/* ──────────────────────────────────────────────────────────────────────────
   The design system, lifted from the prototype.

   Two things it is built around. Michaela works on a tablet in an office with
   a window behind her, so contrast is high and nothing important is grey on
   grey. Drivers are on phones in daylight with wet hands, so targets are large
   and never rely on hover.
   ────────────────────────────────────────────────────────────────────────── */
:root{
  --ink:#1B1E22; --ink-soft:#4A5159; --ink-faint:#737C86;
  --canvas:#F7F6F2; --canvas-2:#FBFAF7; --paper:#FFFFFF;
  --line:#E3E0D8; --rail:#1E2B24;
  --green:#176B4D; --green-wash:#E8F2ED;
  --red:#A42A1E;   --red-wash:#F8ECEA;
  --amber:#F0B429; --amber-wash:#FDF6E4;
  --r:12px;
  --safe-t:env(safe-area-inset-top,0px);
  --safe-b:env(safe-area-inset-bottom,0px);
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --ink:#ECEAE4; --ink-soft:#B6BDC4; --ink-faint:#8A939C;
    --canvas:#14171A; --canvas-2:#1A1E22; --paper:#1E2226;
    --line:#2E343A; --green-wash:#15291F; --red-wash:#2A1917; --amber-wash:#2A2415;
  }
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font:16px/1.55 ui-sans-serif,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  color:var(--ink); background:var(--canvas);
  padding-top:var(--safe-t); padding-bottom:var(--safe-b);
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3{margin:0; letter-spacing:-.02em; font-weight:800}
h1{font-size:28px} h2{font-size:21px} h3{font-size:17px}

/* ── the rail ─────────────────────────────────────────────────────────── */
.rail{
  position:fixed; inset:0 auto 0 0; width:224px; background:var(--rail); color:#E7EDE9;
  padding:18px 12px calc(12px + var(--safe-b)); overflow-y:auto; z-index:20;
}
.brand{display:flex; gap:10px; align-items:center; padding:0 8px 18px}
.brand .mark{
  width:34px; height:34px; border-radius:9px; background:var(--amber); color:#2A2415;
  display:grid; place-items:center; font-weight:800; font-size:14px; flex:none;
}
.brand b{display:block; font-size:15px; line-height:1.2}
.brand small{display:block; font-size:11px; opacity:.6}
.navgroup{font-size:11px; text-transform:uppercase; letter-spacing:.08em;
  opacity:.45; padding:16px 10px 6px}
.navitem{
  display:flex; align-items:center; gap:11px; padding:9px 10px; border-radius:9px;
  color:inherit; text-decoration:none; font-size:15px;
}
.navitem:hover{background:rgba(255,255,255,.06)}
.navitem.on{background:var(--paper); color:var(--ink); font-weight:600}
.navitem .ic{width:17px; text-align:center; opacity:.75}
.tally{margin-left:auto; background:var(--amber); color:#2A2415; font-size:12px;
  font-weight:700; padding:1px 7px; border-radius:9px}
.who{border-top:1px solid rgba(255,255,255,.1); margin-top:20px; padding:14px 10px 0}
.who b{display:block; font-size:14px} .who small{opacity:.55; font-size:12px}
.linky{background:none; border:0; color:#9FD3BC; text-decoration:underline;
  cursor:pointer; padding:6px 0; font-size:13px}

/* ── the page ─────────────────────────────────────────────────────────── */
.page{margin-left:224px; min-height:100vh}
.top{padding:26px 30px 18px; border-bottom:1px solid var(--line); background:var(--paper)}
.top p{margin:4px 0 0; color:var(--ink-faint); font-size:15px}
.body{padding:24px 30px 60px; max-width:1180px}

/* ── pieces ───────────────────────────────────────────────────────────── */
.card{background:var(--paper); border:1px solid var(--line); border-radius:var(--r);
  margin-bottom:18px; overflow:hidden}
.card.narrow{max-width:460px}
.card .hd{display:flex; align-items:center; gap:12px; padding:15px 18px;
  border-bottom:1px solid var(--line)}
.card .bd{padding:18px}
.card .bd.tight{padding:0}
.sp{flex:1}
.hint{color:var(--ink-faint); font-size:14px}

