:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --text: #121826;
  --muted: #5c6475;
  --faint: #8a91a1;
  --border: #e4e7ef;
  --accent: #4f46e5;
  --accent-2: #06b6d4;
  --accent-soft: #eef0ff;
  --ok: #0f7b4f;   --ok-soft: #e4f6ee;
  --warn: #9a5a00; --warn-soft: #fff4dd;
  --mix: #1d58b8;  --mix-soft: #e7f0ff;
  --err: #b42318;  --err-soft: #fdeceb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(18, 24, 38, .04), 0 4px 16px rgba(18, 24, 38, .06);
  --shadow-lg: 0 12px 40px rgba(79, 70, 229, .14);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0f16; --surface: #141925; --surface-2: #1b2130; --text: #e9ecf3; --muted: #a3abbd; --faint: #7a8296;
    --border: #262d3d; --accent: #8b8cff; --accent-2: #22d3ee; --accent-soft: #1e2142;
    --ok: #5ad69e; --ok-soft: #10261d; --warn: #f2b85b; --warn-soft: #2b2210; --mix: #8db8ff; --mix-soft: #142238;
    --err: #ff8f86; --err-soft: #321a1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 40px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.sprite { position: absolute; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.xl { width: 30px; height: 30px; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 18px; letter-spacing: -.01em; }
.brand b { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); position: relative; box-shadow: var(--shadow-lg); }
.logo::after { content: ""; position: absolute; inset: 7px 8px; background: #fff; border-radius: 2px; clip-path: polygon(0 0, 65% 0, 100% 30%, 100% 100%, 0 100%); }
.top-right { display: flex; gap: 8px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); border: 1px solid var(--border); background: var(--surface); padding: 3px 10px; border-radius: 99px; }
.pill .ic { width: 14px; height: 14px; }
.pill.privacy { color: var(--ok); }
.pill:empty { display: none; }

/* ---------- hero ---------- */
.hero { padding: 56px 0 20px; background:
  radial-gradient(600px 240px at 15% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent),
  radial-gradient(520px 220px at 85% 0%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent); }
.eyebrow { margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.hero h1 { margin: 0 0 14px; font-size: clamp(32px, 5vw, 50px); line-height: 1.08; letter-spacing: -.03em; max-width: 760px; }
.grad { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { margin: 0; color: var(--muted); font-size: 17.5px; max-width: 640px; }
.features { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 22px 0 0; }
.features li { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; background: var(--surface); border: 1px solid var(--border); padding: 7px 12px; border-radius: 10px; box-shadow: var(--shadow); }
.features .ic { color: var(--accent); width: 16px; height: 16px; }

/* ---------- upload ---------- */
#upload-view { padding: 18px 0 8px; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 52px 20px; text-align: center; cursor: pointer;
  background: var(--surface); border: 2px dashed color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: 20px; box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease, box-shadow .2s ease, background .2s ease; }
.drop:hover, .drop:focus-visible, .drop.over { border-color: var(--accent); box-shadow: var(--shadow-lg); transform: translateY(-2px); outline: none;
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--accent-soft) 70%, var(--surface))); }
.drop-art { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 10px; border-radius: 18px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: var(--shadow-lg); }
.drop-title { font-size: 19px; font-weight: 650; }
.drop-sub { color: var(--muted); }
.link { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.drop-hint { margin-top: 8px; font-size: 13px; color: var(--faint); }

/* ---------- cards / buttons / banners ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin: 16px 0; }
.btn { display: inline-flex; align-items: center; gap: 6px; appearance: none; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  border: 1px solid transparent; border-radius: 10px; padding: 8px 14px; color: #fff; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--accent-2))); }
.btn:hover { filter: brightness(1.06); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.btn.ghost.danger:hover { border-color: var(--err); color: var(--err); }
.btn .ic { width: 16px; height: 16px; }
.banner { border-radius: 12px; padding: 12px 16px; margin: 12px 0; font-size: 15px; border: 1px solid transparent; }
.banner.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.banner.error { background: var(--err-soft); color: var(--err); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ---------- job ---------- */
#job-view { padding-top: 8px; }
.file-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.file-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); flex: none; }
.file-main { flex: 1; min-width: 200px; }
.file-name { font-weight: 650; overflow-wrap: anywhere; }
.file-facts { color: var(--muted); font-size: 14px; }
.file-actions { display: flex; gap: 8px; }

