/* Ensure HTML `hidden` attribute always wins regardless of display rules */
[hidden] { display: none !important; }

/* ── Shell ───────────────────────────────────────────────────────── */
#login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg);
}
.login-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem 2.5rem; width: min(400px, 90vw);
}
.login-box h1 { margin-bottom: 1.5rem; text-align: center; }
.login-box form { display: flex; flex-direction: column; gap: 0.75rem; }
.login-box input {
  padding: 0.6rem 0.75rem; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 0.875rem;
  background: var(--bg); color: var(--text);
}
.login-box input:focus { outline: none; border-color: var(--primary); }
.login-box button[type="submit"] {
  padding: 0.65rem; background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 600; cursor: pointer;
}
.login-box button[type="submit"]:hover { background: var(--primary-hover); }
.error-msg { color: var(--error-text); font-size: 0.8rem; margin: 0; }

#app-header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 1.5rem; display: flex; align-items: center; gap: 1.5rem; height: 56px;
  position: sticky; top: 0; z-index: 40;
}
.app-logo { font-weight: 700; font-size: 1rem; flex: 0 0 auto; }
.tab-nav { display: flex; gap: 0.25rem; flex: 1; }
.tab-btn {
  padding: 0.4rem 1rem; border: none; background: none;
  border-radius: var(--radius); font-size: 0.875rem; cursor: pointer; color: var(--muted);
}
.tab-btn:hover { background: var(--bg); color: var(--text); }
.tab-btn.active { background: var(--bg); color: var(--primary); font-weight: 600; }
.user-area { display: flex; align-items: center; gap: 0.75rem; font-size: 0.875rem; color: var(--muted); }
#logout-btn {
  padding: 0.35rem 0.75rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: none; font-size: 0.8rem; cursor: pointer; color: var(--muted);
}
#logout-btn:hover { border-color: var(--error-border); color: var(--error-text); }
.tab-panel { padding: 1.5rem; }
#tab-projects { max-width: 1100px; margin: 0 auto; }

.burger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: none;
  cursor: pointer;
  margin-left: auto;
}
.burger-btn span {
  display: block;
  width: 18px; height: 2px;
  background: var(--text);
  border-radius: 1px;
}
.nav-divider { display: none; border: none; border-top: 1px solid var(--border); margin: 0.5rem 0; }
.mobile-nav-panel { display: contents; }

@media (max-width: 768px) {
  .burger-btn { display: flex; }
  .mobile-nav-panel { display: none; }
  #app-header.nav-open .mobile-nav-panel {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 56px; left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
    padding: 0.5rem 1rem 1rem;
    z-index: 900;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
  }
  #app-header.nav-open .tab-nav,
  #app-header.nav-open .user-area {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    width: 100%;
  }
  #app-header.nav-open .nav-divider { display: block; }
  #app-header.nav-open .tab-btn {
    text-align: left;
    padding: 0.75rem 0.85rem;
    width: 100%;
    background: var(--bg);
    border-radius: var(--radius);
  }
  #app-header.nav-open .tab-btn.active { background: var(--primary); color: #fff; }
}
/* ── End Shell ───────────────────────────────────────────────────── */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --error-bg: #fef2f2;
  --error-border: #fca5a5;
  --error-text: #dc2626;
  --warning-bg: #fefce8;
  --warning-border: #fde047;
  --warning-text: #854d0e;
  --warn-bg: #fef3c7;
  --warn-border: #f59e0b;
  --radius: 8px;
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

main {
  max-width: 720px;
  margin: 2.5rem auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; }

/* CUDA warning */
#cuda-warning {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}

/* Drop zone */
#drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

#drop-zone:hover,
#drop-zone.drag-over {
  border-color: var(--primary);
  background: #eff6ff;
}

.drop-label { font-size: 1rem; color: var(--text); margin-bottom: 0.25rem; }
.drop-hint  { color: var(--muted); font-size: 0.875rem; }
.drop-formats { color: var(--muted); font-size: 0.75rem; margin-top: 0.5rem; }

/* Error */
#error-section {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  color: var(--error-text);
  font-size: 0.875rem;
}

/* Progress */
.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.progress-track {
  background: var(--border);
  border-radius: 9999px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

#progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 9999px;
  width: 0%;
  transition: width 0.4s ease;
}

#current-segment {
  font-size: 0.875rem;
  color: var(--muted);
  font-style: italic;
  min-height: 1.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Preview */
#preview-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 320px;
  overflow-y: auto;
}

