/* Auc Invoice — app styles. Mobile-first, app-like, light + dark. */
@font-face { font-family: 'Inter'; src: url('/vendor/fonts/Inter-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/vendor/fonts/Inter-Bold.ttf') format('truetype'); font-weight: 600 800; font-display: swap; }

:root {
  --brand-1: #7b2ff7; --brand-2: #1e5bff;
  --grad: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  --bg: #f4f5fb; --surface: #ffffff; --surface-2: #f7f8fc; --surface-3: #eef0f8; --line: #e3e5ef; --line-2: #d4d7e6;
  --text: #15162a; --muted: #686c86; --faint: #9a9eb8;
  --accent: #5b2bf0; --accent-ink: #4a1fd0; --accent-soft: #efe9ff; --accent-soft-2: #e4dbff;
  --ok: #0f9d63; --ok-soft: #e1f6ec; --warn: #c27400; --warn-soft: #fff1dc; --bad: #d93a4a; --bad-soft: #fde7ea; --info: #1e5bff; --info-soft: #e4ecff;
  --radius: 14px; --radius-s: 10px; --radius-l: 20px;
  --shadow: 0 1px 2px rgba(21,22,42,.04), 0 8px 28px rgba(21,22,42,.06);
  --shadow-l: 0 12px 40px rgba(21,22,42,.16);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --sb: env(safe-area-inset-bottom, 0px); --st: env(safe-area-inset-top, 0px);
  --nav-h: 62px; --side-w: 248px;
  --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1020; --surface: #171830; --surface-2: #1d1f3a; --surface-3: #242748; --line: #2a2d4f; --line-2: #363a62;
    --text: #eceefb; --muted: #9ea2c2; --faint: #6c7093; --accent: #9d7dff; --accent-ink: #b59aff; --accent-soft: #2a2456; --accent-soft-2: #352c6e;
    --ok-soft: #113427; --warn-soft: #3a2a0e; --bad-soft: #3b1620; --info-soft: #152246;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 28px rgba(0,0,0,.35); --shadow-l: 0 12px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1020; --surface: #171830; --surface-2: #1d1f3a; --surface-3: #242748; --line: #2a2d4f; --line-2: #363a62;
  --text: #eceefb; --muted: #9ea2c2; --faint: #6c7093; --accent: #9d7dff; --accent-ink: #b59aff; --accent-soft: #2a2456; --accent-soft-2: #352c6e;
  --ok-soft: #113427; --warn-soft: #3a2a0e; --bad-soft: #3b1620; --info-soft: #152246;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 28px rgba(0,0,0,.35); --shadow-l: 0 12px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body { margin: 0; min-height: 100%; overflow-x: clip; background: var(--bg); color: var(--text); font: 14.5px/1.45 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.015em; font-weight: 700; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
p { margin: 0; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; } .tiny { font-size: 11.5px; }
.num { font-variant-numeric: tabular-nums; } .right { text-align: right; } .center { text-align: center; } .b { font-weight: 700; }
.hide { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .gap { gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt-s { margin-top: 8px; }

/* Boot */
.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 22px; background: var(--bg); }
.boot img { border-radius: 18px; box-shadow: var(--shadow); animation: pop .5s var(--ease); }
.boot-bar { width: 120px; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.boot-bar i { display: block; width: 40%; height: 100%; background: var(--grad); border-radius: 4px; animation: slide 1.1s infinite var(--ease); }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Layout */
.app { min-height: 100dvh; }
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--line); overflow: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; }
.brand img { width: 38px; height: 38px; border-radius: 11px; box-shadow: 0 4px 14px rgba(91,43,240,.3); }
.brand b { display: block; font-size: 16px; font-weight: 800; line-height: 1.1; }
.brand small { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; font-weight: 700; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: var(--muted); font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav a .badge { margin-left: auto; }
.side-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.store-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer; }
.store-chip:hover { background: var(--surface-2); }
.avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
main.view { min-width: 0; padding: 22px 28px 60px; animation: fadeUp .25s var(--ease); }
.topbar { display: none; }
.bottom-nav { display: none; }

/* Mobile */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--st)) 12px 8px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; } .topbar .brand img { width: 32px; height: 32px; }
  .topbar .tb-actions { margin-left: auto; display: flex; gap: 2px; }
  .topbar .tb-actions a, .topbar .tb-actions button { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); position: relative; }
  main.view { padding: 14px 14px calc(var(--nav-h) + var(--sb) + 20px); }
  .bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; height: calc(var(--nav-h) + var(--sb)); padding-bottom: var(--sb); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: var(--nav-h); font-size: 10.5px; font-weight: 600; color: var(--muted); }
  .bottom-nav a.active { color: var(--accent-ink); }
  .bottom-nav .fab { width: 54px; height: 54px; margin: 0 auto 8px; border-radius: 18px; border: 0; background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 22px rgba(91,43,240,.4); transform: translateY(-4px); }
  .bottom-nav .fab svg { width: 26px; height: 26px; }
  h1 { font-size: 21px; }
}

