/*
  Expedientes Ocultos · ARCHIVO FORENSE. Colors and fonts come from the student's design sheet:
  classified-dossier look, navy ink on cool gray-white, blue for official records, red for what
  was suppressed. Inter for titles and body, a monospace (IBM Plex Mono) for IDs, dates, labels,
  coordinates, hashes and nav labels. Shared baseline first (./shared/base.css), then this.
*/

/* ---------- Fonts (self-hosted, Latin subset, SIL OFL: see fonts/OFL-*.txt) ---------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("./fonts/inter-400-600-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/ibm-plex-mono-regular-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./fonts/ibm-plex-mono-semibold-latin.woff2") format("woff2");
}

/* ---------- Sheet tokens ---------- */
:root {
  --page: #F5F7FB;        /* background */
  --card: #FFFFFF;        /* cards */
  --panel: #EEF2F9;       /* metadata panel */
  --navy: #0F1A3A;        /* primary text */
  --slate: #5A6275;       /* secondary text */
  --blue: #3D4F9F;        /* accent: official records, actions */
  --red: #C62828;         /* alert: suppressed, altered, censored */
  --red-bg: #FDECEC;      /* red tag background */
  --black: #111111;       /* black label tag */
  --ok: #1E6B45;          /* integrity check passed */

  --bg: var(--page);
  --surface: var(--card);
  --surface-2: var(--panel);
  --ink: var(--navy);
  --ink-2: var(--slate);
  --line: rgb(15 26 58 / 10%);
  --accent: var(--blue);
  --accent-ink: #FFFFFF;
  --accent-soft: rgb(61 79 159 / 10%);
  --bad: var(--red);
  --good: var(--ok);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: var(--font);
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(15 26 58 / 6%), 0 4px 16px rgb(15 26 58 / 5%);
  --max: 1100px;
  color-scheme: light;
}
/* The sheet is a light design: keep it light even when the device is in dark mode. */
@media (prefers-color-scheme: dark) {
  :root { --bg: var(--page); --surface: var(--card); --surface-2: var(--panel); --ink: var(--navy); --ink-2: var(--slate); }
}

body { background: var(--page); color: var(--navy); font-family: var(--font); }
h1, h2, h3 { color: var(--navy); letter-spacing: -0.01em; }
a { color: var(--blue); }
code, .mono { font-family: var(--font-mono); }
.red { color: var(--red); }
.muted { color: var(--slate); }
:focus-visible { outline: 3px solid rgb(61 79 159 / 55%); outline-style: solid; outline-offset: 2px; }

.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon.tiny { width: 16px; height: 16px; }

.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; background: var(--navy); color: #fff; border-radius: var(--radius-sm); }
.skip-link:focus { top: 8px; }

/* ---------- Header ---------- */
.topbar { min-height: 64px; background: rgb(245 247 251 / 92%); }
.topbar .head-text { flex: 1; min-width: 0; }
.kicker { margin: 0; font-family: var(--font-mono); font-size: .72rem; font-weight: 600; letter-spacing: .14em; color: var(--blue); }
.head-title { margin: 0; font-size: 1.5rem; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-actions { display: flex; align-items: center; gap: 6px; }
.head-actions .btn.ghost, .back { color: var(--navy); position: relative; }
.head-actions [aria-pressed="true"] { color: var(--blue); }
.head-actions [aria-pressed="true"] .icon { fill: var(--blue); }
.head-actions .dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; border: 0; flex: none;
  display: inline-grid; place-items: center; cursor: pointer;
  background: var(--navy); color: #fff; font: 600 .85rem var(--font-mono); letter-spacing: .04em;
}
.avatar.big { width: 56px; height: 56px; font-size: 1rem; }

