/* Storli – «Lapp og nål» (docs/design.md): quiet native chrome, grouped lists, system type, one tint.
   The one thing with character is the box label (.lapp). */
:root {
  --bg: #f2f2f7; --surface: #ffffff; --fill: rgba(120, 120, 128, .12); --fill-2: rgba(120, 120, 128, .08);
  --ink: #000000; --ink-2: rgba(60, 60, 67, .72); --ink-3: rgba(60, 60, 67, .45); --sep: rgba(60, 60, 67, .29);
  --tint: #0b6e99; --tint-ink: #ffffff; --tint-soft: rgba(11, 110, 153, .12);
  --red: #d70015; --red-soft: rgba(255, 59, 48, .12); --green: #248a3d; --green-soft: rgba(52, 199, 89, .14); --switch-on: #34c759;
  --orange: #a8743f; --orange-soft: rgba(168, 116, 63, .14); /* legacy names: "waiting" is kraft now */
  --r: 12px; --r-l: 16px; --tabbar-h: 49px; --navbar-h: 44px; --sidebar-w: 260px;
  /* «Lapp og nål» tokens (docs/design.md §2) – same names as ios/Storli/Support/Tokens.swift */
  --kraft: #a8743f; --kraft-soft: rgba(168, 116, 63, .14); --paper: #fbf7f0; --ink-paper: #1c1c1e; --lapp-edge: rgba(0, 0, 0, .08);
  --place-fjord: #0b6e99; --place-mose: #4f7a4a; --place-lyng: #76609a; --place-rust: #a9532f;
  --place-kraft: #a8743f; --place-skifer: #56697a; --place-nype: #a54862; --place-rug: #8a7a3a;
  --r-pill: 5px; --r-lapp: 6px; --r-tile: 9px; --r-viewfinder: 18px;
  --num: ui-rounded, "SF Pro Rounded", var(--font);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --font-d: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --bar: color-mix(in srgb, var(--bg) 80%, transparent);
  color-scheme: light;
}
:root.dark {
    --bg: #000000; --surface: #1c1c1e; --fill: rgba(118, 118, 128, .24); --fill-2: rgba(118, 118, 128, .16);
    --ink: #ffffff; --ink-2: rgba(235, 235, 245, .7); --ink-3: rgba(235, 235, 245, .4); --sep: rgba(84, 84, 88, .65);
    --tint: #4fb2de; --tint-ink: #001a26; --tint-soft: rgba(79, 178, 222, .18);
    --red: #ff6961; --red-soft: rgba(255, 69, 58, .2); --green: #30d158; --green-soft: rgba(48, 209, 88, .18); --switch-on: #30d158;
    --orange: #e0a86e; --orange-soft: rgba(224, 168, 110, .16); color-scheme: dark;
    --kraft: #e0a86e; --kraft-soft: rgba(224, 168, 110, .14); --paper: #2a2622; --ink-paper: #f2ede6; --lapp-edge: rgba(255, 255, 255, .08);
    --place-fjord: #4fb2de; --place-mose: #8dbb84; --place-lyng: #b49fd6; --place-rust: #e58a64;
    --place-kraft: #e0a86e; --place-skifer: #9fb2c3; --place-nype: #e58aa3; --place-rug: #cdbb72;
    --bar: color-mix(in srgb, #161618 80%, transparent);
  }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.29; letter-spacing: -.41px; -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
html { touch-action: manipulation; }
body { min-height: 100vh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--tint); text-decoration: none; }
.wrap { max-width: 680px; margin: 0 auto; padding: 0 16px; }
.app { padding-bottom: calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); }
.safe-top { height: env(safe-area-inset-top); }

/* type (iOS Dynamic Type defaults) */
h1 { font-family: var(--font-d); font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .37px; margin: 2px 0 14px; overflow-wrap: anywhere; }
h2 { font-size: 13px; line-height: 18px; font-weight: 400; text-transform: uppercase; letter-spacing: .02em; color: var(--ink-2); margin: 24px 16px 7px; }
h3 { font-size: 17px; font-weight: 600; margin: 0 0 4px; }
p { margin: 0 0 10px; }
.muted { color: var(--ink-2); }
.small { font-size: 15px; line-height: 20px; letter-spacing: -.24px; }
.tiny { font-size: 13px; line-height: 18px; letter-spacing: -.08px; color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.warn-t { color: var(--kraft); }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 14px; }
.section { margin-top: 24px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.foot { font-size: 13px; line-height: 18px; color: var(--ink-2); margin: 7px 16px 0; letter-spacing: -.08px; }
details > summary { list-style: none; color: var(--tint); }
details > summary::-webkit-details-marker { display: none; }

/* ---------- navigation bar (sticky, material, hairline only once scrolled) */
.navbar { position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top); margin-top: calc(-1 * env(safe-area-inset-top));
  background: transparent; box-shadow: 0 .5px 0 transparent; transition: box-shadow .2s, background-color .2s; }
