/* Digital Bridge RDC theme: SOURCE tokens (DIGITAL BRIDGE RDC THEME.md) + spec v1.2 extensions (compact app scale, header bar, dark theme). */
:root {
  /* SOURCE */
  --color-primary-accent: #41B6E6;
  --color-secondary-brand: #2E294E;
  --color-surface-white: #FFFFFF;
  --color-surface-subtle: #F8FAFC;
  --color-border-ui: #E2E8F0;
  --color-text-headers: #2E294E;
  --color-text-main: #0F172A;
  --color-text-secondary: #334155;
  --color-text-on-accent: #FFFFFF;
  --spacing-unit: 1rem;
  --border-radius-ui: 14px;
  --shadow-subtle: 0 8px 24px rgba(15, 23, 42, 0.08);
  /* aliases / extensions */
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Space Grotesk', 'Poppins', sans-serif;
  --container-max: 1120px;
  --gutter: 24px;
  --action-hover: #2FA8D7;
  --logo-plate: #FFFFFF;
}
:root, :root[data-theme="light"] {
  color-scheme: light;
  --page: var(--color-surface-white); --surface: var(--color-surface-white); --surface-subtle: var(--color-surface-subtle);
  --border: var(--color-border-ui); --heading: var(--color-text-headers); --text: var(--color-text-main); --text-muted: var(--color-text-secondary);
  --action: var(--color-primary-accent); --icon: var(--color-secondary-brand); --card-shadow: var(--shadow-subtle);
  --action-text: #2E294E; --action-border: #2E294E; --control-border: #64748B; --link: #2E294E; --highlight-text: #2E294E; --focus: #2E294E;
  --ok: #0b7a5a; --mid: #8a6a00; --warm: #b4530a; --hot: #c62039;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0B1220; --surface: #111C2E; --surface-subtle: #18263D; --border: #334155; --control-border: #94A3B8;
  --heading: #F8FAFC; --text: #F1F5F9; --text-muted: #CBD5E1; --action: #41B6E6; --action-hover: #2FA8D7; --action-text: #2E294E; --action-border: #41B6E6;
  --link: #41B6E6; --highlight-text: #41B6E6; --icon: #CBD5E1; --focus: #F8FAFC; --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  --ok: #2fd6a1; --mid: #e8c04a; --warm: #ff8a3d; --hot: #ff6b81;
}

* { box-sizing: border-box; }
html { font-size: 14px; }
body { margin: 0; background: var(--page); color: var(--text); font-family: var(--font-body); line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: hidden; min-height: 100vh; }
.container { max-width: var(--container-max); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 680px; }
@media (max-width: 47.999rem) { :root { --gutter: 16px; } }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--action); color: var(--action-text); padding: .5rem 1rem; border-radius: 10px; z-index: 50; font-weight: 600; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
a { color: var(--link); }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 700; color: var(--heading); letter-spacing: -0.02em; margin: 0 0 .5rem; }
h1 { font-size: 1.9rem; line-height: 1.15; margin-bottom: .35rem; }
h2 { font-size: 1.15rem; line-height: 1.25; margin-bottom: .6rem; }
@media (max-width: 47.999rem) { h1 { font-size: 1.5rem; } }
p { max-width: 75ch; }
.muted { color: var(--text-muted); } .small { font-size: .85rem; }
.text-highlight { display: block; color: var(--highlight-text); font-weight: 600; text-transform: uppercase; font-size: .75rem; letter-spacing: .05em; margin-bottom: .3rem; }

