/* ==========================================================================
   LyoPremium – Reseller Portal design system
   Ink-violet base, electric-violet accent, licence-ticket motif.
   ========================================================================== */

:root {
  --font-body: 'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #F2F2F8;
  --surface: #FFFFFF;
  --surface-2: #F8F8FC;
  --ink: #16142B;
  --ink-2: #4A4863;
  --muted: #706E8A;
  --line: #E4E3EF;
  --line-2: #EEEEF6;

  --brand: #1769D1;
  --brand-hover: #0F55B2;
  --brand-ink: #FFFFFF;
  --brand-soft: #E5F0FF;
  --brand-text: #0D57B7;

  --ok: #0B8A60;      --ok-soft: #DDF6EC;
  --warn: #9A6200;    --warn-soft: #FFF0CF;
  --bad: #C7283F;     --bad-soft: #FFE3E8;

  --side-bg: #071A35;
  --side-ink: #B9B6DA;
  --side-ink-strong: #FFFFFF;
  --side-line: rgba(255, 255, 255, .08);

  --r-s: 10px;
  --r-m: 16px;
  --r-l: 24px;

  --shadow-float: 0 18px 50px -12px rgba(22, 20, 43, .35), 0 2px 8px rgba(22, 20, 43, .08);
  --ring: 0 0 0 3px rgba(91, 61, 245, .22);

  --sidebar-w: 268px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0D0B1C;
  --surface: #161330;
  --surface-2: #1B1838;
  --ink: #F0EFFA;
  --ink-2: #C5C3DF;
  --muted: #9391B3;
  --line: #2B2850;
  --line-2: #221F42;

  --brand: #8C75FF;
  --brand-hover: #A290FF;
  --brand-ink: #120C3D;
  --brand-soft: #2A2360;
  --brand-text: #BDB1FF;

  --ok: #3DD6A0;      --ok-soft: #0F3328;
  --warn: #F5BB4D;    --warn-soft: #3A2C0E;
  --bad: #FF8097;     --bad-soft: #3D1522;

  --side-bg: #0A0818;
  --shadow-float: 0 18px 50px -12px rgba(0, 0, 0, .7), 0 2px 8px rgba(0, 0, 0, .3);
  --ring: 0 0 0 3px rgba(140, 117, 255, .35);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); letter-spacing: -.02em; line-height: 1.15; color: var(--ink); }
