/* ==========================================================================
   Audio Orb — Styles (Dashboard Version)
   ========================================================================== */

/* --- Tool Names Tooltip --- */
.tools-names-tooltip {
  position: fixed;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  font-size: 12px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  color: #0f172a;
  min-width: 520px;
  max-width: 640px;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

.tools-names-tooltip.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.tools-names-content {
  line-height: 1.6;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 12px;
  align-items: stretch;
}

.tools-names-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-family: inherit;
  font-weight: 700;
  color: rgba(15, 23, 42, 0.8);
}

#tools-copy-btn {
  border: 1px solid rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.1);
  color: rgba(15, 23, 42, 0.8);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

#tools-copy-btn:hover {
  background: rgba(139, 92, 246, 0.18);
}

.tools-name-list {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.9);
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
}

.tools-name-group {
  margin-bottom: 8px;
}

.tools-name-group:last-child {
  margin-bottom: 0;
}

.tools-name-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(15, 23, 42, 0.45);
  padding: 4px 6px 2px;
}

.tools-name-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: rgba(15, 23, 42, 0.8);
  padding: 5px 6px;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.tools-name-item:hover,
.tools-name-item:focus {
  background: rgba(139, 92, 246, 0.14);
  outline: none;
}

.tools-name-description {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  color: rgba(15, 23, 42, 0.78);
  white-space: normal;
  min-height: 80px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #f1f5f9;
  color: #0f172a;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
}

body.mode-users {
  overflow: auto;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   USER SELECTION SCREEN
   ========================================================================== */
#user-selection-screen {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f8fafc;
  background-image:
    radial-gradient(at 40% 20%, hsla(28, 100%, 74%, 0.8) 0px, transparent 50%),
    radial-gradient(at 80% 0%, hsla(189, 100%, 76%, 0.8) 0px, transparent 50%),
    radial-gradient(at 0% 50%, hsla(355, 100%, 93%, 0.8) 0px, transparent 50%),
    radial-gradient(at 80% 50%, hsla(340, 100%, 86%, 0.8) 0px, transparent 50%),
    radial-gradient(at 0% 100%, hsla(22, 100%, 77%, 0.8) 0px, transparent 50%),
    radial-gradient(at 80% 100%, hsla(242, 100%, 80%, 0.8) 0px, transparent 50%),
    radial-gradient(at 0% 0%, hsla(343, 100%, 86%, 0.8) 0px, transparent 50%);
  padding: 40px 20px;
}

.user-selection-container {
  width: 520px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: rgba(255, 255, 255, 0.45);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  padding: 40px;
  border-radius: 24px;
}

.user-selection-header {
  text-align: center;
}

.user-selection-header h1 {
  font-size: 32px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.user-selection-header .subtitle {
  font-size: 14px;
  color: rgba(15, 23, 42, 0.45);
  font-weight: 400;
}

/* --- Create User Form --- */
.create-user-section {
  width: 100%;
}

#create-user-form {
  display: flex;
  gap: 10px;
}

#new-user-name {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.06);
  color: #0f172a;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

#new-user-name::placeholder {
  color: rgba(15, 23, 42, 0.3);
}

#new-user-name:focus {
  border-color: rgba(139, 92, 246, 0.6);
  background: rgba(139, 92, 246, 0.1);
}

#create-user-btn {
  padding: 14px 22px;
  border: 2px dashed rgba(139, 92, 246, 0.4);
  border-radius: 12px;
  background: #f1f5f9;
  color: rgba(167, 139, 250, 0.95);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

#create-user-btn:hover {
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.6);
  color: #0f172a;
}

#create-user-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- User List --- */
.user-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.15) transparent;
}

.user-card {
  padding: 16px 20px;
  background: #ffffff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.025);
  border: 1px solid rgba(15, 23, 42, 0.05);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.user-card:hover {
  background: #ffffff;
  box-shadow: 0 10px 25px -3px rgba(139, 92, 246, 0.15), 0 4px 6px -4px rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.1);
}

.user-card-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-card-name {
  font-size: 18px;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.92);
}

