/* Navy & safety orange. Orange is reserved for highlights (brand mark, active menu item, key calls to action). */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #0f1b2d;
  --muted: #5a6a80;
  --line: #e2e7ee;
  --border-strong: #cfd7e3;   /* inputs, hover outlines */
  --brand: #14284b;        /* navy – primary buttons */
  --brand-2: #1f3d70;      /* navy hover */
  --link: #1f4fa3;
  --accent: #e8661c;       /* safety orange */
  --accent-2: #cf5612;
  --accent-strong: #c2410c;  /* orange behind white text (5:1 contrast) */
  --accent-strong-2: #a8370a;
  --side: #0d1b33;         /* sidebar */
  --side-text: #a9b6ca;
  --ok: #157347;      --ok-bg: #e2f4ea;
  --warn: #9a5b00;    --warn-bg: #fff1dc;
  --bad: #b42318;     --bad-bg: #fde7e5;
  --info: #1f4fa3;    --info-bg: #e5edfa;
  --grey-bg: #edf0f4;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a111e; --surface: #111a2b; --surface-2: #16213a; --text: #e6ecf5; --muted: #93a1b8; --line: #22304a; --border-strong: #31415f;
    --brand: #3f6fcf; --brand-2: #5a86e0; --link: #8fb2f2; --accent: #f27c38; --accent-2: #f5925a;
    --side: #070e1b; --side-text: #9aa8bf;
    --ok: #5fd39a; --ok-bg: #12301f; --warn: #f5b95a; --warn-bg: #3a2a10; --bad: #ff8a80; --bad-bg: #3d1916;
    --info: #8fb2f2; --info-bg: #15264a; --grey-bg: #1d2840;
    --shadow: none; --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 14.5px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  background: var(--bg); color: var(--text);
  display: grid; grid-template-columns: 240px 1fr; min-height: 100vh;
}
a { color: var(--link); }
h1 { font-size: 1.6rem; font-weight: 700; margin: 0; letter-spacing: -.02em; line-height: 1.25; }
h2 { font-size: 1rem; font-weight: 650; margin: 0 0 .75rem; letter-spacing: -.005em; }
h3 { font-size: .78rem; font-weight: 650; margin: 1.2rem 0 .5rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* Sidebar */
.sidebar { background: var(--side); color: var(--side-text); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid rgba(255,255,255,.04); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; padding: 2px 10px 22px; }
.brand svg { width: 30px; height: 30px; flex-shrink: 0; }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a { color: var(--side-text); text-decoration: none; padding: 9px 12px; border-radius: 8px; display: flex; align-items: center; gap: 11px; font-weight: 500; position: relative; transition: background .15s, color .15s; }
#nav a svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
#nav a .pill { margin-left: auto; }
#nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
#nav a.active { background: rgba(255,255,255,.09); color: #fff; font-weight: 600; }
#nav a.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
#nav a.active svg { opacity: 1; color: var(--accent); }
.pill { background: var(--accent-strong); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 99px; padding: 1px 7px; line-height: 1.5; }

.sync { font-size: .76rem; color: var(--side-text); padding: 14px 12px 0; margin-top: auto; }
.sync::before { content: "● "; }
.sync.s-saving::before { color: var(--accent); } .sync.s-saved::before { color: #5fd39a; } .sync.s-error { color: #ffb4ab; } .sync.s-error::before { color: #ff8a80; }
body.auth-mode { grid-template-columns: 1fr; background: radial-gradient(1200px 600px at 50% -10%, #1f3d70 0%, var(--side) 60%); }
body.auth-mode .sidebar { display: none; }
.auth-box { max-width: 420px; margin: 10vh auto 0; padding: 32px; box-shadow: var(--shadow-lg); border: 0; }
.auth-box h1 { margin: 18px 0 14px; font-size: 1.35rem; }
.brand-lg { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--text); letter-spacing: -.01em; }
.brand-lg svg { width: 34px; height: 34px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-links { font-size: .9rem; margin: 16px 0 0; text-align: center; }
.err { background: var(--bad-bg); color: var(--bad); padding: 8px 12px; border-radius: 8px; font-size: .9rem; }
.code { font: 600 1rem ui-monospace, Consolas, monospace; background: var(--grey-bg); padding: 2px 8px; border-radius: 6px; letter-spacing: .08em; }
main { padding: 32px 40px 64px; max-width: 1240px; width: 100%; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.crumb a { color: var(--muted); }

/* Buttons */
.btn { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--text); min-height: 36px; padding: 7px 14px; border-radius: 8px; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; box-shadow: 0 1px 2px rgba(16, 24, 40, .05); transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 30%, transparent); outline-offset: 1px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.accent { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn.accent:hover { background: var(--accent-strong-2); border-color: var(--accent-strong-2); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--grey-bg); }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: .82rem; }
.icon-btn { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); }

/* Cards & grids */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.card + .card { margin-top: 18px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Stat tiles: label on top with a status dot, big number below */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: inherit; box-shadow: var(--shadow); display: flex; flex-direction: column-reverse; gap: 6px; transition: border-color .15s, box-shadow .15s; }
a.stat:hover { border-color: var(--border-strong); box-shadow: 0 4px 12px rgba(16, 24, 40, .08); }
.stat b { display: block; font-size: 1.85rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .8rem; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.stat span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex-shrink: 0; }
.stat.bad span::before { background: var(--bad); } .stat.warn span::before { background: var(--accent); } .stat.ok span::before { background: var(--ok); } .stat.info span::before { background: var(--info); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.empty { color: var(--muted); padding: 10px 0; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.list li > div:first-child { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.list li:first-child { border-top: 0; }
.list .meta { color: var(--muted); font-size: .85rem; }
.list a.title { font-weight: 600; color: var(--text); text-decoration: none; }
.list a.title:hover { text-decoration: underline; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th:first-child { border-top-left-radius: 8px; } thead th:last-child { border-top-right-radius: 8px; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td a { font-weight: 600; color: var(--text); text-decoration: none; }
td a:hover { color: var(--link); text-decoration: underline; }
.num { font-variant-numeric: tabular-nums; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input, .toolbar select { max-width: 320px; }

/* Badges & chips */
.badge { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: .75rem; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.b-ok, .b-pass, .b-safe, .b-completed { background: var(--ok-bg); color: var(--ok); }
.b-soon, .b-advised, .b-booked-late { background: var(--warn-bg); color: var(--warn); }
.b-overdue, .b-unsafe, .b-fail, .b-open { background: var(--bad-bg); color: var(--bad); }
.b-booked { background: var(--info-bg); color: var(--info); }
.b-unknown, .b-na, .b-retired { background: var(--grey-bg); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--grey-bg); border-radius: 6px; padding: 2px 8px; font-size: .82rem; }
.type-tag { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* Detail definition lists */
dl.details { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; margin: 0; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--surface); }
.timeline li.t-fault::before, .timeline li.t-repair::before { background: var(--bad); }
.timeline li.t-install::before { background: var(--accent); }
.timeline li:last-child { border-left-color: transparent; }
.timeline .when { font-size: .85rem; color: var(--muted); }
.timeline p { margin: 4px 0; }

/* Forms */
label.f { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; font-weight: 600; color: var(--text); }
input, select, textarea { font: inherit; font-size: .92rem; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 11px; width: 100%; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: #9aa6b8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 18%, transparent); }
textarea { min-height: 70px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.checks label { display: flex; gap: 8px; align-items: center; font-size: .9rem; }
.checks input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0; }
legend { font-weight: 650; font-size: .9rem; padding: 0 6px; }
.chk { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.chk:first-of-type { border-top: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.seg label { cursor: pointer; position: relative; }
.seg input { position: absolute; opacity: 0; width: 1px; }
.seg span { display: block; padding: 4px 10px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.seg label + label span { border-left: 1px solid var(--line); }
.seg input[value="pass"]:checked + span { background: var(--ok-bg); color: var(--ok); }
.seg input[value="fail"]:checked + span { background: var(--bad-bg); color: var(--bad); }
.seg input[value="na"]:checked + span { background: var(--grey-bg); color: var(--text); }
.seg input:focus-visible + span { outline: 2px solid var(--brand-2); }
.hint { font-size: .82rem; color: var(--muted); font-weight: 400; }

/* Dialog */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(13, 27, 51, .28); }
dialog.wide { width: min(860px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(13, 27, 51, .5); backdrop-filter: blur(2px); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
dialog header, dialog footer { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line); }
dialog footer { background: var(--surface-2); border-radius: 0 0 14px 14px; }
dialog footer { border-bottom: 0; border-top: 1px solid var(--line); justify-content: flex-end; gap: 8px; }
dialog h2 { margin: 0; }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(90px); background: var(--side); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 500; font-size: .9rem; box-shadow: var(--shadow-lg); border-left: 3px solid var(--accent); transition: transform .25s; z-index: 50; pointer-events: none; }
#toast.show { transform: translateX(-50%) translateY(0); }

.hero { text-align: center; padding: 64px 20px; }
.hero h1 { font-size: 2.1rem; }
.hero p { color: var(--muted); max-width: 560px; margin: 12px auto 28px; font-size: 1.02rem; }
.hero .actions { justify-content: center; }
.note { background: var(--info-bg); color: var(--info); border: 1px solid color-mix(in srgb, var(--info) 18%, transparent); border-radius: 10px; padding: 11px 14px; font-size: .88rem; margin-bottom: 16px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

/* Printable report – fixed light colours so it prints the same in dark mode */
.report { background: #fff; color: #0f1b2d; max-width: 850px; margin: 0 auto; padding: 40px 44px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.report .r-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 3px solid var(--r-brand, #14284b); padding-bottom: 16px; margin-bottom: 20px; position: relative; }
.report .r-head::after { content: ""; position: absolute; left: 0; bottom: -3px; width: 72px; height: 3px; background: var(--r-accent, #e8661c); }
.report .r-head h1 { color: var(--r-brand-text, #14284b); }
.report .r-logo { display: block; max-width: 240px; max-height: 80px; object-fit: contain; margin-bottom: 12px; }
.report .r-foot { margin-top: 30px; padding-top: 12px; border-top: 2px solid var(--r-brand, #14284b); text-align: center; font-size: .78rem; color: #5a6a80; line-height: 1.6; }
.report .r-foot p { margin: 0 0 6px; color: #0f1b2d; }
.report .r-accred { font-weight: 600; color: var(--r-brand-text, #14284b); margin-bottom: 4px; }
.brand-logo { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 10px 0 6px; }
.brand-logo-box { width: 220px; height: 84px; border: 1px dashed var(--border-strong); border-radius: 10px; display: grid; place-items: center; background: #fff; padding: 8px; }
.brand-logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-logo-box span { color: #5a6a80; font-size: .85rem; }
.color-pick { display: flex; align-items: center; gap: 10px; }
.color-pick input[type=color] { width: 52px; height: 38px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); cursor: pointer; }
.brand-preview { margin: 18px 0 4px; max-width: none; padding: 24px 26px; box-shadow: none; }
.report .r-co { text-align: right; font-size: .85rem; color: #5a6a80; }
.report .r-co strong { color: #0f1b2d; font-size: 1rem; }
.report h2 { color: var(--r-brand-text, #14284b); border-bottom: 1px solid #e2e7ee; padding-bottom: 5px; margin-top: 26px; }
.report h3 { color: #5a6a80; }
.report th, .report td { border-color: #e2e7ee; padding: 7px 9px; font-size: .88rem; }
.report th { color: #5a6a80; background: #f7f9fc; }
.report .verdict { padding: 12px 14px; border-radius: 8px; font-weight: 700; margin-top: 10px; }
.report .sig { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 40px; }
.report .sig div { border-top: 1px solid #0f1b2d; padding-top: 6px; font-size: .85rem; color: #5a6a80; }
.report .small, .report .hint { font-size: .8rem; color: #5a6a80; }
.report .b-ok, .report .b-pass, .report .b-safe, .report .b-completed { background: #e2f4ea; color: #157347; }
.report .b-fail, .report .b-unsafe, .report .b-overdue, .report .b-open { background: #fde7e5; color: #b42318; }
.report .b-advised, .report .b-soon { background: #fff1dc; color: #9a5b00; }
.report .b-na, .report .b-unknown { background: #edf0f4; color: #5a6a80; }
.report .b-booked { background: #e5edfa; color: #1f4fa3; }

.risk-row { display: grid; grid-template-columns: 2fr 1fr; gap: 10px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.risk-row .full { grid-column: 1 / -1; }
.risk-row > .btn { justify-self: start; }
.risk-nums { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 90px)); gap: 10px; }
.report .risk-table td { font-size: .84rem; }
.report .risk-table td:first-child { font-weight: 600; width: 22%; }
.report .signoff td { height: 34px; border: 1px solid #cdd5e0; }
.report ol, .report ul { padding-left: 22px; margin: 6px 0; }
.report li { margin-bottom: 4px; }

.f-label { font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.photo-item { position: relative; display: flex; flex-direction: column; gap: 4px; }
.photo-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--grey-bg); }
.photo-item input { padding: 4px 8px; font-size: .82rem; }
.photo-del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.photo-busy { aspect-ratio: 4 / 3; align-items: center; justify-content: center; border: 2px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: .85rem; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.thumbs img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--grey-bg); }
.report-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.report-photos figure { margin: 0; break-inside: avoid; }
.report-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; border: 1px solid #e2e7ee; }
.report-photos figcaption { font-size: .82rem; color: #5a6a80; margin-top: 4px; }

@media (max-width: 860px) {
  .report table.kv, .report table.kv tbody, .report table.kv tr { display: block; }
  .report table.kv th, .report table.kv td { display: block; border: 0; padding: 2px 0; }
  .report table.kv th { padding-top: 8px; }
  .report table.kv tr { border-bottom: 1px solid #e2e7ee; padding-bottom: 6px; }
  .risk-row { grid-template-columns: 1fr; }
  .risk-nums { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .sidebar, #nav { min-width: 0; }
  .page-head p { overflow-wrap: anywhere; }
  .sidebar { position: sticky; top: 0; z-index: 10; height: auto; padding: 8px 10px; display: flex; flex-direction: row; align-items: center; gap: 8px; }
  #nav a.active::before { left: 10px; right: 10px; top: auto; bottom: 0; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .sync { display: none; }
  main { padding: 20px 16px 60px; }
  .brand { padding: 4px; } .brand span { display: none; }
  #nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  #nav a { white-space: nowrap; padding: 7px 10px; font-size: .9rem; gap: 6px; }
  main { padding: 18px 16px 60px; }
  .g2, .g3, .form-grid { grid-template-columns: 1fr; }
  dl.details { grid-template-columns: 120px 1fr; }
  .report { padding: 20px 16px; }
  .report .r-head { flex-direction: column; } .report .r-co { text-align: left; }
  .hide-sm { display: none; }
}
@media print {
  body { display: block; background: #fff; }
  .sidebar, .no-print, #toast { display: none !important; }
  main { padding: 0; max-width: none; }
  .report { border: 0; padding: 0; max-width: none; }
  .report h2 { break-after: avoid; }
  .report-photos { grid-template-columns: repeat(2, 1fr); }
  tr { break-inside: avoid; }
  .report .badge, .report .verdict { -webkit-print-color-adjust: exact; print-color-adjust: exact; }   /* keep green/red results in the PDF */
}

/* Sites & visits */
.site-group + .site-group { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.site-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 2px; }
.site-head .meta { color: var(--muted); font-size: .82rem; }
.visit-gates { display: grid; gap: 6px; margin-top: 4px; }
.visit-gates label { display: flex; gap: 8px; align-items: center; font-size: .9rem; font-weight: 500; }
.visit-gates input { width: auto; }
.visit-tag { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--info); background: var(--info-bg); border-radius: 5px; padding: 1px 6px; margin-left: 4px; }
.visit-list { list-style: none; padding: 0; margin: 10px 0 0; border-top: 1px solid var(--line); }
.visit-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.report .gate-section { margin-top: 26px; padding-top: 6px; border-top: 2px solid var(--r-brand, #14284b); break-inside: avoid-page; }

/* Import */
.import-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.import-option { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface-2); display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.import-option h3 { margin: 0 0 2px; color: var(--text); text-transform: none; letter-spacing: 0; font-size: .95rem; }
.import-option .hint { margin: 0 0 8px; }
details summary { cursor: pointer; }
details ul { margin: 6px 0 0; padding-left: 20px; }
.map-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.import-table { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.import-table td { font-size: .86rem; }
@media (max-width: 860px) { .import-options, .map-grid { grid-template-columns: 1fr; } }

/* Guided tour */
#tourShade { position: fixed; inset: 0; z-index: 900; background: transparent; }
#tourShade.dim { background: rgba(13, 27, 51, .55); }
#tourSpot { position: fixed; z-index: 901; border-radius: 10px; pointer-events: none; box-shadow: 0 0 0 4px var(--accent), 0 0 0 9999px rgba(13, 27, 51, .55); transition: left .25s, top .25s, width .25s, height .25s; }
#tourPop { position: fixed; z-index: 902; width: min(360px, calc(100vw - 24px)); background: var(--surface); color: var(--text); border-radius: 14px; padding: 18px 18px 14px; box-shadow: var(--shadow-lg); border-top: 4px solid var(--accent); }
#tourPop.centered { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 24px)); }
#tourPop.sheet { left: 12px !important; right: 12px; bottom: 12px; top: auto !important; width: auto; }
#tourPop h2 { font-size: 1.1rem; margin: 6px 0 6px; }
#tourPop p { margin: 0 0 12px; color: var(--muted); font-size: .92rem; line-height: 1.55; }
.tour-progress { display: flex; justify-content: space-between; align-items: center; font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tour-x { background: none; border: 0; font-size: 1.4rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 2px; }
.tour-dots { display: flex; gap: 5px; margin-bottom: 12px; flex-wrap: wrap; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.tour-dots i.done { background: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.tour-dots i.on { background: var(--accent); width: 18px; border-radius: 4px; }
.tour-actions { display: flex; gap: 8px; align-items: center; }
.side-help { margin-top: 10px; background: rgba(255,255,255,.06); color: var(--side-text); border: 1px solid rgba(255,255,255,.08); border-radius: 8px; padding: 8px 12px; font: inherit; font-size: .85rem; font-weight: 500; cursor: pointer; text-align: left; display: flex; align-items: center; gap: 9px; }
.side-help:hover { color: #fff; background: rgba(255,255,255,.1); }
.side-help b { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--accent-strong); color: #fff; font-size: .72rem; }

/* Setup checklist */
.setup-card { margin-bottom: 18px; }
.setup-bar { height: 6px; border-radius: 99px; background: var(--grey-bg); overflow: hidden; margin: 2px 0 12px; }
.setup-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.setup-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; }
.setup-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.setup-list .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex-shrink: 0; font-size: .75rem; color: transparent; }
.setup-list li.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.setup-list li.done .lbl { color: var(--muted); text-decoration: line-through; }
.setup-list .lbl { flex: 1; font-weight: 500; }
@media (max-width: 860px) {
  .setup-list { grid-template-columns: 1fr; }
  .side-help { margin: 0 0 0 4px; padding: 6px 10px; white-space: nowrap; }
  .side-help span { display: none; }
}
@media print { #tourShade, #tourSpot, #tourPop, .setup-card { display: none !important; } }

/* Plans & upgrade prompts */
.locked { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 10px; padding: 12px 14px; font-size: .88rem; color: var(--muted); }
.locked > div { flex: 1 1 220px; }
.locked strong { color: var(--text); }
.lock-ico { font-size: 1.1rem; }
.free-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; font-size: .9rem; }
.free-mark { margin: 26px 0 0; padding-top: 10px; border-top: 1px solid #e2e7ee; text-align: center; font-size: .75rem; color: #5a6a80; }
.plans-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.plan-card { position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 18px 18px; background: var(--surface); display: flex; flex-direction: column; }
.plan-card.popular { border: 2px solid var(--accent); }
.plan-card.current { background: var(--surface-2); }
.plan-card.pick { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.plan-flag { position: absolute; top: -11px; left: 18px; background: var(--accent-strong); color: #fff; font-size: .7rem; font-weight: 700; padding: 2px 10px; border-radius: 99px; text-transform: uppercase; letter-spacing: .05em; }
.plan-card h3 { margin: 0; color: var(--text); font-size: 1.05rem; text-transform: none; letter-spacing: 0; }
.plan-price { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 2px; }
.plan-price span { font-size: .8rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.plan-card ul { list-style: none; padding: 0; margin: 12px 0 16px; flex: 1; }
.plan-card li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: .84rem; }
.plan-card li b { font-weight: 600; text-align: right; color: var(--ok); }
.plan-card li b.no { color: var(--muted); font-weight: 400; }
.plan-cta { width: 100%; }
.current-tag { text-align: center; font-weight: 600; color: var(--muted); padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 1000px) { .plans-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .plans-grid { grid-template-columns: 1fr; } }

/* Public home page */
body.landing-mode { display: block; background: var(--surface); }
body.landing-mode .sidebar { display: none; }
body.landing-mode main { padding: 0; max-width: none; }
.l-wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.l-narrow { max-width: 760px; }
.l-top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.l-top-in { display: flex; align-items: center; gap: 24px; height: 66px; }
.l-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.12rem; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.l-logo svg { width: 30px; height: 30px; }
.l-nav { display: flex; gap: 22px; margin-right: auto; }
.l-nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: .92rem; }
.l-nav a:hover { color: var(--text); }
.l-hero { background: radial-gradient(900px 420px at 85% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%), linear-gradient(180deg, var(--surface-2), var(--surface)); padding: 72px 0 64px; }
.l-hero-in { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
.l-kicker { display: inline-block; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-strong); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 4px 10px; border-radius: 99px; margin-bottom: 16px; }
.l-hero h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); line-height: 1.1; letter-spacing: -.03em; margin-bottom: 18px; }
.l-lead { font-size: 1.12rem; color: var(--muted); line-height: 1.6; margin: 0 0 26px; max-width: 560px; }
.l-big { min-height: 46px; padding: 10px 20px; font-size: 1rem; }
.l-small { font-size: .85rem; color: var(--muted); margin-top: 14px; }
.l-mock { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px rgba(13, 27, 51, .14); overflow: hidden; }
.l-mock-bar { display: flex; gap: 6px; padding: 12px 14px; background: var(--side); }
.l-mock-bar i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.25); }
.l-mock-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.l-mock-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
.l-mock-stats div { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column-reverse; gap: 2px; }
.l-mock-stats b { font-size: 1.5rem; letter-spacing: -.02em; }
.l-mock-stats span { font-size: .75rem; color: var(--muted); }
.l-mock-stats .bad b { color: var(--bad); } .l-mock-stats .warn b { color: var(--accent-strong); } .l-mock-stats .ok b { color: var(--ok); }
.l-mock-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: .86rem; font-weight: 500; }
.l-mock-row em { font-style: normal; }
.l-section { padding: 76px 0; }
.l-alt { background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.l-section h2, .l-cta h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); letter-spacing: -.02em; text-align: center; margin: 0 0 12px; }
.l-sub { text-align: center; color: var(--muted); margin: 0 auto 34px; max-width: 620px; }
.l-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 36px; }
.l-feature { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: var(--surface); }
.l-ico { font-size: 1.6rem; margin-bottom: 10px; }
.l-feature h3 { margin: 0 0 6px; color: var(--text); font-size: 1.02rem; text-transform: none; letter-spacing: 0; }
.l-feature p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.55; }
.l-faq { border-bottom: 1px solid var(--line); padding: 16px 4px; }
.l-faq summary { font-weight: 600; font-size: 1rem; }
.l-faq p { color: var(--muted); margin: 10px 0 0; }
.l-cta { background: var(--side); color: #fff; padding: 64px 0; text-align: center; }
.l-cta h2 { color: #fff; margin-bottom: 22px; }
.l-foot { background: var(--side); color: var(--side-text); padding: 56px 0 0; font-size: .9rem; }
.l-foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.2fr; gap: 36px; padding-bottom: 40px; }
.l-foot .l-logo { color: #fff; margin-bottom: 12px; }
.l-foot-brand p { margin: 0 0 18px; max-width: 300px; line-height: 1.6; }
.l-foot-col { display: flex; flex-direction: column; gap: 10px; }
.l-foot-col h4 { margin: 0 0 4px; color: #fff; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.l-foot-col a { color: var(--side-text); text-decoration: none; width: fit-content; transition: color .15s; }
.l-foot-col a:hover { color: #fff; }
.l-foot-col span { color: color-mix(in srgb, var(--side-text) 80%, transparent); }
.l-foot-bottom { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 20px 24px; border-top: 1px solid rgba(255,255,255,.08); font-size: .8rem; color: color-mix(in srgb, var(--side-text) 75%, transparent); }
.l-foot-legal { display: flex; gap: 20px; flex-wrap: wrap; }
.l-foot-legal a { color: inherit; text-decoration: none; }
.l-foot-legal a:hover { color: #fff; text-decoration: underline; }
.l-legal { line-height: 1.7; }
.l-legal h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); letter-spacing: -.02em; margin: 0 0 6px; }
.l-legal h2 { text-align: left; font-size: 1.15rem; letter-spacing: -.01em; margin: 34px 0 8px; }
.l-legal p, .l-legal li { color: var(--text); }
.l-legal ul { padding-left: 22px; margin: 8px 0; }
.l-legal li { margin: 6px 0; }
.l-legal a { color: var(--accent-strong); }
.l-legal mark { background: #fde68a; color: #111; padding: 0 4px; border-radius: 4px; }
.l-legal-date { color: var(--muted); font-size: .88rem; margin: 0 0 22px; }
.l-legal-intro { font-size: 1.05rem; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.l-legal-other { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); }
@media (max-width: 370px) { .l-top .l-logo span { display: none; } }   /* smallest phones: icon only, so the buttons fit */
.auth-legal { font-size: .8rem; color: var(--muted); margin: 4px 0 0; text-align: center; line-height: 1.5; }
@media (max-width: 900px) {
  .l-hero-in { grid-template-columns: 1fr; }
  .l-features { grid-template-columns: 1fr 1fr; }
  .l-nav { display: none; }
  .l-top-in { justify-content: space-between; }
}
@media (max-width: 560px) {
  .l-wrap { padding: 0 16px; }
  .l-features { grid-template-columns: 1fr; }
  .l-hero { padding: 40px 0; }
  .l-section { padding: 52px 0; }
  .l-top .btn { min-height: 34px; padding: 6px 10px; font-size: .85rem; }
  .l-top .actions { gap: 4px; flex-wrap: nowrap; }
  .l-top-in { height: 58px; }
  .l-logo { font-size: 1rem; }
}
.l-cta + .l-foot { border-top: 1px solid rgba(255,255,255,.08); }
@media (max-width: 900px) {
  .l-foot-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .l-foot-brand { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .l-foot { padding-top: 40px; }
  .l-foot-grid { grid-template-columns: 1fr 1fr; gap: 24px 16px; }
  .l-foot-col:last-child { grid-column: 1 / -1; }
  .l-foot-bottom { flex-direction: column; padding: 18px 16px; }
}

/* App coming soon page */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.l-soon { display: inline-block; margin-left: 6px; font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: var(--accent-strong); color: #fff; border-radius: 99px; padding: 1px 6px; vertical-align: 2px; }
.l-notify { display: flex; gap: 8px; max-width: 480px; flex-wrap: wrap; }
.l-notify input { flex: 1 1 220px; min-height: 46px; font-size: 1rem; }
.l-notify .btn { min-height: 46px; padding: 10px 18px; }
.l-notify-done { background: var(--ok-bg); color: var(--ok); border-radius: 10px; padding: 14px 16px; font-weight: 500; max-width: 480px; }
.l-phone { justify-self: center; width: 270px; height: 540px; border-radius: 42px; background: #0d1b33; padding: 12px; box-shadow: 0 30px 70px rgba(13, 27, 51, .28); position: relative; }
.l-phone-notch { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 84px; height: 22px; border-radius: 12px; background: #000; z-index: 1; }
.l-phone-screen { height: 100%; border-radius: 32px; background: var(--bg); padding: 52px 14px 16px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.l-phone-top { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.l-phone-top svg { width: 24px; height: 24px; }
.l-phone-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 3px; font-size: .82rem; }
.l-phone-card em { font-style: normal; align-self: flex-start; }
.l-phone-card b { font-size: .92rem; margin-top: 4px; }
.l-phone-card span { color: var(--muted); }
.l-phone-card i { font-style: normal; margin-top: 8px; text-align: center; background: var(--brand); color: #fff; border-radius: 8px; padding: 7px; font-weight: 600; font-size: .8rem; }
.l-phone-soon { margin-top: auto; text-align: center; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-strong); }
.l-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.l-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.l-step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.l-step h3 { margin: 0 0 8px; color: var(--text); font-size: 1rem; text-transform: none; letter-spacing: 0; }
.l-step ol { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.9; }
@media (max-width: 900px) { .l-four { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) {
  .l-four, .l-steps { grid-template-columns: 1fr; }
  .l-phone { width: 230px; height: 460px; }
  .l-notify .btn { width: 100%; }
}

/* Customer signature */
.sig-block { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--surface-2); }
.sig-pad-wrap { position: relative; background: #fff; border: 1px dashed var(--border-strong); border-radius: 10px; height: 170px; }
.sig-pad { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; border-radius: 10px; }
.sig-here { position: absolute; left: 16px; right: 16px; bottom: 34px; border-bottom: 1px solid #c9d2de; color: #8a97a8; font-size: .75rem; pointer-events: none; padding-bottom: 2px; }
.sig-pad-wrap.signed .sig-here { color: transparent; }
.sig-existing { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #fff; border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
.sig-existing img { height: 70px; max-width: 260px; object-fit: contain; }
.sig-row { display: flex; align-items: flex-end; gap: 10px; margin-top: 10px; }
.sig-row .f { flex: 1; margin: 0; }
.check-inline { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: .9rem; }
.check-inline input { width: auto; }
.report .sig .sig-signed { border-top: 0; padding-top: 0; }
.report .sig .sig-signed img { display: block; height: 64px; max-width: 100%; object-fit: contain; object-position: left bottom; border-bottom: 1px solid #0f1b2d; margin-bottom: 6px; }

/* Manuals */
.manual-search { display: flex; gap: 8px; }
.manual-search input { flex: 1; min-width: 0; }
.chip-link { text-decoration: none; color: var(--text); }
.chip-link:hover { background: var(--info-bg); color: var(--info); }
.link-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }

/* Stock */
td.neg { color: var(--bad); font-weight: 600; }
.qty-btns .btn { min-width: 38px; }
.stock-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px minmax(0, 150px) auto; gap: 6px; align-items: center; margin-bottom: 6px; }

/* Training & lone working */
.warn-note { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.lone-start { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.lone-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; margin-bottom: 16px; background: var(--ok-bg); color: var(--ok); border: 1px solid color-mix(in srgb, currentColor 25%, transparent); position: sticky; top: 8px; z-index: 6; }
.lone-bar .lone-text { flex: 1; min-width: 200px; font-size: .92rem; }
.lone-bar.lone-soon { background: var(--warn-bg); color: var(--warn); }
.lone-bar.lone-overdue, .lone-bar.lone-help { background: var(--bad-bg); color: var(--bad); }
.lone-dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex-shrink: 0; animation: lonePulse 1.6s ease-in-out infinite; }
@keyframes lonePulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .lone-dot { animation: none; } }
.btn.danger-ghost { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.lone-li.lone-overdue, .lone-li.lone-help { background: var(--bad-bg); border-radius: 8px; padding-left: 8px; padding-right: 8px; }

/* Customer portal */
.portal { min-height: 100vh; background: var(--bg); }
.portal-wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.portal-top { background: var(--surface); border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.portal-top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 72px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.portal-brand { color: var(--text); text-decoration: none; font-size: 1.15rem; }
.portal-brand img { max-height: 52px; max-width: 220px; object-fit: contain; display: block; }
.portal-contact { display: flex; gap: 8px; flex-wrap: wrap; }
.portal-hello { margin-bottom: 18px; }
.portal-hello h1 { margin: 0 0 6px; }
.portal-gate { margin-bottom: 14px; }
.portal-history { margin-top: 12px; }
.portal-history summary { cursor: pointer; font-weight: 600; }
.portal-link input { width: 100%; font-family: ui-monospace, monospace; font-size: .82rem; }
.portal-actions { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.portal-foot { text-align: center; color: var(--muted); font-size: .82rem; padding-top: 26px; padding-bottom: 36px; line-height: 1.7; }
.portal-gone { margin-top: 60px; text-align: center; }
@media print { .portal-top, .portal-foot, .lone-bar { display: none !important; } }
@media (max-width: 560px) {
  .stock-row { grid-template-columns: minmax(0, 1fr) 64px; }
  .stock-row select[name=stockLoc] { grid-column: 1; }
  .manual-search { flex-direction: column; }
}

/* Long emails and addresses wrap instead of pushing cards off small screens */
.grid > * { min-width: 0; }
.details dd { overflow-wrap: anywhere; }

/* Lone-working history */
.lone-history { margin-top: 10px; }
.lone-history > summary { cursor: pointer; font-weight: 600; font-size: .92rem; padding: 4px 0; }
.lone-history[open] > summary { margin-bottom: 4px; }
