/* Product AI Academy — certification UI
   Ink navy for authority, a single seal-gold accent reserved for credential moments,
   cool grey paper so the exam surface stays calm for 90 minutes. */
@font-face { font-family: 'Public Sans'; font-weight: 400; font-display: swap; src: url('/fonts/public-sans/files/public-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Public Sans'; font-weight: 600; font-display: swap; src: url('/fonts/public-sans/files/public-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Public Sans'; font-weight: 700; font-display: swap; src: url('/fonts/public-sans/files/public-sans-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Source Serif 4'; font-weight: 400; font-display: swap; src: url('/fonts/source-serif-4/files/source-serif-4-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Source Serif 4'; font-weight: 600; font-display: swap; src: url('/fonts/source-serif-4/files/source-serif-4-latin-600-normal.woff2') format('woff2'); }

:root {
  --ink: #1B2A4A; --ink-2: #33415E; --muted: #5B6475; --faint: #8A92A3;
  --line: #D9DEE7; --line-2: #E8EBF1; --wash: #F2F4F8; --paper: #FFFFFF;
  --seal: #A8812F; --seal-wash: #F6EFE0;
  --ok: #1E7A4F; --ok-wash: #E5F3EB; --bad: #B3261E; --bad-wash: #FBE9E7; --warn: #8A5A00; --warn-wash: #FDF1D8;
  --focus: #2F5BD3; --select: #E8EEFB;
  --serif: 'Source Serif 4', Georgia, serif; --sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r-sm: 6px; --r: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--sans); color: var(--ink); background: var(--wash); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font: 600 2rem/1.15 var(--serif); letter-spacing: -.01em; }
h2 { font: 600 1.35rem/1.25 var(--serif); }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--focus); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .tiny { font-size: .78rem; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- chrome ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; }
.brand__mark { width: 28px; height: 28px; color: var(--ink); }
.topbar nav { display: flex; gap: 18px; align-items: center; font-size: .92rem; }
.topbar nav a { color: var(--ink-2); text-decoration: none; }
.topbar nav a:hover { text-decoration: underline; }
.foot { padding: 32px 24px; color: var(--faint); font-size: .82rem; text-align: center; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 32px 24px 64px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--r-sm);
  border: 1px solid var(--ink); background: var(--ink); color: #fff; font: 600 .95rem var(--sans); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--ink-2); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--line); border-color: var(--line); color: var(--faint); cursor: not-allowed; }
.btn--ghost { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--wash); }
.btn--seal { background: var(--seal); border-color: var(--seal); }
.btn--seal:hover { background: #8F6D25; }
.btn--danger { background: var(--paper); color: var(--bad); border-color: #E7B7B2; }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: .85rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 6px; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=search], input[type=date], input:not([type]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper);
  font: 1rem var(--sans); color: var(--ink); }
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: var(--focus); }
.prefix { display: flex; } .prefix span { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); background: var(--wash); color: var(--muted); }
.prefix input { border-radius: 0 var(--r-sm) var(--r-sm) 0; letter-spacing: .04em; }
.otp { letter-spacing: .5em; font-size: 1.3rem !important; text-align: center; }
.error { color: var(--bad); font-size: .9rem; margin: 8px 0 0; min-height: 1.2em; }
.devnote { margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--warn); border-radius: var(--r-sm); background: var(--warn-wash); color: var(--warn); font-size: .85rem; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; }
.panel + .panel { margin-top: 20px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--wash); color: var(--ink-2); white-space: nowrap; }
.tag--ok { background: var(--ok-wash); color: var(--ok); } .tag--bad { background: var(--bad-wash); color: var(--bad); }
.tag--warn { background: var(--warn-wash); color: var(--warn); } .tag--seal { background: var(--seal-wash); color: #7A5C1D; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--r-sm); font-size: .92rem; z-index: 100; max-width: calc(100% - 32px); }
.toast--bad { background: var(--bad); }

dialog { border: 0; border-radius: var(--r); padding: 0; max-width: 520px; width: calc(100% - 32px); color: var(--ink); }
dialog::backdrop { background: rgba(20, 28, 46, .55); }
.dlg { padding: 24px; } .dlg h2 { margin-bottom: .4em; } .dlg .btn-row { margin-top: 20px; justify-content: flex-end; }

/* ---------- sign-in (index) ---------- */
.landing { max-width: 1040px; margin: 0 auto; padding: 56px 24px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: start; }
.landing__intro h1 { font-size: clamp(2.2rem, 4.5vw, 3.1rem); max-width: 14ch; margin-bottom: .35em; }
.landing__intro .lede { font-size: 1.1rem; color: var(--ink-2); max-width: 46ch; }
.facts { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 8px 40px; margin: 32px 0 28px; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts dt { font-size: .82rem; color: var(--muted); } .facts dd { margin: 0; font: 600 1.6rem/1.2 var(--serif); }
.path { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.path li { counter-increment: s; position: relative; padding: 0 0 14px 34px; color: var(--ink-2); }
.path li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--seal); color: var(--seal); font-size: .78rem; font-weight: 700; display: grid; place-items: center; }
.signin h2 { margin-bottom: .25em; }
.signin .step-note { color: var(--muted); font-size: .92rem; margin-bottom: 20px; }

/* ---------- dashboard ---------- */
.dash { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.status-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.checks { list-style: none; padding: 0; margin: 16px 0 24px; border-top: 1px solid var(--line-2); }
.checks li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.checks .state { font-weight: 600; font-size: .9rem; }
.checks .yes { color: var(--ok); } .checks .no { color: var(--bad); }
.reasons { margin: 0 0 20px; padding: 12px 16px; background: var(--warn-wash); border-radius: var(--r-sm); color: var(--warn); font-size: .92rem; }
.reasons p:last-child { margin: 0; }
.rules { font-size: .9rem; color: var(--ink-2); padding-left: 18px; margin: 0; }
.rules li { margin-bottom: 6px; }
.credential { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; }
.seal { width: 88px; height: 88px; border-radius: 50%; border: 2px solid var(--seal); outline: 1px solid var(--seal); outline-offset: -8px; display: grid; place-items: center; color: var(--seal); font: 600 1.1rem var(--serif); }
.credential__id { font: 600 1.25rem var(--serif); letter-spacing: .02em; }
.history { width: 100%; border-collapse: collapse; font-size: .9rem; }
.history td, .history th { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.history th { font-weight: 600; color: var(--muted); font-size: .8rem; }

.payblock { margin: 4px 0 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #FCFAF5; }
.payblock h3 { margin-bottom: .4em; }

/* system check */
.syscheck { list-style: none; padding: 0; margin: 12px 0; }
.syscheck li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: .92rem; }
.camprev { width: 100%; aspect-ratio: 4 / 3; background: #10182B; border-radius: var(--r-sm); object-fit: cover; margin-top: 8px; }

/* ---------- exam ---------- */
body.exam { user-select: none; -webkit-user-select: none; }
.exambar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--ink); color: #fff; }
.exambar .title { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer { font: 600 1.35rem/1 var(--sans); font-variant-numeric: tabular-nums; padding: 6px 12px; border-radius: var(--r-sm); background: rgba(255,255,255,.1); }
.timer--warn { background: #F2C14E; color: var(--ink); } .timer--bad { background: #E5564B; color: #fff; }
.savestate { font-size: .8rem; opacity: .8; white-space: nowrap; }
.warnings { font-size: .8rem; padding: 4px 8px; border-radius: var(--r-sm); background: rgba(255,255,255,.1); white-space: nowrap; }
.warnings--hot { background: #E5564B; }
.cam { width: 64px; height: 48px; border-radius: 4px; object-fit: cover; background: #000; border: 1px solid rgba(255,255,255,.3); }
.examgrid { max-width: 1200px; margin: 0 auto; padding: 24px 20px 48px; display: grid; grid-template-columns: 1fr 280px; gap: 24px; align-items: start; }
.qcard { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 28px; min-height: 420px; }
.qmeta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; color: var(--muted); font-size: .88rem; }
.passage { background: var(--wash); border-left: 3px solid var(--seal); padding: 14px 16px; margin: 0 0 18px; font: 1rem/1.6 var(--serif); color: var(--ink-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.prompt { font: 1.2rem/1.5 var(--serif); margin-bottom: 20px; }
.opts { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; background: var(--paper); }
.opt:hover { border-color: var(--ink-2); }
.opt input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--ink); flex: none; }
.opt--on { border-color: var(--ink); background: var(--select); }
.order { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.order li { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); cursor: grab; }
.order li.dragging { opacity: .5; } .order li.over { border-color: var(--focus); box-shadow: 0 -3px 0 var(--focus) inset; }
.order .pos { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--wash); display: grid; place-items: center; font-size: .82rem; font-weight: 700; color: var(--ink-2); }
.order .txt { flex: 1; }
.order .mv { display: flex; gap: 4px; }
.order .mv button { width: 32px; height: 32px; border: 1px solid var(--line); background: var(--paper); border-radius: 4px; cursor: pointer; color: var(--ink-2); }
.qnav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.flagbtn[aria-pressed="true"] { background: var(--warn-wash); border-color: var(--warn); color: var(--warn); }
.palette { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; position: sticky; top: 76px; }
.palette__grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 12px 0 16px; }
.palette__grid button { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); font: 600 .8rem var(--sans); color: var(--ink-2); cursor: pointer; position: relative; padding: 0; }
.palette__grid .ans { background: var(--ink); border-color: var(--ink); color: #fff; }
.palette__grid .flag::after { content: ''; position: absolute; top: 2px; right: 2px; width: 7px; height: 7px; border-radius: 50%; background: #E0A526; }
.palette__grid .cur { outline: 2px solid var(--focus); outline-offset: 1px; }
.legend { display: grid; gap: 6px; font-size: .8rem; color: var(--muted); margin-bottom: 16px; }
.legend span::before { content: ''; display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 8px; border: 1px solid var(--line); }
.legend .l-ans::before { background: var(--ink); border-color: var(--ink); } .legend .l-flag::before { background: #E0A526; border-color: #E0A526; border-radius: 50%; }
.blocker { position: fixed; inset: 0; z-index: 50; background: rgba(20,28,46,.85); display: grid; place-items: center; padding: 24px; }
.blocker .panel { max-width: 460px; }

/* ---------- result ---------- */
.verdict { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.score { font: 600 3.6rem/1 var(--serif); letter-spacing: -.02em; }
.score small { font-size: 1.4rem; color: var(--muted); }
.bars { display: grid; gap: 14px; margin-top: 8px; }
.bar__head { display: flex; justify-content: space-between; font-size: .92rem; margin-bottom: 6px; }
.bar__track { position: relative; height: 10px; background: var(--wash); border-radius: 5px; overflow: visible; }
.bar__fill { height: 100%; border-radius: 5px; background: var(--ink); }
.bar__fill--low { background: var(--bad); }
.bar__pass { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--seal); }
.review { list-style: none; padding: 0; margin: 0; }
.review > li { padding: 18px 0; border-bottom: 1px solid var(--line-2); }
.review .ans-ok { color: var(--ok); } .review .ans-bad { color: var(--bad); }
.review ol { margin: 8px 0; padding-left: 22px; font-size: .95rem; }
.review .explain { background: var(--wash); padding: 10px 14px; border-radius: var(--r-sm); font-size: .92rem; }

/* ---------- verify (server rendered) ---------- */
.vwrap { max-width: 720px; margin: 0 auto; padding: 48px 24px; }
.vresult { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 36px; overflow: hidden; }
.vresult::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--faint); }
.vresult--valid::before { background: var(--ok); } .vresult--revoked::before { background: var(--bad); } .vresult--missing::before { background: var(--warn); }
.vstate { font-weight: 700; font-size: .95rem; margin-bottom: 14px; }
.vresult--valid .vstate { color: var(--ok); } .vresult--revoked .vstate { color: var(--bad); } .vresult--missing .vstate { color: var(--warn); }
.vname { font-size: clamp(1.9rem, 5vw, 2.6rem); margin-bottom: .15em; padding-right: 100px; overflow-wrap: anywhere; }
.vcred { font: 1.15rem var(--serif); color: var(--ink-2); padding-right: 100px; }
.vseal { position: absolute; top: 30px; right: 30px; width: 84px; height: 84px; border-radius: 50%; border: 2px solid var(--seal); outline: 1px solid var(--seal); outline-offset: -8px; display: grid; place-items: center; color: var(--seal); font: 600 1rem var(--serif); }
.vresult--revoked .vseal { filter: grayscale(1); opacity: .5; }
.vmeta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 24px; margin: 28px 0 20px; padding-top: 20px; border-top: 1px solid var(--line-2); }
.vmeta dt { font-size: .8rem; color: var(--muted); } .vmeta dd { margin: 2px 0 0; font-weight: 600; }
.vmeta .ok { color: var(--ok); } .vmeta .bad { color: var(--bad); }
.vnote { font-size: .92rem; color: var(--ink-2); margin: 0; }
.vform { margin-top: 28px; }
.vform__row { display: flex; gap: 10px; }
.vform input { font: 600 1.05rem var(--sans); letter-spacing: .04em; text-transform: uppercase; }
.vform button { min-height: 44px; padding: 0 20px; border: 0; border-radius: var(--r-sm); background: var(--ink); color: #fff; font: 600 .95rem var(--sans); cursor: pointer; }
.vexplain { margin-top: 36px; color: var(--ink-2); }
.page-verify .vwrap > .vform:first-child { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 28px; margin-top: 0; }

/* ---------- admin ---------- */
.admin { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 57px); }
.side { background: var(--paper); border-right: 1px solid var(--line); padding: 20px 12px; }
.side a { display: block; padding: 9px 12px; border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-size: .93rem; }
.side a:hover { background: var(--wash); } .side a[aria-current="page"] { background: var(--ink); color: #fff; }
.side .grp { font-size: .78rem; color: var(--faint); padding: 16px 12px 6px; }
.amain:focus { outline: none; }
.amain { padding: 28px 32px 64px; min-width: 0; }
.ahead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.ahead h1 { font-size: 1.7rem; margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.stat b { display: block; font: 600 1.7rem/1.1 var(--serif); margin-top: 4px; } .stat span { font-size: .82rem; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.filters > * { width: auto; min-width: 140px; }
.filters input[type=search] { min-width: 240px; flex: 1; }
.tablewrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.data th { font-size: .78rem; color: var(--muted); font-weight: 600; background: #FAFBFC; position: sticky; top: 0; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num { font-variant-numeric: tabular-nums; }
.qtext { max-width: 520px; }
.mx { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mx th, .mx td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); text-align: right; } .mx th:first-child, .mx td:first-child { text-align: left; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.optrow { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; margin-bottom: 8px; }
.optrow input[type=radio], .optrow input[type=checkbox] { width: 18px; height: 18px; }
.snaps { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.snaps img { width: 100%; border-radius: 4px; }
.pdfprev { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

@media (max-width: 900px) {
  .landing, .dash, .examgrid, .admin { grid-template-columns: 1fr; }
  .landing { padding-top: 32px; gap: 32px; }
  .palette { position: static; }
  .side { display: flex; overflow-x: auto; gap: 4px; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .side .grp { display: none; } .side a { white-space: nowrap; }
  .amain:focus { outline: none; }
.amain { padding: 20px 16px 48px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { padding: 12px 16px; } .wrap { padding: 20px 16px 48px; }
  .facts { grid-template-columns: repeat(3, 1fr); gap: 4px 16px; } .facts dd { font-size: 1.3rem; }
  .qcard { padding: 20px 16px; } .exambar { gap: 10px; padding: 8px 12px; } .exambar .title, .savestate { display: none; }
  .verdict { grid-template-columns: 1fr; gap: 12px; }
  .vresult { padding: 28px 20px; } .vseal { width: 60px; height: 60px; top: 20px; right: 16px; font-size: .8rem; outline-offset: -6px; }
  .vname, .vcred { padding-right: 64px; } .vmeta { grid-template-columns: 1fr; }
  .vform__row { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