.user-card-actions {
  display: flex;
  gap: 4px;
}

.user-card-edit,
.user-card-delete {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  padding: 6px 10px;
  border-radius: 8px;
}

.user-card:hover .user-card-edit,
.user-card:hover .user-card-delete {
  opacity: 0.6;
}

.user-card-edit:hover {
  opacity: 1 !important;
  background: rgba(15, 23, 42, 0.08);
}

.user-card-delete:hover {
  opacity: 1 !important;
  background: rgba(239, 68, 68, 0.15);
}

.user-card-meta {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.35);
  display: flex;
  gap: 16px;
}

.user-loading,
.user-empty {
  color: rgba(15, 23, 42, 0.35);
  text-align: center;
  padding: 40px 0;
  font-size: 14px;
}

.user-empty {
  font-style: italic;
}

/* ==========================================================================
   START MODAL
   ========================================================================== */
#start-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: fadeIn 0.3s ease;
}

#start-modal.hidden {
  display: none;
}

.start-modal-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.start-modal-icon {
  font-size: 64px;
  line-height: 1;
}

.start-modal-content h2 {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
}

.start-modal-content p {
  font-size: 15px;
  color: rgba(15, 23, 42, 0.5);
  max-width: 320px;
}

#start-modal-btn {
  margin-top: 12px;
  padding: 18px 48px;
  border: 2px solid rgba(139, 92, 246, 0.6);
  border-radius: 16px;
  background: rgba(139, 92, 246, 0.2);
  color: #0f172a;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

#start-modal-btn:hover {
  background: rgba(139, 92, 246, 0.35);
  border-color: rgba(139, 92, 246, 0.8);
  transform: scale(1.03);
}

#start-modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================================
   DASHBOARD
   ========================================================================== */
#dashboard {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f1f5f9;
  background: #f8fafc;
}

/* --- Dashboard Header --- */
#dashboard-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

#back-to-users {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.1);
  color: rgba(15, 23, 42, 0.75);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

#back-to-users:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.3);
  color: #0f172a;
}

#back-to-users svg {
  flex-shrink: 0;
}

#current-user-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.2);
  font-size: 14px;
  font-weight: 500;
  color: rgba(200, 180, 255, 0.9);
  flex-shrink: 0;
}

#tools-names-btn {
  margin-left: 8px;
  width: auto;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(139, 92, 246, 0.28);
  background: rgba(255, 255, 255, 0.45);
  color: rgba(15, 23, 42, 0.75);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

#tools-names-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.45);
  color: #0f172a;
}

.badge-icon {
  font-size: 14px;
}

.badge-name {
  letter-spacing: 0.2px;
}

/* --- Dashboard Controls (in header) --- */
#dashboard-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

#dashboard-controls button,
.icon-btn {
  outline: none;
  border: 1px solid rgba(15, 23, 42, 0.15);
  color: white;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.08);
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

#dashboard-controls button:hover,
.icon-btn:hover {
  background: rgba(15, 23, 42, 0.15);
}

#dashboard-controls button[disabled],
.icon-btn[disabled] {
  display: none;
}

#status {
  font-size: 13px;
  color: rgba(15, 23, 42, 0.5);
  white-space: nowrap;
}

/* --- Mobile Tab Bar --- */
#mobile-tabs {
  display: none;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.mobile-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: none;
  color: rgba(15, 23, 42, 0.4);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
}

.mobile-tab.active {
  color: rgba(167, 139, 250, 0.95);
  border-bottom-color: rgba(139, 92, 246, 0.6);
}

.mobile-tab:hover {
  color: rgba(15, 23, 42, 0.7);
}

/* --- Dashboard Columns --- */
#dashboard-columns {
  display: grid;
  grid-template-columns: 1.5fr 1fr 0.7fr 0.8fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.dashboard-col {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid rgba(15, 23, 42, 0.06);
}

.col-resizer-handle {
  position: absolute;
  top: 0;
  right: -3px;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 10;
  background-color: transparent;
  transition: background-color 0.2s ease;
}

