/* ArborGen customer portal: the customer look (docs/SPEC.md section 10).
   For landowners and contractors, many on a phone, some not at ease with computers: large type (17px body), big
   buttons, one main thing per screen. Phone first: everything here is the 360px layout, and the wider layout is added
   in the min-width blocks. Works with no sideways page scroll.

   Every page links, in this order: Google Fonts (Source Sans 3), this file, then /brand.css LAST. brand.css (copied from
   Nursery Operations, unchanged) owns the ArborGen palette and its light and dark tokens: --bg, --surface, --ink,
   --muted, --line, --accent ... This file only adds the few tokens a customer site needs on top (amber, red, the
   header's green) and uses brand.css's for everything else, so light and dark follow the phone's own setting.

   What a page should use (the classes are listed with examples in README.md):
     layout   .page  .page.narrow  .lead  .stack  .row  .actions  .grid-2
     cards    .card  .card.attention  .card.good  .card.quiet  .card-head  .figure  .figure-label  dl.kv
     tables   table.cards with <td data-label="..."> (a table on a wide screen, stacked cards on a phone);
              table.cards.late stays as cards up to 900px, for a table with many columns
     buttons  .btn  .btn.primary  .btn.quiet  .btn.danger  .btn.small  .btn.block
     chips    .chip  .chip.good  .chip.warn  .chip.bad  .chip.info   (always with words: colour is never the only signal)
     forms    .field (label + input + .hint + .error-text)  .field.invalid  .choice  .code-input
     banners  .banner  .banner.info  .banner.good  .banner.warn  .banner.bad
     other    .muted  .num  .list  .empty  details.fold  .sr-only  .no-print  .print-only  .toast */

:root{
  --warn:#8A5A00; --warn-soft:#FBEFD0; --warn-line:#E5C36B;
  --bad:#B3261E; --bad-soft:#FBE4E2; --bad-line:#E7A5A0;
  --info:#2F5597; --info-soft:#E3EAF6; --info-line:#A9BEE3;
  --hdr:#52692F; --hdr-ink:#ffffff; --hdr-line:#6B8C3B;
  --radius:12px; --radius-s:10px;
  --shadow:0 1px 2px rgba(47,51,55,.08), 0 2px 8px rgba(47,51,55,.05);
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --warn:#E0A52C; --warn-soft:#3D3014; --warn-line:#6B5520;
    --bad:#FF8A80; --bad-soft:#4A1F1C; --bad-line:#7A3530;
    --info:#9DB8E8; --info-soft:#1F2A3F; --info-line:#3A4D73;
    --hdr:#34421F; --hdr-line:#8FB05A;
    --shadow:none;
  }
}
:root[data-theme="dark"]{
  --warn:#E0A52C; --warn-soft:#3D3014; --warn-line:#6B5520;
  --bad:#FF8A80; --bad-soft:#4A1F1C; --bad-line:#7A3530;
  --info:#9DB8E8; --info-soft:#1F2A3F; --info-line:#3A4D73;
  --hdr:#34421F; --hdr-line:#8FB05A;
  --shadow:none;
}

/* ---- base ---- */
*,*::before,*::after{box-sizing:border-box}
html{font-size:106.25%;-webkit-text-size-adjust:100%}            /* 17px when the browser's own size is the usual 16px; a person's larger setting still scales it */
body{margin:0;min-height:100vh;display:flex;flex-direction:column;background:var(--bg);color:var(--ink);
  font-family:var(--ag-body,"Source Sans 3","Segoe UI",system-ui,sans-serif);font-size:1rem;line-height:1.55;overflow-wrap:anywhere}
main{flex:1 0 auto}
h1{font-size:1.7rem;line-height:1.2;margin:0 0 12px;color:var(--ag-heading,var(--ink))}
h2{font-size:1.3rem;line-height:1.25;margin:28px 0 10px}
h3{font-size:1.08rem;margin:20px 0 8px}
p{margin:0 0 14px}
a{color:var(--accent-ink);text-underline-offset:3px}
a:hover{text-decoration-thickness:2px}
img{max-width:100%;height:auto}
[hidden]{display:none !important}
:focus-visible{outline:3px solid var(--focus);outline-offset:2px;border-radius:4px}
strong,b{font-weight:700}

