/* HoloLedger — dark, holo-accented, phone-first */
:root {
  --bg: #0f1020; --panel: #181a33; --panel2: #20234a; --line: #2c2f5c; --text: #eef0ff; --muted: #9aa0c8;
  --accent: #7c5cff; --accent2: #22c1c3; --gold: #f5c542; --pos: #4ade80; --neg: #ff6b7a; --warn: #f5a742;
  --holo: linear-gradient(110deg, #7c5cff, #22c1c3 40%, #f5c542 70%, #ff7a59);
  --r: 14px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: #a99bff; text-decoration: none; }
h1, h2, h3, h4 { margin: .2em 0 .5em; line-height: 1.2; }
h2 { font-size: 22px; } h3 { font-size: 16px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: 12px; }
small, .small { font-size: 12.5px; } .muted { color: var(--muted); } .center { text-align: center; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .err { color: var(--neg); min-height: 1em; margin: 0; }
code { background: var(--panel2); padding: 2px 8px; border-radius: 6px; font-size: 16px; letter-spacing: .1em; cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
pre { white-space: pre-wrap; }

/* layout */
#app { min-height: 100vh; }
#topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-t)) 12px 8px; background: rgba(15,16,32,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 800; flex: none; }
.brand img { width: 28px; height: 28px; } .brand span { background: var(--holo); -webkit-background-clip: text; background-clip: text; color: transparent; }
.scope { display: flex; gap: 6px; overflow-x: auto; flex: 1; scrollbar-width: none; } .scope::-webkit-scrollbar { display: none; }
.syncdot { flex: none; border: 0; background: var(--panel2); color: var(--muted); font-size: 11px; border-radius: 99px; padding: 4px 8px; min-width: 14px; min-height: 14px; cursor: pointer; }
.syncdot.ok { background: var(--pos); padding: 0; width: 12px; height: 12px; min-width: 12px; }
.syncdot.pending { background: var(--warn); color: #1a1300; } .syncdot.off { background: #555a7a; color: #fff; }
main#view { padding: 14px 14px calc(90px + var(--safe-b)); max-width: 980px; margin: 0 auto; }
body:not(.authed) main#view { padding: 0; max-width: none; }
#tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; background: rgba(20,21,42,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
#tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 7px 0 6px; color: var(--muted); font-size: 11px; }
#tabbar a span { font-size: 20px; line-height: 1.2; } #tabbar a.on { color: var(--text); }
#sidenav { display: none; }
@media (min-width: 900px) {
  #tabbar { display: none !important; }
  body.authed #sidenav:not([hidden]) { display: flex; flex-direction: column; position: fixed; top: 58px; left: 0; bottom: 0; width: 200px; padding: 12px; gap: 2px; border-right: 1px solid var(--line); }
  #sidenav a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; color: var(--muted); }
  #sidenav a.on, #sidenav a:hover { background: var(--panel); color: var(--text); }
  body.authed main#view { margin-left: 200px; padding: 22px 28px 40px; }
  .fab { bottom: 28px !important; }
}

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); padding: 10px 14px; border-radius: 12px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 42px; }
.btn:hover { border-color: #444a8a; } .btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; } .btn.danger { color: var(--neg); border-color: #5a2a3a; } .btn.danger:not(.ghost) { background: var(--neg); color: #fff; }
.btn.small { padding: 6px 10px; min-height: 32px; font-size: 13px; } .btn.wide { width: 100%; }
.row { display: flex; gap: 8px; align-items: center; margin: 10px 0; } .row.wrap { flex-wrap: wrap; } .row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; min-height: 42px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; } .grid2 .full { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 99px; padding: 5px 11px; font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer; min-height: 0; width: auto; }
.chip.on { color: var(--text); background: var(--panel2); border-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; } .dot.big { width: 14px; height: 14px; }
.tag { font-style: normal; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--panel2); color: var(--muted); font-weight: 600; margin-left: 4px; }
.tag.sale { background: rgba(74,222,128,.15); color: var(--pos); } .tag.warn { background: rgba(245,167,66,.18); color: var(--warn); }
section { margin: 18px 0; }
.banner { display: block; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; margin: 0 0 12px; color: var(--text); }
.banner.show { border-color: var(--accent2); } .banner.warn { border-color: var(--warn); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.kpis.small { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi small { color: var(--muted); } .kpi b { font-size: 21px; } .kpi.big b { font-size: 26px; background: var(--holo); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kpi.pos b { color: var(--pos); } .kpi.neg b { color: var(--neg); }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } @media (max-width: 640px) { .cols2 { grid-template-columns: 1fr; } }

/* lists */
.list { display: flex; flex-direction: column; gap: 6px; }
.itemrow, .line { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); color: var(--text); }
.itemrow.gone { opacity: .55; }
.thumb { width: 44px; height: 61px; object-fit: contain; border-radius: 6px; background: var(--panel2); flex: none; }
.thumb.ph, .bigimg.ph { display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--muted); text-align: center; }
.it { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.it b { overflow: hidden; text-overflow: ellipsis; } .it small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iv { display: flex; flex-direction: column; align-items: flex-end; flex: none; } .iv small { color: var(--muted); } .iv small.pos { color: var(--pos); } .iv small.neg { color: var(--neg); }
.line .mini { width: 92px; flex: none; } .mini input { padding: 7px 8px; min-height: 36px; }
.line .alloc { font-weight: 700; color: var(--accent2); flex: none; }
.x { border: 0; background: none; color: var(--muted); font-size: 22px; cursor: pointer; padding: 0 4px; }
.lines { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.fliprow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); color: var(--text); }
.fliprow span:first-child { display: flex; flex-direction: column; min-width: 0; } .fliprow small { color: var(--muted); }
.listhead { display: flex; gap: 8px; } .listhead select { width: 150px; flex: none; }
.pick { margin: 0; width: 20px; height: 20px; }
.fab { position: fixed; right: 18px; bottom: calc(76px + var(--safe-b)); width: 56px; height: 56px; border-radius: 50%; background: var(--holo); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 28px; box-shadow: 0 6px 22px rgba(124,92,255,.5); z-index: 15; }
.table { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.tr { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--line); color: var(--text); align-items: center; }
.tr:first-child { border-top: 0; } .tr.th { color: var(--muted); font-size: 12px; font-weight: 600; } .tr span small { display: block; color: var(--muted); }
.table.admin .tr { grid-template-columns: 2.2fr 1.2fr 1.2fr .8fr 1.6fr; }
@media (max-width: 640px) { .table.admin .tr { grid-template-columns: 1fr 1fr; } }
.summary { display: flex; flex-wrap: wrap; gap: 6px 16px; background: var(--panel); border-radius: var(--r); padding: 12px 14px; border: 1px solid var(--line); }
.summary b { margin-left: auto; font-size: 18px; }

/* item */
.itemhead { display: grid; grid-template-columns: 180px 1fr; gap: 18px; margin: 10px 0; }
.itemhead .bigimg { width: 180px; height: 251px; object-fit: contain; border-radius: 12px; background: var(--panel2); }
@media (max-width: 560px) { .itemhead { grid-template-columns: 110px 1fr; gap: 12px; } .itemhead .bigimg { width: 110px; height: 154px; } .itemhead h2 { font-size: 18px; } }
.prices span { display: inline-block; margin: 2px 8px 2px 0; color: var(--muted); } .prices span.on { color: var(--text); font-weight: 700; }
.card-form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.actions .btn { flex: 1; }

/* picker / modal */
body.modal-open { overflow: hidden; }
.modal-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(5,6,15,.7); display: flex; align-items: flex-end; justify-content: center; }
.modal { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 20px 20px 0 0; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; padding: 18px 16px calc(18px + var(--safe-b)); }
.modal.wide { max-width: 720px; }
@media (min-width: 700px) { .modal-wrap { align-items: center; } .modal { border-radius: 20px; } }
.modal-x { position: absolute; top: 8px; right: 10px; border: 0; background: none; color: var(--muted); font-size: 28px; cursor: pointer; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; }
.tab { border: 1px solid var(--line); background: var(--bg); color: var(--muted); padding: 8px 12px; border-radius: 10px; font: inherit; white-space: nowrap; cursor: pointer; }
.tab.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.searchrow { display: flex; gap: 6px; margin-bottom: 10px; } .searchrow .num { width: 90px; flex: none; }
.results { display: flex; flex-direction: column; gap: 6px; }
.result { display: flex; align-items: center; gap: 10px; text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 8px; color: var(--text); font: inherit; cursor: pointer; }
.result:hover { border-color: var(--accent); }
.result img { width: 50px; height: 70px; object-fit: contain; flex: none; } .r-t { flex: 1; display: flex; flex-direction: column; } .r-t small { color: var(--muted); } .r-p { font-weight: 700; color: var(--accent2); text-align: right; }
.scanbtn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px; border: 2px dashed var(--accent); border-radius: 16px; color: var(--text); cursor: pointer; font-size: 17px; font-weight: 600; text-align: center; }
.scanprev { max-width: 160px; max-height: 220px; display: block; margin: 12px auto; border-radius: 10px; }
.cardhead { display: flex; gap: 14px; margin: 8px 0; } .cardhead img { width: 120px; border-radius: 8px; flex: none; }
.variants { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 0 0 12px; } .variants legend { color: var(--gold); font-weight: 600; padding: 0 6px; }
.variant { flex-direction: row; align-items: center; gap: 10px; padding: 8px 4px; color: var(--text); font-size: 15px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.variant:last-child { border-bottom: 0; } .variant span { flex: 1; } .variant small { width: 100%; padding-left: 26px; color: var(--muted); }
.addbtns { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 8px 0; } @media (max-width: 480px) { .addbtns { grid-template-columns: repeat(3, 1fr); } }
.addbtns .btn { padding: 8px 4px; font-size: 13px; }

/* show mode */
.showhead { display: flex; justify-content: space-between; align-items: flex-start; background: var(--holo); border-radius: var(--r); padding: 14px 16px; color: #0d0d1a; margin-bottom: 12px; }
.showhead h2 { margin: 2px 0; color: #0d0d1a; } .showhead small { color: #1b1b33; font-weight: 600; }
.net { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,.75); } .net.off { background: #1b1b33; color: #fff; }
.bigbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.bigbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 104px; border-radius: 18px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; }
.bigbtn span { font-size: 32px; } .bigbtn:active { transform: scale(.98); }
.qrbox { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin: 10px 0; }
.qrbox [data-qr] { width: 110px; flex: none; background: #fff; border-radius: 8px; cursor: zoom-in; } .qrbox [data-qr]:empty { display: none; }
.qrfull { background: #fff; color: #000; padding: 16px; border-radius: 12px; text-align: center; } .qrfull svg { width: 100%; max-width: 420px; }
.salerow { display: flex; gap: 6px; align-items: center; } .salerow .itemrow { flex: 1; } .salerow input { width: 96px; flex: none; }

/* settings */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.plan { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.plan.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; } .plan b { font-size: 22px; } .plan b small { font-size: 12px; color: var(--muted); }
.plan ul { padding-left: 18px; margin: 8px 0; color: var(--muted); font-size: 13px; }
.colrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); } .colrow b { flex: 0 1 auto; } .colrow span { flex: 1; }
.feerow { display: flex; align-items: center; gap: 10px; padding: 4px 0; } .feerow span { flex: 1; } .feerow .mini { width: 90px; }
.swatches { display: flex; gap: 10px; } .swatches label { cursor: pointer; } .swatches input { display: none; }
.swatches i { display: block; width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; } .swatches input:checked + i { border-color: #fff; }
.legal { color: var(--muted); text-align: center; margin: 18px 0; }
.empty { text-align: center; padding: 30px 10px; background: var(--panel); border-radius: var(--r); border: 1px dashed var(--line); }
.hl { background: var(--panel); border: 1px solid var(--accent2); border-radius: var(--r); padding: 12px; }

/* auth */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(circle at 20% 10%, rgba(124,92,255,.25), transparent 50%), radial-gradient(circle at 80% 90%, rgba(34,193,195,.18), transparent 50%); }
.authcard { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 24px; }
.logo { text-align: center; margin-bottom: 14px; } .logo img { width: 64px; } .logo h1 { margin: 6px 0 2px; font-size: 28px; background: var(--holo); -webkit-background-clip: text; background-clip: text; color: transparent; } .logo p { color: var(--muted); margin: 0; }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* toasts */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + var(--safe-b)); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { background: #2a2d5a; border: 1px solid var(--line); color: var(--text); padding: 11px 14px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.4); transition: opacity .35s, transform .35s; }
.toast.ok { border-color: var(--pos); } .toast.err { border-color: var(--neg); } .toast.warn { border-color: var(--warn); }
.toast.out { opacity: 0; transform: translateY(8px); }
details summary { cursor: pointer; }