.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0; margin: 0 0 16px; }
.steps li { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--faint); font-weight: 500; }
.steps .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); flex: none; transition: all .2s; }
.steps li.done { color: var(--muted); }
.steps li.done .dot { background: var(--ok); border-color: var(--ok); }
.steps li.active { color: var(--text); font-weight: 650; }
.steps li.active .dot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 99px; transition: width .5s ease;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent)); background-size: 200% 100%; animation: flow 2s linear infinite; }
@keyframes flow { to { background-position: -200% 0; } }
.progress-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 14px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .bar-fill, .steps li.active .dot { animation: none; } * { transition: none !important; } }

/* ---------- report ---------- */
.report-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; margin-top: 8px; }
.toc { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); max-height: calc(100vh - 100px); overflow: auto; }
.toc .toc-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 4px 8px 8px; }
.toc a { display: flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; font-size: 14px; padding: 6px 8px; border-radius: 8px; }
.toc a:hover { background: var(--surface-2); color: var(--text); }
.toc .tdot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); }
.tdot.document { background: var(--ok); } .tdot.interpretation { background: var(--warn); } .tdot.mixed { background: var(--mix); }

.title-card { padding: 22px 24px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 80%, var(--surface)), var(--surface)); }
.title-card h2 { margin: 0 0 14px; font-size: clamp(22px, 3vw, 30px); line-height: 1.2; letter-spacing: -.02em; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 16px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 600; }
.facts dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0 0; }
.toolbar .label { font-size: 13px; color: var(--muted); margin-right: 2px; }

.section { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--faint); border-radius: var(--radius); margin: 14px 0; box-shadow: var(--shadow); scroll-margin-top: 80px; }
.section.document { border-left-color: var(--ok); } .section.interpretation { border-left-color: var(--warn); } .section.mixed { border-left-color: var(--mix); }
.section > summary { cursor: pointer; list-style: none; padding: 16px 20px; font-size: 17px; font-weight: 650; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.section > summary::-webkit-details-marker { display: none; }
.section > summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(45deg); transition: transform .2s; flex: none; margin-right: 4px; }
.section[open] > summary::after { transform: rotate(-135deg); }
.section-body { padding: 0 20px 18px; }
.meta-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.badge { display: inline-block; font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 99px; }
.badge.document { background: var(--ok-soft); color: var(--ok); }
.badge.interpretation { background: var(--warn-soft); color: var(--warn); }
.badge.mixed { background: var(--mix-soft); color: var(--mix); }
.badge.bad { background: var(--err-soft); color: var(--err); }
.source { display: inline-flex; align-items: center; gap: 4px; }
.source .ic { width: 14px; height: 14px; }
.content { overflow-wrap: anywhere; }
.content :is(p, ul, ol) { margin: 10px 0; }
.content li { margin: 4px 0; }
.content h3, .content h4 { margin: 16px 0 6px; font-size: 16px; }
.content table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; font-size: 14px; margin: 12px 0; }
.content th { background: var(--surface-2); font-weight: 650; }
.content th, .content td { border: 1px solid var(--border); padding: 7px 11px; text-align: left; vertical-align: top; }
.content code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: 90%; }
.content pre { overflow-x: auto; background: var(--surface-2); padding: 12px; border-radius: 10px; }
.content a { color: var(--accent); }
.quotes { display: grid; gap: 8px; margin-top: 12px; }
.quote { margin: 0; padding: 10px 14px 10px 40px; position: relative; background: var(--surface-2); border-radius: 10px; font-size: 14.5px; }
.quote .ic { position: absolute; left: 12px; top: 12px; width: 16px; height: 16px; color: var(--accent); }
.quote cite { display: block; margin-top: 4px; font-style: normal; font-size: 12.5px; color: var(--faint); }

.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.metric { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: linear-gradient(180deg, var(--surface), var(--surface-2)); }
.metric .value { font-size: 22px; font-weight: 750; letter-spacing: -.01em; overflow-wrap: anywhere; }
.metric .label { font-size: 13px; color: var(--muted); }
.metric .src { margin-top: 4px; font-size: 12px; color: var(--faint); }
.metric.unverified .src { color: var(--warn); }
.ref { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.ref:last-child { border-bottom: 0; }
.ref q { display: block; color: var(--muted); margin-top: 3px; quotes: "\201C" "\201D"; }
.small { font-size: 13px; color: var(--faint); }

.foot { color: var(--faint); font-size: 13px; padding: 40px 0 48px; }

@media (max-width: 860px) {
  .report-layout { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; }
  .toc .toc-title { width: 100%; }
}
@media (max-width: 560px) {
  .hero { padding-top: 36px; }
  .steps li { font-size: 12.5px; }
  .privacy { display: none; }
  .file-actions { width: 100%; }
}
