[hidden] { display: none !important; }
body { margin: 0; }
img { max-width: 100%; }
/* Layout: app shell. Phone = top bar + bottom tab bar with a centre "+" action; laptop = left sidebar + content column. */
:root {
  /* Mango Market (default, light) */
  --bg: #FFF8EE; --surface: #FFFFFF; --surface-2: #FDF0DC; --ink: #17302F; --muted: #5E706C; --line: #EEDFC8;
  --brand: #0E4D52; --on-brand: #FFF3DF; --brand-soft: #DCEDEA; --hero: #0E4D52; --on-hero: #FFF3DF;
  --accent: #FFB627; --on-accent: #2A1A00;
  --good: #1F8A5B; --warn: #C77700; --bad: #E2502F; --info: #1F6FB2;
  --chart-a: #0E4D52; --chart-b: #FFB627;
  --font-ui: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 16px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(23 48 47 / .06), 0 6px 20px rgb(23 48 47 / .06);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0C1F21; --surface: #12292B; --surface-2: #183538; --ink: #F5EBDD; --muted: #A2B3AF; --line: #24464A;
  --brand: #0A3639; --on-brand: #FFE7B8; --brand-soft: #1B3E41; --hero: #1F6166; --on-hero: #FFF3DF;
  --accent: #FFC24D; --on-accent: #2A1A00;
  --good: #4CC38A; --warn: #F2A93B; --bad: #FF7A5C; --info: #6AB4F0;
  --chart-a: #7FD1C7; --chart-b: #FFC24D; --shadow: 0 1px 2px rgb(0 0 0 / .3); color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0C1F21; --surface: #12292B; --surface-2: #183538; --ink: #F5EBDD; --muted: #A2B3AF; --line: #24464A;
  --brand: #0A3639; --on-brand: #FFE7B8; --brand-soft: #1B3E41; --hero: #1F6166; --on-hero: #FFF3DF;
  --accent: #FFC24D; --on-accent: #2A1A00;
  --good: #4CC38A; --warn: #F2A93B; --bad: #FF7A5C; --info: #6AB4F0;
  --chart-a: #7FD1C7; --chart-b: #FFC24D; --shadow: 0 1px 2px rgb(0 0 0 / .3); color-scheme: dark }

/* Island Blue */
:root[data-palette="island"] {
  --bg: #F8F3EA; --surface: #FFFFFF; --surface-2: #F1E6D3; --ink: #0B2233; --muted: #56697A; --line: #E4D8C4;
  --brand: #0B3C5D; --on-brand: #F6EBD9; --brand-soft: #DDEBF3; --hero: #0B3C5D; --on-hero: #F6EBD9;
  --accent: #00B4D8; --on-accent: #032430;
  --good: #1E8C62; --warn: #C46A00; --bad: #E8603A; --info: #0B78A8;
  --chart-a: #0B3C5D; --chart-b: #FF8C61; --font-ui: "Outfit", "Segoe UI", system-ui, sans-serif; }
@media (prefers-color-scheme: dark) { :root[data-palette="island"]:not([data-theme="light"]) {
  --bg: #07192A; --surface: #0D2438; --surface-2: #12304A; --ink: #EAF2F7; --muted: #9BB1C2; --line: #1D3D57;
  --brand: #05192A; --on-brand: #F6EBD9; --brand-soft: #143552; --hero: #17507A; --on-hero: #F6EBD9;
  --accent: #2CC9E8; --on-accent: #032430;
  --good: #4CC38A; --warn: #F2A93B; --bad: #FF8C61; --info: #6AB4F0; --chart-a: #5CC8E6; --chart-b: #FF9D76; } }
:root[data-palette="island"][data-theme="dark"] {
  --bg: #07192A; --surface: #0D2438; --surface-2: #12304A; --ink: #EAF2F7; --muted: #9BB1C2; --line: #1D3D57;
  --brand: #05192A; --on-brand: #F6EBD9; --brand-soft: #143552; --hero: #17507A; --on-hero: #F6EBD9;
  --accent: #2CC9E8; --on-accent: #032430;
  --good: #4CC38A; --warn: #F2A93B; --bad: #FF8C61; --info: #6AB4F0; --chart-a: #5CC8E6; --chart-b: #FF9D76; }

/* Calm Pro */
:root[data-palette="calm"] {
  --bg: #F2F5F4; --surface: #FFFFFF; --surface-2: #E8EEEC; --ink: #1B2A2F; --muted: #5B6B70; --line: #DCE4E2;
  --brand: #1B2A2F; --on-brand: #F2F5F4; --brand-soft: #DDF5EA; --hero: #1B2A2F; --on-hero: #F2F5F4;
  --accent: #3DDC97; --on-accent: #0B2A1D;
  --good: #16865A; --warn: #B86E00; --bad: #D64545; --info: #2F6FB0;
  --chart-a: #1B2A2F; --chart-b: #3DDC97; --font-ui: "Inter", "Segoe UI", system-ui, sans-serif; --radius: 12px; --radius-sm: 8px; }
@media (prefers-color-scheme: dark) { :root[data-palette="calm"]:not([data-theme="light"]) {
  --bg: #111A1D; --surface: #172327; --surface-2: #1E2D32; --ink: #E8EFED; --muted: #94A6A3; --line: #2A3B40;
  --brand: #0C1416; --on-brand: #E8EFED; --brand-soft: #1A3A2E; --hero: #1F4A3B; --on-hero: #E8EFED;
  --accent: #3DDC97; --on-accent: #0B2A1D;
  --good: #4CC38A; --warn: #F2A93B; --bad: #F07070; --info: #6AB4F0; --chart-a: #9FB6B1; --chart-b: #3DDC97; } }
:root[data-palette="calm"][data-theme="dark"] {
  --bg: #111A1D; --surface: #172327; --surface-2: #1E2D32; --ink: #E8EFED; --muted: #94A6A3; --line: #2A3B40;
  --brand: #0C1416; --on-brand: #E8EFED; --brand-soft: #1A3A2E; --hero: #1F4A3B; --on-hero: #E8EFED;
  --accent: #3DDC97; --on-accent: #0B2A1D;
  --good: #4CC38A; --warn: #F2A93B; --bad: #F07070; --info: #6AB4F0; --chart-a: #9FB6B1; --chart-b: #3DDC97; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--brand); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.num, .money { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: .86em; letter-spacing: -.01em; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; font-weight: 700; }
h3 { font-size: .95rem; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--muted); }

/* Shell */
.shell { min-height: 100%; display: grid; grid-template-columns: 1fr; }
.sidebar { display: none; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--brand); color: var(--on-brand);
  display: flex; align-items: center; gap: 12px; padding-block: 12px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.wordmark { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; }
.wordmark .seal { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.topbar .spacer { flex: 1; }
.sample-chip { font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; background: color-mix(in srgb, var(--on-brand) 16%, transparent); }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: color-mix(in srgb, var(--on-brand) 12%, transparent); color: var(--on-brand); display: grid; place-items: center; }
.main { padding-block: 20px 110px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); min-width: 0; }
.view { max-width: 1120px; margin: 0 auto; display: grid; gap: 18px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
.tab { border: 0; background: none; display: grid; justify-items: center; gap: 2px; font-size: .7rem; font-weight: 600; color: var(--muted); padding: 6px 0; text-decoration: none; }
.tab[aria-current="page"] { color: var(--brand); }
:root[data-theme="dark"] .tab[aria-current="page"] { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tab[aria-current="page"] { color: var(--accent); } }
.tab .pill { padding: 3px 14px; border-radius: 999px; }
.tab[aria-current="page"] .pill { background: var(--brand-soft); }
.fab { justify-self: center; width: 56px; height: 56px; margin-top: -26px; border-radius: 18px; border: 0; background: var(--accent); color: var(--on-accent); box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 45%, transparent); display: grid; place-items: center; }

@media (min-width: 900px) {
  .shell { grid-template-columns: 248px 1fr; }
  .sidebar { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; background: var(--brand); color: var(--on-brand); padding: 20px 14px; padding-left: max(14px, env(safe-area-inset-left, 0px)); }
  .sidebar .wordmark { padding: 4px 8px 18px; }
  .side-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: color-mix(in srgb, var(--on-brand) 80%, transparent); text-decoration: none; font-weight: 600; border: 0; background: none; text-align: left; }
  .side-link:hover { background: color-mix(in srgb, var(--on-brand) 8%, transparent); }
  .side-link[aria-current="page"] { background: color-mix(in srgb, var(--on-brand) 14%, transparent); color: var(--on-brand); }
  .side-link.primary { background: var(--accent); color: var(--on-accent); margin-bottom: 12px; justify-content: center; }
  .side-sep { height: 1px; background: color-mix(in srgb, var(--on-brand) 14%, transparent); margin: 10px 8px; }
  .side-note { font-size: .72rem; opacity: .6; padding: 0 12px; }
  .sidebar .grow { flex: 1; }
  .topbar .wordmark, .topbar .mobile-only { display: none; }
  .topbar { position: static; background: transparent; color: var(--ink); padding-top: 22px; padding-bottom: 0; }
  .topbar .sample-chip { background: var(--surface-2); color: var(--muted); }
  .topbar .icon-btn { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
  .tabbar { display: none; }
  .main { padding-bottom: 40px; padding-left: 28px; padding-right: max(28px, env(safe-area-inset-right, 0px)); }
}

/* Generic pieces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.btn { text-decoration: none; color: var(--ink); border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 16px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn.dark { background: var(--hero); border-color: transparent; color: var(--on-hero); }
.btn.small { padding: 6px 12px; font-size: .85rem; border-radius: 10px; }
.btn.block { width: 100%; justify-content: center; padding: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--hero); color: var(--on-hero); border-color: transparent; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-good { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.b-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
.b-bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.b-info { color: var(--info); background: color-mix(in srgb, var(--info) 14%, transparent); }
.b-mute { color: var(--muted); background: var(--surface-2); }
.thumb { width: 52px; height: 52px; border-radius: 12px; flex: none; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; color: var(--brand); font-size: .9rem; }
:root[data-theme="dark"] .thumb { color: var(--accent); }

/* Overview */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 4px; min-width: 0; }
.kpi.hero { background: var(--hero); color: var(--on-hero); border-color: transparent; }
.kpi .label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.kpi.hero .label { color: color-mix(in srgb, var(--on-hero) 75%, transparent); }
.kpi .value { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .78rem; color: var(--muted); }
.kpi.hero .sub { color: color-mix(in srgb, var(--on-hero) 75%, transparent); }
.delta { font-weight: 700; color: var(--good); }
.kpi.hero .delta { color: var(--accent); }
.grid-2 { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 14px; font-family: var(--font-ui); }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.hbar + .hbar { margin-top: 12px; }
.hbar .track { grid-column: 1 / -1; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--chart-b); border-radius: 99px; }
.hbar .name { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.stage { background: var(--surface-2); border-radius: 12px; padding: 10px 8px; text-align: center; position: relative; }
.stage b { display: block; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.stage span { font-size: .7rem; font-weight: 600; color: var(--muted); }
.stage.hot { background: var(--accent); color: var(--on-accent); }
.stage.hot span { color: var(--on-accent); opacity: .8; }
.alerts { display: grid; gap: 8px; }
.alert { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border-left: 4px solid var(--warn); }
.alert.bad { border-left-color: var(--bad); }
.alert.info { border-left-color: var(--info); }
.alert p { flex: 1; min-width: 0; font-size: .9rem; }
.alert .go { color: var(--muted); }

/* Lists of cards */
.list { display: grid; gap: 10px; }
@media (min-width: 900px) { .list.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.row-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; min-width: 0; }
.row-top { display: flex; gap: 12px; align-items: flex-start; }
.row-top .info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row-top .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: .82rem; color: var(--muted); }
.row-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.price { font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.margin { font-size: .82rem; font-weight: 700; color: var(--good); }
.more-btn { border: 0; background: var(--surface-2); width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }

/* Parcel timeline */
.timeline { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); position: relative; }
.timeline::before { content: ""; position: absolute; left: 8.33%; right: 8.33%; top: 7px; height: 3px; background: var(--line); border-radius: 3px; }
.timeline .progress { position: absolute; left: 8.33%; top: 7px; height: 3px; background: var(--accent); border-radius: 3px; }
.tl-step { display: grid; justify-items: center; gap: 4px; text-align: center; position: relative; }
.tl-dot { width: 17px; height: 17px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line); }
.tl-step.done .tl-dot { background: var(--accent); border-color: var(--accent); }
.tl-step.now .tl-dot { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.tl-step span { font-size: .68rem; font-weight: 600; color: var(--muted); line-height: 1.2; }
.tl-step small { font-size: .64rem; color: var(--muted); opacity: .8; font-variant-numeric: tabular-nums; }
.tl-step.now span { color: var(--ink); }

/* Stock */
.stock-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 8px; text-align: center; }
.stat b { display: block; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: .7rem; color: var(--muted); font-weight: 600; }

/* Import */
.steps { display: flex; gap: 8px; align-items: center; font-size: .82rem; font-weight: 700; color: var(--muted); flex-wrap: wrap; }
.steps .s { display: flex; align-items: center; gap: 6px; }
.steps .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: .75rem; }
.steps .s.on { color: var(--ink); }
.steps .s.on .n { background: var(--accent); color: var(--on-accent); }
.steps .line { width: 24px; height: 2px; background: var(--line); }
.drop { border: 2px dashed color-mix(in srgb, var(--brand) 35%, var(--line)); border-radius: var(--radius); padding: 28px 16px; text-align: center; display: grid; gap: 10px; justify-items: center; background: var(--surface); }
.drop.over { background: var(--brand-soft); }
.drop .big { width: 56px; height: 56px; border-radius: 16px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.previews { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.previews img { width: 64px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.scan { display: grid; gap: 10px; justify-items: center; padding: 30px 0; }
.scan .bar { width: min(320px, 100%); height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.scan .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 1.4s ease; }
.review { display: grid; gap: 14px; }
.found { font-size: .72rem; font-weight: 700; color: var(--good); display: inline-flex; gap: 4px; align-items: center; }
.fields { display: grid; gap: 10px 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .fields { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.fields .wide { grid-column: 1 / -1; }
.field { display: grid; gap: 4px; min-width: 0; }
.field label, .field .lbl { font-size: .75rem; font-weight: 700; color: var(--muted); }
.field input, .field select { width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: .95rem; }
.field .ro { padding: 10px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.calc { background: var(--surface-2); border-radius: 12px; padding: 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; font-size: .9rem; }
.calc b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.calc .eq { color: var(--muted); }
.seg { display: inline-grid; grid-auto-flow: column; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: none; padding: 8px 14px; border-radius: 9px; font-weight: 700; font-size: .85rem; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.tip { font-size: .85rem; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }

/* Sheet + popovers */
.backdrop { position: fixed; inset: 0; z-index: 20; background: rgb(5 15 16 / .45); display: grid; align-items: end; justify-items: center; }
.sheet { background: var(--surface); width: 100%; max-height: 92%; border-radius: 22px 22px 0 0; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
@media (min-width: 700px) { .backdrop { align-items: center; } .sheet { width: min(560px, 92vw); border-radius: 22px; max-height: 86%; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.sheet-body { overflow: auto; padding: 16px 18px; display: grid; gap: 14px; align-content: start; }
.sheet-foot { padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: grid; gap: 10px; }
.close-x { border: 0; background: var(--surface-2); width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.actions { display: grid; gap: 8px; }
.action { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); text-align: left; }
.action .ic { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.action b { display: block; }
.action small { color: var(--muted); }
.palettes { display: grid; gap: 10px; }
.pal { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); text-align: left; }
.pal[aria-pressed="true"] { border-color: var(--accent); }
.sw { display: flex; }
.sw i { width: 22px; height: 34px; }
.sw i:first-child { border-radius: 8px 0 0 8px; }
.sw i:last-child { border-radius: 0 8px 8px 0; }
.pal .check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; }
.pal[aria-pressed="true"] .check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 30; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: .9rem; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
@media (min-width: 900px) { .toast { bottom: 28px; } }
.menu { position: fixed; z-index: 25; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 30px rgb(0 0 0 / .18); padding: 6px; display: grid; min-width: 190px; }
.menu button { border: 0; background: none; text-align: left; padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.menu button:hover { background: var(--surface-2); }
.empty { text-align: center; color: var(--muted); padding: 24px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- App additions ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.login form { width: min(400px, 100%); display: grid; gap: 14px; }
.login .wordmark { color: var(--ink); justify-content: center; font-size: 1.3rem; }
.error { color: var(--bad); font-weight: 600; font-size: .9rem; }
.note { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-size: .9rem; display: grid; gap: 6px; }
.note.warn { border-left: 4px solid var(--warn); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.field textarea { width: 100%; min-height: 110px; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 12px; font: inherit; color: inherit; }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 6px; }
.pill-count { font-size: .75rem; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: 2px 8px; border-radius: 999px; }
.bm { display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 12px; background: var(--accent); color: var(--on-accent); font-weight: 800; text-decoration: none; cursor: grab; border: 2px dashed color-mix(in srgb, var(--on-accent) 35%, transparent); }
.steps-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.thumb { overflow: hidden; }
.mini { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; flex: none; background: var(--surface-2); }
.items-mini { display: flex; gap: 4px; flex-wrap: wrap; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
.danger { color: var(--bad); }
.linklike { border: 0; background: none; color: var(--info); font-weight: 700; padding: 0; text-decoration: underline; cursor: pointer; }
.more-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.more-grid .action { width: 100%; }
details.card summary { cursor: pointer; font-weight: 700; }
@media (max-width: 899px) { .desktop-only { display: none !important; } }
a.action { color: inherit; text-decoration: none; }
a.icon-btn { text-decoration: none; }
@media (min-width: 900px) { .desktop-hide { display: none !important; } }

/* ---------- 1.2: stock cards, purchases, filters ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filters .field select { width: auto; max-width: 100%; }
.stock-grid { grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
.pcard { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; padding: 12px; text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
.pcard:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); box-shadow: var(--shadow); transform: translateY(-1px); }
.pimg, .pimg-lg, .thumb72 { object-fit: cover; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; color: var(--brand); flex: none; overflow: hidden; }
.pimg { width: 112px; height: 112px; border-radius: 14px; font-size: 1.5rem; }
.pimg-lg { width: 180px; height: 180px; border-radius: 18px; font-size: 2.4rem; }
.thumb72 { width: 72px; height: 72px; border-radius: 12px; font-size: 1.1rem; }
:root[data-theme="dark"] .pimg, :root[data-theme="dark"] .pimg-lg, :root[data-theme="dark"] .thumb72 { color: var(--accent); }
.pbody { min-width: 0; display: grid; gap: 6px; align-content: start; }
.ptop { display: flex; gap: 8px; justify-content: space-between; align-items: flex-start; }
.pname { font-weight: 700; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pvar { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pqty { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: .85rem; }
.pqty b { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.pprice { display: flex; gap: 8px; align-items: center; font-size: .85rem; font-variant-numeric: tabular-nums; }
.marginbar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; flex: 1; min-width: 40px; }
.marginbar i { display: block; height: 100%; background: var(--good); border-radius: 99px; }
.pdetail { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
@media (max-width: 480px) { .pdetail .pimg-lg { width: 100%; height: auto; aspect-ratio: 1; max-width: 100%; } }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 560px) { .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.facts div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; display: grid; gap: 2px; }
.facts span { font-size: .72rem; color: var(--muted); font-weight: 600; }
.facts b { font-variant-numeric: tabular-nums; }
.stage-sub { display: block; font-size: .65rem; color: var(--muted); margin-top: 2px; }
.stage.hot .stage-sub { color: var(--on-accent); opacity: .75; }
.purchase-split { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 12px; font-size: .85rem; }
table.purchases td { vertical-align: middle; }

/* ---------- Extra themes: Ube, Sakura, Banana Leaf ---------- */
:root[data-palette="ube"] { --bg: #FBF7FF; --surface: #FFFFFF; --surface-2: #F1E8FA; --ink: #2A1840; --muted: #6B5A80; --line: #E4D7F1; --brand: #4B2E83; --on-brand: #F6EEFF; --brand-soft: #EADFF8; --hero: #4B2E83; --on-hero: #F6EEFF; --accent: #F2C14E; --on-accent: #2E1F00; --good: #1F8A5B; --warn: #B86E00; --bad: #D6455D; --info: #2F6FB0; --chart-a: #4B2E83; --chart-b: #F2C14E; --font-ui: "Outfit", "Segoe UI", system-ui, sans-serif; --radius: 12px; }
@media (prefers-color-scheme: dark) { :root[data-palette="ube"]:not([data-theme="light"]) { --bg: #160E24; --surface: #1F1533; --surface-2: #2A1D44; --ink: #F1EAFB; --muted: #B2A3C8; --line: #362654; --brand: #120A1F; --on-brand: #F1EAFB; --brand-soft: #34245A; --hero: #5B3A9C; --on-hero: #FFFFFF; --accent: #F5CB62; --on-accent: #2E1F00; --good: #4CC38A; --warn: #F2A93B; --bad: #FF7A8F; --info: #8AB8F0; --chart-a: #B79CF0; --chart-b: #F5CB62; } }
:root[data-palette="ube"][data-theme="dark"] { --bg: #160E24; --surface: #1F1533; --surface-2: #2A1D44; --ink: #F1EAFB; --muted: #B2A3C8; --line: #362654; --brand: #120A1F; --on-brand: #F1EAFB; --brand-soft: #34245A; --hero: #5B3A9C; --on-hero: #FFFFFF; --accent: #F5CB62; --on-accent: #2E1F00; --good: #4CC38A; --warn: #F2A93B; --bad: #FF7A8F; --info: #8AB8F0; --chart-a: #B79CF0; --chart-b: #F5CB62; }
:root[data-palette="sakura"] { --bg: #FFF6F8; --surface: #FFFFFF; --surface-2: #FCE8EE; --ink: #3A1F2B; --muted: #7A5A66; --line: #F3D6DF; --brand: #7A2E4E; --on-brand: #FFF0F4; --brand-soft: #F8DCE6; --hero: #7A2E4E; --on-hero: #FFF0F4; --accent: #FF8FB1; --on-accent: #3A0C1E; --good: #1F8A5B; --warn: #B86E00; --bad: #D64545; --info: #2F6FB0; --chart-a: #7A2E4E; --chart-b: #FF8FB1; --font-ui: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif; --radius: 18px; }
@media (prefers-color-scheme: dark) { :root[data-palette="sakura"]:not([data-theme="light"]) { --bg: #1E1117; --surface: #2A1820; --surface-2: #36202A; --ink: #FBEAF0; --muted: #C7A6B3; --line: #46293A; --brand: #180C12; --on-brand: #FBEAF0; --brand-soft: #4A2536; --hero: #8E3A5D; --on-hero: #FFFFFF; --accent: #FF9DBB; --on-accent: #3A0C1E; --good: #4CC38A; --warn: #F2A93B; --bad: #FF7A7A; --info: #8AB8F0; --chart-a: #E7A3BE; --chart-b: #FF9DBB; } }
:root[data-palette="sakura"][data-theme="dark"] { --bg: #1E1117; --surface: #2A1820; --surface-2: #36202A; --ink: #FBEAF0; --muted: #C7A6B3; --line: #46293A; --brand: #180C12; --on-brand: #FBEAF0; --brand-soft: #4A2536; --hero: #8E3A5D; --on-hero: #FFFFFF; --accent: #FF9DBB; --on-accent: #3A0C1E; --good: #4CC38A; --warn: #F2A93B; --bad: #FF7A7A; --info: #8AB8F0; --chart-a: #E7A3BE; --chart-b: #FF9DBB; }
:root[data-palette="leaf"] { --bg: #F6FAF0; --surface: #FFFFFF; --surface-2: #E9F2DC; --ink: #1B2B16; --muted: #5A6B52; --line: #DCE8CC; --brand: #1E4D2B; --on-brand: #F2FAE8; --brand-soft: #DCEFD0; --hero: #1E4D2B; --on-hero: #F2FAE8; --accent: #B5E655; --on-accent: #1A2A00; --good: #1F8A5B; --warn: #B86E00; --bad: #D64545; --info: #2F6FB0; --chart-a: #1E4D2B; --chart-b: #8FC23A; --font-ui: "Inter", "Segoe UI", system-ui, sans-serif; --radius: 14px; }
@media (prefers-color-scheme: dark) { :root[data-palette="leaf"]:not([data-theme="light"]) { --bg: #0F1A11; --surface: #152418; --surface-2: #1C3020; --ink: #E9F4E2; --muted: #9DB394; --line: #284430; --brand: #0A130C; --on-brand: #E9F4E2; --brand-soft: #1F3D27; --hero: #2B6A3C; --on-hero: #F2FAE8; --accent: #B5E655; --on-accent: #1A2A00; --good: #4CC38A; --warn: #F2A93B; --bad: #FF7A7A; --info: #8AB8F0; --chart-a: #8CC59A; --chart-b: #B5E655; } }
:root[data-palette="leaf"][data-theme="dark"] { --bg: #0F1A11; --surface: #152418; --surface-2: #1C3020; --ink: #E9F4E2; --muted: #9DB394; --line: #284430; --brand: #0A130C; --on-brand: #E9F4E2; --brand-soft: #1F3D27; --hero: #2B6A3C; --on-hero: #F2FAE8; --accent: #B5E655; --on-accent: #1A2A00; --good: #4CC38A; --warn: #F2A93B; --bad: #FF7A7A; --info: #8AB8F0; --chart-a: #8CC59A; --chart-b: #B5E655; }
.pdetail .badge { justify-self: start; }

/* ---------- Sage theme ---------- */
:root[data-palette="sage"] { --bg: #F5F7F2; --surface: #FFFFFF; --surface-2: #E8EDE3; --ink: #23302A; --muted: #66756C; --line: #DAE2D3; --brand: #5F7464; --on-brand: #F4F7F1; --brand-soft: #E1E9DC; --hero: #5F7464; --on-hero: #F7FAF4; --accent: #A3B899; --on-accent: #1E2A1A; --good: #2E7D57; --warn: #B06A12; --bad: #C8503F; --info: #3C6E9E; --chart-a: #5F7464; --chart-b: #A3B899; --font-ui: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif; --radius: 16px; }
@media (prefers-color-scheme: dark) { :root[data-palette="sage"]:not([data-theme="light"]) { --bg: #141A16; --surface: #1B231E; --surface-2: #232D26; --ink: #E8EEE6; --muted: #A2B0A4; --line: #2F3B33; --brand: #101512; --on-brand: #E8EEE6; --brand-soft: #2A3A2F; --hero: #4E6253; --on-hero: #F4F7F1; --accent: #A8BC95; --on-accent: #1A2416; --good: #4CC38A; --warn: #F2A93B; --bad: #FF7A7A; --info: #8AB8F0; --chart-a: #9FB5A3; --chart-b: #A8BC95; } }
:root[data-palette="sage"][data-theme="dark"] { --bg: #141A16; --surface: #1B231E; --surface-2: #232D26; --ink: #E8EEE6; --muted: #A2B0A4; --line: #2F3B33; --brand: #101512; --on-brand: #E8EEE6; --brand-soft: #2A3A2F; --hero: #4E6253; --on-hero: #F4F7F1; --accent: #A8BC95; --on-accent: #1A2416; --good: #4CC38A; --warn: #F2A93B; --bad: #FF7A7A; --info: #8AB8F0; --chart-a: #9FB5A3; --chart-b: #A8BC95; }
/* ---------- Sage & Gold theme: sage green with walnut brown and gold ---------- */
:root[data-palette="sagegold"] { --bg: #F4F6F0; --surface: #FFFFFF; --surface-2: #E7ECE1; --ink: #2E2620; --muted: #6E665C; --line: #DDDCCD; --brand: #5B4636; --on-brand: #F6EFE2; --brand-soft: #E3E9DC; --hero: #5F7464; --on-hero: #F7FAF4; --accent: #C9A227; --on-accent: #2A1F05; --good: #2E7D57; --warn: #A8641A; --bad: #B9473A; --info: #3C6E9E; --chart-a: #7D9270; --chart-b: #C9A227; --font-ui: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif; --radius: 16px; }
@media (prefers-color-scheme: dark) { :root[data-palette="sagegold"]:not([data-theme="light"]) { --bg: #171511; --surface: #201D17; --surface-2: #2A261F; --ink: #F0EBE1; --muted: #B3AA9B; --line: #3A342B; --brand: #43311F; --on-brand: #F4EADA; --brand-soft: #2F3A2C; --hero: #4E6253; --on-hero: #F4F7F1; --accent: #D4B24C; --on-accent: #231A03; --good: #4CC38A; --warn: #F2A93B; --bad: #FF7A6A; --info: #8AB8F0; --chart-a: #9FB5A3; --chart-b: #D4B24C; } }
:root[data-palette="sagegold"][data-theme="dark"] { --bg: #171511; --surface: #201D17; --surface-2: #2A261F; --ink: #F0EBE1; --muted: #B3AA9B; --line: #3A342B; --brand: #43311F; --on-brand: #F4EADA; --brand-soft: #2F3A2C; --hero: #4E6253; --on-hero: #F4F7F1; --accent: #D4B24C; --on-accent: #231A03; --good: #4CC38A; --warn: #F2A93B; --bad: #FF7A6A; --info: #8AB8F0; --chart-a: #9FB5A3; --chart-b: #D4B24C; }

/* Photos keep their square size; the global img max-width must not squeeze them in tight table columns. */
.thumb, .mini, .thumb72, .pimg { max-width: none; flex-shrink: 0; aspect-ratio: 1 / 1; }
table.purchases td:first-child, table.purchases th:first-child { width: 88px; min-width: 88px; }
table td:first-child > .mini { display: block; }
.kpi-link { text-align: left; cursor: pointer; font: inherit; color: inherit; }
.kpi-link:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.kpi-link .label { display: flex; align-items: center; gap: 4px; }
table.purchases td:nth-child(2) { min-width: 260px; max-width: 380px; }
table.purchases .clamp1 { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
table.purchases .ids { font-size: .72rem; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
table.purchases td:nth-child(2) { min-width: 220px; max-width: 290px; }
table.purchases .clamp1 { max-width: 280px; }
table.purchases th, table.purchases td { padding-left: 10px; padding-right: 10px; }
table.purchases td:nth-child(2) { max-width: 270px; }
table.purchases .clamp1 { max-width: 260px; }
.traces { list-style: none; margin: 12px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 10px; font-size: .85rem; }
.traces li { position: relative; display: grid; gap: 2px; }
.traces li::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.traces li.latest::before { background: var(--accent); }
.traces .when { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.trace-line { display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.trace-line svg { flex: none; }
.lines { display: grid; gap: 8px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) 116px 132px 36px; gap: 8px; align-items: center; }
/* Quantity with − and + buttons */
.stepper { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); overflow: hidden; }
.line .stepper input { border: 0; border-radius: 0; text-align: center; padding: 9px 2px; background: transparent; font-weight: 700; }
.stepper .step { border: 0; background: var(--surface-2); color: var(--ink); font-size: 1.15rem; font-weight: 700; cursor: pointer; line-height: 1; }
.stepper .step:hover:not(:disabled) { background: var(--brand-soft); }
.stepper .step:disabled { opacity: .35; cursor: default; }
/* A product already sold out on the listing: shown, but nothing to fill in */
.line-done { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 9px 10px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: .9rem; }
.line-done .clamp1 { color: var(--ink); text-decoration: line-through; text-decoration-color: var(--muted); }
@media (max-width: 560px) {
  .line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px; }
  .line .picker { grid-column: 1 / -1; }
  .line-head { display: none; }
  .line + .line, .line-done { margin-top: 4px; }
}
.line select, .line input { width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 9px 10px; font-size: .92rem; }
.line-head { font-size: .72rem; font-weight: 700; color: var(--muted); margin-bottom: -2px; }
.listing-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .85rem; }
.listing-items li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: baseline; }
.listing-items .clamp1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.traces .orig { font-size: .72rem; color: var(--muted); }
/* Sales by channel: revenue and profit bars per channel */
.channels { display: grid; gap: 16px; }
@media (min-width: 700px) { .channels { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; } }
.channel { display: grid; gap: 6px; }
.ch-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ch-head .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-head .muted { font-size: .8rem; white-space: nowrap; }
.ch-bar { display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem; gap: 10px; align-items: center; }
.ch-bar .track { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.ch-bar .fill { height: 100%; border-radius: 99px; }
.ch-bar .fill.a { background: var(--chart-a); }
.ch-bar .fill.b { background: var(--chart-b); }
.ch-bar .num { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .9rem; }
/* Restore point: two numbered steps with their button */
.rp-steps { display: grid; gap: 10px; }
.rp-step { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--surface-2); border-radius: var(--radius-sm, 10px); padding: 12px; }
.rp-step small { display: block; color: var(--muted); font-size: .82rem; }
.rp-n { width: 28px; height: 28px; border-radius: 99px; display: grid; place-items: center; background: var(--brand); color: var(--on-brand); font-weight: 700; font-size: .9rem; }
.rp-step .btn { white-space: nowrap; }
@media (max-width: 520px) { .rp-step { grid-template-columns: auto minmax(0, 1fr); } .rp-step .btn { grid-column: 1 / -1; justify-content: center; } }
/* Product picker: a search field on the line; the list below shows photo, name, variant and stock */
.picker { position: relative; min-width: 0; }
.line .pick-input { padding-left: 32px; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m16 16 4.5 4.5'/%3E%3C/svg%3E") no-repeat 10px center; text-overflow: ellipsis; }
.pick-pop { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; width: max(100%, 320px); max-width: calc(100vw - 40px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgb(0 0 0 / .18); padding: 8px; display: grid; gap: 6px; }
.pick-list { max-height: 300px; overflow-y: auto; display: grid; gap: 2px; }
.pick-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) 16px; gap: 10px; align-items: center; text-align: left; border: 0; background: none; border-radius: 8px; padding: 6px; color: var(--ink); font: inherit; cursor: pointer; }
.pick-item .mini { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.pick-item .pick-name { display: grid; min-width: 0; line-height: 1.25; }
.pick-item span.mini { display: grid; place-items: center; font-size: .72rem; font-weight: 700; color: var(--muted); background: var(--surface-2); }
.pick-item b { font-size: .9rem; font-weight: 600; }
.pick-item small { font-size: .76rem; color: var(--muted); }
.pick-item:hover, .pick-item.active { background: var(--surface-2); }
.pick-item[aria-selected="true"] svg { color: var(--good); }
.pick-more { margin: 4px 6px; font-size: .8rem; color: var(--muted); }
.sales-sum { margin: 0; font-size: .9rem; }
/* Buyers */
button.row-card { font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%; }
button.row-card:hover { border-color: var(--muted); }
.row-top .badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.buyer-card .thumb { display: grid; place-items: center; font-weight: 700; color: var(--muted); background: var(--surface-2); }
/* Insights */
.prod-cell { display: flex; gap: 10px; align-items: center; min-width: 180px; }
.prod-cell .mini { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.prod-cell span { display: grid; min-width: 0; line-height: 1.25; }
.prod-cell small { font-size: .78rem; }
.minibars { width: 100%; height: auto; display: block; }
.minibars text { fill: var(--muted); font-size: 12px; }
.agebar { display: flex; height: 16px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.age-legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.age-legend > div { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 2px 8px; align-items: center; }
.age-legend i { width: 12px; height: 12px; border-radius: 3px; }
.age-legend b, .age-legend small { grid-column: 2; font-variant-numeric: tabular-nums; }
.card-head h2 svg { vertical-align: -2px; color: var(--warn); }
@media (max-width: 620px) { .age-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.grid-2 > .card.stack { align-content: start; }
.prod-cell span.mini { display: grid; place-items: center; font-size: .72rem; font-weight: 700; color: var(--muted); background: var(--surface-2); flex: none; }
.minibars text { font-size: 11px; }
#pw-format { display: grid; grid-auto-flow: row; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
#pw-format button, #pw-lang button { padding: 8px 6px; }
@media (max-width: 560px) { #pw-format { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.badge.b-personal { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); }
/* Two buttons in a sheet footer: side by side when they fit, otherwise stacked at full width; never two-line labels */
.foot-buttons { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.foot-buttons .btn { flex: 1 1 auto; white-space: nowrap; justify-content: center; }
/* Paid modules that are off */
.badge.b-lock { background: var(--accent); color: var(--on-accent); gap: 5px; display: inline-flex; align-items: center; }
.badge.b-lock::before { display: none; }
/* Locked (Pro) buttons: a gold outline and a PRO chip, so they read as "upgrade", not as disabled */
.btn.is-locked { border: 1.5px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--ink); gap: 8px; }
.btn.is-locked:hover { background: color-mix(in srgb, var(--accent) 24%, var(--surface)); }
.pro-chip { display: inline-flex; align-items: center; gap: 3px; background: var(--accent); color: var(--on-accent); font-size: .66rem; font-weight: 800; letter-spacing: .06em; padding: 2px 6px 2px 5px; border-radius: 6px; line-height: 1.2; vertical-align: 1px; margin-left: 6px; }
.pro-chip svg { flex: none; }
.btn.is-locked .pro-chip { margin-left: 0; }
.locked { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: start; padding: 6px 0; }
.locked h2 { margin: 0; }
.locked .badge { justify-self: start; width: fit-content; }
.lock-ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.nav-lock { margin-left: auto; display: inline-flex; }
.nav-lock .pro-chip { margin-left: 0; }
.plan-list { display: grid; gap: 8px; }
.plan-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.plan-item small { display: block; font-size: .8rem; line-height: 1.35; }
.plan-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface); color: var(--muted); }
.plan-item.on .plan-ic { color: var(--good); }
@media (max-width: 520px) { .plan-item { grid-template-columns: 28px minmax(0, 1fr); } .plan-item > :last-child { grid-column: 2; justify-self: start; } }
.plan-switch { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; border: 1px dashed var(--line); }
.plan-switch small { display: block; font-size: .8rem; line-height: 1.35; }
@media (max-width: 520px) { .plan-switch { grid-template-columns: minmax(0, 1fr); } }
.plan-item.off .plan-ic { background: var(--accent); color: var(--on-accent); }
/* Four compact facts on one line (purchase sheet) */
.facts.facts-row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.facts.facts-row div { padding: 7px 8px; min-width: 0; align-content: start; }
.facts.facts-row b { font-size: .92rem; overflow-wrap: anywhere; }
.facts.facts-row small { font-size: .72rem; line-height: 1.25; }
/* Labels, amounts and notes line up across the four cards, even when a label wraps */
@supports (grid-template-rows: subgrid) {
  .facts.facts-row { grid-template-rows: auto auto auto; row-gap: 0; }
  .facts.facts-row div { grid-row: span 3; display: grid; grid-template-rows: subgrid; gap: 2px; align-content: stretch; }
  .facts.facts-row div > span { align-self: start; }
}
/* A problem in a sheet: above its buttons, in a tinted band that briefly flashes when it appears */
.sheet-msg { margin: 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--bad) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); }
.sheet-msg.flash { animation: msg-flash .6s ease-out; }
@keyframes msg-flash { 0% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-3px); } 100% { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .sheet-msg.flash { animation: none; } }
/* Settings → Problems */
.problems { display: grid; gap: 6px; }
.problem { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.problem summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 10px; cursor: pointer; list-style: none; }
.problem summary::-webkit-details-marker { display: none; }
.problem .p-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.problem .p-detail { padding: 0 10px 10px; font-size: .82rem; }
.problem pre { margin: 6px 0 0; white-space: pre-wrap; word-break: break-word; font-size: .75rem; background: var(--surface-2); padding: 8px; border-radius: 8px; max-height: 220px; overflow: auto; }
@media (max-width: 520px) { .problem summary { grid-template-columns: auto minmax(0, 1fr); } .problem summary small { grid-column: 2; } }
/* Online shop (admin) */
.nav-count { margin-left: auto; background: var(--accent); color: var(--on-accent); font-size: .72rem; font-weight: 800; min-width: 20px; padding: 1px 6px; border-radius: 99px; text-align: center; }
.switch-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; cursor: pointer; }
.switch-row input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); }
.switch-row small { display: block; font-size: .82rem; line-height: 1.35; }
.listing-items li .badge { margin-left: auto; }
/* Lines of a shop request: one block each, with its action under it */
.req-lines { display: grid; gap: 8px; }
.req-line { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; background: var(--surface); }
.rl-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.rl-title { font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; }
.rl-sum { font-size: .85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rl-act select { width: 100%; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--bg); font: inherit; }
.rl-quote { flex-wrap: wrap; gap: 6px; align-items: center; }
.rl-quote input { width: 110px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--bg); font: inherit; }
@media (max-width: 520px) { .rl-top { grid-template-columns: auto minmax(0, 1fr); } .rl-sum { grid-column: 1 / -1; } }
/* On/off switch (owner: modules one by one) */
.toggle { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.toggle span { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .15s; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .15s; }
.toggle input:checked + span { background: var(--good); }
.toggle input:checked + span::after { transform: translateX(18px); }
.toggle input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (max-width: 520px) { .plan-item:has(.toggle) { grid-template-columns: 28px minmax(0, 1fr) auto; } .plan-item:has(.toggle) > .toggle { grid-column: auto; align-self: center; } }
/* Add purchase: a new product line */
.np-line { border: 1px dashed var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 8px; }
.np-row { display: grid; grid-template-columns: 116px 132px minmax(0, 1fr) 36px; gap: 8px; align-items: end; }
.np-row .field label { font-size: .75rem; }
.np-row input { width: 100%; }
@media (max-width: 560px) { .np-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px; } .np-pcs-f { grid-column: 1 / 3; } }
#mp-source { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
.shop-tabs { display: grid; grid-template-columns: repeat(4, auto); }
@media (max-width: 560px) { .shop-tabs, #mp-source { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; } }
.np-line .stepper input { border: 0; border-radius: 0; text-align: center; padding: 9px 2px; background: transparent; font-weight: 700; width: 100%; min-width: 0; }
.np-line .stepper { background: var(--bg); }

/* What a Pro module switches, in Settings → Your plan */
.plan-effects { margin-top: 6px; }
.plan-effects summary { cursor: pointer; font-size: .8rem; font-weight: 700; color: var(--ink); list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.plan-effects summary::-webkit-details-marker { display: none; }
.plan-effects summary::before { content: '▸'; transition: transform .15s; }
.plan-effects[open] summary::before { transform: rotate(90deg); }
.plan-effects .effects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.plan-effects .eff { background: var(--surface); border-radius: 10px; padding: 8px 10px; font-size: .8rem; line-height: 1.4; }
.plan-effects .eff b { display: flex; align-items: center; gap: 5px; margin-bottom: 4px; }
.plan-effects .eff.on b { color: var(--good); }
.plan-effects .eff.off b { color: var(--muted); }
.plan-effects ul { margin: 0; padding-left: 16px; }
.plan-effects li + li { margin-top: 3px; }
@media (max-width: 560px) { .plan-effects .effects { grid-template-columns: 1fr; } }
.plan-item:has(.plan-effects) { align-items: start; }
.plan-item:has(.plan-effects) > .toggle, .plan-item:has(.plan-effects) > .badge, .plan-item:has(.plan-effects) > .btn { margin-top: 2px; }
@media (max-width: 560px) { .plan-item:has(.plan-effects) > .toggle { align-self: start; } }

/* Saved restore points in Settings */
.sp-list { display: grid; gap: 6px; }
.sp-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.sp-when { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sp-what { grid-column: 1; font-size: .78rem; }
.sp-btns { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 6px; align-items: center; }
.sp-btns .btn { white-space: nowrap; }
.sp-more summary { cursor: pointer; font-weight: 700; font-size: .9rem; }
.sp-more .sp-list { margin-top: 8px; }
.sp-dl { padding-left: 9px; padding-right: 9px; }
@media (max-width: 560px) {
  .sp-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sp-facts span { font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sp-facts b { font-size: .92rem; white-space: nowrap; }
  .sp-row { grid-template-columns: minmax(0, 1fr); }
  .sp-btns { grid-row: auto; grid-column: 1; margin-top: 6px; }
  .sp-btns .btn:first-child { flex: 1; justify-content: center; }
}
.facts.facts-row.sp-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sheet .btn.primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* Parcels with several products: up to 4 photos in the same 72px square as a single purchase photo */
.mosaic72 { width: 72px; height: 72px; flex: none; display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr; gap: 3px; border-radius: 12px; overflow: hidden; }
.mosaic72 .mini { width: 100%; height: 100%; border-radius: 0; aspect-ratio: auto; }
.mosaic72 > :only-child { grid-column: 1 / -1; grid-row: 1 / -1; }
.mosaic72:has(> :nth-child(2):last-child) { grid-template-rows: 1fr; }
.mosaic72:has(> :nth-child(2):last-child) > * { grid-row: 1; }
.mosaic72:has(> :nth-child(3):last-child) > :first-child { grid-row: 1 / span 2; }

/* Product photo with its name and key figures next to it (Stock product, Edit purchase) */
.pside { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; align-items: start; }
.pside-info { display: grid; gap: 6px; min-width: 0; align-content: start; justify-items: start; }
.pside-info > .facts { justify-self: stretch; margin-top: 4px; }
.facts.pkey { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts.pkey small { display: block; font-size: .72rem; }
@media (max-width: 480px) { .pside { grid-template-columns: minmax(0, 1fr); } .pside .pimg-lg { width: 100%; height: auto; aspect-ratio: 1; } }
.ptitle { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ptitle.open { display: block; }
.ptitle-more { font-size: .8rem; margin-top: -4px; }

/* Loader in the middle of the screen while something slow runs */
.busy { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--ink) 35%, transparent); backdrop-filter: blur(2px); }
.busy[hidden] { display: none; }
.busy-card { display: grid; justify-items: center; gap: 8px; text-align: center; width: min(340px, 100%); padding: 28px 24px 22px; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.busy-card b { font-size: 1.1rem; }
.busy-card span { color: var(--muted); font-size: .9rem; min-height: 1.3em; }
.busy-card small { color: var(--muted); font-size: .75rem; min-height: 1.2em; font-variant-numeric: tabular-nums; }
.busy-spin { width: 48px; height: 48px; margin-bottom: 6px; border-radius: 50%; border: 5px solid var(--surface-2); border-top-color: var(--accent); animation: busy-spin .8s linear infinite; }
@keyframes busy-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .busy-spin { animation-duration: 2.4s; } }
body.is-busy { overflow: hidden; }

/* Sync review: where you are, and a bar that stays in view until the sync is saved */
.sync-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .85rem; font-weight: 700; color: var(--muted); }
.sync-steps li { display: inline-flex; align-items: center; gap: 6px; }
.sync-steps li span:not(.wide-only) { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; border: 2px solid currentColor; }
.sync-steps li.done { color: var(--good); }
.sync-steps li.now { color: var(--ink); }
.sync-steps li.now span { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.sync-steps li + li::before { content: '→'; margin-right: 12px; color: var(--muted); font-weight: 400; }
.sync-bar { position: sticky; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 4; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 10px 30px rgb(0 0 0 / .16); }
.sync-bar-text { display: grid; gap: 2px; min-width: 0; }
.sync-bar-text b { display: inline-flex; align-items: center; gap: 6px; color: var(--warn, var(--ink)); }
.sync-bar-text small { color: var(--muted); font-size: .82rem; }
.sync-bar .btn { white-space: nowrap; }
@media (min-width: 900px) { .sync-bar { bottom: 16px; } }
@media (max-width: 560px) { .sync-bar { grid-template-columns: 1fr auto; } .sync-bar-text { grid-column: 1 / -1; } .sync-bar .btn.primary { justify-content: center; } }
@media (max-width: 560px) { .sync-steps .wide-only { display: none; } .sync-steps { gap: 6px 10px; } .sync-steps li + li::before { margin-right: 6px; } }

/* Tags: one colour per tag, readable in light and dark */
.tag-green { --c: #2e9e5b; } .tag-teal { --c: #1f9a96; } .tag-blue { --c: #2f74c0; } .tag-purple { --c: #7b5cc4; } .tag-pink { --c: #d0498f; }
.tag-red { --c: #d9473b; } .tag-orange { --c: #e07a1f; } .tag-yellow { --c: #c29306; } .tag-slate { --c: #6b7b8c; }
.tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; line-height: 1.4; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: color-mix(in srgb, var(--c) 78%, var(--ink)); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); }
.ptags { display: flex; flex-wrap: wrap; gap: 4px; }
.chip .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 1px; }
.chip-act { color: var(--muted); border-style: dashed; display: inline-flex; align-items: center; gap: 4px; }
.tag-filter { margin-top: -4px; }
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-toggle { border-radius: 999px; padding: 5px 12px; font-size: .8rem; font-weight: 700; cursor: pointer; border: 1.5px solid color-mix(in srgb, var(--c, var(--muted)) 45%, transparent);
  background: var(--surface); color: color-mix(in srgb, var(--c, var(--muted)) 70%, var(--ink)); display: inline-flex; align-items: center; gap: 4px; }
.tag-toggle[aria-pressed="true"] { background: var(--c); color: #fff; border-color: var(--c); }
.tag-toggle[aria-pressed="true"]::before { content: '✓'; font-size: .75rem; }
.tag-toggle.tag-new { border-style: dashed; color: var(--muted); }
.ptag-edit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ptag-edit .tag-picker { display: contents; }
/* Selecting products in Stock */
.stock-grid.selecting .pcard { position: relative; }
.pick-mark { position: absolute; left: 18px; top: 18px; z-index: 1; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: rgb(0 0 0 / .25); box-shadow: 0 1px 4px rgb(0 0 0 / .3); display: grid; place-items: center; color: transparent; }
.pcard.picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.pcard.picked .pick-mark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.sel-bar { grid-template-columns: minmax(0, 1fr) repeat(4, auto); margin-top: 12px; }
.sel-bar .sync-bar-text b { color: var(--ink); }
@media (max-width: 760px) { .sel-bar { grid-template-columns: 1fr 1fr; } .sel-bar .sync-bar-text { grid-column: 1 / -1; } .sel-bar .btn { justify-content: center; } }
/* Suggestions from AI, and managing tags */
.ai-rows { display: grid; gap: 10px; }
.ai-row { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.ai-row > div { display: grid; gap: 6px; min-width: 0; }
.ai-row small { display: block; font-size: .75rem; }
.tag-admin { display: grid; gap: 6px; }
.tag-admin-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 0; text-align: left; color: inherit; cursor: pointer; }
.color-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 3px var(--ink); }
/* Compact tags on cards and in lists: a coloured dot and the name */
.tdot { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 700; color: color-mix(in srgb, var(--c) 75%, var(--ink)); white-space: nowrap; }
.tdot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.pvar .ptags { display: inline-flex; gap: 8px; margin-right: 8px; vertical-align: 1px; }
@media (max-width: 760px) {
  .sel-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 10px; }
  .sel-bar .sync-bar-text { grid-column: 1 / 3; }
  .sel-bar .btn.primary { grid-column: 3; grid-row: 1; }
  .sel-bar .btn { padding: 8px 6px; font-size: .85rem; min-width: 0; }
  .sel-bar .wide-only { display: none; }
}
.sheet .linklike.danger { white-space: normal; text-align: left; color: var(--bad); }
/* Search on its own line, the two dropdowns side by side (phones) */
@media (max-width: 560px) {
  .filters:has(> :nth-child(3)) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters:has(> :nth-child(3)) > .grow { grid-column: 1 / -1; }
  .filters:has(> :nth-child(3)) select { width: 100%; }
}
.np-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.np-tags > .muted { font-size: .78rem; font-weight: 600; margin-right: 2px; }
.np-tags .tag-picker { display: contents; }
.np-tags .tag-toggle { padding: 3px 10px; font-size: .75rem; }
/* A button whose action is still running: a spinner, and no second click */
.is-loading { position: relative; cursor: progress !important; }
.btn.is-loading, button.is-loading { opacity: .85; }
.is-loading::after { content: ''; display: inline-block; width: 14px; height: 14px; margin-left: 8px; vertical-align: -2px; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: busy-spin .7s linear infinite; }
input.is-loading, select.is-loading { opacity: .6; }
input.is-loading::after, select.is-loading::after { content: none; }
@media (prefers-reduced-motion: reduce) { .is-loading::after { animation-duration: 2s; } }
/* Pinduoduo accounts */
.sync-account { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.sync-account > .muted:first-child { font-size: .8rem; font-weight: 700; }
.sync-account select, .sync-account input { width: auto; min-width: 0; padding: 7px 10px; }
.sync-account small { flex-basis: 100%; font-size: .78rem; }
.acct-tag { display: inline-block; margin-right: 4px; }
.acct-rows { display: grid; gap: 10px; }
.acct-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(0, 2fr) minmax(0, 2fr); gap: 12px; align-items: center; }
.acct-name .tdot { font-size: .9rem; }
.acct-fig { position: relative; display: grid; gap: 1px; padding-bottom: 7px; }
.acct-fig span { font-size: .72rem; color: var(--muted); font-weight: 600; }
.acct-fig small { font-size: .75rem; }
.acct-bar { position: absolute; left: 0; bottom: 0; height: 4px; border-radius: 4px; min-width: 2px; }
.acct-bar.spent { background: var(--chart-b, var(--muted)); }
.acct-bar.sold { background: var(--chart-a, var(--accent)); }
@media (max-width: 560px) { .acct-row { grid-template-columns: 1fr 1fr; } .acct-name { grid-column: 1 / -1; } }
.acct-admin { display: grid; gap: 8px; }
.acct-admin-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.acct-admin-row small { grid-column: 2 / -1; font-size: .75rem; order: 9; }
.acct-admin-row input, .acct-admin-row select { padding: 7px 10px; width: 100%; }
.swatch-mini { width: 14px; height: 14px; border-radius: 50%; background: var(--c); }
@media (max-width: 560px) { .acct-admin-row { grid-template-columns: auto minmax(0, 1fr) auto; } .acct-admin-row .acct-color { grid-column: 2; } }
.acct-table td small { display: block; font-size: .72rem; }
.acct-admin-row { grid-template-columns: auto minmax(0, 1fr) 110px auto auto; }
@media (max-width: 560px) { .acct-admin-row { grid-template-columns: auto minmax(0, 1fr) 96px auto; } .acct-admin-row .acct-color { grid-column: auto; } .acct-admin-row [data-act=acct-delete] { grid-column: 2; justify-self: start; } }
/* Account in the sync review: a quiet line when recognised, a small card for a new one */
.sync-account .tdot { font-size: .9rem; }
.sync-account .linklike { font-size: .85rem; margin-left: auto; }
.sync-account.unsure { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.sync-account.new { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); background: var(--surface); }
.sync-account.new > b { display: inline-flex; align-items: center; gap: 8px; }
.sync-account.new .field input { max-width: 320px; }
.acct-picks { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex-basis: 100%; }
.acct-picks > .muted { font-size: .8rem; font-weight: 600; margin-right: 2px; }
.acct-picks .tag-toggle { padding: 4px 11px; font-size: .78rem; }
@media (max-width: 560px) { .color-pick { gap: 6px; } .swatch { width: 28px; height: 28px; } }
.purchases tr.gone-row td { opacity: .55; } .purchases tr.gone-row td:last-child { opacity: 1; }

/* Foolproof sync instructions */
.how { display: grid; gap: 8px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.how h3 { display: flex; align-items: center; gap: 7px; font-size: .95rem; margin: 0; }
.how .steps-list { gap: 9px; }
.how .steps-list li { line-height: 1.5; }
.kbd { display: inline-block; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); font-size: .82em; font-weight: 700; font-family: inherit; }
.bm-drop { display: grid; justify-items: center; gap: 6px; padding: 10px; }
.seg button svg { vertical-align: -2px; }
@media (max-width: 480px) { #synchow button, #syncphone button { font-size: .85rem; padding: 9px 4px; } }

/* Welcome on the login page */
.login-hi { display: grid; gap: 4px; margin: 2px 0 4px; }
.login-hi h1 { margin: 0; font-size: 1.4rem; }
.login-hi p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.login-new { margin-top: 2px; }
.login-new summary { cursor: pointer; font-size: .85rem; font-weight: 700; color: var(--ink); }
.login-new p { margin: 8px 0 0; font-size: .82rem; line-height: 1.5; }
.how.step0 { border: 1.5px solid color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 10%, var(--surface-2)); }
.how.step0 h3 { color: color-mix(in srgb, var(--warn) 75%, var(--ink)); }

/* Sub-modules of the online shop: indented, with a connector line */
.plan-child { margin-left: 20px; position: relative; }
.plan-child::before { content: ''; position: absolute; left: -12px; top: -4px; bottom: 50%; width: 10px; border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); border-bottom-left-radius: 8px; }
.plan-child + .plan-item:not(.plan-child) { margin-top: 10px; }
.toggle.off-dep { opacity: .45; cursor: not-allowed; }
.needs-off { color: var(--warn); font-weight: 700; }
@media (max-width: 520px) { .plan-child { margin-left: 14px; } }

/* Hub: customers */
.hub-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hub-list { display: grid; gap: 12px; }
.hub-card.is-paused { opacity: .72; }
.hub-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px 12px; flex-wrap: wrap; }
.hub-name b { font-size: 1.05rem; }
.hub-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.hub-hosts { font-size: .88rem; overflow-wrap: anywhere; }
.hub-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hub-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fact-bad { color: var(--bad); }
.hub-seg { display: flex; flex-wrap: wrap; }
.hub-mods { display: grid; gap: 10px; padding: 12px 14px; background: var(--surface-2); border-radius: 12px; }
.hub-hosts-dns { display: grid; gap: 6px; margin-bottom: 8px; }
.hub-host-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hub-host-row .chip { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.hub-dns { font-size: .78rem; }
.hub-dns:not(.badge) { color: var(--muted); }
.hub-x { border: 0; background: none; padding: 0; color: var(--muted); cursor: pointer; display: inline-flex; }
.hub-x:hover { color: var(--bad); }
.row-inline { display: flex; gap: 8px; }
.row-inline input { flex: 1; min-width: 0; }
.hub-pw { font: 700 1.15rem ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .05em; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; user-select: all; overflow-wrap: anywhere; }
.hub-detail { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .78rem; max-height: 240px; overflow: auto; background: var(--surface-2); padding: 8px; border-radius: 8px; }
@media (min-width: 1100px) { .hub-facts { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .hub-kpis { grid-template-columns: 1fr 1fr; }
  .hub-kpis .kpi:last-child { grid-column: span 2; }
  .hub-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Plan usage */
.usage { display: grid; gap: 6px; }
.usage-top { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; }
.usage-bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.usage-bar i { display: block; height: 100%; background: var(--good); border-radius: 999px; }
.usage.is-near .usage-bar i { background: var(--warn); }
.usage.is-full .usage-bar i { background: var(--bad); }
.wait-list { margin: 6px 0 0; padding-left: 18px; font-size: .85rem; }

.hub-requests .hub-req { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.hub-msg { margin: 0; white-space: pre-wrap; font-size: .9rem; background: var(--surface-2); padding: 8px 10px; border-radius: 10px; }

.trial-banner { margin: 0 0 14px; }
.trial-banner a { font-weight: 700; }
.hub-trial .row-inline { align-items: center; flex-wrap: wrap; }
.hub-trial .row-inline span { flex: 1; min-width: 140px; }
