[hidden] { display: none !important; }

:root {
  --bg: #f4f3fb;
  --surface: #ffffff;
  --sidebar: #f8f7ff;
  --panel: #ffffff;
  --text: #17181c;
  --muted: #6b6f78;
  --faint: #9a9ea8;
  --line: #e6e7eb;
  --line-strong: #d3d5db;
  --accent: #6d5efc;
  --accent-soft: rgba(109, 94, 252, 0.12);
  --danger: #c0392b;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.04);
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; line-height: 1.25; }
p { margin: 0; }
a { color: var(--accent); }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 8px 10px; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }

/* ---------- layout: sidebar, top bar, workspace ---------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px;
  flex: none;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; }

/* Language switch: current language shown; a click opens the list to choose another. */
.lang-slot { display: flex; flex: none; }
.lang { position: relative; }
.lang-current {
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px 10px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.lang-current:hover { border-color: var(--line-strong); }
.lang-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 96px;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.lang.open .lang-menu { display: flex; }
.lang-menu button {
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
.lang-menu button:hover { background: var(--bg); }
.lang-menu button.on { color: var(--accent); font-weight: 650; background: var(--accent-soft); }
.gate-top { position: fixed; top: 16px; right: 20px; z-index: 10; }

/* The primary button comes first in the form (so Enter confirms), but is shown last. */
.dialog footer .btn.primary { order: 2; }
.dialog footer [value="cancel"] { order: -1; }

/* Analysis and country components, presets, and written documents */
.check-row { display: flex; align-items: stretch; gap: 8px; }
.check-row .check { flex: 1; min-width: 0; }
.incl {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.incl input { accent-color: var(--accent); margin: 0; }
.preset-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip-btn {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
}
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }
.pick-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.pick-row { display: flex; align-items: center; gap: 10px; }
.pick-label { flex: 1; min-width: 0; }
.doc-panel { margin-top: 24px; }
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.doc-open {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.doc-open:hover strong { color: var(--accent); }
.doc-section h3 { font-size: 16px; margin-bottom: 4px; }
.doc-section p { margin-bottom: 8px; }
.doc-text {
  width: 100%;
  min-height: 110px;
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  resize: vertical;
}

/* ---------- reports: controls, switches, option cards, checklist rows, documents ---------- */
.controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.seg { display: inline-flex; gap: 2px; padding: 4px; background: var(--line); border-radius: 12px; }
.seg-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  padding: 6px 14px;
  cursor: pointer;
}
.seg-btn:hover { color: var(--text); }
.seg-btn:focus-visible, .link-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link-btn { font: inherit; font-size: 13px; font-weight: 600; color: var(--accent); background: none; border: 0; padding: 6px 4px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.summary { font-size: 13px; color: var(--muted); margin: 0 0 18px 2px; }

.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 24px; }
.group-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow-sm); }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.group-head h3 { font-size: 14px; font-weight: 650; }
.badge-count { font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 9px; font-variant-numeric: tabular-nums; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.row:first-child { border-top: 0; }
.row-label { min-width: 0; }

.toggle { position: relative; display: inline-flex; align-items: center; flex: none; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.track { position: relative; width: 38px; height: 22px; border-radius: 999px; background: #d6d8de; transition: background 0.18s; }
.knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.18s; }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track .knob { transform: translateX(16px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s;
}
.item:hover { border-color: var(--line-strong); }
.item.done { background: linear-gradient(90deg, rgba(109, 94, 252, 0.07), var(--surface) 70%); }
.done-box { position: relative; flex: none; width: 24px; height: 24px; cursor: pointer; }
.done-box input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.tick {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1.5px solid var(--line-strong);
  color: transparent;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.15s;
}
.done-box input:checked + .tick { background: var(--accent); border-color: var(--accent); color: #fff; }
.done-box input:focus-visible + .tick { outline: 2px solid var(--accent); outline-offset: 2px; }
.item .num { flex: none; width: 24px; font-size: 12px; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; }
.item .text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .text strong { font-weight: 600; font-size: 14.5px; }
.item .text em { font-style: normal; font-size: 13px; color: var(--muted); line-height: 1.4; }
.item.done .text strong { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }

.docs { margin-top: 32px; padding-top: 26px; border-top: 1px solid var(--line); }
.docs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.docs-head h2 { font-size: 18px; margin-bottom: 4px; }
.docs-head .btn:disabled { opacity: 0.5; }
.doc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.doc-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 40px 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
}
.doc-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.doc-open { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; font: inherit; color: var(--text); background: none; border: 0; padding: 0; cursor: pointer; }
.doc-open strong { font-size: 15px; }
.doc-open:hover strong { color: var(--accent); }
.icon-btn { position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.icon-btn:hover { background: #fbeaea; color: #b91c1c; }
.empty-note { padding: 6px 2px; }

.doc-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 22px 6px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.doc-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.doc-section-head h2 { font-size: 18px; }
.section-hint { font-size: 13px; color: var(--muted); margin-top: 4px; max-width: 60ch; }
.doc-section .composed { margin: 14px -22px 0; border-radius: 0 0 18px 18px; border-width: 1px 0 0; background: var(--sidebar); }

/* Download: format choices as cards */
.dl-format { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fmt {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.fmt:hover { border-color: var(--line-strong); }
.fmt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.fmt input { position: absolute; opacity: 0; }
.fmt span { font-size: 12.5px; line-height: 1.4; }

@media (max-width: 860px) {
  .group-grid { grid-template-columns: 1fr; }
  .dl-format { grid-template-columns: 1fr; }
  .doc-section .composed { margin: 14px -18px 0; }
  .doc-section { padding: 16px 16px 4px; }
}

/* OSINT tools page */
.nav-tool { margin-top: -4px; }
.nav-tool.active { background: var(--surface); box-shadow: var(--shadow); color: var(--text); }
.tool-section { margin-bottom: 30px; }
.tool-section .group-label { color: var(--c); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.tool {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
a.tool:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--c) 45%, #fff);
}
.tool.off { background: transparent; border-style: dashed; box-shadow: none; color: var(--muted); }
.tool-badge {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  background: var(--c);
}
.tool.off .tool-badge { background: var(--bg); color: var(--muted); }
.tool-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tool-name { font-weight: 600; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.tool-host { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.tool-go { flex: none; font-size: 12px; font-weight: 600; color: var(--c); }

.crumbs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.crumbs .current {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.crumbs .sep { color: var(--faint); padding: 0 2px; }
.crumb {
  background: none;
  border: 0;
  padding: 4px 6px;
  border-radius: 7px;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crumb:hover { background: rgba(0, 0, 0, 0.05); color: var(--text); }

.main {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 32px 96px;
  min-width: 0;
}
.tab-body { display: block; }

.scrim { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.01em;
  padding: 4px 8px 8px;
}
.brand img,
.welcome img {
  flex: none;
  width: 28px;
  height: 28px;
  max-width: none;
  border-radius: 8px;
}
.welcome img { width: 90px; height: 90px; border-radius: 22px; }

.nav-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  padding: 6px 10px 0;
}

.dossier-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.dossier-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  transition: background 0.15s;
}
.dossier-item:hover { background: rgba(0, 0, 0, 0.04); }
.dossier-item.active { background: var(--surface); box-shadow: var(--shadow); }
.dossier-item .name {
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dossier-item .meta { font-size: 12px; color: var(--muted); }

.mini {
  height: 3px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.mini > span { display: block; height: 100%; background: var(--accent); }

.sidebar-foot {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.sidebar-foot .btn { flex: 1 1 auto; }

.account {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}
.account #account-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .btn { align-self: flex-start; }

/* ---------- buttons & fields ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, border-color 0.15s, transform 0.05s, filter 0.15s;
}
.btn:hover { border-color: var(--line-strong); background: #fafafb; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent); filter: brightness(1.15); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: rgba(0, 0, 0, 0.05); }
.btn.small { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--danger); }

input[type="text"], input:not([type]), textarea {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; }
input:focus, textarea:focus, .editor:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted);
}

.radio-row {
  display: flex;
  gap: 18px;
  margin-bottom: 14px;
  color: var(--text);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.switch input { accent-color: var(--accent); }

/* ---------- page header ---------- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.head-text { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 4px; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.title-input {
  font: inherit;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 2px 8px;
  margin-left: -8px;
  width: 100%;
}
.title-input:hover { border-color: var(--line); }
.title-input:focus { background: var(--surface); box-shadow: none; }
.sub-input {
  font: inherit;
  font-size: 15px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 2px 8px;
  margin-left: -8px;
  width: 100%;
}
.sub-input:hover { border-color: var(--line); }
.sub-input:focus { background: var(--surface); box-shadow: none; }

.stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.stat {
  font-size: 13px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
}

.fact-head { align-items: center; flex-wrap: nowrap; }
.fact-head .title-input { font-size: 24px; flex: 1; width: auto; min-width: 0; }

/* ---------- progress ---------- */

.progress {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0 0 22px;
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  color: var(--muted);
  text-align: left;
}
button.progress { cursor: pointer; }
.progress-track {
  flex: 1;
  height: 8px;
  background: var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ec4899);
  border-radius: 8px;
  transition: width 0.3s ease;
}
.progress-label { font-size: 13px; min-width: 96px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- tabs: a segmented control ---------- */

.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 4px;
  background: #ebebef;
  border-radius: 12px;
  margin-bottom: 22px;
  max-width: 100%;
}
.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  border-radius: 9px;
  padding: 6px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.count {
  display: inline-block;
  font-size: 12px;
  line-height: 18px;
  background: var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 0 7px;
  font-variant-numeric: tabular-nums;
}
.tab.on .count { background: var(--accent-soft); color: var(--accent); }

/* Section cards: clickable boxes, grouped into "Working with the facts" and "Writing the report". */
.section-nav { display: flex; flex-direction: column; gap: 22px; margin-bottom: 26px; }
.section-group { min-width: 0; }
.group-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 10px 2px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 12px;
}
.section-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-width: 0;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.section-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--c, var(--accent)) 45%, #fff); }
.section-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.section-card.on { border-color: var(--c, var(--accent)); box-shadow: 0 0 0 1px var(--c, var(--accent)), var(--shadow); }
.sc-icon {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--c, var(--accent)) 16%, #fff);
  color: var(--c, var(--accent));
  display: grid;
  place-items: center;
}
.sc-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sc-title { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.sc-desc { font-size: 13px; color: var(--muted); line-height: 1.4; }
.sc-meta {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border-radius: 999px;
  padding: 2px 9px;
  font-variant-numeric: tabular-nums;
  min-width: 26px;
  text-align: center;
}
.section-card.on .sc-meta { background: var(--accent-soft); color: var(--accent); }
.section-card.soon { background: transparent; border-style: dashed; box-shadow: none; }
.section-card.soon .sc-title,
.section-card.soon .sc-icon { color: var(--muted); }
.section-card.soon .sc-icon { background: var(--bg); }
.section-card.soon:hover { transform: none; box-shadow: none; }

/* Dossier title is plain text; it is changed from the sidebar's Options menu. */
.dossier-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.dossier-sub { margin: 4px 0 0; font-size: 15px; color: var(--muted); overflow-wrap: anywhere; }
.dossier-options {
  display: block;
  margin: 2px 0 8px 10px;
  padding: 4px 10px;
  background: none;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.dossier-options:hover { color: var(--text); background: rgba(0, 0, 0, 0.04); }

.empty-section {
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  padding: 28px 24px;
  max-width: 640px;
}
.empty-section h2 { margin: 0 0 8px; font-size: 18px; }
.empty-section p { margin: 0 0 6px; color: var(--muted); }

.menu { display: flex; flex-direction: column; gap: 4px; }
.menu-item {
  text-align: left;
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--text);
}
.menu-item:hover { border-color: var(--line-strong); background: var(--sidebar); }
.menu-item.danger { color: #b91c1c; }

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ---------- fact list ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}
.card {
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 124px;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
}
.card h4 { font-size: 15px; }
.card p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- panels & fact sheet ---------- */

.fact-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.4fr);
  gap: 16px;
  align-items: start;
}
.fact-grid.single { grid-template-columns: 1fr; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
  box-shadow: var(--shadow);
}
.panel + .panel,
.fact-grid + .panel,
.panel + .fact-grid { margin-top: 16px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.panel-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }

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

.source {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}
.source header { display: flex; align-items: center; gap: 8px; }
.source .source-title { font-weight: 650; word-break: break-word; }
.source .ref { word-break: break-word; font-weight: 550; }
.source blockquote,
.pop-item blockquote {
  margin: 0;
  padding: 4px 10px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-style: italic;
  white-space: pre-wrap;
}
.source .notes { color: var(--muted); font-size: 13px; white-space: pre-wrap; }
.source footer { display: flex; gap: 6px; margin-top: 2px; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 7px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.kind { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.thumbs img { height: 64px; width: auto; border-radius: 8px; border: 1px solid var(--line); object-fit: cover; }
.thumb { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.thumb img { height: 72px; }

/* Cited passages in the block editor: dotted underline, hover shows the source. */
.cite {
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 4px;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  cursor: pointer;
}
.cite:hover { background: transparent; }

/* ---------- building blocks ---------- */

.blocks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fact-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.fact-block:focus-within { border-color: var(--line-strong); box-shadow: var(--shadow); }
.fact-block > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.block-tools { display: flex; gap: 2px; flex-wrap: wrap; }
.block-tools .btn.small { height: 28px; padding: 0 8px; }

.block-text {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 9px 12px;
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.block-text:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.block-text:empty::before {
  content: attr(data-placeholder);
  color: var(--faint);
  pointer-events: none;
}
.format { min-width: 30px; }

.refs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 4px 1px 8px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
}
.chip-x {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 3px;
}

.pick { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.pick input[type="checkbox"] { margin: 0; accent-color: var(--accent); }
.pick-ref { flex: 1; min-width: 0; word-break: break-word; }
.pick .page-input { width: 90px; flex: none; padding: 4px 8px; font-size: 13px; }

.thumb-wrap { position: relative; }
.thumb-x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  cursor: pointer;
  line-height: 1;
}

/* ---------- composed text, citations and bibliography ---------- */

.composed-text p {
  white-space: pre-wrap;
  font-size: 16px;
  line-height: 1.75;
  margin: 0 0 12px;
}
.composed-text .fig {
  display: block;
  max-width: 100%;
  max-height: 300px;
  border-radius: 10px;
  margin: 6px 0 14px;
}
sup.cites { margin-left: 2px; white-space: nowrap; }

/* [n] links: each jumps to its entry in the bibliography below the text. */
.cite-link {
  display: inline-block;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 0 5px;
  margin: 0 1px;
  font-size: 12px;
  font-weight: 650;
  line-height: 18px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.cite-link:hover { background: var(--accent); color: #fff; }

.bibliography {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.bibliography h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin-bottom: 8px;
}
.bibliography ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bibliography li { padding: 3px 6px; margin: 0 -6px; border-radius: 8px; transition: background 0.4s; }
.bibliography li a { color: var(--text); word-break: break-all; }
.bib-n { font-weight: 700; color: var(--accent); margin-right: 6px; font-variant-numeric: tabular-nums; }
[id^="bib-"], [id^="sheet-"] { scroll-margin-top: 80px; }
.flash { background: var(--accent-soft) !important; }

/* ---------- questions: list, map, links ---------- */

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: #ebebef;
  border-radius: 10px;
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.segmented button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.segmented.wide { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: #f0eff3; border: 0; border-radius: 12px; }
.segmented.wide button { padding: 9px 12px; border-radius: 9px; font-weight: 550; color: var(--muted); }
.segmented.wide button.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }

.seq-list { display: flex; flex-direction: column; gap: 8px; }
.seq-item {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.15s;
}
.seq-item:hover { border-color: var(--accent); transform: translateX(2px); }
.seq-num { font-weight: 700; color: var(--muted); min-width: 22px; font-variant-numeric: tabular-nums; }
.seq-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.seq-body strong { font-weight: 600; overflow-wrap: anywhere; }
.short-answer {
  font-size: 14px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.question-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.inline-field select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  max-width: 320px;
}
.sequence { display: inline-flex; gap: 4px; }

.mindmap-wrap {
  overflow: auto;
  max-height: 70vh;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sidebar);
  padding: 16px;
}
.mindmap { position: relative; }
.mindmap svg { position: absolute; top: 0; left: 0; pointer-events: none; }
.mindmap path { fill: none; stroke: var(--line-strong); stroke-width: 2; }
.map-node {
  position: absolute;
  width: 230px;
  height: 96px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 34px 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  overflow: hidden;
}
.map-node:hover { border-color: var(--accent); }
.map-node strong {
  font-size: 14px;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.map-add {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

/* ---------- analysis ---------- */

.analysis-head { margin-bottom: 10px; }

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.check {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.15s;
}
.check:hover { border-color: var(--line-strong); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; }
.check .num {
  font-weight: 700;
  color: var(--muted);
  width: 22px;
  flex: none;
  font-variant-numeric: tabular-nums;
}
.check .text { display: flex; flex-direction: column; }
.check .text em { font-style: normal; color: var(--muted); font-size: 14px; }
.check.done strong { text-decoration: line-through; color: var(--muted); }
.check.done { background: var(--sidebar); }

/* ---------- dialogs ---------- */

dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  width: min(600px, calc(100vw - 32px));
  box-shadow: 0 24px 80px rgba(16, 24, 40, 0.22);
}
dialog::backdrop { background: rgba(17, 18, 22, 0.32); backdrop-filter: blur(2px); }

.dialog header { padding: 20px 22px 0; }
.dialog h2 { font-size: 18px; }
.dialog-body { padding: 14px 22px; max-height: 66vh; overflow-y: auto; }
.dialog footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px 20px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
}

/* Download: grouped choices with nested item lists. */
.dl { display: flex; flex-direction: column; gap: 10px; }
.dl > p { margin-bottom: 2px; }
.dl-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface);
}
.dl-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}
.dl-head input,
.dl-item input { accent-color: var(--accent); margin: 0; width: 16px; height: 16px; flex: none; }
.dl-head .count { margin-left: auto; }
.dl-sub { margin: 10px 0 0 26px; display: flex; flex-direction: column; gap: 6px; transition: opacity 0.15s; }
.dl-sub.off { opacity: 0.4; }
.dl-item { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; min-width: 0; }
.dl-item span { overflow-wrap: anywhere; }
.dl-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
  padding: 2px 0 2px 2px;
  transition: opacity 0.15s;
}
.dl-list.off { opacity: 0.4; }
.dl-note { margin: 8px 0 0 26px; }
.dl-format { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dl-format label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: border-color 0.15s, background 0.15s;
}
.dl-format label:hover { border-color: var(--line-strong); }
.dl-format label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.dl-format input { position: absolute; opacity: 0; pointer-events: none; }
.dl-format label { position: relative; }
.dl-format .muted { font-size: 13px; }
.dl-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); }

.pick-list-note { margin-bottom: 6px; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  padding: 0;
}
.swatch.on { box-shadow: 0 0 0 2px var(--text); }
.color-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.color-row input[type="color"] { width: 44px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; }

.popover {
  position: fixed;
  z-index: 10;
  width: 320px;
  max-width: calc(100vw - 24px);
  max-height: 60vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(16, 24, 40, 0.14);
  padding: 8px;
  font-size: 14px;
}
.popover[hidden] { display: none; }
.pop-item { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.pop-item + .pop-item { border-top: 1px solid var(--line); }
.pop-item .btn { align-self: flex-start; }

.welcome {
  text-align: center;
  padding: 90px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}
.welcome h1 { color: var(--text); }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

[contenteditable][data-placeholder]:empty::before { pointer-events: none; }

/* ---------- narrow screens: the sidebar becomes a drawer ---------- */

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    width: min(300px, 86vw);
    z-index: 30;
    transform: translateX(-104%);
    transition: transform 0.22s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.18);
  }
  .layout.nav-open .sidebar { transform: none; }
  .layout.nav-open .scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(17, 18, 22, 0.3);
    z-index: 25;
  }
  .menu-btn { display: inline-flex; }
  .crumb, .crumbs .sep { display: none; }
  .topbar { gap: 8px; padding: 0 14px; }
  .topbar { padding: 0 14px; }
  .main { padding: 22px 16px 80px; }
  .fact-grid { grid-template-columns: 1fr; }
  .title-input { font-size: 22px; }
  .fact-head { flex-wrap: wrap; }
  .fact-head .title-input { min-width: 100%; }
  .editor { min-height: 300px; }
  .dl-format { grid-template-columns: 1fr; }
}

/* ---------- account gate ---------- */

.gate { display: block; min-height: 100vh; background: #fbfafc; }
.auth-layout { display: grid; grid-template-columns: minmax(340px, 5fr) 6fr; min-height: 100vh; }

.auth-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 48px;
  color: #fff;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(255, 255, 255, 0.18), transparent 60%),
    linear-gradient(160deg, #a23ea3 0%, #6e1f78 55%, #3f1148 100%);
  overflow: hidden;
}
.auth-hero::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -160px;
  bottom: -160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
}
.hero-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; }
.hero-brand img { border-radius: 9px; }
.hero-copy { display: flex; flex-direction: column; gap: 16px; max-width: 460px; }
.hero-copy h2 { font-size: 40px; line-height: 1.1; letter-spacing: -0.02em; }
.hero-copy p { font-size: 17px; color: rgba(255, 255, 255, 0.82); }
.hero-points { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.hero-points li {
  position: relative;
  padding-left: 26px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 15px;
}
.hero-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f0c8ef;
  box-shadow: 0 0 0 4px rgba(240, 200, 239, 0.25);
}
.hero-foot { position: relative; z-index: 1; font-size: 13px; color: rgba(255, 255, 255, 0.7); }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-inner { width: min(420px, 100%); display: flex; flex-direction: column; gap: 18px; }
.auth-inner h1 { font-size: 30px; letter-spacing: -0.02em; }
.auth-inner .muted { margin-top: -10px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; margin: 0; }

.form { display: flex; flex-direction: column; gap: 14px; }
.input { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 550; color: var(--text); }
.input input,
.inline-input input,
.form input {
  height: 48px;
  padding: 0 14px;
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  background: #fff;
  border: 1px solid #dcd9e2;
  border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input input::placeholder,
.inline-input input::placeholder { color: #a7a2b0; }
.input input:focus,
.inline-input input:focus,
.form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.btn-primary,
.btn-secondary {
  height: 48px;
  padding: 0 20px;
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s, opacity 0.15s;
}
.btn-primary {
  border: 0;
  color: #fff;
  background: linear-gradient(180deg, #ab47ab, #7d2a86);
  box-shadow: 0 6px 18px rgba(125, 42, 134, 0.28);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-secondary {
  border: 1px solid #dcd9e2;
  color: var(--muted);
  background: #f7f6f9;
}
.btn-secondary:disabled { cursor: not-allowed; }

.error { color: #c0392b; font-size: 14px; margin: 0; min-height: 1.2em; }
.muted.small { font-size: 14px; }
.pill {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
}

.option {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid #e6e3eb;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(20, 10, 30, 0.04);
}
.option h3 { font-size: 15px; font-weight: 650; }
.option-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.option-head h3 { margin-bottom: 2px; }
.option-head p { margin: 0; }
.option .form, .option.form { gap: 12px; }
.inline-input { display: flex; gap: 8px; }
.inline-input input { flex: 1; min-width: 0; height: 46px; }
.inline-input .btn-primary { height: 46px; padding: 0 18px; }

.signout-row { margin: 4px 0 0; text-align: center; }
.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
}

@media (max-width: 860px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-hero { gap: 18px; padding: 28px 24px; }
  .hero-copy h2 { font-size: 28px; }
  .hero-copy p, .hero-points, .hero-foot { display: none; }
  .auth-panel { padding: 28px 18px 40px; }
  .auth-inner h1 { font-size: 26px; }
}

/* ==========================================================================
   v2: top-level groups, sub-tabs, hideable sidebar, setup tab, progress per analysis
   Motion: ease-out curves, 150-250ms, press feedback, hover only where a pointer exists,
   nothing animated on keyboard actions, reduced motion respected.
   ========================================================================== */
:root { --ease-out: cubic-bezier(0.23, 1, 0.32, 1); }

.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand-row .brand { flex: 1; min-width: 0; }
.icon-btn-ghost {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), color 0.15s var(--ease-out), transform 0.15s var(--ease-out);
}
.icon-btn-ghost:active { transform: scale(0.96); }
.icon-btn-ghost:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .icon-btn-ghost:hover { background: rgba(0, 0, 0, 0.05); color: var(--text); }
}
@media (min-width: 861px) {
  .layout.sidebar-hidden .sidebar { display: none; }
}
@media (max-width: 860px) {
  #sidebar-show { display: none !important; }
}

/* Top-level choice: facts, report, tools */
.groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 4px 0 16px; }
.group-choice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), background-color 0.18s var(--ease-out), transform 0.15s var(--ease-out);
}
.group-choice:active { transform: scale(0.98); }
.group-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .group-choice:hover { border-color: color-mix(in srgb, var(--accent) 40%, #fff); }
}
.group-choice.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
  background: linear-gradient(180deg, var(--accent-soft), var(--surface) 75%);
}
.gc-title { font-weight: 650; font-size: 15px; line-height: 1.3; }
.gc-desc { font-size: 13px; color: var(--muted); line-height: 1.45; }

