/* Johto — grafiitti, syvä vihreä ja kupari */

:root {
  --bg: #070b09;
  --bg-2: #0a100d;
  --panel: #0e1512;
  --panel-2: #121b17;
  --card: #111a16;
  --elev: #18241f;
  --line: #1e2c26;
  --line-2: #2a3d34;
  --text: #efe9dc;
  --text-2: #c9cdc4;
  --muted: #93a39a;
  --faint: #63736a;
  --gold: #cf8f5e;
  --gold-2: #ecb98f;
  --gold-3: #8d5c38;
  --gold-soft: rgba(207, 143, 94, 0.12);
  --gold-line: rgba(207, 143, 94, 0.32);
  --red: #b5392f;
  --red-2: #e2675b;
  --red-soft: rgba(181, 57, 47, 0.16);
  --green: #5bb592;
  --green-soft: rgba(91, 181, 146, 0.13);
  --blue: #8fb3c9;
  --blue-soft: rgba(129, 160, 127, 0.14);
  --serif: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 10px;
  --r-sm: 7px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7);
  --top: 60px;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 78% -12%, rgba(65, 86, 69, 0.45), transparent 62%),
    radial-gradient(700px 400px at -10% 110%, rgba(140, 80, 40, 0.16), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
svg { width: 1em; height: 1em; flex-shrink: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(207, 143, 94, 0.35); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #324134; border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #445847; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ───────── Painikkeet ───────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5em; justify-content: center;
  height: 36px; padding: 0 14px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500; letter-spacing: 0.01em; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.btn svg { font-size: 15px; }
.btn-ghost { border: 1px solid var(--line-2); color: var(--text-2); background: rgba(255, 255, 255, 0.015); }
.btn-ghost:hover:not(:disabled) { border-color: var(--gold-line); color: var(--gold-2); background: var(--gold-soft); }
.btn-gold {
  color: #1c0f06; font-weight: 600;
  background: linear-gradient(180deg, #ecb98f 0%, #cf8f5e 55%, #b7764a 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 8px 22px -10px rgba(207, 143, 94, 0.75);
}
.btn-gold:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 12px 28px -10px rgba(207, 143, 94, 0.9); }
.btn-lg { height: 46px; padding: 0 24px; font-size: 15px; border-radius: 9px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-link { color: var(--gold); gap: 0.45em; font-size: 14px; display: inline-flex; align-items: center; padding: 6px 4px; }
.btn-link:hover { color: var(--gold-2); text-decoration: underline; text-underline-offset: 3px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center;
  color: var(--muted); border: 1px solid transparent; font-size: 18px;
}
.icon-btn:hover { color: var(--gold-2); border-color: var(--line-2); }
.mini-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px;
  border-radius: 6px; color: var(--muted); font-size: 12px; border: 1px solid var(--line);
}
.mini-btn:hover:not(:disabled) { color: var(--gold-2); border-color: var(--gold-line); }
.link-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--gold); font-size: 12.5px; }
.link-btn:hover { color: var(--gold-2); }

/* ───────── Yläpalkki ───────── */
.topbar {
  position: relative; z-index: 20;
  height: var(--top); display: flex; align-items: center; gap: 18px;
  padding: 0 18px 0 16px;
  background: linear-gradient(180deg, rgba(16, 22, 17, 0.97), rgba(14, 18, 15, 0.92));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.topbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--gold-3) 18%, var(--gold) 50%, var(--red) 82%, transparent 100%);
  opacity: 0.55;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; padding: 6px; border-radius: 50%;
  color: var(--gold); border: 1px solid var(--gold-line);
  background: radial-gradient(circle at 50% 30%, rgba(207, 143, 94, 0.18), transparent 70%);
}
.brand-name { font-family: var(--serif); font-size: 25px; font-weight: 700; letter-spacing: 0.01em; line-height: 1; }
.brand-name span { color: var(--gold); }
.brand-sub { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); margin-top: 3px; }
.case-meta { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; }
.case-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px;
  border: 1px solid var(--line-2); color: var(--text-2); font-size: 12px; white-space: nowrap;
}
.case-chip b { color: var(--gold-2); font-weight: 600; font-family: var(--mono); font-size: 11.5px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.shield {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 99px;
  font-size: 12px; font-weight: 500; color: var(--muted); border: 1px solid var(--line-2);
}
.shield svg { font-size: 14px; }
.shield.ok { color: var(--green); border-color: rgba(91, 181, 146, 0.4); background: var(--green-soft); }
.shield.warn { color: var(--gold-2); border-color: var(--gold-line); background: var(--gold-soft); }
.shield.bad { color: var(--red-2); border-color: rgba(226, 103, 91, 0.5); background: var(--red-soft); }
.cost-pill { font-family: var(--mono); font-size: 11.5px; color: var(--faint); padding: 0 6px; }

/* ───────── Asettelu ───────── */
.layout {
  height: calc(100vh - var(--top));
  height: calc(100dvh - var(--top));
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 410px;
}
.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 27, 22, 0.85), rgba(16, 21, 17, 0.85));
  overflow-y: auto; display: flex; flex-direction: column;
}
.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat {
  border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0;
  background: linear-gradient(180deg, rgba(20, 27, 22, 0.9), rgba(15, 20, 16, 0.92));
}
.layout[data-state='empty'] .sidebar > .panel:not(:first-child) { display: none; }
.layout[data-state='empty'] .tabs { display: none; }