p { margin: 0; }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
b, strong { font-weight: 700; }
code, kbd { font-family: var(--font-mono); }
.i { flex: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand); color: var(--brand-ink); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; color: inherit; }
.brand:hover { text-decoration: none; }
.logo { display: inline-grid; width: var(--s); height: var(--s); flex: none; filter: drop-shadow(0 6px 14px rgba(91, 61, 245, .45)); }
.logo svg { display: block; }
.brand-text { display: grid; line-height: 1.15; }
.brand-text b { font-family: var(--font-display); font-size: 17px; letter-spacing: -.01em; }
.brand-text small { font-size: 12px; color: var(--muted); }
.brand-light { color: #fff; }
.brand-light .brand-text small { color: var(--side-ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 14.5px; line-height: 1; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--ink) 18%, var(--line)); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  box-shadow: 0 1px 2px rgba(22, 20, 43, .08), 0 4px 12px -4px color-mix(in srgb, var(--brand) 40%, transparent);
}
.btn-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  box-shadow: 0 2px 4px rgba(22, 20, 43, .1), 0 8px 20px -6px color-mix(in srgb, var(--brand) 50%, transparent);
}
.btn-soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-text); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand-soft) 80%, var(--brand)); border-color: transparent; }
.btn-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.btn-ok:hover { background: color-mix(in srgb, var(--ok-soft) 75%, var(--ok)); border-color: transparent; }
.btn-danger { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.btn-danger:hover { background: color-mix(in srgb, var(--bad-soft) 75%, var(--bad)); border-color: transparent; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn-lg { min-height: 50px; padding: 0 22px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn.is-loading { pointer-events: none; opacity: .85; }
.btn.is-loading .i { display: none; }
.btn.is-loading::after {
  content: ''; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink-2);
  cursor: pointer; transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.icon-btn-dark { background: rgba(255, 255, 255, .06); border-color: var(--side-line); color: var(--side-ink); width: 36px; height: 36px; border-radius: 10px; }
.icon-btn-dark:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.icon-btn-sm { width: 32px; height: 32px; border-radius: 9px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 7px; min-width: 0; }
.field label, .label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 15px;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.textarea { padding: 12px 14px; min-height: 120px; resize: vertical; }
.input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.input:hover, .select:hover { border-color: color-mix(in srgb, var(--ink) 20%, var(--line)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.input-num { font-variant-numeric: tabular-nums; }
.input-sm { min-height: 36px; padding: 0 10px; font-size: 14px; border-radius: 9px; }
.input-money { width: 112px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.upload-drop { display:flex; align-items:center; gap:12px; min-height:82px; padding:12px 14px; border:1.5px dashed color-mix(in srgb, var(--brand) 55%, var(--line)); border-radius:16px; background:linear-gradient(135deg,var(--brand-soft),var(--surface)); cursor:pointer; transition:.2s ease; }
.upload-drop:hover,.upload-drop:focus-within { border-color:var(--brand); box-shadow:var(--ring); transform:translateY(-1px); }
.upload-drop input { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.upload-drop-icon { display:grid; place-items:center; width:44px; height:44px; flex:none; border-radius:13px; background:var(--brand); color:#fff; }
.upload-drop-copy { display:grid; gap:3px; min-width:0; flex:1; }.upload-drop-copy b { font-size:14px; }.upload-drop-copy small { color:var(--muted); font-size:12px; }.upload-drop-cta { padding:8px 12px; border-radius:10px; background:var(--surface); color:var(--brand-text); font-size:13px; font-weight:700; }
.upload-preview { display:flex; align-items:center; gap:10px; padding:8px 10px; border:1px solid var(--line); border-radius:12px; background:var(--surface-2); font-size:13px; }.upload-preview img { width:42px; height:42px; object-fit:cover; border-radius:8px; }.upload-preview [data-upload-name] { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }.upload-size { color:var(--muted); white-space:nowrap; font-size:12px; }
.upload-processing { position:fixed; inset:0; z-index:200; display:grid; place-items:center; padding:24px; background:rgba(4,16,37,.72); backdrop-filter:blur(10px); }.upload-processing[hidden] { display:none; }.upload-processing-card { display:grid; justify-items:center; gap:10px; width:min(100%,360px); padding:32px 24px; border:1px solid rgba(255,255,255,.16); border-radius:24px; background:var(--surface); color:var(--ink); box-shadow:0 24px 80px rgba(0,0,0,.3); text-align:center; }.upload-processing-card strong { font-family:var(--font-display); font-size:20px; }.upload-processing-card span:last-child { color:var(--muted); font-size:13px; }.process-ring { width:52px; height:52px; border:4px solid var(--brand-soft); border-top-color:var(--brand); border-radius:50%; animation:spin .8s linear infinite; }
body.upload-busy { overflow:hidden; }
.form-stack { display: grid; gap: 18px; }
.form-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); align-items: end; }

.pw { position: relative; }
.pw .input { padding-right: 48px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--muted); border-radius: 9px; cursor: pointer;
}
.pw-toggle:hover { color: var(--ink); background: var(--surface-2); }

.search { position: relative; flex: 1 1 240px; min-width: 0; max-width: 380px; }
.search .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 40px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2);
  font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); color: var(--ink); }
.chip.is-on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip .count { font-size: 12px; opacity: .75; font-variant-numeric: tabular-nums; }

.stepper { display: grid; grid-template-columns: 44px 1fr 44px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); overflow: hidden; }
.stepper:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.stepper button { border: 0; background: var(--surface-2); color: var(--ink-2); cursor: pointer; display: grid; place-items: center; min-height: 44px; }
.stepper button:hover { background: var(--brand-soft); color: var(--brand-text); }
.stepper input { border: 0; background: transparent; text-align: center; font: inherit; font-size: 16px; font-weight: 700; color: var(--ink); min-width: 0; width: 100%; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input:focus { outline: none; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Auth (sign-in) – premium centered experience ---------- */
body.auth {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: #07061A;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
body.auth input,
body.auth button,
body.auth label,
body.auth .auth-card {
  -webkit-user-select: text;
  user-select: text;
}

.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(91, 61, 245, .45), transparent 55%),
    radial-gradient(ellipse 80% 60% at 100% 50%, rgba(22, 184, 166, .18), transparent 50%),
    radial-gradient(ellipse 70% 50% at 0% 80%, rgba(120, 80, 255, .22), transparent 45%),
    linear-gradient(165deg, #0B0A1A 0%, #12102B 40%, #0A0A18 100%);
}
.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .55;
  animation: orb-float 18s ease-in-out infinite;
}
.auth-orb-1 {
  width: min(520px, 70vw);
  height: min(520px, 70vw);
  top: -12%;
  right: -8%;
  background: radial-gradient(circle, rgba(124, 92, 255, .7), transparent 70%);
}
.auth-orb-2 {
  width: min(420px, 60vw);
  height: min(420px, 60vw);
  bottom: -18%;
  left: -12%;
  background: radial-gradient(circle, rgba(35, 180, 160, .45), transparent 70%);
  animation-delay: -6s;
  animation-duration: 22s;
}
.auth-orb-3 {
  width: min(280px, 40vw);
  height: min(280px, 40vw);
  top: 42%;
  left: 38%;
  background: radial-gradient(circle, rgba(180, 100, 255, .35), transparent 70%);
  animation-delay: -12s;
  animation-duration: 26s;
}
@keyframes orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(18px, -22px) scale(1.05); }
  66% { transform: translate(-14px, 16px) scale(.96); }
}
.auth-grid {
  position: absolute;
  inset: 0;
  opacity: .35;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
}

