:root {
  --bg: #eef3fb;
  --card: #ffffff;
  --ink: #17233a;
  --muted: #4d5d75;      /* darkened: was too light on white backgrounds */
  --line: #dde5f0;
  --accent: #3b82f6;
  --accent-2: #7c3aed;
  --accent-grad: linear-gradient(120deg, #3b82f6, #5b6cf8 55%, #7c3aed);
  --accent-soft: #e6effe;
  --danger: #dc2626;
  --side-ink: #4a5a72;
  --radius: 11px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .05), 0 6px 18px rgba(59, 92, 160, .07);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14.5px; line-height: 1.5;
}
#app { display: flex; height: 100vh; }

/* ---------- Sidebar (light) ---------- */
#sidebar {
  width: 236px; flex-shrink: 0;
  background: linear-gradient(180deg, #ffffff 0%, #f3f7fe 100%);
  border-right: 1px solid var(--line); color: var(--side-ink);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.brand-row { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-bottom: 18px; }
.logo-tile { flex-shrink: 0; filter: drop-shadow(0 3px 8px rgba(99, 102, 241, .35)); }
.brand-txt { font-size: 17px; font-weight: 600; color: var(--ink); line-height: 1.15; }
.brand-txt b { color: var(--accent); font-weight: 700; }
.brand-txt small { display: block; font-size: 10px; font-weight: 500; color: #9aa7ba; letter-spacing: .3px; }
.brand-row:hover .brand-txt b { color: var(--accent-2); }
#projSwitch { margin-bottom: 16px; }
#projSwitch select {
  width: 100%; padding: 7px 8px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 13px; margin-bottom: 6px;
}
#projSwitch .proj-btns { display: flex; gap: 6px; }
#projSwitch .proj-btns button {
  flex: 1; padding: 5px 4px; font-size: 11.5px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; color: var(--side-ink); cursor: pointer;
}
#projSwitch .proj-btns button:hover { background: var(--accent-soft); color: var(--accent); border-color: #c7dbfb; }
#nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
#nav button {
  display: flex; align-items: center; gap: 10px;
  text-align: left; padding: 8px 11px; border: none; border-radius: 9px; background: transparent;
  color: var(--side-ink); font-size: 13.5px; cursor: pointer; font-family: inherit; font-weight: 500;
}
#nav button svg { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
#nav button:hover { background: var(--accent-soft); color: var(--accent); }
#nav button.active { background: var(--accent-grad); color: #fff; box-shadow: 0 4px 12px rgba(59, 130, 246, .3); }
.nav-sep { height: 1px; background: var(--line); margin: 8px 4px; }
/* Guide and Academy live on their own full-width pages, opened in a new tab. */
.nav-ext {
  display: flex; align-items: center; gap: 10px; padding: 8px 11px; border-radius: 9px;
  color: var(--side-ink); font-size: 13.5px; font-weight: 500; text-decoration: none;
}
.nav-ext svg { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.nav-ext:hover { background: var(--accent-soft); color: var(--accent); }
.nav-ext .ext-mark { margin-left: auto; font-size: 11px; opacity: .55; }
.devby { display: block; margin-top: 6px; font-weight: 600; color: #7c8aa0; }
.trial-chip {
  margin-top: auto; display: flex; align-items: center; gap: 7px;
  background: linear-gradient(120deg, #eef4ff, #f3ecff); border: 1px solid #dbe6fb;
  color: #4338ca; font-size: 11.5px; font-weight: 600; border-radius: 10px; padding: 8px 10px;
}
.trial-chip svg { flex-shrink: 0; fill: #7c3aed; }
#userBox { padding: 10px 8px; border-top: 1px solid var(--line); }
#userBox .uname { font-size: 13px; color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#userBox .uinst { font-size: 11px; color: #9aa7ba; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#userBox button { padding: 5px; font-size: 11.5px; border-radius: 7px; border: 1px solid var(--line); background: #fff; color: var(--side-ink); cursor: pointer; }
#userBox button:hover { background: var(--accent-soft); color: var(--accent); }
#verifyBanner {
  display: flex; align-items: center; gap: 12px; padding: 9px 26px; font-size: 13px;
  background: #fef3c7; color: #92400e; border-bottom: 1px solid #fde68a;
}
#verifyBanner .btn { margin-left: auto; }
.sidefoot { font-size: 11px; color: #64748b; line-height: 1.5; margin-top: 12px; }

/* ---------- Main ---------- */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px; background: var(--card); border-bottom: 1px solid var(--line);
}
#topbar h1 { font-size: 18px; font-weight: 650; }
#topActions { display: flex; gap: 8px; }
#content { flex: 1; overflow: auto; padding: 22px 26px; }
#menuToggle { display: none; background: none; border: none; cursor: pointer; padding: 6px; margin-right: 4px; border-radius: 8px; color: var(--ink); }
#menuToggle svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
#menuToggle:hover { background: var(--accent-soft); color: var(--accent); }
#navOverlay { display: none; }

/* ---------- Responsive (tablet / mobile) ---------- */
@media (max-width: 860px) {
  #menuToggle { display: inline-flex; }
  #topbar h1 { font-size: 16px; }
  #topbar { padding: 12px 16px; }
  #content { padding: 16px 16px; }
  #sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 250px; z-index: 300;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 4px 0 24px rgba(15, 23, 42, .18);
  }
  #app.nav-open #sidebar { transform: none; }
  #app.nav-open #navOverlay { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 250; }
  .coding-wrap { flex-direction: column; height: auto; gap: 12px; }
  .doc-pane { height: 60vh; }
  .code-pane { width: 100%; height: auto; max-height: 340px; }
  #docText { font-size: 15px; }
  .modal, .modal.wide { width: 94vw; }
  .toolbar { gap: 6px; }
  .bar-label { width: 120px; }
  .dash-hero { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .stat-grid, .dash-grid { grid-template-columns: 1fr 1fr; }
  #topActions .btn { padding: 6px 9px; font-size: 12px; }
  table.grid th, table.grid td { padding: 6px 6px; font-size: 12.5px; }
}

/* ---------- Generic ---------- */
.btn {
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  color: var(--ink); font-size: 13.5px; cursor: pointer; font-family: inherit;
}
.btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn.primary { background: var(--accent-grad); border-color: transparent; color: #fff; box-shadow: 0 3px 10px rgba(59, 130, 246, .25); }
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 5px 16px rgba(59, 130, 246, .35); }
.btn.accent { background: #eef4ff; border-color: #cfe0fb; color: var(--accent); font-weight: 600; }
.btn.accent:hover { background: #e0ecff; }
.btn.danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.icon-btn {
  border: none; background: transparent; cursor: pointer; font-size: 14px; color: var(--muted);
  padding: 3px 6px; border-radius: 6px;
}
.icon-btn:hover { background: #eef2f7; color: var(--ink); }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
input[type=text], input[type=search], input[type=number], select, textarea {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-family: inherit;
  font-size: 13.5px; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { width: 100%; resize: vertical; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th {
  text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--line);
  font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted);
}
table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid tr:hover td { background: #f8fafc; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state h2 { font-size: 17px; color: var(--ink); margin-bottom: 6px; }
.chip {
  display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px;
  background: #eef2f7; color: #475569; margin: 1px 3px 1px 0;
}
.color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 7px; vertical-align: -1px; flex-shrink: 0; }

/* ---------- Welcome ---------- */
.welcome { max-width: 560px; margin: 60px auto; text-align: center; }
.welcome h2 { font-size: 24px; margin-bottom: 8px; }
.welcome p { color: var(--muted); margin-bottom: 24px; }
.welcome .btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex;
  align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; border-radius: 14px; width: 480px; max-width: 94vw; max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.modal.wide { width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px 10px; }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 6px 20px 16px; overflow: auto; }
.modal-body label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
.modal-body input[type=text], .modal-body select { width: 100%; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }

/* ---------- Coding view ---------- */
.coding-wrap { display: flex; gap: 16px; height: calc(100vh - 120px); }
.doc-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.doc-head { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.doc-head select { max-width: 300px; }
#docText {
  flex: 1; overflow: auto; padding: 20px 26px; white-space: pre-wrap; font-size: 15px;
  line-height: 1.9; cursor: text;
}
#docText span.seg { cursor: pointer; border-radius: 2px; padding: 1.5px 0; }
#docText span.flash { outline: 2px solid var(--accent); }
.code-pane {
  width: 280px; flex-shrink: 0; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column; padding: 12px;
}
.code-pane .pane-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 8px; }
.code-pane input { width: 100%; margin-bottom: 8px; }
.code-list { overflow: auto; flex: 1; }
.code-item {
  display: flex; align-items: center; padding: 6px 8px; border-radius: 7px; cursor: pointer;
  font-size: 13.5px; user-select: none;
}
.code-item:hover { background: #eef2f7; }
.code-item .cname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-item .ccount { font-size: 11.5px; color: var(--muted); margin-left: 6px; }
.pane-hint { font-size: 11.5px; color: var(--muted); margin-top: 8px; line-height: 1.5; }

/* ---------- Float panel & popover ---------- */
#floatPanel, #popover {
  position: fixed; z-index: 90; background: #fff; border-radius: 12px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, .25); border: 1px solid var(--line);
  width: 280px; padding: 10px;
}
#floatPanel .code-list { max-height: 220px; overflow: auto; }
#floatPanel input { width: 100%; margin-bottom: 6px; }
#floatPanel .fp-actions { display: flex; gap: 6px; margin-top: 8px; }
#floatPanel .fp-actions button { flex: 1; }
.hidden { display: none !important; }
#popover { width: 320px; }
#popover .seg-row { display: flex; align-items: center; gap: 6px; padding: 5px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
#popover .seg-row:last-child { border-bottom: none; }
#popover .seg-row .cname { flex: 1; }

/* ---------- Codebook tree ---------- */
.tree-row { display: flex; align-items: center; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.tree-row:hover { background: #f8fafc; }
.tree-row .cname { font-weight: 550; }
.tree-row .cdesc { color: var(--muted); font-size: 12.5px; margin-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; }
.tree-row .grow { flex: 1; }
.tree-row .actions { visibility: hidden; display: flex; gap: 2px; }
.tree-row:hover .actions { visibility: visible; }
.count-badge { font-size: 11.5px; background: #eef2f7; color: #475569; border-radius: 10px; padding: 1px 8px; margin-left: 8px; }

/* ---------- Analysis ---------- */
.subtabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.subtabs button {
  padding: 7px 14px; border-radius: 20px; border: 1px solid var(--line); background: #fff;
  cursor: pointer; font-size: 13px; font-family: inherit; color: var(--ink);
}
.subtabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
/* ---------- Codebook 2.0 ---------- */
.cb-head { display: flex; align-items: flex-start; gap: 14px; }
.cb-row { display: flex; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 13.8px; }
.cb-row:hover { background: #f8fafc; }
.cb-tw { width: 22px; flex-shrink: 0; }
.cb-tw .icon-btn { padding: 0 4px; font-size: 12px; }
.cb-name { font-weight: 550; }
.cb-row .cdesc { color: var(--muted); font-size: 12.5px; margin-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.cb-row .grow { flex: 1; }
.cb-row .actions { visibility: hidden; display: flex; gap: 2px; }
.cb-row:hover .actions { visibility: visible; }
.cb-row { cursor: pointer; }
.cb-row.open { background: var(--accent-soft); }
.cb-row .cb-caret { visibility: visible; color: var(--accent); }
.cb-row .actions .cb-caret { visibility: visible; }

/* Inline detail panel — click a code to open it and edit in place. */
.cb-detail {
  border-bottom: 1px solid var(--line); background: #fbfcff;
  padding: 14px 16px 12px; animation: cbdIn .22s ease;
}
@keyframes cbdIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.cbd-grid { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; align-items: start; }
.cbd-grid label { font-size: 12.5px; font-weight: 600; color: #4a5a72; padding-top: 7px; }
.cbd-grid textarea { width: 100%; font-size: 13px; resize: vertical; }
.cbd-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.cbd-row span { display: flex; flex-direction: column; gap: 3px; }
.cbd-row label { font-size: 12px; font-weight: 600; color: #4a5a72; }
.cbd-row select { font-size: 12.5px; padding: 5px 8px; min-width: 150px; }
.cbd-row input[type=color] { width: 52px; height: 30px; border: 1px solid var(--line); border-radius: 7px; padding: 2px; }
.cbd-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--line); }
.cbd-saved { color: var(--ok, #16a34a); font-weight: 600; }
@media (max-width: 700px) { .cbd-grid { grid-template-columns: 1fr; } .cbd-grid label { padding-top: 0; } }
@media (prefers-reduced-motion: reduce) { .cb-detail { animation: none; } }
.sent-chip { display: inline-block; font-weight: 700; font-size: 11.5px; border: 1px solid; border-radius: 6px; padding: 0 5px; margin-left: 6px; }
.chip.sm-chip { font-size: 10.5px; padding: 1px 7px; }
.cb-health { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.hl-chip { font-size: 11.5px; padding: 3px 10px; border-radius: 20px; background: #eef2f7; color: #475569; }
.hl-chip.warn { background: #fef3c7; color: #92400e; }
.hl-chip.ok { background: #dcfce7; color: #166534; }

/* ---------- Framework matrix ---------- */
table.fw-table { border-collapse: collapse; font-size: 12.5px; width: 100%; }
table.fw-table th, table.fw-table td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
table.fw-table thead th { background: #f8fafc; font-size: 12px; font-weight: 650; position: sticky; top: 0; }
th.fw-case { min-width: 150px; max-width: 200px; background: #f8fafc; }
td.fw-cell { min-width: 165px; max-width: 260px; cursor: pointer; }
td.fw-cell:hover { background: var(--accent-soft); }
td.fw-cell.empty { background: #fcfdff; }
.fw-n { display: inline-block; min-width: 22px; text-align: center; border-radius: 6px; font-weight: 700; font-size: 11.5px; padding: 1px 6px; margin-bottom: 4px; }
.fw-sum { font-size: 12px; color: var(--ink); line-height: 1.45; }
.draft-chip { background: #fef3c7; color: #92400e; font-weight: 600; font-size: 10.5px; padding: 1px 7px; }
.fw-sum.none { color: #b6c0cd; font-style: italic; }

/* ---------- Sentiment ---------- */
.sent-mini { font-size: 11px; font-weight: 700; margin-left: 4px; }
.sent-legend { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 10.5px; line-height: 1.7; }
.sent-summary { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.ss-cell { background: #f8fafc; border-radius: 10px; padding: 10px 14px; min-width: 92px; text-align: center; flex: 1; }
.ss-cell .num { font-size: 20px; font-weight: 750; }
.ss-cell .lbl { font-size: 11px; color: var(--muted); }
.sent-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.sent-name { width: 190px; flex-shrink: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sent-bar { flex: 1; display: flex; height: 18px; border-radius: 4px; overflow: hidden; background: #eef2f7; }
.sent-bar div { height: 100%; }
.sent-extremes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .sent-extremes { grid-template-columns: 1fr; } .sent-name { width: 120px; } }

/* ---------- Evidence table & KWIC ---------- */
.ev-theme { border-top: 2px solid var(--line); padding-top: 12px; margin-top: 14px; }
.ev-theme:first-child { border-top: none; margin-top: 0; }
.ev-theme h4 { font-size: 15.5px; margin-bottom: 6px; display: flex; align-items: center; }
.ev-code { margin: 8px 0 12px 6px; }
.ev-code-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; margin-bottom: 4px; }
.ev-quote {
  background: #f8fafc; border-left: 3px solid var(--line); border-radius: 0 8px 8px 0;
  padding: 8px 12px; margin: 5px 0 5px 14px; font-size: 13.5px;
}
.ev-quote footer { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
table.kwic td { font-size: 12.5px; vertical-align: middle; }
table.kwic mark { font-weight: 600; }

.unit-toggle { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.unit-toggle button { padding: 5px 14px; border-radius: 20px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 12.5px; font-family: inherit; color: var(--ink); }
.unit-toggle button.active { background: var(--accent-grad); color: #fff; border-color: transparent; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.bar-label { width: 200px; flex-shrink: 0; font-size: 13px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; }
.bar-fill { height: 20px; border-radius: 4px; min-width: 2px; display: flex; align-items: center; }
.bar-val { font-size: 11.5px; color: #fff; padding-left: 7px; font-weight: 600; }
.matrix-scroll { overflow-x: auto; }
table.matrix { border-collapse: collapse; font-size: 12.5px; }
table.matrix th, table.matrix td { border: 1px solid var(--line); padding: 6px 9px; text-align: center; min-width: 44px; }
table.matrix th { background: #f8fafc; font-weight: 600; }
table.matrix th.rowh { text-align: right; max-width: 200px; }
.retrieval-item { border-left: 4px solid var(--accent); background: #f8fafc; border-radius: 0 8px 8px 0; padding: 10px 14px; margin-bottom: 10px; }
.retrieval-item .src { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.cloud { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: baseline; justify-content: center; padding: 20px; }
.cloud span { line-height: 1; }
mark { background: #fde047; border-radius: 2px; padding: 0 1px; }

/* ---------- Home dashboard ---------- */
.dash-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(115deg, #2563eb 0%, #4f46e5 55%, #7c3aed 100%);
  border-radius: 18px; color: #fff; padding: 30px 32px;
  margin-bottom: 20px; box-shadow: 0 12px 34px rgba(79, 70, 229, .28);
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.dash-hero::after {
  content: ""; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(255,255,255,.16), transparent 65%); pointer-events: none;
}
.dh-text { position: relative; z-index: 1; }
.dh-greet { font-size: 12.5px; letter-spacing: .6px; text-transform: uppercase; opacity: .85; font-weight: 600; }
.dash-hero h2 { font-size: 26px; font-weight: 750; margin: 2px 0 6px; }
.dash-hero p { color: rgba(255,255,255,.94); font-size: 14px; max-width: 580px; line-height: 1.55; }
.dh-actions { position: relative; z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; }
.btn.dh-btn { background: #fff; color: #2540b8; font-weight: 650; border: none; padding: 10px 18px; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.btn.dh-btn:hover { background: #f4f7ff; }
.btn.dh-btn.ghost { background: rgba(255,255,255,.16); color: #fff; box-shadow: none; border: 1px solid rgba(255,255,255,.4); }
.btn.dh-btn.ghost:hover { background: rgba(255,255,255,.26); }
.made-in { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: #46566f; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card {
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 16px 18px;
  border-top: 3px solid var(--accent);
}
.stat-card .num { font-size: 27px; font-weight: 750; color: var(--ink); line-height: 1.1; }
.stat-card .lbl { font-size: 12px; color: #4d5d75; margin-top: 3px; font-weight: 500; }
/* ---------- Project cards ---------- */
.proj-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin: 22px 0 12px; flex-wrap: wrap; }
.proj-head h3 { font-size: 17px; }
.proj-head p { max-width: 560px; margin-top: 2px; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 14px; margin-bottom: 22px; }
.proj-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
  box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; gap: 8px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.proj-card:hover { transform: translateY(-3px); border-color: rgba(59,130,246,.5); box-shadow: 0 12px 26px rgba(59,92,160,.14); }
.proj-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(59,130,246,.18), var(--shadow); }
.proj-card.new { align-items: center; justify-content: center; border-style: dashed; background: #fbfcfe; min-height: 178px; }
.proj-card.new .plus { font-size: 26px; color: var(--accent); line-height: 1; }
.proj-card.new .nm { font-weight: 600; color: var(--accent); }
.proj-card.new.sample { border-color: #d8c9fb; background: #fbfaff; }
.proj-card.new.sample .plus { font-size: 22px; color: #7c3aed; }
.proj-card.new.sample .nm { color: #7c3aed; }
.pc-top { display: flex; align-items: flex-start; gap: 8px; }
.pc-name { font-weight: 650; font-size: 15px; flex: 1; line-height: 1.3; }
.pc-open { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pc-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.pc-aim { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 32px; }
.pc-stats { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); }
.pc-stats b { color: var(--ink); font-size: 13.5px; }
.pc-prog { height: 6px; background: #eef2f7; border-radius: 4px; overflow: hidden; }
.pc-prog div { height: 100%; background: var(--accent-grad); }
.pc-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pc-del {
  margin-left: auto; color: var(--danger); background: #fef2f2; border: 1px solid #fecaca;
  border-radius: 8px; padding: 3px 8px; opacity: 0; transition: opacity .18s, background .18s;
}
.proj-card:hover .pc-del, .pc-del:focus-visible { opacity: 1; }
.pc-del:hover { background: #fee2e2; color: #b91c1c; }
@media (hover: none) { .pc-del { opacity: 1; } }

/* ---------- Write-up: Methods & Results draft ---------- */
.wu-doc .wu-body { max-width: 780px; }
.wu-doc .wu-body h3 { font-size: 14px; margin: 16px 0 4px; color: #1e2b45; }
.wu-doc .wu-body h3:first-child { margin-top: 0; }
.wu-doc .wu-body p { margin-bottom: 9px; line-height: 1.72; text-align: justify; }
.wu-cap { font-weight: 650; font-size: 12.5px; margin: 18px 0 5px; color: #33415c; }
.wu-table table.grid { font-size: 12.5px; }
.wu-fig { margin: 6px 0 10px; }
table.wu-chart { width: 100%; max-width: 700px; border-collapse: collapse; }
table.wu-chart td { border: none; padding: 2px 6px; }
.wu-chart .wu-bl { width: 36%; font-size: 12.5px; color: #33415c; }
.wu-chart .wu-bt { width: 48%; }
.wu-chart .wu-bv { width: 16%; font-size: 12.5px; text-align: right; color: #4a5a72; white-space: nowrap; }
.wu-warn { border-left: 4px solid #f59e0b; background: #fffbeb; }
.wu-note { border-left: 4px solid var(--accent); background: #f5f9ff; }
.wu-chip-req { background: #fee2e2; color: #991b1b; }
.wu-refs li { margin-bottom: 7px; font-size: 13px; line-height: 1.55; }
.wu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 12px; }
.wu-demo-row { display: flex; gap: 6px; align-items: center; margin-bottom: 5px; }
.wu-demo-row input { flex: 1; min-width: 0; }

/* ---------- Dashboard mode ----------
   On the dashboard there is no project to navigate, so the whole sidebar is
   hidden and the brand plus account actions move into the top bar. The sidebar
   returns as soon as you are inside a project. */
#app.dash-mode #sidebar,
#app.dash-mode #menuToggle,
#app.dash-mode #navOverlay { display: none !important; }
#app.dash-mode #viewTitle { display: none; }
#app.dash-mode #topbar { padding: 12px 30px; }
#app.dash-mode #content { padding: 24px 30px; }
.dash-brand { display: none; align-items: center; gap: 10px; text-decoration: none; }
#app.dash-mode .dash-brand { display: flex; }
.dash-brand svg { flex-shrink: 0; filter: drop-shadow(0 3px 8px rgba(99, 102, 241, .3)); }
.dash-brand .brand-txt { font-size: 16.5px; font-weight: 600; color: var(--ink); line-height: 1.15; }
.dash-brand .brand-txt b { color: var(--accent); font-weight: 700; }
.dash-brand .brand-txt small { display: block; font-size: 10px; font-weight: 500; color: #9aa7ba; letter-spacing: .3px; }
#topActions { align-items: center; }
.top-user { display: flex; align-items: center; gap: 10px; }
.top-user .tu-name { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.2; text-align: right; }
.top-user .tu-name small { display: block; font-size: 11px; font-weight: 500; color: #8b98ab; }
.top-user .tu-av {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-grad); color: #fff; font-size: 12.5px; font-weight: 700; flex-shrink: 0;
}
@media (max-width: 640px) { .top-user .tu-name { display: none; } .dash-brand .brand-txt small { display: none; } }

/* "All projects" back button at the top of the in-project sidebar */
#nav button.nav-back { color: var(--accent); font-weight: 600; }
#nav button.nav-back:hover { background: var(--accent-soft); }

/* Inductive / deductive / hybrid approach picker and framework domain preview */
.approach-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.approach-opt {
  display: flex; gap: 9px; align-items: flex-start; cursor: pointer;
  border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px; background: #fbfcfe;
  transition: border-color .15s, background .15s;
}
.approach-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.approach-opt input { width: auto; margin-top: 3px; flex-shrink: 0; }
.approach-opt span { display: flex; flex-direction: column; gap: 2px; }
.approach-opt b { font-size: 13.5px; }
.fw-dom { border-top: 1px solid var(--line); padding: 7px 0; display: flex; flex-direction: column; gap: 1px; }
.fw-dom b { font-size: 13px; }

/* Double-coding: the three-step setup and the reconciliation list. */
.rel-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.rel-step { display: flex; gap: 10px; align-items: flex-start; background: #f8fafd; border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px; }
.rel-step .n {
  width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-grad); color: #fff; font-size: 12px; font-weight: 700;
}
.rel-step b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.rel-step span.small { display: block; line-height: 1.5; }

.recon-list { border: 1px solid var(--line); border-radius: 10px; max-height: 420px; overflow-y: auto; }
.recon-row {
  display: grid; grid-template-columns: 104px 150px 1fr 130px; gap: 10px; align-items: baseline;
  padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.recon-row:last-child { border-bottom: none; }
.recon-row:nth-child(odd) { background: #fbfcfe; }
.recon-who { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; text-align: center; }
.recon-who.a { background: #dbeafe; color: #1e40af; }
.recon-who.b { background: #fae8ff; color: #86198f; }
.recon-code { font-weight: 600; color: #33415c; overflow: hidden; text-overflow: ellipsis; }
.recon-text { color: var(--ink); line-height: 1.5; }
.recon-doc { font-size: 11.5px; color: var(--muted); text-align: right; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 820px) {
  .recon-row { grid-template-columns: 1fr; gap: 4px; }
  .recon-who { justify-self: start; }
  .recon-doc { text-align: left; }
}

/* Backup warning for a browser-only project. */
.backup-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fffbeb; border: 1px solid #fde68a; border-left: 4px solid #f59e0b;
  border-radius: 10px; padding: 11px 14px; margin-bottom: 14px; font-size: 13.3px; color: #7c2d12;
}
.backup-bar span { flex: 1; min-width: 240px; }
.backup-bar .icon-btn { color: #92400e; }

/* Keyboard shortcut hint on codes in the coding pane. */
kbd.code-kb {
  display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 3px;
  margin-right: 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
  background: #f8fafc; color: #7b8aa1; font: 600 10.5px ui-monospace, Consolas, monospace; flex-shrink: 0;
}

/* Undo toast — a delete is recoverable while this is on screen. */
.toast.undo { display: flex; align-items: center; gap: 12px; padding-right: 12px; }
.toast.undo .undo-btn {
  background: none; border: 1px solid rgba(255,255,255,.45); color: #fff; font: inherit;
  font-size: 12.5px; font-weight: 700; padding: 3px 12px; border-radius: 7px; cursor: pointer;
}
.toast.undo .undo-btn:hover { background: rgba(255,255,255,.16); }
.toast.undo .undo-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; overflow: hidden; border-radius: 0 0 10px 10px; }
.toast.undo .undo-bar i { display: block; height: 100%; background: rgba(255,255,255,.55); animation: undoDrain linear forwards; }
@keyframes undoDrain { from { width: 100%; } to { width: 0; } }
.toast.undo { position: relative; }

/* Audit trail */
.audit-list { border: 1px solid var(--line); border-radius: 10px; max-height: 380px; overflow-y: auto; }
.audit-row {
  display: flex; align-items: baseline; gap: 10px; padding: 8px 12px;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.audit-row:last-child { border-bottom: none; }
.audit-row:nth-child(odd) { background: #fbfcfe; }
.audit-when { color: var(--muted); font-size: 12px; white-space: nowrap; min-width: 132px; }
.audit-what { flex: 1; min-width: 0; }
.audit-who { color: var(--muted); font-size: 12px; white-space: nowrap; }
@media (max-width: 700px) { .audit-row { flex-wrap: wrap; } .audit-when { min-width: 0; } }
@media (prefers-reduced-motion: reduce) { .toast.undo .undo-bar i { animation: none; width: 100%; } }

/* Mapping each code onto a framework domain — the step that fills in coverage. */
.fw-map { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.fw-map-row {
  display: flex; align-items: center; gap: 9px; padding: 7px 11px;
  border-bottom: 1px solid var(--line); background: #fffdf7;
}
.fw-map-row:last-child { border-bottom: none; }
.fw-map-row.on { background: #f4fbf6; }
.fw-map-row .fm-name { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fw-map-row select { min-width: 210px; font-size: 12.5px; padding: 5px 8px; }
.callout-warn { border-left: 4px solid #f59e0b; background: #fffbeb; border-radius: 0 10px 10px 0; padding: 11px 14px; }
.callout-warn b { font-size: 13.5px; }

/* Names the single project a share dialog applies to, so it is never mistaken
   for sharing the whole account. */
.share-target {
  border: 1px solid #dbe6fb; background: var(--accent-soft); border-radius: 10px;
  padding: 10px 13px; margin-bottom: 12px;
}
.share-target .st-name { font-weight: 650; font-size: 15px; margin: 2px 0 3px; }

/* Divider between "Your projects" and the tool shortcuts, so the two are not
   read as one grid of projects. */
.sec-split { border-top: 1px solid var(--line); padding-top: 18px; margin: 6px 0 12px; }
.sec-split h3 { font-size: 15px; letter-spacing: .2px; text-transform: uppercase; color: #5b6b85; }
.sec-split p { margin-top: 2px; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 18px; }
.dash-card {
  background: #f7f9fd; border-radius: 12px; box-shadow: none; padding: 15px 16px;
  cursor: pointer; border: 1px solid var(--line); transition: transform .15s, border-color .15s, background .15s;
  display: block; text-decoration: none; color: inherit; /* the Guide/Academy cards are links */
}
.dash-card:hover { transform: translateY(-3px); border-color: rgba(59, 130, 246, .4); background: #fff; }
.dash-card .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 10px; background: var(--accent-soft); }
.dash-card .ic svg { width: 20px; height: 20px; fill: none; stroke: var(--accent); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.dash-card h3 { font-size: 15px; margin-bottom: 4px; }
.dash-card p { font-size: 12.8px; color: #4d5d75; line-height: 1.55; }
.dash-steps { display: flex; flex-direction: column; gap: 0; }
.dash-step { display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; align-items: baseline; }
.dash-step:first-child { border-top: none; }
.dash-step .n { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; display: grid; place-items: center; flex-shrink: 0; align-self: center; }
.dash-foot {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  color: #46566f; font-size: 12.5px; padding: 18px 0 6px; border-top: 1px solid var(--line); margin-top: 8px;
}
.dash-foot a { color: var(--accent); text-decoration: none; }

/* ---------- Learn view ---------- */
.learn { max-width: 900px; }
.learn h2 { font-size: 20px; margin-bottom: 8px; }
.learn h3 { margin: 22px 0 6px; font-size: 16px; color: var(--accent); }
.learn h4 { margin: 12px 0 4px; font-size: 14px; }
.learn ul, .learn ol { margin: 4px 0 8px 22px; }
.learn li { margin-bottom: 4px; }
.learn p { margin-bottom: 8px; }
.learn table.grid td, .learn table.grid th { font-size: 13px; }
.learn .refbox { background: #f6f9ff; border: 1px solid #dbe6fb; border-radius: 10px; padding: 12px 16px; font-size: 12.5px; margin-top: 8px; }

/* ---------- Admin ---------- */
.admin-note { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }

/* ---------- Auto-suggest modal ---------- */
.sugg-theme { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: #fbfcfe; }
.sugg-theme-head { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.sugg-code { display: flex; gap: 8px; padding: 7px 4px 7px 20px; align-items: flex-start; border-top: 1px solid var(--line); margin-top: 6px; cursor: pointer; }
.sugg-code input { margin-top: 3px; }

/* ---------- User Guide ---------- */
.guide { max-width: 860px; }
.guide h2 { font-size: 20px; margin-bottom: 8px; }
.guide h3 { margin: 20px 0 6px; font-size: 15.5px; color: var(--accent); }
.guide ul, .guide ol { margin: 4px 0 6px 22px; }
.guide li { margin-bottom: 5px; }
.guide p { margin-bottom: 6px; }

/* ---------- Memos ---------- */
.memo-card { background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.memo-card h4 { font-size: 14.5px; margin-bottom: 4px; }
.memo-card .memo-meta { font-size: 11.5px; color: #92400e; margin-bottom: 6px; }
.memo-card p { white-space: pre-wrap; font-size: 13.5px; }

/* ---------- Transcribe (AI) Workbench ---------- */
.transcribe-deck { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 900px) { .transcribe-deck { grid-template-columns: 1fr; } }
.transcribe-dropzone {
  border: 2px dashed #bfdbfe; background: #f8fafc; border-radius: var(--radius);
  padding: 24px 16px; text-align: center; cursor: pointer; transition: all .2s; margin-bottom: 12px;
}
.transcribe-dropzone:hover, .transcribe-dropzone.drag-over {
  border-color: var(--accent); background: #eff6ff;
}
.transcribe-dropzone .drop-icon {
  width: 44px; height: 44px; border-radius: 12px; background: #dbeafe; color: #1e40af;
  display: grid; place-items: center; margin: 0 auto 8px;
}
.file-pill {
  display: inline-flex; align-items: center; gap: 8px; background: #dbeafe; color: #1e40af;
  font-weight: 600; font-size: 12.5px; padding: 5px 12px; border-radius: 20px; margin-top: 8px;
}
.file-pill button { background: none; border: none; font-size: 15px; cursor: pointer; color: #1e40af; }
.options-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 12px; }
@media (max-width: 600px) { .options-3col { grid-template-columns: 1fr; } }

.progress-container {
  background: #ffffff; border: 1px solid #bfdbfe; border-radius: var(--radius);
  padding: 14px 16px; margin-top: 14px; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
}
.progress-bar-bg {
  height: 8px; width: 100%; background: #e2e8f0; border-radius: 4px; overflow: hidden; margin: 10px 0;
}
.progress-bar-fill {
  height: 100%; width: 30%; background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
  border-radius: 4px; animation: progressShimmer 2s infinite linear;
}
@keyframes progressShimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.stats-triplet { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.stat-card-mini { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; text-align: center; }
.stat-card-mini .num { font-size: 15px; font-weight: 700; color: var(--accent); }
.stat-card-mini .lbl { font-size: 11px; color: var(--muted); }

.speaker-quick-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.spk-badge {
  font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; border: 1px solid transparent;
}
.spk-badge.p1 { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.spk-badge.p2 { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
.spk-badge.p3 { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }

.turn-card {
  display: flex; gap: 12px; background: #ffffff; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; transition: all .15s;
}
.turn-card:hover { border-color: #93c5fd; box-shadow: var(--shadow); }
.turn-time-btn {
  background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 6px;
  font-family: monospace; font-size: 11.5px; font-weight: 600; color: var(--accent);
  padding: 4px 8px; cursor: pointer; height: fit-content; white-space: nowrap;
}
.turn-time-btn:hover { background: #dbeafe; }
.turn-body { flex: 1; }
.turn-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.turn-text { font-size: 14px; color: var(--ink); line-height: 1.5; outline: none; }
.turn-text[contenteditable="true"]:focus { background: #f0f7ff; border-radius: 4px; padding: 2px 4px; }

/* IndicSpeech Custom Deck Styles */
.control-deck {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 960px) {
  .control-deck { grid-template-columns: 1fr; }
}

.help-tag {
  font-size: 0.75rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
  padding: 3px 8px;
  border-radius: 6px;
}

.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 2rem 1.5rem;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
}
.dropzone-icon {
  color: #2563eb;
  margin-bottom: 0.5rem;
}
.dropzone-title {
  font-weight: 600;
  color: #0f172a;
  font-size: 0.95rem;
}
.dropzone-subtitle {
  font-size: 0.85rem;
  color: #475569;
  margin-top: 0.25rem;
}
.link-btn {
  background: none;
  border: none;
  color: #2563eb;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
  font-size: inherit;
}
.file-chosen-pill {
  margin-top: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #dbeafe;
  color: #1e3a8a;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.pill-remove {
  background: none;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  color: #1e3a8a;
  cursor: pointer;
}

.mic-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1rem 0;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.mic-divider::before, .mic-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e2e8f0;
}
.mic-divider span { padding: 0 10px; }

.mic-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.btn-record {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  font-weight: 600;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-record:hover { background: #e2e8f0; }
.btn-record.recording {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
  animation: pulse-danger 1.5s infinite;
}
.rec-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #dc2626;
}
.rec-timer {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #dc2626;
  font-size: 1.1rem;
}
@keyframes pulse-danger {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.options-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.processing-progress-box {
  margin-top: 1rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 1rem;
}
.progress-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 0.88rem;
  color: #1e40af;
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #bfdbfe;
  border-top: 2px solid #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.mono-timer {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  background: #dbeafe;
  padding: 2px 8px;
  border-radius: 6px;
  color: #1e3a8a;
  font-size: 0.82rem;
}
.progress-note {
  font-size: 0.78rem;
  color: #3b82f6;
  margin-top: 0.4rem;
}

.stats-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}
.stat-box {
  background: #f1f5f9;
  padding: 0.85rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
}
.stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0.2rem 0;
}
.stat-sub {
  font-size: 0.75rem;
  color: #475569;
  font-weight: 500;
}
.text-accent { color: #2563eb; }

.badge-status {
  font-size: 0.75rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #475569;
  padding: 3px 10px;
  border-radius: 9999px;
}
.badge-status.processing { background: #fef3c7; color: #92400e; }
.badge-status.ready { background: #d1fae5; color: #065f46; }

.audio-player-wrapper {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.85rem;
  margin-bottom: 1rem;
}
.player-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.5rem;
}
.native-audio {
  width: 100%;
  height: 40px;
  outline: none;
}
.speed-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.speed-label {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 600;
}
.btn-chip {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.btn-chip.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.speaker-quick-bar {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
}
.quick-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.speaker-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.btn-speaker-tag {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}
.btn-speaker-tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}
.p1-tag { color: #1e40af; border-color: #bfdbfe; background: #eff6ff; }
.p2-tag { color: #6d28d9; border-color: #ddd6fe; background: #f5f3ff; }

.doctor-tip-box {
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  padding: 0.85rem 1rem;
  border-radius: 0 8px 8px 0;
}
.tip-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 0.2rem;
}
.tip-desc {
  font-size: 0.78rem;
  color: #334155;
  line-height: 1.4;
}

.results-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.results-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.section-heading {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  width: 260px;
}
.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 0.85rem;
  width: 100%;
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.segments-feed {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 620px;
  overflow-y: auto;
  padding-right: 0.5rem;
}
.segment-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem 1.2rem;
  display: flex;
  gap: 1.2rem;
  transition: all 0.15s ease;
  position: relative;
}
.segment-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}
.segment-item.active-playing {
  border-color: #2563eb;
  background: #f0f7ff;
}
.segment-time-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 100px;
}
.time-btn {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #2563eb;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.time-btn:hover { background: #dbeafe; }
.segment-content { flex: 1; }
.segment-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.seg-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
}
.seg-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
}
.seg-speaker-badge {
  font-size: 0.76rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border: 1px solid transparent;
}
.seg-speaker-badge.spk-p1 { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.seg-speaker-badge.spk-p2 { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
.seg-speaker-badge.spk-p3 { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.seg-speaker-badge.spk-p4 { background: #fef3c7; color: #92400e; border-color: #fde68a; }

.segment-text {
  font-size: 0.95rem;
  color: #0f172a;
  line-height: 1.5;
  font-weight: 500;
  outline: none;
}
.segment-text[contenteditable="true"] {
  border-bottom: 1px dashed #2563eb;
  background: rgba(59, 130, 246, 0.04);
  padding: 2px 4px;
  border-radius: 4px;
}

/* ---------- Toast ---------- */
#toastWrap { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #1e293b; color: #fff; padding: 9px 18px; border-radius: 10px; font-size: 13.5px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25); animation: fadein .2s;
}
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }



/* Framework multi-select (COM-B + TDF and other paired frameworks) */
.fw-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.fw-pick-opt {
  display: flex; align-items: flex-start; gap: 8px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  background: var(--card); transition: border-color .15s, background .15s;
}
.fw-pick-opt:hover { border-color: var(--brand); }
.fw-pick-opt.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, transparent); }
.fw-pick-opt input { margin-top: 3px; flex: 0 0 auto; }
.fw-pick-opt span { display: block; line-height: 1.35; }
.callout-info {
  border: 1px solid var(--line); border-left: 3px solid var(--brand);
  background: color-mix(in srgb, var(--brand) 6%, transparent);
  border-radius: 8px; padding: 9px 12px;
}

/* "Find more like this" on a code row in the Coding view */
.code-learn {
  border: 0; background: transparent; cursor: pointer; font-size: 13px;
  line-height: 1; padding: 2px 4px; border-radius: 6px; opacity: .45;
  transition: opacity .12s, background .12s;
}
.code-item:hover .code-learn { opacity: 1; }
.code-learn:hover { background: color-mix(in srgb, var(--brand) 18%, transparent); }

/* Review queue */
.nav-badge {
  margin-left: auto; background: var(--brand); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; padding: 1px 7px; line-height: 1.5;
}
.rv-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--card); }
.rv-item.gone { opacity: .35; }
.rv-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.rv-text { line-height: 1.55; }
.rv-ctx { color: var(--muted); }
.rv-acts { display: flex; gap: 6px; margin-top: 8px; }
.rv-bar { position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 8px 0; border-bottom: 1px solid var(--line); }
.rv-progress { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.rv-progress i { display: block; height: 100%; background: var(--brand); transition: width .2s; }