/* ---------- Tags ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 4px;
  font: 600 .7rem/1.4 var(--font-mono); letter-spacing: .06em; white-space: nowrap;
}
.tag-blue { background: var(--accent-soft); color: var(--blue); }
.tag-red { background: var(--red-bg); color: var(--red); }
.tag-sev { background: var(--red); color: #fff; }
.tag-black { background: var(--black); color: #fff; }
.tag-ok { background: rgb(30 107 69 / 10%); color: var(--ok); }
.tag-pending { background: var(--panel); color: var(--slate); }
.tag-fiction { background: transparent; color: var(--slate); border: 1px dashed currentColor; }
.label { font-size: .7rem; font-weight: 600; letter-spacing: .1em; color: var(--slate); margin: 0 0 4px; }
.label.red { color: var(--red); }

/* ---------- Archivo Central de Casos ---------- */
.purge-banner {
  width: 100%; display: flex; align-items: center; gap: 10px; min-height: 52px; margin-bottom: 14px; padding: 10px 14px;
  border: 1px solid rgb(198 40 40 / 25%); border-radius: var(--radius-sm); background: var(--red-bg); color: var(--red);
  font: inherit; text-align: left; cursor: pointer;
}
.purge-banner span:nth-child(2) { flex: 1; color: var(--navy); }
.purge-banner strong { color: var(--red); }
.purge-banner .banner-action { font-size: .72rem; font-weight: 600; letter-spacing: .1em; }
.purge-banner[aria-pressed="true"] { background: var(--red); color: #fff; }
.purge-banner[aria-pressed="true"] span, .purge-banner[aria-pressed="true"] strong { color: #fff; }
.search { margin-bottom: 12px; }
.search input { background: var(--card); border-color: var(--line); box-shadow: var(--shadow); }
.chips { margin-bottom: 8px; }
.chip { min-height: 44px; padding: 0 16px; font-size: .9rem; background: var(--card); color: var(--navy); }
.chip[aria-pressed="true"] { background: var(--navy); color: #fff; }
.result-count { font-size: .72rem; letter-spacing: .12em; color: var(--slate); margin: 10px 0; }
.case-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); }
.case-card { display: flex; gap: 14px; padding: 14px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); height: 100%; }
.thumb { flex: none; width: 92px; height: 92px; border-radius: 10px; overflow: hidden; background: var(--panel); }
.thumb svg { width: 100%; height: 100%; display: block; }
.case-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.case-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.case-id { font-size: .78rem; font-weight: 600; color: var(--blue); letter-spacing: .04em; }
.case-title { margin: 0; font-size: 1.15rem; font-weight: 600; }
.case-headline { display: flex; gap: 6px; align-items: flex-start; margin: 0; font-size: .92rem; }
.case-headline.alert { color: var(--red); }
.case-headline.ok { color: var(--ok); }
.case-headline .icon { margin-top: 2px; }
.meta { margin: 0; font-size: .74rem; color: var(--slate); letter-spacing: .02em; }
.see-more {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: auto; align-self: flex-start;
  font-weight: 600; text-decoration: none; color: var(--blue);
}
.fiction-note { margin: 24px 0 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--panel); color: var(--slate); font-size: .88rem; }
.fiction-note a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }

