* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: #212121;
  color: #ececec;
  height: var(--app-height, 100dvh);
  overflow: hidden;
}

.app-container {
  display: flex;
  height: var(--app-height, 100dvh);
  position: relative;
  overflow: hidden;
}

.panel-toggle {
  position: fixed;
  top: 16px;
  z-index: 1200;
  width: 34px;
  height: 34px;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  background: #2f2f2f;
  color: #ececec;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 0.25s ease, right 0.25s ease, background 0.2s ease;
}

.panel-toggle:hover {
  background: #3f3f3f;
}

.left-toggle {
  left: 272px;
}

.right-toggle {
  right: 212px;
}

body.left-sidebar-collapsed .left-toggle {
  left: 12px;
}

body.right-sidebar-collapsed .right-toggle {
  right: 12px;
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: #171717;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #2f2f2f;
  transition: margin-left 0.25s ease;
}

body.left-sidebar-collapsed .sidebar {
  margin-left: -260px;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #2f2f2f;
}

.new-chat-btn {
  width: 100%;
  padding: 12px;
  background: #2f2f2f;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  color: #ececec;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.new-chat-btn:hover {
  background: #3f3f3f;
}

.sidebar-options {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
}

.sidebar-section-title {
  padding: 10px 16px;
  color: #8e8e8e;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.chat-history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-history-item {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #ececec;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font: inherit;
  font-size: 14px;
  text-align: left;
}

.chat-history-item span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-delete-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #8e8e8e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}

.chat-history-item:hover .chat-delete-btn,
.chat-history-item.active .chat-delete-btn {
  opacity: 1;
}

.chat-delete-btn:hover {
  background: #3f3f3f;
  color: #ececec;
}

.chat-history-item:hover,
.chat-history-item.active {
  background: #2f2f2f;
  border-color: #3f3f3f;
}