.page{width:100%;max-width:960px;margin:0 auto;padding:20px 16px 48px}
.page.narrow{max-width:560px}
.lead{font-size:1.1rem;color:var(--ink-2)}
.muted{color:var(--muted)}
.num{font-variant-numeric:tabular-nums;white-space:nowrap}
.stack>*+*{margin-top:16px}
.row{display:flex;flex-wrap:wrap;gap:12px;align-items:center}
.grid-2{display:grid;gap:16px;grid-template-columns:1fr}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.print-only{display:none}
.skip-link{position:absolute;left:8px;top:-60px;z-index:50;background:var(--surface);color:var(--ink);padding:10px 14px;border-radius:8px;border:2px solid var(--focus)}
.skip-link:focus{top:8px}

/* ---- header: the green bar with the white logo, then who you are ---- */
.hdr{background:var(--hdr);color:var(--hdr-ink);border-top:3px solid var(--hdr-line)}
.hdr-in{max-width:960px;margin:0 auto;padding:10px 16px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 16px}
.hdr-logo{display:inline-flex;align-items:center;border-radius:6px}
.hdr-logo img{display:block;width:192px;height:40px}
.hdr-logo img.print-only{display:none}                              /* the colour logo, for paper only */
.hdr-menu-btn{min-height:44px;padding:8px 14px;font:inherit;font-weight:600;color:var(--hdr-ink);background:transparent;border:2px solid rgba(255,255,255,.7);border-radius:var(--radius-s);cursor:pointer}
.hdr-menu-btn[aria-expanded="true"]{background:rgba(255,255,255,.1)}   /* 4.88:1 for the white words (25 Nov 2026 review, SCR-68: .16 was 4.27:1) */
.hdr-nav{display:none;flex:1 0 100%;flex-direction:column;gap:2px;padding:6px 0 8px}
.hdr-nav.open{display:flex}
.hdr-nav a,.hdr-nav button{display:block;min-height:48px;padding:11px 12px;font:inherit;font-weight:600;text-align:left;text-decoration:none;color:var(--hdr-ink);background:transparent;border:0;border-radius:8px;cursor:pointer}
/* 25 Nov 2026 review, SCR-68: white on the lighter green fell short of 4.5:1 (the current page 3.92:1, under the mouse
   4.46:1). Both are now .12 (4.67:1); the current page keeps its underline, so it still stands apart. */
.hdr-nav a:hover,.hdr-nav button:hover{background:rgba(255,255,255,.12)}
.hdr-nav a[aria-current="page"]{background:rgba(255,255,255,.12);text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:5px}
.hdr :focus-visible{outline-color:#fff}

.who-bar{background:var(--surface);border-bottom:1px solid var(--line)}
.who-in{max-width:960px;margin:0 auto;padding:10px 16px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 20px}
.who-name{font-family:var(--ag-display,Georgia,serif);font-weight:700;font-size:1.12rem;line-height:1.25}
.who-no{color:var(--muted)}
.who-switch{display:flex;align-items:center;gap:10px;font-weight:600;flex:1 1 100%;min-width:0}   /* a row of its own on a phone */
.who-switch span{flex:0 0 auto;white-space:nowrap}
.who-switch select{flex:1 1 auto;min-width:0;width:auto;min-height:44px}

/* The staff "view as customer" bar, on every page while the view lasts. It is the first thing in <body>, so it stays at
   the top of the screen however far the page scrolls (25 Nov 2026 review, SCR-60: inside the header it scrolled away
   with it, and on a phone it was 145px high). On a phone: the customer's name, "read only" and the button, in one or
   two short lines; the customer number and the staff name join them on a wider screen. */
.viewas-bar{position:sticky;top:0;z-index:40;background:var(--warn-soft);color:var(--ink);border-bottom:2px solid var(--warn-line);
  padding:6px 16px;display:flex;flex-wrap:nowrap;align-items:center;justify-content:space-between;gap:10px;font-weight:600;font-size:.94rem;line-height:1.35}
.viewas-text{flex:1 1 auto;min-width:0}
.viewas-bar .btn{flex:0 0 auto}
.viewas-more{display:none}

/* ---- footer ---- */
.foot{margin-top:auto;background:var(--surface);border-top:1px solid var(--line);color:var(--ink-2)}
.foot-in{max-width:960px;margin:0 auto;padding:18px 16px 28px}
.foot-in p{margin:0 0 8px}
.foot-in p:last-child{margin-bottom:0}

/* ---- cards ---- */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:18px 16px;margin:0 0 16px;box-shadow:var(--shadow)}
.card>:first-child{margin-top:0}
.card>:last-child{margin-bottom:0}
.card.attention{border-left:6px solid var(--warn)}
.card.good{border-left:6px solid var(--accent-bar)}
.card.quiet{background:var(--surface-2);box-shadow:none}
.card-head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:6px 12px;margin-bottom:10px}
.card-head h2,.card-head h3{margin:0}
.figure{font-family:var(--ag-display,Georgia,serif);font-size:2rem;font-weight:700;line-height:1.15;font-variant-numeric:tabular-nums}
.figure-label{color:var(--muted);margin:0 0 2px}
dl.kv{display:grid;grid-template-columns:minmax(110px,40%) 1fr;gap:6px 16px;margin:0 0 14px}
dl.kv dt{color:var(--muted)}
dl.kv dd{margin:0;font-weight:600}
.list{list-style:none;margin:0;padding:0}
.list>li{padding:12px 0;border-bottom:1px solid var(--line)}
.list>li:last-child{border-bottom:0}
.empty{padding:22px 12px;text-align:center;color:var(--muted)}
details.fold{border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);margin:0 0 16px}
details.fold>summary{cursor:pointer;min-height:52px;padding:14px 16px;font-weight:700;list-style-position:inside}
details.fold>.fold-body{padding:0 16px 16px}