html.scrolled .navbar { background: var(--bar); backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px); box-shadow: 0 .5px 0 var(--sep); }
.navbar .in { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; height: var(--navbar-h); padding: 0 8px; }
.navbar .nt { font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw; opacity: 0; transition: opacity .2s; }
html.scrolled .navbar .nt { opacity: 1; }
.navbar .l, .navbar .r { display: flex; align-items: center; min-width: 0; }
.navbar .r { justify-content: flex-end; }
.nb-back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding-right: 8px; color: var(--tint); min-width: 0; }
.nb-back svg { width: 22px; height: 22px; flex: none; stroke-width: 2.4; margin-left: -2px; }
.nb-back span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-btn { width: 44px; height: 44px; border: 0; background: none; display: inline-grid; place-items: center; color: var(--tint); cursor: pointer; border-radius: 22px; flex: none; }
.nb-btn svg { width: 24px; height: 24px; stroke-width: 2; }
.nb-btn.txt { width: auto; padding: 0 8px; font-weight: 400; }
.nb-btn:disabled { opacity: .35; }
.nb-btn.busy svg { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- grouped lists (inset grouped table view) */
.card, .list { display: block; background: var(--surface); border-radius: var(--r); overflow: hidden; position: relative; }
.card.plain { background: none; }
.pad { padding: 16px; }
.list > *, .card > *, .menu > * { position: relative; }
/* one separator rule: inset by the row's --inset (64px after a tile/label, 16px for text rows) */
:is(.boxcard, .itemrow, .r, .addrow, .fr, .menu > *) + :is(.boxcard, .itemrow, .r, .addrow, .fr, .menu > *)::before {
  content: ""; position: absolute; top: 0; right: 0; left: var(--inset, 16px); height: 1px; transform: scaleY(.5); transform-origin: top; background: var(--sep); pointer-events: none; }

/* rows */
.boxcard { --inset: 64px; display: flex; gap: 12px; align-items: center; padding: 8px 16px; color: inherit; min-height: 60px; }
.boxcard.bx { min-height: 52px; padding-top: 6px; padding-bottom: 6px; }
.boxcard .meta { flex: 1; min-width: 0; }
.boxcard .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.boxcard .title > span { overflow: hidden; text-overflow: ellipsis; }
.boxcard .title .fragile { width: 13px; height: 13px; color: var(--red); flex: none; stroke-width: 2.2; }
.sub { font-size: 15px; line-height: 20px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.24px; margin-top: 1px; }
.sub .dot { display: inline-block; vertical-align: 1px; margin-right: 6px; }
.val { font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.24px; flex: none; }
.chev { width: 14px; height: 14px; color: var(--ink-3); flex: none; stroke-width: 2.6; margin-left: 2px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--kraft); flex: none; display: inline-block; }
.dot.quiet { background: var(--ink-3); }
.kraft-t { color: var(--kraft); font-size: 13px; font-weight: 600; letter-spacing: -.08px; white-space: nowrap; }
.ok-t { color: var(--green); font-size: 13px; font-weight: 600; letter-spacing: -.08px; white-space: nowrap; }
.itemrow { display: flex; align-items: center; gap: 12px; padding: 11px 16px; min-height: 44px; color: inherit; cursor: pointer; }
.itemrow.static { cursor: default; }
.itemrow .nm { font-weight: 400; }
.itemrow .qty { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.itemrow .val { margin-left: auto; }
.itemrow img { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; flex: none; }
.itemrow:has(> img) { --inset: 58px; }
.itemrow .ic { width: 22px; height: 22px; color: var(--ink-2); flex: none; stroke-width: 1.75; }
.itemrow:has(> .ic) { --inset: 50px; }
.itemrow.tint { color: var(--tint); }
.itemrow.danger { color: var(--red); justify-content: center; }
button.itemrow { width: 100%; border: 0; background: none; text-align: left; font: inherit; }
.boxcard:active, .itemrow[role=button]:active, a.itemrow:active, button.itemrow:active, .menu a:active, .menu button:active, label.itemrow:active { background: var(--fill-2); }
.code { min-width: 40px; padding: 2px 7px; border-radius: var(--r-pill); background: var(--fill); font-weight: 600; font-size: 15px; text-align: center; font-variant-numeric: tabular-nums; flex: none; }
.inline { width: 15px; height: 15px; vertical-align: -2px; }
.pill { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: var(--r-pill); font-size: 11px; font-weight: 600; letter-spacing: .06px;
  background: var(--kraft-soft); color: var(--kraft); white-space: nowrap; vertical-align: 2px; }
.pill.quiet { background: var(--fill); color: var(--ink-2); }

/* place tiles: tinted, never a solid white-glyph squircle in lists */
.tile { --c: var(--place-fjord); flex: none; width: 36px; height: 36px; border-radius: var(--r-tile); display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.tile svg { width: 20px; height: 20px; stroke-width: 1.8; }
.tile.gray { color: var(--ink-2); background: var(--fill); }
.tile.lg { width: 60px; height: 60px; border-radius: 14px; color: #fff; background: var(--c); }
.tile.lg svg { width: 30px; height: 30px; stroke-width: 1.7; }
.tile.lg.gray { color: var(--ink-2); background: var(--fill); }
.tile .code-big { font-family: var(--num); font-weight: 800; font-size: 19px; letter-spacing: -.5px; color: var(--ink); }
@supports not (background: color-mix(in srgb, red 50%, white)) { .tile { background: var(--fill); } }

/* EskeLapp – the box label (docs/design.md §3A). Markup from lapp() in views.js; --c is the place colour. */
.lapp { --c: var(--place-fjord); --band: 7px; --hole: 3px; position: relative; flex: none; display: grid; place-items: center; overflow: hidden;
  width: 40px; height: 46px; padding-top: var(--band); border-radius: var(--r-lapp); background: var(--paper); box-shadow: inset 0 0 0 .5px var(--lapp-edge);
  font-family: var(--num); font-weight: 800; font-size: 20px; line-height: 1; letter-spacing: -.5px; font-variant-numeric: tabular-nums; color: var(--ink-paper); }
.lapp::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: var(--band); background: var(--c); }
.lapp::after { content: ""; position: absolute; top: calc((var(--band) - var(--hole)) / 2); left: calc(50% - var(--hole) / 2); width: var(--hole); height: var(--hole); border-radius: 50%; background: var(--bg); }
.lapp b { font-weight: inherit; white-space: nowrap; }
.lapp.long { font-size: 15px; }
.lapp.lg { --band: 12px; --hole: 5px; width: 88px; height: 100px; border-radius: 10px; font-size: 44px; }
.lapp.lg.long { font-size: 33px; }
.lapp.sm { --band: 4px; --hole: 2px; width: 22px; height: 26px; border-radius: 4px; font-size: 11px; letter-spacing: -.3px; }
.lapp.sm.long { font-size: 8px; }
.card .lapp::after, .list .lapp::after { background: var(--surface); }
/* signature C – "får en plass": add .settle when a box gets a place */
.settle { animation: settle 280ms cubic-bezier(.2, .9, .3, 1.2); }
@keyframes settle { from { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .settle { animation: fade 200ms ease-out; } }

/* headers of detail screens */
.hero { display: block; margin: 0 4px 20px; color: inherit; }
.hero-num { font-family: var(--num); font-size: 34px; line-height: 41px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0; color: var(--ink); }
.hero-sub { font-size: 15px; line-height: 20px; color: var(--ink-2); letter-spacing: -.24px; }
a.hero:active .hero-num { opacity: .6; }
.box-hero { display: flex; gap: 16px; align-items: center; margin: 2px 0 20px; }
.box-hero h1 { margin: 0; font-size: 28px; line-height: 34px; }
.box-hero .hero-sub { margin-top: 2px; }

/* buttons: capsule only for primary; everything else is text in tint */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 0;
  background: var(--tint-soft); color: var(--tint); font-weight: 600; cursor: pointer; white-space: nowrap; transition: transform 100ms ease-out, opacity 100ms ease-out; text-decoration: none; }
.btn:disabled { opacity: .4; cursor: default; }
.btn svg { width: 19px; height: 19px; flex: none; stroke-width: 2.1; }
.btn.primary { background: var(--tint); color: var(--tint-ink); border-radius: 999px; min-height: 50px; }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.ghost { background: none; padding: 0 8px; font-weight: 400; }
.btn.block { width: 100%; }
.btn.sm { min-height: 30px; padding: 0 12px; font-size: 15px; border-radius: 999px; letter-spacing: -.24px; }
.btn.sm.primary { min-height: 30px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 0; background: none; display: inline-grid; place-items: center; cursor: pointer; color: var(--tint); flex: none; }
.icon-btn:active { background: var(--fill-2); }
.icon-btn svg { width: 22px; height: 22px; }
.btn:active, .icon-btn:active { transform: scale(.97); opacity: .85; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--tint) 55%, transparent); outline-offset: 2px; }