.auth-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}
.auth-art {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px clamp(28px, 5vw, 72px);
  color: #fff;
  overflow: hidden;
}
.auth-art > * { position: relative; }
.auth-art-mid { max-width: 520px; }
.auth-art h2 {
  color: #fff;
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.05;
  text-wrap: balance;
  text-shadow: 0 4px 40px rgba(0,0,0,.25);
}
.auth-art p {
  margin-top: 18px;
  color: rgba(210, 205, 240, .82);
  font-size: 17px;
  max-width: 440px;
  line-height: 1.55;
}
.auth-art-foot {
  color: rgba(185, 182, 218, .5);
  font-size: 13px;
  letter-spacing: .02em;
}

.ticket {
  --stub: 64px; --notch: 12px;
  margin-top: 44px;
  max-width: 440px;
  color: #16142B;
  background: linear-gradient(165deg, #FFFFFF 0%, #EDE8FF 100%);
  border-radius: 20px;
  box-shadow: 0 28px 60px -18px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255,255,255,.08);
  -webkit-mask:
    radial-gradient(circle var(--notch) at 0 calc(100% - var(--stub)), #0000 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% calc(100% - var(--stub)), #0000 97%, #000) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle var(--notch) at 0 calc(100% - var(--stub)), #0000 97%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% calc(100% - var(--stub)), #0000 97%, #000) right / 51% 100% no-repeat;
  transform: rotate(-2.2deg);
  animation: ticket-in .95s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes ticket-in {
  from { opacity: 0; transform: translateY(28px) rotate(-6deg); }
  to { opacity: 1; transform: rotate(-2.2deg); }
}
.ticket-main { padding: 24px 26px 22px; }
.ticket-label { font-size: 13px; font-weight: 600; color: #6B5FA8; }
.ticket-key {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(17px, 2.1vw, 23px);
  letter-spacing: .02em;
  white-space: nowrap;
}
.ticket-stub {
  height: var(--stub);
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 2px dashed rgba(91, 61, 245, .35);
}
.ticket-state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: #0B7A55; }
.ticket-copy {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #fff;
  color: #4228C9;
  box-shadow: 0 2px 8px rgba(66, 40, 201, .15);
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 28px clamp(18px, 4vw, 48px);
  position: relative;
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 36px 32px 28px;
  border-radius: 28px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .55),
    0 24px 64px -16px rgba(10, 8, 40, .45),
    0 8px 24px -8px rgba(10, 8, 40, .2);
  animation: card-in .7s cubic-bezier(.2, .8, .2, 1) both;
}
html[data-theme="dark"] .auth-card {
  background: rgba(22, 19, 48, .88);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .08),
    0 24px 64px -16px rgba(0, 0, 0, .6),
    0 8px 24px -8px rgba(0, 0, 0, .35);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(20px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.auth-card-glow {
  position: absolute;
  inset: -1px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(124, 92, 255, .35), transparent 40%, transparent 60%, rgba(22, 184, 166, .25));
  opacity: .6;
  z-index: -1;
  filter: blur(12px);
  pointer-events: none;
}
.auth-card h1 {
  font-size: clamp(28px, 5vw, 34px);
  font-weight: 800;
  letter-spacing: -.03em;
  margin: 0 0 6px;
  color: var(--ink);
}
.auth-kicker {
  margin-bottom: 10px;
  color: var(--brand-text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.auth-sub {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}
.auth-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  line-height: 1.4;
}
.auth-credit {
  margin-top: 14px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  letter-spacing: .03em;
  opacity: .85;
}
.auth-credit strong { color: var(--ink-2); font-weight: 700; }
.brand-mobile {
  display: none;
  margin-bottom: 28px;
  align-items: center;
  gap: 12px;
}
.brand-mobile .brand-text b { color: var(--ink); }
.auth-card .flash { margin-bottom: 18px; }
.auth-form .field { margin-bottom: 16px; }
.auth-form .field:last-of-type { margin-bottom: 22px; }
.auth-submit {
  margin-top: 4px;
  box-shadow: 0 8px 24px -6px color-mix(in srgb, var(--brand) 55%, transparent);
  transition: transform .15s ease, box-shadow .15s ease;
}
.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -6px color-mix(in srgb, var(--brand) 65%, transparent);
}
.auth-submit:active { transform: translateY(0); }

/* Admin auth accent */
.auth-admin .auth-bg {
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(22, 184, 166, .4), transparent 55%),
    radial-gradient(ellipse 80% 60% at 100% 50%, rgba(35, 110, 190, .2), transparent 50%),
    radial-gradient(ellipse 70% 50% at 0% 80%, rgba(22, 184, 166, .18), transparent 45%),
    linear-gradient(165deg, #061820 0%, #0A1A28 40%, #071018 100%);
}
.auth-admin {
  --brand: #16B8A6;
  --brand-hover: #0E9487;
  --brand-soft: #DDF8F3;
  --brand-text: #08796F;
}
html[data-theme="dark"] .auth-admin {
  --brand: #2DD4BF;
  --brand-hover: #5EEAD4;
  --brand-soft: #0F332C;
  --brand-text: #5EEAD4;
}
.auth-admin .auth-orb-1 {
  background: radial-gradient(circle, rgba(22, 184, 166, .65), transparent 70%);
}
.auth-admin .auth-orb-2 {
  background: radial-gradient(circle, rgba(35, 110, 190, .4), transparent 70%);
}
.auth-admin .auth-card-glow {
  background: linear-gradient(135deg, rgba(22, 184, 166, .4), transparent 40%, transparent 60%, rgba(35, 110, 190, .3));
}

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column; padding: 22px 14px 16px;
  background: var(--side-bg); color: var(--side-ink);
}
.sidebar .brand { padding: 4px 10px 26px; }
.nav-label { padding: 0 12px 8px; font-size: 12.5px; font-weight: 600; color: rgba(185, 182, 218, .55); }
.nav { display: grid; gap: 3px; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px;
  border-radius: 12px; color: var(--side-ink); font-weight: 600; font-size: 14.5px;
  transition: background-color .15s, color .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-link.is-active { background: rgba(255, 255, 255, .1); color: #fff; }
.nav-link.is-active::before { content: ''; position: absolute; left: -14px; top: 11px; bottom: 11px; width: 4px; border-radius: 0 4px 4px 0; background: #9B86FF; }
.nav-badge { margin-left: auto; font-style: normal; min-width: 22px; padding: 2px 7px; border-radius: 999px; background: #FFB84D; color: #3A2500; font-size: 12px; font-weight: 800; text-align: center; }
.sidebar-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--side-line); }
.profile { display: flex; align-items: center; gap: 12px; padding: 8px; }
.avatar {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 13px;
  background: linear-gradient(135deg, #8B73FF, #4A2BE8); color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 17px;
}
.profile-info { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.profile-info b { color: #fff; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-info small { color: var(--side-ink); font-size: 12.5px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; min-height: 68px;
  padding: 10px 32px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line-2);
}
.menu-btn, .topbar-brand { display: none; }
.topbar-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
.tag { padding: 2px 9px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 12px; font-weight: 700; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.balance-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink-2); font-size: 14px;
}
.balance-chip:hover { text-decoration: none; border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.balance-chip b { color: var(--ink); font-variant-numeric: tabular-nums; font-size: 15px; }
.balance-chip .i { color: var(--brand); }
.theme-moon { display: none; } .theme-sun { display: inline-flex; }
html[data-theme="dark"] .theme-moon { display: inline-flex; } html[data-theme="dark"] .theme-sun { display: none; }

/* Auth floating theme toggle */
.auth-theme-toggle {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 20;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 14px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .45);
  transition: background .18s ease, border-color .18s ease, transform .15s ease;
}
.auth-theme-toggle:hover {
  background: rgba(255, 255, 255, .16);
  border-color: rgba(255, 255, 255, .28);
  transform: translateY(-1px);
}
.auth-theme-toggle:active { transform: translateY(0); }
.auth-theme-toggle .theme-sun,
.auth-theme-toggle .theme-moon { display: none; place-items: center; }
html:not([data-theme="dark"]) .auth-theme-toggle .theme-sun { display: inline-grid; }
html[data-theme="dark"] .auth-theme-toggle .theme-moon { display: inline-grid; }

.content { width: 100%; max-width: none; margin: 0; padding: 30px clamp(20px, 3vw, 48px) 28px; flex: 1; }
.foot { margin-top: 44px; color: var(--muted); font-size: 13px; text-align: center; }

.scrim { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head h1 { font-size: clamp(28px, 3.2vw, 36px); font-weight: 800; letter-spacing: -.035em; }
.page-head p { margin-top: 8px; color: var(--muted); max-width: 62ch; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  min-width: 0;
  box-shadow: 0 1px 2px rgba(22, 20, 43, .04), 0 4px 16px -6px rgba(22, 20, 43, .06);
  transition: box-shadow .2s ease, border-color .2s ease;
}
html[data-theme="dark"] .card {
  box-shadow: 0 1px 2px rgba(0,0,0,.2), 0 4px 16px -6px rgba(0,0,0,.35);
}
.card + .card, .stack > * + * { margin-top: 22px; }
.card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 24px 0; }
.card-h h2 { font-size: 19px; font-weight: 700; }
.card-h p { margin-top: 5px; color: var(--muted); font-size: 14px; max-width: 60ch; }
.card-b { padding: 22px 24px 24px; }
.card-flush { overflow: hidden; }
.card-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 24px; border-bottom: 1px solid var(--line-2); }
.card-tools .push { margin-left: auto; }
.grid-2 { display: grid; gap: 22px; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
.grid-eq { display: grid; gap: 22px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.grid-2 > .card + .card, .grid-eq > .card + .card { margin-top: 0; }
.section-gap { margin-top: 22px; }

.flash {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; margin-bottom: 22px;
  border: 1px solid transparent; border-radius: 14px; font-size: 14.5px; font-weight: 500;
  animation: flash-in .28s ease-out;
}
.flash > .i { margin-top: 1px; }
.flash > span { flex: 1; min-width: 0; }
.flash.success { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash.error { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.flash.info { background: var(--brand-soft); color: var(--brand-text); border-color: color-mix(in srgb, var(--brand) 20%, transparent); }
.flash.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.flash a { font-weight: 700; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.flash-x { border: 0; background: transparent; color: inherit; opacity: .6; cursor: pointer; padding: 2px; border-radius: 6px; display: grid; }
.flash-x:hover { opacity: 1; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.flash.is-gone { display: none; }

/* ---------- Dashboard ---------- */
.dash-top { display: grid; gap: 22px; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: stretch; }
.dash-top > .card + .card { margin-top: 0; }
.wallet {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  padding: 26px; color: #fff; border: 0; border-radius: var(--r-l);
  background:
    radial-gradient(420px 260px at 100% 0%, rgba(155, 134, 255, .55), transparent 65%),
    linear-gradient(160deg, #3A22C4 0%, #1E1260 100%);
}
.wallet::after { /* perforation edge */
  content: ''; position: absolute; right: 22px; top: 0; bottom: 0; width: 0; border-right: 2px dashed rgba(255, 255, 255, .16);
}
.wallet-label { display: flex; align-items: center; gap: 8px; color: rgba(255, 255, 255, .72); font-weight: 600; font-size: 14px; }
.wallet-amount { margin: 14px 0 6px; font-family: var(--font-display); font-weight: 800; letter-spacing: -.04em; font-size: clamp(38px, 4.4vw, 52px); line-height: 1; font-variant-numeric: tabular-nums; }
.wallet-sub { color: rgba(255, 255, 255, .7); font-size: 14px; }
.wallet-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; padding-right: 20px; }
.wallet .btn { background: rgba(255, 255, 255, .14); border-color: transparent; color: #fff; }
.wallet .btn:hover { background: rgba(255, 255, 255, .24); }
.wallet .btn-primary { background: #fff; color: #2A1A9E; }
.wallet .btn-primary:hover { background: #EDE8FF; }

.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.mini-stats .card + .card { margin-top: 0; }
.stat {
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 40%, transparent));
  opacity: .85;
  border-radius: var(--r-m) var(--r-m) 0 0;
}
.stat-k { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.stat-k .i { color: var(--brand); }
.stat-v { margin-top: 10px; font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-n { margin-top: 4px; color: var(--muted); font-size: 13px; }

/* generator */
.gen-grid { display: grid; gap: 18px; }
.gen-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 14px; align-items: end; }
.sum { display: grid; gap: 0; margin-top: 6px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.sum-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 16px; font-size: 14.5px; color: var(--ink-2); }
.sum-row + .sum-row { border-top: 1px solid var(--line-2); }
.sum-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.sum-total { background: var(--surface); }
.sum-total span { font-weight: 700; color: var(--ink); }
.sum-total b { font-family: var(--font-display); font-size: 22px; letter-spacing: -.02em; }
.sum.is-short .sum-after b { color: var(--bad); }
.gen-warn { display: none; align-items: center; gap: 8px; color: var(--bad); font-size: 13.5px; font-weight: 600; }
.gen-warn.is-on { display: flex; }
.gen-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 14px; padding: 13px 24px; }
.list li + li { border-top: 1px solid var(--line-2); }
.list-ico { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 12px; background: var(--brand-soft); color: var(--brand-text); }
.list-ico.in { background: var(--ok-soft); color: var(--ok); }
.list-ico.out { background: var(--bad-soft); color: var(--bad); }
.list-ico.wait { background: var(--warn-soft); color: var(--warn); }
.list-main { flex: 1; min-width: 0; line-height: 1.35; }
.list-main b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main small { color: var(--muted); font-size: 13px; }
.list-end { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.list-end small { display: block; font-weight: 500; color: var(--muted); font-size: 12.5px; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th {
  padding: 12px 18px; text-align: left; white-space: nowrap;
  font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.tbl td { padding: 14px 18px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color .12s; }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 35%, transparent); }
.tbl th:first-child, .tbl td:first-child { padding-left: 24px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 24px; }
.tbl .num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .nowrap { white-space: nowrap; }
.money { font-weight: 700; font-variant-numeric: tabular-nums; }
.money.in { color: var(--ok); } .money.out { color: var(--bad); } .money.wait { color: var(--warn); }
.cell-main { display: grid; line-height: 1.35; }
.cell-main small { color: var(--muted); font-size: 12.5px; }
.cell-user { display: flex; align-items: center; gap: 12px; }
.avatar-sm { width: 34px; height: 34px; border-radius: 11px; font-size: 14px; }
.key-code {
  display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  font-family: var(--font-mono); font-size: 13.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.copy-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.copy-btn:hover { background: var(--brand-soft); color: var(--brand-text); }
.copy-btn.is-done { color: var(--ok); background: var(--ok-soft); }

.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-brand { background: var(--brand-soft); color: var(--brand-text); }
.pill-neutral { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

.no-results { display: none; padding: 40px 20px; text-align: center; color: var(--muted); }
.no-results.is-on { display: block; }
.row-hidden { display: none; }

.empty { display: grid; justify-items: center; gap: 6px; padding: 56px 24px; text-align: center; }
.empty-ico { display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 10px; border-radius: 20px; background: var(--brand-soft); color: var(--brand-text); }
.empty b { font-family: var(--font-display); font-size: 19px; }
.empty p { color: var(--muted); max-width: 40ch; margin-bottom: 12px; }
.card .empty { padding: 44px 24px; }

/* group header inside price table */
.group-row td { padding: 10px 24px !important; background: var(--surface-2); font-size: 13px; font-weight: 700; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.group-row:hover { background: var(--surface-2) !important; }
.price-input.is-changed { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- Dialog ---------- */
dialog.modal {
  width: calc(100% - 24px); max-width: 520px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-l);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-float);
}
dialog.modal[open] { animation: modal-in .2s cubic-bezier(.2, .8, .2, 1); }
dialog.modal::backdrop { background: rgba(10, 8, 30, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
dialog.modal-wide { max-width: 640px; }
.modal-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 0; }
.modal-h h2 { font-size: 22px; font-weight: 800; letter-spacing: -.025em; }
.modal-h p { margin-top: 6px; color: var(--muted); font-size: 14px; }
.modal-b { padding: 20px 24px 24px; display: grid; gap: 18px; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 0 24px 24px; }
.modal-section { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); display: grid; gap: 12px; }
.modal-section h3 { font-size: 15px; font-family: var(--font-body); letter-spacing: 0; font-weight: 700; }
.modal-section p { color: var(--muted); font-size: 13.5px; margin-top: -6px; }
.inline-form { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.inline-form .input { flex: 1 1 160px; }

.keylist { display: grid; gap: 8px; max-height: min(46vh, 380px); overflow-y: auto; padding: 2px; }
.keyrow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px;
  border: 1px dashed color-mix(in srgb, var(--brand) 45%, var(--line)); border-radius: 14px; background: var(--surface-2);
}
.keyrow code { font-weight: 600; font-size: 15px; letter-spacing: .03em; word-break: break-all; }

/* ---------- Sticky save bar ---------- */
.savebar {
  position: fixed; left: calc(var(--sidebar-w) + 32px); right: 32px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  max-width: 1156px; margin: 0 auto; padding: 12px 14px 12px 20px;
  background: var(--side-bg); color: #fff; border-radius: 18px; box-shadow: var(--shadow-float);
  transform: translateY(140%); opacity: 0; pointer-events: none; transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .2s;
}
.savebar.is-on { transform: none; opacity: 1; pointer-events: auto; }
.savebar span { font-weight: 600; }
.savebar .btn-ghost-dark { background: transparent; color: var(--side-ink); border-color: var(--side-line); }
.savebar .btn-ghost-dark:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.savebar-btns { display: flex; gap: 8px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 100; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 10px; justify-items: end; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; pointer-events: auto;
  background: var(--side-bg); color: #fff; font-weight: 600; font-size: 14.5px; box-shadow: var(--shadow-float);
  animation: toast-in .25s cubic-bezier(.2, .8, .2, 1);
}
.toast .i { color: #5BE3B0; }
.toast.is-error .i { color: #FF8097; }
.toast.is-out { opacity: 0; transform: translateY(8px); transition: .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- Admin tabs ---------- */
.tab-panel[hidden] { display: none !important; }
.callout { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: 14px; background: var(--brand-soft); color: var(--brand-text); font-size: 14.5px; }
.callout .i { margin-top: 2px; }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.callout b { color: inherit; }
.callout-row { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; justify-content: space-between; }
.kv { display: grid; gap: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-2); font-size: 14.5px; }
.kv > div:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- Motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .dash-top, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .mini-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .brand-mobile { display: flex; }
  .auth-panel {
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  }
  .auth-card {
    max-width: 400px;
    width: 100%;
    padding: 32px 24px 24px;
    border-radius: 24px;
  }
  .grid-eq { grid-template-columns: minmax(0, 1fr); }

  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
    padding-top: max(22px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-float); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(10, 8, 30, .55); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }

  .menu-btn { display: inline-grid; }
  .topbar-brand { display: inline-grid; }
  .topbar-status { display: none; }
  .topbar { padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); min-height: 62px; gap: 12px; }
  .content { padding: 22px 16px 24px; }
  .savebar { left: 16px; right: 16px; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .input, .select, .textarea, .stepper input { font-size: 16px; }
  .page-head { margin-bottom: 20px; }
  .card-h { padding: 18px 18px 0; }
  .card-b { padding: 18px 18px 20px; }
  .card-tools { padding: 14px 18px; }
  .search { max-width: none; flex-basis: 100%; }
  .gen-row { grid-template-columns: minmax(0, 1fr); }
  .mini-stats { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .wallet { padding: 22px; }
  .wallet::after { right: 14px; }
  .wallet-actions { padding-right: 14px; }
  .balance-chip-label { display: none; }
  .list li { padding: 12px 18px; }
  .toasts { left: 16px; right: 16px; justify-items: stretch; }

  /* tables become stacked cards */
  .tbl.stack thead { display: none; }
  .tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; width: 100%; }
  .tbl.stack tr { padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
  .tbl.stack tbody tr:last-child { border-bottom: 0; }
  .tbl.stack td { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 0 !important; border: 0; text-align: right; }
  .tbl.stack td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: 13px; font-weight: 600; text-align: left; }
  .tbl.stack td[data-label=""]::before, .tbl.stack td:not([data-label])::before { content: none; }
  .tbl.stack td.cell-first { justify-content: flex-start; padding-bottom: 10px !important; text-align: left; }
  .tbl.stack td.cell-first::before { content: none; }
  .tbl.stack td.cell-actions { justify-content: flex-end; padding-top: 12px !important; flex-wrap: wrap; }
  .tbl.stack td.cell-actions::before { content: none; }
  .tbl.stack .group-row { padding: 0; }
  .tbl.stack .group-row td { display: block; text-align: left; padding: 10px 18px !important; }
  .tbl.stack .group-row td::before { content: none; }
  .tbl.stack .input-money { width: 120px; }
  .tbl.stack tbody tr:hover { background: transparent; }
  .savebar { flex-direction: column; align-items: stretch; text-align: center; }
  .savebar-btns { justify-content: stretch; }
  .savebar-btns .btn { flex: 1; }
  dialog.modal { margin: auto auto 0; max-width: 100%; width: 100%; border-radius: 24px 24px 0 0; max-height: 92dvh; }
  .modal-h, .modal-b, .modal-f { padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 400px) {
  .auth-card { padding: 28px 20px 22px; border-radius: 22px; }
  .auth-card h1 { font-size: 26px; }
  .page-head h1 { font-size: 27px; }
}

@media print {
  .sidebar, .topbar, .savebar, .toasts, .scrim { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}

/* admin stat row */
.mini-stats.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .mini-stats.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .mini-stats.cols-4 { grid-template-columns: minmax(0, 1fr); } }

body:has(.savebar.is-on) .content { padding-bottom: 120px; }
.wallet-last { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.1); font-size: 14px; color: rgba(255,255,255,.8); }
.wallet-last b { color: #fff; font-variant-numeric: tabular-nums; }
.wallet-last small { margin-left: auto; color: rgba(255,255,255,.6); font-size: 13px; }

/* v3 security and mobile refresh */
.mobile-hide { display: inline-flex; }
.admin-generator-card { border-color: color-mix(in srgb, var(--brand) 25%, var(--line)); }
@media (max-width: 720px) {
  .mobile-hide { display: none !important; }
  .dash-top { display: flex; flex-direction: column; }
  .dash-top .wallet { order: -1; }
  .wallet { min-height: 225px; }
  .sidebar .nav { gap: 8px; }
  .sidebar .nav-link { min-height: 50px; padding: 0 14px; border: 1px solid rgba(255,255,255,.04); }
  .nav-label { margin-top: 8px; }
  .page-actions, .page-actions .btn { width: 100%; }
  .page-actions .btn { min-height: 46px; }
}


.admin-live-balance{display:flex;align-items:center;gap:9px;margin-top:14px;color:var(--muted);font-size:13px}.admin-live-balance .dot{width:7px;height:7px}.admin-live-balance strong{color:var(--ink);font-size:16px;font-variant-numeric:tabular-nums}.admin-live-balance a{font-weight:700;margin-left:4px}