.col-resizer-handle:hover,
.col-resizer-handle.dragging {
  background-color: rgba(139, 92, 246, 0.6);
}

.dashboard-col:last-child {
  border-right: none;
}

.col-header {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(15, 23, 42, 0.4);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  flex-shrink: 0;
  background: linear-gradient(to right, rgba(248, 250, 252, 0), rgba(248, 250, 252, 0.8) 10%, rgba(248, 250, 252, 0.8) 90%, rgba(248, 250, 252, 0));
}

.col-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.15) transparent;
}

.col-body::-webkit-scrollbar {
  width: 4px;
}

.col-body::-webkit-scrollbar-track {
  background: transparent;
}

.col-body::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.15);
  border-radius: 2px;
}

/* ==========================================================================
   CONVERSATION CONTROLS (Column 1 footer)
   ========================================================================== */
#convo-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

#convo-controls.hidden {
  display: none;
}

.convo-ctrl-btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid;
}

.convo-ctrl-btn.hidden {
  display: none;
}

.stop-btn {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.stop-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
}

.continue-btn {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.continue-btn:hover {
  background: rgba(34, 197, 94, 0.25);
  border-color: rgba(34, 197, 94, 0.5);
}

/* ==========================================================================
   TRANSCRIPT (Column 1)
   ========================================================================== */
#transcript-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.transcript-msg {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  max-width: 90%;
  word-wrap: break-word;
  animation: fadeIn 0.2s ease;
}

.transcript-msg.user {
  align-self: flex-end;
  background: #eff6ff;
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #1e3a8a;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.05);
}

.transcript-msg.ai {
  align-self: flex-start;
  background: #f5f3ff;
  border: 1px solid rgba(139, 92, 246, 0.2);
  color: #4c1d95;
  box-shadow: 0 2px 4px rgba(139, 92, 246, 0.05);
}

.transcript-msg .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
  display: block;
}

.transcript-msg.user .label {
  color: #3b82f6;
}

.transcript-msg.ai .label {
  color: #8b5cf6;
}

.transcript-msg.tool {
  align-self: center;
  background: rgba(245, 158, 11, 0.08);
  border: 1px dashed rgba(245, 158, 11, 0.3);
  color: rgba(15, 23, 42, 0.6);
  font-size: 12px;
  padding: 4px 12px;
  max-width: 90%;
}

.transcript-msg.tool .label {
  color: #d97706;
  font-size: 10px;
}

.transcript-msg.tool .text {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 11px;
  color: rgba(15, 23, 42, 0.55);
}

.transcript-msg.tool.tool-result {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.25);
}

.transcript-msg.tool.tool-result .label {
  color: #059669;
}

.transcript-msg.tool.tool-error {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.25);
}

.transcript-msg.tool.tool-error .label {
  color: #dc2626;
}

/* ==========================================================================
   FILE EDITORS (Columns 2 & 3)
   ========================================================================== */
.file-editor {
  margin-bottom: 12px;
}

.file-nav-section {
  margin-bottom: 16px;
}

.file-nav-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-nav-btn {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  background: #fff;
  color: rgba(15, 23, 42, 0.75);
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-nav-btn:hover {
  border-color: rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.08);
}

.file-nav-btn.active {
  border-color: rgba(139, 92, 246, 0.45);
  background: rgba(139, 92, 246, 0.14);
  color: rgba(15, 23, 42, 0.92);
}

.file-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.file-editor-header:hover {
  background: rgba(139, 92, 246, 0.08);
}

.file-editor-header label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.6);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  cursor: pointer;
}

.save-status {
  font-size: 12px;
  font-weight: 600;
  color: #4ade80;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.save-status.visible {
  opacity: 1;
}

.save-status.error {
  color: #f87171;
}

.file-textarea {
  display: none;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.05);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.025);
  color: rgba(15, 23, 42, 0.85);
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  line-height: 1.6;
  resize: none;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.15) transparent;
}

body.preview-textareas .file-editor:not(.expanded) .file-textarea:not(#textarea-tasks-datenbank) {
  display: block;
  height: calc(1.6em * 3 + 20px);
  overflow: hidden;
}