/* ---- buttons: big enough for a thumb ---- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:11px 20px;
  font:inherit;font-size:1.06rem;font-weight:700;line-height:1.2;text-align:center;text-decoration:none;cursor:pointer;
  color:var(--ink);background:var(--surface);border:2px solid var(--line-2);border-radius:var(--radius-s)}
.btn:hover{border-color:var(--ink-2)}
.btn.primary{color:#fff;background:var(--accent);border-color:var(--accent)}
.btn.quiet{background:transparent;border-color:transparent;color:var(--accent-ink);text-decoration:underline;padding-left:8px;padding-right:8px}
.btn.danger{color:var(--bad);border-color:var(--bad-line)}
.btn.small{min-height:40px;padding:7px 14px;font-size:.96rem}
.btn.block{display:flex;width:100%}
.btn[disabled],.btn[aria-disabled="true"]{opacity:.55;cursor:not-allowed}
.actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:18px}
.actions .btn{flex:1 1 100%}

/* ---- chips: a word in a pill; the word carries the meaning, the colour only helps ---- */
/* A chip may run to a second line rather than push the page sideways: the server's words can be a whole sentence ("You
   told us you paid. We are checking with our bank"). Until 25 Nov 2026 every page with such words had to say so itself. */
.chip{display:inline-flex;align-items:center;gap:6px;padding:3px 11px;border-radius:14px;font-size:.9rem;font-weight:700;line-height:1.4;
  max-width:100%;white-space:normal;overflow-wrap:normal;word-break:normal;text-align:left;color:var(--ink-2);background:var(--surface-3);border:1px solid var(--line-2)}
.chip.good{color:var(--good);background:var(--good-soft);border-color:var(--accent-bar)}
.chip.warn{color:var(--warn);background:var(--warn-soft);border-color:var(--warn-line)}
.chip.bad{color:var(--bad);background:var(--bad-soft);border-color:var(--bad-line)}
.chip.info{color:var(--info);background:var(--info-soft);border-color:var(--info-line)}

/* ---- banners: one thing the person should know, across the page ---- */
.banner{padding:13px 16px;margin:0 0 16px;border-radius:var(--radius-s);border:1px solid var(--line-2);border-left-width:6px;background:var(--surface-2)}
.banner>:last-child{margin-bottom:0}
.banner.info{background:var(--info-soft);border-color:var(--info-line);border-left-color:var(--info)}
.banner.good{background:var(--good-soft);border-color:var(--accent-bar)}
.banner.warn{background:var(--warn-soft);border-color:var(--warn-line);border-left-color:var(--warn)}
.banner.bad{background:var(--bad-soft);border-color:var(--bad-line);border-left-color:var(--bad)}

/* ---- forms: a label on every input, one question per row ---- */
.field{display:grid;gap:6px;margin:0 0 18px}
.field>label,.field>legend,label.field-label{font-weight:700}
input,select,textarea{font:inherit;font-size:1.06rem;color:var(--ink);background:var(--surface);border:2px solid var(--line-2);border-radius:var(--radius-s);
  min-height:48px;padding:10px 12px;width:100%;max-width:100%}
