/* Qld Waste Tracking PoC
   Palette: deep eucalypt ink and teal, with hi-vis yellow reserved for
   "this is where the load is now" on the chain-of-custody strip. */
:root {
    --ink: #17302d;
    --ink-soft: #4a5f5b;
    --paper: #f3f5f2;
    --surface: #ffffff;
    --line: #d3dbd6;
    --brand: #123d3a;
    --brand-ink: #e8f1ee;
    --link: #0b6157;
    --hivis: #f4c20d;
    --ok: #1d7444;
    --ok-bg: #e3f2e8;
    --warn: #8a5a00;
    --warn-bg: #fdf1d6;
    --bad: #b42318;
    --bad-bg: #fde8e6;
    --focus: #1a73e8;
    --radius: 6px;
    --font: "Public Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.55 var(--font); }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .8rem; max-width: 72ch; }
code { font-size: .9em; background: #eef2ef; padding: 0 .25em; border-radius: 3px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 1.25rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: .5rem; z-index: 10; background: var(--surface); padding: .5rem 1rem; }

/* ------------------------------------------------------------ chrome */
.pocbar { background: var(--hivis); color: #2a2200; font-size: .82rem; font-weight: 600; text-align: center; padding: .2rem 1rem; }
.masthead { background: var(--brand); color: var(--brand-ink); }
.masthead-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .55rem; color: inherit; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.brand-mark { width: 30px; height: 30px; color: var(--hivis); }
.mainnav { display: flex; align-items: center; gap: .15rem; flex: 1; flex-wrap: wrap; }
.mainnav a, .mainnav .linkbutton { color: var(--brand-ink); text-decoration: none; padding: .45rem .65rem; border-radius: var(--radius); font-size: .95rem; }
.mainnav a:hover, .mainnav .linkbutton:hover { background: rgba(255,255,255,.1); color: #fff; }
.mainnav a[aria-current="page"] { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 0 -3px 0 var(--hivis); }
.nav-spacer { flex: 1; }
.count { display: inline-block; min-width: 1.35em; padding: 0 .35em; border-radius: 1em; background: var(--hivis); color: #2a2200; font-size: .78rem; font-weight: 700; text-align: center; }
.navtoggle { display: none; }
.whoami { font-size: .85rem; color: #b8cfc9; padding-bottom: .45rem; display: flex; gap: 1rem; }
.netstatus { margin-left: auto; color: var(--hivis); font-weight: 600; }
.page { padding-top: 1.75rem; padding-bottom: 3rem; }
.footer { color: var(--ink-soft); font-size: .85rem; padding-bottom: 2rem; }
.crumbs { margin-bottom: .3rem; font-size: .9rem; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.lede { color: var(--ink-soft); font-size: 1.05rem; }
.sub { color: var(--ink-soft); font-size: .9rem; }
.mono-num, .tabular, .num { font-variant-numeric: tabular-nums; }
.hint { color: var(--ink-soft); font-size: .88rem; }
.empty { color: var(--ink-soft); }

/* ------------------------------------------------------------ notices */
.notice { padding: .7rem 1rem; border-radius: var(--radius); border-left: 4px solid; margin: 0 0 1rem; max-width: none; }
.notice ul { margin: .25rem 0 0; padding-left: 1.2rem; }
.notice p { margin: 0; }
.notice-ok { background: var(--ok-bg); border-color: var(--ok); }
.notice-warn { background: var(--warn-bg); border-color: #d99a00; }
.notice-bad { background: var(--bad-bg); border-color: var(--bad); }

/* ------------------------------------------------------------ buttons */
.button, .button-quiet, .button-danger {
    display: inline-flex; align-items: center; gap: .4rem; font: 600 .95rem var(--font); padding: .55rem 1rem;
    border-radius: var(--radius); border: 2px solid transparent; cursor: pointer; text-decoration: none; line-height: 1.2;
}
.button { background: var(--brand); color: #fff; }
.button:hover { background: #0b2c2a; color: #fff; }
.button-quiet { background: var(--surface); color: var(--brand); border-color: var(--brand); }
.button-quiet:hover { background: #e8f0ed; color: var(--brand); }
.button-danger { background: var(--surface); color: var(--bad); border-color: var(--bad); }
.button-danger:hover { background: var(--bad-bg); }
.linkbutton { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; }
form.inline { display: inline; }
.quick { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }

/* ------------------------------------------------------------ panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; }
.panel > summary, details.addform > summary { cursor: pointer; font-weight: 650; }
details.addform { margin-top: 1rem; }
details[open] > summary { margin-bottom: .8rem; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; align-items: start; }
.split > .panel { margin-bottom: 0; }
.split + * { margin-top: 1.25rem; }
.callout { border-left: 4px solid var(--brand); }
.choice { text-decoration: none; color: inherit; display: block; }
.choice:hover { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }

/* tallies */
.tally { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0 0 1.25rem; }
.tally > div { background: var(--surface); padding: .8rem 1rem; }
.tally dt { font-size: .85rem; color: var(--ink-soft); }
.tally dd { margin: 0; font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tally dd a { color: inherit; text-decoration: none; }
.tally dd a:hover { text-decoration: underline; }
.tally .tally-bad dd { color: var(--bad); }
.bignum { font-size: 2rem; font-weight: 700; margin: 0 0 .5rem; font-variant-numeric: tabular-nums; }

/* facts */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem 1.5rem; margin: 0 0 1rem; }
.facts dt { font-size: .82rem; color: var(--ink-soft); }
.facts dd { margin: 0; }
.facts .wide { grid-column: 1 / -1; }

/* lists of rows */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: 0; }
.rows li > :nth-child(2) { flex: 1; color: var(--ink-soft); min-width: 12rem; }
.rows.compact li { padding: .3rem 0; font-size: .92rem; }
.when { font-size: .88rem; white-space: nowrap; }
.warn { color: var(--warn); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.ok { color: var(--ok); font-weight: 600; }

/* ------------------------------------------------------------ tables */
.scroll { overflow-x: auto; margin-bottom: 1rem; }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .94rem; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: .82rem; font-weight: 650; color: var(--ink-soft); border-bottom: 2px solid var(--line); white-space: nowrap; }
tfoot th { border-top: 2px solid var(--ink); }
.num { text-align: right; }
.nowrap { white-space: nowrap; }
.details { font-size: .82rem; color: var(--ink-soft); max-width: 28rem; word-break: break-word; }
.row-attention td:first-child { box-shadow: inset 4px 0 0 #d99a00; }
.row-bad td:first-child { box-shadow: inset 4px 0 0 var(--bad); }
.row-muted { color: var(--ink-soft); }
.errlist { margin: 0; padding-left: 1rem; color: var(--bad); font-size: .9rem; }
.flag { margin-left: .4rem; font-size: .75rem; font-weight: 700; color: var(--bad); }
.matrix td:not(:first-child) { text-align: center; }
progress { width: 6rem; height: .6rem; vertical-align: middle; accent-color: var(--brand); }

/* pills */
.pill { display: inline-block; font-size: .78rem; font-weight: 650; padding: .12rem .55rem; border-radius: 999px; background: #e7ece9; color: var(--ink); white-space: nowrap; }
.pill-completed, .pill-approved, .pill-paid, .pill-succeeded, .pill-accepted, .pill-delivered { background: var(--ok-bg); color: var(--ok); }
.pill-awaiting_transporter, .pill-awaiting_receiver, .pill-submitted, .pill-under_assessment, .pill-pending, .pill-simulated { background: #e2eef7; color: #1f4e79; }
.pill-information_requested, .pill-unpaid { background: var(--warn-bg); color: var(--warn); }
.pill-refused, .pill-cancelled, .pill-failed, .pill-rejected, .pill-void, .pill-withdrawn { background: var(--bad-bg); color: var(--bad); }

/* ------------------------------------------------------------ forms */
.form fieldset { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
.form legend { font-weight: 650; margin-bottom: .5rem; padding: 0; }
.form.narrow { max-width: 720px; }
.field { margin-bottom: .9rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; min-width: 0; }
.field label { font-weight: 600; font-size: .92rem; }
.field-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.field-row > .field { min-width: 12rem; }
.field.short { flex: 0 1 10rem; min-width: 8rem; }
.field.grow { flex: 2; }
.opt { font-weight: 400; color: var(--ink-soft); font-size: .85em; }
input[type=text], input:not([type]), input[type=email], input[type=password], input[type=tel], input[type=search],
input[type=date], input[type=url], select, textarea {
    font: inherit; padding: .5rem .6rem; border: 1px solid #a9b6b0; border-radius: var(--radius); background: #fff; color: var(--ink); width: 100%;
}
input[aria-invalid=true], select[aria-invalid=true], textarea[aria-invalid=true] { border: 2px solid var(--bad); }
.field-error { color: var(--bad); font-size: .88rem; font-weight: 600; margin: 0; }
.check { display: flex; gap: .5rem; align-items: baseline; margin: 0 0 .5rem; font-size: .95rem; }
.checks .check { font-weight: 400; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: .5rem; }
.searchbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.searchbar input[type=search] { max-width: 24rem; }
.searchbar select { width: auto; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .75rem; }
.inline-form .hint { flex-basis: 100%; margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .9rem; }
.filters a { padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-size: .88rem; color: var(--ink); }
.filters a[aria-current] { background: var(--brand); border-color: var(--brand); color: #fff; }
[data-toggled][hidden] { display: none; }

/* ------------------------------------------------------------ chain of custody
   The one bold element: where the load is right now, in hi-vis. */
.custody { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 0 0 1.5rem; padding: 0; counter-reset: none; }
.custody-compact { grid-template-columns: repeat(4, 1fr); }
.custody li {
    position: relative; padding: .75rem 1.6rem .75rem 1.9rem; min-height: 4.6rem;
    background: #e3e9e6; color: var(--ink-soft);
    clip-path: polygon(0 0, calc(100% - 1rem) 0, 100% 50%, calc(100% - 1rem) 100%, 0 100%, 1rem 50%);
    display: flex; flex-direction: column; justify-content: center;
}
.custody li:first-child { clip-path: polygon(0 0, calc(100% - 1rem) 0, 100% 50%, calc(100% - 1rem) 100%, 0 100%); padding-left: 1rem; }
.custody-compact li { min-height: 3rem; }
.custody-label { font-weight: 700; font-size: .95rem; }
.custody-who { font-size: .9rem; }
.custody-when { font-size: .8rem; }
.custody .custody-done { background: var(--brand); color: var(--brand-ink); }
.custody .custody-current { background: var(--hivis); color: #241d00; }
.custody .custody-cancelled { background: #ece7e6; color: #8a6d69; text-decoration: line-through; }

/* conversation + timeline */
.thread { list-style: none; padding: 0; margin: 0 0 1rem; }
.thread li { padding: .7rem .9rem; border-radius: var(--radius); margin-bottom: .6rem; background: #f0f4f2; max-width: 80ch; }
.thread .from-dept { background: #e5eef7; margin-left: auto; }
.thread .internal { background: #fbf4e0; border: 1px dashed #d9b452; }
.thread-meta { font-size: .85rem; color: var(--ink-soft); margin-bottom: .25rem; }
.tag { font-weight: 600; color: var(--warn); }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.timeline li { padding: .3rem 0 .3rem 1rem; border-left: 2px solid var(--line); }
.timeline time { color: var(--ink-soft); margin-right: .4rem; }
.notes { list-style: none; padding: 0; }
.notes li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: .6rem; }
.notes .is-unread { border-left: 4px solid var(--hivis); }
.notes .is-read { opacity: .75; }
.note-head { display: flex; gap: .75rem; align-items: baseline; flex-wrap: wrap; }
.note-head time { margin-left: auto; font-size: .85rem; color: var(--ink-soft); }
.note-actions { display: flex; gap: 1rem; align-items: baseline; font-size: .9rem; }
.kind { font-size: .75rem; font-weight: 700; padding: .05rem .45rem; border-radius: 3px; background: #e7ece9; }
.kind-task { background: var(--hivis); color: #241d00; }
.kind-reminder { background: var(--warn-bg); color: var(--warn); }

.decision-approved { border-left: 4px solid var(--ok); }
.decision-refused { border-left: 4px solid var(--bad); }
.assess { border-top: 4px solid var(--brand); }
.assessor { margin-bottom: 1rem; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.allocation { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }

/* auth */
.authbox { max-width: 30rem; margin: 1rem auto; }
.democreds { margin-top: 2rem; font-size: .9rem; }
.democreds table { font-size: .88rem; }

/* code */
pre.code { background: #0f2725; color: #d8ebe6; padding: 1rem; border-radius: var(--radius); overflow-x: auto; font-size: .85rem; }
.secret { font-size: 1rem; word-break: break-all; background: var(--warn-bg); padding: .3rem .5rem; }
.debug { white-space: pre-wrap; font-size: .8rem; background: #fff; padding: 1rem; border: 1px solid var(--line); }
.errorpage { max-width: 40rem; }
.errorcode { font-size: 4rem; font-weight: 700; color: var(--line); margin: 0; line-height: 1; }

/* capture page */
.netline { font-weight: 600; }
.netline.online { color: var(--ok); }
.netline.offline { color: var(--warn); }

/* ------------------------------------------------------------ small screens / field devices */
@media (max-width: 760px) {
    .navtoggle { display: inline-block; margin-left: auto; background: none; color: var(--brand-ink); border: 1px solid rgba(255,255,255,.4); border-radius: var(--radius); padding: .35rem .8rem; font: inherit; }
    .mainnav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: .75rem; }
    .mainnav.open { display: flex; }
    .nav-spacer { display: none; }
    .custody, .custody-compact { grid-template-columns: 1fr; gap: 3px; }
    .custody li, .custody li:first-child { clip-path: none; padding: .6rem 1rem; min-height: 0; border-radius: var(--radius); }
    .button, .button-quiet, .button-danger { padding: .75rem 1.1rem; }   /* bigger touch targets */
    input, select, textarea { font-size: 16px !important; }              /* stops iOS zooming */
    .whoami { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media print {
    .pocbar, .masthead, .footer, form, .actions, details, [data-print], .filters, .searchbar { display: none !important; }
    body { background: #fff; }
    .panel { border: 1px solid #999; break-inside: avoid; }
    .custody li { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
