:root {
--bg: #f3f4f2; --surface: #ffffff; --surface-2: #e9ebe9; --text: #151a1e; --muted: #5d6670;
--border: #d9dcdb; --accent: #0f6e6a; --accent-ink: #ffffff; --accent-soft: #d6ebe8;
--good: #15803d; --warn: #b45309; --bad: #b91c1c;
--radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
--safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
color-scheme: light;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #111517; --surface: #181d20; --surface-2: #20272a; --text: #e7ebec; --muted: #93a0a6;
--border: #2b3236; --accent: #45b5ab; --accent-ink: #0b1514; --accent-soft: #18332f;
--good: #4ade80; --warn: #fbbf24; --bad: #f87171; --shadow: none; color-scheme: dark;
}
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
.topbar {
position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
padding: calc(12px + var(--safe-t)) 16px 12px; background: color-mix(in srgb, var(--bg) 88%, transparent);
backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.topbar h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar #back { margin-left: -8px; margin-right: 4px; color: var(--accent); }
.icon-btn { background: none; border: 0; padding: 8px; border-radius: 10px; color: var(--muted); cursor: pointer; }
.icon-btn:active { background: var(--surface-2); }
main { padding: 4px 16px calc(96px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
.tabbar {
position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr);
background: var(--surface); border-top: 1px solid var(--border); padding: 6px 8px calc(6px + var(--safe-b));
}
.tab { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
font-size: 11px; color: var(--muted); padding: 6px 0; cursor: pointer; }
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--accent); }
.tab-add { align-self: center; justify-self: center; width: 52px; height: 52px; border-radius: 50%;
background: var(--accent); color: var(--accent-ink); justify-content: center; box-shadow: var(--shadow); }
.tab-add svg { width: 26px; height: 26px; }
.tab-add.active { color: var(--accent-ink); }
.tabbar[hidden] { display: none; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.card h2 { font-size: 15px; margin: 0 0 12px; color: var(--muted); font-weight: 600; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.kpi .label { font-size: 13px; color: var(--muted); }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.hero { grid-column: 1 / -1; background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.kpi.hero .label, .kpi.hero .sub { color: inherit; opacity: .85; }
.kpi.hero .value { font-size: 32px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .bar { fill: var(--accent); }
.chart .bar.zero { fill: var(--surface-2); }
.chart text { fill: var(--muted); font-size: 10px; }
.chart .gridline { stroke: var(--border); stroke-width: 1; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.rank li:first-child { border-top: 0; padding-top: 0; }
.rank .meter { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.rank .meter span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.rank .amt { font-variant-numeric: tabular-nums; font-weight: 600; }
.search { position: sticky; top: calc(58px + var(--safe-t)); z-index: 4; background: var(--bg); padding-bottom: 8px; }
.input, select.input, textarea.input {
width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
outline: none; appearance: none; -webkit-appearance: none; font-size: 16px; /* 16px avoids iOS zoom */
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 80px; resize: vertical; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--border); background: var(--surface); padding: 6px 14px; border-radius: 999px; font-size: 14px; cursor: pointer; }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 14px; border-top: 1px solid var(--border);
width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; cursor: pointer; }
.row:first-child { border-top: 0; }
.row:active { background: var(--surface-2); }
.row .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .what { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .amt { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.row .meta { font-size: 12px; color: var(--muted); text-align: right; }
.day { font-size: 13px; font-weight: 600; color: var(--muted); padding: 14px 4px 6px; display: flex; justify-content: space-between; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; margin-left: 6px; vertical-align: 1px; }
.badge.pending { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.refunded { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.form { display: grid; gap: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: none; padding: 9px 0; border-radius: 9px; font-size: 14px; cursor: pointer; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.total-line { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 2px; }
.total-line strong { font-size: 26px; font-variant-numeric: tabular-nums; }
.btn { display: block; width: 100%; border: 0; border-radius: 12px; padding: 14px; font-weight: 600; font-size: 16px; cursor: pointer;
background: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: .6; }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.danger { background: none; color: var(--bad); border: 1px solid var(--border); }
.btn + .btn { margin-top: 10px; }
.link { background: none; border: 0; color: var(--accent); font-weight: 600; cursor: pointer; padding: 8px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.error { color: var(--bad); font-size: 14px; }
.hero-auth { padding: 32px 0 20px; text-align: center; }
.hero-auth img { width: 72px; height: 72px; border-radius: 18px; }
.hero-auth h2 { margin: 14px 0 4px; font-size: 24px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%;
animation: sh 1.2s infinite; border-radius: var(--radius); height: 90px; margin-bottom: 12px; }
@keyframes sh { to { background-position: -200% 0; } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + var(--safe-b)); z-index: 20;
background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.badge.shipped { background: var(--accent-soft); color: var(--accent); }
.badge.paid { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.badge.cancelled { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.badge.test { background: var(--surface-2); color: var(--muted); }
.seg.four { grid-template-columns: repeat(4, 1fr); }
.seg.three { grid-template-columns: repeat(3, 1fr); }
.input.sm { padding: 9px 10px; }
.line { border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: grid; gap: 10px; background: var(--bg); }
.line-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.line-head .t { font-weight: 600; }
.line-head .s { font-size: 12px; color: var(--muted); }
.line-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.line-grid.two-c { grid-template-columns: repeat(2, 1fr); }
.line-grid label { font-size: 11px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }
.line-foot { display: flex; justify-content: space-between; font-size: 14px; }
.warn { color: var(--warn); font-size: 13px; }
.x-btn { border: 0; background: var(--surface-2); width: 30px; height: 30px; border-radius: 50%; font-size: 18px; line-height: 1; color: var(--muted); cursor: pointer; flex: none; }
.add-line { border: 1.5px dashed var(--border); background: none; border-radius: 12px; padding: 14px; width: 100%; color: var(--accent); font-weight: 600; cursor: pointer; }
.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; }
.sheet[hidden] { display: none; }
.sheet-body { background: var(--surface); width: 100%; max-width: 640px; margin: 0 auto; max-height: 88dvh; border-radius: 18px 18px 0 0;
display: flex; flex-direction: column; padding-bottom: var(--safe-b); }
.sheet-top { padding: 14px 16px 10px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--border); }
.sheet-top h3 { margin: 0; font-size: 17px; flex: 1; }
.sheet-list { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pick { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; width: 100%; text-align: left; background: none; border: 0;
border-bottom: 1px solid var(--border); padding: 12px 16px; cursor: pointer; }
.pick:active { background: var(--surface-2); }
.pick .c { font-weight: 700; font-family: ui-monospace, Menlo, monospace; font-size: 14px; }
.pick .n { color: var(--muted); font-size: 13px; grid-column: 1; }
.pick .oh { grid-row: 1 / span 2; grid-column: 2; align-self: center; text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.pick .oh.zero, .zero { color: var(--muted); opacity: .6; }
.cat { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--muted); padding: 12px 16px 6px; background: var(--bg); }
.code { font-family: ui-monospace, Menlo, monospace; font-weight: 700; }
.lines-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.lines-tbl td { padding: 8px 0; border-top: 1px solid var(--border); vertical-align: top; }
.lines-tbl tr:first-child td { border-top: 0; }
.lines-tbl td.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sum-row { display: flex; justify-content: space-between; padding: 4px 0; font-variant-numeric: tabular-nums; }
.sum-row.big { font-size: 20px; font-weight: 700; padding-top: 8px; }
.actions { display: grid; gap: 10px; }
.stock-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 11px 14px; border-top: 1px solid var(--border); }
.stock-row:first-child { border-top: 0; }
.stock-row .locq { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stock-row .tot { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
a.tel { color: var(--accent); text-decoration: none; font-weight: 600; }
.kpi .value.sm { font-size: 20px; }