textarea{min-height:110px;resize:vertical}
input[type="checkbox"],input[type="radio"]{width:24px;height:24px;min-height:0;padding:0;flex:0 0 auto;accent-color:var(--accent)}
input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid var(--focus);outline-offset:1px;border-color:var(--focus)}
.hint{color:var(--muted);font-size:.94rem;margin:0}
ul.hint{margin:16px 0 0;padding-left:22px}
ul.hint>li+li{margin-top:6px}
.error-text{color:var(--bad);font-weight:700;margin:0}
.field.invalid input,.field.invalid select,.field.invalid textarea{border-color:var(--bad)}
fieldset{border:0;padding:0;margin:0 0 18px;min-width:0}
legend{padding:0;margin:0 0 8px;font-weight:700}
.choice{display:flex;align-items:center;gap:12px;min-height:56px;padding:12px 14px;margin:0 0 10px;border:2px solid var(--line-2);border-radius:var(--radius-s);background:var(--surface);cursor:pointer;font-weight:600}
.choice:has(input:checked){border-color:var(--accent);background:var(--accent-soft)}
.choice .hint{font-weight:400}
.code-input{font-size:1.9rem;font-weight:700;letter-spacing:.28em;text-align:center;font-variant-numeric:tabular-nums;min-height:64px;padding:10px 8px}

/* ---- tables that become stacked cards on a phone ----
   <table class="cards"><thead><tr><th>Invoice</th><th>Due</th><th class="num">Open</th></tr></thead>
     <tbody><tr><td data-label="Invoice">9000012345</td><td data-label="Due">Sun, Dec 20, 2026</td><td data-label="Open" class="num">$0.00</td></tr></tbody></table>
   On a phone each row is a card and each cell shows its data-label in front of its value. */
table.cards{width:100%;border-collapse:collapse;margin:0 0 16px}
table.cards thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
table.cards,table.cards tbody,table.cards tfoot,table.cards tr,table.cards td{display:block}
table.cards tr{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:6px 14px;margin:0 0 12px}
table.cards td{display:flex;justify-content:space-between;align-items:baseline;gap:16px;padding:9px 0;border-bottom:1px solid var(--line);text-align:right}
table.cards td:last-child{border-bottom:0}
table.cards td::before{content:attr(data-label);flex:0 0 40%;text-align:left;color:var(--muted);font-weight:600}
table.cards td:not([data-label])::before,table.cards td[data-label=""]::before{content:none}
table.cards td.wide{display:block;text-align:left}                     /* a cell that is the card's title, or holds buttons */
table.cards td.wide::before{display:block;margin-bottom:2px}

/* ---- the little message that pops up after something is done, or goes wrong ---- */
.toast-box{position:fixed;left:0;right:0;bottom:16px;z-index:60;display:flex;flex-direction:column;align-items:center;gap:8px;padding:0 12px;pointer-events:none}
.toast{pointer-events:auto;max-width:560px;width:100%;padding:13px 16px;border-radius:var(--radius-s);font-weight:600;
  color:var(--ink);background:var(--surface);border:2px solid var(--line-2);box-shadow:0 6px 24px rgba(0,0,0,.22)}
.toast.good{border-color:var(--accent-bar);background:var(--good-soft)}
.toast.bad{border-color:var(--bad);background:var(--bad-soft)}

/* ---- wider screens ---- */
@media (min-width:480px){
  .actions .btn{flex:0 1 auto}
}
@media (min-width:700px){
  .viewas-more{display:inline}
  .viewas-bar{justify-content:center;gap:16px}
  .viewas-text{flex:0 1 auto}
  .who-switch{flex:0 1 auto}
  .page{padding:28px 24px 64px}
  h1{font-size:2rem}
  .card{padding:22px}
  .grid-2{grid-template-columns:1fr 1fr}
  table.cards{display:table;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius)}
  table.cards thead{position:static;display:table-header-group;width:auto;height:auto;clip:auto;white-space:normal}
  table.cards tbody{display:table-row-group}
  table.cards tfoot{display:table-footer-group}
  table.cards tr{display:table-row;border:0;border-radius:0;box-shadow:none;padding:0;margin:0;background:transparent}
  table.cards th{text-align:left;font-weight:700;color:var(--muted);font-size:.92rem;padding:11px 14px;border-bottom:2px solid var(--line-2)}
  table.cards td,table.cards td.wide{display:table-cell;padding:13px 14px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}
  /* as a table every cell of a row has its line, the last one too (the phone's cards take it off the last cell) */
  table.cards td:last-child{border-bottom:1px solid var(--line)}
  table.cards tbody tr:last-child td{border-bottom:0}
  table.cards td::before,table.cards td.wide::before{content:none;display:none}
  table.cards th.num,table.cards td.num{text-align:right}
}
/* A table with many columns (invoices, payments, the catalogue) does not fit beside itself on a small tablet, so it
   stays as stacked cards until there is room: table.cards.late. These are the phone's card rules again, for the widths
   between 700px and 900px. Until 25 Nov 2026 each page that needed it carried its own copy. */
