/* AWAN Billing — mobile-first UI (Sulanza) */
:root {
  --b900: #1b1464;
  --b800: #241878;
  --b700: #2e1c92;
  --b600: #3d2bb4;
  --b500: #5640d4;
  --b400: #7a68e6;
  --b200: #cfc8fa;
  --b100: #ece9fd;
  --b50:  #f6f4ff;
  --bg: #f3f5fb;
  --surface: #ffffff;
  --text: #0e1433;
  --text2: #3b4266;
  --muted: #6b7294;
  --faint: #9aa0bb;
  --line: #e7e9f3;
  --line2: #f0f1f7;
  --green: #0f9f6e;
  --green-bg: #e3f7ef;
  --red: #dc2f45;
  --red-bg: #fdecef;
  --amber: #c27803;
  --amber-bg: #fff4dc;
  --blue: #2563eb;
  --blue-bg: #e7efff;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20, 16, 70, .06);
  --shadow: 0 6px 20px rgba(27, 20, 100, .08), 0 1px 3px rgba(27, 20, 100, .06);
  --shadow-lg: 0 18px 50px rgba(27, 20, 100, .22);
  --grad: linear-gradient(135deg, #1b1464 0%, #2e1c92 50%, #5640d4 100%);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --nav-h: 64px;
  --top-h: 56px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--b600); text-decoration: none; }
img { max-width: 100%; display: block; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.bold { font-weight: 700; }
.right { text-align: right; }
.center { text-align: center; }
.green { color: var(--green); }
.red { color: var(--red); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.row { display: content; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack > * + * { margin-top: 12px; }
.gap-s > * + * { margin-top: 8px; }
.mt { margin-top: 14px; }
.mt-s { margin-top: 8px; }
.mt-l { margin-top: 22px; }

/* ---------- Boot ---------- */
.boot { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; align-content: center; gap: 22px; background: var(--grad); }
.boot-logo img { width: 84px; height: 84px; border-radius: 22px; box-shadow: 0 16px 40px rgba(0,0,0,.3); }
.boot-spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: calc(var(--top-h) + var(--safe-t));
  padding: var(--safe-t) 8px 0;
  display: flex; align-items: center; gap: 4px;
  background: rgba(243, 245, 251, .86);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, background .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); background: rgba(255,255,255,.92); }
.topbar h1 { font-size: 18px; font-weight: 800; letter-spacing: -.2px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px; }
.topbar .brandmark { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding-left: 6px; }
.brandmark .logo-box { width: 36px; height: 36px; border-radius: 11px; background: var(--grad); display: grid; place-items: center; color: #fff; font-weight: 800; overflow: hidden; flex: none; }
.brandmark .logo-box img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brandmark .t1 { font-weight: 800; font-size: 16px; line-height: 1.15; }
.brandmark .t2 { font-size: 12px; color: var(--muted); line-height: 1.2; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; display: inline-grid; place-items: center; color: var(--text2); flex: none; position: relative; }
.icon-btn:active { background: var(--b100); }
.icon-btn.brand { color: var(--b600); }

.main { padding: 6px 16px calc(var(--nav-h) + var(--safe-b) + 28px); max-width: 760px; margin: 0 auto; }
.main.wide { max-width: 1100px; }
.main.no-nav { padding-bottom: calc(var(--safe-b) + 28px); }

/* Bottom nav */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
}
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 100%; color: var(--faint); font-size: 11px; font-weight: 600; }
.bottomnav a.active { color: var(--b600); }
.bottomnav a svg.i { width: 23px; height: 23px; }
.bottomnav a.fab-slot { position: relative; }
.bottomnav .fab {
  width: 58px; height: 58px; border-radius: 20px; margin-top: -26px;
  background: var(--grad); color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 24px rgba(61, 43, 180, .45), 0 0 0 5px var(--bg);
}
.bottomnav .fab svg.i { width: 28px; height: 28px; stroke-width: 2.4; }
.bottomnav a.fab-slot span.lbl { margin-top: 1px; color: var(--b600); }