/* ───────── Paneelit ───────── */
.panel { padding: 16px 16px 14px; border-bottom: 1px solid var(--line); }
.panel-grow { flex: 1 0 auto; display: flex; flex-direction: column; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.panel-head h2 {
  font-size: 11px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 7px;
}
.count {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0; color: var(--gold-2);
  background: var(--gold-soft); border: 1px solid var(--gold-line); border-radius: 99px; padding: 0 7px; line-height: 17px;
}
.count.warn { color: var(--red-2); background: var(--red-soft); border-color: rgba(226, 103, 91, 0.4); }
.panel-note { font-size: 12px; color: var(--muted); margin: -4px 0 10px; line-height: 1.45; }

.doc-list { display: flex; flex-direction: column; gap: 6px; }
.doc-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--r-sm); background: var(--panel-2); border: 1px solid var(--line);
  cursor: pointer; transition: border-color 0.15s;
}
.doc-item:hover { border-color: var(--line-2); }
.doc-item.active { border-color: var(--gold-line); }
.doc-id { font-family: var(--mono); font-size: 11px; color: var(--gold); border: 1px solid var(--gold-line); border-radius: 5px; padding: 1px 5px; }
.doc-info { min-width: 0; }
.doc-name { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.doc-sub { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-sub.err { color: var(--red-2); }
.doc-x { color: var(--faint); font-size: 14px; padding: 4px; border-radius: 5px; }
.doc-x:hover { color: var(--red-2); background: var(--red-soft); }
.doc-item.loading .doc-sub::after { content: ''; display: inline-block; width: 9px; height: 9px; margin-left: 6px; border: 1.5px solid var(--gold); border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -1px; }
.drop-mini {
  margin-top: 8px; padding: 10px; border: 1px dashed var(--line-2); border-radius: var(--r-sm);
  font-size: 11.5px; color: var(--faint); text-align: center; cursor: pointer;
}
.drop-mini:hover, .drop-mini.over { border-color: var(--gold); color: var(--gold-2); background: var(--gold-soft); }
.layout[data-state='empty'] .drop-mini { display: none; }

.client-box { display: flex; flex-direction: column; gap: 6px; }
.client-chip {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--gold-line); background: linear-gradient(90deg, rgba(207, 143, 94, 0.14), rgba(207, 143, 94, 0.03));
}
.client-chip svg { color: var(--gold); font-size: 14px; }
.client-chip .nm { font-family: var(--serif); font-size: 17px; font-weight: 600; flex: 1; line-height: 1.15; }
.client-chip .tk { font-family: var(--mono); font-size: 10.5px; color: var(--gold); }
.client-empty { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.client-empty b { color: var(--gold-2); font-weight: 500; }
.client-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.client-suggest button {
  font-size: 12px; padding: 4px 9px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--text-2);
}
.client-suggest button:hover { border-color: var(--gold-line); color: var(--gold-2); }

.role-filter { display: flex; gap: 4px; flex-wrap: wrap; margin: -2px 0 10px; }
.role-filter button {
  font-size: 11px; padding: 2px 8px; border-radius: 99px; color: var(--faint); border: 1px solid var(--line);
}
.role-filter button:hover { color: var(--text-2); }
.role-filter button.on { color: var(--gold-2); border-color: var(--gold-line); background: var(--gold-soft); }
.people { margin: 0 -6px; padding: 0 6px; display: flex; flex-direction: column; gap: 2px; }
.person, .org-row {
  display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 8px;
  padding: 7px 6px; border-radius: var(--r-sm); border: 1px solid transparent;
}
.person:hover { background: rgba(255, 255, 255, 0.025); border-color: var(--line); }
.person.flash { animation: flash 1.2s ease; }
.person.client { background: linear-gradient(90deg, rgba(207, 143, 94, 0.1), transparent); }
@keyframes flash { 0%, 100% { background: transparent; } 30% { background: var(--gold-soft); } }
.tok {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--gold);
  background: rgba(207, 143, 94, 0.09); border: 1px solid var(--gold-line); border-radius: 5px;
  text-align: center; padding: 1px 0;
}
.person-main { min-width: 0; }
.person-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-meta { display: flex; align-items: center; gap: 6px; margin-top: 1px; }
.role-select {
  appearance: none; -webkit-appearance: none; font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  border-radius: 4px; padding: 1px 6px; border: 1px solid transparent; background: transparent; cursor: pointer;
}
.role-select option { background: var(--panel); color: var(--text); text-transform: none; }
.r-suspect { color: #f08a9c; background: var(--red-soft); border-color: rgba(226, 103, 91, 0.3); }
.r-victim { color: #ecb98f; background: rgba(207, 143, 94, 0.1); border-color: var(--gold-line); }
.r-witness { color: #9fbbe9; background: var(--blue-soft); border-color: rgba(143, 179, 201, 0.3); }
.r-police, .r-prosecutor, .r-court { color: #a7b2c7; background: rgba(133, 158, 128, 0.1); border-color: rgba(133, 158, 128, 0.22); }
.r-counsel { color: #7fd0b0; background: var(--green-soft); border-color: rgba(91, 181, 146, 0.3); }
.r-expert, .r-interpreter, .r-other { color: var(--muted); background: rgba(117, 140, 113, 0.08); border-color: rgba(117, 140, 113, 0.18); }
.person-sub { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-actions { display: flex; align-items: center; gap: 1px; opacity: 0.55; transition: opacity 0.15s; }
.person:hover .person-actions, .person.client .person-actions { opacity: 1; }
.p-act { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; color: var(--faint); font-size: 14px; }
.p-act:hover { color: var(--gold-2); background: var(--gold-soft); }
.p-act.star.on { color: var(--gold); }
.star-label { display: none; }
@media (max-width: 880px) {
  /* Puhelimella tähti isommaksi ja selitteen kanssa, jotta päämiehen valinta on ilmeinen */
  .person-actions { opacity: 1; gap: 4px; }
  .p-act { width: 34px; height: 34px; }
  .p-act.star { width: auto; padding: 0 9px; gap: 4px; flex-shrink: 0; display: inline-flex; align-items: center; border: 1px solid var(--gold-line); color: var(--gold); border-radius: 999px; height: 30px; }
  .p-act.star.on { background: var(--gold-soft); border-color: var(--gold); }
  .star-label { display: inline; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
}
.people-empty { font-size: 12.5px; color: var(--faint); padding: 8px 2px; }
.add-name { display: flex; gap: 6px; margin-top: 10px; }
.add-name input {
  flex: 1; min-width: 0; height: 30px; border-radius: 6px; padding: 0 10px; font-size: 12.5px;
  background: var(--bg-2); border: 1px solid var(--line); outline: none;
}
.add-name input:focus { border-color: var(--gold-line); }
.add-name .mini-btn { height: 30px; }

.review { display: flex; flex-direction: column; gap: 4px; max-height: 210px; overflow-y: auto; }
.review-item { display: flex; align-items: center; gap: 8px; padding: 5px 2px; font-size: 12.5px; }
.review-item .w { flex: 1; font-weight: 500; }
.review-item .n { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.review-item button { font-size: 11px; padding: 2px 8px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--text-2); }
.review-item button.anon { border-color: var(--gold-line); color: var(--gold-2); }
.review-item button:hover { background: var(--gold-soft); }
.review-item.likely .w::after { content: 'nimi?'; margin-left: 6px; font-size: 10px; color: var(--red-2); font-weight: 600; }

.privacy { background: linear-gradient(180deg, rgba(91, 181, 146, 0.05), transparent); }
.privacy-head { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--green); margin-bottom: 10px; }
.privacy-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 8px; }
.stat b { display: block; font-family: var(--serif); font-size: 21px; font-weight: 700; line-height: 1.05; color: var(--text); }
.stat span { font-size: 10.5px; color: var(--muted); }
.stat.leak b { color: var(--red-2); }
.stat.zero b { color: var(--green); }

/* ───────── Välilehdet ───────── */
.tabs { display: flex; gap: 2px; padding: 0 22px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.tab {
  position: relative; padding: 14px 14px 12px; font-size: 13px; font-weight: 500; color: var(--muted);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold-2); }
.tab.active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--gold); border-radius: 2px; }
.tab-chat { display: none; }
.view { flex: 1; overflow-y: auto; min-height: 0; }
.view-analysis { padding: 26px 30px 60px; }

/* ───────── Aloitus ───────── */
.hero { max-width: 760px; margin: 4vh auto 0; text-align: center; animation: rise 0.6s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.hero-emblem {
  width: 74px; height: 74px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--gold-line); color: var(--gold); font-size: 38px;
  background: radial-gradient(circle at 50% 35%, rgba(207, 143, 94, 0.2), transparent 70%);
  box-shadow: 0 0 0 7px rgba(207, 143, 94, 0.04), 0 0 60px -10px rgba(207, 143, 94, 0.35);
}
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 4.2vw, 46px); line-height: 1.08; letter-spacing: -0.005em; }
.hero h1 em { font-style: italic; color: var(--gold-2); font-weight: 500; }
.hero-lead { margin: 16px auto 26px; max-width: 590px; color: var(--text-2); font-size: 15.5px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer;
  padding: 34px 20px; border-radius: 14px; border: 1.5px dashed var(--line-2);
  background: linear-gradient(180deg, rgba(40, 54, 43, 0.45), rgba(24, 32, 26, 0.45));
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.dropzone:hover, .dropzone.over { border-color: var(--gold); background: linear-gradient(180deg, rgba(207, 143, 94, 0.1), rgba(24, 32, 26, 0.5)); }
.dropzone.over { transform: scale(1.01); }
.dz-icon { font-size: 34px; color: var(--gold); margin-bottom: 4px; }
.dz-title { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.dz-sub { font-size: 12.5px; color: var(--muted); }
#btn-sample { margin-top: 14px; }
.hero-points { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 34px; text-align: left; }
.hero-points li { display: flex; gap: 11px; padding: 15px; border-radius: var(--r); border: 1px solid var(--line); background: rgba(24, 32, 26, 0.55); }
.hero-points li > svg { font-size: 19px; color: var(--gold); margin-top: 2px; }
.hero-points strong { display: block; font-size: 13.5px; margin-bottom: 3px; }
.hero-points span { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ───────── Analyysin asetukset ───────── */
.setup { max-width: 920px; margin: 0 auto 22px; animation: rise 0.4s ease both; }
.setup-card {
  border-radius: 14px; border: 1px solid var(--line-2); padding: 22px 24px;
  background: linear-gradient(180deg, rgba(43, 57, 46, 0.6), rgba(26, 34, 27, 0.6)); box-shadow: var(--shadow);
}
.setup-title h2 { font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1.1; }
.setup-title p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.field-wide { grid-column: 1 / -1; }
.field-label { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.seg { display: flex; gap: 4px; padding: 3px; border-radius: 9px; background: var(--bg-2); border: 1px solid var(--line); }
.seg button {
  flex: 1; padding: 8px 10px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text-2);
  display: flex; flex-direction: column; align-items: center; line-height: 1.25;
}
.seg button small { font-size: 10.5px; color: var(--faint); font-weight: 400; }
.seg button:hover { color: var(--text); }
.seg button.on { background: linear-gradient(180deg, #334336, #28362b); color: var(--gold-2); box-shadow: 0 0 0 1px var(--gold-line) inset; }
.seg button.on small { color: var(--muted); }
.seg-sm { padding: 2px; }
.seg-sm button { padding: 5px 11px; font-size: 12px; flex: none; }
.setup-client { margin-top: 16px; }
.notice {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border-radius: 9px; font-size: 13px; line-height: 1.45;
  border: 1px solid var(--gold-line); background: var(--gold-soft); color: var(--text-2);
}
.notice svg { color: var(--gold); font-size: 16px; margin-top: 1px; }
.notice.red { border-color: rgba(226, 103, 91, 0.4); background: var(--red-soft); }
.notice.red svg { color: var(--red-2); }
.notice b { color: var(--text); font-weight: 600; }
.setup-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 20px; flex-wrap: wrap; }
.estimate { font-size: 12.5px; color: var(--muted); }
.estimate b { color: var(--text-2); font-weight: 500; }

.stale-banner, .run-bar {
  max-width: 920px; margin: 0 auto 16px; display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 13px; color: var(--text-2);
}
.stale-banner { border-color: var(--gold-line); }
.stale-banner > svg { color: var(--gold); font-size: 17px; }
.stale-banner span { flex: 1; }
.run-bar { backdrop-filter: blur(8px); background: rgba(30, 40, 32, 0.92); margin-bottom: 8px; }
.analysis-sticky { position: sticky; top: -26px; z-index: 5; max-width: 920px; margin: 0 auto 8px; padding-top: 8px; background: linear-gradient(180deg, var(--bg) 75%, rgba(12, 17, 13, 0)); }
.analysis-sticky:has(> .run-bar[hidden]):has(> .toc[hidden]) { display: none; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 10px; }
.toc-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--line-2); background: rgba(30, 40, 32, 0.92); color: var(--text-2); font-size: 12.5px; cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.toc-chip b { font-family: var(--serif); font-size: 13px; color: var(--gold); font-weight: 600; }
.toc-chip:hover { border-color: var(--gold-line); color: var(--text); }
.toc-chip.on { border-color: var(--gold); color: var(--gold-2); background: var(--gold-soft); }
.toc-chip.live b::after { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); margin-left: 5px; vertical-align: 2px; animation: pulse 1.2s ease-in-out infinite; }
.toc-chip.err { border-color: rgba(226, 103, 91, 0.5); }
.toc-chip.err b { color: #e2675b; }
.run-progress { width: 140px; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.run-progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-3), var(--gold-2)); transition: width 0.4s ease; }
.run-bar span { flex: 1; }

/* ───────── Analyysiosiot ───────── */
.sections { max-width: 920px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.section {
  border-radius: 13px; border: 1px solid var(--line); overflow: hidden;
  background: linear-gradient(180deg, rgba(33, 44, 35, 0.75), rgba(24, 31, 25, 0.75));
  animation: rise 0.45s ease both;
}
.section-body .md { animation: none; }
.section-head {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(207, 143, 94, 0.07), transparent 60%);
}
.section-num {
  font-family: var(--serif); font-size: 15px; font-weight: 700; color: var(--gold); width: 34px; height: 34px; flex-shrink: 0;
  display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--gold-line); letter-spacing: 0.02em;
}
.section-title { flex: 1; min-width: 0; }
.section-title h3 { font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.15; }
.section-status { font-size: 11.5px; color: var(--faint); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.section-status.live { color: var(--gold); }
.section-status.err { color: var(--red-2); }
.section-status.done { color: var(--green); }
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; transform: scale(0.8); } }
.section-actions { display: flex; gap: 2px; }
.section-body { padding: 16px 20px 18px; }
.section-body.empty { color: var(--faint); font-size: 13px; font-style: italic; }
.thinking-line {
  font-size: 12.5px; color: var(--muted); font-style: italic; padding: 2px 0 2px 12px; border-left: 2px solid var(--gold-line);
  max-height: 3.2em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.skeleton { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }
.skeleton i { display: block; height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--line) 0%, var(--line-2) 50%, var(--line) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton i:nth-child(2) { width: 86%; }
.skeleton i:nth-child(3) { width: 62%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ───────── Markdown-sisältö ───────── */
.md { font-size: 14.5px; line-height: 1.62; color: var(--text-2); overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md p { margin: 0.55em 0; }
.md h2, .md h3, .md h4 { color: var(--text); line-height: 1.25; }
.md h2 { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 1.1em 0 0.4em; }
.md h3 { font-family: var(--serif); font-size: 18px; font-weight: 600; margin: 1.15em 0 0.35em; color: var(--gold-2); }
.md h4 { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; margin: 1em 0 0.3em; }
.md strong { color: var(--text); font-weight: 600; }
.md em { color: var(--text); }
.md ul, .md ol { margin: 0.5em 0 0.6em; padding-left: 1.35em; }
.md li { margin: 0.32em 0; padding-left: 0.15em; }
.md li::marker { color: var(--gold-3); }
.md ol li::marker { font-family: var(--mono); font-size: 0.85em; color: var(--gold); }
.md blockquote { margin: 0.7em 0; padding: 6px 14px; border-left: 2px solid var(--gold); background: var(--gold-soft); border-radius: 0 6px 6px 0; color: var(--text); font-style: italic; }
.md hr { border: none; height: 1px; margin: 1.1em 0; background: linear-gradient(90deg, var(--line-2), transparent); }
.md code { font-family: var(--mono); font-size: 0.86em; padding: 1px 5px; border-radius: 4px; background: var(--bg-2); border: 1px solid var(--line); }
.md .tbl-wrap { position: relative; margin: 0.7em 0 0.9em; }
/* Taulukko vierittyy omassa laatikossaan, jolloin otsikkorivi pysyy näkyvissä alaspäin vieritettäessä */
.md .tbl {
  overflow: auto; max-height: min(78vh, 900px); border: 1px solid var(--line); border-radius: 9px;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.md table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; line-height: 1.45; }
.md th {
  position: sticky; top: 0; z-index: 2;
  text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-2);
  background: var(--panel-2); padding: 9px 11px; border-bottom: 1px solid var(--gold-line); white-space: nowrap;
  box-shadow: 0 6px 10px -8px rgba(0, 0, 0, 0.7);
}
/* Sarakkeille vähimmäisleveys, ettei yksi sarake kutistu muutaman kirjaimen levyiseksi */
.md td { padding: 9px 11px; border-bottom: 1px solid var(--line); vertical-align: top; min-width: 8.5em; overflow-wrap: break-word; }
.md td:first-child { min-width: 7em; }
.md td .docref { white-space: nowrap; }
/* Vieritysvihje: häivytys oikeaan reunaan ja kultainen "Jatkuu →" -painike */
.md .tbl-wrap::after {
  content: ''; position: absolute; top: 1px; right: 1px; bottom: 1px; width: 38px; pointer-events: none;
  border-radius: 0 9px 9px 0; background: linear-gradient(90deg, transparent, rgba(12, 17, 13, 0.85));
  opacity: 0; transition: opacity 0.2s;
}
.md .tbl-wrap::before {
  content: ''; position: absolute; top: 1px; left: 1px; bottom: 1px; width: 24px; pointer-events: none; z-index: 3;
  border-radius: 9px 0 0 9px; background: linear-gradient(270deg, transparent, rgba(12, 17, 13, 0.7));
  opacity: 0; transition: opacity 0.2s;
}
.md .tbl-wrap.more::after { opacity: 1; }
.md .tbl-wrap.scrolled::before { opacity: 1; }
.tbl-hint {
  position: absolute; top: 5px; right: 6px; z-index: 4; display: none; align-items: center; gap: 3px;
  font: 600 10.5px/1 var(--sans, Inter, sans-serif); letter-spacing: 0.06em; color: #1c0f06;
  background: var(--gold); border: none; border-radius: 999px; padding: 5px 7px 5px 10px; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); animation: nudge 1.6s ease-in-out infinite;
}
.tbl-hint svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.md .tbl-wrap.more .tbl-hint { display: inline-flex; }
.md .tbl-wrap.more.scrolled .tbl-hint { animation: none; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .tbl-hint { animation: none; } }
.md tr:last-child td { border-bottom: none; }
.md tr:hover td { background: rgba(255, 255, 255, 0.015); }
.pn {
  color: var(--text); font-weight: 500; border-bottom: 1px dotted var(--gold-3); cursor: pointer; white-space: nowrap;
}
.pn:hover { color: var(--gold-2); border-bottom-color: var(--gold); }
.pn.client { color: var(--gold-2); border-bottom: 1px solid var(--gold); }
.pii-val { font-family: var(--mono); font-size: 0.86em; color: var(--text); background: rgba(143, 179, 201, 0.12); border-radius: 4px; padding: 0 4px; }
.docref {
  display: inline-flex; align-items: center; font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--gold);
  border: 1px solid var(--gold-line); border-radius: 4px; padding: 0 4px; margin: 0 1px; line-height: 16px; vertical-align: 1px; cursor: pointer;
}
.lawref { color: var(--gold-2); text-decoration: underline; text-decoration-color: var(--gold-line); text-underline-offset: 3px; white-space: nowrap; }
.lawref:hover { color: var(--gold); text-decoration-color: var(--gold); }
.docref:hover { background: var(--gold-soft); color: var(--gold-2); }
.sev {
  display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: 0.1em; padding: 1px 6px; border-radius: 4px; margin-right: 4px; vertical-align: 1.5px;
}
.sev-kriittinen { color: #ffd0d8; background: linear-gradient(180deg, #b5392f, #8a2a22); }
.sev-merkittava { color: #1c0f06; background: linear-gradient(180deg, #ecb98f, #cf8f5e); }
.sev-huomio { color: #cfe0ff; background: rgba(143, 179, 201, 0.25); border: 1px solid rgba(143, 179, 201, 0.35); }
.uncertain { color: var(--gold-2); font-size: 0.92em; font-style: italic; }

/* ───────── Asiakirjanäkymä ───────── */
.view-docs { display: flex; flex-direction: column; padding: 0; position: relative; overflow: hidden; }
.doc-toolbar { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.doc-tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.doc-tabs button { font-size: 12.5px; padding: 5px 11px; border-radius: 7px; color: var(--muted); border: 1px solid transparent; white-space: nowrap; }
.doc-tabs button b { font-family: var(--mono); font-weight: 500; color: var(--gold); margin-right: 6px; font-size: 11px; }
.doc-tabs button.on { color: var(--text); border-color: var(--line-2); background: var(--panel-2); }
.doc-legend { display: flex; gap: 14px; padding: 8px 22px; font-size: 11.5px; color: var(--muted); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.doc-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.doc-viewer {
  flex: 1; overflow-y: auto; padding: 26px 34px 80px; white-space: pre-wrap; font-family: var(--serif);
  font-size: 17px; line-height: 1.6; color: var(--text-2); tab-size: 4;
}
.doc-viewer .page { max-width: 820px; margin: 0 auto; position: relative; }
.jump-hl { position: absolute; pointer-events: none; border-radius: 4px; background: rgba(207, 143, 94, 0.28); box-shadow: 0 0 0 1px var(--gold); animation: jump-in 0.6s ease; transition: opacity 1.2s; }
.jump-hl.fade { opacity: 0.35; }
@keyframes jump-in { from { background: rgba(207, 143, 94, 0.7); } }
.hl-p {
  background: rgba(207, 143, 94, 0.16); color: var(--gold-2); border-radius: 3px; padding: 0 2px;
  box-shadow: 0 -1px 0 rgba(207, 143, 94, 0.35) inset; cursor: pointer;
}
.hl-p.focus { background: rgba(207, 143, 94, 0.42); color: #fff1e4; }
.hl-x { background: rgba(143, 179, 201, 0.16); color: #c4d6f6; border-radius: 3px; padding: 0 2px; cursor: help; }
.ai-tok { font-family: var(--mono); font-size: 0.78em; color: var(--gold); background: rgba(207, 143, 94, 0.1); border: 1px solid var(--gold-line); border-radius: 4px; padding: 0 3px; }
.ai-tok.x { color: #a9c1ee; background: rgba(143, 179, 201, 0.1); border-color: rgba(143, 179, 201, 0.35); }
.sel-btn {
  position: absolute; z-index: 10; display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; color: #1c0f06; background: linear-gradient(180deg, #ecb98f, #cf8f5e); box-shadow: var(--shadow);
}

/* ───────── Keskustelu ───────── */
.chat-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px 18px 13px; border-bottom: 1px solid var(--line); }
.chat-head h2 { font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.1; }
.chat-head p { font-size: 11.5px; color: var(--faint); margin-top: 2px; display: flex; align-items: center; gap: 5px; }
.messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.chat-empty { margin: auto; text-align: center; color: var(--faint); font-size: 13px; max-width: 260px; }
.chat-empty svg { font-size: 30px; color: var(--gold-3); margin-bottom: 8px; }
.msg { display: flex; flex-direction: column; gap: 5px; animation: rise 0.3s ease both; }
.msg-role { font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); display: flex; align-items: center; gap: 8px; }
.msg.user { align-items: flex-end; }
.msg.user .msg-bubble {
  max-width: 88%; padding: 10px 14px; border-radius: 13px 13px 3px 13px; font-size: 14px;
  background: linear-gradient(180deg, #394c3d, #2e3e32); border: 1px solid #465c49; color: var(--text); white-space: pre-wrap;
}
.msg.assistant .msg-bubble { padding: 2px 0; }
.msg.assistant .md { font-size: 14px; }
.msg-sent { font-size: 11px; color: var(--faint); max-width: 88%; text-align: right; }
.msg-sent summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.msg-sent summary::-webkit-details-marker { display: none; }
.msg-sent[open] summary { color: var(--muted); }
.msg-sent code { display: block; text-align: left; margin-top: 4px; font-family: var(--mono); font-size: 11px; color: var(--muted); background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; white-space: pre-wrap; }
.msg-tools { display: flex; gap: 2px; margin-top: 2px; }
.msg-err { color: var(--red-2); font-size: 13px; display: flex; gap: 6px; align-items: flex-start; }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 10px; }
.suggestions button {
  font-size: 12px; padding: 6px 11px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--text-2);
  background: rgba(255, 255, 255, 0.015); text-align: left;
}
.suggestions button:hover { border-color: var(--gold-line); color: var(--gold-2); background: var(--gold-soft); }
.composer { display: flex; align-items: flex-end; gap: 8px; margin: 0 14px 14px; padding: 8px 8px 8px 14px; border-radius: 13px; border: 1px solid var(--line-2); background: var(--bg-2); }
.composer:focus-within { border-color: var(--gold-line); box-shadow: 0 0 0 3px rgba(207, 143, 94, 0.08); }
.composer textarea { flex: 1; resize: none; border: none; outline: none; background: transparent; font-size: 14px; line-height: 1.45; max-height: 160px; padding: 6px 0; }
.composer textarea::placeholder { color: var(--faint); }
.send { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; font-size: 17px; color: #1c0f06; background: linear-gradient(180deg, #ecb98f, #cf8f5e); }
.send.stop { background: var(--red); color: #ffe0e5; }

/* ───────── Ponnahdukset, ilmoitukset ───────── */
.popover {
  position: fixed; z-index: 60; min-width: 220px; max-width: 300px; padding: 12px 14px; border-radius: 11px;
  background: #232f25; border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 13px;
}
.popover h4 { font-family: var(--serif); font-size: 18px; font-weight: 600; margin-bottom: 2px; }
.popover .meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.popover .row { display: flex; gap: 6px; flex-wrap: wrap; }
.menu { display: flex; flex-direction: column; min-width: 200px; padding: 5px; }
.menu button { text-align: left; padding: 7px 10px; border-radius: 7px; font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.menu button:hover { background: var(--gold-soft); color: var(--gold-2); }
.menu button.danger:hover { background: var(--red-soft); color: var(--red-2); }
.toasts { position: fixed; z-index: 80; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 9px; padding: 10px 15px; border-radius: 10px; font-size: 13px;
  background: #2a382c; border: 1px solid var(--line-2); box-shadow: var(--shadow); animation: rise 0.25s ease both; max-width: min(560px, 92vw);
}
.toast svg { font-size: 16px; color: var(--gold); }
.toast.err { border-color: rgba(226, 103, 91, 0.5); }
.toast.err svg { color: var(--red-2); }
.toast.ok svg { color: var(--green); }
.busy { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(12, 17, 13, 0.55); backdrop-filter: blur(3px); }
.busy-card { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-radius: 12px; background: #232f25; border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 14px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--gold-line); border-top-color: var(--gold); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal {
  margin: auto; border: 1px solid var(--line-2); border-radius: 15px; padding: 0; color: var(--text);
  background: linear-gradient(180deg, #28362b, #1c261e); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.85);
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 40px);
}
.modal-wide { width: min(720px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(9, 12, 10, 0.7); backdrop-filter: blur(3px); }
.modal-body { padding: 22px 24px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal h2 { font-family: var(--serif); font-size: 26px; font-weight: 600; }
.modal-text { font-size: 13.5px; color: var(--text-2); }
.modal-note { font-size: 12.5px; color: var(--muted); line-height: 1.55; padding: 11px 13px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); }
.modal-note strong { display: block; color: var(--text-2); margin-bottom: 3px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.toggle-row, .field-row { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.toggle-row input { margin-top: 3px; accent-color: var(--gold); width: 16px; height: 16px; flex-shrink: 0; }
.toggle-row small, .field-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.45; }
.field-row { flex-direction: column; gap: 6px; cursor: default; }
.field-row input { height: 36px; border-radius: 8px; padding: 0 12px; background: var(--bg-2); border: 1px solid var(--line-2); outline: none; }
.field-row input:focus { border-color: var(--gold-line); }
.export-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.export-sections label { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }
.export-sections input { accent-color: var(--gold); }
.merge-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; }
.merge-list button { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); font-size: 13px; }
.merge-list button:hover { border-color: var(--gold-line); background: var(--gold-soft); }
.privacy-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.privacy-table td, .privacy-table th { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.privacy-table th { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.privacy-ok { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 10px; background: var(--green-soft); border: 1px solid rgba(91, 181, 146, 0.35); color: #bfe8d6; font-size: 13.5px; margin-bottom: 12px; }
.privacy-ok svg { color: var(--green); font-size: 18px; }

.mobile-nav { display: none; }

/* ───────── Responsiivisuus ───────── */
.view-chat-slot { display: flex; flex-direction: column; overflow: hidden; }
.view-chat-slot .chat { display: flex; flex: 1; border-left: none; background: transparent; }
.view-chat-slot .chat-head { padding-left: 22px; }
@media (max-width: 1320px) {
  .layout { grid-template-columns: 280px minmax(0, 1fr); }
  .layout > .chat { display: none; }
  .tab-chat { display: block; }
}
@media (max-width: 880px) {
  body { font-size: 14px; }
  .topbar { padding: 0 10px; gap: 8px; }
  .brand-sub, .case-meta, .hide-sm, .cost-pill { display: none !important; }
  .brand-mark { width: 30px; height: 30px; }
  .layout { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - var(--top) - 62px); }
  .sidebar { display: none; border: none; }
  .layout[data-view='case'] .sidebar { display: flex; }
  .layout[data-view='case'] .workspace { display: none; }
  .layout[data-state='empty'] .sidebar > .panel:first-child { display: block; }
  .tabs { display: none !important; }
  .view-analysis { padding: 18px 16px 40px; }
  .hero { margin-top: 1vh; }
  .hero-points { grid-template-columns: 1fr; }
  .setup-grid { grid-template-columns: 1fr; }
  .setup-card { padding: 18px 16px; }
  .section-head { padding: 12px 14px; gap: 10px; }
  .section-body { padding: 14px 15px; }
  .section-title h3 { font-size: 19px; }
  .doc-viewer { padding: 18px 16px 70px; font-size: 16px; }
  .doc-toolbar, .doc-legend { padding-left: 16px; padding-right: 16px; }
  .analysis-sticky { top: -18px; }
  .toc { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .toc::-webkit-scrollbar { display: none; }
  .view-chat-slot .chat-head { padding-left: 16px; }
  .mobile-nav {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; height: 62px; z-index: 30;
    padding-bottom: env(safe-area-inset-bottom); background: rgba(15, 20, 16, 0.97); border-top: 1px solid var(--line); backdrop-filter: blur(10px);
  }
  .mobile-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; color: var(--faint); font-weight: 500; letter-spacing: 0.03em; }
  .mobile-nav button svg { font-size: 19px; }
  .mobile-nav button.on { color: var(--gold-2); }
  .export-sections { grid-template-columns: 1fr; }
  .toasts { bottom: 76px; }
}

/* ───────── Lainkohta-ikkuna ───────── */
.law-body { display: flex; flex-direction: column; gap: 10px; max-height: 62vh; overflow-y: auto; }
.law-title { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.law-head { font-family: var(--serif); font-size: 21px; font-weight: 600; color: var(--text); }
.law-head span { color: var(--gold-2); }
.law-mom { display: flex; flex-direction: column; gap: 3px; padding-left: 12px; border-left: 2px solid var(--gold-line); }
.law-mom-n { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.law-mom p { font-family: var(--serif); font-size: 16.5px; line-height: 1.55; color: var(--text-2); white-space: pre-line; }
.law-meta { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.law-error { color: var(--text-2); font-size: 14px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--gold-line); background: var(--gold-soft); }
.law-loading { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; padding: 14px 0; }
.law-loading .spinner { width: 18px; height: 18px; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.notice-btn { display: flex; width: fit-content; gap: 6px; margin-top: 10px; }
.notice-btn svg { width: 14px; height: 14px; }
.people.flash .person { animation: flash-person 1.6s ease 2; }
@keyframes flash-person { 0%, 100% { box-shadow: none; } 40% { box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(207, 143, 94, 0.25); } }
/* Johto: yhtiöt ja henkilöt ilman rikosprosessin rooleja */
.org-row:hover { background: rgba(255, 255, 255, 0.025); border-color: var(--line); }
.org-row .tok { color: var(--blue); border-color: rgba(143, 179, 201, 0.35); }
.org-list { max-height: 240px; overflow-y: auto; }
.org-ex { font-size: 11.5px; color: var(--faint); padding: 6px 6px 0; }
.org-ex button { color: var(--gold); font-size: 11.5px; margin-right: 6px; }
.org { color: var(--text); border-bottom: 1px dotted var(--blue); white-space: nowrap; }
.ai-tok.y { color: var(--blue); }
.p-act.star, .role-select, .role-filter { display: none !important; }
