/* SMG Handheld. Tokens and component rules from SMG Teamwork's app.css, trimmed for a phone-first app. Light only.
   No inline styles anywhere (CSP): add classes here. */
:root {
  --nd-ground: #f2f4f3; --nd-panel: #ffffff; --nd-paper: #e6eae8; --nd-line: #d8dedb; --nd-rule: #e3e8e6; --nd-field: #c3ccc8;
  --nd-ink: #18211f; --nd-ink-2: #47524f; --nd-pill: #e3ebe8; --nd-accent: #0b6f66; --nd-accent-hover: #095a53; --nd-accent-soft: #eef4f2;
  --nd-link: #0b5d56; --nd-link-hover: #083f3b;
  --nd-good: #1f5a31; --nd-good-bg: #dff1e4; --nd-good-line: #b7dcc0;
  --nd-warn: #8a3a0a; --nd-warn-bg: #fdf1e7; --nd-warn-line: #efc9a8;
  --nd-bad: #8a2b1a; --nd-bad-bg: #fbe9e5; --nd-bad-line: #e5b3a6;
  --nd-info: #1d4f6e; --nd-info-bg: #e8f1f4; --nd-info-line: #bcd5e0;
  --nd-chip-dark: #18211f; --nd-shadow: 0 12px 32px rgba(24,33,31,.18);
  --nd-radius: 8px; --nd-radius-field: 6px; --nd-radius-chip: 4px;
  --nd-top-h: 56px; --nd-hold-ms: 500ms;
  --nd-font: "Segoe UI Variable Text","Segoe UI",-apple-system,BlinkMacSystemFont,system-ui,"Helvetica Neue",Arial,sans-serif;
  --nd-font-head: "Segoe UI Variable Display","Segoe UI",-apple-system,BlinkMacSystemFont,system-ui,sans-serif;
  --nd-mono: "Cascadia Mono",Consolas,ui-monospace,monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.nd { margin: 0; background: var(--nd-ground); color: var(--nd-ink); font: 15px/1.45 var(--nd-font); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; }
body.nd a { color: var(--nd-link); }
body.nd h1, .nd-h1 { font: 600 22px/1.25 var(--nd-font-head); letter-spacing: -.005em; margin: 0 0 12px; }
body.nd h2 { font: 600 16px/1.3 var(--nd-font-head); margin: 0; }
body.nd h3 { font: 600 14px/1.3 var(--nd-font-head); margin: 0; }
body.nd p { margin: 0; }
.small { font-size: 13px; } .muted { color: var(--nd-ink-2); }
.mono { font-family: var(--nd-mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden, [hidden] { display: none !important; }
.grow { flex: 1; } .nowrap { white-space: nowrap; } .right { text-align: right; }

/* buttons and fields */
body.nd input, body.nd select, body.nd textarea { font: inherit; min-height: 40px; padding: 8px 10px; border: 1px solid var(--nd-field); border-radius: var(--nd-radius-field); background-color: var(--nd-panel); color: var(--nd-ink); max-width: 100%; }
body.nd input:focus, body.nd select:focus, body.nd textarea:focus { outline: 2px solid var(--nd-accent); outline-offset: -1px; border-color: var(--nd-accent); }
body.nd button, body.nd .button { font: inherit; font-weight: 500; min-height: 40px; padding: 0 14px; border: 1px solid var(--nd-field); border-radius: var(--nd-radius); background-color: var(--nd-panel); color: var(--nd-ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
body.nd button:hover { background-color: #f3f6f5; border-color: #9fb0aa; }
body.nd button:focus-visible, body.nd .button:focus-visible { outline: 2px solid var(--nd-accent); outline-offset: 2px; }
body.nd button:disabled { opacity: .55; cursor: default; }
body.nd button.small, body.nd .button.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
body.nd button.primary, body.nd a.button.primary { min-height: 44px; padding: 0 18px; background-color: var(--nd-accent); border-color: var(--nd-accent); color: #fff; font-weight: 600; }
body.nd button.primary:hover, body.nd a.button.primary:hover { background-color: var(--nd-accent-hover); border-color: var(--nd-accent-hover); }
body.nd button.danger { background-color: var(--nd-bad-bg); border-color: var(--nd-bad-line); color: var(--nd-bad); font-weight: 600; }
body.nd button.danger:hover { background-color: #f7ddd7; border-color: var(--nd-bad); }
body.nd button.quiet { border-color: transparent; background: none; color: var(--nd-link); }
body.nd button.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--nd-link); text-decoration: underline; }
body.nd button.link:hover { background: none; color: var(--nd-link-hover); }
.btns { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }

/* tags and banners: a tinted background with dark text of the same family */
body.nd .tag { display: inline-block; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 22px; padding: 0 10px; background: var(--nd-pill); color: var(--nd-ink-2); white-space: nowrap; }
body.nd .tag.good { background: var(--nd-good-bg); color: var(--nd-good); } body.nd .tag.warn { background: var(--nd-warn-bg); color: var(--nd-warn); }
body.nd .tag.bad { background: var(--nd-bad-bg); color: var(--nd-bad); } body.nd .tag.info { background: var(--nd-info-bg); color: var(--nd-info); }
.banner { border-radius: var(--nd-radius); padding: 10px 12px; border: 1px solid transparent; }
.banner.good { background: var(--nd-good-bg); color: var(--nd-good); border-color: var(--nd-good-line); }
.banner.warn { background: var(--nd-warn-bg); color: var(--nd-warn); border-color: var(--nd-warn-line); }
.banner.bad { background: var(--nd-bad-bg); color: var(--nd-bad); border-color: var(--nd-bad-line); }
.banner.info { background: var(--nd-info-bg); color: var(--nd-info); border-color: var(--nd-info-line); }
.ok-text { color: var(--nd-good); } .bad-text { color: var(--nd-bad); } .warn-text { color: var(--nd-warn); }

/* top bar: white, a hairline, Menu button, logo, store picker pill */
.nd-top { position: sticky; top: 0; z-index: 20; flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  min-height: var(--nd-top-h); box-sizing: border-box; background: var(--nd-panel); border-bottom: 1px solid var(--nd-line);
  padding: max(6px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left)); }
body.nd .nd-menu-btn { min-height: 44px; min-width: 44px; padding: 0 12px; gap: 8px; }
.nd-logo { flex: 0 0 auto; font: 600 18px var(--nd-font-head); color: var(--nd-ink) !important; text-decoration: none; letter-spacing: -.01em; white-space: nowrap; }
.nd-co { margin: 0 0 0 auto; min-width: 0; flex: 0 1 auto; display: flex; }
body.nd .nd-co select { min-height: 36px; width: 100%; max-width: 240px; padding: 4px 30px 4px 12px; background-color: var(--nd-pill); border: 1px solid transparent; border-radius: 999px; font-weight: 600; font-size: 14px; text-overflow: ellipsis; }
@media (max-width: 520px) { .nd-hide-xs { display: none; } }
@media (min-width: 701px) { .nd-top { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); } }

/* page, sections, cards */
main.nd-main { flex: 1 0 auto; width: 100%; padding: 16px 20px 28px; min-width: 0; }
.nd-page { display: flex; flex-direction: column; gap: 16px; min-width: 0; max-width: 1280px; margin: 0 auto; }
.nd-page.narrow { max-width: 720px; } .nd-page.mid { max-width: 1100px; }
.nd-card, .nd-sec { background: var(--nd-panel); border: 1px solid var(--nd-line); border-radius: var(--nd-radius); padding: 14px 16px; min-width: 0; }
.nd-sec { display: flex; flex-direction: column; gap: 12px; }
.nd-sec.bare { padding: 0; border: 0; background: none; }
.nd-sec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.nd-sec-note { color: var(--nd-ink-2); font-size: 14px; }
.nd-num { display: inline-block; font: 600 12px/1.4 var(--nd-font); padding: 1px 6px; background: var(--nd-chip-dark); color: #fff; border-radius: var(--nd-radius-chip); }
.nd-h1-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.nd-h1-row h1 { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row-gap { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.empty { padding: 18px 8px; color: var(--nd-ink-2); text-align: center; }
.placeholder { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; max-width: 640px; }
.placeholder .big { font: 600 18px var(--nd-font-head); }
@media (max-width: 700px) { main.nd-main { padding: 12px 12px 24px; } }

/* a page that fills the phone screen under the top bar and never scrolls itself (body class "fill") */
body.nd.fill { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.nd.fill main.nd-main { flex: 1 1 auto; min-height: 0; padding: 0; max-width: none; display: flex; flex-direction: column; overflow: hidden; }

/* summary tiles */
.nd-boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.nd-box { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; background: var(--nd-panel); border: 1px solid var(--nd-line); border-radius: var(--nd-radius); color: var(--nd-ink); min-width: 0; text-align: left; }
.nd-box.warn { border-color: var(--nd-warn); } .nd-box.bad { border: 2px solid var(--nd-bad); padding: 13px 15px; }
a.nd-box { text-decoration: none; } a.nd-box:hover { border-color: var(--nd-accent); }
.nd-box-t { color: var(--nd-ink-2); font-size: 13px; }
.nd-box-n { font: 600 28px/1.15 var(--nd-font-head); font-variant-numeric: tabular-nums; }
.nd-box.bad .nd-box-n { color: var(--nd-bad); } .nd-box.warn .nd-box-n { color: var(--nd-warn); }

/* tables: .grid, and on a phone .grid.cards turns each row into a stacked card (td data-l="Label") */
.nd-scroll { overflow-x: auto; max-width: 100%; }
table.grid { width: 100%; border-collapse: collapse; border: 1px solid var(--nd-line); border-radius: var(--nd-radius); background: var(--nd-panel); }
.grid th { background: var(--nd-ground); color: var(--nd-ink-2); font-weight: 500; font-size: 13px; padding: 6px 8px; border-bottom: 1px solid var(--nd-line); text-align: left; white-space: nowrap; }
.grid td { padding: 6px 8px; height: 36px; border-bottom: 1px solid var(--nd-rule); vertical-align: middle; }
.grid tbody tr:hover td { background: #f6f9f8; }
.grid td.nm { font-weight: 600; }
.grid td.num, .grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
body.nd .grid a.nm-link { color: inherit; text-decoration: none; font-weight: 600; }
body.nd .grid a.nm-link:hover { text-decoration: underline; }
@media (max-width: 700px) {
  .grid.cards thead { display: none; } .grid.cards, .grid.cards tbody { display: block; border: 0; background: none; }
  .grid.cards tr { display: block; background: var(--nd-panel); border: 1px solid var(--nd-line); border-radius: var(--nd-radius); padding: 8px 4px; margin-bottom: 10px; }
  .grid.cards td { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; height: auto; border: 0; padding: 3px 8px; align-items: center; }
  .grid.cards td::before { content: attr(data-l); color: var(--nd-ink-2); font-size: 13px; }
  .grid.cards td.nm { font-size: 16px; display: block; } .grid.cards td.nm::before { content: none; }
  .grid.cards td.num { text-align: left; }
}

/* queue rows */
.q { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; background: var(--nd-panel); border: 1px solid var(--nd-line); border-radius: var(--nd-radius); padding: 12px 16px; }
.q.amber { border-color: var(--nd-warn-line); border-left: 4px solid var(--nd-warn); }
.q .main { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 3px; } .q .main b { font-weight: 600; }
.q .tag { align-self: flex-start; }
.lst { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.lst li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 0; border-top: 1px solid var(--nd-rule); } .lst li:first-child { border-top: 0; }
.sub { color: var(--nd-ink-2); font-size: 13px; }

/* forms */
.fields, .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--nd-ink-2); min-width: 0; }
.field input, .field select, .field textarea { color: var(--nd-ink); font-size: 14px; width: 100%; }
.field .hint { font-size: 12px; color: var(--nd-ink-2); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--nd-ink); }
.check input { min-height: 0; width: 18px; height: 18px; margin-top: 2px; }
input.short { max-width: 140px; }
textarea.list { min-height: 130px; }
.nd-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.nd-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--nd-ink-2); min-width: 150px; flex: 1 1 150px; }

/* settings rows */
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px 24px; padding: 14px 0; border-top: 1px solid var(--nd-rule); }
.set-row.first { border-top: 0; }
.set-row form { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; }
.hist { margin: 4px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--nd-ink-2); }
@media (max-width: 700px) { .set-row { grid-template-columns: minmax(0, 1fr); } }

/* the Menu dialog */
.nd-menu { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); margin: 72px auto auto; padding: 16px; border: 1px solid var(--nd-field); border-radius: 12px; box-shadow: var(--nd-shadow); background: var(--nd-panel); color: var(--nd-ink); }
.nd-menu[open] { display: flex; flex-direction: column; gap: 14px; }
.nd-menu::backdrop { background: rgba(24,33,31,.28); }
.nd-menu-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nd-menu-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; overflow: auto; min-height: 0; }
.nd-menu-group { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nd-menu-group h3 { margin: 0 0 4px; color: var(--nd-ink-2); font: 600 12px var(--nd-font); letter-spacing: .04em; text-transform: uppercase; }
.nd-menu-group a { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border-radius: var(--nd-radius-field); color: var(--nd-ink); text-decoration: none; }
.nd-menu-group a:hover { background: var(--nd-accent-soft); }
.nd-menu-group a.on { background: var(--nd-accent-soft); box-shadow: inset 3px 0 0 var(--nd-accent); font-weight: 600; }
.nd-menu-group a:focus-visible, .nd-menu button:focus-visible { outline: 2px solid var(--nd-accent); outline-offset: -2px; }
.nd-menu-group.off, .nd-menu-group a.off { display: none; }
.nd-menu-none { color: var(--nd-ink-2); padding: 12px 4px; }
.nd-menu-user { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--nd-line); }
.nd-menu-who { min-width: 0; overflow-wrap: anywhere; }
.nd-menu-user form { margin: 0; }
@media (max-width: 700px) {
  .nd-menu { margin: 8px auto auto; width: calc(100vw - 16px); max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); padding: 12px; }
  .nd-menu[open] { overflow: auto; }
  .nd-menu-groups { grid-template-columns: minmax(0, 1fr); overflow: visible; }
}