/* ── header bar (spec §3.1) ── */
.app-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; padding-block: 10px; }
.brand-block { display: flex; align-items: center; gap: 14px; min-width: 0; text-decoration: none; cursor: pointer; }
.brand { display: block; background: var(--logo-plate); padding: 4px; border-radius: 10px; line-height: 0; flex: none; }
.brand-logo { display: block; width: 108px; max-width: none; height: auto; object-fit: contain; }
@media (max-width: 47.999rem) { .brand-logo { width: 84px; } }
.brand-text { display: grid; line-height: 1.2; min-width: 0; }
.app-name { font: 700 1.15rem/1.2 var(--font-heading); color: var(--heading); letter-spacing: -0.02em; }
.app-sub { font-size: .8rem; color: var(--text-muted); }
@media (max-width: 47.999rem) { .app-name { font-size: 1.1rem; } }
.utilities { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.version-pill, .status-pill { font-size: .72rem; font-weight: 600; padding: .15rem .6rem; border: 1px solid var(--border); background: var(--surface-subtle); border-radius: 999px; color: var(--text-muted); }
.status-pill.ok { color: var(--ok); } .status-pill.warn { color: var(--mid); }
@media (max-width: 47.999rem) { .version-pill { display: none; } }
.lang-switch { border: 1px solid var(--control-border); border-radius: 999px; padding: 2px; display: inline-flex; margin: 0; min-width: 0; }
.lang-opt { position: relative; display: inline-flex; cursor: pointer; }
.lang-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.lang-opt span { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; min-height: 26px; padding: 0 .55rem; font-size: .75rem; font-weight: 600; border-radius: 999px; color: var(--text); }
.lang-opt input:checked + span { background: var(--action); color: var(--action-text); }
.lang-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.theme-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 2px 0; }
.switch { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 11px; background: var(--control-border); position: relative; margin: 0; cursor: pointer; flex: none; border: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--color-secondary-brand); transition: transform .2s ease; }
:root[data-theme="dark"] .switch:not(:checked)::after { background: #F8FAFC; }
.switch:checked { background: var(--action); } .switch:checked::after { transform: translateX(16px); }
.theme-state { font-size: .75rem; font-weight: 600; color: var(--text); }

/* ── hero (compact app intro band) ── */
.hero { background: var(--surface-subtle); border-bottom: 1px solid var(--border); padding: 1rem 0 1.1rem; }
.hero h1 { margin-bottom: .3rem; }
.lead { font-size: .9rem; line-height: 1.5; margin: 0; color: var(--text-muted); }
.workspace { padding-top: 1rem; padding-bottom: 1rem; }

/* ── cards / buttons ── */
.card-ui { background: var(--surface); border: 1px solid var(--border); border-radius: var(--border-radius-ui); box-shadow: var(--card-shadow); }
.pad { padding: 1rem 1.25rem; }
.card-h { font: 700 .8rem var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 .8rem; }
.btn-primary, .btn-secondary { min-height: 36px; font: 600 .9rem var(--font-body); padding: .5rem 1rem; border-radius: var(--border-radius-ui); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; transition: background-color .2s ease, transform .1s ease; }
.btn-primary { background: var(--action); color: var(--action-text); border: 1px solid var(--action-border); box-shadow: 0 4px 6px -1px rgba(65, 182, 230, 0.2); padding: .5rem 1.6rem; }
.btn-primary:hover { background: var(--action-hover); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--control-border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-subtle); }
.btn-secondary:disabled { opacity: .45; cursor: not-allowed; }
.link-btn { background: none; border: 0; color: var(--link); text-decoration: underline; cursor: pointer; font: inherit; padding: 2px 4px; }