/* forms in sheets (stacked fields) */
.field { display: block; }
.field > span { display: block; font-size: 13px; color: var(--ink-2); margin: 0 0 6px 4px; letter-spacing: -.08px; }
.input, select.input, textarea.input { width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 10px; background: var(--surface); -webkit-appearance: none; appearance: none; }
.card .input { background: var(--fill-2); }
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: none; box-shadow: 0 0 0 2px var(--tint); }
.input::placeholder { color: var(--ink-3); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 10px; background: var(--surface); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--tint); flex: none; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset[disabled] .input, fieldset[disabled] .check, fieldset[disabled] .fr, .input:disabled { opacity: .6; }

/* forms as iOS rows: label left, borderless value right */
.fr { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 16px; cursor: text; }
.fr > span:first-child { flex: none; max-width: 55%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr input:not([type=checkbox]), .fr select { flex: 1; min-width: 0; min-height: 44px; border: 0; padding: 0; background: none; color: var(--ink-2); text-align: right; -webkit-appearance: none; appearance: none; outline: none; }
.fr select { text-align-last: right; cursor: pointer; }
.fr input::placeholder { color: var(--ink-3); }
.fr .chev { margin-left: 0; }
.fr.sel { cursor: pointer; }
.fr.sw-row { cursor: pointer; justify-content: space-between; }
textarea.notes { display: block; width: 100%; min-height: 88px; resize: none; border: 0; background: none; padding: 11px 16px; outline: none; line-height: 1.35; }
textarea.notes::placeholder { color: var(--ink-3); }
/* iOS switch */
.sw { -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 51px; height: 31px; margin: 0; border-radius: 16px; background: var(--fill); cursor: pointer; transition: background .2s; }
.sw::before { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 3px 1px rgba(0, 0, 0, .06); transition: transform .25s cubic-bezier(.3, .9, .4, 1.1); }
.sw:checked { background: var(--switch-on); }
.sw:checked::before { transform: translateX(20px); }
@media (prefers-reduced-motion: reduce) { .sw, .sw::before { transition: none; } }

/* borderless "add" row at the end of a list */
.addrow { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 44px; }
.addrow .plus { width: 22px; height: 22px; flex: none; color: var(--tint); }
.addrow input { flex: 1; min-width: 0; min-height: 44px; border: 0; padding: 0; background: none; outline: none; }
.addrow input::placeholder { color: var(--ink-3); }
.addrow.tint input::placeholder { color: var(--tint); opacity: 1; }
.addrow input:focus::placeholder { color: var(--ink-3); }

/* photos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.photos img, .photos .ph-add { width: 100%; aspect-ratio: 1; border-radius: 10px; object-fit: cover; background: var(--fill); display: block; }
.ph-add { display: grid !important; place-items: center; align-content: center; gap: 4px; color: var(--tint); cursor: pointer; text-align: center; font-size: 13px; background: var(--surface) !important; }
.ph-add svg { width: 24px; height: 24px; stroke-width: 1.75; }
/* item photo strip: thumbnails, main one outlined in tint, a small remove button */
.ph-strip { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); margin-bottom: 8px; }
.ph-strip .ph-add { font-size: 11px; background: var(--fill) !important; }
.ph-strip .ph-add svg { width: 20px; height: 20px; }
.ph-thumb { position: relative; }
.ph-pick { display: block; width: 100%; padding: 0; border: 0; background: none; border-radius: 10px; cursor: pointer; }
.ph-thumb.main .ph-pick { box-shadow: 0 0 0 2px var(--tint); }
.ph-x { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center;
  background: var(--surface); color: var(--ink-2); box-shadow: 0 0 0 .5px rgba(0,0,0,.15); cursor: pointer; }
