/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font: 500 15px/1.45 var(--font); overscroll-behavior: none; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; -webkit-touch-callout: none; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
svg.i { display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Soft colour behind the glass so there is something to frost. Static, no blur filter. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 40% at 8% 4%, var(--blob-a), transparent 70%),
    radial-gradient(50% 36% at 100% 22%, var(--blob-b), transparent 70%),
    radial-gradient(60% 40% at 30% 100%, var(--blob-c), transparent 70%);
}

#app { position: fixed; inset: 0; margin: 0 auto; width: min(100%, 520px); z-index: 1; overflow: hidden; }
@media (min-width: 560px) { #app { box-shadow: 0 0 0 1px var(--line); } }
/* a soft fade at the very bottom, so content scrolling under the floating bar does not show in the gap below it */
#app::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--safe-bottom) + 22px); z-index: 25; pointer-events: none; background: linear-gradient(to bottom, transparent, var(--bg)); }

/* ---------- surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--shadow-1); padding: 16px;
}

/* ---------- top bar ---------- */
.topbar {
  position: absolute; inset: 0 0 auto 0; z-index: 20; height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) 14px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-edge);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16px; letter-spacing: -0.02em; min-width: 0; }
.brand img { width: 30px; height: 25px; object-fit: contain; }
.brand small { font-weight: 700; font-size: 11px; color: var(--ink-2); letter-spacing: 0.02em; display: block; margin-top: -2px; }
.userchip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 12px 4px 4px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-size: 13px; max-width: 150px;
  transition: transform var(--t-fast) var(--ease);
}
.userchip:active { transform: scale(0.96); }
/* pressing answers at once; letting go springs back */
.userchip:active, .btn:active, .iconbtn:active, .chip:active, .choice:active, .tile:active, .sw:active { transition-duration: 0.05s; }
.tab svg { transition: scale var(--t-fast) var(--ease); } /* `scale` is separate from the arrival tick, which uses `transform` */
.tab:active svg { scale: 0.9; transition-duration: 0.05s; }
.topright { display: flex; align-items: center; gap: 8px; flex: none; }
.syncchip { display: inline-flex; align-items: center; gap: 5px; min-height: 40px; min-width: 40px; justify-content: center; padding: 0 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 800; font-size: 13px; color: var(--ink); }
.syncchip[hidden] { display: none; }
.syncchip i { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); flex: none; }
.syncchip.good i { background: var(--good); }
.syncchip.blue i { background: var(--brand); }
.syncchip.warn i { background: var(--warn); }
.syncchip.bad i { background: var(--bad); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--btn-bg); color: var(--btn-ink); font-weight: 800; font-size: 13px;
}

/* ---------- pager and panels (swipe between tabs) ---------- */
.pager {
  position: absolute; inset: 0; display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none;
}
.pager::-webkit-scrollbar { display: none; }
.panel {
  flex: 0 0 100%; width: 100%; scroll-snap-align: start; scroll-snap-stop: always;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch;
  padding: calc(var(--topbar-h) + var(--safe-top) + 10px) 16px calc(var(--nav-h) + var(--safe-bottom) + 34px);
}
.panel > * + * { margin-top: 14px; }
.title { font-size: 34px; line-height: 1.1; font-weight: 800; letter-spacing: -0.04em; }
.sub { color: var(--ink-3); font-size: 14px; margin-top: 4px; }
.section-title { font-size: 12px; font-weight: 700; color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase; margin: 26px 2px 8px; }

/* ---------- floating Liquid Glass navigation (after iOS 26) ----------
   A glass capsule with the four tabs, and the + as its own round glass button beside it. The selection
   (.nav-lens) is moved, lifted and scaled by nav.js with transforms only; --act runs from 0 (a tinted
   capsule resting in the bar) to 1 (a clear magnifying lens standing out of it). */