/* ---------- Línea Temporal ---------- */
.case-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 10px; }
.lead { font-size: 1.02rem; line-height: 1.55; color: var(--navy); max-width: 70ch; margin: 0 0 14px; }
.segmented {
  display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 16px; max-width: 520px;
  background: var(--panel); border-radius: 12px;
}
.segmented a {
  display: grid; place-items: center; min-height: 44px; border-radius: 9px; text-decoration: none;
  color: var(--slate); font-weight: 600; font-size: .95rem;
}
.segmented a[aria-current="true"] { background: var(--card); color: var(--navy); box-shadow: var(--shadow); }
.segmented a[aria-current="true"]:last-child { color: var(--red); }
.timeline-layout { display: grid; gap: 16px; align-items: start; }
@media (min-width: 900px) {
  .timeline-layout { grid-template-columns: 340px minmax(0, 1fr); }
  .meta-panel { position: sticky; top: 84px; }
}
.meta-panel { background: var(--panel); border-radius: var(--radius); padding: 16px; }
.panel-title { margin: 0 0 10px; font-size: 1.05rem; font-weight: 600; }
.panel-sub { margin: 18px 0 8px; font-size: .95rem; font-weight: 600; }
.meta-list { margin: 0; display: grid; gap: 10px; }
.meta-list.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.meta-list dt { font: 600 .68rem var(--font-mono); letter-spacing: .1em; color: var(--slate); }
.meta-list dd { margin: 2px 0 0; font-size: .92rem; overflow-wrap: anywhere; }
.hash-row { display: flex; align-items: center; gap: 8px; }
.btn.copy { min-height: 44px; min-width: 44px; padding: 0 10px; }
.custody { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.custody li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.custody p { margin: 0; font-size: .88rem; }
.custody-mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--slate); }
.custody-ok .custody-mark { background: var(--ok); color: #fff; }
.custody-bad .custody-mark { background: var(--red); color: #fff; }

.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 8px; }
.section-head .panel-title { margin: 0; }
.rail { list-style: none; margin: 0; padding: 0 0 0 26px; position: relative; }
.rail::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: rgb(61 79 159 / 30%); }
.node { position: relative; margin-bottom: 12px; }
.node > .dot { position: absolute; left: -24px; top: 18px; width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--page); background: var(--blue); }
.node-hidden > .dot { background: var(--red); }
.node-gap > .dot { background: var(--page); border: 2px dashed var(--red); }
.node-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.node-hidden .node-card { border-left: 3px solid var(--red); }
.gap-card { background: transparent; box-shadow: none; border: 1.5px dashed rgb(198 40 40 / 45%); }
.gap-card p { margin: 0 0 8px; }
.gap-card .btn { min-height: 44px; }
.node-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.stamp { margin: 0; font-size: .8rem; color: var(--slate); }
.node-title { margin: 2px 0 4px; font-size: 1.02rem; font-weight: 600; }
.node-detail { margin: 0 0 6px; color: var(--navy); font-size: .93rem; line-height: 1.5; }
.was { margin: 0 0 6px; font-size: .88rem; color: var(--slate); }
.geo, .source { display: flex; align-items: center; gap: 4px; margin: 2px 0 0; font-size: .72rem; color: var(--slate); letter-spacing: .02em; }