.ph-x svg { width: 12px; height: 12px; }

/* menus (settings-style rows) */
.menu a, .menu button.mi, .menu label.mi { display: flex; align-items: center; gap: 12px; padding: 0 16px; color: inherit; border: 0; width: 100%; background: none; text-align: left; cursor: pointer; min-height: 44px; font: inherit; }
.menu svg { width: 22px; height: 22px; color: var(--ink-2); flex: none; stroke-width: 1.75; }
.menu .chev { width: 14px; height: 14px; color: var(--ink-3); stroke-width: 2.6; }
.menu > :has(> svg:first-child:not(.chev)) { --inset: 50px; }
.menu .tint, .menu .tint svg, .menu button.mi.tint { color: var(--tint); }
.menu .danger, .menu button.mi.danger { color: var(--red); justify-content: center; }
.menu .danger svg { color: var(--red); }
.menu .vl { color: var(--ink-2); font-size: 17px; white-space: nowrap; }
.mi-row { display: flex; align-items: center; gap: 12px; padding: 6px 16px; min-height: 44px; }

/* bars (value view) */
.bar { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.bar > i { --c: var(--ink-3); display: block; height: 100%; background: var(--c); border-radius: 3px; }

/* segmented control */
.seg { display: flex; gap: 2px; background: var(--fill); border-radius: 9px; padding: 2px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1; min-height: 28px; border: 0; background: none; border-radius: 7px; font-weight: 500; font-size: 13px; color: var(--ink); cursor: pointer; white-space: nowrap; padding: 0 10px; letter-spacing: -.08px; transition: transform 100ms ease-out; }
.seg button[aria-pressed="true"] { background: var(--surface); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); }
.seg button:disabled { opacity: .45; }
:root.dark .seg button[aria-pressed="true"] { background: #636366; }:root.dark .tile.lg:not(.gray) { color: rgba(0, 0, 0, .78); }

/* empty states (ContentUnavailableView) */
.empty { text-align: center; padding: 48px 24px 32px; max-width: 420px; margin: 0 auto; }
.empty > svg { width: 48px; height: 48px; color: var(--ink-3); stroke-width: 1.5; }
.empty h3 { font-size: 22px; line-height: 28px; font-weight: 700; margin: 12px 0 6px; letter-spacing: .35px; }
.empty p { color: var(--ink-2); font-size: 15px; line-height: 20px; letter-spacing: -.24px; }
.empty .btn { margin-top: 10px; }
.empty .btn.primary { padding: 0 28px; }
.empty.kraft > svg { color: var(--kraft); }
.empty.inline { padding: 24px 16px; }

/* search field */
.searchbar { display: flex; align-items: center; gap: 0; margin-bottom: 4px; }
.sfield { position: relative; flex: 1; min-width: 0; }
.sfield svg { position: absolute; left: 8px; top: 50%; width: 17px; height: 17px; margin-top: -8.5px; color: var(--ink-3); stroke-width: 2.2; pointer-events: none; }
.sfield input { width: 100%; height: 36px; border: 0; border-radius: 10px; background: var(--fill); padding: 0 8px 0 30px; font-size: 17px; outline: none; -webkit-appearance: none; appearance: none; }
.sfield input::placeholder { color: var(--ink-3); }
.sfield input::-webkit-search-decoration { -webkit-appearance: none; }
.s-cancel { max-width: 0; overflow: hidden; white-space: nowrap; border: 0; background: none; color: var(--tint); padding: 0; cursor: pointer; opacity: 0; transition: max-width .25s ease, opacity .2s, padding .25s; }
.searchbar:focus-within .s-cancel, .searchbar.has-q .s-cancel { max-width: 90px; padding-left: 12px; opacity: 1; }
@media (prefers-reduced-motion: reduce) { .s-cancel { transition: none; } }

/* tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--bar); backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px);
  box-shadow: 0 -.5px 0 var(--sep); padding-bottom: env(safe-area-inset-bottom); }
.tabbar .wrap { display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tabbar-h); padding: 0 4px; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--ink-3); font-size: 10px; font-weight: 500; letter-spacing: .1px; min-height: 44px; padding-top: 2px; }
.tab svg { width: 24px; height: 24px; stroke-width: 1.75; transition: transform 100ms ease-out; }
.tab[aria-current="page"] { color: var(--tint); }
.tab[aria-current="page"] svg .f { fill: currentColor; }
.tab[aria-current="page"] svg .d { stroke: var(--surface); }
.tab:active svg { transform: scale(.9); }

/* desktop: sidebar instead of the tab bar */
.sidebar { display: none; }
@media (min-width: 900px) {
  .tabbar { display: none; }
  .app { padding-bottom: 48px; }
  .app.has-side { padding-left: var(--sidebar-w); }
  .sidebar { display: block; position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-w); z-index: 25; background: var(--bg); box-shadow: .5px 0 0 var(--sep); padding: 20px 12px; overflow-y: auto; }
  .side-head { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; font-weight: 600; font-size: 17px; }
  .side-head svg { width: 28px; height: 28px; flex: none; }
  .side-row { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 8px; color: var(--ink); font-size: 15px; font-weight: 500; letter-spacing: -.24px; }
  .side-row svg { width: 20px; height: 20px; color: var(--ink-2); stroke-width: 1.75; flex: none; }
  .side-row:hover { background: var(--fill-2); }
  .side-row[aria-current="page"] { background: var(--tint-soft); color: var(--tint); }
  .side-row[aria-current="page"] svg { color: var(--tint); }
  .has-side .wrap { max-width: 720px; padding: 0 40px; }
  .has-side main > .wrap:first-child, .has-side .navbar + .wrap { padding-top: 16px; }
  .has-side .navbar .in { max-width: 720px; margin: 0 auto; padding: 0 32px; }
  .toast { bottom: 32px; margin-left: calc(var(--sidebar-w) / 2); }
}

