/* ==========================================================
   SMM Panel design system
   Ink + teal + saffron. KHQR red is used only on the payment card.
   ========================================================== */
:root {
  --ink: #12171f;
  --ink-2: #1b222c;
  --ink-line: #2a323e;
  --paper: #f3f5f7;
  --surface: #ffffff;
  --line: #e2e6eb;
  --line-strong: #cfd5dc;
  --text: #151a22;
  --muted: #5f6b7a;
  --primary: #0b7a75;
  --primary-hover: #086560;
  --primary-soft: #e3f3f1;
  --saffron: #e9a23b;
  --saffron-soft: #fdf3e0;
  --ok: #1d7f49;
  --ok-soft: #e4f4ea;
  --warn: #9a6408;
  --warn-soft: #fdf1d9;
  --danger: #b73228;
  --danger-soft: #fbe9e7;
  --info: #285f9f;
  --info-soft: #e5eefa;
  --khqr: #e21c2b;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(18, 23, 31, .05), 0 4px 14px rgba(18, 23, 31, .04);
  --sidebar: 248px;
  --topbar: 64px;
  --font: "Kantumruy Pro", "Noto Sans Khmer", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 700; }
p { margin: 0; }
img { max-width: 100%; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86em; background: var(--paper); padding: 2px 6px; border-radius: 5px; }
:focus-visible { outline: 3px solid rgba(11, 122, 117, .45); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.text-end { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.hide { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App shell ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--ink); color: #c7ced8;
  display: flex; flex-direction: column; padding: 20px 14px; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: #fff; font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--primary); display: grid; place-items: center; color: #fff; font-size: 15px; flex: none; }
.brand:hover { text-decoration: none; }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: #aab3bf; font-weight: 500; position: relative;
}
.nav a i { width: 18px; text-align: center; font-size: 15px; }
.nav a:hover { background: var(--ink-2); color: #fff; text-decoration: none; }
.nav a.active { background: var(--ink-2); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--saffron); }
.nav-sep { height: 1px; background: var(--ink-line); margin: 12px 6px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--ink-line); padding-top: 14px; }
.who { display: flex; align-items: center; gap: 10px; padding: 6px 8px 12px; color: #fff; min-width: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; text-transform: uppercase; }
.who-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-role { font-size: 12px; color: #8b95a3; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; width: 100%; text-align: left; }

.shell { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar); background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 32px;
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 18px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.balance-chip {
  display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 14px; border: 1px solid var(--line-strong);
  border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 700;
}
.balance-chip:hover { text-decoration: none; border-color: var(--primary); }
.balance-chip small { font-weight: 500; color: var(--muted); }
.balance-chip .plus { width: 28px; height: 28px; border-radius: 50%; background: var(--saffron); color: #3b2706; display: grid; place-items: center; font-size: 13px; }
.page { padding: 28px 32px 48px; width: 100%; max-width: 1180px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; }
.page-head p { color: var(--muted); margin-top: 2px; }

/* ---------- Mobile shell ---------- */
.m-top, .m-nav, .sheet, .sheet-back { display: none; }
@media (max-width: 900px) {
  .sidebar, .topbar { display: none; }
  .shell { margin-left: 0; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .page { padding: 18px 16px 32px; }
  .page-head h2 { font-size: 20px; }
  .m-top {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 30;
    background: var(--ink); color: #fff; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  }
  .m-top .brand { padding: 0; font-size: 16px; }
  .m-top .balance-chip { background: var(--ink-2); border-color: var(--ink-line); color: #fff; padding: 4px 5px 4px 12px; }
  .m-top .balance-chip small { color: #9aa5b3; }
  .m-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0; z-index: 50;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .m-nav a, .m-nav button {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; color: var(--muted);
    font: inherit; font-size: 11px; font-weight: 500; background: none; border: 0; cursor: pointer; border-radius: 10px;
  }
  .m-nav a i, .m-nav button i { font-size: 18px; }
  .m-nav a:hover { text-decoration: none; }
  .m-nav .on { color: var(--primary); font-weight: 700; }
  .m-nav .cta i { width: 44px; height: 44px; margin-top: -20px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 12px rgba(11, 122, 117, .4); border: 3px solid var(--surface); }
  .sheet-back { display: block; position: fixed; inset: 0; background: rgba(18, 23, 31, .5); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sheet {
    display: block; position: fixed; inset: auto 0 0 0; z-index: 70; background: var(--surface); border-radius: 18px 18px 0 0;
    padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .22s ease;
  }
  .sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 0 auto 12px; }
  .sheet a, .sheet button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 8px; color: var(--text); font: inherit; font-weight: 500; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
  .sheet a:last-child, .sheet form:last-child button { border-bottom: 0; }
  .sheet i { width: 22px; text-align: center; color: var(--muted); }
  .sheet .danger { color: var(--danger); } .sheet .danger i { color: var(--danger); }
  body.sheet-open .sheet { transform: none; }
  body.sheet-open .sheet-back { opacity: 1; pointer-events: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h3 { font-size: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-main { grid-template-columns: 1fr; } }

/* ledger-style balance */
.ledger { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--ink); }
.ledger .label { color: #9aa5b3; font-size: 13px; }
.ledger .amount { font-size: 40px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.ledger .amount sup { font-size: 20px; color: var(--saffron); margin-right: 3px; vertical-align: .55em; font-weight: 600; }
.ledger .row { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.stat { padding: 16px 18px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; min-height: 42px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.saffron { background: var(--saffron); border-color: var(--saffron); color: #3b2706; }
.btn.danger { color: var(--danger); border-color: #e7c2be; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field > label, .label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; min-height: 44px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit;
}
.textarea { min-height: 88px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); outline: 3px solid rgba(11, 122, 117, .2); }
.input[readonly] { background: var(--paper); color: var(--muted); }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 38px; }
.prefix { display: flex; align-items: stretch; }
.prefix span { display: grid; place-items: center; padding: 0 14px; border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--paper); font-weight: 700; }
.prefix .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .input, .select, .textarea { font-size: 16px; } } /* stop iOS zoom-on-focus */

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 44px; height: 26px; border-radius: 26px; background: var(--line-strong); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid rgba(11, 122, 117, .45); outline-offset: 2px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; font-size: 14px; cursor: pointer; }
.chip:hover { text-decoration: none; border-color: var(--primary); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Badges & alerts ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--paper); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.plain::before { display: none; }

.alert { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; font-size: 14.5px; }
.alert i { margin-top: 3px; }
.alert .x { margin-left: auto; background: none; border: 0; cursor: pointer; color: inherit; font-size: 18px; line-height: 1; padding: 0 2px; }
.alert.success { background: var(--ok-soft); border-color: #bfe3cc; color: #14522f; }
.alert.danger { background: var(--danger-soft); border-color: #f0c8c3; color: #7d211a; }
.alert.warning { background: var(--warn-soft); border-color: #f1d9a6; color: #6b4506; }
.alert.info { background: var(--info-soft); border-color: #c3d6ee; color: #1c4673; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 11px 16px; background: #fafbfc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfc; }
.truncate { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: bottom; }
@media (max-width: 760px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack td { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 5px 0; border: 0; text-align: right; }
  .table-stack td::before { content: attr(data-label); color: var(--muted); font-size: 13px; font-weight: 500; text-align: left; flex: none; }
  .table-stack td.full { display: block; text-align: left; }
  .table-stack td.full::before { display: none; }
  .table-stack .truncate { max-width: 55vw; }
}
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty i { font-size: 30px; color: var(--line-strong); display: block; margin-bottom: 10px; }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 16px; color: var(--muted); border-top: 1px solid var(--line); }

/* ---------- Order form: service picker ---------- */
.picker { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.picker-list { max-height: 300px; overflow-y: auto; }
.picker-item { display: flex; justify-content: space-between; gap: 14px; width: 100%; padding: 11px 14px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; font: inherit; cursor: pointer; color: var(--text); }
.picker-item:last-child { border-bottom: 0; }
.picker-item:hover { background: var(--paper); }
.picker-item.on { background: var(--primary-soft); }
.picker-item .nm { min-width: 0; }
.picker-item .id { color: var(--muted); font-size: 12.5px; }
.picker-item .rt { white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary); }
.picker-empty { padding: 22px; text-align: center; color: var(--muted); }
.detail { background: var(--paper); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 16px; }
.detail-row { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13.5px; color: var(--muted); margin-bottom: 8px; }
.detail-row b { color: var(--text); }
.detail p { white-space: pre-line; font-size: 13.5px; color: #3c4655; }
.total { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); margin-bottom: 16px; }
.total strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.field-error { color: var(--danger); font-size: 13px; margin-top: 5px; font-weight: 600; }

/* ---------- KHQR card ---------- */
.khqr { max-width: 400px; margin: 0 auto; background: var(--surface); border-radius: 16px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(18, 23, 31, .1); }
.khqr-head { background: var(--khqr); color: #fff; text-align: center; padding: 13px; font-weight: 800; letter-spacing: 3px; font-size: 20px; position: relative; }
.khqr-head::after { content: ""; position: absolute; right: 0; bottom: 0; border-style: solid; border-width: 0 0 16px 16px; border-color: transparent transparent #fff transparent; }
.khqr-merchant { padding: 14px 20px 0; color: var(--muted); font-size: 14px; }
.khqr-name { padding: 2px 20px 12px; font-weight: 700; font-size: 18px; border-bottom: 1px dashed var(--line-strong); }
.khqr-body { padding: 20px; }
.khqr-amount { text-align: center; margin: 6px 0 14px; }
.khqr-amount strong { font-size: 34px; font-variant-numeric: tabular-nums; }
.khqr-amount small { display: block; color: var(--muted); }
.qr-box { display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 14px; min-height: 200px; }
.qr-box img { width: 100%; max-width: 240px; }
.timer { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; color: var(--danger); margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin-bottom: 14px; }
.presets button { padding: 10px 0; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); font: inherit; font-weight: 700; cursor: pointer; }
.presets button:hover, .presets button.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.note-box { background: var(--saffron-soft); border: 1px solid #f1dcae; color: #5c3f07; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 14px; white-space: pre-line; }
.steps { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; display: grid; gap: 6px; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side { background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { font-size: 34px; max-width: 14ch; line-height: 1.25; }
.auth-side p { color: #9aa5b3; margin-top: 12px; max-width: 36ch; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; color: #c7ced8; }
.auth-points i { color: var(--saffron); margin-right: 10px; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 24px; margin-bottom: 4px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.m-brand { display: none; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .m-brand { display: flex; margin-bottom: 26px; color: var(--text); }
  .auth-main { align-items: start; padding-top: 48px; }
}

/* ---------- Dialog ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(18, 23, 31, .55); }
.dialog-body { padding: 22px; }
.dialog-body h3 { margin-bottom: 14px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

.error-page { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.error-page .code { font-size: 72px; font-weight: 800; color: var(--primary); line-height: 1; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; word-break: break-all; }
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 22px 0 10px; }
.sticky-save { position: sticky; bottom: 0; background: linear-gradient(to top, var(--paper) 70%, transparent); padding: 16px 0 4px; display: flex; justify-content: flex-end; gap: 10px; z-index: 5; }
@media (max-width: 900px) { .sticky-save { bottom: calc(72px + env(safe-area-inset-bottom)); } }

.nav-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: var(--radius-sm); color: #aab3bf; font: inherit; font-weight: 500; cursor: pointer; }
.nav-btn i { width: 18px; text-align: center; }
.nav-btn:hover { background: var(--ink-2); color: #fff; }

/* selected service card (replaces the open list after choosing) */
.selected-svc { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 16px; border: 1.5px solid var(--primary); background: var(--primary-soft); border-radius: var(--radius-sm); }
.selected-svc-main { min-width: 0; }
.selected-svc .id { color: var(--primary); font-size: 12.5px; font-weight: 700; }
.selected-svc .nm { font-weight: 600; word-break: break-word; }
.selected-svc-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.selected-svc .rt { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary); white-space: nowrap; }
@media (max-width: 520px) { .selected-svc { flex-direction: column; align-items: stretch; } .selected-svc-side { flex-direction: row; justify-content: space-between; align-items: center; } }


/* ==========================================================
   Mobile polish: no sideways overflow + better buttons
   ========================================================== */
.grid > *, .grid-main > *, .card, .picker, .field { min-width: 0; }
.shell { overflow-x: clip; }
.picker-item { align-items: flex-start; }
.picker-item .nm { overflow-wrap: anywhere; line-height: 1.5; }
.picker-item .rt { padding-top: 2px; }
.chips { max-width: 100%; }

@media (max-width: 900px) {
  /* 1fr can grow with its content; minmax(0,1fr) cannot, so wide rows no longer push the page sideways */
  .grid-2, .grid-3, .grid-main { grid-template-columns: minmax(0, 1fr); }
  .grid[style*="repeat(3"] { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .grid[style*="repeat(3"] .stat { padding: 12px 10px; }
  .grid[style*="repeat(3"] .stat .v { font-size: 18px; }

  .card-pad { padding: 16px; }
  .ledger .amount { font-size: 34px; }

  /* comfortable touch targets */
  .btn { min-height: 46px; padding: 11px 18px; font-size: 15px; border-radius: 10px; }
  .btn.sm { min-height: 40px; padding: 8px 14px; font-size: 14px; }
  .btn.block { min-height: 52px; font-size: 16px; }
  .ledger .row .btn { flex: 1 1 140px; }
  .page-head .btn { width: 100%; }
  .page-head > div[style*="flex"] { width: 100%; }
  .page-head > div[style*="flex"] .btn { flex: 1 1 100%; }

  /* action buttons inside stacked table rows become full-width buttons */
  .table-stack td.act, .table-stack td.text-end { display: flex; justify-content: stretch; flex-wrap: wrap; gap: 8px; padding-top: 12px; }
  .table-stack td.act .btn, .table-stack td.text-end .btn { flex: 1 1 140px; }
  .table-stack td.act form, .table-stack td.text-end form { flex: 1 1 140px; display: flex !important; }
  .table-stack td.act form .btn, .table-stack td.text-end form .btn { width: 100%; }

  .selected-svc .btn { min-height: 40px; }
  .detail-row { gap: 6px 14px; }
  .khqr { max-width: 100%; }
  .presets { grid-template-columns: repeat(3, 1fr); }
  .presets button { min-height: 46px; }
  .picker-list { max-height: 340px; }
}

/* Fix: ".field > label" (display:block) was overriding ".switch", collapsing the toggle track so its knob floated over the text */
label.switch, .field > label.switch { display: flex; align-items: center; gap: 12px; margin-bottom: 0; font-weight: 400; position: relative; cursor: pointer; }
.switch .track { display: block; flex: none; }

/* gateway chooser: two selectable cards, one active at a time */
.gateway-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.gw { position: relative; display: block; cursor: pointer; }
.gw input { position: absolute; opacity: 0; }
.gw-box { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); transition: border-color .15s, background .15s; }
.gw-box b { font-size: 16px; }
.gw-box .muted { font-size: 13px; }
.gw input:checked + .gw-box { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(11, 122, 117, .15); }
.gw input:checked + .gw-box b::before { content: "\2713  "; color: var(--primary); }
.gw input:focus-visible + .gw-box { outline: 3px solid rgba(11, 122, 117, .45); outline-offset: 2px; }
@media (max-width: 520px) { .gateway-choice { grid-template-columns: 1fr; } }


/* ==========================================================
   Login page: social media artwork on the dark panel
   All sizes use cqw (1% of the artwork width) so it scales as one piece.
   ========================================================== */
.auth-side { position: relative; gap: 24px; background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px); background-size: 22px 22px; }
.auth-side h2 { margin-top: 4px; }
.auth-art-wrap { flex: 1; min-height: 0; display: grid; place-items: center; }
.auth-art {
  position: relative; container-type: inline-size;
  width: min(440px, 100%, calc((100vh - 430px) * .957));
  min-width: 260px; aspect-ratio: 440 / 460;
}
.art-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.art-tile { position: absolute; width: 13cqw; height: 13cqw; z-index: 2; animation: artFloat 6s ease-in-out infinite; }
.art-tile .ico {
  display: grid; place-items: center; width: 100%; height: 100%; border-radius: 3.6cqw; color: #fff; font-size: 6cqw;
  box-shadow: 0 1.5cqw 4cqw rgba(0, 0, 0, .4), inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.art-tile .chip {
  position: absolute; top: 50%; transform: translateY(-50%); white-space: nowrap;
  font-size: max(11px, 3.1cqw); color: #c7ced8; padding: .9cqw 2.2cqw; border-radius: 99px;
  background: var(--ink-2); border: 1px solid var(--ink-line);
}
.art-tile .chip b { color: #fff; font-variant-numeric: tabular-nums; }
.t-fb { left: 3cqw; top: 4cqw; }
.t-tt { right: 3cqw; top: 15cqw; animation-delay: -1.5s; }
.t-tg { left: 2cqw; top: 72cqw; animation-delay: -3s; }
.t-ig { right: 4cqw; top: 76cqw; animation-delay: -4.5s; }
.t-yt { left: 36cqw; top: 91cqw; animation-delay: -2.2s; }
.t-fb .chip, .t-tg .chip, .t-yt .chip { left: calc(100% + 1.6cqw); }
.t-tt .chip, .t-ig .chip { right: calc(100% + 1.6cqw); }
.t-fb .ico { background: #1877f2; }
.t-tt .ico { background: #fff; color: #0b0b0f; }
.t-tg .ico { background: #229ed9; }
.t-ig .ico { background: #d62976; }
.t-yt .ico { background: #e62117; }

.art-card {
  position: absolute; left: 50%; top: 52cqw; transform: translate(-50%, -50%); width: 54cqw; z-index: 1;
  padding: 3.2cqw; border-radius: 3.2cqw; background: var(--ink-2); border: 1px solid var(--ink-line);
  box-shadow: 0 3cqw 8cqw rgba(0, 0, 0, .45); color: #fff; font-size: max(11px, 3cqw);
}
.art-card-head { display: flex; align-items: center; gap: 2.2cqw; }
.art-card-head b { display: block; font-size: max(12px, 3.3cqw); line-height: 1.25; }
.art-card-head small { color: #8b95a3; font-size: max(10px, 2.6cqw); }
.art-mini { width: 7.5cqw; height: 7.5cqw; border-radius: 2.2cqw; background: #d62976; display: grid; place-items: center; font-size: 4cqw; flex: none; }
.art-card-row { display: flex; align-items: center; justify-content: space-between; margin: 3cqw 0 2cqw; }
.art-card-row strong { font-size: 6.4cqw; line-height: 1; font-variant-numeric: tabular-nums; }
.art-badge { padding: .6cqw 2cqw; border-radius: 99px; background: rgba(29, 127, 73, .25); color: #6fd39a; font-size: max(10px, 2.5cqw); font-weight: 700; }
.art-bar { height: 1.4cqw; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.art-bar span { display: block; width: 100%; height: 100%; background: var(--saffron); transform-origin: left; animation: artFill 4s ease-out infinite; }
.art-card-foot { margin-top: 2.4cqw; color: #8b95a3; font-size: max(10px, 2.6cqw); }
.art-card-foot i { color: var(--saffron); margin-right: .6cqw; }

@keyframes artFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.6cqw); } }
@keyframes artFill { 0% { transform: scaleX(.15); } 70%, 100% { transform: scaleX(1); } }
@media (max-height: 760px) { .auth-art-wrap { display: none; } }