.option-item {
  padding: 12px 16px;
  margin: 4px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.option-item:hover {
  background: #2f2f2f;
}

.sidebar-user {
  padding: 16px;
  border-top: 1px solid #2f2f2f;
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
}

.user-info {
  flex: 1;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
}

.user-status {
  font-size: 12px;
  color: #8e8e8e;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(18, 18, 18, 0.86);
  backdrop-filter: blur(8px);
}

.auth-overlay[hidden] {
  display: none;
}

.auth-panel {
  width: min(420px, 100%);
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  background: #1f1f1f;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  padding: 20px;
}

.auth-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.auth-logo {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #ececec;
  color: #171717;
  font-weight: 800;
}

.auth-brand h1 {
  font-size: 20px;
  line-height: 1.2;
}

.auth-brand p {
  margin-top: 3px;
  color: #a8a8a8;
  font-size: 13px;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  background: #171717;
  margin-bottom: 14px;
}

.auth-tab {
  flex: 1;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #a8a8a8;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.auth-tab.active,
.auth-tab:hover {
  background: #2f2f2f;
  color: #ececec;
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.auth-form.active {
  display: flex;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #a8a8a8;
  font-size: 12px;
}

.auth-form input {
  min-height: 40px;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  background: #252525;
  color: #ececec;
  padding: 0 12px;
  font: inherit;
  outline: none;
}

.auth-form input:focus {
  border-color: #6e6e6e;
}

.auth-submit {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: #ececec;
  color: #171717;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.auth-status {
  min-height: 22px;
  margin-top: 12px;
  color: #a8a8a8;
  font-size: 13px;
}

.auth-status.error {
  color: #ff9b9b;
}

.auth-status.loading {
  color: #ececec;
}

body.auth-loading .app-container,
body.auth-required .app-container {
  filter: blur(2px);
  pointer-events: none;
}

.logout-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  background: #252525;
  color: #a8a8a8;
  cursor: pointer;
}

.logout-btn:hover {
  background: #3f3f3f;
  color: #ececec;
}

/* Main Content */
.main-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chat-container {
  min-height: 0;
  width: 100%;
  max-width: 960px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 28px 32px;
}

.chat-container > h1 {
  font-size: 22px;
  line-height: 1.4;
  font-weight: 600;
  margin: 12px 0 24px;
}

.admin-status-bar {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding-right: 48px;
}

.admin-status-bar[hidden] {
  display: none;
}

.health-chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  background: #252525;
  color: #ececec;
  font-size: 12px;
  line-height: 1;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8e8e8e;
  flex: 0 0 auto;
}

.health-label {
  font-weight: 600;
}

.health-detail {
  color: #a8a8a8;
}

.health-chip.status-ok .health-dot {
  background: #49c46d;
}

.health-chip.status-warn .health-dot {
  background: #e0b34f;
}

.health-chip.status-error .health-dot {
  background: #e85d5d;
}

.health-chip.status-off .health-dot {
  background: #6e6e6e;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 40px 0;
}

.quick-action-card {
  background: #2f2f2f;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-action-card:hover {
  background: #3f3f3f;
  border-color: #4f4f4f;
  transform: translateY(-2px);
}

.quick-action-icon {
  font-size: 24px;
  margin-bottom: 12px;
}

.quick-action-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.quick-action-desc {
  font-size: 13px;
  color: #8e8e8e;
}

/* Chat Messages */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.message {
  display: flex;
  gap: 12px;
  min-width: 0;
  align-items: flex-start;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.message.ai .message-avatar {
  background: #244a3b;
  color: #b3e5ce;
  font-size: 12px;
  font-weight: 600;
}

.message.user .message-avatar {
  background: #2f2f2f;
}

.message-content {
  flex: 1;
  padding-top: 4px;
}

.message-text {
  line-height: 1.6;
  font-size: 15px;
}

.message-sources {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #3f3f3f;
}

.message-sources-title {
  color: #a8a8a8;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.message-sources-title::-webkit-details-marker {
  display: none;
}

.message-sources-title::before {
  content: ">";
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s ease;
}

.message-sources[open] .message-sources-title::before {
  transform: rotate(90deg);
}

.message-sources-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.message-source-item {
  padding: 8px;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  background: #252525;
}

.message-source-meta {
  color: #ececec;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}

.message-source-snippet {
  color: #a8a8a8;
  font-size: 12px;
  line-height: 1.4;
}

/* Input Area */
.input-container {
  flex-shrink: 0;
  width: 100%;
  max-width: 960px;
  padding: 16px 32px 24px;
  border-top: 1px solid #2f2f2f;
}

.input-wrapper {
  background: #2f2f2f;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.input-wrapper textarea {
  flex: 1;
  min-height: 48px;
  background: transparent;
  border: none;
  color: #ececec;
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  outline: none;
  font-family: inherit;
  max-height: 220px;
  overflow-y: auto;
}

.input-wrapper textarea::placeholder {
  color: #6e6e6e;
}

.send-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #ececec;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.send-btn:hover {
  opacity: 0.8;
}

.send-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Toolbox */
.toolbox {
  width: 200px;
  min-width: 200px;
  background: #171717;
  border-left: 1px solid #2f2f2f;
  padding: 20px;
  transition: margin-right 0.25s ease;
}

body.right-sidebar-collapsed .toolbox {
  margin-right: -200px;
}

.toolbox-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #8e8e8e;
}

.toolbox-item {
  width: 100%;
  color: inherit;
  font: inherit;
  padding: 12px;
  background: #2f2f2f;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.toolbox-item:hover {
  background: #3f3f3f;
}

.toolbox-item.recording {
  border-color: #ff7070;
  background: #3a2424;
}

.toolbox-item.recording .toolbox-icon {
  color: #ff9b9b;
}

.toolbox-item:disabled {
  opacity: 0.6;
  cursor: wait;
}

.toolbox-status {
  min-height: 34px;
  margin: -4px 0 12px;
  color: #8e8e8e;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.toolbox-status.success {
  color: #8fd19e;
}

.toolbox-status.error {
  color: #ff9b9b;
}

.toolbox-status.loading {
  color: #ececec;
}

.toolbox-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.toolbox-label {
  font-size: 12px;
  color: #ececec;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.68);
}

.modal-backdrop[hidden] {
  display: none;
}

.settings-modal {
  width: min(720px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  background: #1f1f1f;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #2f2f2f;
}

.settings-modal-header h2 {
  font-size: 18px;
  font-weight: 650;
}

.modal-close-btn {
  width: 34px;
  height: 34px;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  background: #2f2f2f;
  color: #ececec;
  cursor: pointer;
}

.modal-close-btn:hover {
  background: #3f3f3f;
}

.settings-section {
  padding: 20px;
  overflow-y: auto;
}

.settings-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.settings-section-header h3 {
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 650;
}

.settings-section-header p {
  color: #a8a8a8;
  font-size: 13px;
  line-height: 1.4;
}

.settings-status {
  min-height: 22px;
  margin-bottom: 12px;
  color: #a8a8a8;
  font-size: 13px;
}

.settings-status.success {
  color: #8fd19e;
}

.settings-status.error {
  color: #ff9b9b;
}

.settings-status.loading {
  color: #ececec;
}

.knowledge-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.knowledge-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  background: #252525;
}

.knowledge-info {
  min-width: 0;
}

.knowledge-title {
  overflow: hidden;
  color: #ececec;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-meta,
.knowledge-key {
  margin-top: 4px;
  color: #a8a8a8;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.knowledge-key {
  color: #777;
}

.knowledge-delete-btn,
.settings-action-btn {
  min-height: 34px;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  background: #2f2f2f;
  color: #ececec;
  cursor: pointer;
}

.knowledge-delete-btn {
  width: 38px;
  flex: 0 0 auto;
}

.settings-action-btn {
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 13px;
}

.knowledge-delete-btn:hover,
.settings-action-btn:hover {
  background: #3f3f3f;
}

.knowledge-delete-btn:disabled,
.settings-action-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.knowledge-empty {
  padding: 14px;
  border: 1px dashed #3f3f3f;
  border-radius: 8px;
  color: #a8a8a8;
  font-size: 13px;
}

.admin-modal {
  width: min(920px, 100%);
}

.settings-modal-header p {
  margin-top: 3px;
  color: #a8a8a8;
  font-size: 13px;
}

.settings-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid #2f2f2f;
  background: #1b1b1b;
}

.settings-tab {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #a8a8a8;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.settings-tab:hover,
.settings-tab.active {
  border-color: #3f3f3f;
  background: #2f2f2f;
  color: #ececec;
}

.settings-content {
  overflow-y: auto;
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
}

.compact-section {
  overflow: visible;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 20px;
}

.admin-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.admin-health-card {
  min-height: 70px;
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  background: #252525;
}

.admin-health-card-dot {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: #8e8e8e;
  flex: 0 0 auto;
}

.admin-health-card.status-ok .admin-health-card-dot,
.integration-value.status-ok::before {
  background: #49c46d;
}

.admin-health-card.status-warn .admin-health-card-dot,
.integration-value.status-warn::before {
  background: #e0b34f;
}

.admin-health-card.status-error .admin-health-card-dot,
.integration-value.status-error::before {
  background: #e85d5d;
}

.admin-health-card.status-off .admin-health-card-dot,
.integration-value.status-off::before {
  background: #6e6e6e;
}

.admin-health-card-body {
  min-width: 0;
}

.admin-health-card-label {
  margin-bottom: 5px;
  color: #ececec;
  font-size: 13px;
  font-weight: 650;
}

.admin-health-card-detail {
  color: #a8a8a8;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.integration-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.integration-row {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid #343434;
  border-radius: 8px;
  background: #252525;
}

.integration-label {
  color: #a8a8a8;
  font-size: 12px;
}

.integration-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ececec;
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

.integration-value::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8e8e8e;
}

.split-actions {
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.inline-status {
  margin: 0;
  flex: 1;
  min-height: 0;
}

.knowledge-item {
  align-items: flex-start;
}

.knowledge-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  background: #2f2f2f;
  color: #ff8e8e;
  flex: 0 0 auto;
}

.knowledge-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.knowledge-meta span {
  padding: 3px 7px;
  border: 1px solid #3f3f3f;
  border-radius: 999px;
  background: #1f1f1f;
  color: #a8a8a8;
}

/* Responsive */
@media (max-width: 1024px) {
  .toolbox {
      position: fixed;
      top: 0;
      right: 0;
      height: var(--app-height, 100dvh);
      z-index: 1000;
  }

  body.right-sidebar-collapsed .toolbox {
      margin-right: -200px;
  }
}

@media (max-width: 768px) {
  .sidebar {
      position: fixed;
      left: 0;
      height: var(--app-height, 100dvh);
      z-index: 1000;
      margin-left: -260px;
  }

  body:not(.left-sidebar-collapsed) .sidebar {
      margin-left: 0;
  }

  .left-toggle {
      left: 12px;
  }

  body:not(.left-sidebar-collapsed) .left-toggle {
      left: 272px;
  }

  .right-toggle {
      right: 12px;
  }

  body:not(.right-sidebar-collapsed) .right-toggle {
      right: 212px;
  }

  .chat-container {
      padding: 10px;
  }

  .quick-actions {
      grid-template-columns: 1fr;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #3f3f3f;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #4f4f4f;
}




/*
TESTING
*/

.message.user {
  justify-content: flex-end; /* User rechts */
}

.message.ai {
  justify-content: flex-start; /* AI links */
}

.bubble {
  padding: 12px 16px;
  border-radius: 8px;
  max-width: calc(100% - 44px);
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.6;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 1; /* dauerhaft sichtbar */
  transform: translateY(0); /* initial nicht verschoben */
}

.message.user .bubble {
  background: #303735;
  color: #f1f5f3;
  max-width: min(80%, 680px);
  align-self: flex-end;
}

.message.ai .bubble {
  background: transparent;
  color: #ececec;
  padding: 0 0 12px;
  flex: 1;
  align-self: flex-start;
}

/* Optional: sanftes Einblenden beim Hinzufügen */
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.new .bubble {
  animation: fadeInUp 0.3s ease forwards;
}
.image-bubble {
  padding: 8px;
  max-width: min(70%, 420px);
}

.image-bubble img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 8px;
}

.image-meta {
  margin-top: 6px;
  color: #bdbdbd;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  margin-bottom: 8px;
}

.message-author {
  font-size: 12px;
  font-weight: 600;
  color: #b9c6c0;
}

.message-copy-status {
  margin-left: auto;
  font-size: 11px;
  color: #b9c6c0;
  overflow-wrap: anywhere;
}

.message-copy-btn {
  position: relative;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #b9c6c0;
  cursor: pointer;
}

.message-copy-btn:hover,
.message-copy-btn:focus-visible {
  background: #3a4240;
  color: #fff;
  border-color: #647c70;
}

.message-copy-btn:hover::after,
.message-copy-btn:focus-visible::after {
  content: attr(aria-label);
  position: absolute;
  right: 0;
  bottom: calc(100% + 4px);
  background: #101412;
  color: #fff;
  padding: 5px 8px;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 11px;
  z-index: 5;
}

.message.user .message-text {
  white-space: pre-wrap;
}

.message-text > :first-child { margin-top: 0; }
.message-text > :last-child { margin-bottom: 0; }
.message-text p { margin: 0 0 12px; }
.message-text ul,
.message-text ol { margin: 12px 0; padding-left: 24px; }
.message-text li { margin: 6px 0; }
.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4,
.message-text h5,
.message-text h6 { font-size: 17px; line-height: 1.4; margin: 20px 0 10px; }
.message-text a { color: #9edbc1; text-underline-offset: 3px; }
.message-text blockquote { margin: 12px 0; padding-left: 16px; border-left: 3px solid #647c70; color: #b9c6c0; }
.message-text pre { max-width: 100%; overflow-x: auto; padding: 14px; margin: 12px 0; background: #161a18; border: 1px solid #3b4540; border-radius: 6px; }
.message-text code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; background: #161a18; padding: 2px 5px; border-radius: 3px; }
.message-text pre code { padding: 0; white-space: pre; overflow-wrap: normal; }
.message-table-scroll { max-width: 100%; overflow-x: auto; margin: 12px 0; }
.message-text table { border-collapse: collapse; width: 100%; }
.message-text th,
.message-text td { padding: 8px 12px; border: 1px solid #3b4540; text-align: left; }
.input-wrapper:focus-within { border-color: #719d89; }

@media (max-width: 768px) {
  .chat-container { padding: 48px 16px 16px; }
  .chat-container > h1 { margin-top: 0; }
  .message { gap: 8px; }
  .message-avatar { width: 26px; height: 26px; font-size: 12px; }
  .bubble { max-width: calc(100% - 34px); padding: 10px 12px; }
  .message.user .bubble { max-width: calc(100% - 34px); }
  .message-copy-btn { width: 40px; height: 40px; flex-basis: 40px; }
}


.call-log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.call-log-item {
  padding: 12px;
  border: 1px solid #343434;
  border-radius: 8px;
  background: #242424;
}

.call-log-item.status-error {
  border-color: #7a3434;
}

.call-log-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.call-log-title {
  color: #ececec;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.call-log-meta,
.call-log-event {
  color: #8f8f8f;
  font-size: 12px;
}

.call-log-turns {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.call-log-line {
  padding: 7px 9px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.call-log-line.customer {
  background: #303030;
  color: #f1f1f1;
}

.call-log-line.assistant {
  background: #26322d;
  color: #d9f2e4;
}

.call-log-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.proxmox-admin-panel {
  margin-top: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  padding-top: 16px;
}

.compact-header {
  margin-bottom: 10px;
}

.proxmox-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  margin-top: 12px;
}

.proxmox-form input {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  color: #e5e7eb;
  padding: 10px 12px;
}

.proxmox-server-list {
  display: grid;
  gap: 8px;
}

.proxmox-server-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.5);
}

.proxmox-server-title {
  color: #f8fafc;
  font-weight: 700;
}

.proxmox-server-meta {
  color: #94a3b8;
  font-size: 0.86rem;
  margin-top: 2px;
}

@media (max-width: 920px) {
  .proxmox-form {
    grid-template-columns: 1fr;
  }
}


/* Mobile touch safety */
@media (max-width: 768px) {
  body.left-sidebar-collapsed .sidebar,
  body.right-sidebar-collapsed .toolbox {
    pointer-events: none;
  }

  .main-content {
    min-width: 0;
  }

  .input-container {
    max-width: none;
    padding: 12px 12px max(12px, env(safe-area-inset-bottom));
  }

  .input-wrapper textarea {
    min-height: 52px;
    min-width: 0;
    font-size: 16px;
    resize: none;
  }
}