.callout{border-radius:var(--r); padding:15px 17px; margin:0 0 16px; font-size:15px;
  background:var(--green-wash); border:1px solid rgba(23,107,77,.18)}
.callout.c-amber{background:var(--amber-wash); border-color:rgba(240,180,41,.3)}
.callout.c-red{background:var(--red-wash); border-color:rgba(164,42,30,.2)}
.ct{font-weight:700; margin-bottom:5px}

.btn{background:var(--green); color:#fff; border:0; border-radius:9px;
  padding:11px 17px; font-size:15px; font-weight:600; cursor:pointer;
  min-height:44px;                      /* a wet thumb on a phone */
  font-family:inherit}
.btn:hover{filter:brightness(1.08)}
.btn.quiet{background:var(--canvas); color:var(--ink); border:1px solid var(--line)}
.btn.small{padding:7px 12px; font-size:14px; min-height:36px}
.btn.full{width:100%}
.btn:disabled{opacity:.45; cursor:not-allowed}

.field{margin-bottom:14px}
.field label{display:block; font-size:14px; font-weight:600; margin-bottom:6px}
.in{width:100%; padding:11px 13px; border:1px solid var(--line); border-radius:9px;
  font-size:16px;                        /* 16px or iOS zooms on focus */
  font-family:inherit; background:var(--paper); color:var(--ink)}
.in:focus{outline:2px solid var(--green); outline-offset:1px}
label.tick{display:flex; gap:10px; align-items:flex-start; font-size:15px;
  cursor:pointer; margin:12px 0}

table{width:100%; border-collapse:collapse; font-size:15px}
th{text-align:left; font-size:12px; text-transform:uppercase; letter-spacing:.06em;
  color:var(--ink-faint); padding:11px 18px; border-bottom:1px solid var(--line)}
td{padding:13px 18px; border-bottom:1px solid var(--line); vertical-align:top}
tr:last-child td{border-bottom:0}
.right{text-align:right} .num{font-variant-numeric:tabular-nums}
.second{color:var(--ink-faint); font-size:13px; margin-top:2px}

.tag{display:inline-block; font-size:12px; font-weight:600; padding:2px 9px;
  border-radius:20px; background:var(--canvas); border:1px solid var(--line)}
