/* Project Tracker theme on top of Pico CSS.
   White background, navy text, one blue accent, light grey cards. Mobile first. */
:root:not([data-theme="dark"]), [data-theme="light"] {
  --ct-navy: #1B2A41;
  --ct-blue: #1F5FAF;
  --ct-blue-dark: #184C8C;
  --ct-grey: #F3F5F8;
  --ct-border: #DDE2EA;
  --ct-muted: #5B6B82;
  --ct-ok: #1E7B4D;
  --ct-warn: #9A6200;
  --ct-bad: #B3261E;

  --pico-background-color: #FFFFFF;
  --pico-color: var(--ct-navy);
  --pico-h1-color: var(--ct-navy);
  --pico-h2-color: var(--ct-navy);
  --pico-h3-color: var(--ct-navy);
  --pico-h4-color: var(--ct-navy);
  --pico-h5-color: var(--ct-navy);
  --pico-h6-color: var(--ct-navy);
  --pico-muted-color: var(--ct-muted);
  --pico-primary: var(--ct-blue);
  --pico-primary-background: var(--ct-blue);
  --pico-primary-border: var(--ct-blue);
  --pico-primary-hover: var(--ct-blue-dark);
  --pico-primary-hover-background: var(--ct-blue-dark);
  --pico-primary-focus: rgba(31, 95, 175, 0.3);
  --pico-card-background-color: var(--ct-grey);
  --pico-card-sectioning-background-color: var(--ct-grey);
  --pico-font-size: 100%;
  --pico-spacing: 1rem;
  --tap: 48px; /* minimum touch target */
}