@media screen and (min-width:700px) and (max-width:899.98px){
  table.cards.late{display:block;background:transparent;border:0;border-radius:0}
  table.cards.late thead{display:block;position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
  table.cards.late tbody,table.cards.late tfoot,table.cards.late tr{display:block}
  table.cards.late tr{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:6px 14px;margin:0 0 12px}
  table.cards.late td,table.cards.late td.wide,table.cards.late tbody tr:last-child td{display:flex;justify-content:space-between;align-items:baseline;gap:16px;padding:9px 0;border-bottom:1px solid var(--line);text-align:right}
  table.cards.late td::before,table.cards.late td.wide::before{content:attr(data-label);display:block;flex:0 0 40%;text-align:left;color:var(--muted);font-weight:600}
  table.cards.late td:not([data-label])::before,table.cards.late td[data-label=""]::before{content:none}
  table.cards.late td.wide,table.cards.late tbody tr:last-child td.wide{display:block;text-align:left}
  table.cards.late td.wide::before{margin-bottom:2px}
  table.cards.late td:last-child,table.cards.late tbody tr:last-child td:last-child{border-bottom:0}
}
@media (min-width:900px){
  /* room for the whole menu in the green bar: no Menu button */
  .hdr-menu-btn{display:none}
  .hdr-nav,.hdr-nav.open{display:flex;flex:0 1 auto;flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:2px;padding:0}
  .hdr-nav a,.hdr-nav button{min-height:44px;padding:9px 11px;font-size:.98rem}
}

/* ---- on paper: an order, an invoice or a receipt, without the site around it ---- */
@media print{
  /* Paper is white whatever the screen is set to. brand.css comes after this file and its dark tokens are the more
     specific, so a browser that keeps the dark setting while printing would print light words on white: these selectors
     outrank them (until 25 Nov 2026 the money pages had to say this themselves). */
  html:root,html:root:not([data-theme="light"]),html:root[data-theme="dark"]{
    --bg:#fff;--surface:#fff;--surface-2:#fff;--surface-3:#fff;--ink:#000;--ink-2:#222;--muted:#444;--line:#bbb;--line-2:#999;
    --accent-ink:#000;--good:#000;--warn:#000;--bad:#000;--info:#000;--ag-heading:#000;--shadow:none;color-scheme:light}
  .who-bar,.foot{background:#fff}
  .chip,.chip.good,.chip.warn,.chip.bad,.chip.info{background:#fff;color:#000;border-color:#666}
  .banner,.banner.good,.banner.warn,.banner.bad,.banner.info{background:#fff;border-color:#999}
  html{font-size:11pt}
  body{background:#fff;color:#000;display:block}
  .hdr{background:#fff;color:#000;border-top:0;border-bottom:1px solid #999}
  .hdr-nav,.hdr-menu-btn,.viewas-bar,.toast-box,.skip-link,.who-switch,.no-print,.actions{display:none !important}
  .print-only,.hdr-logo img.print-only{display:block}
  .page{max-width:none;padding:0}
  .card,table.cards tr{box-shadow:none;break-inside:avoid}
  .foot{border-top:1px solid #999}
  a{color:#000;text-decoration:none}
  table.cards{display:table;border:1px solid #999}
  table.cards thead{position:static;display:table-header-group;width:auto;height:auto;clip:auto}
  table.cards tbody{display:table-row-group}
  table.cards tr{display:table-row;border:0;padding:0;margin:0}
  table.cards th,table.cards td,table.cards td.wide,table.cards td:last-child{display:table-cell;padding:6px 8px;border-bottom:1px solid #bbb;text-align:left}
  table.cards tbody tr:last-child td{border-bottom:0}
  table.cards td::before{content:none;display:none}
  table.cards th.num,table.cards td.num{text-align:right}
}