/* Tabs inside the chosen group */
.subnav { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.subtab {
  position: relative;
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 10px 12px 12px;
  cursor: pointer;
  transition: color 0.18s var(--ease-out);
}
.subtab:active { transform: scale(0.98); }
.subtab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.subtab:disabled { cursor: default; opacity: 0.65; }
@media (hover: hover) and (pointer: fine) {
  .subtab:hover:not(:disabled) { color: var(--text); }
}
.subtab.on { color: var(--text); font-weight: 650; }
.subtab.on::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.soon-pill {
  margin-left: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--line);
  border-radius: 999px;
  padding: 1px 7px;
}

/* Setup tab: name and sections, before a document exists */
.setup { display: flex; flex-direction: column; gap: 18px; }
.field-lg { display: flex; flex-direction: column; gap: 6px; max-width: 520px; }
.field-lg > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-lg input {
  font: inherit;
  font-size: 17px;
  padding: 12px 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  transition: border-color 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
}
.field-lg input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.setup-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }
.setup-foot .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.row-hint { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }

/* Progress of one written analysis */
.doc-progress {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.doc-progress .progress-track { display: block; height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 8px; }
.doc-progress .progress-fill { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), #ec4899); transition: width 0.3s var(--ease-out); }
.doc-progress p { margin: 0; }
.doc-pct { font-size: 12px; font-weight: 600; color: var(--accent); }

.done-toggle { position: relative; display: inline-flex; align-items: center; gap: 8px; flex: none; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.done-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.done-toggle input:checked + .track { background: var(--accent); }
.done-toggle input:checked + .track .knob { transform: translateX(16px); }
.done-toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.add-block { margin: 2px 0 14px; }

/* Sign-in screen */
.gate-top { position: fixed; top: 16px; right: 20px; z-index: 10; }
.auth-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-hero {
  background: var(--accent);
  color: #fff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
}
.hero-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; }
.hero-brand img { border-radius: 10px; }
.hero-copy h2 { font-size: 36px; line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 14px; max-width: 16ch; text-wrap: balance; }
.hero-copy > p { font-size: 16px; line-height: 1.55; opacity: 0.9; max-width: 44ch; margin: 0 0 28px; }
.hero-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.hero-points li { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; line-height: 1.45; }
.hero-points svg { flex: none; margin-top: 1px; padding: 3px; width: 16px; height: 16px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); }
.hero-foot { font-size: 13px; opacity: 0.75; margin: 0; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 56px 24px; background: var(--bg); }
.auth-inner { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; animation: gate-rise 0.42s var(--ease-out) both; }
@keyframes gate-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-inner { animation: none; }
  .btn-primary, .auth-tabs button, .group-choice, .subtab, .icon-btn-ghost { transition: none; }
}
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--line); border-radius: 12px; }
.auth-tabs button {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  padding: 9px 10px;
  cursor: pointer;
  transition: background-color 0.18s var(--ease-out), color 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), transform 0.15s var(--ease-out);
}
.auth-tabs button:active { transform: scale(0.98); }
.auth-tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.auth-inner h1 { font-size: 26px; letter-spacing: -0.02em; margin-top: 8px; }
.lede { color: var(--muted); margin: -6px 0 6px; font-size: 15px; line-height: 1.5; }
.form { display: flex; flex-direction: column; gap: 14px; }
.field-row { display: flex; flex-direction: column; gap: 6px; }
.field-row > span:first-child { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-row input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  transition: border-color 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
}
.field-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pw { position: relative; display: block; }
.pw input { padding-right: 84px; }
.reveal {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out);
}
.reveal:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (hover: hover) and (pointer: fine) {
  .reveal:hover { background: var(--accent-soft); }
}
.error { color: #b91c1c; font-size: 13.5px; line-height: 1.45; margin: 0; }
.error:empty { display: none; }
.btn-primary {
  height: 46px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s var(--ease-out), opacity 0.15s var(--ease-out), filter 0.15s var(--ease-out);
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
}
.auth-inner .option {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.auth-inner .option h3 { font-size: 15px; margin: 0 0 10px; }
.option-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.option-head h3 { margin: 0 0 4px; }
.inline-input { display: flex; gap: 8px; }
.inline-input input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}
.inline-input input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inline-input .btn-primary { height: 44px; padding: 0 16px; flex: none; }
.pill { font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.btn-secondary { height: 40px; width: 100%; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font: inherit; font-weight: 600; cursor: default; }
.signout-row { text-align: center; margin: 4px 0 0; }
.link { font: inherit; font-size: 14px; color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 860px) {
  .groups { grid-template-columns: 1fr; }
  .auth-layout { grid-template-columns: 1fr; }
  .auth-hero { padding: 36px 24px 28px; gap: 22px; }
  .hero-copy h2 { font-size: 26px; }
  .hero-points { display: none; }
  .auth-panel { padding: 28px 18px 44px; align-items: flex-start; }
  .gate-top { top: 12px; right: 12px; }
}

/* Setup cards read better as a single column of sections */
.setup .group-grid { grid-template-columns: minmax(0, 640px); }

/* Sign-in bullets: only the check marks, none of the old dot markers */
.hero-points li::before, .hero-points li::after { content: none !important; display: none !important; }
.hero-points li { padding-left: 0; }