/* ── input card ── */
.input-card { max-width: 760px; margin: 0 auto; padding: 1rem 1.25rem; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-bottom: .8rem; }
.tab { border: 0; background: transparent; color: var(--text-muted); font: 600 .9rem var(--font-body); min-height: 34px; padding: .35rem .8rem; border-radius: 9px; cursor: pointer; }
.tab.on { background: var(--surface); color: var(--heading); box-shadow: 0 1px 4px rgba(15, 23, 42, .12); }
.drop { display: flex; align-items: center; gap: 14px; padding: .8rem 1rem; border-radius: var(--border-radius-ui); border: 1.5px dashed var(--control-border); cursor: pointer; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--action); background: color-mix(in oklab, var(--action) 8%, transparent); }
.drop.has { border-style: solid; border-color: var(--ok); }
.drop .icon-thin { flex: none; stroke: var(--icon); stroke-width: 1.5px; }
.drop-text { display: grid; flex: 1; min-width: 0; line-height: 1.35; }
.drop-text strong { color: var(--heading); font-size: .95rem; overflow-wrap: anywhere; } .drop-text span { font-size: .82rem; overflow-wrap: anywhere; }
@media (max-width: 47.999rem) { .drop { flex-wrap: wrap; } .drop .btn-secondary { width: 100%; } }
.field { display: grid; gap: 5px; } .lbl { font-size: .8rem; font-weight: 600; color: var(--text-muted); }
input[type=text], input[type=password], input:not([type]), select, textarea { width: 100%; min-height: 36px; background: var(--surface); color: var(--text); border: 1px solid var(--control-border); border-radius: 10px; padding: .45rem .7rem; font: .9rem var(--font-body); }
textarea { min-height: 76px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
input::placeholder, textarea::placeholder { color: color-mix(in oklab, var(--text-muted) 75%, transparent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .grid2:empty { display: none; }
@media (max-width: 40rem) { .grid2 { grid-template-columns: 1fr; } }
.options { padding: .7rem 2px .2rem; }
.switch-row { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .9rem; padding: 2px 0; }
.decision-box { margin: .5rem 0 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-subtle); }
.decision-box summary { list-style: none; cursor: pointer; padding: .6rem .9rem; display: flex; gap: 10px; align-items: center; font-size: .9rem; min-height: 36px; }
.decision-box summary::-webkit-details-marker { display: none; }
.chev { width: 7px; height: 7px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(-45deg); transition: .15s; flex: none; }
.decision-box[open] .chev { transform: rotate(45deg); }
.dec-body { padding: 0 .9rem .9rem; display: grid; gap: 10px; } .dec-body p { margin: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--text-muted); }
.actions { display: flex; align-items: center; gap: 14px; padding-top: .8rem; flex-wrap: wrap; }
.error { color: var(--hot); font-size: .9rem; font-weight: 500; }
.facts { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 0; margin: 1.2rem auto 0; max-width: 960px; }
.facts li { font-size: .85rem; color: var(--text-muted); padding: .8rem 1rem; border-top: 1px solid var(--border); }
.facts b { display: block; color: var(--heading); font-family: var(--font-heading); margin-bottom: 2px; }
@media (max-width: 47.999rem) { .facts { grid-template-columns: 1fr; } }

/* ── progress ── */
.progress-card { text-align: center; margin-top: 8vh; padding: 1.8rem 1.4rem; }
.scan { height: 64px; width: 64px; margin: 0 auto 8px; border-radius: 50%; border: 2px solid var(--border); position: relative; overflow: hidden; }
.scan::before { content: ''; position: absolute; inset: 19px; border-radius: 50%; background: var(--action); }
.scan i { position: absolute; left: 0; right: 0; height: 2px; background: var(--color-secondary-brand); animation: sweep 1.6s ease-in-out infinite alternate; }
:root[data-theme="dark"] .scan i { background: #F8FAFC; }
@keyframes sweep { from { top: 6%; } to { top: 92%; } }
.bar { height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; margin: 14px 0 12px; }
.bar span { display: block; height: 100%; width: 0; background: var(--action); border-radius: 99px; transition: width .5s ease; }
@media (prefers-reduced-motion: reduce) { .scan i { animation: none; top: 50%; } * { transition: none !important; } }

/* ── results ── */
.result-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; padding: .4rem 0 .9rem; flex-wrap: wrap; }
.r-name { overflow-wrap: anywhere; max-width: 760px; margin: 0; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.grid-main { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 63.999rem) { .grid-main { grid-template-columns: 1fr; } }
.side { display: grid; gap: 1rem; position: sticky; top: 12px; }
@media (max-width: 63.999rem) { .side { position: static; } }
.main-col { display: grid; gap: 1rem; min-width: 0; }
.verdict { text-align: center; padding: 1.2rem; }
.gauge { position: relative; width: 170px; margin: 0 auto 6px; } .gauge svg { width: 100%; display: block; }
.g-track { fill: none; stroke: var(--border); stroke-width: 11; }
.g-fill { fill: none; stroke: var(--ok); stroke-width: 11; stroke-linecap: round; stroke-dasharray: 364.4; stroke-dashoffset: 364.4; transition: stroke-dashoffset 1.1s cubic-bezier(.2,.8,.2,1), stroke .6s; }
.g-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.g-center span { font: 700 2.6rem/1 var(--font-heading); letter-spacing: -.03em; color: var(--heading); }
.g-center small { font-size: .68rem; font-weight: 600; color: var(--text-muted); letter-spacing: .06em; text-transform: uppercase; margin-top: 3px; }
.v-label { margin: 4px 0 8px; font-size: 1.1rem; }
.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; } .chips.left { justify-content: flex-start; }
.chip { font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--control-border); color: var(--text-muted); background: var(--surface); }
.chip.hot { color: var(--hot); border-color: var(--hot); } .chip.good { color: var(--ok); border-color: var(--ok); } .chip.mid { color: var(--mid); border-color: var(--mid); } .chip.low { color: var(--warm); border-color: var(--warm); }
#v-summary { margin: 0 auto; font-size: .9rem; }
.dets { display: grid; gap: .9rem; }
.det .row { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; } .det .name { overflow-wrap: anywhere; font-weight: 500; } .det .val { font-weight: 600; font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: 99px; background: var(--border); margin: 6px 0 4px; overflow: hidden; } .meter i { display: block; height: 100%; border-radius: 99px; }
.det .why { font-size: .8rem; color: var(--text-muted); } .det.err .val { color: var(--hot); }
.prov { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.prov li { display: grid; grid-template-columns: 10px 1fr; gap: 10px; font-size: .9rem; }
.prov .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--text-muted); } .prov .ai .dot { background: var(--hot); } .prov .human .dot { background: var(--ok); }
.prov b { display: block; } .prov span { color: var(--text-muted); font-size: .82rem; overflow-wrap: anywhere; }
.notes { margin: 0; padding-left: 1.2rem; color: var(--text-muted); font-size: .88rem; display: grid; gap: .5rem; }
.dec-verdict { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; } .dec-verdict strong { font: 700 1rem var(--font-heading); color: var(--heading); }
.dec-reason { font-size: .9rem; margin: 0 0 10px; }
.dec-list { margin: 0 0 8px; padding-left: 1.1rem; font-size: .85rem; color: var(--text-muted); display: grid; gap: 4px; }
.dec-meta { font-size: .75rem; font-weight: 600; color: var(--text-muted); margin: 8px 0 3px; }
.dec-ask { display: grid; gap: 10px; }