body.preview-textareas .file-editor:not(.expanded) #textarea-tasks-datenbank {
  display: block;
}

.file-editor-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(15, 23, 42, 0.45);
  padding: 14px 4px 6px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  margin-top: 4px;
}
.file-editor-section-label:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: 4px;
}

.file-editor.expanded .file-textarea {
  display: block;
}

.single-editor {
  height: 100%;
  margin-bottom: 0;
}

.single-editor .file-textarea {
  min-height: calc(100vh - 260px);
  padding: 14px 16px;
}

.single-editor.markdown-preview-mode .file-textarea {
  display: none;
}

.single-editor.markdown-preview-mode .markdown-toolbar {
  display: none;
}

.markdown-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.md-btn {
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: rgba(255, 255, 255, 0.9);
  color: rgba(15, 23, 42, 0.78);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1.2;
  font-family: inherit;
  cursor: pointer;
}

.md-btn:hover {
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(139, 92, 246, 0.35);
}

.markdown-preview {
  display: block;
  width: 100%;
  min-height: calc(100vh - 260px);
  padding: 14px 16px;
  border: 1px solid rgba(15, 23, 42, 0.05);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.025);
  color: rgba(15, 23, 42, 0.85);
  line-height: 1.65;
  overflow-y: auto;
}

.markdown-preview.hidden {
  display: none;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3 {
  margin: 14px 0 8px;
}

.markdown-preview p,
.markdown-preview ul,
.markdown-preview ol,
.markdown-preview pre {
  margin: 8px 0;
}

.markdown-preview ul,
.markdown-preview ol {
  padding-left: 1.4rem;
}

.markdown-preview code {
  background: rgba(15, 23, 42, 0.08);
  padding: 1px 4px;
  border-radius: 4px;
}

.markdown-preview pre code {
  display: block;
  padding: 10px;
  overflow-x: auto;
}

.file-textarea::placeholder {
  color: rgba(15, 23, 42, 0.2);
}

.file-textarea:focus {
  border-color: rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.06);
}

/* Remove forced min height for start.md */
/* .file-editor[data-file="start.md"] .file-textarea {
  min-height: 160px;
} */

.pin-btn {
  display: inline-block;
  font-size: 13px;
  cursor: pointer;
  opacity: 0.3;
  transition: all 0.2s ease;
  user-select: none;
}

.pin-btn:hover {
  opacity: 0.8;
  transform: scale(1.1);
}

.file-editor.pinned .pin-btn {
  opacity: 1;
  text-shadow: 0 0 8px rgba(167, 139, 250, 0.8);
}

/* --- Maximize Button (on hover) --- */
.maximize-btn {
  display: none;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.4;
  transition: all 0.2s ease;
  user-select: none;
  padding: 0 4px;
  line-height: 1;
  margin-left: 6px;
  flex-shrink: 0;
}

.file-editor-header:hover .maximize-btn {
  display: inline-block;
}

.maximize-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

/* --- Maximize Modal --- */
.maximize-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 32px;
  animation: fadeIn 0.2s ease;
}

.maximize-modal.hidden {
  display: none;
}

.maximize-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.maximize-modal-title {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.maximize-modal-close {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
  font-size: 22px;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.maximize-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.maximize-modal-textarea {
  flex: 1;
  width: 100%;
  padding: 16px 20px;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 14px;
  background: #ffffff;
  color: rgba(15, 23, 42, 0.85);
  font-size: 14px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  line-height: 1.7;
  resize: none;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.15) transparent;
}

.maximize-modal-textarea:focus {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* --- RTT Display (in conversation column header) --- */
#rtt-display {
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.5);
  min-width: 60px;
  text-align: right;
  transition: color 0.3s ease;
}

#rtt-display.rtt-good { color: #22c55e; }
#rtt-display.rtt-ok { color: #eab308; }
#rtt-display.rtt-slow { color: #ef4444; }