/* Sidebar (desktop) */
.sidebar { display: none; }
@media (min-width: 960px) {
  .bottomnav { display: none; }
  .sidebar {
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: 244px; z-index: 45;
    background: linear-gradient(180deg, #1b1464 0%, #2e1c92 50%, #5640d4 100%); color: #fff; padding: 16px 12px;
  }
  .sidebar .sb-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 12px; }
  .sidebar .sb-brand .logo-box { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.14); display: grid; place-items: center; font-weight: 800; overflow: hidden; }
  .sidebar .sb-brand .logo-box img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
  .sidebar .sb-brand .t1 { font-weight: 800; font-size: 15px; line-height: 1.2; }
  .sidebar .sb-brand .t2 { font-size: 11.5px; opacity: .7; }
  .sidebar a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px; color: rgba(255,255,255,.88); font-weight: 600; font-size: 14px; }
  .sidebar a:hover { background: rgba(255,255,255,.1); }
  .sidebar a.active { background: rgba(255,255,255,.18); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
  .sidebar .sb-new { background: #fff; color: var(--b700); justify-content: center; margin: 4px 0 12px; font-weight: 800; }
  .sidebar .sb-new:hover { background: #f3f1ff; }
  .sidebar .sb-foot { margin-top: auto; font-size: 11.5px; opacity: .6; padding: 8px 12px; }
  .shell { padding-left: 244px; }
  .main { padding-bottom: 40px; }
}

/* ---------- Cards / Lists ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.card.pad { padding: 16px; }
.card-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 16px 16px 6px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 4px 10px; }
.section-title h3 { font-size: 15px; font-weight: 800; }
.section-title a { font-size: 13px; font-weight: 700; }

.list { background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--line); overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 13px 14px; min-height: 60px; border-top: 1px solid var(--line2); color: inherit; width: 100%; text-align: left; background: none; }
.li:first-child { border-top: 0; }
button.li:active, a.li:active { background: var(--b50); }
.li .av { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; font-weight: 800; font-size: 15px; background: var(--b100); color: var(--b600); }
.li .av.g { background: var(--green-bg); color: var(--green); }
.li .av.a { background: var(--amber-bg); color: var(--amber); }
.li .av.r { background: var(--red-bg); color: var(--red); }
.li .av.b { background: var(--blue-bg); color: var(--blue); }
.li .t { font-weight: 700; font-size: 15px; line-height: 1.3; }
.li .s { font-size: 12.5px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.li .amt { font-weight: 800; font-size: 15px; text-align: right; white-space: nowrap; }
.li .chev { color: var(--faint); }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; line-height: 1.6; white-space: nowrap; }
.badge.tax { background: var(--b100); color: var(--b600); }
.badge.simple { background: #eef0f6; color: var(--text2); }
.badge.cash { background: var(--green-bg); color: var(--green); }
.badge.credit { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.gray { background: #eef0f6; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 18px; border-radius: 13px; font-weight: 700; font-size: 15px;
  background: var(--b600); color: #fff; transition: transform .08s, filter .15s, background .15s; user-select: none; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn.primary { background: var(--grad); box-shadow: 0 6px 16px rgba(61, 43, 180, .3); }
.btn.green { background: var(--green); box-shadow: 0 6px 16px rgba(15, 159, 110, .25); }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.btn.soft { background: var(--b100); color: var(--b700); }
.btn.danger { background: var(--red-bg); color: var(--red); }
.btn.block { width: 100%; }
.btn.lg { height: 54px; font-size: 16px; border-radius: 15px; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn .spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn.ghost .spin, .btn.soft .spin { border-color: var(--b200); border-top-color: var(--b600); }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }

/* ---------- Forms ---------- */
.field { display: block; }
.field + .field { margin-top: 14px; }
.field > span.lbl { display: block; font-size: 13px; font-weight: 700; color: var(--text2); margin: 0 2px 6px; }
.field > span.hint { display: block; font-size: 12px; color: var(--muted); margin: 5px 2px 0; }
.input, select.input, textarea.input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
textarea.input { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; line-height: 1.4; }
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7294' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px; }
.input:focus { border-color: var(--b500); box-shadow: 0 0 0 4px rgba(86, 64, 212, .12); }
.input::placeholder { color: var(--faint); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 > .field + .field { margin-top: 0; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; }
.switch-row + .switch-row { border-top: 1px solid var(--line2); }
.switch-row .t { font-weight: 700; font-size: 14.5px; }
.switch-row .s { font-size: 12.5px; color: var(--muted); }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: #d9dcea; border-radius: 999px; transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; background: #fff; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,.18); transition: transform .2s; }
.switch input:checked + span { background: var(--b500); }
.switch input:checked + span::after { transform: translateX(20px); }

/* Segmented control */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #e9ebf4; border-radius: 13px; padding: 4px; gap: 4px; }
.seg button { height: 40px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s, color .15s, box-shadow .15s; }
.seg button.on { background: var(--surface); color: var(--b700); box-shadow: 0 2px 6px rgba(20,16,70,.1); }
.seg.lg button { height: 46px; font-size: 15px; }
.seg.green button.on.cash { color: var(--green); }
.seg.green button.on.credit { color: var(--amber); }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 700; color: var(--text2); display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--b700); border-color: var(--b700); color: #fff; }

/* Search bar */
.searchbar { position: relative; }
.searchbar svg.i.lead { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.searchbar .input { padding-left: 44px; }
.searchbar .trail { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); display: flex; gap: 2px; }

/* ---------- Home ---------- */
.hero {
  background: var(--grad); color: #fff; border-radius: 24px; padding: 20px; position: relative; overflow: hidden;
  box-shadow: 0 16px 36px rgba(46, 28, 146, .3);
}
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.16), transparent 70%); }
.hero .lbl { font-size: 13px; opacity: .8; font-weight: 600; }
.hero .big { font-size: 34px; font-weight: 800; letter-spacing: -.5px; line-height: 1.15; margin-top: 2px; }
.hero .big small { font-size: 15px; font-weight: 700; opacity: .8; margin-right: 4px; }
.hero .split { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 16px; }
.hero .split > div { background: rgba(255,255,255,.12); border-radius: 14px; padding: 10px 12px; }
.hero .split .k { font-size: 11.5px; opacity: .8; font-weight: 600; }
.hero .split .v { font-size: 15px; font-weight: 800; margin-top: 1px; }
.spark { display: flex; align-items: flex-end; gap: 6px; height: 46px; margin-top: 16px; position: relative; z-index: 1; }
.spark div { flex: 1; background: rgba(255,255,255,.25); border-radius: 6px 6px 3px 3px; min-height: 4px; }
.spark div.today { background: #fff; }
.spark-labels { display: flex; gap: 6px; margin-top: 5px; }
.spark-labels span { flex: 1; text-align: center; font-size: 10.5px; opacity: .7; font-weight: 600; }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.quick a { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 4px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--text2); text-align: center; }
.quick a:active { transform: scale(.97); }
.quick .qi { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; }
.qi.c1 { background: var(--b100); color: var(--b600); }
.qi.c2 { background: var(--green-bg); color: var(--green); }
.qi.c3 { background: var(--amber-bg); color: var(--amber); }
.qi.c4 { background: var(--blue-bg); color: var(--blue); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.kpi .k { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 20px; font-weight: 800; margin-top: 4px; letter-spacing: -.2px; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.hl { background: var(--b50); border-color: var(--b100); }

.install-card { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px dashed var(--b200); border-radius: 18px; padding: 12px 14px; margin-top: 14px; }

/* ---------- Billing ---------- */
.bill-page { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 150px); }
.edit-banner { background: var(--amber-bg); color: var(--amber); border-radius: 12px; padding: 10px 14px; font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cust-pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; text-align: left; box-shadow: var(--shadow-sm); }
.cust-pick .av { width: 44px; height: 44px; border-radius: 14px; background: var(--b100); color: var(--b600); display: grid; place-items: center; font-weight: 800; flex: none; }
.cust-pick .av.walk { background: #eef0f6; color: var(--muted); }
.cust-pick .t { font-weight: 800; font-size: 15.5px; }
.cust-pick .s { font-size: 12.5px; color: var(--muted); }
.cust-pick .chg { color: var(--b600); font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 2px; }
.step-lbl { font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .6px; text-transform: uppercase; margin: 18px 4px 8px; display: flex; align-items: center; gap: 8px; }
.step-lbl .n { width: 20px; height: 20px; border-radius: 50%; background: var(--b700); color: #fff; font-size: 11px; display: grid; place-items: center; letter-spacing: 0; }

.item-search { position: relative; z-index: 20; }
.item-search .input { height: 54px; border-radius: 16px; font-size: 16.5px; padding-right: 104px; box-shadow: var(--shadow-sm); }
.item-search .scan-btn { width: 44px; height: 44px; border-radius: 12px; background: var(--b100); color: var(--b700); display: grid; place-items: center; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border-radius: 16px; border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); overflow: hidden; max-height: min(56vh, 420px); overflow-y: auto; overscroll-behavior: contain;
}
.suggest button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; text-align: left; border-top: 1px solid var(--line2); min-height: 58px; }
.suggest button:first-child { border-top: 0; }
.suggest button.hl, .suggest button:active { background: var(--b50); }
.suggest .code { font-size: 11.5px; font-weight: 700; color: var(--b600); background: var(--b100); padding: 1px 7px; border-radius: 6px; }
.suggest .nm { font-weight: 700; font-size: 14.5px; }
.suggest .nm mark { background: #fff1b8; color: inherit; border-radius: 3px; padding: 0 1px; }
.suggest .pr { font-weight: 800; white-space: nowrap; }
.suggest .empty-s { padding: 18px 14px; color: var(--muted); font-size: 14px; text-align: center; }

.lines { margin-top: 12px; }
.line { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px 12px 12px 14px; animation: pop .18s ease-out; }
.line + .line { margin-top: 10px; }
.line.flash { animation: flash .6s ease-out; }
@keyframes pop { from { transform: scale(.97); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--b400); } 100% { box-shadow: 0 0 0 0 transparent; } }
.line-top { display: flex; align-items: flex-start; gap: 8px; }
.line-desc { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-weight: 700; font-size: 15px; padding: 4px 6px; margin: -4px -6px; border-radius: 8px; width: 100%; }
.line-desc:focus { background: var(--b50); }
.line-code { font-size: 11.5px; color: var(--faint); font-weight: 600; margin-top: 1px; }
.line-del { width: 34px; height: 34px; border-radius: 10px; color: var(--faint); display: grid; place-items: center; flex: none; margin: -4px -4px 0 0; }
.line-del:active { background: var(--red-bg); color: var(--red); }
.line-bot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.stepper { display: flex; align-items: center; background: var(--bg); border-radius: 12px; height: 42px; flex: none; }
.stepper button { width: 38px; height: 42px; display: grid; place-items: center; color: var(--b700); }
.stepper button:active { background: var(--b100); border-radius: 12px; }
.stepper input { width: 50px; height: 42px; border: 0; background: transparent; text-align: center; font-weight: 800; font-size: 16px; outline: 0; }
.rate-box { display: flex; align-items: center; background: var(--bg); border-radius: 12px; height: 42px; padding: 0 10px; gap: 4px; min-width: 0; flex: 1; max-width: 130px; }
.rate-box span { font-size: 11px; font-weight: 700; color: var(--faint); }
.rate-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-weight: 700; font-size: 16px; text-align: right; }
.line-amt { margin-left: auto; font-weight: 800; font-size: 16px; text-align: right; white-space: nowrap; }

