/* ChemGro shipment portal (2026-10-21). Mobile first; colors are tokens with dark values below. */
:root {
  --bg: #f6f7f8; --surface: #fff; --text: #17202a; --muted: #5b6673; --border: #dde2e7; --row: #f0f3f5;
  --th-bg: #e3f1ef; --th-ink: #134e48; --zebra: #f7faf9; --hover: #eef6f4;
  --accent: #0f766e; --accent-ink: #fff; --accent-soft: #e6f4f2; --warn-bg: #fdecec; --warn: #a61b1b; --ok-bg: #e7f6ec; --ok: #17643a;
  --focus: #2563eb; --radius: 12px;
  --pad: clamp(14px, 3vw, 24px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161b; --surface: #182027; --text: #e6ebef; --muted: #9aa6b2; --border: #2b3640; --row: #1e2830;
    --th-bg: #1b3a37; --th-ink: #b9e8e0; --zebra: #1c252c; --hover: #20302f;
    --accent: #2dd4bf; --accent-ink: #062a26; --accent-soft: #123631; --warn-bg: #3a1717; --warn: #ffb4b4; --ok-bg: #133222; --ok: #9be3b7;
    --focus: #8ab4ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11161b; --surface: #182027; --text: #e6ebef; --muted: #9aa6b2; --border: #2b3640; --row: #1e2830;
  --th-bg: #1b3a37; --th-ink: #b9e8e0; --zebra: #1c252c; --hover: #20302f;
  --accent: #2dd4bf; --accent-ink: #062a26; --accent-soft: #123631; --warn-bg: #3a1717; --warn: #ffb4b4; --ok-bg: #133222; --ok: #9be3b7;
  --focus: #8ab4ff; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.wrap { inline-size: 100%; max-inline-size: 1200px; margin-inline: auto; padding-inline: 16px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.top { background: var(--surface); border-block-end: 1px solid var(--border); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; flex-wrap: wrap; }
.brand { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; }
.brand .mark { font-size: 26px; }
.brand b { display: block; font-size: 17px; } .brand small { display: block; color: var(--muted); font-size: 13px; }
.nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav a { padding: 10px 12px; min-block-size: 44px; display: inline-flex; align-items: center; text-decoration: none; color: var(--muted); border-radius: 8px; }
.nav a[aria-current="page"] { color: var(--text); font-weight: 700; background: var(--row); }
.foot { padding-block: 18px; color: var(--muted); font-size: 14px; }
.page { padding-block: var(--pad); display: grid; gap: 16px; align-content: start; grid-template-columns: minmax(0, 1fr); }
.page > *, .filters > *, .tabbar > *, .f { min-inline-size: 0; }
h1 { font-size: clamp(22px, 4vw, 28px); margin: 0; line-height: 1.2; }

.btn { font: inherit; font-size: 15px; min-block-size: 44px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.small { min-block-size: 36px; padding: 4px 12px; font-size: 14px; }
.btn.full { inline-size: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
@media (pointer: coarse) { .btn.small { min-block-size: 44px; } }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--pad); display: grid; gap: 14px; }
.narrow { max-inline-size: 440px; inline-size: 100%; margin-inline: auto; display: grid; gap: 14px; }
.f { display: grid; gap: 4px; }
.f label { font-weight: 600; font-size: 15px; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="date"] {
  font: inherit; font-size: 16px; min-block-size: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); inline-size: 100%; }
input:user-invalid, input[aria-invalid="true"] { border-color: var(--warn); }
.err { color: var(--warn); font-size: 14px; margin: 0; }
.flash { padding: 10px 14px; border-radius: 10px; margin: 0; }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.check { display: flex; gap: 8px; align-items: center; font-size: 15px; } input[type="checkbox"] { accent-color: var(--accent); inline-size: 20px; block-size: 20px; }

/* tabs + filters (2026-10-21) */
.tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block-end: 1px solid var(--border); }
@media (min-width: 640px) { .tabs { display: flex; gap: 4px; } }
.tabs a { padding: 10px clamp(6px, 2vw, 16px); justify-content: center; min-block-size: 44px; display: inline-flex; align-items: center; text-decoration: none; color: var(--muted); border-block-end: 3px solid transparent; margin-block-end: -1px; white-space: nowrap; font-weight: 600; }
.tabs a[aria-current="page"] { color: var(--text); border-block-end-color: var(--accent); }
.tabbar { display: grid; gap: 10px; border-block-end: 1px solid var(--border); }
.tabbar .tabs { border-block-end: 0; }
.search { display: flex; gap: 8px; align-items: center; padding-block-end: 8px; }
.search label { font-weight: 600; font-size: 15px; }
.search input { flex: 1; }
@media (min-width: 820px) {
  .tabbar { grid-template-columns: auto minmax(260px, 420px); justify-content: space-between; align-items: end; }
}
/* every filter but the search on one line (wraps on narrow screens) */
.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: end; padding-block: 12px; }
.filters > .f { flex: 1 1 140px; }
.filters .f label { font-size: 13.5px; }
.filters .acts { display: flex; gap: 6px 12px; align-items: center; min-block-size: 44px; flex: 0 0 auto; }
.filters .check { white-space: nowrap; cursor: pointer; }
@media (min-width: 1000px) { .filters { flex-wrap: nowrap; } .filters > .f { flex: 1 1 0; min-inline-size: 0; } }
select { font: inherit; font-size: 16px; min-block-size: 44px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); inline-size: 100%; min-inline-size: 0; }
.f small { font-size: 12.5px; }
#res { transition: opacity .15s; } #res.busy { opacity: .55; }
.chip { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 2px 10px; border-radius: 999px; white-space: nowrap; background: var(--row); color: var(--muted); }
.chip.open { background: var(--accent-soft); color: var(--accent); } .chip.paid { background: var(--ok-bg); color: var(--ok); } .chip.late { background: var(--warn-bg); color: var(--warn); }