body { background: #FFFFFF; color: var(--ct-navy); }
.muted { color: var(--ct-muted); }
code { color: var(--ct-navy); background: #E8ECF2; }

/* ---- App shell -------------------------------------------------------------
   < 1024px (phones, iPad portrait): slim top bar + bottom tab bar.
   >= 1024px (iPad landscape, laptops): left sidebar with every module.        */
.main-col { min-width: 0; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ct-navy); text-decoration: none; min-width: 0; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand strong { white-space: nowrap; }
.brand small { color: var(--ct-muted); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand img { flex: none; }

.topbar { border-bottom: 1px solid var(--ct-border); background: #FFFFFF; position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: .5rem; min-height: 56px; padding: 0 max(1rem, env(safe-area-inset-left)); }
.brand-top { margin-right: auto; }
.usermenu { margin: 0; }
.usermenu summary { min-height: 44px; display: flex; align-items: center; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linklike { background: none; border: 0; padding: 0; color: var(--ct-blue); width: auto; margin: 0; }

.sidenav { display: none; }

.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-around;
  background: #FFFFFF; border-top: 1px solid var(--ct-border); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); z-index: 10; }
.bottomnav a { flex: 1; max-width: 160px; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-decoration: none; color: var(--ct-muted); font-size: .78rem; }
.bottomnav a .ico { font-size: 1.35rem; line-height: 1; margin-bottom: 2px; }
.bottomnav a[aria-current="page"] { color: var(--ct-blue); font-weight: 600; }
body.shell { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

@media (max-width: 479px) {
  .topbar-inner { min-height: 52px; }
  .brand small { display: none; }        /* phones: just the app name */
  .usermenu summary { max-width: 6.5rem; padding-left: .6rem; padding-right: .6rem; }
}

@media (min-width: 1024px) {
  body.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); padding-bottom: 0; }
  .bottomnav { display: none; }
  .sidenav { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: #F8F9FB; border-right: 1px solid var(--ct-border); padding: 1rem .75rem; }
  .sidenav .brand { padding: .25rem .5rem .75rem; border-bottom: 1px solid var(--ct-border); }
  .sidenav nav { display: flex; flex-direction: column; gap: 2px; }
  .sidenav nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 8px;
    text-decoration: none; color: var(--ct-navy); font-size: .95rem; min-height: 42px; }
  .sidenav nav a .ico { width: 1.3rem; text-align: center; color: var(--ct-muted); font-size: 1.1rem; }
  .sidenav nav a:hover { background: #EEF2F7; }
  .sidenav nav a[aria-current="page"] { background: #E7F0FB; color: var(--ct-blue); font-weight: 600; }
  .sidenav nav a[aria-current="page"] .ico { color: var(--ct-blue); }
  body.shell .brand-top { visibility: hidden; }   /* the sidebar shows the brand */
}

/* Layout */
.page { width: 100%; max-width: 1320px; margin: 0 auto; padding: 1.25rem max(1rem, env(safe-area-inset-left)) 2rem; }
@media (min-width: 768px) { .page { padding-left: 1.5rem; padding-right: 1.5rem; } }
@media (min-width: 1024px) { .page { padding: 1.5rem 2rem 2.5rem; } }
.card { background: var(--ct-grey); border: 1px solid var(--ct-border); border-radius: 10px; box-shadow: none; padding: 1rem; margin-bottom: 1rem; }
.narrow { max-width: 420px; margin: 2rem auto; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.tiles { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); margin-bottom: 1.5rem; }
.tile h3 { margin-bottom: .25rem; font-size: 1.05rem; }
.tile p { margin: 0; font-size: .9rem; }

/* Touch-friendly controls */
button, [role="button"], input:not([type="checkbox"]):not([type="radio"]), select, textarea { min-height: var(--tap); }
button.block { width: 100%; }

/* Filters */
.filters { display: grid; gap: .5rem; grid-template-columns: 1fr; margin-bottom: .5rem; }
.filters > * { margin-bottom: 0; }
@media (min-width: 768px) { .filters { grid-template-columns: 2fr 1fr 1fr; } }

/* Messages */
.flash { padding: .75rem 1rem; border-radius: 8px; background: #E7F0FB; border: 1px solid #C5DAF3; }
.flash-error { background: #FBEAEA; border-color: #F0C4C2; color: var(--ct-bad); }
.flash-success { background: #E6F4EC; border-color: #BFE3CD; color: var(--ct-ok); }

/* Audit list */
.eventlist { list-style: none; padding: 0; }
.eventlist li { list-style: none; }
.event { padding: .75rem 1rem; margin-bottom: .5rem; }
.event time { color: var(--ct-muted); font-size: .85rem; }
.event details { margin: .5rem 0 0; }
.changes { font-size: .85rem; margin: .5rem 0 0; }
.changes td, .changes th { padding: .35rem .5rem; word-break: break-word; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.htmx-request { opacity: .6; transition: opacity .2s; }

/* Menu page */
.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1.5rem; }
.menu-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  min-height: 96px; text-decoration: none; color: var(--ct-navy); font-weight: 600; margin: 0; }
.menu-item .ico { font-size: 1.6rem; color: var(--ct-blue); }
@media (min-width: 768px) { .menu-grid { grid-template-columns: repeat(4, 1fr); } }

/* Text helpers */
.mb0 { margin-bottom: 0; }
.crumbs { margin-bottom: .25rem; font-size: .9rem; }
.crumbs a { text-decoration: none; }
.req { color: var(--ct-bad); }
small.error { display: block; color: var(--ct-bad); }
.field { margin-bottom: .25rem; }
.inline { display: inline-flex; align-items: center; gap: .4rem; }
.plainlist { padding-left: 1.1rem; }

/* Badges and stages */
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: #E8ECF2; color: var(--ct-navy); vertical-align: middle; }
.badge-void { background: #FBEAEA; color: var(--ct-bad); }
.badge-decommissioned { background: #EEE8F7; color: #5B3D8F; }
.badge-ok { background: #E6F4EC; color: var(--ct-ok); }
.badge-warn { background: #FFF4DE; color: var(--ct-warn); }
.badge-bad { background: #FBEAEA; color: var(--ct-bad); }
.badge-info { background: #E7F0FB; color: var(--ct-blue); }
.stage { display: inline-block; padding: .15rem .55rem; border-radius: 6px; font-size: .8rem; font-weight: 600;
  background: #E7F0FB; color: var(--ct-blue); white-space: nowrap; }
.stage-strip_out { background: #FBEDE3; color: #8A4B14; }
.stage-procurement { background: #F1EEF9; color: #5B3D8F; }
.stage-warehouse { background: #FFF4DE; color: var(--ct-warn); }
.stage-installation { background: #E7F0FB; color: var(--ct-blue); }
.stage-integration, .stage-interface_testing { background: #E3F2F5; color: #1A6573; }
.stage-commissioning { background: #E9F5E4; color: #3B6E22; }
.stage-handover { background: #E6F4EC; color: var(--ct-ok); }

/* Stage stepper */
.stepper { display: flex; list-style: none; padding: 0; margin: .5rem 0 1rem; overflow-x: auto; gap: 2px; }
.stepper li { list-style: none; flex: 1 0 auto; padding: .45rem .6rem; font-size: .75rem; text-align: center;
  background: #E8ECF2; color: var(--ct-muted); white-space: nowrap; }
.stepper li:first-child { border-radius: 6px 0 0 6px; }
.stepper li:last-child { border-radius: 0 6px 6px 0; }
.stepper li.done { background: #C9D9EF; color: var(--ct-navy); }
.stepper li.current { background: var(--ct-blue); color: #fff; font-weight: 700; }

/* Facts list */
.facts { display: grid; grid-template-columns: 8rem 1fr; gap: .4rem .75rem; margin: 0; }
.facts dt { color: var(--ct-muted); font-weight: 400; }
.facts dd { margin: 0; }

/* Timeline */
.timeline { list-style: none; padding: 0; border-left: 3px solid var(--ct-border); margin-left: .4rem; }
.timeline li { list-style: none; position: relative; padding: 0 0 1rem 1rem; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: .35rem; width: 13px; height: 13px; border-radius: 50%;
  background: var(--ct-blue); border: 2px solid #fff; }
.timeline li.reversal::before { background: var(--ct-warn); }
.timeline time { color: var(--ct-muted); font-size: .85rem; }

.action-card > summary { min-height: var(--tap); display: flex; align-items: center; }

/* Responsive table: rows become cards on phones */
.table-cards table { width: 100%; }
.table-cards tbody tr { cursor: pointer; }
.table-cards tbody tr:hover td { background: var(--ct-grey); }
@media (max-width: 767px) {
  .table-cards thead { display: none; }
  .table-cards table, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { background: var(--ct-grey); border: 1px solid var(--ct-border); border-radius: 10px; margin-bottom: .6rem; padding: .6rem .8rem; }
  .table-cards td { border: 0; padding: .1rem 0; background: transparent !important; }
  .table-cards td[data-label]::before { content: attr(data-label) ": "; color: var(--ct-muted); font-size: .85rem; }
  .table-cards td[data-label="Tag"]::before { content: ""; }
}

/* Asset filters */
.more-filters { margin: 0; }
.more-filters summary { min-height: var(--tap); display: flex; align-items: center; }
.filter-grid { display: grid; grid-template-columns: 1fr; gap: .5rem; }
.filter-grid select { margin-bottom: 0; }
@media (min-width: 768px) {
  .filters-assets { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: repeat(4, 1fr); }
}
.filters-inline { grid-template-columns: 1fr; }
@media (min-width: 768px) { .filters-inline { grid-template-columns: 2fr 1fr; align-items: center; } }

/* Indented tree lists (setup) */
.treelist { list-style: none; padding: 0; }
.treelist li { list-style: none; margin-left: calc(var(--depth, 0) * 1rem); padding: .6rem .9rem; margin-bottom: .4rem; }
.treelist a { text-decoration: none; }
.menu-item small { font-weight: 400; }
[hidden] { display: none !important; }
@media (max-width: 767px) {
  /* compact asset cards: secondary facts on one line */
  .table-cards td.inline { display: inline; width: auto; font-size: .9rem; color: var(--ct-muted); }
  .table-cards td.inline::before { content: "" !important; }
  .table-cards td.inline + td.inline::before { content: " · " !important; }
  .table-cards td.stagecell { position: absolute; top: .6rem; right: .8rem; width: auto; }
  .table-cards td.stagecell::before { content: "" !important; }
  .table-cards tr { position: relative; }
}
@media (max-width: 767px) {
  /* stepper becomes a segmented progress bar; only the current stage is labelled */
  .stepper { overflow: visible; }
  .stepper li { font-size: 0; padding: .35rem 0; flex: 1 1 0; min-width: 0; }
  .stepper li.current { font-size: .75rem; flex: 4 1 0; padding: .35rem .4rem; }
}

/* Shared list cards */
.plain-cards { list-style: none; padding: 0; }
.plain-cards > li { list-style: none; }
.linkcard { display: block; text-decoration: none; color: var(--ct-navy); }
.linkcard:hover { border-color: var(--ct-blue); }
.linktile { text-decoration: none; color: var(--ct-navy); }
.selectable > li { display: flex; gap: .75rem; align-items: flex-start; padding: .7rem .9rem; margin-bottom: .5rem; }
.selectable > li > input[type=checkbox] { width: 1.6rem; height: 1.6rem; margin-top: .15rem; flex: none; }
.selectable .grow { flex: 1; text-decoration: none; color: var(--ct-navy); }
.btnrow { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.btnrow form { margin: 0; }
.btnrow button, .btnrow [role=button] { margin: 0; width: auto; }
.btngrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.btngrid button { margin: 0; }
.text-bad { color: var(--ct-bad); }
.text-ok { color: var(--ct-ok); }
.small { font-size: .85rem; }
.sticky-actions { position: sticky; bottom: 76px; z-index: 5; box-shadow: 0 -4px 16px rgba(27,42,65,.08); }
@media (min-width: 768px) { .sticky-actions { bottom: 0; } }
fieldset { border: 1px solid var(--ct-border); border-radius: 8px; padding: .75rem; margin-bottom: .75rem; }
.radio-row fieldset, .radio-row > div { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.radio-row label { display: inline-flex; align-items: center; gap: .3rem; min-height: var(--tap); }
.radio-row ul, .radio-row div > div { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .25rem 1rem; }

/* Reconciliation */
.table-scroll { overflow-x: auto; }
.recon td, .recon th { white-space: nowrap; }
.recon td:first-child { white-space: normal; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.recon tr.unbalanced td { background: #FFF8F7; }
.recon-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1rem; }
.recon-mini > div { background: var(--ct-grey); border: 1px solid var(--ct-border); border-radius: 8px; padding: .5rem .6rem; display: flex; flex-direction: column; }
.recon-mini span { font-size: .75rem; color: var(--ct-muted); }
.recon-mini strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.recon-mini .bad { border-color: #F0C4C2; background: #FBEAEA; color: var(--ct-bad); }
.recon-mini .ok { border-color: #BFE3CD; background: #E6F4EC; color: var(--ct-ok); }
@media (min-width: 768px) { .recon-mini { grid-template-columns: repeat(6, 1fr); } }
.flaglist { list-style: none; padding: 0; }
.flaglist > li { list-style: none; border-left: 4px solid var(--ct-bad); }
.flaglist ul { margin: .25rem 0 0 1rem; }

/* Photos */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-bottom: .75rem; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; border: 1px solid var(--ct-border); }
@media (min-width: 768px) { .photos { grid-template-columns: repeat(6, 1fr); } }

.approvals { list-style: none; padding: 0; margin: .5rem 0; }
.approvals li { list-style: none; }
.line-completed { border-left: 4px solid var(--ct-ok); }
.line-rejected { border-left: 4px solid var(--ct-bad); opacity: .8; }
.line-proposed { border-left: 4px solid var(--ct-warn); }
.line-approved { border-left: 4px solid var(--ct-blue); }
.row-between > [role=button], .row-between > .btnrow { margin-bottom: 1rem; }

/* Signature pad */
.sigpad { margin-bottom: 1rem; }
.sigpad canvas { width: 100%; height: auto; aspect-ratio: 3 / 1; background: #fff; border: 2px dashed var(--ct-border);
  border-radius: 8px; touch-action: none; display: block; margin-bottom: .4rem; }
.sigpad .sig-clear { width: auto; padding: .3rem .9rem; min-height: 36px; }
.sigimg { max-width: 260px; background: #fff; border: 1px solid var(--ct-border); border-radius: 6px; }
.count-grid { grid-template-columns: repeat(3, 1fr) !important; gap: .5rem; }
.count-grid label { font-size: .8rem; }
.qty-input { width: 8rem; display: inline-block; min-height: 40px; margin: .25rem 0 0 .5rem; }
.sig-row { display: flex; gap: 1rem; flex-wrap: wrap; }

/* Permits */
.impairment-banner { background: #FBEAEA; border: 2px solid var(--ct-bad); color: #7A1A14; border-radius: 10px;
  padding: .75rem 1rem; margin-bottom: 1rem; }
.impairment-banner ul { margin: .35rem 0 0 1rem; }
.impairment-banner a { color: #7A1A14; font-weight: 600; }
.linkcard.impairment { border-left: 4px solid var(--ct-bad); }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .5rem; margin-bottom: .5rem; }
.chip { flex: none; padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--ct-border); text-decoration: none;
  color: var(--ct-navy); background: #fff; font-size: .9rem; min-height: 40px; display: inline-flex; align-items: center; }
.chip.on { background: var(--ct-blue); border-color: var(--ct-blue); color: #fff; }
.checklist { list-style: none; padding: 0; }
.checklist li { list-style: none; padding: .35rem 0 .35rem 1.8rem; position: relative; }
.checklist li::before { position: absolute; left: 0; font-weight: 700; }
.checklist li.ok::before { content: "✔"; color: var(--ct-ok); }
.checklist li.no::before { content: "✖"; color: var(--ct-bad); }
.stack > * { margin-bottom: .6rem; }

/* Testing */
.gate { border-left: 6px solid var(--ct-border); }
.gate h2 { margin-bottom: .4rem; font-size: 1.1rem; }
.gate-done { border-left-color: var(--ct-ok); background: #F1F9F4; }
.gate-ready { border-left-color: var(--ct-blue); background: #F2F7FD; }
.gate-blocked { border-left-color: var(--ct-warn); }
.gate ul { margin-left: 1rem; }
.mt { margin-top: .6rem; }
table.compact td, table.compact th { padding: .35rem .5rem; font-size: .9rem; }
.steps { list-style: none; padding: 0; }
.steps > li { list-style: none; }
.progress { display: flex; gap: 4px; overflow-x: auto; padding-bottom: .4rem; }
.progress a { flex: none; min-width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; background: #E8ECF2; color: var(--ct-muted); text-decoration: none; font-weight: 600; }
.progress a.done { background: #C9D9EF; color: var(--ct-navy); }
.progress a.current { background: var(--ct-blue); color: #fff; }
.step-card h2 { font-size: 1.2rem; }
.outcome-buttons { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .5rem; margin: .5rem 0 1rem; }
.outcome-buttons button { min-height: 64px; font-size: 1.1rem; font-weight: 700; margin: 0; border: 2px solid transparent; }
.outcome-buttons .pass { background: var(--ct-ok); border-color: var(--ct-ok); }
.outcome-buttons .fail { background: var(--ct-bad); border-color: var(--ct-bad); }
.outcome-buttons .na { background: #fff; color: var(--ct-navy); border-color: var(--ct-border); }
.outcome-buttons .chosen { box-shadow: 0 0 0 4px rgba(31, 95, 175, .35); }

/* Work management */
.bell { position: relative; text-decoration: none; font-size: 1.25rem; min-width: var(--tap); min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center; }
.bell-count:not(:empty) { position: absolute; top: 4px; right: 2px; background: var(--ct-bad); color: #fff; font-size: .7rem;
  font-weight: 700; border-radius: 999px; padding: 0 .35rem; min-width: 1.1rem; text-align: center; }
.work-filters { grid-template-columns: 1fr 1fr; }
.work-filters input[type=search] { grid-column: 1 / -1; }
@media (min-width: 768px) { .work-filters { grid-template-columns: 2fr repeat(5, 1fr) auto; } .work-filters input[type=search] { grid-column: auto; } }
.sortrow { display: flex; gap: .4rem; align-items: center; margin-bottom: .5rem; flex-wrap: wrap; }
.newmenu { margin: 0; }
.newmenu summary { margin: 0; }
.wlist { display: grid; gap: .5rem; }
@media (min-width: 900px) { .wlist { grid-template-columns: 1fr 1fr; } }
.wcard { background: var(--ct-grey); border: 1px solid var(--ct-border); border-left: 5px solid var(--ct-border);
  border-radius: 8px; padding: .55rem .7rem; }
.wcard-link { display: flex; flex-direction: column; gap: .15rem; text-decoration: none; color: var(--ct-navy); }
.wcard.prio-critical { border-left-color: var(--ct-bad); }
.wcard.prio-high { border-left-color: #E07A1F; }
.wcard.prio-medium { border-left-color: var(--ct-blue); }
.wcard.prio-low { border-left-color: #9AA8BC; }
.wcard.dragging { opacity: .5; }
.move-form { margin: .4rem 0 0; }
.move-select { min-height: 38px !important; padding: .2rem .5rem; font-size: .85rem; margin: 0; }
.kind { font-weight: 700; }
.kind-ncr { color: var(--ct-bad); }
.kind-punch { color: #8A4B14; }
.prio-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .35rem; background: #9AA8BC; }
.prio-dot.prio-critical { background: var(--ct-bad); } .prio-dot.prio-high { background: #E07A1F; } .prio-dot.prio-medium { background: var(--ct-blue); }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: 85%; gap: .75rem; overflow-x: auto;
  scroll-snap-type: x mandatory; padding-bottom: .75rem; }
@media (min-width: 900px) { .board { grid-auto-columns: minmax(220px, 1fr); } }
.col { scroll-snap-align: start; background: #F8F9FB; border: 1px solid var(--ct-border); border-radius: 10px; padding: .6rem;
  min-height: 200px; }
.col h3 { font-size: 1rem; margin-bottom: .5rem; }
.col-cards { display: grid; gap: .5rem; }
.comments { list-style: none; padding: 0; }
.comments > li { list-style: none; }
.linkcard.unread { border-left: 4px solid var(--ct-blue); font-weight: 600; }
.filetile { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; background: #E8ECF2; border-radius: 6px;
  font-size: .75rem; padding: .3rem; text-align: center; word-break: break-all; }

/* Scan */
.scan-box video { width: 100%; border-radius: 8px; background: #000; aspect-ratio: 1; object-fit: cover; }

/* Dashboard */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-bottom: 1rem; }
@media (min-width: 768px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { display: flex; flex-direction: column; gap: .15rem; text-decoration: none; color: var(--ct-navy); margin: 0; padding: .8rem; }
.kpi:hover { border-color: var(--ct-blue); }
.kpi-label { font-size: .8rem; color: var(--ct-muted); }
.kpi-value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .75rem; color: var(--ct-muted); }
.kpi-bad { border-left: 4px solid var(--ct-bad); }
.kpi-bad .kpi-value { color: var(--ct-bad); }
.kpi-ok { border-left: 4px solid var(--ct-ok); }
.viz { background: #fff; }
.viz h2 { font-size: 1.1rem; margin-bottom: .6rem; }
.hbars { list-style: none; padding: 0; margin: 0; }
.hbars li { list-style: none; margin: 0; }
.hbar-row { display: grid; grid-template-columns: 7.5rem 1fr 3rem; align-items: center; gap: .5rem; min-height: 34px;
  text-decoration: none; color: var(--ct-navy); }
.hbar-row:hover .hbar { background: var(--ct-blue-dark); }
.hbar-label { font-size: .85rem; }
.hbar-track { height: 16px; }
.hbar { display: block; height: 100%; min-width: 2px; background: var(--ct-blue); border-radius: 0 4px 4px 0; }
.hbar-value { font-size: .85rem; font-variant-numeric: tabular-nums; text-align: right; }
table.heat { border-collapse: separate; border-spacing: 2px; font-size: .8rem; }
table.heat th, table.heat td { padding: .3rem .4rem; border: 0; }
table.heat thead th { font-weight: 500; color: var(--ct-muted); vertical-align: bottom; white-space: nowrap; font-size: .72rem; }
table.heat tbody th { white-space: nowrap; font-weight: 600; }
table.heat td.num { min-width: 2.4rem; border-radius: 3px; text-align: center; }
.pctcell { min-width: 9rem; white-space: nowrap; }
.pct-track { display: inline-block; position: relative; width: 6rem; height: 10px; background: #E8ECF2; border-radius: 4px;
  vertical-align: middle; overflow: hidden; }
.pct-late { position: absolute; left: 0; top: 0; bottom: 0; background: #9ec5f4; }
.pct-done { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ct-blue); }
.pct-num { font-variant-numeric: tabular-nums; margin-left: .35rem; }
.btngrid.three { grid-template-columns: repeat(3, 1fr); }
.btngrid a[role=button] { margin: 0; text-align: center; }
.report-form select, .report-form input { margin-bottom: .5rem; }
.key { display: inline-block; width: .8rem; height: .6rem; border-radius: 2px; vertical-align: baseline; }
.key-done { background: var(--ct-blue); } .key-late { background: #9ec5f4; }

/* Imports */
.grid2 { display: grid; gap: .75rem; }
@media (min-width: 768px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.inline-match { display: flex; gap: .3rem; margin: .3rem 0 0; }
.inline-match input, .inline-match button { min-height: 36px !important; padding: .2rem .5rem; margin: 0; font-size: .85rem; width: auto; }
tr.row-unmatched td, tr.row-error td, tr.row-conflict td { background: #FFF8F7; }
.table-cards tr[class^="row-"] { cursor: default; }

/* Users */
.radio-col ul, .radio-col div > div { list-style: none; padding: 0; margin: 0; }
.radio-col li, .radio-col div > div > div { list-style: none; }
.radio-col label { display: flex; align-items: center; gap: .5rem; min-height: var(--tap); font-weight: 400; }
.linkbox { border: 2px solid var(--ct-blue); background: #F2F7FD; }
.linkbox input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; }

/* iOS zooms into any field with text under 16px: keep form controls at 16px on touch-size screens. */
@media (max-width: 1023px) {
  input, select, textarea, .move-select, .inline-match input, .qty-input { font-size: 16px !important; }
}

/* Tablet tuning (iPad portrait / small landscape) */
@media (min-width: 600px) and (max-width: 899px) { .board { grid-auto-columns: calc(50% - .4rem); } }
@media (min-width: 768px) and (max-width: 1199px) {
  .work-filters { grid-template-columns: repeat(3, 1fr); }
  .work-filters input[type=search] { grid-column: 1 / -1; }
}

/* Scanner */
.scan-field { display: flex; gap: .4rem; align-items: flex-start; }
.scan-field > input, .scan-field > textarea { flex: 1; margin-bottom: 0; }
.scan-btn { width: auto; flex: none; margin: 0; padding: .55rem .8rem; white-space: nowrap; }
/* Pico centres <dialog><article>; the article is the sheet. */
dialog.scanner, dialog.quick-dialog { background: rgba(10, 18, 30, .7); }
dialog.scanner > article { width: min(560px, 100vw); max-width: 100vw; max-height: 100dvh; padding: .75rem; margin: 0;
  border-radius: 12px; overflow-y: auto; }
.scanner-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.scanner-close { width: auto; margin: 0; }
.scanner-view { position: relative; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; }
.scanner-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-frame { position: absolute; inset: 18% 12%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 10px; }
dialog.scanner.hit .scanner-frame { border-color: #3AD07A; box-shadow: 0 0 0 9999px rgba(58, 208, 122, .15); }
.scanner-status { margin: .5rem 0 .25rem; font-size: .95rem; }
.scanner-list { max-height: 9rem; overflow-y: auto; margin: 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; }
@media (max-width: 600px) { dialog.scanner > article { width: 100vw; height: 100dvh; border-radius: 0; } }
.scan-big { min-height: 72px; font-size: 1.2rem; margin-bottom: .4rem; }
.notfound { border-left: 4px solid var(--ct-warn); }
.batch-row { padding: .45rem .7rem; border-left: 4px solid var(--ct-border); background: var(--ct-grey); border-radius: 6px; margin-bottom: .35rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: baseline; }
.batch-row.ok { border-left-color: var(--ct-ok); }
.batch-row.bad { border-left-color: var(--ct-bad); }
.quick-btn { width: auto; flex: none; margin: 0; padding: .55rem .8rem; white-space: nowrap; }
dialog.quick-dialog > article { width: min(520px, 96vw); max-height: 92dvh; overflow-y: auto; margin: 0; padding: 1rem 1.1rem; }
.badge-site { background: #FFF4DE; color: var(--ct-warn); }
.inline-form { display: inline; margin: 0; }
.inline-form button { width: auto; display: inline-block; margin: .3rem 0 0; padding: .35rem .8rem; }
.menu-item .badge { margin-top: .2rem; }
.flash.incomplete { background: #FFF4DE; border-color: #F2D48A; color: #6B4600; }
.steps-inline { padding-left: 1.1rem; }
.steps-inline li { margin-bottom: .5rem; }
.steps-inline [role=button] { width: auto; display: inline-block; padding: .4rem .9rem; }
.grid3 { display: grid; gap: 1rem; }
@media (min-width: 900px) { .grid3 { grid-template-columns: repeat(3, 1fr); } }