/* annotated text */
.doc-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: .8rem; } .doc-head .card-h { margin: 0; }
.legend { display: flex; align-items: center; gap: 8px; font-size: .75rem; color: var(--text-muted); } .legend i { display: block; width: 100px; height: 8px; border-radius: 99px; background: linear-gradient(90deg, #2fd6a1, #e8c04a, #ff8a3d, #ff4560); }
.seg-filter { display: inline-flex; gap: 2px; background: var(--surface-subtle); border: 1px solid var(--border); padding: 3px; border-radius: 10px; }
.seg-filter button { border: 0; background: transparent; color: var(--text-muted); min-height: 28px; padding: 0 .8rem; border-radius: 7px; font: 600 .8rem var(--font-body); cursor: pointer; } .seg-filter button.on { background: var(--surface); color: var(--heading); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.doc-wrap { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 12px; }
.minimap { position: sticky; top: 12px; height: min(70vh, 540px); display: flex; flex-direction: column; gap: 1px; border-radius: 6px; overflow: hidden; background: var(--border); align-self: start; }
.minimap button { flex: 1 1 0; min-height: 2px; border: 0; padding: 0; cursor: pointer; background: var(--c, var(--border)); } .minimap button:hover { outline: 2px solid var(--text); }
.doc { display: grid; gap: 8px; align-content: start; }
.page-tag { font-size: .72rem; font-weight: 700; letter-spacing: .08em; color: var(--text-muted); text-transform: uppercase; padding: 10px 0 2px; border-bottom: 1px solid var(--border); }
.seg { position: relative; padding: .6rem .9rem .6rem 1rem; border-radius: 10px; border-left: 4px solid var(--c, var(--border)); background: var(--bg, transparent); font-size: 1rem; line-height: 1.65; overflow-wrap: anywhere; scroll-margin-top: 20px; }
.seg:not(.unscored) { padding-right: 4.8rem; }
.seg.unscored { color: var(--text-muted); border-left-color: var(--border); font-size: .92rem; }
.seg .tag { position: absolute; right: 8px; top: 6px; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--surface); color: var(--text); border: 1px solid var(--c); opacity: 0; transition: .15s; }
.seg:hover .tag, .seg.flag .tag { opacity: 1; }
.seg .sig { display: none; margin-top: 6px; font-size: .75rem; color: var(--text-muted); } .seg:hover .sig { display: block; }
.seg.hidden { display: none; }
.empty-note { color: var(--text-muted); padding: 1rem 2px; }

/* image / video */
.preview { overflow: hidden; }
.preview img, .preview video { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: #000; }
.timeline-wrap { padding: 1rem 1.25rem 1.1rem; }
.timeline { position: relative; height: 44px; border-radius: 10px; overflow: hidden; display: flex; background: var(--border); cursor: pointer; }
.timeline .cell { flex: 1 1 0; background: var(--c); }
.timeline .range { position: absolute; top: 0; bottom: 0; border: 2px solid var(--hot); border-radius: 8px; background: color-mix(in oklab, var(--hot) 14%, transparent); pointer-events: none; }
.timeline .head { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; box-shadow: 0 0 0 1px #000; pointer-events: none; }
.ruler { display: flex; justify-content: space-between; font-size: .72rem; color: var(--text-muted); margin-top: 5px; }
.segs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 14px; }
.vseg { text-align: left; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-subtle); color: var(--text); cursor: pointer; font: inherit; transition: .15s; }
.vseg:hover { border-color: var(--hot); transform: translateY(-2px); }
.vseg img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.vseg div { padding: 8px 12px 10px; font-size: .85rem; } .vseg .sc { color: var(--hot); font-weight: 700; }
.emb { display: grid; gap: 8px; } .emb div { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; padding: .5rem .8rem; border-radius: 9px; border: 1px solid var(--border); } .emb .f { border-color: var(--hot); }

/* batch table */
.tbl-wrap { overflow-x: auto; margin: .8rem 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); padding: 8px 12px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--surface-subtle); }
.tbl .nm span { display: block; overflow-wrap: anywhere; max-width: 380px; font-weight: 500; } .tbl .nm small { display: block; font-size: .78rem; overflow-wrap: anywhere; }
.tbl .sc { width: 170px; } .tbl .sc .meter { margin: 0 0 3px; } .tbl .sc b { font-size: .85rem; font-variant-numeric: tabular-nums; }

.foot { padding: 1.6rem var(--gutter) 2rem; color: var(--text-muted); font-size: .8rem; text-align: center; }
.foot p { margin: 0 auto .4rem; }
@media (forced-colors: active) { .chip, .btn-primary, .btn-secondary { border: 1px solid CanvasText; } }
