/* Plantrite Procure — light, daylight-readable theme (rolled in from the
   2026-06-12 mobile-first prototype). Shared across all tabs. */
:root {
  --bg:#f4f7f3; --surface:#ffffff; --surface-2:#eef3ec;
  --line:#e2e9dd; --ink:#16241c; --txt:#16241c; --muted:#69796d;
  --brand:#1f7a4d; --brand-dk:#14532d; --brand-soft:#e4f2ea;
  --warn:#b4541b; --warn-soft:#fdeee2; --danger:#c0392b; --danger-soft:#fbe7e4;
  --shadow:0 1px 2px rgba(20,40,28,.06), 0 4px 16px rgba(20,40,28,.06);
  --r:16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color:transparent; }
[x-cloak] { display: none !important; }
html, body { margin:0; }
body { font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; background:var(--bg); color:var(--ink); -webkit-font-smoothing:antialiased; }
h1,h2,h3 { margin:0; letter-spacing:-.3px; }
small { color:var(--muted); display:block; font-weight:400; }
.muted { color:var(--muted); font-size:14px; }
.error { color:var(--danger); }

button { background:var(--brand); color:#fff; border:0; border-radius:11px; padding:10px 16px; font-weight:650; font-size:15px; cursor:pointer; font-family:inherit; transition:.15s; box-shadow:var(--shadow); }
button:active { transform:scale(.97); }
button:disabled { opacity:.5; }
button.link { background:none; color:var(--brand); padding:6px 8px; font-weight:650; box-shadow:none; }
button.wide { width:100%; margin:16px 0 40px; padding:14px; }
input, select { background:var(--surface); border:1px solid var(--line); color:var(--ink); border-radius:11px; padding:11px 12px; font-size:15px; width:100%; font-family:inherit; }
input:focus, select:focus { outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft); }

/* login */
.login { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px; }
.login-card { background:var(--surface); border:1px solid var(--line); border-radius:var(--r); padding:28px; width:100%; max-width:360px; display:flex; flex-direction:column; gap:12px; box-shadow:var(--shadow); }
.login-card h1 { font-size:23px; } .login-card p { margin:0 0 4px; }

