/* Shattered Web: dark-only, taken from the logo (black ground, violet shards, lilac web lines).
   Layout: sticky header with tabs on desktop, bottom tab bar on phones; item editor slides in as a side sheet. */
:root {
  --bg: #09070E;
  --surface: #12101A;
  --surface-2: #1A1624;
  --surface-3: #231D31;
  --line: #2D2640;
  --ink: #EFEAFB;
  --muted: #A49BBD;
  --accent: #9B5CFF;
  --accent-hi: #B47EFF;
  --lilac: #CDB0FF;
  --accent-ink: #0B0812;
  --accent-soft: rgba(155, 92, 255, .16);
  --good: #5AD6A0;
  --good-soft: rgba(90, 214, 160, .13);
  --bad: #FF6B7F;
  --bad-soft: rgba(255, 107, 127, .13);
  --warn: #FFC15C;
  --warn-soft: rgba(255, 193, 92, .13);
  --vinted: #42CBD1;
  --depop: #FF7272;
  --ebay: #F1C84B;
  --scrim: rgba(4, 3, 8, .72);
  --shadow: 0 10px 40px rgba(0, 0, 0, .55);
  --f-display: "Archivo", "Arial Black", system-ui, sans-serif;
  --f-stencil: "Saira Stencil One", "Archivo", Impact, sans-serif;
  --shard: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  --shard-sm: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  --web: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 900 900'%3E%3Cpath d='M900,-40L726,945M900,-40L462,859M900,-40L244,715M900,-40L81,534M900,-40L-27,335M900,-40L-85,134M900,-40L-100,-57M881,68Q869,55 852,59Q845,44 828,43Q825,27 810,23Q812,8 798,1Q803,-12 792,-21Q800,-32 790,-42M862,177Q838,151 804,158Q789,127 756,126Q751,94 720,86Q723,56 696,42Q707,15 683,-2Q699,-24 680,-44M841,295Q804,255 751,266Q729,219 677,217Q669,168 621,155Q627,108 585,87Q601,46 565,19Q590,-16 560,-46M818,423Q768,367 694,382Q663,317 592,315Q581,247 515,230Q522,165 464,136Q487,79 437,42Q471,-6 430,-48M794,561Q728,489 633,508Q593,424 500,420Q486,333 400,310Q410,226 334,189Q363,114 299,66Q343,4 290,-51M768,708Q686,619 567,643Q517,538 401,534Q384,424 277,396Q289,291 195,245Q232,152 152,92Q206,15 140,-53' fill='none' stroke='%23CDB0FF' stroke-opacity='.075' stroke-width='1.6'/%3E%3C/svg%3E");
  --drip: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 16'%3E%3Cpath d='M0 0H120V3H108Q106 3 106 5V7A2 2 0 0 1 102 7V5Q102 3 100 3H87Q85 3 85 5V13A2 2 0 0 1 81 13V5Q81 3 79 3H50Q48 3 48 5V8A2 2 0 0 1 44 8V5Q44 3 42 3H21Q19 3 19 5V11A2 2 0 0 1 15 11V5Q15 3 13 3H0Z' fill='%239B5CFF'/%3E%3C/svg%3E");
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --r: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  background-image: var(--web), radial-gradient(900px 420px at 50% -120px, rgba(155, 92, 255, .16), transparent 70%), radial-gradient(600px 500px at 0% 100%, rgba(91, 43, 192, .10), transparent 70%);
  background-size: min(900px, 120vw) auto, auto, auto;
  background-position: right top, 0 0, 0 0;
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--lilac); outline-offset: 2px; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; text-wrap: balance; }
h2 { font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: rgba(9, 7, 14, .86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.top-in { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 10px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand img { width: 34px; height: 34px; display: block; }
.brand span { font-family: var(--f-display); font-stretch: 125%; font-weight: 800; font-size: 16px; letter-spacing: .04em; text-transform: uppercase; }
.brand span b { color: var(--accent-hi); font-weight: 800; }
.tabs { display: flex; gap: 2px; flex: 1; }
.tab { border: 0; background: none; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab[aria-current="page"] { color: var(--ink); background: var(--surface-3); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.icon-btn { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--muted); flex: none; }
.icon-btn:hover { color: var(--ink); border-color: var(--muted); }
.icon-btn svg { width: 18px; height: 18px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 9px; padding: 9px 14px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: var(--accent-ink); border-color: var(--bad); }
.btn.good { color: var(--good); border-color: var(--good); background: var(--good-soft); }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; padding-block: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Bottom nav (phone) */
.bnav { display: none; }
@media (max-width: 760px) {
  .tabs { display: none; }
  .add-label { display: none; }
  .brand span { font-size: 14px; }
  .bnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(12, 10, 18, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
    padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
  .bnav button { border: 0; background: none; padding: 6px 2px; display: grid; justify-items: center; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 500; }
  .bnav button svg { width: 21px; height: 21px; }
  .bnav button[aria-current="page"] { color: var(--lilac); font-weight: 600; }
}

/* Page */
.page { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 22px calc(110px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 20px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(26px, 4.4vw, 34px); font-weight: 800; font-stretch: 112%; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid rgba(155, 92, 255, .35); }
.banner.warn { background: var(--warn-soft); border-color: rgba(255, 193, 92, .35); }
.banner p { margin: 0; min-width: 0; flex: 1 1 240px; }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; border-radius: 6px; padding: 6px 10px; font-size: 13px; color: var(--muted); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head .sub { color: var(--muted); font-size: 13px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.kpi .v { font-family: var(--f-display); font-weight: 800; font-size: clamp(22px, 3.2vw, 30px); letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .s { color: var(--muted); font-size: 12.5px; }
.kpi.lead { background: linear-gradient(140deg, #5A2BC0, #2B1660 70%); border-color: rgba(205, 176, 255, .35); }
.kpi.lead .eyebrow, .kpi.lead .s { color: var(--lilac); }
.pos { color: var(--good); } .neg { color: var(--bad); }
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.grid2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

.stockline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stockline > div { padding: 2px 14px; border-left: 1px solid var(--line); display: grid; gap: 2px; }
.stockline > div:first-child { border-left: 0; padding-left: 0; }
.stockline b { font-family: var(--f-mono); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .stockline { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; } .stockline > div:nth-child(3) { border-left: 0; padding-left: 0; } }

/* Chart */
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--accent); }
.chart .bar.dim { fill: var(--accent); opacity: .4; }
.chart .bar.neg { fill: var(--bad); }
.chart .zero { stroke: var(--line); stroke-width: 1; }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.chart text { fill: var(--muted); font-family: var(--f-mono); font-size: 11px; }
.chart text.val { fill: var(--ink); font-weight: 600; }

/* Tables & lists */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 0 8px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 8px 9px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl td.r { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.list { display: grid; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border: 0; border-bottom: 1px solid var(--line); text-align: left; width: 100%; background: none; }
.list-row:last-child { border-bottom: 0; }
button.list-row:hover .lr-title { color: var(--lilac); }
.lr-main { flex: 1; min-width: 0; }
.lr-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-meta { color: var(--muted); font-size: 12.5px; }
.empty-note { color: var(--muted); padding: 6px 0; margin: 0; }

/* Chips */
.plat { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 7px 2px 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.plat::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.plat-vinted { color: var(--vinted); } .plat-depop { color: var(--depop); } .plat-ebay { color: var(--ebay); }
.plats { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; background: var(--surface-3); color: var(--muted); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.good { background: var(--good-soft); color: var(--good); }

/* Toolbar */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search { flex: 1 1 240px; min-width: 0; position: relative; }
.search input { width: 100%; padding: 10px 12px 10px 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); }
.search svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; margin-top: -8px; color: var(--muted); }
select.plain { padding: 9px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); }

/* Stock cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
@media (max-width: 440px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.card { text-align: left; padding: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; overflow: hidden; display: grid; grid-template-rows: auto 1fr; min-width: 0; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.ph { position: relative; aspect-ratio: 4 / 5; max-width: 100%; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph-mono { font-family: var(--f-display); font-stretch: 125%; font-weight: 800; font-size: 28px; color: var(--surface-3); }
.swing { position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 6px; background: rgba(9, 7, 14, .82); color: var(--lilac); font-family: var(--f-mono); font-size: 11px; font-weight: 500; padding: 3px 8px 3px 6px; border-radius: 3px 6px 6px 3px; border: 1px solid rgba(205, 176, 255, .3); }
.swing i { width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--lilac); }
.cbody { padding: 10px 12px 12px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.ctitle { font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cmeta { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.price { font-family: var(--f-mono); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Sold rows */
.srows { display: grid; }
.srow { display: grid; grid-template-columns: 74px minmax(0, 1fr) 90px 92px 92px; gap: 12px; align-items: center; padding: 11px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; width: 100%; }
.srow:hover { background: var(--surface-2); }
.srow.head { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding-block: 0 8px; cursor: default; }
.srow.head:hover { background: none; }
.srow .n { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.srow .d { color: var(--muted); font-family: var(--f-mono); font-size: 12.5px; }
.s-metam { display: none !important; }
@media (max-width: 640px) {
  .srow { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main sale" "meta profit"; row-gap: 3px; }
  .srow.head { display: none; }
  .srow .s-main { grid-area: main; } .srow .s-sale { grid-area: sale; } .srow .s-profit { grid-area: profit; }
  .srow .d, .srow .s-plat { display: none; }
  .srow .s-metam { display: flex !important; grid-area: meta; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; }
}
.totals { display: flex; gap: 22px; flex-wrap: wrap; }
.totals div { display: grid; gap: 2px; }
.totals b { font-family: var(--f-mono); font-size: 17px; font-variant-numeric: tabular-nums; }

/* Forms */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.lab { font-size: 12px; font-weight: 600; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
.inp, .field select, .field textarea { width: 100%; padding: 10px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); min-width: 0; font-size: 16px; }
@media (min-width: 761px) { .inp, .field select, .field textarea { font-size: 14px; } }
.field textarea { min-height: 72px; resize: vertical; }
.inp:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.money { position: relative; }
.money span { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-family: var(--f-mono); }
.money .inp { padding-left: 24px; font-family: var(--f-mono); }
.toggles { display: flex; gap: 6px; flex-wrap: wrap; }
.toggle { border: 1px solid var(--line); background: var(--surface-2); border-radius: 99px; padding: 7px 12px 7px 10px; font-weight: 600; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.toggle::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; }
.toggle[aria-pressed="true"]::before { background: currentColor; }
.toggle[aria-pressed="true"].t-vinted { color: var(--vinted); border-color: currentColor; }
.toggle[aria-pressed="true"].t-depop { color: var(--depop); border-color: currentColor; }
.toggle[aria-pressed="true"].t-ebay { color: var(--ebay); border-color: currentColor; }
.err { color: var(--bad); font-size: 13px; margin: 0; }

/* Sheet */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; animation: fade .18s ease; }
.sheet { position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(580px, 100%); background: var(--surface); border-left: 1px solid var(--line); display: grid; grid-template-rows: auto 1fr auto; box-shadow: var(--shadow); animation: slide .22s cubic-bezier(.2, .8, .2, 1); padding-top: env(safe-area-inset-top, 0px); }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 14px max(18px, env(safe-area-inset-right, 0px)) 14px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px max(18px, env(safe-area-inset-right, 0px)) 24px 18px; display: grid; gap: 22px; align-content: start; }
.sheet-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px max(18px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) 18px; border-top: 1px solid var(--line); background: var(--surface); }
.sheet-foot .grow { flex: 1; }
.section { display: grid; gap: 12px; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 4 / 5; max-width: 100%; border-radius: 8px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .x { position: absolute; right: 4px; top: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(9, 7, 14, .85); color: var(--ink); font-size: 15px; line-height: 1; display: grid; place-items: center; }
.thumb .cover { position: absolute; left: 4px; bottom: 4px; font-size: 10px; font-weight: 700; background: rgba(9, 7, 14, .85); color: var(--lilac); padding: 2px 6px; border-radius: 4px; border: 0; }
.add-photo { position: relative; aspect-ratio: 4 / 5; max-width: 100%; border-radius: 8px; border: 1.5px dashed var(--line); display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; padding: 6px; }
.add-photo:hover { border-color: var(--accent); color: var(--lilac); }
.add-photo input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.receipt { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; display: grid; gap: 4px; font-family: var(--f-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.receipt div { display: flex; justify-content: space-between; gap: 10px; }
.receipt .tot { border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 2px; font-weight: 600; font-size: 14.5px; }
.sold-box { border: 1.5px solid var(--good); border-radius: 12px; padding: 14px; }

.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.photo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.photo-actions .btn { position: relative; padding-block: 12px; }
.photo-actions .btn svg { width: 18px; height: 18px; }
.money.unit .inp { padding-left: 11px; padding-right: 34px; }
.money.unit span { left: auto; right: 10px; }
.form.meas { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.checklist { display: grid; gap: 8px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.cl-head { display: flex; justify-content: space-between; align-items: center; }
.cl-missing { display: flex; gap: 5px; flex-wrap: wrap; }
.meter.done i { background: var(--good); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 14px; }
.steps li { display: grid; gap: 8px; color: var(--muted); }
.steps li::marker { color: var(--lilac); font-family: var(--f-mono); font-weight: 600; }
.steps li > div, .steps li > textarea { color: var(--ink); }

/* ---------- Logo theme: stencil type, shards, drips ---------- */
.brand span { font-family: var(--f-stencil); font-stretch: normal; font-weight: 400; letter-spacing: .06em; font-size: 18px; }
.page-head h1 { font-family: var(--f-stencil); font-weight: 400; font-stretch: normal; text-transform: uppercase; letter-spacing: .03em; font-size: clamp(28px, 5vw, 38px); }
.auth-card h1, .welcome h2 { font-family: var(--f-stencil); font-weight: 400; font-stretch: normal; letter-spacing: .05em; }
.top { border-bottom: 0; }
.top::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 12px; background: var(--drip) repeat-x 0 0 / 120px 16px; opacity: .55; pointer-events: none; }
.btn.primary, .cam-next { clip-path: var(--shard-sm); border-radius: 0; }
.btn.primary { background: linear-gradient(135deg, var(--accent-hi), var(--accent) 55%, #7A3CEB); }
.kpi.lead { clip-path: var(--shard); border-radius: 0; border: 0;
  background:
    linear-gradient(118deg, transparent 52%, rgba(205, 176, 255, .14) 52.5%, transparent 68%),
    linear-gradient(200deg, transparent 40%, rgba(0, 0, 0, .25) 40.5%, transparent 75%),
    linear-gradient(140deg, #6A33D6, #3A1A86 60%, #22104F); }
.kpi.lead .v { text-shadow: 0 2px 18px rgba(205, 176, 255, .35); }
.panel, .kpi, .card { border-radius: 6px; }
.card:hover { box-shadow: 0 0 0 1px var(--accent), 0 10px 30px rgba(155, 92, 255, .18); }
.ph-mono { font-family: var(--f-stencil); font-weight: 400; color: var(--surface-3); font-size: 34px; }
.swing { clip-path: polygon(0 50%, 7px 0, 100% 0, 100% 100%, 7px 100%); padding-left: 12px; border-radius: 0; border: 0; background: rgba(9, 7, 14, .88); }
.swing i { display: none; }
.welcome { border-color: rgba(155, 92, 255, .4); background: linear-gradient(120deg, rgba(155, 92, 255, .10), transparent 60%), var(--surface); }
.tab-cam { display: inline-flex; align-items: center; gap: 6px; }
.tab-cam svg { width: 16px; height: 16px; }
.spin { border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); border: 0; background: var(--accent); animation: spin 1s linear infinite; }
.money-switch { display: none; }
@media (max-width: 760px) { .money-switch { display: inline-flex; justify-self: start; } }

/* ---------- Bottom bar: Snapchat-style centre camera ---------- */
@media (max-width: 760px) {
  .bnav { align-items: end; }
  .bnav-snap { position: relative; display: grid !important; place-items: center; padding: 0 !important; margin-top: -26px; }
  .bnav-snap > span { width: 60px; height: 60px; display: grid; place-items: center; clip-path: polygon(50% 0, 100% 28%, 100% 78%, 50% 100%, 0 78%, 0 28%); background: linear-gradient(150deg, var(--accent-hi), var(--accent) 50%, #4B21A8); color: #fff; }
  .bnav-snap svg { width: 26px !important; height: 26px !important; }
  .bnav-snap[aria-current="page"] > span { background: linear-gradient(150deg, #E3D0FF, var(--lilac) 40%, var(--accent)); color: var(--accent-ink); }
  .snap-badge { position: absolute; top: -2px; right: calc(50% - 38px); min-width: 20px; height: 20px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 11px; display: grid; place-items: center; padding: 0 5px; }
  body.on-camera { background: #000; overflow: hidden; }
  body.on-camera .bnav { background: rgba(0, 0, 0, .9); border-top-color: rgba(255, 255, 255, .06); }
}

/* ---------- Camera ---------- */
.page.page-cam { max-width: 1180px; padding-bottom: 24px; }
.cam { position: relative; height: calc(100vh - 110px); min-height: 520px; display: flex; flex-direction: column; background: #000; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.cam-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; }
.cam-top .brand { visibility: hidden; }
.cam-top .brand img { width: 30px; height: 30px; }
.cam-tools { display: flex; gap: 6px; }
.cam-icon, .cam-side { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .08); color: var(--ink); display: grid; place-items: center; position: relative; cursor: pointer; }
.cam-icon svg, .cam-side svg { width: 20px; height: 20px; }
.cam-icon.on { background: var(--lilac); color: var(--accent-ink); }
.cam-side:disabled { opacity: .35; }
.cam-stage { flex: 1; min-height: 0; container-type: size; display: grid; place-items: center; padding: 0 12px; }
.cam-frame { position: relative; width: min(100cqw, 80cqh); aspect-ratio: 4 / 5; max-width: 100%; overflow: hidden; border-radius: 10px; background: #0D0A14; }
.cam-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-frame video.mirror { transform: scaleX(-1); }
.cam-grid { position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255, 255, 255, .22) calc(33.33% - .5px), rgba(255, 255, 255, .22) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255, 255, 255, .22) calc(66.66% - .5px), rgba(255, 255, 255, .22) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
                    linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255, 255, 255, .22) calc(33.33% - .5px), rgba(255, 255, 255, .22) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255, 255, 255, .22) calc(66.66% - .5px), rgba(255, 255, 255, .22) calc(66.66% + .5px), transparent calc(66.66% + .5px)); }
.cam-corners i { position: absolute; width: 26px; height: 26px; border: 3px solid var(--lilac); pointer-events: none; }
.cam-corners i:nth-child(1) { left: 10px; top: 10px; border-right: 0; border-bottom: 0; }
.cam-corners i:nth-child(2) { right: 10px; top: 10px; border-left: 0; border-bottom: 0; }
.cam-corners i:nth-child(3) { left: 10px; bottom: 10px; border-right: 0; border-top: 0; }
.cam-corners i:nth-child(4) { right: 10px; bottom: 10px; border-left: 0; border-top: 0; }
.cam-flash { position: absolute; inset: 0; background: #fff; animation: camflash .14s ease-out forwards; }
@keyframes camflash { from { opacity: .85; } to { opacity: 0; } }
.cam-msg { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; padding: 24px; color: var(--muted); }
.cam-msg strong { color: var(--ink); font-size: 16px; }
.cam-msg .btn { position: relative; }
.cam-tray { height: 72px; flex: none; display: flex; gap: 8px; align-items: center; overflow-x: auto; padding: 8px 16px; scrollbar-width: none; }
.cam-tray::-webkit-scrollbar { display: none; }
.cam-hint { color: var(--muted); font-size: 12.5px; text-align: center; width: 100%; }
.cam-shot { position: relative; flex: none; width: 44px; height: 55px; border-radius: 5px; overflow: hidden; border: 1.5px solid var(--lilac); animation: pop .18s ease-out; }
.cam-shot img { width: 100%; height: 100%; object-fit: cover; }
.cam-shot button { position: absolute; right: 1px; top: 1px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .75); color: #fff; font-size: 12px; line-height: 1; display: grid; place-items: center; padding: 0; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.cam-controls { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 4px 28px 16px; }
.cam-controls > :first-child { justify-self: start; }
.cam-controls > :last-child { justify-self: end; }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 4px solid var(--lilac); background: transparent; padding: 5px; display: grid; place-items: center; transition: transform .08s; }
.shutter span { width: 100%; height: 100%; border-radius: 50%; display: block;
  background: radial-gradient(circle at 35% 30%, var(--accent-hi), var(--accent) 45%, #4B21A8); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .08); }
.shutter:active { transform: scale(.9); }
.shutter:disabled { opacity: .4; }
.cam-next { border: 0; background: linear-gradient(135deg, var(--accent-hi), var(--accent)); color: var(--accent-ink); font-weight: 700; padding: 11px 16px; display: inline-flex; gap: 8px; align-items: center; }
.cam-next b { background: var(--accent-ink); color: var(--lilac); border-radius: 99px; min-width: 22px; height: 22px; display: grid; place-items: center; font-size: 12px; padding: 0 6px; }
@media (max-width: 760px) {
  .page.page-cam { padding: 0; }
  .cam { position: fixed; z-index: 15; left: 0; right: 0; top: 0; bottom: calc(62px + env(safe-area-inset-bottom, 0px)); height: auto; min-height: 0; border: 0; border-radius: 0; padding-top: env(safe-area-inset-top, 0px); }
  .cam-top .brand { visibility: visible; }
  .cam-top .brand span { font-size: 15px; }
  .cam-stage { padding: 0 8px; }
}

/* ---------- "What makes you money" breakdown ---------- */
.bd-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.bd-pick { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 0 4px 0 12px; }
.bd-pick span { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.bd-pick select { border: 0; background: transparent; padding: 9px 6px; font-weight: 600; color: var(--lilac); font-size: 14px; cursor: pointer; }
.bd-pick select:focus { outline: none; }
.bd-pick:focus-within { border-color: var(--accent); }
.bd-insight { margin: 0 0 12px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); }
.bd-insight b { color: var(--lilac); }
.bd-rows { display: grid; }
.bd-row { border-bottom: 1px solid var(--line); }
.bd-row:last-child { border-bottom: 0; }
.bd-line { width: 100%; border: 0; background: none; text-align: left; display: grid; grid-template-columns: minmax(90px, 170px) minmax(0, 1fr) auto; grid-template-areas: "label track val" ". sub sub"; column-gap: 12px; row-gap: 3px; align-items: center; padding: 10px 0; }
.bd-line:hover .bd-label { color: var(--lilac); }
.bd-label { grid-area: label; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-track { grid-area: track; position: relative; height: 14px; background: var(--surface-2); }
.bd-zero { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--muted); opacity: .5; }
.bd-bar { position: absolute; top: 0; bottom: 0; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); clip-path: polygon(0 0, 100% 0, calc(100% - 5px) 100%, 0 100%); transition: width .3s ease, left .3s ease; }
.bd-bar.neg { background: var(--bad); clip-path: polygon(5px 0, 100% 0, 100% 100%, 0 100%); }
.bd-val { grid-area: val; font-family: var(--f-mono); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 72px; text-align: right; }
.bd-sub { grid-area: sub; color: var(--muted); font-size: 12px; }
.bd-row.open .bd-line { padding-bottom: 6px; }
.bd-items { padding: 0 0 10px; display: grid; }
.bd-items .list-row { padding-left: 10px; border-left: 2px solid var(--accent); }
@media (max-width: 520px) {
  .bd-line { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label val" "track track" "sub sub"; }
}

/* Tax */
.stmt { display: grid; }
.stmt div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.stmt div span:last-child { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.stmt .ind span:first-child { padding-left: 14px; color: var(--muted); }
.stmt .tot { border-bottom: 0; border-top: 2px solid var(--lilac); font-weight: 700; font-size: 15px; margin-top: 4px; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meter.hit i { background: var(--warn); }
.thresh { display: grid; gap: 14px; }
.thresh-row { display: grid; gap: 6px; }
.thresh-row .top-line { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.small { font-size: 12.5px; color: var(--muted); }
.note { color: var(--muted); font-size: 13px; margin: 0; max-width: 68ch; }
.export { display: flex; gap: 8px; flex-wrap: wrap; }

/* Expenses */
.exp-form { display: grid; grid-template-columns: 150px minmax(0, 1fr) 130px minmax(0, 1.4fr) auto; gap: 10px; align-items: end; }
@media (max-width: 860px) { .exp-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .exp-form .note-f, .exp-form > .btn { grid-column: 1 / -1; } }
.mgroup-head { display: flex; justify-content: space-between; padding: 14px 0 6px; font-weight: 600; border-bottom: 1px solid var(--line); }
.mgroup-head span:last-child { font-family: var(--f-mono); }
.erow { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }

/* Sign-in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.auth-card { width: min(380px, 100%); display: grid; gap: 16px; justify-items: center; text-align: center; }
.auth-card img { width: 148px; height: 148px; filter: drop-shadow(0 10px 40px rgba(155, 92, 255, .35)); }
.auth-card h1 { font-stretch: 125%; font-weight: 800; font-size: 26px; letter-spacing: .04em; text-transform: uppercase; }
.auth-card h1 b { color: var(--accent-hi); }
.auth-card form { width: 100%; display: grid; gap: 12px; text-align: left; }
.auth-card .msg { color: var(--muted); margin: 0; }
.setup { max-width: 620px; margin: 0 auto; }
.setup ol { padding-left: 20px; display: grid; gap: 8px; color: var(--muted); }
.setup code { font-family: var(--f-mono); color: var(--lilac); }

/* Toast, loading */
.toast { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100% - 32px); animation: rise .2s ease; }
@media (max-width: 760px) { .toast { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); } }
.loading { display: grid; place-items: center; gap: 12px; padding: 80px 0; color: var(--muted); text-align: center; }
.spin { width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.empty { text-align: center; padding: 40px 16px; display: grid; gap: 10px; justify-items: center; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 18px; }
.welcome { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; }
.welcome img { width: 72px; height: 72px; }
.welcome h2 { font-size: 18px; margin-bottom: 4px; }
.welcome p { margin: 0 0 12px; color: var(--muted); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
@keyframes rise { from { transform: translate(-50%, 8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
