/* FocusMeet — design system
   Light canvas, deep navy shell, indigo accent, readable document typography. */

:root {
  --bg: #f5f6fa;
  --bg-soft: #eef0f7;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --muted-2: #98a2b3;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --accent: #5b5bd6;
  --accent-strong: #4646c6;
  --accent-soft: #eeeefc;
  --teal: #0e9384;
  --teal-soft: #e6f6f3;
  --amber: #b54708;
  --amber-soft: #fef0c7;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --nav: #101828;
  --nav-2: #1a2332;
  --nav-ink: #e6e9f0;
  --nav-muted: #98a2b3;
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12), 0 4px 8px rgba(16, 24, 40, 0.04);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
::selection { background: #d9d9fb; }

/* ------------------------------------------------------------------ shell */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  background: var(--nav);
  color: var(--nav-ink);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 2px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(145deg, #6d6df0, #4a4ac4);
  display: grid; place-items: center; flex: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 6px 14px rgba(76,76,200,.35);
}
.brand-name { font-weight: 650; letter-spacing: -0.01em; font-size: 17px; }
.brand-sub { font-size: 11px; color: var(--nav-muted); letter-spacing: .02em; margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--nav-muted); background: transparent; border: 0;
  font-size: 13.5px; font-weight: 500; text-align: left; width: 100%;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--nav-ink); }