/* sign-in */
body.nd.anon main.nd-main { display: flex; align-items: flex-start; justify-content: center; padding-top: 8vh; }
.card-login { width: min(440px, 100%); display: flex; flex-direction: column; gap: 14px; }

/* hold-to-submit (app.js): the fill is a background layer, so the label stays above it */
button[data-hold] { --nd-fill: rgba(0, 0, 0, .32); position: relative; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  background-image: linear-gradient(var(--nd-fill), var(--nd-fill)); background-repeat: no-repeat; background-position: left center; background-size: 0% 100%;
  transition: background-size 160ms ease-out; }
button[data-hold]:not(.primary):not(.danger) { --nd-fill: rgba(11, 111, 102, .22); }
button.danger[data-hold] { --nd-fill: rgba(138, 43, 26, .2); }
button[data-hold].nd-holding { background-size: 100% 100%; transition: background-size var(--nd-hold-ms) linear; }
.nd-hold-msg { font-size: 13px; color: var(--nd-ink-2); }
@media (prefers-reduced-motion: reduce) {
  button[data-hold], button[data-hold].nd-holding { transition: none !important; background-size: 0% 100%; }
  button[data-hold].nd-holding { background-size: 100% 100%; outline: 3px solid var(--nd-accent); outline-offset: 2px; }  /* no motion: the button darkens at once; the delay is the same */
}

/* "updating" signal for htmx requests */
.nd-busy { position: relative; transition: opacity .15s; }
.nd-busy.htmx-request { opacity: .75; transition-delay: .12s; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* phones: 16px inputs (stops iOS zooming in), 44px touch targets */
@media (max-width: 700px) {
  body.nd input, body.nd select, body.nd textarea { font-size: 16px; }
  .field input, .field select, .field textarea, body.nd .nd-co select { font-size: 16px; }
}
@media (pointer: coarse) {
  body.nd input, body.nd select, body.nd textarea, body.nd button, body.nd .button { min-height: 44px; }
  body.nd button.small, body.nd .button.small { min-height: 44px; }
  body.nd button.link { min-height: 44px; padding: 0 6px; }
  body.nd .nd-co select { min-height: 44px; }
  .nd-menu-group a { min-height: 48px; }
  .check input { min-height: 0; width: 24px; height: 24px; }
  .grid td { height: 44px; }
}
