/* ATA Portal — light-blue professional theme
   tokens: navy sidebar, trust-blue actions, sky tints, semantic status colours.
   fonts: Lexend (headings) + Source Sans 3 (body) */
:root {
  --navy: #0B2545; --navy-2: #13315C; --blue: #1769C7; --blue-dk: #0F4F99; --sky: #2F8DE4;
  --sky-lt: #EAF3FC; --sky-2: #D6E8F9; --bg: #F3F7FB; --card: #fff;
  --ink: #0F1C2E; --muted: #5B6B82; --line: #DCE5EF; --line-2: #EDF2F7; --row: #F8FBFE;
  --pass: #157347; --pass-bg: #E6F4EC; --fail: #B42318; --fail-bg: #FBEAE7;
  --warn: #B54708; --warn-bg: #FFF4E5; --grey: #64748B; --grey-bg: #EEF2F6;
  --focus: #1769C7; --r: 14px; --r-sm: 8px; --t: 160ms; --side-w: 250px;
  --shadow: 0 1px 2px rgba(11,37,69,.05), 0 10px 30px -18px rgba(11,37,69,.28);
  --shadow-lg: 0 24px 60px -24px rgba(11,37,69,.45);
  --font-head: "Lexend", "Segoe UI", Arial, sans-serif; --font-body: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
a { color: var(--blue-dk); text-decoration: none; }
a:hover { text-decoration: underline; }
.btn, .side a, .brand, .chip, .pill, tr.rowlink a { text-decoration: none !important; }
h1, h2, h3, .stat, .brand { font-family: var(--font-head); }

/* accessibility */
.skip { position: absolute; left: -999px; top: 8px; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: var(--r-sm); z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
main:focus { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- app shell */
body.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }
.side { background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 18px 14px 14px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; color: #fff; padding: 6px 8px 18px; }
.brand .mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(145deg, var(--sky), var(--blue)); display: grid; place-items: center; box-shadow: 0 6px 16px -6px rgba(47,141,228,.8); flex: none; }
.brand span:not(.mark) { display: flex; flex-direction: column; line-height: 1.15; font-size: 18px; font-weight: 500; letter-spacing: .01em; }
.brand b { font-weight: 700; }
.brand .t { white-space: nowrap; }
.brand img.logo { width: 44px; height: 44px; object-fit: contain; flex: none; filter: drop-shadow(0 4px 10px rgba(0,0,0,.35)); }
.brand img.logo.lg { width: 56px; height: 56px; }
.brand small { font-family: var(--font-body); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.55); margin-top: 3px; font-weight: 600; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side .group { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.42); margin: 14px 12px 6px; font-weight: 600; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: rgba(255,255,255,.84); font-weight: 500; font-size: 14.5px; transition: background var(--t), color var(--t); }
.side nav a .icon { opacity: .85; flex: none; }
.side nav a:hover { background: rgba(255,255,255,.09); color: #fff; }
.side nav a.on { background: var(--sky); color: #fff; box-shadow: 0 8px 18px -10px rgba(47,141,228,.9); }
.side nav a.on .icon { opacity: 1; }
.side .user { margin-top: auto; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 10px 10px; }
.side .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--sky-2); color: var(--navy); font-weight: 700; display: grid; place-items: center; flex: none; font-family: var(--font-head); }
.side .who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.side .who b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .who small { font-size: 11.5px; color: rgba(255,255,255,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .user .acts { margin-left: auto; display: flex; gap: 2px; flex: none; }
.iconbtn { background: transparent; border: 0; color: rgba(255,255,255,.75); cursor: pointer; padding: 8px; border-radius: 8px; display: grid; place-items: center; min-width: 36px; min-height: 36px; text-decoration: none !important; }
.iconbtn:hover { background: rgba(255,255,255,.12); color: #fff; }
.shell { min-width: 0; display: flex; flex-direction: column; }
.topbar { background: rgba(255,255,255,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 10px 28px; display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; min-height: 56px; }
.topbar .crumb { font-family: var(--font-head); font-size: 13.5px; color: var(--muted); font-weight: 500; }
.spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--navy); background: var(--sky-lt); border: 1px solid var(--sky-2); border-radius: 999px; padding: 5px 11px; white-space: nowrap; }
.chip.live { background: var(--pass-bg); border-color: #CBE8D6; color: var(--pass); font-variant-numeric: tabular-nums; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pass); animation: blink 1.6s infinite; }
.content { padding: 26px 28px 48px; max-width: 1360px; width: 100%; }
.foot { color: var(--muted); font-size: 12px; padding: 14px 28px; border-top: 1px solid var(--line); margin-top: auto; }

/* ---------------------------------------------------------------- type + headings */
h1 { font-weight: 600; font-size: 24px; margin: 0 0 4px; color: var(--navy); letter-spacing: -.01em; }
h2 { font-weight: 600; font-size: 16px; margin: 0 0 14px; color: var(--navy); display: flex; align-items: center; gap: 8px; }
h2 .icon { color: var(--blue); }
h3 { font-size: 15px; margin: 0 0 6px; color: var(--navy); font-weight: 600; }
.lead { color: var(--muted); margin: 0 0 18px; max-width: 86ch; font-size: 15px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.page-head h1 { margin-right: 4px; }
.muted { color: var(--muted); font-size: 13px; }
.label { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; display: block; font-weight: 700; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.req::after { content: " *"; color: var(--fail); }

/* ---------------------------------------------------------------- layout blocks */
.grid { display: grid; gap: var(--s4); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r); padding: 20px 22px; box-shadow: var(--shadow); }
.card.tight { padding: 14px 16px; }
.card + .card, .card + form.card, form.card + .card, form.card + form.card { margin-top: var(--s4); }
.hero { background: linear-gradient(135deg, var(--sky-lt) 0%, #fff 55%); border: 1px solid var(--sky-2); border-radius: var(--r); padding: 18px 22px; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; box-shadow: var(--shadow); margin-bottom: var(--s4); }
.hero .big { font-family: var(--font-head); font-size: 22px; font-weight: 600; color: var(--navy); }
.hero .sub { color: var(--muted); font-size: 13.5px; }
.kpi { display: flex; gap: 14px; align-items: flex-start; }
.kpi .tile { width: 46px; height: 46px; border-radius: 13px; background: var(--sky-lt); color: var(--blue); display: grid; place-items: center; flex: none; }
.kpi .tile.pass { background: var(--pass-bg); color: var(--pass); } .kpi .tile.fail { background: var(--fail-bg); color: var(--fail); } .kpi .tile.warn { background: var(--warn-bg); color: var(--warn); }
.stat { font-size: 30px; font-weight: 600; color: var(--navy); line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat.fail { color: var(--fail); } .stat.pass { color: var(--pass); } .stat.warn { color: var(--warn); }
.stack { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--grey-bg); margin: 10px 0 8px; }
.stack > span { display: block; height: 100%; transition: width 300ms ease-out; }
.stack .s-assigned { background: #C7D2DF; } .stack .s-sampled { background: var(--sky); } .stack .s-test { background: #F2A33A; } .stack .s-pass { background: var(--pass); } .stack .s-fail { background: var(--fail); }
.legend { display: flex; gap: 10px 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: 0; }
.empty { text-align: center; color: var(--muted); padding: 30px 16px; }
.empty b { display: block; color: var(--navy); font-size: 15px; margin-bottom: 4px; font-family: var(--font-head); font-weight: 500; }
.steps { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: var(--s4); }
.steps .st { background: #fff; border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; box-shadow: var(--shadow); }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 700; font-size: 12.5px; flex: none; font-family: var(--font-head); }

/* ---------------------------------------------------------------- pills + buttons */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; background: var(--sky-lt); color: var(--blue-dk); white-space: nowrap; line-height: 1.5; letter-spacing: .01em; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.pass { background: var(--pass-bg); color: var(--pass); } .pill.pass::before { content: "✓"; width: auto; height: auto; background: none; font-size: 11px; }
.pill.fail { background: var(--fail-bg); color: var(--fail); } .pill.fail::before { content: "✕"; width: auto; height: auto; background: none; font-size: 11px; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.done { background: var(--sky-lt); color: var(--blue-dk); }
.pill.grey { background: var(--grey-bg); color: var(--grey); }
.btn { font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 10px; padding: 9px 18px; cursor: pointer; background: linear-gradient(180deg, var(--sky), var(--blue)); color: #fff; min-height: 40px; display: inline-flex; align-items: center; gap: 7px; box-shadow: 0 6px 14px -8px rgba(23,105,199,.9); transition: filter var(--t), box-shadow var(--t), background var(--t), border-color var(--t); }
.btn:hover { filter: brightness(.95); box-shadow: 0 8px 18px -8px rgba(23,105,199,1); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled=true] { filter: none; opacity: .55; cursor: not-allowed; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--navy); font-weight: 600; box-shadow: none; }
.btn-ghost:hover { background: var(--sky-lt); border-color: var(--sky); filter: none; box-shadow: none; }
.btn-dark { background: linear-gradient(180deg, var(--navy-2), var(--navy)); box-shadow: 0 6px 14px -8px rgba(11,37,69,.9); }
.btn-red { background: #fff; border-color: var(--line); color: var(--fail); font-weight: 600; box-shadow: none; }
.btn-red:hover { border-color: var(--fail); background: var(--fail-bg); filter: none; box-shadow: none; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; min-height: 32px; }
.btn.busy { pointer-events: none; opacity: .7; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }

/* ---------------------------------------------------------------- tables */
.tbl { overflow-x: auto; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #F6F9FC; position: sticky; top: 0; z-index: 1; font-weight: 700; white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: var(--row); }
tbody tr:hover td { background: var(--sky-lt); }
tr.retest td { background: #FFF8EC; }
tr.rowlink { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap, th.wrap { white-space: normal; }
th[aria-sort] { cursor: pointer; } th[aria-sort=ascending]::after { content: " ↑"; } th[aria-sort=descending]::after { content: " ↓"; }
table.fp input, table.fp select { min-height: 34px; padding: 5px 8px; }

/* ---------------------------------------------------------------- forms */
input[type=text], input[type=number], input[type=email], input[type=password], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); font: inherit; background: #fff; color: var(--ink); min-height: 40px; transition: border-color var(--t), box-shadow var(--t); }
input:hover, select:hover, textarea:hover { border-color: #C5D3E2; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--sky-2); }
input[aria-invalid=true], .invalid input { border-color: var(--fail); }
.err { color: var(--fail); font-size: 12.5px; margin-top: 4px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--blue); cursor: pointer; }
input[type=file] { font-size: 13px; }
label.check { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink); cursor: pointer; min-height: 34px; }
.field { margin-bottom: 12px; } .row { display: flex; gap: 14px; flex-wrap: wrap; } .row > * { flex: 1; min-width: 160px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin: 4px 0 12px; }
.filters > div { min-width: 140px; }
.msgs { margin-bottom: 14px; } .msg { padding: 11px 14px; border-radius: 10px; margin-bottom: 6px; font-size: 14px; border: 1px solid transparent; display: flex; gap: 10px; align-items: flex-start; }
.msg .icon { flex: none; margin-top: 2px; }
.msg.success { background: var(--pass-bg); color: var(--pass); border-color: #C6E6D2; } .msg.error { background: var(--fail-bg); color: var(--fail); border-color: #F3C7C0; }
.msg.info, .msg.warning { background: var(--warn-bg); color: var(--warn); border-color: #F6DDB5; }
.exc { background: var(--warn-bg); border: 1px solid #F6DDB5; color: var(--warn); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin: 10px 0; }
.console { background: #0E1A2B; color: #D9E6F2; border-radius: 12px; font: 12.5px/1.6 Consolas, "Cascadia Mono", monospace; padding: 14px 16px; height: 280px; overflow: auto; white-space: pre-wrap; }
.console .ok { color: #7FD4A6; } .console .warn { color: #F4B860; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0 6px 18px; border-left: 2px solid var(--line); position: relative; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 11px; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 3px #fff; }
.timeline li.fail::before { background: var(--fail); } .timeline li.pass::before { background: var(--pass); }
.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 14px; background: var(--row); text-align: center; color: var(--muted); }
.dropzone.has { border-color: var(--blue); background: var(--sky-lt); color: var(--navy); }
.centre-box { border: 1px solid var(--line-2); border-radius: 12px; padding: 14px; background: #fff; box-shadow: var(--shadow); }
.live { font-size: 11px; color: var(--pass); font-weight: 700; letter-spacing: .1em; }
.live::before { content: "●"; margin-right: 4px; animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.progress { height: 8px; background: var(--grey-bg); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--sky), var(--blue)); transition: width 300ms ease-out; }
.icon { vertical-align: -3px; flex: none; }
.inline { display: inline; }

/* ---------------------------------------------------------------- sign-in */
body.auth { min-height: 100dvh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(900px 500px at 5% -10%, var(--sky-2), transparent 60%), radial-gradient(800px 500px at 105% 110%, var(--sky-lt), transparent 60%), var(--bg); }
.auth-card { display: grid; grid-template-columns: 1.05fr 1fr; width: 100%; max-width: 920px; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow-lg); background: #fff; border: 1px solid var(--line-2); }
.auth-hero { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 55%, var(--blue) 140%); color: #fff; padding: 40px 38px; display: flex; flex-direction: column; gap: 18px; }
.auth-hero .brand { padding: 0; }
.auth-hero h2 { color: #fff; font-size: 24px; font-weight: 600; margin: 10px 0 0; line-height: 1.25; display: block; }
.auth-hero p { color: rgba(255,255,255,.78); margin: 0; font-size: 14.5px; }
.auth-hero ul { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 10px; }
.auth-hero li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: rgba(255,255,255,.9); }
.auth-hero li .icon { color: var(--sky); margin-top: 2px; }
.auth-hero .foot-note { margin-top: auto; font-size: 12px; color: rgba(255,255,255,.5); }
.auth-form { padding: 40px 38px; display: flex; flex-direction: column; justify-content: center; }
.auth-form h1 { margin-bottom: 4px; }
.auth-form .lead { margin-bottom: 20px; }

/* ---------------------------------------------------------------- responsive + motion + print */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rise { animation: rise 360ms cubic-bezier(.2,.7,.3,1) both; }
.stack > span, .progress > span { transition: width 700ms cubic-bezier(.2,.7,.3,1); }
@media (prefers-reduced-motion: reduce) {
  .live::before, .chip .dot { animation: none; } html { scroll-behavior: auto; }
  .rise { animation: none; }
  *, *::before, *::after { transition: none !important; }
}
@media (max-width: 960px) {
  body.app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 12px; }
  .brand { padding: 4px 6px; } .brand small { display: none; }
  .side nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; width: 100%; order: 3; gap: 4px; padding-bottom: 4px; }
  .side nav a { padding: 8px 11px; white-space: nowrap; font-size: 13.5px; }
  .side .group { display: none; }
  .side .user { margin-top: 0; margin-left: auto; padding: 4px 6px; background: transparent; border: 0; }
  .side .who { display: none; }
  .topbar { padding: 8px 14px; } .topbar .crumb { display: none; }
  .content { padding: 16px 14px 40px; }
  .auth-card { grid-template-columns: 1fr; } .auth-hero { padding: 26px 24px; gap: 10px; } .auth-hero ul { display: none; } .auth-form { padding: 26px 24px; }
  .btn { min-height: 44px; } .btn-sm { min-height: 36px; }
  input[type=text], input[type=number], input[type=email], input[type=password], input[type=date], input[type=datetime-local], select, textarea { min-height: 44px; font-size: 16px; }
  h1 { font-size: 21px; } .card { padding: 14px; }
}
@media print { .side, .topbar, .foot, .toolbar, .filters, .skip { display: none !important; } body.app { display: block; } .card { border: 0; box-shadow: none; } }