.bill-empty { text-align: center; padding: 34px 20px; color: var(--muted); border: 2px dashed var(--line); border-radius: 20px; margin-top: 12px; }
.bill-empty .ic { width: 56px; height: 56px; border-radius: 18px; background: var(--b100); color: var(--b600); display: grid; place-items: center; margin: 0 auto 10px; }
.bill-empty b { color: var(--text); display: block; font-size: 15px; margin-bottom: 2px; }

.extras { margin-top: 14px; }
.extras summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--b600); padding: 6px 4px; }
.extras summary::-webkit-details-marker { display: none; }

.bill-bar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 45;
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -10px 30px rgba(27,20,100,.08);
  padding: 10px 16px 12px; border-radius: 20px 20px 0 0;
}
.bill-bar .inner { max-width: 760px; margin: 0 auto; }
.bill-bar .totals { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.bill-bar .tot-lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.bill-bar .tot-v { font-size: 26px; font-weight: 800; letter-spacing: -.4px; line-height: 1.1; }
.bill-bar .tot-v small { font-size: 13px; font-weight: 700; color: var(--muted); margin-right: 3px; }
.bill-bar .tot-sub { font-size: 12px; color: var(--muted); text-align: right; line-height: 1.5; }
.bill-bar .act { display: grid; grid-template-columns: 1.1fr 1fr; gap: 10px; }
.bill-bar .seg { padding: 3px; }
.bill-bar .seg button { height: 46px; }
@media (pointer: coarse) and (max-width: 959px) { body.kb-open .bill-bar, body.kb-open .bottomnav { display: none; } }
@media (min-width: 960px) { .bill-bar { left: 244px; bottom: 0; padding-bottom: calc(12px + var(--safe-b)); } .bill-page { padding-bottom: 170px; } }

/* ---------- Bill view ---------- */
.saved-hero { text-align: center; padding: 8px 0 4px; }
.saved-hero .ok { width: 64px; height: 64px; border-radius: 50%; background: var(--green-bg); color: var(--green); display: grid; place-items: center; margin: 0 auto 10px; animation: pop .3s ease-out; }
.saved-hero .ok svg.i { width: 32px; height: 32px; stroke-width: 3; }
.saved-hero h2 { font-size: 20px; font-weight: 800; }
.print-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.print-opt { background: var(--surface); border: 1.5px solid var(--line); border-radius: 18px; padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 8px; min-height: 104px; }
.print-opt:active { border-color: var(--b500); background: var(--b50); }
.print-opt .pi { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.print-opt .t { font-weight: 800; font-size: 14.5px; line-height: 1.2; }
.print-opt .s { font-size: 12px; color: var(--muted); line-height: 1.3; }
.print-opt.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 0; }
.bill-sum .r { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; }
.bill-sum .r.total { font-size: 18px; font-weight: 800; border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 10px; }
.bl-line { display: flex; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line2); }
.bl-line:first-child { border-top: 0; }