/* header + nav */
header { display:flex; justify-content:space-between; align-items:center; padding:14px 18px; background:linear-gradient(180deg,#1f7a4d,#1a6b43); color:#fff; position:sticky; top:0; z-index:5; box-shadow:0 2px 10px rgba(20,40,28,.14); }
.brand { font-weight:750; font-size:18px; }
.who { display:flex; align-items:center; gap:8px; font-size:13px; opacity:.97; }
.who span[x-text="user?.name"] { font-weight:650; }
.role { opacity:.85; text-transform:capitalize; }
header button.link { color:#fff; }
.tabs { display:flex; gap:6px; padding:10px 14px; background:var(--bg); position:sticky; top:53px; z-index:4; overflow-x:auto; scrollbar-width:none; }
.tabs::-webkit-scrollbar { display:none; }
.tabs button { background:var(--surface); color:var(--muted); border:1px solid var(--line); border-radius:999px; padding:9px 16px; font-weight:650; white-space:nowrap; box-shadow:none; }
.tabs button.active { background:var(--brand); border-color:var(--brand); color:#fff; }

main { padding:14px 16px 80px; max-width:640px; margin:0 auto; }
.bar { display:flex; justify-content:space-between; align-items:center; margin:10px 2px 14px; gap:10px; }
.bar h2 { font-size:21px; }
.count { color:var(--muted); font-size:14px; font-weight:400; margin-left:6px; }
.cat { margin:16px 0; }
.cat h3 { font-size:13px; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; padding-bottom:6px; margin-bottom:8px; border-bottom:1px solid var(--line); }

/* tables sit on white cards */
table { width:100%; border-collapse:separate; border-spacing:0; font-size:14.5px; background:var(--surface); border:1px solid var(--line); border-radius:var(--r); overflow:hidden; box-shadow:var(--shadow); }
th { text-align:left; color:var(--muted); font-weight:650; font-size:11.5px; text-transform:uppercase; letter-spacing:.4px; padding:11px 12px 7px; background:var(--surface-2); }
td { padding:12px; border-top:1px solid var(--line); vertical-align:middle; }
tbody tr:first-child td { border-top:1px solid var(--line); }
td input { width:72px; padding:7px 8px; }
tr.low td { background:var(--warn-soft); }
.pack { font-size:11.5px; } .note { font-size:11.5px; color:var(--warn); }
.suggest b { color:var(--brand); font-size:16px; }

.stockrow { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:11px 0; border-top:1px solid var(--line); }
.stockrow label { flex:1; font-size:14.5px; font-weight:600; }
.stockrow input { width:104px; }

.flash { position:sticky; top:104px; background:var(--brand-soft); color:var(--brand-dk); padding:10px 14px; border-radius:11px; margin:10px 0; font-weight:650; z-index:3; border:1px solid #cfe6da; }

.modal { position:fixed; inset:0; background:rgba(20,40,28,.45); display:flex; align-items:flex-start; justify-content:center; padding:16px; z-index:20; overflow-y:auto; }
.modal-card { background:var(--surface); border:1px solid var(--line); border-radius:var(--r); padding:22px; width:100%; max-width:480px; display:flex; flex-direction:column; gap:13px; box-shadow:0 10px 40px rgba(20,40,28,.22); margin:24px 0; }
.modal-card label { font-size:13px; color:var(--muted); display:flex; flex-direction:column; gap:5px; font-weight:600; }
.row { display:flex; gap:8px; } .row label { flex:1; }

/* status pills (Phase 1 AP) */
.pill { display:inline-block; background:var(--surface-2); color:var(--ink); border-radius:999px; padding:3px 11px; font-size:12.5px; font-weight:700; text-transform:capitalize; }
.pill.ok   { background:var(--brand-soft); color:var(--brand-dk); }     /* matched / approved */
.pill.go   { background:#e6effb; color:#2c5aa0; }                       /* awaiting action */
.pill.done { background:#dff0e6; color:var(--brand-dk); }              /* posted */
.pill.warn { background:var(--warn-soft); color:var(--warn); }         /* exception / duplicate / query */
.pill.dead { background:var(--danger-soft); color:var(--danger); }     /* rejected */
.uploadbtn { background:var(--brand); color:#fff; border-radius:11px; padding:10px 16px; font-weight:650; font-size:15px; cursor:pointer; display:inline-block; box-shadow:var(--shadow); }

/* bill cards (mobile-first list — replaces the wide table) */
.cards { display:flex; flex-direction:column; gap:11px; }
.billcard { width:100%; text-align:left; background:var(--surface); border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--shadow); padding:15px; display:flex; flex-direction:column; gap:8px; color:var(--ink); }
.billcard.warn { border-color:#f0d3bf; background:linear-gradient(180deg,#fffaf6,#fff); }
.bc-top { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.bc-supplier { font-weight:750; font-size:16px; letter-spacing:-.2px; line-height:1.25; }
.bc-mid { display:flex; align-items:baseline; gap:10px; }
.bc-amount { font-size:19px; font-weight:800; font-variant-numeric:tabular-nums; }
.bc-inv { color:var(--muted); font-size:13.5px; }
.bc-foot { font-size:12.5px; color:var(--muted); text-transform:capitalize; }
.modal-card table { font-size:13.5px; } .modal-card td, .modal-card th { padding:9px 8px; }
/* bill detail panel */
.billdetail { gap:0; }
.bd-head { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
.bd-title h3 { font-size:21px; line-height:1.2; }
.bd-sub { color:var(--muted); font-size:13.5px; margin-top:4px; }
.bd-amount { display:flex; align-items:center; gap:12px; margin:14px 0 4px; }
.bd-total { font-size:30px; font-weight:800; letter-spacing:-.5px; font-variant-numeric:tabular-nums; }
.bd-meta { color:var(--muted); font-size:13px; display:flex; gap:8px; }
.callout { background:var(--surface-2); border:1px solid var(--line); border-radius:11px; padding:10px 12px; font-size:13.5px; font-weight:600; margin-top:12px; }
.callout.warn { background:var(--warn-soft); border-color:#f0d3bf; color:var(--warn); }
.bd-sec { font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; color:var(--muted); margin:20px 0 9px; padding-bottom:7px; border-bottom:1px solid var(--line); }
.bd-sec .muted { text-transform:none; letter-spacing:0; font-weight:600; }
.li-select { width:auto; max-width:100%; flex:1; padding:8px 10px; font-size:13.5px; }
.li-q { color:var(--muted); font-size:12.5px; white-space:nowrap; }
.attachrow { display:flex; gap:9px; align-items:center; margin-bottom:10px; }
.attachrow input { width:84px; flex:0 0 auto; }
.attachrow button { flex:1; }
.actions { display:flex; flex-direction:column; gap:9px; margin-top:4px; }
.actions .primary { width:100%; padding:14px; font-size:16px; }
.actions-sub { display:flex; flex-wrap:wrap; gap:4px 12px; margin-top:8px; }
.link.danger { color:var(--danger); }
.myob { margin-top:14px; padding-top:12px; border-top:1px solid var(--line); }

/* per-line items in the bill detail (stacked, mobile-friendly) */
.lines { display:flex; flex-direction:column; gap:8px; margin-top:4px; }
.lineitem { background:var(--surface-2); border:1px solid var(--line); border-radius:12px; padding:11px 12px; }
.li-top { display:flex; justify-content:space-between; align-items:baseline; gap:10px; }
.li-desc { font-weight:650; font-size:14.5px; }
.li-amt { font-weight:750; font-variant-numeric:tabular-nums; }
.li-qty { font-size:12.5px; color:var(--muted); margin-top:3px; }
.amt-edit { display:inline-flex; align-items:center; gap:5px; font-size:13px; color:var(--ink); }
.amt-edit input { width:74px; padding:6px 8px; font-size:13px; }
.li-acct { display:flex; align-items:center; gap:8px; margin-top:8px; flex-wrap:wrap; }

.docrow { display:flex; flex-wrap:wrap; gap:8px; }
.docbtn { background:var(--surface-2); color:var(--brand-dk); border:1px solid var(--line); border-radius:11px; padding:10px 14px; font-weight:650; font-size:14px; box-shadow:none; }
.docbtn:disabled { opacity:.45; }
/* ── Labels module ─────────────────────────────────────────────────────── */
main.wide { max-width:1180px; }
.labels .subtabs { display:flex; gap:4px; margin-bottom:12px; flex-wrap:wrap; }
.labels .subtabs button { background:transparent; border:1px solid var(--line); color:var(--muted); padding:5px 12px; border-radius:7px; font-size:13px; }
.labels .subtabs button.active { background:var(--brand); color:#fff; border-color:var(--brand); font-weight:600; }
.labels .fresh { font-size:13px; color:var(--muted); margin:4px 0 12px; }
.labels .fresh b { color:var(--ink); }
.labels .chip { font-size:11px; padding:2px 8px; border-radius:99px; text-transform:uppercase; letter-spacing:.04em; }
.labels .chip.ok { background:var(--brand-soft); color:var(--brand-dk); }
.labels .chip.watch { background:var(--warn-soft); color:var(--warn); }
.labels .chip.uncounted { background:var(--surface-2); color:var(--muted); }
.labels .mark { font-size:11px; color:var(--muted); margin-left:6px; }
.labels .mark.warnmark { color:var(--warn); }
.labels .warn { color:var(--warn); font-size:13px; }
.labels .cols { display:grid; grid-template-columns:1fr 1fr; gap:16px; align-items:start; }
.labels .pick { border-top:1px solid var(--line); padding:8px 4px; cursor:pointer; }
.labels .pick.sel { outline:1px solid var(--brand); border-radius:6px; background:rgba(120,200,150,.06); }
.labels .pick small { display:block; }
.labels .namein { background:transparent; border:1px solid transparent; color:var(--ink); font-size:14px; padding:2px 4px; border-radius:4px; width:60%; }
.labels .namein:hover, .labels .namein:focus { border-color:var(--line); background:var(--surface); }
.labels .linkchip { display:flex; gap:6px; align-items:center; margin-top:4px; font-size:12px; }
.labels .linkchip input { width:64px; } .labels .linkchip select { font-size:12px; }
.labels .linkbar { position:sticky; top:97px; display:flex; gap:12px; align-items:center; flex-wrap:wrap;
           background:var(--surface); border:1px solid var(--line); border-radius:8px; padding:8px 12px; margin-bottom:10px; z-index:2; }
.labels label.inline { display:inline-flex; align-items:center; gap:6px; font-size:13px; color:var(--muted); }
@media (max-width:820px) { .labels .cols { grid-template-columns:1fr; } }

/* ── Slice 2: trigger state, die statuses, and the Count screen on a phone ── */
.labels .chip.trigger { background:var(--danger-soft); color:var(--danger); }
.labels .chip.draft { background:var(--surface-2); color:var(--ink); border:1px dashed var(--line); }
.labels .chip.approved { background:var(--warn-soft); color:var(--warn); }
.labels .chip.ordered { background:#e6effb; color:#2c5aa0; }
.labels .chip.received { background:var(--brand-soft); color:var(--brand-dk); }
.labels .chip.cancelled { background:var(--danger-soft); color:var(--danger); text-decoration:line-through; }
.labels tr.trig td { background:var(--danger-soft); }
.labels .savebar { position:sticky; bottom:0; background:var(--bg); padding:10px 0; border-top:1px solid var(--line); }

/* Labels are counted in the shed, so the Count screen has to work on a phone.
   The Admin mapping screen deliberately does not — side-by-side linking on a
   393px viewport would be worse than useless. */
@media (max-width:480px) {
  /* Scoped to the labels section: this block exists for the Count screen, which is
     used in the shed. Unscoped it was also resetting master's AP screens — it took
     80px off `main`'s bottom gutter and shrank their tables. */
  main.wide { max-width:100%; padding:10px; }
  .subtabs { overflow-x:auto; -webkit-overflow-scrolling:touch; white-space:nowrap; }
  .labels .bar { flex-wrap:wrap; gap:6px; }
  .labels .stockrow { min-height:44px; }
  .labels .stockrow input { width:88px; }
  /* iOS Safari zooms the whole page when a focused input is under 16px. */
  .labels input, .labels select, .labels button { font-size:16px; }
  .labels table { font-size:13px; }
}