#preview:empty::before {
  content: 'La transcription apparaîtra ici en temps réel…';
  color: var(--muted);
  font-size: 0.875rem;
  padding: 1rem;
  display: block;
}

.segment {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.6;
}

.segment:last-child { border-bottom: none; }

.ts {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: monospace;
  margin-right: 0.5rem;
}

/* Download */
#download-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.download-buttons { display: flex; gap: 0.75rem; }

.btn {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: background 0.15s;
}

.btn:hover { background: var(--primary-hover); }

.dl-btn { display: inline-block; }

@media (max-width: 480px) {
  .download-buttons { flex-direction: column; }
  .btn { text-align: center; }
}

/* Model loading overlay */
#model-overlay {
  position: fixed;
  inset: 0;
  background: rgba(248, 250, 252, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#model-overlay.hidden { display: none; }

#model-overlay-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2.5rem;
  width: min(400px, 90vw);
  text-align: center;
}

#model-overlay-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

#model-overlay-box .progress-track {
  margin-bottom: 0.75rem;
}

#model-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 9999px;
  width: 0%;
  transition: width 0.5s ease;
}

#model-overlay-msg {
  font-size: 0.875rem;
  color: var(--muted);
  min-height: 1.25rem;
}

/* Prompt section */
#prompt-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

#prompt-toggle {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#prompt-toggle::before {
  content: "▶";
  font-size: 0.6rem;
  transition: transform 0.15s;
}

#prompt-section[open] #prompt-toggle::before {
  transform: rotate(90deg);
}

#prompt-body {
  padding: 0 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.prompt-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.prompt-row label {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.prompt-select-wrap {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

#prompt-select {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text);
}

#prompt-delete-btn {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--error-border);
  border-radius: var(--radius);
  background: var(--error-bg);
  color: var(--error-text);
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

#prompt-delete-btn:hover { background: #fee2e2; }

#prompt-text {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: inherit;
  resize: vertical;
  background: var(--bg);
  color: var(--text);
}

#prompt-text:focus {
  outline: none;
  border-color: var(--primary);
}

.prompt-save-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

#prompt-save-btn {
  white-space: nowrap;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

#prompt-save-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

#prompt-name-input {
  flex: 1;
  min-width: 120px;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text);
}

#prompt-name-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* ── Transcript module class aliases ─────────────────────────────── */
.drop-zone-card {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  transition: border-color .15s, background .15s;
  user-select: none;
}
.drop-zone-card:hover, .drop-zone-card.drag-over {
  border-color: var(--primary);
  background: #eff6ff;
}
.drop-zone-card.file-selected {
  border-color: var(--primary);
  background: #f0fdf4;
}
.drop-zone-card.file-selected .drop-label {
  color: var(--primary);
  font-weight: 600;
}
.prompt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.prompt-toggle {
  padding: .75rem 1rem;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.prompt-toggle::before {
  content: "▶";
  font-size: .6rem;
  transition: transform .15s;
}
details[open] .prompt-toggle::before { transform: rotate(90deg); }
.prompt-body {
  padding: 0 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.prompt-body textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  font-family: inherit;
  resize: vertical;
  background: var(--bg);
  color: var(--text);
}
.prompt-body textarea:focus { outline: none; border-color: var(--primary); }
.prompt-body select {
  flex: 1;
  min-width: 0;
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  background: var(--bg);
  color: var(--text);
}
.prompt-body input[type="text"] {
  flex: 1;
  min-width: 120px;
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  background: var(--bg);
  color: var(--text);
}
.prompt-body input[type="text"]:focus { outline: none; border-color: var(--primary); }
.error-card {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  color: var(--error-text);
  font-size: .875rem;
}
.preview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 320px;
  overflow-y: auto;
}
.preview-card > div:empty::before {
  content: 'La transcription apparaîtra ici en temps réel…';
  color: var(--muted);
  font-size: .875rem;
  padding: 1rem;
  display: block;
}
.download-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.model-overlay-inline {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}
.model-overlay-box { /* inner box, no extra chrome needed */ }
.btn-secondary {
  white-space: nowrap;
  padding: .35rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-del {
  padding: .35rem .75rem;
  border: 1px solid var(--error-border);
  border-radius: var(--radius);
  background: var(--error-bg);
  color: var(--error-text);
  font-size: .8rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn-del:hover { background: #fee2e2; }

/* Progress bar fill (used by both transcript and model bars) */
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 9999px;
  width: 0%;
  transition: width .4s ease;
}
/* ── End Transcript module aliases ───────────────────────────────── */

/* ── Todo ──────────────────────────────────────────────────────────── */
.todo-toolbar { display: flex; gap: .5rem; margin-bottom: 1.5rem; align-items: center; flex-wrap: wrap; }
.view-btn { padding: .35rem .85rem; border: 1px solid var(--border); border-radius: var(--radius); background: none; font-size: .8rem; cursor: pointer; color: var(--muted); }
.view-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.todo-main { display: flex; gap: 1.5rem; }
.todo-list-area { flex: 1; min-width: 0; }

/* Activity / Project tree */
.activity-group { margin-bottom: 1.25rem; }
.activity-header { display: flex; align-items: center; gap: .5rem; cursor: pointer; padding: .35rem 0; user-select: none; }
.activity-chevron { font-size: .85rem; color: var(--muted); transition: transform .2s; flex: 0 0 auto; }
.activity-chevron.collapsed { transform: rotate(-90deg); }
.activity-stats { display: flex; align-items: center; gap: .3rem; font-size: .75rem; color: var(--muted); font-weight: 400; }
.activity-stat-sep { opacity: .5; }
.activity-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.activity-name { font-weight: 700; font-size: .95rem; }
.activity-actions { margin-left: auto; display: flex; gap: .25rem; opacity: 0; }
.activity-header:hover .activity-actions { opacity: 1; }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--muted); font-size: .8rem; padding: .15rem .35rem; border-radius: 4px; }
.icon-btn:hover { background: var(--bg); color: var(--text); }