.nav-item.is-active { background: rgba(255,255,255,.10); color: #fff; }
.nav-item .nav-icon { width: 18px; height: 18px; opacity: .9; flex: none; }
.nav-item.is-active .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto; font-size: 11px; background: rgba(255,255,255,.12);
  border-radius: 99px; padding: 1px 7px; color: var(--nav-ink);
}
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.capability { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--nav-muted); padding: 0 8px; }
.dot { width: 7px; height: 7px; border-radius: 99px; background: #475467; flex: none; }
.dot.on { background: #32d583; box-shadow: 0 0 0 3px rgba(50,213,131,.15); }
.sidebar-note { font-size: 11px; color: #667085; line-height: 1.45; padding: 10px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-note a { color: #b9b9f5; text-decoration: none; }
.sidebar-note a:hover { text-decoration: underline; }

.main { min-width: 0; display: flex; flex-direction: column; }
.view { display: flex; flex-direction: column; min-height: 100vh; }

/* --------------------------------------------------------------- elements */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 10px; padding: 8px 13px; font-size: 13px; font-weight: 550;
  color: var(--ink-2); box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: #b9c0cc; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 1px 2px rgba(70,70,198,.35); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: #fda29b; }
.btn-sm { padding: 5px 9px; font-size: 12px; border-radius: 8px; }
.icon-btn {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 8px; border: 0; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--bg-soft); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 9px 11px; font-size: 13.5px; background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91,91,214,.15);
}
.textarea { resize: vertical; min-height: 110px; line-height: 1.55; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.hint strong { color: var(--ink-2); font-weight: 600; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: var(--bg-soft); color: var(--ink-2); letter-spacing: .01em;
}
.badge-accent { background: var(--accent-soft); color: var(--accent-strong); }
.badge-teal { background: var(--teal-soft); color: var(--teal); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.kind {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center; font-size: 9px; font-weight: 750; letter-spacing: .02em;
  background: var(--bg-soft); color: var(--ink-2); text-transform: uppercase;
}
.kind.pdf { background: #fee4e2; color: #b42318; }
.kind.docx { background: #dbeafe; color: #1d4ed8; }
.kind.gdoc { background: #dcfce7; color: #15803d; }
.kind.note { background: #fef0c7; color: #92400e; }
.kind.md, .kind.txt { background: #f2f4f7; color: #475467; }

/* --------------------------------------------------------------- console */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.82); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.topbar-title h1 {
  font-size: 15px; font-weight: 620; margin: 0; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 550; color: var(--muted); }
.status .pulse { width: 8px; height: 8px; border-radius: 99px; background: var(--muted-2); }
.status.live { color: var(--teal); }
.status.live .pulse { background: var(--teal); animation: pulse 1.6s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(14,147,132,.45); }
  70% { box-shadow: 0 0 0 8px rgba(14,147,132,0); }
  100% { box-shadow: 0 0 0 0 rgba(14,147,132,0); }
}
.timer { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); background: var(--bg-soft); padding: 4px 9px; border-radius: 8px; }

.console {
  display: grid; grid-template-columns: minmax(380px, 0.92fr) minmax(420px, 1.08fr);
  gap: 18px; padding: 18px 24px 24px; flex: 1; min-height: 0;
  height: calc(100vh - 61px);
}
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  border-bottom: 1px solid var(--line); background: var(--surface-2);
  flex: none;
}
.panel-head h2 { font-size: 13px; font-weight: 650; margin: 0; letter-spacing: .01em; text-transform: uppercase; color: var(--muted); }
.panel-head .spacer { flex: 1; }

/* mic card */
.listen { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.mic-card {
  display: flex; gap: 16px; align-items: center; padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(120% 140% at 0% 0%, #f4f4ff 0%, #ffffff 55%);
  flex: none;
}
.mic-orb {
  width: 68px; height: 68px; border-radius: 999px; border: 0; flex: none;
  background: linear-gradient(150deg, #6d6df0, #4646c6);
  color: #fff; display: grid; place-items: center; position: relative;
  box-shadow: 0 10px 22px rgba(70,70,198,.30), inset 0 1px 0 rgba(255,255,255,.3);
  transition: transform .12s, box-shadow .2s;
}
.mic-orb:hover { transform: translateY(-1px); box-shadow: 0 14px 26px rgba(70,70,198,.36), inset 0 1px 0 rgba(255,255,255,.3); }
.mic-orb svg { width: 26px; height: 26px; }
.mic-orb.listening { background: linear-gradient(150deg, #12b3a0, #0e8a7d); box-shadow: 0 10px 24px rgba(14,147,132,.35); }
.mic-orb.listening::before, .mic-orb.listening::after {
  content: ""; position: absolute; inset: -6px; border-radius: 999px;
  border: 2px solid rgba(14,147,132,.35); animation: ripple 2s infinite;
}
.mic-orb.listening::after { animation-delay: .9s; }
@keyframes ripple { 0% { transform: scale(.92); opacity: .8; } 100% { transform: scale(1.35); opacity: 0; } }
.mic-meta { display: flex; flex-direction: column; gap: 7px; min-width: 0; flex: 1; }
.mic-title { font-size: 13.5px; font-weight: 600; }
.mic-title .subtle { color: var(--muted); font-weight: 450; }
.mic-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.select.compact { width: auto; padding: 5px 8px; font-size: 12px; border-radius: 8px; }
.speaker-switch {
  display: inline-flex; background: var(--bg-soft); border-radius: 9px; padding: 2px; gap: 2px;
}
.speaker-switch button {
  border: 0; background: transparent; padding: 4px 9px; border-radius: 7px;
  font-size: 11.5px; font-weight: 550; color: var(--muted);
}
.speaker-switch button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* transcript */
.transcript {
  flex: 1; overflow-y: auto; padding: 14px 16px 6px; min-height: 140px;
  scroll-behavior: smooth;
}
.transcript-empty {
  color: var(--muted); font-size: 13px; line-height: 1.6; padding: 10px 4px;
  max-width: 44ch;
}
.seg { display: grid; grid-template-columns: 54px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px dashed transparent; }
.seg:hover { border-bottom-color: var(--line); }
.seg-time { font-family: var(--mono); font-size: 10.5px; color: var(--muted-2); padding-top: 3px; }
.seg-body { min-width: 0; }
.seg-who { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 2px; }
.seg.me .seg-who { color: var(--teal); }
.seg-text { font-size: 13.5px; line-height: 1.6; color: var(--ink-2); overflow-wrap: anywhere; }
.seg.interim .seg-text { color: var(--muted); font-style: italic; }
.seg.interim .seg-who { color: var(--muted-2); }
.interim-caret { display: inline-block; width: 2px; height: 1em; background: var(--accent); vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.manual { display: flex; gap: 8px; padding: 12px 16px 14px; border-top: 1px solid var(--line); background: var(--surface-2); }
.manual .input { flex: 1; }
.manual .btn { flex: none; }

/* suggestions */
.suggestions-panel .panel-head { gap: 8px; }
.query-pill {
  font-size: 11.5px; color: var(--muted); background: var(--bg-soft);
  border-radius: 99px; padding: 3px 10px; max-width: 46%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.suggestions { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.suggestions:empty { display: none; }
.suggestions-empty { padding: 8px 6px; }
.suggestions-empty h3 { font-size: 14px; margin: 0 0 6px; font-weight: 620; }
.suggestions-empty p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); max-width: 52ch; }
.suggestions-empty ol { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); line-height: 1.7; }

.card {
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  box-shadow: var(--shadow-sm); overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.card.is-new { animation: card-in .18s ease-out; }
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
@keyframes card-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.card.is-pinned { border-color: #f2c94c; box-shadow: 0 0 0 1px #f2c94c inset; }
.card-head { display: flex; align-items: center; gap: 9px; padding: 11px 13px 8px; }
.card-head .doc { min-width: 0; flex: 1; }
.card-title { font-size: 12.5px; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { font-size: 10.5px; color: var(--muted); margin-top: 1px; display: flex; gap: 6px; align-items: center; min-width: 0; overflow: hidden; white-space: nowrap; }
.card-sub > span { overflow: hidden; text-overflow: ellipsis; }
.relevance { display: flex; align-items: center; gap: 6px; flex: none; }
.relevance-bar { width: 42px; height: 5px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.relevance-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8b8bf0, var(--accent)); }
.relevance-bar.high span { background: linear-gradient(90deg, #3dd5aa, var(--teal)); }
.relevance-num { font-size: 10.5px; font-variant-numeric: tabular-nums; color: var(--muted); font-family: var(--mono); }
.card-excerpt {
  margin: 0; padding: 0 13px 10px; font-family: var(--serif);
  font-size: 13.8px; line-height: 1.62; color: var(--ink-2);
}
.card-excerpt mark {
  background: #fdf0b8; color: inherit; padding: 0 2px; border-radius: 3px;
}
.card-foot { display: flex; align-items: center; gap: 6px; padding: 7px 10px 9px; border-top: 1px solid var(--line); background: var(--surface-2); }
.card-foot .spacer { flex: 1; }
.chip { font-size: 10.5px; color: var(--muted); background: var(--bg-soft); border-radius: 6px; padding: 2px 6px; }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.teal { background: var(--teal-soft); color: var(--teal); }
.card-foot .btn { padding: 4px 8px; font-size: 11.5px; border-radius: 7px; box-shadow: none; background: transparent; border-color: transparent; color: var(--muted); }
.card-foot .btn:hover { background: var(--bg-soft); color: var(--ink); }
.card-foot .btn.on { color: var(--accent-strong); background: var(--accent-soft); }

/* answer */
.answer {
  margin: 12px 14px 0; border: 1px solid #c9c9f4; background: linear-gradient(180deg, #f7f7ff, #ffffff);
  border-radius: 14px; padding: 13px 14px; animation: card-in .2s ease-out;
}
.answer-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.answer-head h3 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-strong); }
.answer-head .spacer { flex: 1; }
.answer-text { font-size: 14px; line-height: 1.65; color: var(--ink); }
.answer-text p { margin: 0 0 8px; }
.answer-list { margin: 6px 0 0; padding-left: 18px; font-size: 13.2px; line-height: 1.6; color: var(--ink-2); }
.answer-list li { margin-bottom: 4px; }
.answer-figures { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.answer-figures .fig { font-family: var(--mono); font-size: 11.5px; background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 2px 7px; }
.answer-sources { margin-top: 9px; font-size: 11.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 5px; }

/* --------------------------------------------------------------- library */
.page { padding: 22px 26px 40px; max-width: 1180px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.02em; font-weight: 680; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; max-width: 62ch; }
.page-head .spacer { flex: 1; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-sm); }
.stat-value { font-size: 20px; font-weight: 680; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 2px; letter-spacing: .02em; }

.dropzone {
  border: 1.5px dashed #c3c8d4; border-radius: var(--radius-lg); background: var(--surface-2);
  padding: 26px; text-align: center; transition: border-color .15s, background .15s; margin-bottom: 16px;
  cursor: pointer;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 0 auto 8px; }
.dropzone strong { font-size: 13.5px; }
.dropzone p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.toolbar .input { max-width: 320px; }
.toolbar .spacer { flex: 1; }

.doc-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.doc-row { display: grid; grid-template-columns: 30px minmax(0,1fr) 78px 78px 96px 108px; gap: 12px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.doc-row:last-child { border-bottom: 0; }
.doc-row:hover { background: var(--surface-2); }
.doc-row.head { background: var(--surface-2); font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; padding: 8px 14px; }
.doc-name { min-width: 0; }
.doc-name strong { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-name span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.doc-cell { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.doc-actions { display: flex; justify-content: flex-end; gap: 2px; }
.empty {
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface);
  padding: 40px 24px; text-align: center; color: var(--muted); font-size: 13px;
}
.empty h3 { color: var(--ink); margin: 0 0 6px; font-size: 15px; }

/* sessions */
.session-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-sm); margin-bottom: 9px;
}
.session-card .date { font-family: var(--mono); font-size: 11px; color: var(--muted); width: 116px; flex: none; }
.session-card .name { flex: 1; min-width: 0; }
.session-card .name strong { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-card .name span { font-size: 11.5px; color: var(--muted); }
.session-card .metrics { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); }
.session-card .metrics b { color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }

/* replay */
.replay { display: grid; grid-template-columns: minmax(0,1fr) 380px; gap: 18px; padding: 18px 24px 30px; align-items: start; }
.replay .panel { max-height: calc(100vh - 130px); }
.timeline { overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.timeline-entry { border-left: 2px solid var(--accent-soft); padding-left: 10px; }
.timeline-entry time { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.timeline-entry .q { font-size: 12px; color: var(--ink-2); margin: 3px 0 6px; font-style: italic; }
.timeline-entry .hit { font-size: 12px; color: var(--muted); margin-bottom: 3px; line-height: 1.45; }
.timeline-entry .hit b { color: var(--ink-2); font-weight: 600; }

/* --------------------------------------------------------------- modals */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16,24,40,.52); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 60; padding: 20px; animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: min(620px, 100%); max-height: min(84vh, 760px); display: flex; flex-direction: column;
  animation: modal-in .18s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 15.5px; font-weight: 650; flex: 1; }
.modal-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 16px 16px; }
.modal-wide { width: min(820px, 100%); }

/* toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast {
  background: #101828; color: #f2f4f7; padding: 10px 14px; border-radius: 10px;
  font-size: 12.5px; box-shadow: var(--shadow-lg); max-width: 380px;
  display: flex; gap: 8px; align-items: flex-start; animation: toast-in .18s ease-out;
}
.toast.error { background: #7a271a; }
.toast.success { background: #085d52; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 99px; animation: spin .7s linear infinite; }
.spinner.dark { border-color: var(--line-strong); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-screen { display: grid; place-items: center; height: 100vh; color: var(--muted); gap: 10px; }
.loading-screen .spinner { width: 26px; height: 26px; border-width: 3px; }
.mono { font-family: var(--mono); }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1120px) {
  .app { grid-template-columns: 72px minmax(0,1fr); }
  .sidebar { padding: 16px 10px; }
  .brand-name, .brand-sub, .nav-item span, .sidebar-note, .capability span { display: none; }
  .brand { justify-content: center; padding: 4px 0 2px; }
  .nav-item { justify-content: center; padding: 10px; }
  .nav-badge { display: none; }
  .capability { justify-content: center; padding: 0; }
  .console { grid-template-columns: 1fr; height: auto; }
  .panel { min-height: 420px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .replay { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; top: auto; height: 60px; width: 100%; flex-direction: row; padding: 8px; z-index: 30; border-top: 1px solid rgba(255,255,255,.1); }
  .brand, .sidebar-foot { display: none; }
  .nav { flex-direction: row; flex: 1; justify-content: space-around; }
  .nav-item { width: auto; }
  .main { padding-bottom: 60px; }
  .console { padding: 12px; height: auto; }
  .topbar { padding: 10px 14px; }
  .page { padding: 16px; }
  .doc-row { grid-template-columns: 30px minmax(0,1fr) 90px; }
  .doc-row .col-hide { display: none; }
  .doc-row.head { grid-template-columns: 30px minmax(0,1fr) 90px; }
  .topbar-meta .timer { display: none; }
}

/* --------------------------------------------------------- workspace bar */
.workspace-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 24px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 25;
  min-height: 48px;
}
.ws-button {
  display: flex; align-items: center; gap: 9px; border: 1px solid transparent;
  background: transparent; border-radius: 10px; padding: 4px 8px 4px 5px; text-align: left;
}
.ws-button:hover { background: var(--bg-soft); border-color: var(--line); }
.ws-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ws-avatar {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  color: #fff; background: linear-gradient(145deg, #6d6df0, #4646c6);
}
.ws-text { display: flex; flex-direction: column; line-height: 1.15; }
.ws-caption { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ws-text strong { font-size: 13px; font-weight: 620; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-chevron { width: 15px; height: 15px; color: var(--muted); }
.ws-hint { font-size: 11.5px; color: var(--muted-2); }
.workspace-bar .spacer { flex: 1; }

.ws-list { display: flex; flex-direction: column; gap: 6px; }
.ws-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.ws-row:hover { border-color: var(--line-strong); background: var(--surface-2); }
.ws-row.is-active { border-color: var(--accent); background: var(--accent-soft); }
.ws-row-info { flex: 1; min-width: 0; }
.ws-row-info strong { display: block; font-size: 13.5px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-row-info span { font-size: 11.5px; color: var(--muted); }
.ws-row-actions { display: flex; gap: 2px; }
.ws-create { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.ws-create .input { flex: 1; }

/* -------------------------------------------------------- folder sources */
.sources-head { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 8px; }
.sources-head h2 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); margin: 0; }
.sources { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.source-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.source-icon {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
}
.source-icon.local { background: var(--amber-soft); color: var(--amber); }
.source-icon.drive { background: var(--teal-soft); color: var(--teal); }
.source-icon svg { width: 17px; height: 17px; }
.source-info { flex: 1; min-width: 0; }
.source-info strong { display: block; font-size: 13px; font-weight: 620; }
.source-path { display: block; font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-meta { display: block; font-size: 11px; color: var(--muted-2); margin-top: 1px; }
.source-actions { display: flex; align-items: center; gap: 6px; flex: none; }

/* --------------------------------------------------------------- imports */
.jobs { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.job-card {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 10px 12px; box-shadow: var(--shadow-sm);
}
.job-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 6px; }
.job-head strong { font-weight: 620; }
.job-head .mono { font-size: 11px; color: var(--muted); }
.progress { height: 6px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; margin-bottom: 6px; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8b8bf0, var(--accent)); transition: width .3s; }
.job-errors { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.job-errors summary { cursor: pointer; }
.job-errors ul { margin: 6px 0 0; padding-left: 18px; max-height: 140px; overflow-y: auto; }
.job-errors li { margin-bottom: 2px; line-height: 1.4; }

.checkline { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.checkline input { width: 15px; height: 15px; accent-color: var(--accent); }

.console { height: calc(100vh - 109px); }
#view { flex: 1; min-width: 0; display: flex; flex-direction: column; }

@media (max-width: 1120px) {
  .ws-hint { display: none; }
}
@media (max-width: 720px) {
  .workspace-bar { padding: 6px 12px; min-height: 44px; }
  .ws-text strong { max-width: 150px; }
  .workspace-bar .btn { padding: 6px 9px; font-size: 12px; }
  .console { height: auto; }
  .source-card { flex-wrap: wrap; }
  .source-actions { width: 100%; justify-content: flex-end; }
}

/* --------------------------------------------------------------- settings */
.settings-page { max-width: 900px; }
.settings-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.settings-card-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.settings-card-head h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.settings-card-head .spacer { flex: 1; }
.settings-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px;
}
.settings-grid .field-wide { grid-column: 1 / -1; }
.settings-foot {
  display: flex; align-items: center; gap: 8px; margin-top: 16px;
  padding-top: 13px; border-top: 1px solid var(--line);
}
.settings-foot .spacer { flex: 1; }
.switchline {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 10px 12px; border-radius: 10px; background: var(--bg-soft);
  font-size: 13px; margin: 10px 0 12px;
}
.switchline input { width: 17px; height: 17px; accent-color: var(--accent); }
.ai-status-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-status-line .spacer { flex: 1; }
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
.preset {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  border-radius: 99px; padding: 4px 11px; font-size: 12px; font-weight: 550;
}
.preset:hover { background: var(--surface-2); }
.preset.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.test-result {
  margin-top: 12px; border-radius: 10px; padding: 9px 11px; font-size: 12.5px;
  background: var(--bg-soft); color: var(--ink-2); display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.test-result.ok { background: var(--teal-soft); color: var(--teal); }
.test-result.fail { background: var(--danger-soft); color: var(--danger); }
.test-result svg { width: 15px; height: 15px; flex: none; }
.linklike {
  background: none; border: 0; padding: 0; color: var(--accent-strong);
  text-decoration: underline; font-size: inherit; cursor: pointer;
}
.capabilities-list { display: flex; flex-direction: column; gap: 9px; font-size: 13px; color: var(--ink-2); }
.capabilities-list .dot { display: inline-block; margin-right: 6px; }
.capabilities-list .hint { font-size: 11.5px; }
.security-note { margin-top: 8px; font-size: 11.5px; }
.settings-page code, .hint code {
  font-family: var(--mono); font-size: .92em; background: var(--bg-soft);
  padding: 1px 4px; border-radius: 4px;
}
@media (max-width: 720px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-card { padding: 14px; }
}