/* --- RTT Log Modal --- */
.rtt-log-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(680px, 92vw);
  max-height: 80vh;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(139, 92, 246, 0.15);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rtt-log-modal.hidden { display: none; }

.rtt-log-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.rtt-log-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}

.rtt-log-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: rgba(15, 23, 42, 0.4);
  padding: 0 4px;
  line-height: 1;
}

.rtt-log-modal-close:hover { color: #0f172a; }

.rtt-log-content {
  flex: 1;
  overflow: auto;
  padding: 16px 20px;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  line-height: 1.8;
  color: rgba(15, 23, 42, 0.75);
  white-space: pre-wrap;
  word-break: break-all;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.15) transparent;
  margin: 0;
}

/* --- Tooltip Icons (System Prompt & Push) --- */
.sysprompt-icon,
.push-icon {
  position: relative;
  vertical-align: middle;
  margin-right: 2px;
  cursor: help;
}

.sysprompt-icon {
  color: #4ade80;
  font-size: 10px;
}

.push-icon {
  color: #facc15;
  font-size: 12px;
}

/* Custom Tooltip Shared Styles */
.sysprompt-icon::after,
.push-icon::after {
  content: attr(data-title);
  position: absolute;
  bottom: 180%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: #ffffff;
  color: #0f172a;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(15, 23, 42, 0.15);
  z-index: 1000;
  text-transform: none;
  letter-spacing: normal;
}

/* Tooltip Arrow Shared Styles */
.sysprompt-icon::before,
.push-icon::before {
  content: "";
  position: absolute;
  bottom: 155%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  border-width: 6px;
  border-style: solid;
  border-color: #1f1a27 transparent transparent transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}

.sysprompt-icon:hover::after,
.sysprompt-icon:hover::before,
.push-icon:hover::after,
.push-icon:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* --- Push Dynamic Input --- */
.push-editor .file-textarea {
  border-color: rgba(250, 204, 21, 0.2);
  background: rgba(250, 204, 21, 0.04);
}

.push-editor .file-textarea:focus {
  border-color: rgba(250, 204, 21, 0.4);
  background: rgba(250, 204, 21, 0.08);
}

.push-status {
  font-size: 12px;
  font-weight: 600;
  color: #facc15;
  opacity: 0;
  transition: opacity 0.3s ease;
  margin-right: 6px;
}

.push-status.visible {
  opacity: 1;
}

/* ==========================================================================
   PAST CONVERSATIONS (Column 4)
   ========================================================================== */
#past-convo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.convo-item {
  position: relative;
  padding: 10px 12px;
  background: #ffffff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.025);
  border: 1px solid rgba(15, 23, 42, 0.05);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.convo-delete {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(15, 23, 42, 0.4);
  opacity: 0;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 6px;
}

.convo-item:hover .convo-delete {
  opacity: 1;
}

.convo-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.convo-item:hover {
  background: rgba(15, 23, 42, 0.08);
  border-color: rgba(139, 92, 246, 0.4);
  transform: translateY(-1px);
}

.convo-item .convo-topic {
  font-size: 14px;
  font-weight: 600;
  color: rgba(15, 23, 42, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.convo-item .convo-meta {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.4);
  display: flex;
  gap: 10px;
}

.convo-loading {
  color: rgba(15, 23, 42, 0.4);
  text-align: center;
  padding: 30px;
  font-size: 14px;
}

.convo-empty {
  color: rgba(15, 23, 42, 0.3);
  text-align: center;
  padding: 30px 0;
  font-size: 14px;
  font-style: italic;
}

/* --- App Content Wrapper --- */
#app-content {
  width: 100%;
  height: 100%;
}

/* ==========================================================================
   RESPONSIVE — Tabs on mobile (≤ 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  #mobile-tabs {
    display: flex;
  }

  #dashboard-columns {
    display: flex;
    flex: 1;
    min-height: 0;
  }

  .dashboard-col {
    display: none;
    flex: 1;
    min-height: 0;
  }

  .dashboard-col.active-tab {
    display: flex;
  }

  #dashboard-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  #dashboard-controls {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }
}