/* sheets */
.scrim { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, 0); transition: background 280ms ease-out; }
.scrim.in { background: rgba(0, 0, 0, .4); }
.sheet { background: var(--bg); width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; border-radius: 14px 14px 0 0; padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  will-change: transform; touch-action: pan-y; transform: translateY(100%); }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--ink-3); opacity: .5; margin: 6px auto 0; }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 14px; max-height: 86vh; } .grabber { display: none; } }
.sheet-head { position: sticky; top: 0; background: var(--bg); display: flex; align-items: center; gap: 8px; padding: 10px 0; z-index: 2; margin-bottom: 8px; }
.sheet-head h2 { margin: 0; padding: 0; flex: 1; font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -.41px; color: var(--ink); text-transform: none; }
.sheet-head, .grabber { touch-action: none; cursor: grab; }
.sheet-foot { display: flex; gap: 10px; margin-top: 20px; }
.sheet-foot .btn { flex: 1; }
.sheet-foot .btn.primary { min-height: 50px; }
.sheet h2:not(.sheet-head h2) { margin-left: 16px; }
.confirm-q { font-size: 17px; line-height: 22px; font-weight: 600; text-align: center; margin: 18px 8px 4px; }
.actsheet { padding-top: 8px; }
.actsheet .card + .card { margin-top: 8px; }
.actsheet .menu button.mi { justify-content: flex-start; color: var(--ink); }
.actsheet .menu button.mi svg { color: var(--ink-2); }
.actsheet .menu button.mi.danger, .actsheet .menu button.mi.danger svg { color: var(--red); }
.actsheet .menu button.mi.cancel { font-weight: 600; color: var(--tint); justify-content: center !important; }
@keyframes fade { from { opacity: 0; } }