.nav { position: absolute; z-index: 30; left: 12px; right: 12px; bottom: calc(10px + var(--safe-bottom)); display: flex; gap: 10px; align-items: center; -webkit-user-select: none; user-select: none; }
.nav-bar { position: relative; flex: 1; min-width: 0; height: var(--nav-h); border-radius: 999px; touch-action: pan-y; box-shadow: var(--shadow-glass); }
.nav-surface {
  position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(var(--glass-hue, transparent), var(--glass-hue, transparent)), var(--nav-bg);
  -webkit-backdrop-filter: var(--nav-blur); backdrop-filter: var(--nav-blur);
  border: 1px solid var(--glass-border); box-shadow: inset 0 1px 0 var(--glass-shine), inset 0 -1px 0 var(--glass-edge);
}
.nav-row {
  position: absolute; top: 0; bottom: 0; left: 4px; right: 4px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  --ll: 0px; --lr: 0px; /* the stretch hidden under the lens */
  -webkit-mask-image: linear-gradient(90deg, #000 var(--ll), transparent var(--ll), transparent var(--lr), #000 var(--lr));
  mask-image: linear-gradient(90deg, #000 var(--ll), transparent var(--ll), transparent var(--lr), #000 var(--lr));
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; font-weight: 700; color: var(--tab-ink); min-height: 44px;
  transition: color var(--t-fast) var(--ease);
}
.tab[aria-current='page'] { color: var(--tab-ink-on); }
.nav-lens {
  --act: 0;
  position: absolute; z-index: 2; top: 4px; bottom: 4px; left: 0; border-radius: 999px; overflow: hidden; pointer-events: none;
  transform-origin: 50% 50%; will-change: transform;
  box-shadow: 0 calc(var(--act) * 14px) calc(var(--act) * 26px) calc(var(--act) * -8px) rgba(2, 8, 24, calc(var(--act) * 0.5));
}
.lens-tint, .lens-glass { position: absolute; inset: 0; border-radius: inherit; }
.lens-tint { /* at rest: a soft tinted capsule, like the selection in Apple Music */
  background: linear-gradient(var(--glass-hue-lens, transparent), var(--glass-hue-lens, transparent)), var(--plate-bg);
  opacity: calc(1 - var(--act));
}
.lens-glass { /* lifted: clear glass; in Chromium it bends what is behind its rim (lens.js) */
  visibility: hidden; opacity: var(--act); background: var(--lens-tint);
  -webkit-backdrop-filter: blur(1px) saturate(180%) brightness(1.12); backdrop-filter: blur(1px) saturate(180%) brightness(1.12);
}
.nav-lens.lifted .lens-glass { visibility: visible; }
html.lens-fx .lens-glass { -webkit-backdrop-filter: url(#pp-lens); backdrop-filter: url(#pp-lens); }
html.lite .lens-glass { -webkit-backdrop-filter: none; backdrop-filter: none; }
.lens-mag { left: 0; right: auto; height: var(--nav-h); -webkit-mask-image: none; mask-image: none; will-change: transform; }
.lens-mag .tab { pointer-events: none; }
.lens-rim { position: absolute; inset: 0; border-radius: inherit; opacity: calc(0.3 + var(--act) * 0.7); }
.lens-rim::before { /* the bright bevel: strong top left, faint in between, bright again bottom right */
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px;
  background: linear-gradient(150deg, var(--lens-rim-a) 0%, var(--lens-rim-b) 30%, var(--lens-rim-b) 62%, var(--lens-rim-c) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.lens-rim::after { /* a sheen across the top and a soft glow inside the edge, only when lifted */
  content: ''; position: absolute; inset: 0; border-radius: inherit; opacity: var(--act);
  background: radial-gradient(90% 55% at 30% 0%, var(--lens-sheen), transparent 70%);
  box-shadow: inset 0 0 18px var(--lens-glow), inset 0 2px 3px var(--lens-rim-a);
}
.nav-add { /* its own round glass button, tinted with the accent colour */
  position: relative; flex: none; width: var(--nav-h); height: var(--nav-h); border-radius: 50%; display: grid; place-items: center;
  color: var(--btn-ink); background: color-mix(in srgb, var(--btn-bg) 86%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(180%); backdrop-filter: blur(14px) saturate(180%);
  box-shadow: var(--shadow-glass), inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 -8px 16px -10px rgba(0, 0, 0, 0.35);
  transition: transform var(--t-med) var(--spring);
}
.nav-add:active { transform: scale(0.9); transition-duration: 0.06s; }
.nav-add svg { stroke-width: 2.4; }

/* ---------- buttons, fields, chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: 16px; font-weight: 800; font-size: 15px; background: var(--btn-bg); color: var(--btn-ink);
  box-shadow: 0 6px 14px -8px color-mix(in srgb, var(--btn-bg) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast);
}
.btn:active { transform: scale(0.97); }
.btn.soft { background: var(--brand-soft); color: var(--brand-text); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--ink-2); box-shadow: none; border: 1px solid var(--line); }
.btn.block { width: 100%; }

.field {
  display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 48px; padding: 0 14px; border-radius: 15px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-3);
}
.field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.field input { flex: 1; min-width: 0; width: 100%; border: 0; background: none; outline: 0; font-size: 16px; color: var(--ink); }
.field input::placeholder { color: var(--ink-3); }
.searchrow { display: flex; gap: 10px; align-items: stretch; }
.iconbtn {
  width: 48px; min-height: 48px; display: grid; place-items: center; border-radius: 15px; flex: none;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
  transition: transform var(--t-fast) var(--ease);
}
.iconbtn:active { transform: scale(0.94); }

/* Tab sliders and filter chips are small liquid-glass versions of the bar: a frosted track with a
   glass thumb that lifts, grows and turns clearer while a finger holds it. */
.glass-rim::before { /* bright bevel edge shared by the thumbs */
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: linear-gradient(150deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.2) 30%, rgba(255, 255, 255, 0.2) 62%, rgba(255, 255, 255, 0.7) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.glass-rim::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(90% 60% at 30% 0%, rgba(255, 255, 255, 0.5), transparent 70%); }
.seg {
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; border-radius: 999px; touch-action: pan-y;
  background: var(--ctl-track); border: 1px solid var(--line); -webkit-backdrop-filter: blur(10px) saturate(160%); backdrop-filter: blur(10px) saturate(160%);
  box-shadow: inset 0 1px 2px rgba(11, 18, 32, 0.08);
}
.seg-ind {
  position: absolute; top: 4px; bottom: 4px; left: 4px; border-radius: 999px; background: var(--ctl-thumb);
  -webkit-backdrop-filter: blur(6px) saturate(180%); backdrop-filter: blur(6px) saturate(180%);
  box-shadow: 0 6px 14px -8px rgba(8, 24, 70, 0.5), 0 1px 2px rgba(8, 24, 70, 0.14);
  will-change: transform;
}
.seg-ind { transition: scale var(--t-med) var(--spring), background var(--t-fast) var(--ease); }
.seg.held .seg-ind { background: var(--ctl-thumb-on); scale: 1.08; transition-duration: 0.12s; } /* held: the thumb lifts a little, like the tab bar's lens */
.seg button { position: relative; z-index: 1; min-height: 38px; font-weight: 700; font-size: 13px; color: var(--ink-3); border-radius: 999px; transition: color var(--t-fast) var(--ease); padding: 0 6px; }
.seg button[aria-pressed='true'] { color: var(--ink); }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; margin: -6px -16px; padding: 8px 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  position: relative; flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; font-weight: 700; font-size: 13px; color: var(--ink-2);
  background: var(--ctl-track); border: 1px solid var(--line); /* no backdrop blur here: inside a scrolling row it leaves square edges, and a row of them is slow */
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-med) var(--spring);
}
.chip:active { transform: scale(0.95); }
.chip[aria-pressed='true'], .chip[aria-checked='true'] {
  background: color-mix(in srgb, var(--brand) 16%, var(--ctl-thumb)); color: var(--brand-text);
  border-color: color-mix(in srgb, var(--brand) 30%, transparent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 6px 12px -8px rgba(8, 24, 70, 0.4);
}

.pill { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 0 9px; border-radius: 10px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.pill.blue { background: var(--brand-soft); color: var(--brand-text); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.gray { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.good-t { color: var(--good); } .bad-t { color: var(--bad); }

/* ---------- Home ---------- */
.hero { position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 22px; color: var(--ink); border: 0; background: color-mix(in srgb, var(--btn-bg) 13%, #ffffff); }
html[data-theme='dark'] .hero { background: color-mix(in srgb, var(--btn-bg) 24%, var(--surface)); }
.hero::before { content: ''; position: absolute; width: 260px; height: 260px; right: -90px; top: -120px; border-radius: 50%; pointer-events: none; background: radial-gradient(closest-side, color-mix(in srgb, var(--btn-bg) 24%, transparent), transparent); }
.hero > * { position: relative; }
.hero .kicker { font-weight: 700; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.hero .big { font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -0.035em; margin-top: 6px; }
.hero .line { margin-top: 8px; color: var(--ink-2); }
/* Home is a bento of tiles: the profit tile is wide and blue, stock value is dark, the last tile is wide and teal */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { container-type: inline-size; padding: 18px; border-radius: var(--r-l); min-width: 0; min-height: 132px; display: flex; flex-direction: column; justify-content: space-between; }
.stat .lbl { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.stat .val { font-size: clamp(20px, 22cqi, 34px); font-weight: 800; letter-spacing: -0.045em; margin-top: 10px; white-space: nowrap; }
.stat .hint { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.stat:nth-child(1) { background: #0b1220; color: #fff; border-color: rgba(255, 255, 255, 0.06); }
html[data-theme='dark'] .stat:nth-child(1) { background: #17233b; }
.stat:nth-child(1) .lbl, .stat:nth-child(1) .hint { color: #a8b6cf; }
.stat:nth-child(2) { order: -1; grid-column: 1 / -1; min-height: 168px; background: linear-gradient(150deg, var(--btn-bg), color-mix(in srgb, var(--btn-bg) 78%, #000000)); color: var(--btn-ink); border: 0; }
.stat:nth-child(2) .val { font-size: clamp(32px, 20cqi, 56px); letter-spacing: -0.05em; }
.stat:nth-child(2) .lbl, .stat:nth-child(2) .hint { color: color-mix(in srgb, var(--btn-ink) 92%, transparent); }
.stat:nth-child(3) .val { color: var(--brand-text); }
.stat:nth-child(4) { grid-column: 1 / -1; min-height: 110px; background: color-mix(in srgb, var(--teal) 20%, var(--surface)); border: 0; }
.stat:nth-child(4) .lbl, .stat:nth-child(4) .hint { color: var(--ink-2); }
.goal { padding: 20px; }
.goal .row1 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 700; }
.bar { height: 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); margin-top: 12px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 100%; border-radius: inherit; transform-origin: left; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, var(--teal), var(--brand)); transition: transform 0.9s var(--spring); }
.buckets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.bucket { text-align: center; padding: 10px 4px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.bucket b { display: block; font-size: 20px; font-weight: 800; }
.bucket span { font-size: 11px; color: var(--ink-3); font-weight: 700; }
.bucket.hot { background: var(--warn-soft); border-color: transparent; }
.bucket.hot b, .bucket.hot span { color: var(--warn); }
.list { padding: 4px 0; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 16px; text-align: left; }
.row + .row { border-top: 1px solid var(--line); }
.row .ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.row .ico.warn { background: var(--warn-soft); color: var(--warn); }
.row .ico.bad { background: var(--bad-soft); color: var(--bad); }
.row .ico.good { background: var(--good-soft); color: var(--good); }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 700; }
.row .s { font-size: 13px; color: var(--ink-3); }
.row .chev { color: var(--ink-3); }
button.row:active { background: var(--surface-2); }

/* ---------- Stock and Sales ---------- */
.cards { display: block; border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-1); }
.phone { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 11px 14px; transition: background var(--t-fast); }
.phone + .phone { border-top: 1px solid var(--line); }
button.phone:active { background: var(--surface-2); }
.cards > .phone { content-visibility: auto; contain-intrinsic-size: auto 78px; }
.phone .info { flex: 1; min-width: 0; }
.phone .model { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15.5px; letter-spacing: -0.015em; }
.phone .meta { color: var(--ink-3); font-size: 12.5px; margin-top: 1px; overflow-wrap: anywhere; }
.warn-t { color: var(--warn); }
.phone .money { text-align: right; flex: none; }
.phone .money b { font-size: 16px; font-weight: 800; }
.phone .money span { display: block; font-size: 12px; color: var(--ink-3); }
.empty { text-align: center; padding: 34px 20px; color: var(--ink-3); }
.cards > .empty { border: 0; box-shadow: none; background: none; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.sumcard { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; text-align: left; }
.sumcard b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.sumcard span { font-size: 12px; color: var(--ink-3); font-weight: 700; }

/* ---------- More ---------- */
.group { padding: 0; overflow: hidden; }
.switch { position: relative; width: 52px; height: 32px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); flex: none; transition: background var(--t-med); }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); transition: transform var(--t-med) var(--spring); }
.switch[aria-checked='true'] { background: var(--btn-bg); border-color: transparent; }
.switch[aria-checked='true']::after { transform: translateX(20px); }
.row.static { cursor: default; }

/* ---------- bottom sheet and toast ---------- */
.backdrop { position: absolute; inset: 0; z-index: 60; background: rgba(8, 12, 20, 0.45); opacity: 0; }
/* while a sheet is up, the page behind it recedes a little (--depth runs 0 to 1 with the sheet's spring) */
#app.depth .pager { transform: scale(calc(1 - var(--depth) * 0.045)); }
.sheet {
  position: absolute; z-index: 61; left: 0; right: 0; bottom: 0; max-height: 88%; display: flex; flex-direction: column;
  border-radius: 30px 30px 0 0; padding: 10px 18px calc(18px + var(--safe-bottom)); transform: translateY(104%);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--glass-border); border-bottom: 0;
  box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, 0.5), inset 0 1px 0 var(--glass-shine);
}
.sheet.on { transform: none; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--ink-3); opacity: 0.35; margin: 2px auto 12px; flex: none; touch-action: none; }
.sheet h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.sheet .body { overflow-y: auto; margin-top: 12px; overscroll-behavior: contain; }
.sheet .body > * + * { margin-top: 12px; }
.choice { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.choice:active { transform: scale(0.985); }
.choice .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.choice b { display: block; }
.choice span { font-size: 13px; color: var(--ink-3); }
.tour { text-align: center; padding: 8px 4px; }
.tour .ico { width: 64px; height: 64px; border-radius: 22px; margin: 4px auto 14px; display: grid; place-items: center; background: linear-gradient(145deg, var(--cyan), var(--brand)); color: #fff; }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--ink-3); opacity: 0.35; transition: width var(--t-med) var(--ease), opacity var(--t-med); }
.dots i.on { width: 20px; opacity: 1; background: var(--brand); }

.toast {
  position: absolute; z-index: 70; left: 50%; bottom: calc(var(--nav-h) + var(--safe-bottom) + 26px); max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-radius: 999px; font-weight: 700; font-size: 14px;
  background: var(--ink); color: var(--bg); box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, 24px); opacity: 0; transition: transform var(--t-med) var(--spring), opacity var(--t-med);
}
.toast.on { transform: translate(-50%, 0); opacity: 1; }
.toast button { color: var(--cyan); font-weight: 800; min-height: 32px; padding: 0 4px; }

/* the glass tint colour setting: a veil over the glass, never over the text */
.topbar { background-image: linear-gradient(var(--glass-hue, transparent), var(--glass-hue, transparent)); }

/* ---------- colour pickers (More > Appearance) ---------- */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.sw {
  position: relative; width: 36px; height: 36px; border-radius: 50%; background: var(--sw); flex: none; overflow: hidden;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line); transition: transform var(--t-fast) var(--spring), box-shadow var(--t-fast);
}
.sw:active { transform: scale(0.92); }
.sw[aria-pressed='true'], .sw[data-on='true'] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.sw.custom { background: conic-gradient(#ff3b30, #ffcc00, #34c759, #00c7be, #0a84ff, #bf5af2, #ff3b30); }
.sw.custom input { position: absolute; inset: -6px; width: 48px; height: 48px; opacity: 0; cursor: pointer; }
.sw.auto { background: linear-gradient(135deg, var(--cyan), var(--btn-bg)); }

/* ---------- sell sheet ---------- */
.delta { font-size: 13px; font-weight: 700; margin-top: 2px; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }

.sell > * + * { margin-top: 12px; }
.sellhead { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); }
.sellhead .info { flex: 1; min-width: 0; }
.sellhead .model { font-weight: 700; font-size: 16px; letter-spacing: -0.015em; }
.sellhead .meta { color: var(--ink-3); font-size: 13px; }
.sellhead .money { text-align: right; }
.sellhead .money b { font-weight: 700; } .sellhead .money span { display: block; font-size: 12px; color: var(--ink-3); }
.flabel { font-size: 12px; font-weight: 700; color: var(--ink-3); letter-spacing: 0.05em; text-transform: uppercase; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 84px;
  border-radius: 20px; background: var(--surface); border: 1.5px solid var(--line); font-weight: 700; font-size: 13px; color: var(--ink-2);
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease);
}
.tile:active { transform: scale(0.97); }
.tile[aria-checked='true'] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }
.chips.wrap { flex-wrap: wrap; margin: 0; padding: 0; overflow: visible; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mfield { display: grid; gap: 6px; min-width: 0; }
.mfield .field b { color: var(--ink-3); font-weight: 700; }
.fees { border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); padding: 4px 14px; }
.feeline { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; font-size: 14px; }
.feeline + .feeline { border-top: 1px solid var(--line); }
.feeline em { font-style: normal; color: var(--ink-3); }
.feeline.muted { color: var(--ink-3); }
.warnline { display: flex; gap: 8px; align-items: flex-start; padding: 9px 0; font-size: 13px; font-weight: 600; color: var(--warn); }
.result { text-align: center; padding: 14px; border-radius: var(--r-l); background: #0b1220; border: 0; }
.rlabel { font-size: 13px; color: #a8b6cf; font-weight: 700; }
.rval { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.rsub { font-size: 13px; color: #a8b6cf; }
.result .good-t { color: #4adf9d; } .result .bad-t { color: #ff8178; }
.btn:disabled { opacity: 0.45; pointer-events: none; }

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------- forms, phone page ---------- */
.formwrap > * + * { margin-top: 12px; }
.form > * + * { margin-top: 12px; }
.formbtns { display: grid; gap: 10px; padding-top: 4px; }
.btn.soft.block, .btn.ghost.block { width: 100%; }
.fhint { font-size: 12px; color: var(--ink-3); }
.fmsg { font-size: 12.5px; font-weight: 600; }
.fmsg:empty { display: none; }
.fmsg.bad { color: var(--bad); }
.fmsg.warn { color: var(--warn); }
.field.area { align-items: stretch; padding: 8px 14px; }
.field textarea { flex: 1; min-width: 0; width: 100%; border: 0; background: none; outline: 0; resize: none; font-size: 16px; color: var(--ink); }
.field input[type='date'] { min-width: 0; }
.iconbtn.small { width: 36px; min-height: 36px; border-radius: 12px; }
.shipline { padding: 14px; }
.shiphead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.phonehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.phonehead .info { min-width: 0; }
.phonehead .model { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.phonehead .meta { color: var(--ink-3); }
.actions { display: grid; gap: 10px; }
.actionrow { display: flex; flex-wrap: wrap; gap: 8px; }
.actionrow .btn { flex: 1 1 auto; min-height: 44px; padding: 0 14px; }
.kvs { padding: 4px 14px; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; font-size: 14px; }
.kv + .kv { border-top: 1px solid var(--line); }
.kv span { color: var(--ink-3); flex: none; }
.kv b { text-align: right; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.hist .kv b { font-weight: 600; }
.stack > * + * { margin-top: 12px; }

/* ---------- settings ---------- */
.grouphead { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px 4px; }
.grouphead b { font-size: 17px; letter-spacing: -0.015em; }
.flabel.pad, .s.pad { padding: 8px 16px 2px; }
.addline { padding: 6px 16px 12px; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13px; border-radius: 12px; }
.addrow { display: flex; gap: 10px; align-items: stretch; }
.addrow .field { flex: 1; }
.field select { flex: 1; min-width: 0; width: 100%; border: 0; background: none; outline: 0; font-size: 16px; color: var(--ink); }
.mfield .field > input + b { color: var(--ink-3); font-weight: 700; }
.group > .empty { padding: 18px 16px; }

/* ---------- home performance, sales and stock extras ---------- */
.perf .lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.perf .val { font-size: 38px; font-weight: 800; letter-spacing: -0.045em; margin-top: 4px; }
.minis { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 16px; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.mini { background: var(--surface); padding: 11px 14px; min-width: 0; }
.mini span { display: block; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.mini b { display: block; font-size: 17px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; overflow-wrap: anywhere; }
.card > .lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.ranks { margin-top: 10px; }
.rank + .rank { margin-top: 14px; }
.rhead { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; }
.rhead.tight { padding: 7px 0; }
.rhead.tight + .rhead.tight { border-top: 1px solid var(--line); }
.rhead em { font-style: normal; font-weight: 600; color: var(--ink-3); }
.rbar { height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); margin-top: 6px; overflow: hidden; }
.rbar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--brand)); }
.rank .rsub { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.countrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.countrow select, .sortsel { border: 0; background: none; color: var(--brand-text); font-weight: 700; font-size: 13px; padding: 6px 0; max-width: 60%; }
.daybar { display: flex; justify-content: space-between; gap: 10px; padding: 8px 14px; font-size: 12px; font-weight: 700; color: var(--ink-2); background: var(--surface-2); border-top: 1px solid var(--line); }
.daybar:first-child { border-top: 0; }
.phone.returned { opacity: 0.6; }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sumcard.four { grid-template-columns: 1fr 1fr; row-gap: 14px; }
.dates[hidden] { display: none; }

.filebtn { position: relative; overflow: hidden; cursor: pointer; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

.backupnote { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--warn-soft); border-color: transparent; }
.backupnote b { color: var(--warn); }
.backupnote .s { font-size: 13px; color: var(--ink-2); }
.backupnote .btn { flex: none; }

.kv.stacked { flex-direction: column; gap: 2px; }
.kv.stacked span, .kv.stacked b { text-align: left; overflow-wrap: anywhere; }

/* ---------- the scanner ---------- */
.scanner { position: absolute; inset: 0; z-index: 90; background: #000; color: #fff; display: flex; flex-direction: column; }
.cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camshade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 22%, transparent 55%, rgba(0, 0, 0, 0.78)); pointer-events: none; }
.camtop { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(var(--safe-top) + 14px) 16px 8px; }
.camtop b { font-size: 17px; letter-spacing: -0.015em; }
.camtools { display: flex; gap: 8px; }
.camtool { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(255, 255, 255, 0.18); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.camtool[aria-pressed='true'] { background: #fff; color: #000; }
.camframe { position: relative; flex: 1; margin: 6% 9%; max-height: 38%; border: 3px solid rgba(255, 255, 255, 0.9); border-radius: 22px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.2); transition: border-color var(--t-fast), transform var(--t-med) var(--spring); }
.scanner.hit .camframe { border-color: #4adf9d; transform: scale(1.03); }
.cambottom { position: relative; margin-top: auto; padding: 16px 16px calc(var(--safe-bottom) + 18px); display: grid; gap: 10px; }
.camstatus { font-size: 14px; font-weight: 600; text-align: center; }
.camlast { font-size: 17px; font-weight: 800; text-align: center; color: #4adf9d; min-height: 1.2em; }
.camtype { background: rgba(255, 255, 255, 0.94); color: #0b1220; padding-right: 6px; }
.camtype input { color: #0b1220; }
.camtype input::placeholder { color: #566277; }

.inlinebtn { flex: none; width: 36px; height: 36px; margin-right: -8px; border-radius: 12px; display: grid; place-items: center; color: var(--brand-text); background: var(--brand-soft); }

/* ---------- receipt and invoice preview (always a white sheet of paper) ---------- */
.paper.f-serif { font-family: Georgia, 'Times New Roman', serif; }
.paper.l-modern .p-head { margin: -18px -16px 14px; padding: 16px; background: var(--accent); color: #fff; border: 0; border-radius: 10px 10px 0 0; }
.paper.l-modern .p-title, .paper.l-modern .p-title small { color: #fff; }
.paper.l-modern .p-th { background: color-mix(in srgb, var(--accent) 12%, #fff); color: var(--accent); padding: 6px 4px; border-radius: 4px; }
.paper.l-modern .p-totals .strong { background: none; color: var(--accent); border-top: 2px solid var(--accent); border-radius: 0; padding: 8px 0; font-size: 15px; }
.paper.l-minimal .p-head { flex-direction: row-reverse; border-bottom: 1px solid #606a7a; padding-bottom: 14px; }
.paper.l-minimal .p-biz { font-size: 9.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #606a7a; text-align: right; }
.paper.l-minimal .p-title { color: #111827; font-weight: 300; font-size: 22px; text-align: left; }
.paper.l-minimal .p-th { border-bottom: 1px solid #111827; }
.paper.l-minimal .p-totals .strong { background: none; color: #111827; border-top: 1px solid #111827; border-radius: 0; padding: 8px 0; }
.paper { background: #fff; color: #111827; border-radius: 10px; padding: 18px 16px; font-size: 11.5px; line-height: 1.4; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 14px 30px -18px rgba(0, 0, 0, 0.5); }
.paper b { font-weight: 700; }
.p-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 10px; border-bottom: 2px solid var(--accent); }
.p-biz { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.p-title { font-size: 20px; font-weight: 800; color: var(--accent); text-align: right; line-height: 1.1; }
.p-title small { display: block; margin-top: 4px; font-size: 10.5px; font-weight: 500; color: #606a7a; }
.p-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 14px 0; }
.p-parties > div { min-width: 0; overflow-wrap: anywhere; }
.p-label { display: block; font-size: 8.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #606a7a; margin-bottom: 2px; }
.p-line { font-size: 10px; color: #606a7a; }
.p-table { margin-top: 6px; }
.p-row { display: grid; grid-template-columns: 1fr 2.6em 5.2em 5.6em; gap: 8px; padding: 7px 0; border-bottom: 1px solid #d7dce4; }
.p-row > span { min-width: 0; overflow-wrap: anywhere; }
.p-row .r { text-align: right; }
.p-th { font-size: 8.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #606a7a; padding-top: 0; }
.p-totals { margin: 10px 0 4px auto; width: 70%; }
.p-totals > div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.p-totals .strong { margin-top: 6px; padding: 8px 10px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 13px; }
.p-note { margin-top: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.p-foot { margin-top: 16px; padding-top: 8px; border-top: 1px solid #d7dce4; font-size: 9.5px; color: #606a7a; white-space: pre-wrap; }

.logopick > * + * { margin-top: 10px; }
.logoshow { display: grid; place-items: center; min-height: 84px; padding: 10px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.logoshow img { max-width: 100%; max-height: 72px; object-fit: contain; }
.logoshow.empty { color: var(--ink-3); background: var(--surface-2); font-size: 13px; }
.p-logo { display: block; max-width: 120px; max-height: 38px; object-fit: contain; margin-bottom: 4px; }
.paper.l-modern .p-logo { background: #fff; padding: 4px 6px; border-radius: 6px; max-height: 44px; }

/* Apple-style continuous corners (squircles) where the browser supports them; the radius values stay as they are. */
@supports (corner-shape: squircle) {
  .sheet, .btn, .field, .seg, .seg-ind, .tab, .choice, .iconbtn { corner-shape: squircle; }
}

/* ---------- home activity chart ---------- */
.activity { display: grid; gap: 12px; }
.activity .readout .val { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; margin-top: 2px; }
.achart { display: block; width: 100%; height: auto; touch-action: pan-y; -webkit-user-select: none; user-select: none; outline: none; color: var(--chart-line); }
.achart:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
.achart .grid { stroke: var(--line); stroke-width: 1; }
.achart .zero { stroke: var(--ink-3); stroke-width: 1; opacity: 0.5; }
.achart .ax { fill: var(--ink-3); font-size: 9px; font-weight: 700; }
.achart .col { fill: currentColor; transition: opacity var(--t-fast) var(--ease); }
.achart .col.neg { fill: var(--bad); }
.achart .col.dim { opacity: 0.38; }
.achart .avg { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.7; }
.achart .cursor { stroke: var(--ink-2); stroke-width: 1; opacity: 0.35; }
.afoot { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.astat { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 8px 10px; border-radius: 14px; background: var(--surface-2); text-align: left; }
.astat span { font-size: 11px; font-weight: 700; color: var(--ink-3); }
.astat b { font-size: 14px; overflow-wrap: anywhere; }
.astat.tap:active { transform: scale(0.97); }
.afoot .seeall { grid-column: 1 / -1; }

/* blocks that open something: pressing answers at once, letting go springs back */
.tap { cursor: pointer; font: inherit; color: inherit; width: 100%; transition: transform var(--t-fast) var(--ease); }
.tap:active { transform: scale(0.98); transition-duration: 0.05s; }
.tap:disabled { cursor: default; opacity: 1; }
.tap:disabled:active { transform: none; }
.stat .lbl .go { margin-left: auto; opacity: 0.5; }
button.card { text-align: left; }
button.rank { display: block; background: none; border: 0; padding: 4px 0; }
button.rhead { background: none; border: 0; }