.tag.t-ok{background:var(--green-wash); color:var(--green); border-color:transparent}
.tag.t-bad{background:var(--red-wash); color:var(--red); border-color:transparent}
.tag.t-wait{background:var(--amber-wash); color:#8A6400; border-color:transparent}

.dropzone{border:2px dashed var(--line); border-radius:var(--r); padding:26px;
  display:flex; align-items:center; gap:18px; cursor:pointer; background:var(--canvas-2)}
.dropzone:hover{border-color:var(--green); background:var(--green-wash)}
.dzi{width:46px; height:46px; border-radius:12px; background:var(--green); color:#fff;
  display:grid; place-items:center; font-size:20px; flex:none}

/* ── signing in ───────────────────────────────────────────────────────── */
.centred{display:grid; place-items:center; min-height:100vh; padding:20px}
.signin{width:100%; max-width:380px}
.signin form{background:var(--paper); border:1px solid var(--line);
  border-radius:var(--r); padding:22px; margin-top:16px}
.brand.big{justify-content:center}
.brand.big .mark{width:42px; height:42px; font-size:16px}

/* ── phones and tablets ───────────────────────────────────────────────── */
@media (max-width:860px){
  .rail{
    position:static; width:auto; inset:auto; display:flex; gap:6px;
    overflow-x:auto; padding:10px 12px; align-items:center;
  }
  .rail .navgroup,.rail .who small{display:none}
  .navitem{flex:none; padding:8px 12px}
  .who{border:0; margin:0 0 0 auto; padding:0; display:flex; gap:10px; align-items:center}
  .page{margin-left:0}
  .top{padding:18px 16px 14px}
  .body{padding:16px 16px 48px}
  h1{font-size:23px}
  td,th{padding:11px 14px}
}

/* A section from a later rollout stage: shown so you know it exists, dimmed so
   it is plainly not on yet. Clicking it goes to Rollout, where it is turned on.
   Hiding these outright is what made people think half the system was missing. */
.navitem.locked { opacity: .42; }
.navitem.locked:hover { opacity: .72; }
.navitem .lockmark { margin-left: auto; font-size: 11px; opacity: .8; }

/* The question mark beside each section. It sits outside the link so clicking
   it explains rather than navigates, and it stays faint until looked at so it
   does not compete with the section names. */
.navrow { display: flex; align-items: center; }
.navrow > .navitem { flex: 1 1 auto; min-width: 0; }
.qmark {
  flex: 0 0 auto; margin-right: 10px; width: 17px; height: 17px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid currentColor; border-radius: 50%;
  font-size: 10px; line-height: 1; opacity: .3; cursor: help;
  user-select: none;
}
.qmark:hover, .qmark:focus { opacity: .85; outline: none; }

/* The explanation that opens under a section when its question mark is
   clicked. Inside the sidebar rather than floating over the page, so it cannot
   end up off-screen on a phone. */
.qmark {
  flex: 0 0 auto; margin-right: 10px; width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid currentColor; border-radius: 50%; background: none;
  color: inherit; font: inherit; font-size: 10px; line-height: 1;
  opacity: .35; cursor: pointer; padding: 0;
}
.qmark:hover, .qmark:focus-visible { opacity: .9; }
.qmark[aria-expanded="true"] { opacity: 1; background: rgba(255,255,255,.14); }
.helpnote {
  margin: 0 12px 8px 42px; padding: 9px 11px;
  background: rgba(255,255,255,.07); border-left: 2px solid rgba(255,255,255,.3);
  border-radius: 0 5px 5px 0; font-size: 12.5px; line-height: 1.5;
  color: rgba(255,255,255,.82);
}
.helpnote em { color: rgba(255,255,255,.6); font-style: normal; }

/*
 | Form fields, whether or not somebody remembered the class.
 |
 | There was a .in class doing this properly and 81 of the 142 fields in the
 | application did not carry it — including every field on the setup screens,
 | which are the first thing anybody sees. Those fell back to the browser's
 | default: raw white boxes sitting under carefully written prose.
 |
 | Styling the element rather than the class means a field is right by default
 | and nobody has to remember. The .in class still works and still wins where
 | it is used.
 */
form input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):not([type=file]),
form select,
form textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 16px;                   /* 16px, or iOS zooms the page on focus */
  font-family: inherit;
  background: var(--paper);
  color: var(--ink);
  margin-bottom: 4px;
  box-sizing: border-box;
}

form input:focus, form select:focus, form textarea:focus {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

form input::placeholder, form textarea::placeholder { color: var(--ink-faint); }

form input:disabled, form select:disabled, form textarea:disabled {
  background: var(--line); opacity: .7; cursor: not-allowed;
}

/* A label needs air above it when it follows another field, or the form reads
   as one undifferentiated column. */
form label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 6px;
  color: var(--ink);
}
form > label:first-of-type, form .bd > label:first-of-type { margin-top: 0; }

/* A tickbox is not a text field and must not be stretched across the row. */
form label.tick, form label:has(> input[type=checkbox]), form label:has(> input[type=radio]) {
  display: flex; align-items: center; gap: 10px;
  font-weight: 500; cursor: pointer;
}
form label.tick input, form label input[type=checkbox], form label input[type=radio] {
  width: auto; margin: 0; flex: 0 0 auto;
}

/* The explanation under a field belongs with the field, not floating between
   two of them. */
form .hint { margin: 2px 0 0; font-size: 13px; color: var(--ink-faint); line-height: 1.45; }

/* Select needs its own arrow back once the border is restyled. */
form select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-faint) 50%),
                    linear-gradient(135deg, var(--ink-faint) 50%, transparent 50%);
  background-position: calc(100% - 18px) 54%, calc(100% - 13px) 54%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

/* A field inside a table is a column of figures, not a form row. Full width is
   right, but the generous padding is not — four price columns at 13px padding
   each will not fit a phone. */
form td input, form td select {
  padding: 8px 9px;
  font-size: 15px;
  margin-bottom: 0;
  min-width: 72px;
}

/* A short field that is obviously short — a postcode, a VAT number, a number of
   days — reads better than one stretched across the page. */
form input[type=number] { max-width: 220px; }
form td input[type=number] { max-width: none; }
form input[name=postcode], form input[name=site_postcode],
form input[name$=_postcode] { max-width: 180px; }