/* ---------- Ficha de Evidencia ---------- */
.ev-title { margin: 4px 0 8px; font-size: 1.45rem; font-weight: 600; line-height: 1.25; }
.evidence-grid { display: grid; gap: 12px; margin: 14px 0 12px; }
@media (min-width: 900px) { .evidence-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
.evidence-grid .card + .card { margin-top: 0; }
.card + .card { margin-top: 12px; }
.tri-score { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 8px; }
.tri-score .big { font-size: 2.2rem; font-weight: 600; color: var(--navy); }
.meter { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 10px; }
.meter span { height: 6px; border-radius: 3px; background: var(--red-bg); }
.meter span.on { background: var(--blue); }
.sources { list-style: none; margin: 0; padding: 0; }
.sources li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.sources p { margin: 0; }
.sources .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--blue); color: #fff; }
.sources li.no .mark { background: var(--red-bg); color: var(--red); }
.sources .mono { font-size: .68rem; letter-spacing: .08em; color: var(--slate); }
.spectro-wrap { position: relative; border-radius: 8px; overflow: hidden; background: var(--panel); --p: 0; }
.spectrogram { display: block; width: 100%; height: 170px; }
.playhead { position: absolute; top: 0; bottom: 0; left: calc(var(--p) * 100%); width: 2px; background: var(--red); opacity: 0; }
.spectro-wrap.playing .playhead { opacity: 1; }
.spectro-axis { display: flex; justify-content: space-between; font-size: .68rem; color: var(--slate); letter-spacing: .06em; margin: 4px 0 10px; }
.visual .row p { margin: 0; flex: 1; min-width: 200px; }
.visual .btn[aria-pressed="true"] { background: var(--red); color: #fff; border-color: transparent; }
.video-strip { width: 100%; height: auto; display: block; margin-bottom: 8px; }
.transcript, .doc-lines { list-style: none; margin: 0; padding: 0; }
.transcript li, .doc-lines li { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .93rem; align-items: start; }
.transcript .mono { font-size: .8rem; color: var(--slate); }
.transcript .censored .bar { background: var(--black); color: #fff; padding: 6px 10px; border-radius: 3px; font-size: .72rem; letter-spacing: .1em; }
.doc-lines .tag { justify-self: start; }
.doc-alterado > span:last-child, .doc-eliminado > span:last-child { color: var(--red); }
.doc-eliminado > span:last-child { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.was-line { display: block; font-size: .78rem; color: var(--slate); margin-top: 2px; }
.hash-box { margin-top: 14px; padding: 12px; border-radius: var(--radius-sm); background: var(--panel); }
.hash-line { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.hash { display: block; font-size: .8rem; line-height: 1.45; overflow-wrap: anywhere; word-break: break-all; color: var(--navy); flex: 1; }
.hash.sealed { color: var(--slate); margin-bottom: 10px; }
.verdict { display: flex; align-items: center; gap: 6px; margin: 6px 0; font-weight: 600; }
.verdict.ok { color: var(--ok); }
.verdict.bad { color: var(--red); }
.verdict.warn { color: #8A5A00; }
.canonical summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--blue); }
.canonical pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .78rem; background: var(--card); padding: 10px; border-radius: 6px; margin: 0 0 8px; }
.canonical .btn { min-height: 44px; }
.cotejo-grid { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 8px; }
@media (min-width: 640px) { .cotejo-grid { grid-template-columns: 1fr auto 1fr; align-items: center; } }
.cotejo-grid p { margin: 0 0 2px; }
.big-time { font-size: 1.35rem; font-weight: 600; }
.delta { text-align: center; padding: 10px 16px; border-radius: var(--radius-sm); background: var(--red-bg); }
.delta-value { font-size: 1.4rem; font-weight: 600; color: var(--red); }

/* ---------- Auditoría ---------- */
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 16px 0; }
.tile { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; border-top: 3px solid var(--blue); }
.tile.bad { border-top-color: var(--red); }
.tile-num { margin: 0; font: 600 1.7rem var(--font-mono); }
.audit-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.audit-list .card + .card { margin-top: 0; }
.audit-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.audit-head a { display: inline-block; padding: 12px 0; min-height: 44px; font-weight: 600; text-decoration: none; }
.audit-case p { margin: 0 0 6px; }
.audit-ev { list-style: none; margin: 0; padding: 0; }
.audit-ev li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.audit-ev li.ok { color: var(--ok); }
.audit-ev li.bad { color: var(--red); font-weight: 600; }
.audit-ev a { display: inline-flex; align-items: center; min-height: 44px; }
.audit-ev code { color: var(--slate); }
.checker { margin-top: 16px; }
.checker textarea, .checker input { font-family: var(--font-mono); font-size: 16px; }

/* ---------- Guardados, perfil, ética ---------- */
.saved-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.saved-list .card + .card { margin-top: 0; }
.saved-link { display: inline-block; padding: 12px 0; min-height: 44px; font-weight: 600; text-decoration: none; margin-bottom: 4px; }
.prose { max-width: 760px; }
.prose h2 { font-size: 1.1rem; margin: 18px 0 6px; }
.prose p { line-height: 1.6; }
.sheet-title { margin: 0; font-size: 1.15rem; }
.profile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.plain-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.filters-form fieldset { border: 0; padding: 0; margin: 12px 0; }
.radio-row { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.install-hint { margin: 12px 16px 0; }

/* ---------- Bottom nav: mono labels ---------- */
.tabbar { background: rgb(255 255 255 / 94%); }
.tabbar a { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .04em; text-transform: uppercase; max-width: 160px; }
.tabbar a[aria-current="page"] { color: var(--blue); background: var(--accent-soft); font-weight: 600; }
.tabbar .icon { width: 22px; height: 22px; }

/* ---------- Phone ---------- */
@media (max-width: 520px) {
  .head-title { font-size: 1.2rem; }
  .case-card { flex-direction: row; }
  .thumb { width: 72px; height: 72px; }
  .spectrogram { height: 130px; }
  .tabbar a { font-size: .58rem; letter-spacing: 0; }
}
