/* Nikotene stock - rebuild. iOS 26 look: system palette, Liquid Glass chrome,
   inset grouped lists. Light and dark follow the device; the tint is the
   brand red. Nothing here depends on a webfont, so the app paints at once. */

/* ---------- tokens ---------- */
:root {
  --tint: #EA0029; --tint-on: #fff;
  --bg: #F2F2F7; --bg2: #FFFFFF; --bg3: #F2F2F7;
  --label: #000; --label2: rgba(60,60,67,.6); --label3: rgba(60,60,67,.3); --label4: rgba(60,60,67,.18);
  --sep: rgba(60,60,67,.29); --fill: rgba(120,120,128,.12); --fill2: rgba(120,120,128,.16); --fill3: rgba(118,118,128,.08);
  --green: #34C759; --orange: #FF9500; --red: #FF3B30; --blue: #007AFF; --gray: #8E8E93; --yellow: #FFCC00;
  --glass: rgba(255,255,255,.58); --glass-strong: rgba(255,255,255,.74);
  --glass-rim: rgba(255,255,255,.85); --glass-edge: rgba(0,0,0,.08);
  --glass-shadow: 0 10px 30px rgba(0,0,0,.14), 0 2px 6px rgba(0,0,0,.06);
  --glass-sheen: linear-gradient(180deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,0) 45%);
  --veil: rgba(0,0,0,.28);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --dock-h: 62px; --dock-gap: max(12px, var(--safe-b));
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tint: #EA0029;
    --bg: #000; --bg2: #1C1C1E; --bg3: #2C2C2E;
    --label: #fff; --label2: rgba(235,235,245,.6); --label3: rgba(235,235,245,.3); --label4: rgba(235,235,245,.16);
    --sep: rgba(84,84,88,.6); --fill: rgba(118,118,128,.24); --fill2: rgba(118,118,128,.32); --fill3: rgba(118,118,128,.14);
    --green: #30D158; --orange: #FF9F0A; --red: #FF453A; --blue: #0A84FF; --gray: #8E8E93; --yellow: #FFD60A;
    --glass: rgba(40,40,44,.52); --glass-strong: rgba(52,52,56,.7);
    --glass-rim: rgba(255,255,255,.22); --glass-edge: rgba(0,0,0,.5);
    --glass-shadow: 0 10px 30px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.3);
    --glass-sheen: linear-gradient(180deg, rgba(255,255,255,.12) 0%, rgba(255,255,255,0) 45%);
    --veil: rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  --tint: #EA0029;
  --bg: #000; --bg2: #1C1C1E; --bg3: #2C2C2E;
  --label: #fff; --label2: rgba(235,235,245,.6); --label3: rgba(235,235,245,.3); --label4: rgba(235,235,245,.16);
  --sep: rgba(84,84,88,.6); --fill: rgba(118,118,128,.24); --fill2: rgba(118,118,128,.32); --fill3: rgba(118,118,128,.14);
  --green: #30D158; --orange: #FF9F0A; --red: #FF453A; --blue: #0A84FF; --gray: #8E8E93; --yellow: #FFD60A;
  --glass: rgba(40,40,44,.52); --glass-strong: rgba(52,52,56,.7);
  --glass-rim: rgba(255,255,255,.22); --glass-edge: rgba(0,0,0,.5);
  --glass-shadow: 0 10px 30px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.3);
  --glass-sheen: linear-gradient(180deg, rgba(255,255,255,.12) 0%, rgba(255,255,255,0) 45%);
  --veil: rgba(0,0,0,.5);
}

/* ---------- base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { background: var(--bg); color: var(--label); font-family: var(--font); font-size: 17px; line-height: 1.3;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; touch-action: manipulation; overscroll-behavior: none; }
body { min-height: 100vh; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; background: none; border: 0; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; text-align: inherit; }
a { color: var(--tint); text-decoration: none; }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--label2); }
.amber { color: var(--orange); } .red { color: var(--red); } .green { color: var(--green); }
::selection { background: color-mix(in srgb, var(--tint) 25%, transparent); }
:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- Liquid Glass ----------
   Translucent material, bright rim, soft sheen, over a blurred and saturated
   copy of what scrolls beneath. Safari has no displacement filter for
   backdrops, so the lens is suggested with light rather than refraction. */
.glass { position: relative; background: var(--glass); backdrop-filter: blur(14px) saturate(190%); -webkit-backdrop-filter: blur(14px) saturate(190%);
  box-shadow: var(--glass-shadow), inset 0 0 0 .5px var(--glass-rim), inset 0 1px 1px var(--glass-rim), inset 0 -1px 1px var(--glass-edge); }
.glass::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--glass-sheen); pointer-events: none; }