/* toast & notices */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); z-index: 60; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); color: var(--ink); padding: 11px 18px; border-radius: 22px; font-weight: 600; font-size: 15px; max-width: calc(100% - 32px); width: max-content;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .14), 0 0 0 .5px var(--sep); display: flex; align-items: center; gap: 10px; letter-spacing: -.24px; animation: toastIn 260ms cubic-bezier(.2, .9, .3, 1); }
.toast.with-lapp { padding-left: 10px; }
.toast .t-msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast .undo { border: 0; background: none; color: var(--tint); font-weight: 600; padding: 0 0 0 4px; cursor: pointer; white-space: nowrap; }
.toast .lapp::after { background: var(--surface); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(.96); } }
.notice { padding: 12px 16px; border-radius: var(--r); background: var(--surface); color: var(--ink-2); font-size: 15px; margin-top: 12px; letter-spacing: -.24px; }
.notice.info { color: var(--ink-2); }
.notice.err { background: var(--red-soft); color: var(--red); }

/* loading */
.spin { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .8s linear infinite; display: inline-block; flex: none; }
@keyframes rot { to { transform: rotate(360deg); } }
.skel { background: var(--surface); border-radius: var(--r); height: 60px; position: relative; overflow: hidden; }
.skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--fill-2), transparent); animation: sh 1.4s infinite; }
@keyframes sh { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* sell */
.sellitem { padding: 12px 16px; }
.sellitem .head { display: flex; gap: 12px; align-items: flex-start; }
.sellitem img { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; flex: none; }
.sellitem .price { font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sellitem .btnrow { margin-top: 10px; }
.sellitem + .sellitem::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; height: 1px; transform: scaleY(.5); transform-origin: top; background: var(--sep); }

/* scan: camera first, viewfinder shaped like a label */
.scanview { position: relative; border-radius: var(--r-l); overflow: hidden; background: #0d0d0e; aspect-ratio: 3 / 4; max-height: 62vh; width: 100%; display: grid; place-items: center; }
.scanview video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.vf { position: relative; width: 220px; height: 250px; max-width: 64%; max-height: 72%; border-radius: var(--r-viewfinder); box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }
.vf i { position: absolute; width: 34px; height: 34px; border: 3px solid rgba(255, 255, 255, .9); }
.vf i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: var(--r-viewfinder); }
.vf i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: var(--r-viewfinder); }
.vf i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: var(--r-viewfinder); }
.vf i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: var(--r-viewfinder); }
.scanview .start { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); background: rgba(255, 255, 255, .16); color: #fff; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 999px; }
.numfield { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 6px 6px 6px 20px; border-radius: 999px; background: var(--surface); }
.numfield input { flex: 1; min-width: 0; border: 0; background: none; outline: none; height: 50px; font-family: var(--num); font-weight: 800; font-size: 34px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.numfield input::placeholder { font-family: var(--font); font-weight: 400; font-size: 17px; letter-spacing: -.41px; color: var(--ink-3); }
.numfield button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--tint); color: var(--tint-ink); display: grid; place-items: center; cursor: pointer; flex: none; transition: opacity .15s; }
.numfield button svg { width: 22px; height: 22px; stroke-width: 2.4; }
.numfield:has(input:placeholder-shown) button { opacity: .3; }

