/* ODA visual system, ported from the COS700 interactive prototype:
   navy app bar with teal rule, IBM Plex, grid-paper diagram canvases, pipeline stages,
   score ring, element-by-element breakdown, dark report blocks. */

@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --ink: #0E2A47; --ink-2: #143456; --ink-3: #1d4067;
  --teal: #0E8C84; --teal-2: #0aa39a; --teal-soft: #d8efed;
  --paper: #eef2f6; --surface: #ffffff; --line: #d9e1ea; --line-2: #e8eef4;
  --text: #1b2a3a; --muted: #5f7184; --faint: #8fa0b1;
  --match: #1f8a4c; --match-soft: #e4f3ea;
  --partial: #b26a00; --partial-soft: #f9ecd4;
  --miss: #c0392b; --miss-soft: #fbe5e2;
  --extra: #5b5f97; --extra-soft: #eceef8;
  --code-bg: #0c2034; --code-line: #1c3b59; --code-text: #cfe3f2; --code-dim: #7fa0bd;
  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(14,42,71,.06), 0 6px 22px rgba(14,42,71,.07);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--text); font-family: var(--font-ui); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--teal); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 22px; width: 100%; }
[hidden] { display: none !important; }
code { font-family: var(--font-mono); font-size: 12px; background: #eef3f7; padding: 1px 6px; border-radius: 4px; color: var(--ink); }

/* ---------- app bar ---------- */
.appbar { background: var(--ink); color: #fff; border-bottom: 3px solid var(--teal); }
.appbar .wrap { display: flex; align-items: center; gap: 18px; padding-top: 16px; padding-bottom: 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; color: #fff; text-decoration: none; }
.glyph { width: 38px; height: 38px; flex: none; }
.brand h1 { font-size: 17px; font-weight: 600; letter-spacing: .2px; margin: 0; line-height: 1.1; }
.brand .eyebrow { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 2.5px; text-transform: uppercase; color: #7fb6d8; margin: 0 0 2px; }
.brand .sub { font-size: 11.5px; color: #9db6cc; }
.spacer { flex: 1; }
.userbox { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; font-size: 13px; color: #cfe1ef; }
.userbox .role { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; background: var(--ink-3); color: #9fe3dc; border: 1px solid #2b5480; }
.userbox .name { font-weight: 600; color: #fff; }
.userbox button { appearance: none; background: transparent; color: #cfe1ef; border: 1px solid #3a5f86; border-radius: 6px; padding: 6px 12px; font: 500 12.5px var(--font-ui); cursor: pointer; }
.userbox button:hover { background: var(--ink-3); color: #fff; }
nav.tabs { display: flex; gap: 2px; width: 100%; flex-wrap: wrap; }
nav.tabs a { color: #b7cbdd; font-size: 13.5px; font-weight: 500; padding: 11px 15px; text-decoration: none; letter-spacing: .2px; border-bottom: 2px solid transparent; }
nav.tabs a:hover { color: #fff; }
nav.tabs a[aria-current="page"] { color: #fff; border-bottom-color: var(--teal-2); }
nav.tabs a:focus-visible { outline: 2px solid var(--teal-2); outline-offset: -2px; border-radius: 3px; }

/* ---------- generic ---------- */
main.wrap { padding-top: 26px; padding-bottom: 60px; flex: 1; }
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.lede { max-width: 720px; color: var(--muted); margin: 0 0 20px; font-size: 14.5px; }
.lede b { color: var(--text); font-weight: 600; }
.page-title { font-size: 20px; font-weight: 600; color: var(--ink); margin: 0 0 6px; }
.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.crumb a { color: var(--teal); text-decoration: none; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 0; }
.phead { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.phead .tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: #fff; background: var(--ink-3); padding: 3px 8px; border-radius: 4px; }
.phead .tag.teal { background: var(--teal); }
.phead h3 { margin: 0; font-size: 14px; font-weight: 600; }
.phead .meta { margin-left: auto; font-size: 12px; color: var(--faint); font-family: var(--font-mono); }
.pbody { padding: 16px; }
.pbody > :last-child { margin-bottom: 0; }
.stack > * + * { margin-top: 18px; }

/* ---------- control strip ---------- */
.controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 18px; }
.controls label { font-size: 12px; color: var(--muted); font-weight: 500; }
select, .btn, input, textarea { font-family: var(--font-ui); font-size: 13.5px; }
select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--text); min-width: 190px; max-width: 100%; }
.btn { appearance: none; border: 0; border-radius: 7px; padding: 9px 16px; font-weight: 600; cursor: pointer; letter-spacing: .2px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; line-height: 1.2; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-2); }
.btn-ghost { background: #eef3f7; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: #e3ebf2; }
.btn-danger { background: #fff; color: var(--miss); border: 1px solid #efc2bc; }
.btn-danger:hover { background: var(--miss-soft); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.hint { font-size: 12px; color: var(--faint); margin-left: auto; }
.filebtn { position: relative; overflow: hidden; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- diagram workspace ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.canvas { position: relative; padding: 8px; min-height: 220px; background:
  linear-gradient(var(--line-2) 1px, transparent 1px) 0 0/22px 22px,
  linear-gradient(90deg, var(--line-2) 1px, transparent 1px) 0 0/22px 22px,
  #fbfdff; border-radius: 0 0 10px 10px; overflow: auto; display: flex; align-items: center; justify-content: center; }
.canvas svg { display: block; width: 100%; height: auto; }
.canvas .empty { width: 100%; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 14px 2px 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 11px; height: 11px; border-radius: 3px; border: 1px solid rgba(0,0,0,.12); display: inline-block; }

/* ---------- pipeline ---------- */
.pipe { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; margin: 18px 0 0; }
.stage { flex: 1; min-width: 120px; background: #f3f7fa; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; position: relative; opacity: .45; transition: all .3s; }
.stage + .stage { margin-left: 22px; }
.stage::after { content: ""; position: absolute; right: -22px; top: 50%; width: 22px; height: 2px; background: var(--line); }
.stage:last-child::after { display: none; }
.stage.on { opacity: 1; border-color: var(--teal); background: var(--teal-soft); }
.stage.done { opacity: 1; }
.stage .n { font-family: var(--font-mono); font-size: 10px; color: var(--faint); letter-spacing: 1px; }
.stage .t { font-size: 12.5px; font-weight: 600; margin-top: 2px; }
.stage .d { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.stage.on .n { color: var(--teal); }

/* ---------- results ---------- */
.results { margin-top: 20px; display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.scorecard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 20px; text-align: center; }
.ring-wrap { position: relative; width: 160px; height: 160px; margin: 4px auto 10px; }
.ring-wrap .pct { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-wrap .pct .big { font-size: 34px; font-weight: 700; color: var(--ink); font-family: var(--font-mono); line-height: 1; }
.ring-wrap .pct .pts { font-size: 12px; color: var(--muted); margin-top: 4px; font-family: var(--font-mono); }
.scorecard .verdict { font-size: 13px; color: var(--muted); margin-top: 6px; }
.scorecard .verdict b { color: var(--ink); }
.tallies { display: flex; justify-content: center; gap: 14px; margin-top: 14px; border-top: 1px solid var(--line-2); padding-top: 14px; flex-wrap: wrap; }
.tally { font-size: 11.5px; color: var(--muted); }
.tally b { display: block; font-size: 18px; font-family: var(--font-mono); color: var(--ink); }
.scorecard .tutor-mark { margin-top: 14px; border-top: 1px solid var(--line-2); padding-top: 12px; font-size: 13px; color: var(--muted); text-align: left; }
.scorecard .tutor-mark b { color: var(--ink); font-family: var(--font-mono); }

table.brk { width: 100%; border-collapse: collapse; font-size: 13px; }
table.brk th { text-align: left; font-size: 11px; letter-spacing: .4px; text-transform: uppercase; color: var(--faint); font-weight: 600; padding: 10px 12px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.brk td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.brk tr:last-child td { border-bottom: 0; }
table.brk tr.click { cursor: pointer; }
table.brk tr.click:hover td { background: #f6f9fb; }
table.brk tr.older td { opacity: .65; }
.tablewrap { overflow-x: auto; }
.cat { font-family: var(--font-mono); font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 1px; }
.el { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); font-weight: 500; }
.reason { color: var(--muted); font-size: 12.5px; }
.marks { font-family: var(--font-mono); font-size: 12.5px; white-space: nowrap; text-align: right; font-weight: 600; }
.num { font-family: var(--font-mono); text-align: right; white-space: nowrap; }
.chip { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.chip.ok { background: var(--match-soft); color: var(--match); }
.chip.partial { background: var(--partial-soft); color: var(--partial); }
.chip.miss { background: var(--miss-soft); color: var(--miss); }
.chip.extra { background: var(--extra-soft); color: var(--extra); }
.chip.info { background: var(--teal-soft); color: var(--teal); }
.chip.dim { background: #eef3f7; color: var(--muted); }

.empty { padding: 30px 18px; text-align: center; color: var(--faint); font-size: 13px; }
.empty svg { opacity: .5; margin-bottom: 8px; }
.empty b { color: var(--muted); }

/* ---------- reports / code ---------- */
.report { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; background: var(--code-bg); color: var(--code-text); border-radius: 10px; padding: 18px 20px; overflow: auto; max-height: 560px; }
.report .h { color: #74c7bf; font-weight: 600; }
.report .ln { display: block; white-space: pre-wrap; }
.report .g { color: var(--code-dim); }
.report .ok { color: #7ad19a; }
.report .pa { color: #e6b366; }
.report .mi { color: #ec8a80; }
.report .ex { color: #b3b8f0; }
.codeblock { background: var(--code-bg); border-radius: 10px; overflow: hidden; }
.codeblock .cap { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-bottom: 1px solid var(--code-line); font-family: var(--font-mono); font-size: 11px; color: var(--code-dim); letter-spacing: 1px; text-transform: uppercase; }
.codeblock pre { margin: 0; padding: 14px 16px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; color: var(--code-text); overflow: auto; white-space: pre-wrap; }

/* ---------- rubric ---------- */
table.rubric { width: 100%; border-collapse: collapse; font-size: 13.5px; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.rubric th { background: #f1f5f9; text-align: left; font-size: 12px; letter-spacing: .3px; color: var(--ink); font-weight: 600; padding: 11px 16px; border-bottom: 1px solid var(--line); }
table.rubric td { padding: 10px 16px; border-bottom: 1px solid var(--line-2); }
table.rubric tr:last-child td { border-bottom: 0; }
table.rubric select { min-width: 130px; padding: 6px 8px; }
table.rubric .src { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.ded-full { color: var(--miss); font-weight: 600; } .ded-half { color: var(--partial); font-weight: 600; } .ded-none { color: var(--match); font-weight: 600; }

/* ---------- metrics / eval ---------- */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 0 0 20px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; box-shadow: var(--shadow); }
.metric .v { font-size: 26px; font-weight: 700; font-family: var(--font-mono); color: var(--ink); line-height: 1; }
.metric .k { font-size: 12px; color: var(--muted); margin-top: 6px; }
.metric .k b { color: var(--teal); font-weight: 600; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding: 10px 4px 0; border-bottom: 1px solid var(--line); }
.barcol { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; height: 100%; justify-content: flex-end; min-width: 28px; }
.barpair { display: flex; align-items: flex-end; gap: 3px; height: 100%; width: 100%; justify-content: center; }
.bar { width: 14px; border-radius: 3px 3px 0 0; min-height: 2px; }
.bar.human { background: var(--ink-3); }
.bar.tool { background: var(--teal); }
.barlabel { font-family: var(--font-mono); font-size: 10px; color: var(--faint); white-space: nowrap; }
.tooltip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 6px; transform: translate(-50%, calc(-100% - 8px)); white-space: nowrap; font-family: var(--font-mono); }

/* ---------- how it works ---------- */
.flow { display: flex; gap: 0; flex-wrap: wrap; align-items: stretch; margin: 8px 0 26px; }
.fcard { flex: 1; min-width: 150px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 15px; box-shadow: var(--shadow); position: relative; }
.fcard + .fcard { margin-left: 26px; }
.fcard::after { content: "→"; position: absolute; right: -21px; top: 50%; transform: translateY(-50%); color: var(--teal); font-size: 16px; font-weight: 700; }
.fcard:last-child::after { display: none; }
.fcard .num { font-family: var(--font-mono); font-size: 10px; color: var(--teal); letter-spacing: 1px; }
.fcard h4 { margin: 3px 0 5px; font-size: 14px; }
.fcard p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.infobox { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; box-shadow: var(--shadow); }
.infobox h4 { margin: 0 0 8px; font-size: 14px; color: var(--ink); }
.infobox ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.infobox ul b { color: var(--text); }
.infobox p { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.kvs { font-size: 13px; line-height: 1.9; color: var(--muted); }
.kvs b { color: var(--text); font-weight: 600; }
.note { font-size: 12px; color: var(--faint); margin-top: 14px; line-height: 1.5; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field > label, .flabel { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 5px; letter-spacing: .2px; }
.field input[type=text], .field input[type=password], .field input[type=number], .field input[type=datetime-local], .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--text);
}
.field textarea { min-height: 150px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; resize: vertical; }
.field .help { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.checks { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; }
.checks label { display: inline-flex; gap: 7px; align-items: center; cursor: pointer; }
.checks input { accent-color: var(--teal); width: 15px; height: 15px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; flex-wrap: wrap; }
.seg button { appearance: none; border: 0; background: none; padding: 8px 14px; font-family: var(--font-ui); font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.dropzone { border: 1.5px dashed #9fb2c4; border-radius: 10px; background: #fbfdff; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--teal); background: var(--teal-soft); }
.dropzone b { color: var(--ink); display: block; font-size: 14px; margin-bottom: 2px; }
.dropzone input { display: none; }
.formbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 18px; }

/* ---------- notices ---------- */
.notice { border-radius: 8px; padding: 11px 14px; font-size: 13px; margin-bottom: 14px; border: 1px solid; }
.notice.warn { background: var(--partial-soft); border-color: #ecc98d; color: #6d4300; }
.notice.error { background: var(--miss-soft); border-color: #efc2bc; color: #7c1f15; }
.notice.info { background: var(--teal-soft); border-color: #a9dcd7; color: #0a5d57; }
.notice ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- login ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.acct-list { display: grid; gap: 8px; }
.acct { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--text); cursor: pointer; }
.acct:hover { border-color: var(--teal); background: #f6fbfa; }
.acct .nm { font-weight: 600; }
.acct .un { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); }
.acct .chip { margin-left: auto; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); max-width: 380px; border-left: 3px solid var(--teal-2); animation: fade .2s ease; }
.toast.error { border-left-color: var(--miss); }

footer { border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; padding: 18px 0 40px; }
footer .wrap { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .grid2, .grid3, .results, .metrics, .twocol, .login { grid-template-columns: 1fr; }
  .results { gap: 16px; }
  .stage + .stage, .fcard + .fcard { margin-left: 0; margin-top: 14px; }
  .stage::after, .fcard::after { display: none; }
  .pipe .stage { flex-basis: 100%; }
  .hint { margin-left: 0; }
  .canvas svg { min-width: 520px; }
  .canvas { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
/* let diagram canvases fill their panel when the neighbouring panel is taller */
.grid2 > .panel { display: flex; flex-direction: column; }
.grid2 > .panel > .canvas { flex: 1; }