/* ---------- shell ---------- */
#app { min-height: 100vh; min-height: 100dvh; }
#side { display: none; }
.pane { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(var(--dock-h) + var(--dock-gap) + 28px); }
#pane-detail { display: none; }
body.has-detail #pane-list { display: none; }
body.has-detail #pane-detail { display: block; }
body.no-dock .pane { padding-bottom: calc(var(--safe-b) + 28px); }
body.has-fab .pane { padding-bottom: calc(var(--dock-h) + var(--dock-gap) + 28px); }
.view { max-width: 680px; margin: 0 auto; }

/* nav bar */
.nav { position: sticky; top: 0; z-index: 20; padding: calc(var(--safe-t) + 6px) 16px 6px; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: calc(var(--safe-t) + 50px); }
.nav::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(var(--bg) 55%, color-mix(in srgb, var(--bg) 0%, transparent)); pointer-events: none; }
.nav .lead { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.nav .trail { display: flex; align-items: center; gap: 8px; flex: none; }
.nav .ttl { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Screen name beside the wordmark, sharing its baseline: the wordmark's
   baseline is the foot of the "i" (y 66.79 of 67.92), half a pixel from the
   image's bottom edge, which is where flex puts a replaced element's baseline.
   Cap height of the title = x-height of the wordmark: 52.11/67.92 of 17px is
   13.04px, over SF's 0.705 cap height = 18.5px. */
.brand { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.brand .logo { height: 17px; width: auto; flex: none; fill: var(--label); }
.brand h1 { font-size: 18.5px; font-weight: 600; letter-spacing: -.2px; white-space: nowrap; }
.meta { font-size: 13px; color: var(--label2); padding: 0 16px 10px; }

/* round glass buttons */
.gbtn { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--label); flex: none; }
.gbtn svg.i { width: 17px; height: 17px; stroke-width: 2; }
.gbtn.back svg.i { width: 18px; height: 18px; stroke-width: 2.4; }
.gpair { display: inline-flex; border-radius: 16px; height: 32px; align-items: center; padding: 0 3px; gap: 2px; }
.gpair .gbtn { background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.gpair .gbtn::before { display: none; }
.gbtn:active, .gpair .gbtn:active { transform: scale(.92); }
.gbtn.spin svg.i { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.gtext { height: 32px; padding: 0 14px; border-radius: 16px; display: inline-flex; align-items: center; font-size: 15px; font-weight: 600; color: var(--tint); }

/* page heading for detail screens */
.hero { padding: 4px 16px 14px; }
.hero h2 { font-size: 28px; font-weight: 700; letter-spacing: .2px; line-height: 1.15; }
.hero .sub { font-size: 15px; color: var(--label2); margin-top: 4px; }
.hero .tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- dock: floating tab bar + search ---------- */
#dock { position: fixed; left: 50%; transform: translateX(-50%); bottom: var(--dock-gap); width: min(calc(100% - 32px), 520px); z-index: 40; display: flex; gap: 10px; align-items: center; }
body.no-dock #dock { display: none; }
.tabbar { flex: 1; height: var(--dock-h); border-radius: calc(var(--dock-h) / 2); display: flex; align-items: center; padding: 4px; min-width: 0; }
.tab { flex: 1; height: calc(var(--dock-h) - 8px); border-radius: 27px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; font-weight: 600; color: var(--label); position: relative; z-index: 1; min-width: 0; }
.tab svg.i { width: 24px; height: 24px; stroke-width: 1.8; }
.tab.on { color: var(--tint); }
.tab.on::after { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; background: color-mix(in srgb, var(--tint) 13%, var(--glass-strong));
  box-shadow: inset 0 0 0 .5px var(--glass-rim), inset 0 1px 1px var(--glass-rim), 0 1px 4px rgba(0,0,0,.08); }
.tab:active { transform: scale(.95); }
.badge { position: absolute; top: 2px; left: calc(50% + 5px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; padding: 0 5px; box-shadow: 0 0 0 2px var(--glass-strong); }
.solo { width: var(--dock-h); height: var(--dock-h); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--label); flex: none; }
.solo svg.i { width: 24px; height: 24px; stroke-width: 2; }
/* search open: the circle grows into a field, the tabs shrink to one */
.searchfield { flex: 1; height: var(--dock-h); border-radius: calc(var(--dock-h) / 2); display: flex; align-items: center; gap: 8px; padding: 0 8px 0 18px; }
.searchfield svg.i { width: 20px; height: 20px; color: var(--label2); }
.searchfield input { flex: 1; min-width: 0; font-size: 17px; height: 100%; outline: none; }
.searchfield input::placeholder { color: var(--label2); }
.searchfield .x { width: 30px; height: 30px; border-radius: 50%; background: var(--fill2); display: flex; align-items: center; justify-content: center; color: var(--label2); }
.searchfield .x svg.i { width: 14px; height: 14px; stroke-width: 2.6; }
#dock.searching .tabbar { flex: 0 0 var(--dock-h); padding: 4px; }
#dock.searching .tab:not(.on) { display: none; }
#dock.searching .tab.on { font-size: 0; gap: 0; }
#dock.searching .tab.on .badge { display: none; }

/* floating action (order screen, forms) */
.fab { flex: 1; height: var(--dock-h); border-radius: calc(var(--dock-h) / 2); display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 600; color: #fff;
  background: color-mix(in srgb, var(--tint) 90%, transparent); backdrop-filter: blur(14px) saturate(190%); -webkit-backdrop-filter: blur(14px) saturate(190%);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--tint) 38%, transparent), inset 0 1px 1px rgba(255,255,255,.45), inset 0 0 0 .5px rgba(255,255,255,.35), inset 0 -1px 1px rgba(0,0,0,.15); }
.fab:disabled { background: var(--glass-strong); color: var(--label3); box-shadow: var(--glass-shadow), inset 0 0 0 .5px var(--glass-rim); }
.fabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: var(--dock-gap); width: min(calc(100% - 32px), 520px); z-index: 40; display: flex; gap: 10px; align-items: center; }

/* ---------- segmented control ---------- */
.seg { margin: 0 16px 14px; display: flex; background: var(--fill); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { flex: 1; text-align: center; font-size: 13px; font-weight: 500; padding: 6px 4px; border-radius: 7px; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.seg button.on { background: var(--bg2); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); font-weight: 600; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button.on { background: #636366; } }
:root[data-theme="dark"] .seg button.on { background: #636366; }
.seg .n { color: var(--label2); font-weight: 400; margin-left: 3px; }
.seg .n.warn { color: var(--orange); font-weight: 600; }
.seg.scroll { overflow-x: auto; scrollbar-width: none; }
.seg.scroll::-webkit-scrollbar { display: none; }
.seg.scroll button { flex: 1 0 auto; padding: 6px 10px; }

/* ---------- inset grouped lists ---------- */
.sec { margin: 0 16px 22px; }
.sec-h { font-size: 13px; color: var(--label2); text-transform: uppercase; padding: 0 16px 7px; letter-spacing: -.08px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sec-h .act { text-transform: none; font-size: 15px; color: var(--tint); letter-spacing: 0; }
.sec-f { font-size: 13px; color: var(--label2); padding: 7px 16px 0; line-height: 1.4; }
.list { background: var(--bg2); border-radius: 12px; overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 44px; position: relative; width: 100%; color: inherit; }
.li + .li::before, .li + .li-wrap::before, .li-wrap + .li::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--sep); }
.li.ind + .li.ind::before { left: 58px; }
button.li:active, a.li:active { background: var(--fill3); }
.li .main { flex: 1; min-width: 0; padding: 11px 0; }
.li .t { font-size: 17px; letter-spacing: -.41px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .t.wrap { white-space: normal; }
.li .d { font-size: 13px; color: var(--label2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .d.wrap { white-space: normal; line-height: 1.35; }
.li .v { font-size: 17px; color: var(--label2); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.li .v.strong { color: var(--label); }
.li .v small { font-size: 13px; color: var(--label2); margin-left: 2px; }
.li .v .s { display: block; font-size: 13px; color: var(--label2); }
.li.dim .t, .li.dim .v { color: var(--label2); }
.li.danger .t { color: var(--red); }
.li.tint .t { color: var(--tint); }
.li.center { justify-content: center; }
.li.center .t { color: var(--tint); }
.chev { width: 8px; height: 13px; stroke: var(--label3); stroke-width: 2.2; fill: none; flex: none; }
.icon-tile { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.icon-tile svg.i { width: 18px; height: 18px; stroke-width: 2; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.empty { padding: 40px 32px; text-align: center; color: var(--label2); font-size: 15px; line-height: 1.45; }
.empty b { display: block; color: var(--label); font-size: 17px; margin-bottom: 4px; font-weight: 600; }
.loading { padding: 48px 0; text-align: center; color: var(--label2); font-size: 15px; }

/* collapsible section */
.sec.fold > .sec-h { cursor: pointer; }
.sec.fold > .sec-h .tw { display: inline-flex; align-items: center; gap: 6px; }
.sec.fold > .sec-h .car { width: 10px; height: 10px; stroke: currentColor; stroke-width: 2.4; fill: none; transition: transform .2s; }
.sec.fold.open > .sec-h .car { transform: rotate(90deg); }
.sec.fold:not(.open) > .body { display: none; }

/* pills / tags */
.pill { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 6px; white-space: nowrap; line-height: 1.35; vertical-align: 1px; }
.t .pill, .d .pill { margin-left: 6px; }
.d .pill:first-child { margin-left: 0; margin-right: 4px; }
.p-orange { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); }
.p-red { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.p-blue { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue); }
.p-green { background: color-mix(in srgb, var(--green) 17%, transparent); color: var(--green); }
.p-gray { background: var(--fill2); color: var(--label2); }
.p-tint { background: color-mix(in srgb, var(--tint) 13%, transparent); color: var(--tint); }

/* banners */
.banner { margin: 0 16px 16px; border-radius: 14px; padding: 12px 14px; background: var(--bg2); display: flex; gap: 12px; align-items: center; font-size: 15px; width: calc(100% - 32px); }
.banner .main { flex: 1; min-width: 0; }
.banner .t { font-weight: 600; }
.banner .d { font-size: 13px; color: var(--label2); margin-top: 1px; line-height: 1.35; }
.banner .act { color: var(--tint); font-weight: 500; flex: none; }
.banner.warn .icon-tile { background: var(--orange); }
.banner.err .icon-tile { background: var(--red); }
.banner.info .icon-tile { background: var(--blue); }
.note { margin: 0 16px 16px; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.4; background: var(--fill3); color: var(--label); }
.note.warn { background: color-mix(in srgb, var(--orange) 14%, transparent); }
.note.err { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.note .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* cards */
.card { margin: 0 16px 22px; background: var(--bg2); border-radius: 14px; padding: 16px; }
.card .k { font-size: 13px; color: var(--label2); }
.card .big { font-size: 28px; font-weight: 700; letter-spacing: .2px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.card .mid { font-size: 20px; font-weight: 600; margin-top: 3px; }
.card .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; margin-top: 14px; }
.card .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.card .v { font-size: 15px; margin-top: 2px; }
.cards2 { display: grid; grid-template-columns: 1fr; gap: 0; }

/* table inside a list (summary, lines) */
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: right; font-weight: 500; color: var(--label2); font-size: 12px; text-transform: uppercase; padding: 10px 16px 6px; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td { padding: 9px 16px; text-align: right; font-variant-numeric: tabular-nums; border-top: .5px solid var(--sep); }
.tbl tr.tot td { font-weight: 600; }
.tbl td.warn { color: var(--orange); }

/* ---------- buttons ---------- */
.btn { display: flex; width: 100%; height: 50px; border-radius: 14px; background: var(--tint); color: var(--tint-on); font-size: 17px; font-weight: 600; align-items: center; justify-content: center; gap: 8px; }
.btn.plain { background: var(--fill); color: var(--tint); }
.btn.gray { background: var(--fill); color: var(--label); }
.btn.danger { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.btn.amber { background: var(--orange); color: #fff; }
.btn:disabled { opacity: .45; }
.btn:active:not(:disabled) { transform: scale(.985); filter: brightness(.96); }
.btns { margin: 0 16px 22px; display: flex; flex-direction: column; gap: 10px; }
.btns.row { flex-direction: row; }
.btns.row .btn { flex: 1; }
.lnk { color: var(--tint); font-size: 15px; font-weight: 500; }
.lnk.danger { color: var(--red); }
.chipbtn { height: 32px; padding: 0 14px; border-radius: 16px; background: var(--fill); color: var(--label); font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; }
.chipbtn.tint { background: color-mix(in srgb, var(--tint) 13%, transparent); color: var(--tint); }

/* ---------- forms ---------- */
.form .li { min-height: 48px; }
.fl { display: block; width: 100%; padding: 8px 0 9px; }
.fl > span { display: block; font-size: 12px; color: var(--label2); margin-bottom: 2px; }
.in { width: 100%; font-size: 17px; outline: none; padding: 2px 0; color: var(--label); min-height: 26px; }
.in::placeholder { color: var(--label3); }
.in.num { font-variant-numeric: tabular-nums; }
input.in[type="date"], input.in[type="time"] { -webkit-appearance: none; appearance: none; min-height: 26px; text-align: left; display: block; }
input.in[type="date"]::-webkit-date-and-time-value, input.in[type="time"]::-webkit-date-and-time-value { text-align: left; }
select.in { -webkit-appearance: none; appearance: none; padding-right: 22px; background: no-repeat right 2px center / 12px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238E8E93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
select.in:has(option[value=""]:checked) { color: var(--label3); }
textarea.in { resize: vertical; min-height: 60px; line-height: 1.35; }
.inline2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.err-t { color: var(--red); font-size: 14px; padding: 0 16px 12px; min-height: 0; }
.err-t:empty { display: none; }

/* iOS switch */
.sw { position: relative; width: 51px; height: 31px; flex: none; }
.sw input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 1; }
.sw span { position: absolute; inset: 0; border-radius: 16px; background: var(--fill2); transition: background .2s; }
.sw span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .2s; }
.sw input:checked + span { background: var(--green); }
.sw input:checked + span::after { transform: translateX(20px); }
.sw input:disabled + span { opacity: .5; }

/* multi-select chips (assignees) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0 12px; }
.chips button { height: 34px; padding: 0 14px; border-radius: 17px; background: var(--fill); font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.chips button.on { background: var(--tint); color: #fff; }
.chips button svg.i { width: 15px; height: 15px; stroke-width: 2.6; }

/* ---------- sheet ---------- */
#veil { position: fixed; inset: 0; background: var(--veil); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .25s; }
#veil.on { opacity: 1; pointer-events: auto; }
#sheet { position: fixed; left: 8px; right: 8px; bottom: max(8px, var(--safe-b)); z-index: 61; max-height: calc(100dvh - var(--safe-t) - 40px); border-radius: 34px; overflow: hidden;
  background: var(--glass-strong); backdrop-filter: blur(30px) saturate(190%); -webkit-backdrop-filter: blur(30px) saturate(190%);
  box-shadow: var(--glass-shadow), inset 0 0 0 .5px var(--glass-rim), inset 0 1px 1px var(--glass-rim);
  transform: translateY(calc(100% + 40px)); transition: transform .32s cubic-bezier(.32,.72,0,1); display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }
#sheet.on { transform: none; }
#sheet.tall { height: calc(100dvh - var(--safe-t) - 40px); }
#sheet .grab { width: 36px; height: 5px; border-radius: 3px; background: var(--label3); margin: 7px auto 0; flex: none; }
#sheet .sbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 4px; gap: 8px; flex: none; min-height: 48px; }
#sheet .sbar .ttl { font-size: 17px; font-weight: 600; text-align: center; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sheet .sbar .side { flex: 0 0 76px; display: flex; }
#sheet .sbar .side.r { justify-content: flex-end; }
#sheet .sbody { overflow-y: auto; padding: 6px 0 18px; -webkit-overflow-scrolling: touch; }
#sheet .ssub { text-align: center; font-size: 13px; color: var(--label2); padding: 0 24px 12px; line-height: 1.35; }
#sheet .list, #sheet .card { background: color-mix(in srgb, var(--bg2) 86%, transparent); }
#sheet .sec { margin-left: 12px; margin-right: 12px; }
#sheet .btns, #sheet .card, #sheet .note { margin-left: 12px; margin-right: 12px; }

/* dialog (confirm) */
#dlg { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--veil); }
#dlg .box { width: min(300px, 100%); border-radius: 22px; padding: 20px 18px 14px; text-align: center; background: var(--glass-strong); backdrop-filter: blur(30px) saturate(190%); -webkit-backdrop-filter: blur(30px) saturate(190%);
  box-shadow: var(--glass-shadow), inset 0 0 0 .5px var(--glass-rim); }
#dlg h3 { font-size: 17px; font-weight: 600; }
#dlg p { font-size: 13px; color: var(--label); margin-top: 6px; line-height: 1.4; }
#dlg .acts { display: flex; gap: 8px; margin-top: 18px; }
#dlg .acts button { flex: 1; height: 44px; border-radius: 22px; background: var(--fill); font-size: 17px; font-weight: 500; text-align: center; }
#dlg .acts button.pri { background: var(--tint); color: #fff; font-weight: 600; }
#dlg .acts button.danger { background: var(--red); color: #fff; font-weight: 600; }

/* toast */
#toast { position: fixed; left: 50%; bottom: calc(var(--dock-h) + var(--dock-gap) + 14px); transform: translate(-50%, 10px); z-index: 90; max-width: calc(100% - 48px);
  padding: 11px 18px; border-radius: 22px; font-size: 15px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; text-align: center; line-height: 1.3; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
body.no-dock #toast { bottom: calc(var(--safe-b) + 24px); }

/* image viewer */
#viewer { position: fixed; inset: 0; z-index: 85; background: #000; display: flex; align-items: center; justify-content: center; }
#viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
#viewer .x { position: absolute; top: calc(var(--safe-t) + 12px); right: 14px; }

/* login */
.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px calc(32px + var(--safe-b)); }
.login .logo { height: 26px; fill: var(--label); margin-bottom: 40px; }
.login form { width: 100%; max-width: 340px; }
.login .list { margin-bottom: 14px; }
.login .foot { margin-top: 36px; font-size: 12px; color: var(--label3); }

/* stock rows */
.qty { font-variant-numeric: tabular-nums; color: var(--label); }
.qty.low { color: var(--orange); }
.qty.out { color: var(--red); }

/* delivery photo */
.photo { display: block; width: 100%; border-radius: 10px; background: var(--fill); min-height: 120px; object-fit: cover; }

/* ---------- wide: sidebar + list + detail (iPad landscape, Mac) ---------- */
@media (min-width: 1024px) {
  body { background: var(--bg2); }
  #app { display: grid; grid-template-columns: 250px 380px 1fr; height: 100vh; height: 100dvh; overflow: hidden; }
  #side { display: flex; flex-direction: column; margin: 10px; border-radius: 20px; padding: 18px 10px 12px; overflow: auto; }
  #side .logo { height: 16px; margin: 6px 12px 22px; fill: var(--label); width: auto; align-self: flex-start; }
  #side a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; font-size: 15px; color: var(--label); position: relative; }
  #side a svg.i { width: 20px; height: 20px; color: var(--tint); }
  #side a.on { background: var(--fill2); font-weight: 600; }
  #side a .n { margin-left: auto; font-size: 13px; color: var(--label2); font-weight: 500; }
  #side a .n.hot { color: #fff; background: var(--red); border-radius: 9px; padding: 1px 7px; font-size: 12px; }
  #side .grp { font-size: 11px; font-weight: 600; color: var(--label2); text-transform: uppercase; padding: 18px 12px 6px; letter-spacing: .3px; }
  #side .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 12px; font-size: 14px; border-radius: 10px; }
  #side .me:hover { background: var(--fill3); }
  .pane { min-height: 0; height: 100%; overflow-y: auto; padding-bottom: 32px; }
  #pane-list { border-right: .5px solid var(--sep); background: var(--bg2); }
  #pane-detail { display: block; background: var(--bg); }
  body.has-detail #pane-list { display: block; }
  body.wide #pane-detail { display: none !important; }
  body.wide #app { grid-template-columns: 250px 1fr; }
  #dock { display: none !important; }
  body.has-fab .pane { padding-bottom: 32px; }
  .fabbar { position: sticky; left: auto; transform: none; bottom: 16px; width: auto; margin: 8px 16px 0; }
  #pane-list .nav::after { background: linear-gradient(var(--bg2) 55%, color-mix(in srgb, var(--bg2) 0%, transparent)); }
  #pane-list .list { background: transparent; border-radius: 0; }
  #pane-list .sec { margin: 0 8px 18px; }
  #pane-list .sec-h { padding: 0 10px 6px; }
  #pane-list .li { border-radius: 10px; padding: 0 10px; }
  #pane-list .li + .li::before { left: 10px; right: 10px; }
  #pane-list .li.on { background: var(--tint); color: #fff; }
  #pane-list .li.on .d, #pane-list .li.on .v, #pane-list .li.on .v small, #pane-list .li.on .qty { color: rgba(255,255,255,.85); }
  #pane-list .li.on .pill { background: rgba(255,255,255,.22); color: #fff; }
  #pane-list .li.on .chev { stroke: rgba(255,255,255,.7); }
  #pane-list .li.on::before, #pane-list .li.on + .li::before { display: none; }
  #pane-list .listsearch { display: flex; }
  .detail-empty { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--label3); font-size: 17px; }
  .view { max-width: 820px; }
  #toast { bottom: 28px; }
  #sheet { left: 50%; right: auto; width: 520px; transform: translate(-50%, calc(100% + 40px)); bottom: 24px; }
  #sheet.on { transform: translate(-50%, 0); }
  #sheet.tall { height: min(860px, calc(100dvh - 60px)); }
  .cards2 { grid-template-columns: 1fr 1fr; gap: 16px; margin: 0 16px 22px; }
  .cards2 .card { margin: 0; }
  .gbtn.back.phone-only { display: none; }
}
.listsearch { display: none; margin: 0 16px 12px; height: 36px; border-radius: 10px; background: var(--fill); align-items: center; gap: 6px; padding: 0 8px; color: var(--label2); }
.listsearch svg.i { width: 17px; height: 17px; stroke-width: 2.2; }
.listsearch input { flex: 1; min-width: 0; font-size: 17px; outline: none; color: var(--label); }
.listsearch input::placeholder { color: var(--label2); }
@media (min-width: 1024px) { #pane-list .listsearch { margin: 0 8px 12px; } }
@media (max-width: 1023px) { .wide-only { display: none !important; } }
@media (min-width: 1024px) { .phone-only { display: none !important; } }
input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; display: none; }

/* ---------- stock list: the original layout, in the new material ----------
   Name over its code, the tag beside the code, quantity on the right with a
   small unit. One flat list, as the app has always shown it. */
.fchips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 16px 14px; }
.fchips::-webkit-scrollbar { display: none; }
.fchip { flex: none; height: 32px; padding: 0 14px; border-radius: 16px; font-size: 14px; font-weight: 500; color: var(--label); background: var(--fill); display: inline-flex; align-items: center; gap: 6px; }
.fchip .cnt { color: var(--orange); font-weight: 600; font-variant-numeric: tabular-nums; }
.fchip.on { background: var(--label); color: var(--bg); }
.fchip.on .cnt { color: inherit; }
.srow { padding: 10px 16px; min-height: 58px; }
.srow .nm { font-size: 17px; letter-spacing: -.41px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow .cd { display: flex; align-items: center; gap: 8px; margin-top: 3px; font-family: var(--mono); font-size: 11.5px; letter-spacing: .3px; color: var(--label2); text-transform: uppercase; white-space: nowrap; overflow: hidden; }
.srow .cd .pill { font-family: var(--font); letter-spacing: 0; text-transform: none; margin: 0; }
.srow .q { font-size: 19px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--label); white-space: nowrap; }
.srow .q small { font-size: 12px; font-weight: 400; color: var(--label2); margin-left: 3px; }
.srow.low .q { color: var(--orange); } .srow.out .q { color: var(--red); }
#pane-list .srow, .srow { width: 100%; }
.srow .main { padding: 0; }
@media (min-width: 1024px) {
  /* The sidebar carries the wordmark; the list column takes a plain title. */
  #pane-list .brand .logo, body.wide #pane-list .brand .logo { display: none; }
  #pane-list .brand h1 { font-size: 26px; font-weight: 700; letter-spacing: .2px; }
  .fabbar { justify-content: flex-end; }
  .fabbar .fab { flex: 0 0 auto; min-width: 280px; padding: 0 28px; height: 50px; border-radius: 25px; }
  #pane-detail .view, body.wide #pane-list .view { padding-top: 8px; }
}
@media (min-width: 1024px) {
  /* Full-width pages (Stock, Local, Settings) keep the phone's card look. */
  body.wide #pane-list { background: var(--bg); border-right: 0; }
  body.wide #pane-list .nav::after { background: linear-gradient(var(--bg) 55%, color-mix(in srgb, var(--bg) 0%, transparent)); }
  body.wide #pane-list .list { background: var(--bg2); border-radius: 12px; }
  body.wide #pane-list .sec { margin: 0 16px 22px; }
  body.wide #pane-list .li { border-radius: 0; padding: 0 16px; }
  body.wide #pane-list .li + .li::before { left: 16px; right: 0; }
  body.wide #pane-list .srow { padding: 10px 16px; }
}

/* ---------- buttons in brand red, solid ----------
   The see-through tint read as pink over dark backgrounds; buttons are now
   the brand red itself in both modes, and sized like iOS's own, not a slab. */
.fab { background: var(--tint); backdrop-filter: none; -webkit-backdrop-filter: none;
  box-shadow: 0 8px 22px rgba(234,0,41,.32), inset 0 1px 0 rgba(255,255,255,.22); }
.fab:active:not(:disabled) { filter: brightness(.92); transform: scale(.98); }
.fabbar { justify-content: center; pointer-events: none; }
.fabbar > * { pointer-events: auto; }
.fabbar .fab { flex: 0 0 auto; height: 50px; border-radius: 25px; padding: 0 30px; min-width: 220px; font-size: 17px; }
.chipbtn.tint { background: var(--tint); color: #fff; }
/* The selected tab sits on neutral glass; the red is in its icon and label. */
.tab.on::after { background: var(--glass-strong); }
@media (min-width: 1024px) { .fabbar { justify-content: flex-end; } .fabbar .fab { min-width: 260px; } }
/* labelled value, label on top (Contacts style) */
.kvrow .main { padding: 9px 0 10px; }
.kvrow .k { font-size: 13px; color: var(--label2); margin-bottom: 1px; }
/* Numbers stay in the text colour; the green phone tile says it dials. */
.kvrow .t.link { color: var(--label); }

/* search under the top bar */
.searchrow { display: none; align-items: center; gap: 12px; margin: 0 16px 12px; }
.searchrow.open { display: flex; }
.searchrow .listsearch { display: flex; margin: 0; flex: 1; }
.searchrow .lnk { font-size: 17px; font-weight: 400; flex: none; }
@media (min-width: 1024px) { .searchrow { display: flex; margin: 0 8px 12px; } body.wide .searchrow { margin: 0 16px 12px; } }
/* Errors and addresses are read in full, not cut at one line. */
.li.danger .t, .li.danger .d, .li.wrap .t, .li.wrap .d { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.35; }
.thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--fill); flex: none; margin: 8px 0; }
.thumb-bad { display: flex; align-items: center; justify-content: center; color: var(--label3); font-weight: 600; }
.li.danger .d { color: var(--red); }

/* ---------- PO mapping ---------- */
.track { flex: 1; height: 8px; border-radius: 4px; background: var(--fill2); overflow: hidden; }
.track i { display: block; height: 100%; background: var(--green); border-radius: 4px; }
.mcard { background: var(--bg2); border-radius: 14px; padding: 14px 14px 12px; margin-bottom: 12px; }
.mcard.done { padding: 12px 14px; opacity: .75; }
.mdesc { font-size: 16px; font-weight: 600; line-height: 1.3; margin-bottom: 6px; }
.monpo { font-size: 13px; color: var(--label2); line-height: 1.5; margin-bottom: 10px; }
.monpo b { color: var(--label); }
.mform { background: var(--fill3) !important; border-radius: 10px; }
.mform .li { padding: 0 12px; }
.mtags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0 0; font-size: 13px; }
.mcalc { font-size: 14px; line-height: 1.5; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--fill3); font-variant-numeric: tabular-nums; }
.mwhy { font-size: 13px; color: var(--label2); line-height: 1.45; margin-top: 8px; }
.mwhy b { color: var(--label); font-weight: 600; }
.mbtns { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.msettled { display: flex; align-items: center; gap: 8px; color: var(--green); font-size: 15px; font-weight: 500; }
.msettled svg.i { width: 18px; height: 18px; }
.fmtrow { align-items: center; }
.fmtrow .lnk { flex: none; padding: 6px; color: var(--label3); }
.fmtrow .lnk svg.i { width: 16px; height: 16px; }
details.mailrow { display: block; padding: 0 16px; }
details.mailrow summary { list-style: none; cursor: pointer; }
details.mailrow summary::-webkit-details-marker { display: none; }
details.mailrow .chips { gap: 6px; }
.mailbody { white-space: pre-wrap; font: 13px/1.45 var(--mono); color: var(--label2); background: var(--fill3); border-radius: 10px; padding: 10px 12px; margin: 4px 0 12px; max-height: 320px; overflow: auto; }

/* ---------- document scanner ---------- */
#scanner { position: fixed; inset: 0; z-index: 95; background: #000; color: #fff; display: flex; flex-direction: column; }
#scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#scanner .sc-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#scanner .sc-top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(var(--safe-t) + 10px) 14px 0; }
#scanner .sc-top .gbtn { color: #fff; --glass: rgba(40,40,44,.5); --glass-rim: rgba(255,255,255,.25); }
#scanner .sc-hint { padding: 7px 14px; border-radius: 16px; font-size: 14px; font-weight: 500; color: #fff; --glass: rgba(40,40,44,.55); --glass-rim: rgba(255,255,255,.2); text-align: center; }
#scanner .sc-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 18px 28px calc(var(--safe-b) + 22px); background: linear-gradient(transparent, rgba(0,0,0,.55)); }
#scanner .sc-side { width: 72px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; font-size: 12px; font-weight: 500; }
#scanner .sc-side svg.i { width: 26px; height: 26px; }
#scanner .sc-shutter { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; display: flex; align-items: center; justify-content: center; }
#scanner .sc-shutter span { width: 60px; height: 60px; border-radius: 50%; background: #fff; transition: transform .1s; }
#scanner .sc-shutter:active span { transform: scale(.9); }
#scanner .sc-go { width: auto; min-width: 150px; padding: 0 28px; border-radius: 25px; }
#scanner .sc-stage { position: absolute; inset: calc(var(--safe-t) + 64px) 16px calc(var(--safe-b) + 120px); display: flex; align-items: center; justify-content: center; touch-action: none; }
#scanner .sc-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
#scanner .sc-result .sc-img { background: #fff; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
#scanner .sc-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#scanner .sc-poly { fill: rgba(234,0,41,.16); stroke: #EA0029; stroke-width: 2.5; }
#scanner .sc-h { fill: #fff; stroke: #EA0029; stroke-width: 3; cursor: grab; }
/* second, quieter floating button beside the main one */
.fabbar .fab.fab2 { min-width: 0; padding: 0 22px; color: var(--label); background: var(--glass-strong); box-shadow: var(--glass-shadow), inset 0 0 0 .5px var(--glass-rim), inset 0 1px 1px var(--glass-rim); backdrop-filter: blur(14px) saturate(190%); -webkit-backdrop-filter: blur(14px) saturate(190%); }
.fabbar .fab svg.i { width: 20px; height: 20px; }
/* beta marker */
.beta-strip { position: fixed; top: 0; left: 0; right: 0; z-index: 100; padding: calc(var(--safe-t) + 2px) 12px 3px; background: var(--orange); color: #000; font-size: 11px; font-weight: 700; letter-spacing: .3px; text-align: center; text-transform: uppercase; pointer-events: none; }
body.is-beta .nav { padding-top: calc(var(--safe-t) + 24px); }
body.is-beta .login { padding-top: 48px; }
@media (min-width: 1024px) { body.is-beta #app { padding-top: 20px; } }