.project-group { margin-left: 1.25rem; margin-top: .4rem; border-left: 2px solid var(--border); padding-left: .875rem; }
.project-header { display: flex; align-items: center; gap: .5rem; cursor: pointer; padding: .25rem 0; user-select: none; }
.project-chevron { font-size: .8rem; color: var(--muted); transition: transform .2s; flex: 0 0 auto; }
.project-chevron.collapsed { transform: rotate(-90deg); }
.project-body { margin-top: .3rem; }
.project-name { font-size: .875rem; font-weight: 600; }
.project-progress-wrap { flex: 1; display: flex; align-items: center; gap: .4rem; max-width: 140px; }
.project-progress-track { flex: 1; height: 5px; background: var(--border); border-radius: 9999px; overflow: hidden; }
.project-progress-bar { height: 100%; background: var(--primary); border-radius: 9999px; transition: width .3s; }
.project-progress-label { font-size: .7rem; color: var(--muted); white-space: nowrap; }
.project-actions { margin-left: auto; display: flex; gap: .25rem; opacity: 0; }
.project-header:hover .project-actions { opacity: 1; }

.task-list { margin-top: .25rem; }
.task-row { display: flex; align-items: center; gap: .5rem; padding: .4rem .5rem; border-radius: 6px; cursor: pointer; font-size: .875rem; }
.task-row:hover { background: var(--bg); }
.task-row.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-check { width: 16px; height: 16px; border: 1.5px solid var(--border); border-radius: 4px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; cursor: pointer; }
.task-check.checked { background: var(--primary); border-color: var(--primary); color: #fff; font-size: 10px; }
.task-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.priority-badge { font-size: .7rem; padding: .1rem .3rem; border-radius: 4px; font-weight: 600; flex: 0 0 auto; }
.priority-low    { background: #f0fdf4; color: #16a34a; }
.priority-medium { background: #eff6ff; color: #2563eb; }
.priority-high   { background: #fff7ed; color: #ea580c; }
.priority-urgent { background: #fef2f2; color: #dc2626; }
.task-meta { color: var(--muted); font-size: .72rem; white-space: nowrap; }

/* Task detail panel */
.task-panel { position: fixed; right: 0; top: 56px; bottom: 0; width: min(380px, 100vw); background: var(--surface); border-left: 1px solid var(--border); padding: 1.5rem; overflow-y: auto; transform: translateX(100%); transition: transform .2s ease; z-index: 50; box-shadow: -4px 0 16px rgba(0,0,0,.06); }
.task-panel.open { transform: translateX(0); }
.panel-close { position: absolute; top: .875rem; right: .875rem; background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--muted); padding: .25rem .4rem; border-radius: 4px; }
.panel-close:hover { background: var(--bg); }
.panel-title { font-weight: 700; font-size: 1rem; margin-bottom: 1.25rem; padding-right: 1.5rem; }
.form-field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .875rem; }
.form-field label { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.form-field input, .form-field select, .form-field textarea { padding: .5rem .65rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: .875rem; background: var(--bg); color: var(--text); font-family: inherit; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: none; border-color: var(--primary); }
.panel-actions { display: flex; gap: .5rem; margin-top: 1.25rem; flex-wrap: wrap; }
.btn-primary { padding: .45rem 1rem; background: var(--primary); color: #fff; border: none; border-radius: var(--radius); font-size: .875rem; font-weight: 600; cursor: pointer; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { padding: .45rem 1rem; background: none; border: 1px solid var(--border); border-radius: var(--radius); font-size: .875rem; cursor: pointer; color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger-sm { padding: .45rem 1rem; background: var(--error-bg); color: var(--error-text); border: 1px solid var(--error-border); border-radius: var(--radius); font-size: .875rem; cursor: pointer; }

/* Today view */
.today-section { margin-bottom: 1rem; }
.today-section-header { display: flex; align-items: center; gap: .4rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .4rem; }

/* Calendar */
.cal-nav { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.cal-nav button { background: none; border: 1px solid var(--border); border-radius: var(--radius); padding: .3rem .65rem; cursor: pointer; font-size: .875rem; }
.cal-month-label { font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-day-hdr { background: var(--bg); padding: .4rem; text-align: center; font-size: .72rem; color: var(--muted); font-weight: 700; }
.cal-cell { background: var(--surface); min-height: 72px; padding: .3rem; font-size: .72rem; }
.cal-cell.other-month { background: var(--bg); opacity: .6; }
.cal-cell.today-cell { outline: 2px solid var(--primary); outline-offset: -2px; }
.cal-num { font-weight: 700; color: var(--muted); margin-bottom: .2rem; }
.cal-task-chip { background: #eff6ff; color: var(--primary); border-radius: 3px; padding: .1rem .3rem; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-task-chip.urgent { background: #fef2f2; color: #dc2626; }

/* Add forms */
.add-row { display: flex; gap: .4rem; margin-top: .5rem; }
.add-row input { flex: 1; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: .8rem; background: var(--bg); color: var(--text); }
.add-row input:focus { outline: none; border-color: var(--primary); }
.add-row button { padding: .35rem .65rem; background: var(--primary); color: #fff; border: none; border-radius: var(--radius); font-size: .8rem; cursor: pointer; }
.add-row label { padding: .35rem .65rem; background: var(--primary); color: #fff; border: none; border-radius: var(--radius); font-size: .8rem; cursor: pointer; }

/* Share section in panel */
.share-section { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.share-section h3 { font-size: .8rem; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; }

/* Linked transcripts */
.linked-transcripts-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--muted); margin: .5rem 0 .25rem; }
.project-transcripts { padding: 0 .5rem .5rem; }
.transcript-chip { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: .35rem .6rem; margin-bottom: .25rem; font-size: .8rem; }
.transcript-chip:hover { border-color: var(--primary); }
.transcript-chip-title { font-weight: 500; }
.transcript-chip-meta { color: var(--muted); margin-left: .4rem; font-size: .75rem; }
.transcript-chip-text { margin-top: .5rem; white-space: pre-wrap; font-size: .8rem; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: .5rem; max-height: 300px; overflow-y: auto; }
.transcript-chip-summary { margin-top: .4rem; font-size: .8rem; color: var(--text); background: var(--surface,#f9fafb); border: 1px solid var(--border); border-radius: 4px; padding: .4rem .5rem; }

.doc-tree { margin-top: .5rem; }
.doc-folder-row, .doc-file-row { display: flex; align-items: center; gap: .4rem; padding: .25rem 0; font-size: .8rem; }
.doc-folder-row { cursor: pointer; font-weight: 500; }
.doc-folder-children { margin-left: 1.1rem; border-left: 1px dashed var(--border); padding-left: .6rem; }
.doc-file-row { margin-left: 1.1rem; color: var(--text); }
.doc-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-file-size { color: var(--muted); font-size: .72rem; }
.doc-status {
  border: none; border-radius: 999px; padding: .1rem .55rem; font-size: .68rem;
  font-weight: 600; cursor: pointer; color: #fff; line-height: 1.4;
}
.doc-status-ready { background: #16a34a; }
.doc-status-failed { background: #dc2626; }
.doc-status-indexing, .doc-status-pending { background: #f59e0b; }

/* Chat (RAG) */
.rag-toggle-row { margin-top: .5rem; }
.rag-toggle-btn { background: none; border: 1px solid var(--border); cursor: pointer; color: var(--muted); font-size: .78rem; padding: .25rem .55rem; border-radius: 6px; }
.rag-toggle-btn:hover { background: var(--bg); color: var(--text); }
.rag-container { margin-top: .5rem; }
.rag-panel { display: flex; flex-direction: column; gap: 8px; max-height: 400px; }
.rag-messages { overflow-y: auto; max-height: 320px; display: flex; flex-direction: column; gap: 6px; }
.rag-msg { padding: 6px 10px; border-radius: 8px; white-space: pre-wrap; font-size: .82rem; max-width: 85%; }
.rag-msg-user { background: var(--primary); color: white; align-self: flex-end; }
.rag-msg-assistant { background: var(--bg); color: var(--text); border: 1px solid var(--border); align-self: flex-start; }
.rag-input-row { display: flex; gap: .4rem; align-items: flex-end; }
.rag-input { flex: 1; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: .8rem; background: var(--bg); color: var(--text); resize: vertical; font-family: inherit; }
.rag-input:focus { outline: none; border-color: var(--primary); }
.rag-input-row button { padding: .35rem .65rem; background: var(--primary); color: #fff; border: none; border-radius: var(--radius); font-size: .8rem; cursor: pointer; align-self: flex-end; }

/* ── Admin ─────────────────────────────────────────────────────────── */
.admin-section { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; }
.admin-section-title { font-size: 1rem; font-weight: 600; margin: 0 0 .25rem; }
.admin-section-desc { font-size: .8rem; color: var(--muted); margin: 0 0 1rem; }
.admin-field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .9rem; }
.admin-field label { font-size: .85rem; font-weight: 500; }
.admin-field input[type=number], .admin-field select { padding: .35rem .5rem; border: 1px solid var(--border); border-radius: 4px; font-size: .875rem; background: var(--bg); color: var(--text); width: 100%; max-width: 280px; }
.admin-field-check label { display: flex; align-items: center; gap: .5rem; font-weight: 400; cursor: pointer; }
.admin-hint { font-size: .75rem; color: var(--muted); }
.admin-actions { display: flex; align-items: center; gap: .75rem; margin-top: .5rem; }
.admin-saved { font-size: .8rem; color: green; font-weight: 500; }
.restart-status-error { font-size: .8rem; color: var(--error-text); font-weight: 500; }

/* ── Status banners (model availability, whisper updates) ───────── */
.status-banner-container {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  display: flex; flex-direction: column;
}
.status-banner {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
}
.status-banner--error {
  background: var(--error-bg); border-bottom: 1px solid var(--error-border);
  color: var(--error-text);
}
.status-banner--error button { color: var(--error-text); }
.status-banner--warning {
  background: var(--warning-bg); border-bottom: 1px solid var(--warning-border);
  color: var(--warning-text);
}
.status-banner--warning button { color: var(--warning-text); }
.status-banner button {
  background: none; border: none;
  cursor: pointer; font-size: 1rem; line-height: 1;
}

/* ── Cost banner (RAG / résumé / LLM token & $ usage) ────────────── */
.cost-banner {
  position: sticky; top: 0; z-index: 999;
  display: flex; flex-wrap: wrap; gap: 1.25rem; justify-content: center;
  padding: 0.4rem 1rem; font-size: 0.78rem;
  background: var(--panel-bg, #f1f5f9); border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.cost-banner-item strong { color: var(--text); }
@media (max-width: 768px) {
  .cost-banner { display: none; }
}

/* ── Admin sub-tabs & Logs ────────────────────────────────────────── */
.admin-subtabs { display: flex; gap: .5rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.admin-subtab-btn { background: none; border: none; padding: .5rem .75rem; font-size: .875rem; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.admin-subtab-btn:hover { color: var(--text); }
.admin-subtab-btn.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.admin-subtab-panel[hidden] { display: none; }

.logs-controls { display: flex; gap: .75rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.logs-controls select, .logs-controls input[type=text] { padding: .35rem .5rem; border: 1px solid var(--border); border-radius: 4px; font-size: .875rem; background: var(--bg); color: var(--text); }
.logs-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.logs-table th, .logs-table td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.logs-table td.logs-message { word-break: break-word; }
.log-level { display: inline-block; padding: .1rem .45rem; border-radius: 3px; font-weight: 600; font-size: .7rem; }
.log-level-INFO { background: var(--bg); color: var(--muted); }
.log-level-WARNING { background: #fef3c7; color: #92400e; }
.log-level-ERROR, .log-level-CRITICAL { background: #fee2e2; color: #991b1b; }
.logs-pagination { display: flex; gap: .5rem; align-items: center; margin-top: .75rem; font-size: .8rem; }