/* Page head */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 18px; }
.card.soft { background: var(--surface-2); box-shadow: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-body { padding: 16px 18px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); } .grid.c3 { grid-template-columns: repeat(3, 1fr); } .grid.c4 { grid-template-columns: repeat(4, 1fr); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid.dash { grid-template-columns: 1.6fr 1fr; align-items: start; }
@media (max-width: 1000px) { .grid.dash { grid-template-columns: 1fr; } }
.grid.auto-s { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
@media (max-width: 900px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } .grid.c4.keep2, .grid.c2.keep2 { grid-template-columns: 1fr 1fr; } }

/* Stat tiles */
.stat { padding: 16px 18px; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.stat .d { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat .d.up { color: var(--ok); } .stat .d.down { color: var(--bad); }
.stat.accent { background: var(--grad); color: #fff; border: 0; } .stat.accent .k, .stat.accent .d { color: rgba(255,255,255,.8); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; transition: transform .1s, background .15s, box-shadow .15s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); } .btn:active { transform: scale(.97); }
.btn.primary { background: var(--grad); color: #fff; border: 0; box-shadow: 0 6px 18px rgba(91,43,240,.28); } .btn.primary:hover { filter: brightness(1.06); }
.btn.soft { background: var(--accent-soft); color: var(--accent-ink); border: 0; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); } .btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); } .btn.danger.fill { background: var(--bad); color: #fff; border: 0; }
.btn.ok { background: var(--ok); color: #fff; border: 0; }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.lg { min-height: 48px; padding: 0 22px; font-size: 15.5px; border-radius: 13px; }
.btn.block { width: 100%; }
.btn.icon { width: 40px; padding: 0; } .btn.icon.sm { width: 32px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.seg { display: inline-flex; background: var(--surface-3); padding: 3px; border-radius: 11px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; font-weight: 600; color: var(--muted); font-size: 13px; transition: all .15s; display: inline-flex; align-items: center; gap: 6px; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg button svg { width: 16px; height: 16px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, label.lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 12px; color: var(--faint); }
.input, select.input, textarea.input { width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); outline: none; transition: border .15s, box-shadow .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.input.err { border-color: var(--bad); }
textarea.input { min-height: 80px; resize: vertical; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.input-wrap { position: relative; } .input-wrap .input { padding-left: 38px; } .input-wrap > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.input-wrap .prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; } .form-grid .span { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 10px 0; }
.toggle input { display: none; }
.toggle .sw { width: 42px; height: 24px; border-radius: 24px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.toggle .sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle input:checked + .sw { background: var(--accent); } .toggle input:checked + .sw::after { transform: translateX(18px); }
.toggle .t { display: flex; flex-direction: column; } .toggle .t small { color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; } .check input { width: 18px; height: 18px; accent-color: var(--accent); }
.err-msg { color: var(--bad); font-size: 13px; }

/* Badges / pills */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.info { background: var(--info-soft); color: var(--info); } .badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge.pro { background: linear-gradient(135deg, #f7b733, #fc4a1a); color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; } .dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }

/* Lists & tables */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.list-item:last-child { border-bottom: 0; } .list-item:hover { background: var(--surface-2); }
.list-item .t { font-weight: 600; } .list-item .s { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.list-item .amt { font-weight: 700; text-align: right; white-space: nowrap; }
.table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-weight: 700; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; } .tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--surface-2); }
.tbl .r { text-align: right; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ico { width: 64px; height: 64px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; } .empty .ico svg { width: 30px; height: 30px; }
.empty b { color: var(--text); font-size: 16px; }

/* Cards view */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.inv-card { padding: 14px; cursor: pointer; transition: transform .15s var(--ease), box-shadow .15s; display: flex; flex-direction: column; gap: 8px; }
.inv-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-l); }
.inv-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.inv-card .amt { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
/* service tickets: card link + Call / WhatsApp while the ticket is open; quick create hides the extra fields */
.inv-card .t-link { display: flex; flex-direction: column; gap: 8px; color: inherit; text-decoration: none; }
.t-acts { display: flex; gap: 8px; } .t-acts .btn { flex: 1; justify-content: center; }
.btn.wa { background: #25d366; border-color: #25d366; color: #fff; }
.bill-layout.quick .opt { display: none; }

/* Filters bar */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters .input { min-height: 38px; } .filters .search { flex: 1; min-width: 180px; }
.chips { display: flex; gap: 6px; overflow: auto; padding-bottom: 2px; scrollbar-width: none; } .chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.chip.active { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }

/* Billing editor */
.bill-layout { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .bill-layout { grid-template-columns: 1fr; } .bill-side { position: static !important; } }
.bill-side { position: sticky; top: 20px; }
.bill-layout > *, .grid > *, .settings-layout > *, .shell > * { min-width: 0; }
.lines { display: flex; flex-direction: column; gap: 8px; }
.line { display: grid; grid-template-columns: 1fr 72px 100px 110px 32px; gap: 8px; align-items: start; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid transparent; animation: fadeUp .2s var(--ease); }
.line.adv { grid-template-columns: 1.4fr 90px 70px 100px 70px 80px 110px 32px; }
.line:focus-within { border-color: var(--line-2); background: var(--surface); }
.line .input { min-height: 38px; padding: 7px 10px; }
.line .amt { min-height: 38px; display: flex; align-items: center; justify-content: flex-end; font-weight: 700; padding-right: 4px; }
.line .rm { width: 32px; height: 38px; border: 0; background: transparent; color: var(--faint); border-radius: 8px; display: grid; place-items: center; } .line .rm:hover { background: var(--bad-soft); color: var(--bad); }
.line .lh { font-size: 10.5px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; display: none; }
.line .cell { position: relative; }
@media (max-width: 700px) {
  .line, .line.adv { grid-template-columns: 1fr 1fr; }
  .line .cell.name { grid-column: 1 / -1; } .line .lh { display: block; }
  .line .cell.rmc { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
  .line .amt { justify-content: flex-start; } .line .rm { width: auto; padding: 0 10px; font-size: 12.5px; gap: 6px; }
}
.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-l); margin-top: 4px; max-height: 260px; overflow: auto; }
.suggest div { padding: 9px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; } .suggest div:hover, .suggest div.hl { background: var(--accent-soft); }
.suggest small { color: var(--muted); }
.totals { display: flex; flex-direction: column; gap: 6px; }
.totals .tr { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; } .totals .tr.muted { color: var(--muted); }
.totals .grand { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; margin: 6px -4px 0; border-radius: 12px; background: var(--accent-soft); font-weight: 800; font-size: 20px; letter-spacing: -.02em; } .totals .grand small { font-size: 13px; font-weight: 600; color: var(--muted); }
.quick-items { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.quick-items .chip { font-size: 12.5px; padding: 5px 11px; }

/* Modal / sheet */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(10, 10, 30, .5); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn .18s; }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); border-radius: var(--radius-l); box-shadow: var(--shadow-l); animation: fadeUp .22s var(--ease); }
.modal.wide { width: min(900px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 0; }
.modal-body { padding: 16px 20px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 20px; flex-wrap: wrap; }
@media (max-width: 560px) {
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; padding-bottom: var(--sb); animation: sheet .25s var(--ease); }
  .modal.wide { width: 100%; }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
}
.menu { position: absolute; z-index: 40; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-l); padding: 6px; animation: fadeUp .15s var(--ease); }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 9px 12px; border-radius: 9px; text-align: left; font-weight: 500; } .menu button:hover { background: var(--surface-2); } .menu button.danger { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* Toasts */
.toasts { position: fixed; left: 50%; top: calc(var(--st) + 10px); transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 24px)); pointer-events: none; }
@media (min-width: 901px) { .toasts { top: auto; bottom: 22px; } }
.toast { pointer-events: none; padding: 12px 16px; border-radius: 13px; background: #1c1d33; color: #fff; box-shadow: var(--shadow-l); animation: fadeUp .2s var(--ease); display: flex; align-items: center; gap: 10px; font-weight: 500; }
.toast button, .toast a { pointer-events: auto; }
.toast.ok { background: #0f9d63; } .toast.bad { background: #d93a4a; } .toast.warn { background: #c27400; }

/* Banner */
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 13px; margin-bottom: 16px; font-weight: 500; }
.banner.warn { background: var(--warn-soft); color: var(--warn); } .banner.info { background: var(--info-soft); color: var(--info); } .banner.bad { background: var(--bad-soft); color: var(--bad); } .banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner .btn { margin-left: auto; }

/* Plan card */
.plan-card { background: linear-gradient(135deg, #1a0b3d, #2a1660 60%, #1e3a8a); color: #fff; border: 0; padding: 20px; position: relative; overflow: hidden; }
.plan-card::after { content: ''; position: absolute; width: 260px; height: 260px; right: -90px; top: -120px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); }
.plan-card .muted { color: rgba(255,255,255,.72); }
.countdown { display: inline-flex; align-items: baseline; gap: 6px; font-size: 30px; font-weight: 800; letter-spacing: -.03em; } .countdown small { font-size: 13px; font-weight: 600; opacity: .8; }

/* Auth */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth .art { background: var(--grad); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth .art::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 20% 20%, rgba(255,255,255,.2), transparent 45%), radial-gradient(circle at 80% 80%, rgba(0,0,0,.2), transparent 45%); }
.auth .art > * { position: relative; }
.auth .art h1 { font-size: 40px; line-height: 1.1; max-width: 480px; }
.auth .art ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; font-size: 15px; } .auth .art li { display: flex; gap: 10px; align-items: center; }
.auth .pane { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth .box { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth .art { padding: 28px 22px; min-height: 0; } .auth .art h1 { font-size: 26px; } .auth .art ul { display: none; } }

/* Templates gallery */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tpl { border: 2px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer; background: var(--surface); transition: transform .15s var(--ease), border-color .15s; position: relative; }
.tpl:hover { transform: translateY(-2px); } .tpl.active { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.tpl img { display: block; width: 100%; aspect-ratio: 300/420; object-fit: cover; background: #eef; }
.tpl .n { padding: 8px 10px; font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.tpl .n small { color: var(--muted); font-weight: 500; }
.tpl.locked img { filter: grayscale(.4) opacity(.75); }
.tpl .lock { position: absolute; top: 8px; right: 8px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; } .swatch { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; } .swatch.active { border-color: var(--text); }

/* Charts */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: 13.5px; padding: 6px 0; }
.bar-row .bar { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin-top: 4px; } .bar-row .bar i { display: block; height: 100%; background: var(--grad); border-radius: 6px; transition: width .6s var(--ease); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--accent-ink); border-color: var(--accent); }

/* Settings nav */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .settings-layout { grid-template-columns: 1fr; } }
.settings-nav { display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 10px; } .settings-nav a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
@media (max-width: 900px) { .settings-nav { flex-direction: row; overflow: auto; scrollbar-width: none; } .settings-nav a { white-space: nowrap; } }

/* Status line */
.sync-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); }

/* Print */
@media print { .sidebar, .topbar, .bottom-nav, .toasts, .no-print { display: none !important; } main.view { padding: 0; } }
::selection { background: var(--accent-soft-2); }
kbd { font: 600 11px var(--font); padding: 2px 6px; border-radius: 6px; background: var(--surface-3); color: var(--muted); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; min-height: 16px; } @keyframes sk { to { background-position: -200% 0; } }

/* Store verification */
.kyc-steps { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; font-size: 13px; font-weight: 600; color: var(--muted); }
.kyc-steps span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.kyc-steps span.done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.kyc-steps svg { width: 16px; height: 16px; }
.kyc-steps i { flex: 0 0 18px; height: 2px; background: var(--line-2); border-radius: 2px; }
@media (max-width: 560px) { .kyc-steps i { display: none; } }
.kyc-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.kyc-file, .kyc-add { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 1; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; }
.kyc-file img { width: 100%; flex: 1; min-height: 0; object-fit: cover; background: var(--surface-3); }
.kyc-pdf { flex: 1; display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--bad); font-weight: 800; font-size: 12px; background: var(--bad-soft); }
.kyc-pdf svg { width: 30px; height: 30px; }
.kyc-name { font-size: 11.5px; padding: 5px 8px; color: var(--muted); }
.kyc-rm { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; }
.kyc-rm svg { width: 15px; height: 15px; }
.kyc-add { align-items: center; justify-content: center; gap: 6px; border: 2px dashed var(--line-2); cursor: pointer; color: var(--accent-ink); font-weight: 600; font-size: 13px; text-align: center; padding: 8px; background: var(--surface); transition: border-color .15s, background .15s; }
.kyc-add:hover { border-color: var(--accent); background: var(--accent-soft); }
.verify-hero { background: var(--grad); color: #fff; border: 0; padding: 22px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.verify-hero .btn { background: #fff; color: #4a1fd0; border: 0; margin-left: auto; }
.verify-hero p { opacity: .88; }

/* ---------- Native app feel ---------- */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, select, [contenteditable], .selectable, .tbl td, .kv, .modal-body p, .card-body { -webkit-user-select: text; user-select: text; }
a, button, .chip, .list-item, .inv-card, .tpl, .seg button { -webkit-user-drag: none; touch-action: manipulation; }
img { -webkit-user-drag: none; }
.slide-in { animation: slideIn .28s var(--ease); } .slide-back { animation: slideBack .28s var(--ease); } .fade-in { animation: fadeIn .2s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes slideBack { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .slide-in, .slide-back, .fade-in, .modal, .toast { animation: none !important; } }
.btn:active, .list-item:active, .inv-card:active, .chip:active, .bottom-nav a:active { transform: scale(.97); }
.list-item:active { background: var(--surface-3); }
.tb-back { display: none; }
.mobile-savebar { display: none; }
.ptr { position: fixed; top: 0; left: 50%; transform: translate(-50%, -50px); z-index: 60; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-l); display: grid; place-items: center; color: var(--accent-ink); opacity: 0; transition: opacity .15s; pointer-events: none; }
.ptr.ready { color: var(--ok); } .ptr.spinning { opacity: 1; transform: translate(-50%, 30px); } .ptr.spinning svg { animation: rot .7s linear infinite; }
.install-banner { position: fixed; left: 10px; right: 10px; bottom: calc(var(--nav-h) + var(--sb) + 10px); z-index: 45; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-l); animation: fadeUp .3s var(--ease); }
.install-banner img { width: 40px; height: 40px; border-radius: 11px; }
@media (max-width: 900px) {
  .input, select.input, textarea.input { font-size: 16px; }          /* no zoom-in on focus (iOS) */
  .topbar .tb-back { display: grid; place-items: center; width: 40px; height: 40px; border: 0; background: transparent; color: var(--text); border-radius: 12px; margin-left: -6px; }
  .topbar .tb-back.hide { display: none; }
  .topbar #tb-title { font-size: 16px; }
  .page-back { display: none !important; }
  body.sub main.view > .page-head h1 { display: none; }
  body.sub main.view > .page-head { margin-bottom: 10px; }
  main.view .page-head h1 { font-size: 20px; }
  main.view > .page-head { margin-bottom: 12px; }
  /* editor screens: hide the tab bar, show a sticky save bar like a native form */
  body.editing .bottom-nav { display: none; }
  body.editing main.view { padding-bottom: calc(96px + var(--sb)); }
  body.editing .install-banner { display: none; }
  .mobile-savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; display: flex; align-items: center; gap: 12px; padding: 10px 14px calc(10px + var(--sb)); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .mobile-savebar b { font-size: 20px; letter-spacing: -.02em; }
  .mobile-savebar .btn { min-width: 130px; }
  .card { border-radius: 16px; }
  .card.pad { padding: 16px; }
}