/* the lists */
input { min-inline-size: 0; }
.count { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.list { display: grid; gap: 10px; }
.ship { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 8px; }
.ship-h { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.ship-h b { font-size: 17px; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; font-size: 14px; margin: 0; }
.kv div { min-inline-size: 0; } .kv dt { color: var(--muted); font-size: 12.5px; } .kv dd { margin: 0; overflow-wrap: anywhere; }
.items { margin: 0; padding: 0; list-style: none; font-size: 14px; display: grid; gap: 2px; }
.items li { display: flex; gap: 8px; } .items li > span:last-child { min-inline-size: 0; overflow-wrap: anywhere; } .items .q { font-variant-numeric: tabular-nums; white-space: nowrap; min-inline-size: 5.5em; }
.pdf { display: flex; gap: 8px; flex-wrap: wrap; }
.tbl-wrap { display: none; }
@media (min-width: 1000px) {
  .list { display: none; }
  .tbl-wrap { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
  table { inline-size: 100%; border-collapse: collapse; font-size: 14px; }
  th { text-align: start; font-size: 13px; color: var(--th-ink); background: var(--th-bg); font-weight: 700; padding: 11px 10px; border-block-end: 1px solid var(--border); white-space: nowrap; }
  th button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
  th button[aria-pressed="true"] { color: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
  td { padding: 10px; border-block-end: 1px solid var(--row); vertical-align: top; }
  tr:last-child td { border-block-end: 0; }
  tbody tr:nth-child(even) td { background: var(--zebra); }   /* every other row lightly shaded (Ryan 2026-10-21) */
  tbody tr:hover td { background: var(--hover); }
  td.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
  td .items { font-size: 13px; }
  td.items-cell { min-inline-size: 260px; }
  td .muted { font-size: 13px; }
  td .pdf { flex-direction: column; }
  table.no-items td .pdf { flex-direction: row; flex-wrap: nowrap; }   /* items hidden: room for the buttons side by side */
}
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.empty { padding: 24px; text-align: center; }
.sr { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.m0 { margin: 0; } .nowrap { white-space: nowrap; } .h2 { margin: 0; font-size: 18px; }
