/* Busy Bins Fleet — design system
   Brand (Busy Bins Brand Guidelines 2017): green #C1D82F, black #000000, white and greys. Headings in Arvo (agreed with Busy Bins in place of Chennai Slab), text in Helvetica Neue.
   Two themes on <html data-theme="light|dark">. Light: crisp white surfaces and hairlines. Dark: true black with grey layers.
   Red and amber are status colours only. */

@font-face { font-family: 'Arvo'; font-weight: 400; font-display: swap; src: url('../fonts/arvo-400.woff2') format('woff2'); }
@font-face { font-family: 'Arvo'; font-weight: 700; font-display: swap; src: url('../fonts/arvo-700.woff2') format('woff2'); }

:root, :root[data-theme="light"] {
  color-scheme: light;
  --green: #C1D82F;            /* brand green: fills, bars, focus */
  --green-ink: #4F5C00;        /* brand green darkened for text on white (AA) */
  --green-wash: #F3F8D6;
  --on-green: #000;
  --bg: #F4F4F2; --surface: #FFFFFF; --surface-2: #FAFAF8; --surface-3: #F0F0EE; --hover: #F6F6F3;
  --line: #E4E4E0; --line-strong: #CFCFCA;
  --text: #000000; --text-2: #3D3D3D; --muted: #6B6B6B; --faint: #9A9A9A;
  --side: #000000; --side-text: #B8B8B8; --side-hover: #1E1E1E; --side-line: #262626;
  --red: #C8261A; --red-wash: #FCEBE9; --amber: #A35E00; --amber-wash: #FFF2D9; --ok: #4F5C00; --ok-wash: #F1F7D2;
  --btn: #000; --btn-text: #fff; --btn-hover: #2A2A2A;
  --shadow-pop: 0 12px 40px rgba(0,0,0,.16), 0 2px 6px rgba(0,0,0,.06);
  --plate-bg: #FFD500; --plate-text: #000; --plate-line: #000;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --green-ink: #C1D82F; --green-wash: #20240D; --on-green: #000;
  --bg: #000000; --surface: #141414; --surface-2: #1A1A1A; --surface-3: #232323; --hover: #1F1F1F;
  --line: #262626; --line-strong: #3A3A3A;
  --text: #FFFFFF; --text-2: #D6D6D6; --muted: #A3A3A3; --faint: #6E6E6E;
  --side: #000000; --side-text: #A3A3A3; --side-hover: #181818; --side-line: #1F1F1F;
  --red: #FF6A5C; --red-wash: #2C1311; --amber: #F2B04B; --amber-wash: #2A1F0C; --ok: #C1D82F; --ok-wash: #20240D;
  --btn: #C1D82F; --btn-text: #000; --btn-hover: #D2E85A;
  --shadow-pop: 0 16px 48px rgba(0,0,0,.6);
  --plate-bg: #FFD500; --plate-text: #000; --plate-line: #FFD500;
}
:root {
  --r-lg: 14px; --r: 10px; --r-sm: 7px;
  --font: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --display: 'Arvo', Rockwell, Georgia, serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { transition: background-color .2s var(--ease); }
a { color: var(--text); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--green); text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { flex: none; display: block; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
.money { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }
.boot { padding: 40px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ================= Shell ================= */
.shell { display: flex; min-height: 100vh; }
.side { width: 248px; flex: none; background: var(--side); padding: 18px 12px 14px; display: flex; flex-direction: column; gap: 1px; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.side .brand { display: block; padding: 10px 12px 24px; }
.side .brand img { height: 42px; width: auto; display: block; }
.nav-label { font-size: 12px; font-weight: 500; color: #6E6E6E; padding: 18px 12px 6px; }
.nav { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; color: var(--side-text); text-decoration: none; font-weight: 500; font-size: 14px; transition: color .15s, background-color .15s; }
.nav:hover { color: #fff; background: var(--side-hover); }
.nav.on { color: #fff; background: #1A1A1A; font-weight: 700; }
.nav.on::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--green); }
.nav.on .ico { color: var(--green); }
.nav-badge { margin-left: auto; display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #262626; color: #fff; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.nav-badge.bad { background: var(--green); color: #000; }
.nav-badge.phase { background: transparent; color: #5C5C5C; border: 1px solid #2E2E2E; font-weight: 500; }
.side-foot { margin-top: auto; padding: 16px 12px 4px; display: flex; gap: 10px; align-items: center; color: #8A8A8A; font-size: 12.5px; line-height: 1.3; border-top: 1px solid var(--side-line); }
.side-foot img { width: 28px; height: 28px; }
.demo-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.demo-tag::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-wash); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 32px; position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; }
.topbar .mob { display: none; }
.top-search { position: relative; flex: 0 1 460px; }
.top-search input { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 0 16px 0 40px; font-size: 14px; transition: border-color .15s, box-shadow .15s; }
.top-search input::placeholder { color: var(--faint); }
.top-search input:hover { border-color: var(--line-strong); }
.top-search input:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px var(--green-wash); }
.top-search .ico { position: absolute; left: 14px; top: 11px; color: var(--muted); }
.spacer { flex: 1; }
.top-btn { position: relative; width: 40px; height: 40px; border-radius: 999px; border: none; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--text-2); transition: background-color .15s; }
.top-btn:hover { background: var(--surface-3); color: var(--text); }
.top-btn .dot { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; border-radius: 999px; background: var(--green); color: #000; font-size: 10px; font-weight: 800; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--bg); }
.user-btn { display: flex; align-items: center; gap: 10px; border: none; background: transparent; border-radius: 999px; padding: 3px 10px 3px 3px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--text); transition: background-color .15s; }
.user-btn:hover { background: var(--surface-3); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: #000; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; }
.user-role { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; text-align: left; }
.pop { position: absolute; top: calc(100% + 8px); right: 0; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); border: 1px solid var(--line); min-width: 300px; max-width: min(420px, calc(100vw - 24px)); z-index: 100; padding: 6px; max-height: 70vh; overflow: auto; animation: pop-in .14s var(--ease); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
.pop-head { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 10px 10px 6px; }
.pop a, .pop button.pop-item { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; color: var(--text); text-decoration: none; border: none; background: none; cursor: pointer; font-size: 13.5px; }
.pop a:hover, .pop button.pop-item:hover, .pop a.sel { background: var(--hover); }
.pop .sub-line { display: block; color: var(--muted); font-size: 12px; }
.pop label { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pop select { height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--surface); color: var(--text); font-size: 13.5px; }
.pop hr { border: none; border-top: 1px solid var(--line); margin: 6px 4px; }
.rel { position: relative; }
.main { padding: 12px 32px 64px; display: flex; flex-direction: column; gap: 24px; min-width: 0; max-width: 1440px; width: 100%; }
.main:focus { outline: none; }
.bnav { display: none; }

/* ================= Type & page header ================= */
h1 { margin: 0; font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
h2 { margin: 0; font-size: 15.5px; font-weight: 700; letter-spacing: -0.005em; }
h3 { margin: 0; font-size: 14px; font-weight: 700; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-head h1 { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; max-width: 72ch; }
.eyebrow { font-size: 13px; color: var(--muted); font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; margin-bottom: -8px; }
.eyebrow:hover { color: var(--text); }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ================= Buttons ================= */
.btn, .pill { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: 13.5px; color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none; transition: background-color .15s, border-color .15s, transform .1s; }
.btn:hover, .pill:hover { border-color: var(--text); background: var(--surface); color: var(--text); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn.cta { background: var(--btn); border-color: var(--btn); color: var(--btn-text); }
.btn.cta:hover { background: var(--btn-hover); border-color: var(--btn-hover); color: var(--btn-text); }
.btn.soft, .btn.green { background: var(--green); border-color: var(--green); color: #000; }
.btn.soft:hover, .btn.green:hover { background: #CFE34A; border-color: #CFE34A; color: #000; }
:root[data-theme="dark"] .btn.cta { background: #fff; border-color: #fff; color: #000; }
:root[data-theme="dark"] .btn.cta:hover { background: #E6E6E6; }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn.danger:hover { border-color: var(--red); }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 12.5px; gap: 6px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { min-height: 34px; padding: 0 14px; font-size: 13px; font-weight: 500; border-color: var(--line); }
.pill.on { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }
.icon-btn { width: 36px; height: 36px; border: none; background: transparent; border-radius: 999px; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.link-btn { background: none; border: none; padding: 0; color: var(--text); font-weight: 600; cursor: pointer; min-height: 28px; display: inline-flex; gap: 6px; align-items: center; font-size: 13px; text-decoration: underline; text-decoration-color: var(--green); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.link-btn:hover { text-decoration-color: var(--text); }

/* ================= Surfaces ================= */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.pad { padding: 20px 22px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 20px 10px; }
.card-title h2 { display: flex; gap: 10px; align-items: center; }
.card-title h2 .ico { color: var(--muted); }
.card-body { padding: 2px 20px 16px; }
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split > .wide { flex: 2 1 540px; min-width: 0; }
.split > .narrow { flex: 1 1 320px; min-width: 0; }

/* KPI strip: one card split into four, slab numerals are the signature */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.kpi { position: relative; padding: 18px 22px 20px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line); transition: background-color .15s; }
.kpi:first-child { border-left: none; }
a.kpi:hover { background: var(--hover); color: inherit; text-decoration: none; }
.kpi-icon { order: -1; display: flex; align-items: center; gap: 8px; color: var(--muted); margin-bottom: 10px; }
.kpi-icon .ico { width: 16px; height: 16px; }
.kpi-name { font-size: 13px; font-weight: 600; color: var(--text-2); }
.kpi-value { font-family: var(--display); font-size: 44px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.kpi.red .kpi-value { color: var(--red); }
.kpi.red .kpi-icon { color: var(--red); }
.kpi.yellow .kpi-icon { color: var(--amber); }
.kpi.blue .kpi-icon, .kpi.green .kpi-icon { color: var(--text-2); }
.kpi.is-zero .kpi-value { color: var(--faint); }

/* ================= Tables ================= */
.table-wrap { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; padding: 10px 14px; white-space: nowrap; border-bottom: 1px solid var(--line); background: transparent; }
td { font-size: 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; transition: background-color .12s; }
tr.clickable:hover td { background: var(--hover); }
tr.clickable:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
td.chev { width: 32px; color: var(--faint); padding-right: 14px; }
tr.clickable:hover td.chev { color: var(--text); }
.inset-table th:first-child, .inset-table td:first-child { padding-left: 20px; }
.inset-table th:last-child, .inset-table td:last-child { padding-right: 20px; }
.empty { padding: 32px 20px; color: var(--muted); text-align: center; }
tr.total-row td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line-strong); }
td.money, th.money { text-align: right; }

/* ================= Badges, plates, tags ================= */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge.ok { background: var(--ok-wash); color: var(--ok); }
.badge.warn { background: var(--amber-wash); color: var(--amber); }
.badge.bad { background: var(--red-wash); color: var(--red); }
.badge.idle { background: var(--surface-3); color: var(--muted); }
.reg { display: inline-block; background: var(--plate-bg); color: var(--plate-text); border: 1.5px solid var(--plate-line); border-radius: 5px; padding: 2px 7px; font-weight: 800; font-size: 12px; letter-spacing: .03em; white-space: nowrap; line-height: 1.3; font-variant-numeric: tabular-nums; }
.reg.lg { font-size: 22px; padding: 4px 14px; border-width: 2px; border-radius: 8px; }
.tag { background: var(--surface-3); color: var(--text-2); border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.tagrow { display: flex; gap: 6px; flex-wrap: wrap; }
.q { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--line-strong); font-size: 10px; font-weight: 800; margin-left: 4px; vertical-align: 1px; cursor: help; }
.phase { display: inline-block; background: var(--text); color: var(--bg); font-weight: 700; font-size: 11.5px; border-radius: 999px; padding: 2px 9px; }

/* ================= Forms ================= */
.search { min-height: 38px; border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; background: var(--surface); font-size: 13.5px; min-width: 0; max-width: 100%; color: var(--text); }
input.search { width: 240px; }
.search:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px var(--green-wash); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.field input, .field select, .field textarea { min-height: 42px; border: 1px solid var(--line-strong); border-radius: var(--r); padding: 9px 12px; font-weight: 400; font-size: 15px; background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--muted); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px var(--green-wash); }
.field input[type=file] { padding: 8px; background: var(--surface-2); }
.field input[type=color] { padding: 4px; width: 80px; }
.field small { font-weight: 400; }
.form-error { color: var(--red); background: var(--red-wash); padding: 10px 12px; border-radius: var(--r); margin: 0; font-size: 13.5px; }
.form-note { background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); border-radius: var(--r); padding: 10px 12px; font-size: 13.5px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; font-size: 14px; min-height: 40px; }
.check input { width: 18px; height: 18px; accent-color: var(--green); flex: none; }
fieldset.ticks { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 6px 16px 8px; margin: 0; }
fieldset.ticks legend { font-weight: 700; font-size: 13px; padding: 0 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ================= Modal, toast, login ================= */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; padding: 16px; z-index: 1000; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); color: var(--text); border-radius: 16px; width: min(540px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow-pop); border: 1px solid var(--line); animation: rise .18s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 18px 22px 14px; position: sticky; top: 0; background: var(--surface); z-index: 1; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-family: var(--display); font-size: 19px; }
.modal-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 22px 20px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 16px); background: var(--text); color: var(--bg); padding: 11px 18px 11px 14px; border-radius: 999px; font-weight: 600; font-size: 13.5px; opacity: 0; transition: .22s var(--ease); z-index: 1100; box-shadow: var(--shadow-pop); display: flex; gap: 10px; align-items: center; }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px 16px 96px; background: #000; position: relative; }
.login::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: var(--green); }
.login-card { background: #fff; color: #000; border-radius: 18px; padding: 34px; width: min(400px, 100%); display: flex; flex-direction: column; gap: 16px; }
.login-card .brand img { height: 50px; display: block; }
.login-card .brand { padding: 4px 0 10px; }
.login-card h1 { font-size: 24px; }
.login-card .field input { background: #fff; color: #000; border-color: #CFCFCA; }
.login-card .btn { border-color: #CFCFCA; background: #fff; color: #000; }
.login-card .btn.cta { background: #000; border-color: #000; color: #fff; }
.foot-note { margin: 0; font-size: 12.5px; color: #6B6B6B; }

/* ================= Banners, lists, feeds ================= */
.banner { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: var(--r); padding: 12px 16px; font-size: 13.5px; color: var(--text-2); }
.banner .lead { display: flex; gap: 12px; align-items: flex-start; flex: 1 1 420px; }
.banner .lead .ico { color: var(--text); margin-top: 1px; }
.banner.danger { border-left-color: var(--red); background: var(--red-wash); color: var(--text); }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.list-row:last-child { border-bottom: none; }
.list-row a { color: var(--text); text-decoration: none; display: inline-flex; gap: 10px; align-items: baseline; min-width: 0; }
.list-row a:hover { text-decoration: underline; text-decoration-color: var(--green); }
.list-row .reg { flex: none; }
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 12px 0 12px 18px; border-left: 2px solid var(--line); position: relative; }
.feed-item::before { content: ''; position: absolute; left: -6px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.feed-item:first-child::before { background: var(--green); border-color: var(--green); }
.feed-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.feed-title { font-weight: 600; font-size: 14px; }
.feed-msg { font-size: 13px; color: var(--muted); }
.review { display: flex; gap: 16px; align-items: center; justify-content: space-between; }
.review .illus { flex: none; color: var(--text); }
.review.done { border-color: color-mix(in srgb, var(--green) 60%, var(--line)); }
.upcoming a { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: 14px; }
.upcoming a:last-child { border-bottom: none; }
.upcoming a:hover { color: var(--text); }
.upcoming a:hover .num { background: var(--green); color: #000; }
.upcoming a .ico:first-child { display: none; }
.upcoming .num { display: inline-grid; place-items: center; min-width: 38px; height: 30px; border-radius: 8px; background: var(--surface-3); font-family: var(--display); font-weight: 700; font-size: 15px; transition: background-color .15s; }
.upcoming a .ico:last-child { margin-left: auto; color: var(--faint); }
.tiles { display: none; }
.show-m { display: none; }
.task-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: none; }
.task-title { font-weight: 600; font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.task-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ================= Tabs ================= */
.tabs { display: flex; gap: 22px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab { text-decoration: none; color: var(--muted); font-weight: 600; padding: 10px 0 11px; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.on { color: var(--text); border-bottom-color: var(--green); }

/* ================= Defect tracker ================= */
.tracker { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.tracker li { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 16px; font-size: 12.5px; color: var(--muted); border-left: 1px solid var(--line); }
.tracker li:first-child { border-left: none; }
.tracker .dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surface-3); color: var(--muted); font-size: 11.5px; }
.tracker li.done { color: var(--text-2); } .tracker li.done .dot { background: var(--green); color: #000; }
.tracker li.current { color: var(--text); font-weight: 700; background: var(--surface-2); box-shadow: inset 0 -3px 0 var(--green); }
.tracker li.current .dot { background: var(--text); color: var(--bg); }
.tracker li.skipped { opacity: .45; }

/* ================= Media ================= */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.thumb { margin: 0; }
.thumb-btn { display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; cursor: zoom-in; background: var(--surface-3); aspect-ratio: 4/3; }
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s var(--ease); }
.thumb-btn:hover img { transform: scale(1.03); }
.thumb figcaption { font-size: 12px; margin-top: 6px; color: var(--text-2); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.stage { font-weight: 700; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); }
.stage-found { background: var(--red-wash); color: var(--red); } .stage-repair { background: var(--amber-wash); color: var(--amber); } .stage-repaired { background: var(--ok-wash); color: var(--ok); }
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.doc-list li:last-child { border-bottom: none; }
.doc-list a { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; text-decoration: none; }
.doc-list a:hover { text-decoration: underline; text-decoration-color: var(--green); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 1200; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); border-radius: 8px; }
.lightbox p { color: #fff; margin: 10px 0 0; }
.lb-close { position: absolute; top: 12px; right: 12px; color: #fff; background: rgba(255,255,255,.15); }

/* ================= 52-week grids ================= */
.grid-wrap { overflow: auto; max-height: calc(100vh - 260px); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
table.grid { border-collapse: separate; border-spacing: 0; width: max-content; }
table.grid th, table.grid td { padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; font-size: 11px; white-space: nowrap; }
table.grid thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; color: var(--muted); padding: 6px 0; min-width: 32px; font-weight: 600; }
table.grid thead tr.wks th { top: 27px; }
table.grid .lab { position: sticky; left: 0; background: var(--surface); z-index: 1; text-align: left; padding: 6px 14px; min-width: 200px; font-size: 13px; font-weight: 700; color: var(--text); }
table.grid thead .lab { z-index: 3; background: var(--surface-2); }
table.grid .lab a { color: var(--text); text-decoration: none; } table.grid .lab a:hover { text-decoration: underline; text-decoration-color: var(--green); }
table.grid .lab small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
table.grid tr.sep th, table.grid tr.sep td { background: var(--surface-2); font-weight: 700; font-size: 12px; text-align: left; padding: 7px 14px; color: var(--text-2); }
table.grid td.cell { height: 38px; min-width: 32px; vertical-align: middle; }
table.grid td.now, table.grid th.now { background: var(--green-wash); }
table.grid th.now { color: var(--text); }
.code { position: relative; display: inline-grid; place-items: center; min-width: 22px; height: 21px; padding: 0 3px; border-radius: 5px; font-weight: 800; font-size: 11px; color: #000; margin: 1px; border: none; cursor: pointer; font-family: var(--font); transition: transform .1s; }
.code:hover { transform: translateY(-1px); }
.code.done { box-shadow: inset 0 0 0 2px rgba(0,0,0,.55); }
.code.proj { background: transparent !important; border: 1.5px dashed var(--faint); color: var(--muted); }
.code.over { outline: 2px solid var(--red); outline-offset: 1px; }
.code.booked { box-shadow: inset 0 -3px 0 #000; }
.code.unconf::after { content: '?'; position: absolute; top: -6px; right: -5px; width: 12px; height: 12px; border-radius: 50%; background: var(--text); color: var(--bg); font-size: 8.5px; line-height: 12px; text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; align-items: center; color: var(--text-2); }
.legend .code { cursor: default; }
.cell-add { width: 100%; height: 36px; border: none; background: transparent; cursor: pointer; }
.cell-add:hover { background: var(--hover); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* ================= Records ================= */
.veh-head { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 28px; margin: 0; }
.spec-grid div { border-bottom: 1px solid var(--line); padding: 9px 0; font-size: 14px; }
.spec-grid dt { font-size: 12px; color: var(--muted); font-weight: 500; } .spec-grid dd { margin: 3px 0 0; font-weight: 500; }
.checklist { list-style: none; margin: 0; padding: 0; columns: 2 260px; }
.checklist li { break-inside: avoid; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.contact-card { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; background: var(--surface); }
.contact-card a { font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.placeholder { border: 1px dashed var(--line-strong); border-radius: var(--r-lg); padding: 22px; background: var(--surface); color: var(--text-2); }

/* ================= Reports ================= */
.hbar { display: grid; grid-template-columns: minmax(100px, 180px) minmax(40px, 1fr) auto; align-items: center; gap: 14px; font-size: 13.5px; padding: 6px 0; }
.hbar .track { height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 999px; background: var(--text); }
.hbar:first-child .track i { background: var(--green); }
.mail-preview { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.print-only { display: none; }

/* ================= Phone check forms ================= */
.check-form { max-width: 760px; }
.ck-list { display: flex; flex-direction: column; }
.ck-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; flex-wrap: wrap; }
.ck-list .ck-row:last-child { border-bottom: none; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px; gap: 2px; background: var(--surface-2); flex-wrap: wrap; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--text-2); transition: background-color .12s, color .12s; }
.seg label:hover span { background: var(--hover); }
.seg input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 1px; }
.seg input:checked + span { background: var(--text); color: var(--bg); }
.seg label.ok input:checked + span { background: var(--green); color: #000; }
.seg label.bad input:checked + span { background: var(--red); color: #fff; }
.ck-count { max-width: 160px; }
.tyre-grid { display: flex; flex-direction: column; gap: 10px; }
.tg-head, .tg-row { display: grid; grid-template-columns: 1fr 64px 1fr; gap: 10px; align-items: center; }
.tg-head span { font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: center; }
.tg-axle { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); border-top: 2px solid var(--line-strong); padding-top: 4px; }
.tg-side { display: flex; gap: 6px; justify-content: center; }
.tg-cell input { width: 64px; height: 48px; text-align: center; font-size: 17px; font-weight: 700; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); }
.tg-cell input:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px var(--green-wash); }
.tg-cell input.low { border-color: var(--red); background: var(--red-wash); color: var(--red); }
.sig-wrap { position: relative; }
canvas.sig { width: 100%; height: 160px; border: 1.5px dashed var(--line-strong); border-radius: var(--r); background: #fff; touch-action: none; display: block; cursor: crosshair; }
.sig-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #9A9A9A; pointer-events: none; font-size: 14px; }
@media (max-width: 900px) { .ck-submit { position: sticky; bottom: 72px; background: var(--bg); padding: 8px 0; } .ck-submit .btn { flex: 1; } .tg-cell input { width: 56px; } }

/* Theme toggle + logo per theme */
.theme-toggle .ico-moon { display: block; } .theme-toggle .ico-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-moon { display: none; } :root[data-theme="dark"] .theme-toggle .ico-sun { display: block; }
.logo-for-dark { display: none !important; }
:root[data-theme="dark"] .logo-for-light { display: none !important; }
:root[data-theme="dark"] .logo-for-dark { display: block !important; }

/* ================= Mobile ================= */
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } .kpi:nth-child(3) { border-left: none; } .kpi:nth-child(n+3) { border-top: 1px solid var(--line); } }
@media (max-width: 900px) {
  .side { position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw); z-index: 60; transform: translateX(-105%); transition: transform .22s var(--ease); }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.5); }
  .topbar { padding: 8px 12px; gap: 4px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .topbar .mob { display: grid; }
  .topbar a.mob { display: flex; justify-content: center; }
  .topbar .mob-logo { height: 34px; }
  .top-search, .user-wrap, .topbar .spacer, .topbar .demo-tag { display: none; }
  .main { padding: 18px 16px 100px; gap: 18px; }
  h1 { font-size: 26px; }
  .page-head { align-items: flex-start; }
  .bnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bnav a, .bnav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; background: none; border: none; cursor: pointer; }
  .bnav .on { color: var(--text); }
  .bnav .on .ico { color: #000; background: var(--green); border-radius: 999px; padding: 3px 12px; box-sizing: content-box; }
  .kpi { padding: 14px 16px 16px; }
  .kpi-value { font-size: 34px; }
  .kpi-name { font-size: 12.5px; }
  .kpi-icon { margin-bottom: 8px; }
  .kpi-sub { display: none; }
  .tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .tile { display: flex; flex-direction: column; justify-content: space-between; gap: 16px; min-height: 82px; padding: 14px 12px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13px; text-align: left; text-decoration: none; cursor: pointer; }
  .tile.dark { background: var(--text); color: var(--bg); border-color: var(--text); }
  .tile.lime { background: var(--green); color: #000; border-color: var(--green); }
  .dash-actions { display: none !important; }
  .task-row { grid-template-columns: 1fr; }
  .actions { justify-content: flex-start; }
  .page-head .row-gap .btn { flex: 1 1 auto; }
  .hide-m { display: none; }
  .show-m { display: block; font-size: 12.5px; margin-top: 2px; }
  .inset-table th, .inset-table td { padding: 10px 6px; font-size: 13px; }
  .inset-table th:first-child, .inset-table td:first-child { padding-left: 14px; }
  .inset-table td:nth-child(2) { white-space: normal; min-width: 0 !important; }
  .inset-table td.chev { width: 20px; padding-right: 10px; }
  .tabs { gap: 16px; overflow-x: auto; flex-wrap: nowrap; }
}
@media (max-width: 520px) { .two { grid-template-columns: 1fr; } .hbar { grid-template-columns: 100px minmax(30px, 1fr) auto; } input.search { width: 100%; } }

@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; }
  .side, .topbar, .bnav, .no-print, .toast, .tabs, button, .modal-backdrop { display: none !important; }
  .print-only { display: block !important; }
  .main { padding: 0; }
  .card { break-inside: avoid; }
  .table-wrap { overflow: visible; }
  td, th { white-space: normal; font-size: 11px; padding: 5px 6px; }
  a { color: #000; text-decoration: none; }
}

/* ================= Phase 3: handovers ================= */
.ico.flip { transform: scaleX(-1); }
.hv-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.dg { display: flex; flex-direction: column; gap: 10px; background: #FFF; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; color: #000; }
.dg-wide { display: grid; grid-template-columns: 1fr; gap: 14px; }
.dg-ends { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 520px; margin: 0 auto; width: 100%; }
.dg-view { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.dg-view figcaption { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #5E5E5E; }
.dg-view svg { width: 100%; height: auto; display: block; }
.dg-svg { cursor: crosshair; touch-action: manipulation; border-radius: 8px; transition: box-shadow .12s; }
.dg-svg:hover { box-shadow: 0 0 0 2px #C1D82F; }
.dg-svg .mk { cursor: pointer; }
.dg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.dg-list li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.dg-list li:last-child { border-bottom: none; }
.dg-num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #FFF; background: #D0281B; }
.dg-list li.old .dg-num { background: #5E5E5E; } .dg-list li.fixed .dg-num { background: #BDBDB8; } .dg-list li.fixed .dg-what { text-decoration: line-through; color: var(--muted); }
.dg-what { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dg-note { width: 100%; max-width: 420px; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; }
.dg-notetext { color: var(--text-2); font-size: 13px; }
.hv-people { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hv-person canvas.sig { height: 140px; }
.hv-declare { margin: 0; font-size: 13.5px; color: var(--text-2); border-left: 3px solid var(--green); padding: 4px 0 4px 12px; }
.sig-img { max-width: 100%; background: #FFF; border-radius: 8px; border: 1px solid var(--line); }
@media (max-width: 760px) { .dg-wide, .hv-people { grid-template-columns: 1fr; } }

/* ================= Phase 3: location log ================= */
.loc { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--bg); color: var(--fg); white-space: nowrap; }
.loc.auto { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--bg); border: 1.5px dashed var(--line-strong); }
.loc.sm { height: 20px; font-size: 11px; }
table.loc-grid th { padding: 6px 8px; } table.loc-grid th small { display: block; font-weight: 500; font-size: 10.5px; }
table.loc-grid td { min-width: 118px; vertical-align: top; }
.loc-cell { width: 100%; min-height: 50px; padding: 6px 7px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; border: none; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
div.loc-cell { cursor: default; }
button.loc-cell:hover { background: var(--hover); box-shadow: inset 0 0 0 1px var(--line-strong); }
.loc-note { font-size: 11px; color: var(--text-2); white-space: normal; line-height: 1.3; max-width: 130px; }
.loc-wrap { max-height: none; }

/* ================= Phase 3: onboarding ================= */
.ob-bar { display: block; height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; flex: 1; min-width: 80px; }
.ob-bar i { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.ob-row { display: flex; align-items: center; gap: 14px; padding: 8px 0; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.ob-row:last-child { border-bottom: none; }
.ob-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ob-list li { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ob-list li:last-child { border-bottom: none; }
.ob-tick { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--muted); }
.ob-list li.done .ob-tick { background: var(--green); color: #000; } .ob-list li.na .ob-tick { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); }
.ob-what { display: flex; flex-direction: column; gap: 3px; min-width: 0; } .ob-what .muted { font-size: 12.5px; } .ob-note { font-size: 13px; color: var(--text-2); }
table.loc-grid .lab { min-width: 132px; }

/* ================= Track-POD walkarounds ================= */
.wk-issue { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.wk-issue:last-child { border-bottom: none; }
.wk-issue.done { opacity: .7; }
.wk-items { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--text-2); padding: 4px 0 8px; white-space: normal; }
.wk-items .bad { color: var(--red); font-weight: 700; }
tr.wk-detail td { background: var(--surface-2); }
@media (max-width: 760px) { .wk-issue { grid-template-columns: 1fr; } }
.wk-photos { margin-top: 8px; } .wk-photos .gallery { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.wk-issue > div:first-child { min-width: 0; }
.narrow .wk-issue { grid-template-columns: 1fr; } .narrow .wk-issue .row-gap { justify-content: flex-start !important; }

/* iPhone zooms in when a form field with text smaller than 16px is tapped, and stays zoomed until you pinch.
   On touch screens every field uses 16px so the page never zooms. */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; }
  .tg-cell input { font-size: 17px !important; }
}

/* Alerts list: header with Clear all, scrolls when long. */
.alerts-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.alerts-pop { max-height: min(70vh, 560px); overflow-y: auto; }