/* ---------- Ledger ---------- */
.bal-card { border-radius: 22px; padding: 18px; background: var(--grad); color: #fff; box-shadow: 0 14px 30px rgba(46,28,146,.28); }
.bal-card .k { font-size: 13px; opacity: .8; font-weight: 600; }
.bal-card .v { font-size: 30px; font-weight: 800; letter-spacing: -.4px; }
.bal-card .meta { font-size: 12.5px; opacity: .85; margin-top: 4px; }
.bal-card .btn { background: #fff; color: var(--b700); }
.bal-card .btn.ghost2 { background: rgba(255,255,255,.14); color: #fff; }
.ledger-row { display: flex; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line2); align-items: flex-start; }
.ledger-row:first-child { border-top: 0; }
.ledger-row .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.ledger-row .ic.dr { background: var(--amber-bg); color: var(--amber); }
.ledger-row .ic.cr { background: var(--green-bg); color: var(--green); }
.ledger-row .ic.op { background: #eef0f6; color: var(--muted); }
.ledger-row .amt { text-align: right; white-space: nowrap; }
.ledger-row .amt .a { font-weight: 800; }
.ledger-row .amt .b { font-size: 12px; color: var(--muted); }

/* ---------- Tables (reports) ---------- */
.tbl-wrap { overflow-x: 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: .4px; color: var(--muted); font-weight: 700; padding: 10px 12px; background: #f8f9fd; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 800; background: #f8f9fd; border-top: 1px solid var(--line); }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:active { background: var(--b50); }

.date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.date-row .input { height: 44px; font-size: 15px; }

/* ---------- Empty / loading ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ic { width: 64px; height: 64px; border-radius: 20px; background: var(--b100); color: var(--b600); display: grid; place-items: center; margin: 0 auto 14px; }
.empty .ic svg.i { width: 28px; height: 28px; }
.empty h3 { color: var(--text); font-size: 16px; margin-bottom: 4px; }
.loading { padding: 40px; display: grid; place-items: center; }
.loading::after { content: ""; width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--b100); border-top-color: var(--b500); animation: spin .8s linear infinite; }
.skel { background: linear-gradient(90deg, #eceef6 25%, #f5f6fb 50%, #eceef6 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Sheet / modal ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(14, 12, 48, .45); opacity: 0; transition: opacity .22s; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.sheet-backdrop.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 101; background: var(--surface);
  border-radius: 24px 24px 0 0; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.9,.25,1); box-shadow: var(--shadow-lg);
  padding-bottom: var(--safe-b);
}
.sheet.show { transform: none; }
.sheet.full { height: 92vh; height: 92dvh; }
.sheet .grab { width: 42px; height: 5px; border-radius: 3px; background: #d9dcea; margin: 8px auto 2px; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px 8px 18px; flex: none; }
.sheet-head h3 { flex: 1; font-size: 17px; font-weight: 800; }
.sheet-body { overflow-y: auto; padding: 4px 18px 18px; flex: 1; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet-foot { padding: 10px 18px 14px; border-top: 1px solid var(--line2); flex: none; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(560px, 94vw); border-radius: 22px; transform: translate(-50%, -46%) scale(.97); opacity: 0; transition: transform .2s, opacity .2s; max-height: 86vh; }
  .sheet.full { height: min(760px, 86vh); }
  .sheet.show { transform: translate(-50%, -50%); opacity: 1; }
  .sheet .grab { display: none; }
  .sheet-head { padding-top: 14px; }
}

/* ---------- Toast ---------- */
#toasts { position: fixed; left: 0; right: 0; top: calc(var(--safe-t) + 10px); z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: #15123d; color: #fff; padding: 12px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; max-width: 520px; animation: tin .25s ease-out; pointer-events: auto; }
.toast.err { background: #b4233a; }
.toast.ok svg.i { color: #4ade80; }
.toast.out { animation: tout .2s ease-in forwards; }
@keyframes tin { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tout { to { transform: translateY(-14px); opacity: 0; } }

.offline-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 12px); z-index: 60; background: #15123d; color: #fff; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 999px; display: flex; gap: 8px; align-items: center; box-shadow: var(--shadow-lg); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--grad); }
.auth-top { padding: calc(var(--safe-t) + 44px) 24px 34px; color: #fff; text-align: center; position: relative; overflow: hidden; }
.auth-top::before { content: ""; position: absolute; width: 340px; height: 340px; border-radius: 50%; right: -120px; top: -140px; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); }
.auth-top .logo { width: 76px; height: 76px; border-radius: 22px; margin: 0 auto 16px; background: rgba(255,255,255,.14); display: grid; place-items: center; overflow: hidden; box-shadow: 0 14px 30px rgba(0,0,0,.25); position: relative; }
.auth-top .logo img { width: 100%; height: 100%; object-fit: contain; }
.auth-top .logo img.user-logo { background: #fff; padding: 6px; }
.auth-top h1 { font-size: 24px; font-weight: 800; letter-spacing: -.3px; position: relative; }
.auth-top p { opacity: .8; font-size: 14px; margin-top: 4px; position: relative; }
.auth-card { flex: 1; background: var(--bg); border-radius: 28px 28px 0 0; padding: 26px 20px calc(30px + var(--safe-b)); }
.auth-card .inner { max-width: 420px; margin: 0 auto; }
.auth-card h2 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 50px; }
.pw-wrap button { position: absolute; right: 4px; top: 4px; width: 40px; height: 40px; display: grid; place-items: center; color: var(--muted); }
.auth-credit { text-align: center; font-size: 12px; color: var(--faint); margin-top: 26px; }
.auth-credit b { color: var(--muted); }
.form-err { background: var(--red-bg); color: var(--red); font-size: 13.5px; font-weight: 600; padding: 10px 12px; border-radius: 12px; margin-bottom: 14px; }
@media (min-width: 900px) {
  .auth { flex-direction: row; }
  .auth-top { flex: 1; display: flex; flex-direction: column; justify-content: center; }
  .auth-card { flex: 0 0 480px; border-radius: 0; display: flex; align-items: center; }
  .auth-card .inner { width: 100%; }
}

/* ---------- Menu ---------- */
.menu-user { display: flex; align-items: center; gap: 14px; padding: 16px; }
.menu-user .av { width: 52px; height: 52px; border-radius: 16px; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 20px; }

/* ---------- Printer page ---------- */
.printer-state { display: flex; align-items: center; gap: 14px; padding: 16px; }
.printer-state .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--faint); flex: none; }
.printer-state .dot.on { background: var(--green); box-shadow: 0 0 0 5px var(--green-bg); }
.note { background: var(--b50); border: 1px solid var(--b100); color: var(--text2); border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.5; }
.note.warn { background: var(--amber-bg); border-color: #f8e2b0; color: #7a4d00; }

/* ---------- Print preview ---------- */
.pv-bar { position: sticky; top: calc(var(--top-h) + var(--safe-t)); z-index: 30; display: flex; gap: 10px; padding: 8px 0 12px; background: var(--bg); }
.pv-paper { background: #fff; box-shadow: var(--shadow); border-radius: 6px; margin: 0 auto; overflow: hidden; }
.pv-paper.a4 { width: 100%; max-width: 820px; }
.pv-paper.t80 { width: 302px; max-width: 100%; }
.pv-scale { overflow-x: auto; padding-bottom: 10px; }
#print-root { display: none; }
@media print {
  @page { margin: 0; }
  html, body { background: #fff !important; }
  body.printing #app, body.printing #toasts { display: none !important; }
  body.printing #print-root { display: block !important; }
}

/* ---------- Scanner ---------- */
.scanner { position: relative; background: #000; border-radius: 18px; overflow: hidden; aspect-ratio: 3 / 4; max-height: 60vh; width: 100%; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; left: 12%; right: 12%; top: 34%; height: 28%; border: 3px solid rgba(255,255,255,.9); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.scanner .laser { position: absolute; left: 14%; right: 14%; top: 48%; height: 2px; background: #ff3b5c; box-shadow: 0 0 12px #ff3b5c; animation: laser 1.6s ease-in-out infinite; }
@keyframes laser { 0%,100% { transform: translateY(-34px); } 50% { transform: translateY(34px); } }

/* Pagination */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }

@media (min-width: 700px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .print-grid { grid-template-columns: repeat(3, 1fr); }
  .print-opt.wide { grid-column: auto; flex-direction: column; align-items: flex-start; }
}
@media (max-width: 360px) {
  .main { padding-left: 12px; padding-right: 12px; }
  .hero .big { font-size: 28px; }
  .rate-box { max-width: 100px; }
  .stepper input { width: 42px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Recovery code */
.rc-box { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 22px; font-weight: 800; letter-spacing: 2px; text-align: center; padding: 18px 10px; background: var(--surface); border: 2px dashed var(--b400); border-radius: 16px; color: var(--b800); user-select: all; -webkit-user-select: all; word-break: break-all; }
@media (max-width: 360px) { .rc-box { font-size: 18px; letter-spacing: 1px; } }