/* ai results */
.airow { display: grid; grid-template-columns: 28px 1fr 56px 84px; gap: 8px; align-items: center; padding: 6px 0; }
.airow.head { padding-bottom: 0; }
.airow input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--tint); }
.airow .input { min-height: 38px; padding: 6px 10px; }
/* items from photos: the box row and the review */
.phitems { padding-right: 6px; }
.phitems .ph-pick-row { display: flex; align-items: center; gap: 12px; cursor: pointer; min-width: 0; }
.phitems .ttl { display: block; }
.phitems .tiny { display: block; }
.phrow { display: grid; grid-template-columns: 28px 44px 1fr 48px 72px; gap: 8px; align-items: center; padding: 6px 0; }
.phrow.head { padding-bottom: 0; }
.phrow input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--tint); }
.phrow .input { min-height: 38px; padding: 6px 10px; min-width: 0; }
.phrow .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; display: block; background: var(--fill); }
.phrow .thumb.none { display: grid; place-items: center; color: var(--ink-3); }
.phrow .thumb.none svg { width: 20px; height: 20px; }
.phrow:has(input[type=checkbox]:not(:checked)) > :not(input[type=checkbox]) { opacity: .5; }
label.btn.sm.section { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
label.btn.sm.section svg { width: 18px; height: 18px; }

@media (max-width: 380px) { h1 { font-size: 30px; line-height: 36px; } }

/* accessibility preferences */
@media (prefers-reduced-motion: reduce) {
  .btn:active, .icon-btn:active { transform: none; }
  .toast { animation: none; }
  .sheet { transform: none !important; }
  .navbar, .navbar .nt { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .tabbar, .toast, html.scrolled .navbar { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --sep: rgba(60, 60, 67, .6); --ink-2: rgba(60, 60, 67, .9); }
  .card, .list, .input, .btn { outline: 1px solid var(--sep); outline-offset: -1px; }
}

/* onboarding: one screen, three labels drop in */
.onb { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: 0; }
.onb-page { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px 32px; max-width: 520px; }
.onb-tags { display: flex; gap: 14px; align-items: flex-end; margin: 0 0 32px; height: 112px; }
.onb-tags .lapp { --band: 10px; --hole: 4px; width: 68px; height: 78px; font-size: 34px; border-radius: 8px; box-shadow: inset 0 0 0 .5px var(--lapp-edge), 0 6px 16px rgba(0, 0, 0, .08); animation: drop 520ms cubic-bezier(.2, .9, .3, 1.2) both; }
.onb-tags .lapp::after { background: var(--bg); }
.onb-tags .lapp:nth-child(1) { transform: rotate(-6deg); animation-delay: 60ms; }
.onb-tags .lapp:nth-child(2) { transform: translateY(-14px); animation-delay: 160ms; }
.onb-tags .lapp:nth-child(3) { transform: rotate(5deg); animation-delay: 260ms; }
@keyframes drop { from { opacity: 0; translate: 0 -36px; scale: 1.12; } }
@media (prefers-reduced-motion: reduce) { .onb-tags .lapp { animation: fade 200ms ease-out both; } }
.onb-page h1 { margin: 0 0 28px; }
.feat { display: flex; gap: 16px; align-items: flex-start; }
.feat + .feat { margin-top: 22px; }
.feat svg { width: 30px; height: 30px; color: var(--tint); flex: none; stroke-width: 1.6; margin-top: 2px; width: 36px; }
.feat b { display: block; font-weight: 600; }
.feat span { display: block; font-size: 15px; line-height: 20px; color: var(--ink-2); letter-spacing: -.24px; margin-top: 2px; }
.onb-foot { width: 100%; max-width: 520px; padding: 0 32px calc(24px + env(safe-area-inset-bottom)); }
/* onboarding questions */
.onb-top { display: flex; align-items: center; gap: 8px; min-height: 52px; max-width: 520px; padding: 4px 20px 0; }
.onb-top .onb-skip { margin-left: auto; color: var(--ink-2); font-weight: 500; }
.onb-back { padding: 0 8px; min-height: 44px; color: var(--tint); }
.onb-back svg { width: 22px; height: 22px; }
.onb-dots { display: flex; gap: 6px; flex: 1; justify-content: center; }
.onb-dots span { width: 22px; height: 4px; border-radius: 2px; background: var(--fill); transition: background 200ms ease-out; }
.onb-dots span.on { background: var(--tint); }
.onb-page.onb-q { justify-content: flex-start; padding-top: 20px; }
.onb-q h1 { margin: 0 0 8px; }
.onb-lead { margin: 0 0 24px; color: var(--ink-2); font-size: 17px; line-height: 22px; }
.onb-h2 { font-size: 15px; font-weight: 600; margin: 8px 0 10px; color: var(--ink); }
.onb-input { font-size: 20px; min-height: 54px; }
.onb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.onb-list { display: flex; flex-direction: column; gap: 10px; }
.onb-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.onb-choice { position: relative; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 12px 14px; border: 0; border-radius: 14px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; font-weight: 500; text-align: left; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--sep); transition: box-shadow 120ms ease-out, background 120ms ease-out, transform 100ms ease-out; }
.onb-choice:active { transform: scale(.98); }
.onb-choice svg { width: 22px; height: 22px; color: var(--tint); flex: none; }
.onb-choice span { flex: 1; }
.onb-choice[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--tint); background: color-mix(in srgb, var(--tint) 8%, var(--surface)); }
.onb-choice .onb-check { width: 18px; height: 18px; stroke-width: 2.6; }
.onb-grid .onb-choice { flex-direction: column; align-items: flex-start; gap: 8px; min-height: 92px; }
.onb-grid .onb-choice .onb-check { position: absolute; top: 12px; right: 12px; }
.onb-pills .onb-choice { min-height: 40px; padding: 8px 16px; border-radius: 20px; font-size: 15px; }
.onb-pills .onb-choice .onb-check { display: none; }
.onb-done-ic { width: 64px; height: 64px; border-radius: 32px; background: var(--tint); color: #fff; display: grid; place-items: center; margin-bottom: 20px; animation: drop 420ms cubic-bezier(.2, .9, .3, 1.2) both; }
.onb-done-ic svg { width: 34px; height: 34px; stroke-width: 2.4; }
.onb-done-ic + h1 { margin-bottom: 6px; }
@media (prefers-reduced-motion: reduce) { .onb-done-ic { animation: none; } }

/* sign-in buttons in the providers' own styles */
.btn.brand { gap: 10px; font-weight: 500; border-radius: 12px; min-height: 50px; }
.btn.brand svg { width: 20px; height: 20px; stroke: none; }
.btn.brand.apple { background: #000; color: #fff; }
.btn.brand.google { background: #fff; color: #1f1f1f; box-shadow: inset 0 0 0 1px #747775; }
.btn.brand.facebook { background: #1877f2; color: #fff; }
:root.dark .btn.brand.apple { background: #fff; color: #000; }:root.dark .btn.brand.google { background: #131314; color: #e3e3e3; box-shadow: inset 0 0 0 1px #8e918f; }

/* profile */
.avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; color: var(--tint); font-family: var(--num); font-weight: 600; background: var(--tint-soft); }
.avatar.none { background: none; color: var(--ink-3); }
.avatar svg { width: 100%; height: 100%; stroke-width: 1.2; }
.menu .profile-head { min-height: 76px; gap: 14px; padding-top: 8px; padding-bottom: 8px; }
.profile-head b { font-size: 20px; font-weight: 600; letter-spacing: .38px; }
.itemrow.tint .ic, .itemrow.tint .plus { color: var(--tint); }
.nb-btn.busy:disabled { opacity: 1; }
