/* Magni design system — client door (light) and Magni Console (dark sidebar).
   Brand: Klein Blue #0237D7 · Black #101820 · Alabaster #F3F1F4 · Pastel Gray #DCD1BE
   Headings: Glancyr · Body: Montserrat (files in /fonts, from ENTREGA ID. VISUAL - MAGNI/TIPOGRAFIA)
   Sections: 1 fonts+tokens · 2 base · 3 layout utilities · 4 buttons · 5 forms · 6 pills+chips · 7 cards+stats
   8 alerts · 9 tabs · 10 tables · 11 overlays · 12 dropdowns+bell · 13 charts+progress · 14 empty+skeleton
   15 shell · 16 Magni Console · 17 auth pages · 18 legacy page pieces · 19 responsive */

/* ============================================================ 1. fonts + tokens */
/* Only the faces the UI uses: Glancyr 600 (every heading and big number) and Montserrat 400/500/600.
   Nothing asks for 700 (it would fall back to 600). The pages preload Montserrat-Regular and Glancyr-SemiBold.
   .woff2 files are the same fonts, Brotli-packed (lossless, about 65% smaller); .ttf/.otf stay as fallback. */
@font-face { font-family: 'Glancyr'; src: url('/fonts/Glancyr-SemiBold.woff2') format('woff2'), url('/fonts/Glancyr-SemiBold.otf') format('opentype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat-Regular.woff2') format('woff2'), url('/fonts/Montserrat-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat-Medium.woff2') format('woff2'), url('/fonts/Montserrat-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat-SemiBold.woff2') format('woff2'), url('/fonts/Montserrat-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }

:root {
  /* brand */
  --blue: #0237D7;
  --blue-text: #0237D7;      /* blue used as TEXT (links, numbers); the dark theme lightens it */
  --topbar-bg: rgba(255,255,255,.92);
  --blue-dark: #0230BD;
  --blue-700: #01279B;
  --blue-soft: #EEF2FD;
  --blue-100: #DCE5FB;
  --blue-200: #B9CAF7;
  --black: #101820;
  --alabaster: #F3F1F4;
  --sand: #DCD1BE;
  --sand-soft: #F5F0E8;
  --sand-700: #7E6A47;
  --white: #ffffff;
  /* neutrals */
  --ink: #101820;
  --ink-2: #39414D;
  --muted: #646B77;        /* secondary text: ≥ 4.5:1 on every light surface, tinted pills included */
  --faint: #9AA0AA;        /* icons, borders and decoration only — never text */
  --control: #878D98;      /* checkbox / radio borders (≥ 3:1 on white) */
  --bg: #F6F5F8;
  --surface: #ffffff;
  --surface-2: #FAF9FB;
  --line: #E9E6EC;
  --line-2: #DDD9E1;
  --line-3: #CCC7D2;       /* hover borders, switch track */
  --hover: #F4F3F6;
  --blue-softer: #F5F7FE;  /* selected rows, unread notifications */
  --black-2: #1C2733;
  /* status */
  --green: #11795A;
  --green-soft: #E5F4EE;
  --green-dot: #1DAA7B;
  --green-dark: #0C6248;
  --green-line: #C7E8DA;
  --amber: #A65300;
  --amber-soft: #FEF2E1;
  --amber-dot: #F29A1F;
  --amber-text: #7A3E00;
  --amber-line: #F5D9B0;
  --amber-tint: #FFFBF4;
  --red: #C42730;
  --red-soft: #FDECEC;
  --red-dot: #E5484D;
  --red-dark: #A81F27;
  --red-line: #F3C9CB;
  --red-tint: #FFF7F7;
  --grey: #5F6672;
  --grey-soft: #EFEEF2;
  /* on dark surfaces (console sidebar, auth side panel, address block, toasts) */
  --dk-text: #C3C9D2;
  --dk-muted: #7F8A99;     /* ≥ 5:1 on Black */
  --dk-blue: #8FA9FF;
  --dk-green: #5BD6A6;
  /* shape */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 32, .04), 0 1px 3px rgba(16, 24, 32, .03);
  --shadow-md: 0 4px 12px rgba(16, 24, 32, .06), 0 1px 3px rgba(16, 24, 32, .05);
  --shadow-lg: 0 18px 50px rgba(16, 24, 32, .18), 0 4px 12px rgba(16, 24, 32, .08);
  --ring: 0 0 0 3px rgba(2, 55, 215, .16);
  /* type */
  --head: 'Glancyr', 'Montserrat', system-ui, sans-serif;
  --body: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
  /* layout */
  --sb-w: 256px;
  --sb-w-min: 72px;
  --tb-h: 64px;
  --pad: 28px;
  --cell-y: 13px;
  --cell-x: 14px;
}

/* ============================================================ 2. base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  font-family: var(--body); font-size: 14px; line-height: 1.5; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4 { font-family: var(--head); font-weight: 600; margin: 0; letter-spacing: .005em; line-height: 1.25; }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 12px; }
a { color: var(--blue-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
svg.i { flex: none; display: inline-block; vertical-align: middle; }
::selection { background: var(--blue-100); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
/* inside scrolling / clipped containers the ring goes inside so it is never cut off */
.sb-nav a:focus-visible, .dd-item:focus-visible, .notif:focus-visible, .mtabs button:focus-visible,
.dt-table th:focus-visible, .sb-collapse:focus-visible, .seg button:focus-visible { outline-offset: -2px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.mono { word-break: break-all; }

/* ============================================================ 3. utilities + layout */
.muted { color: var(--muted); }
.faint { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong, b, strong { font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 16px; }
.mt-0 { margin-top: 0 !important; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.blue { color: var(--blue-text); }
.num-big { font-family: var(--head); font-size: 28px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }

/* grids: every track is minmax(0, …) so tables and charts can shrink */
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid + .grid, .grid + .card, .card + .grid { margin-top: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid.cols-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.grid.cols-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.grid > .card + .card { margin-top: 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.section-title { scroll-margin-top: calc(var(--tb-h) + 12px); font: 600 12px var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 26px 0 12px; }

/* ============================================================ 4. buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: 600 13px/1.2 var(--body); padding: 0 16px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--blue); color: var(--white); cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s; white-space: nowrap;
  text-decoration: none; position: relative; user-select: none;
}
.btn:hover { background: var(--blue-dark); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; box-shadow: none; }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn .i { margin: 0 -1px; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn.secondary:hover { background: var(--hover); border-color: var(--line-3); }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--surface); color: var(--ink); border-color: var(--line-3); }
.btn.ghost.on { background: var(--blue-soft); color: var(--blue-text); border-color: var(--blue-200); }
.btn.soft { background: var(--blue-soft); color: var(--blue-text); }
.btn.soft:hover { background: var(--blue-100); }
.btn.dark { background: var(--black); }
.btn.dark:hover { background: var(--black-2); }
.btn.danger { background: var(--surface); color: var(--red); border-color: var(--red-line); }
.btn.danger:hover { background: var(--red-soft); }
.btn.danger.solid { background: var(--red); color: var(--white); border-color: var(--red); }
.btn.danger.solid:hover { background: var(--red-dark); }
.btn.success { background: var(--green); }
.btn.success:hover { background: var(--green-dark); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; gap: 6px; }
.btn.xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; gap: 5px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.busy { color: transparent !important; pointer-events: none; }
.btn.busy::after {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45); border-top-color: var(--white); animation: spin .7s linear infinite;
}
.btn.secondary.busy::after, .btn.ghost.busy::after, .btn.danger:not(.solid).busy::after { border-color: var(--line-2); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

.link { background: none; border: 0; padding: 0; font: 600 13px var(--body); color: var(--blue-text); cursor: pointer; }
.link:hover { text-decoration: underline; }
.link.sm { font-size: 12px; }
.link.muted { color: var(--muted); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none;
  border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--ink-2);
  cursor: pointer; padding: 0; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 6px; }
.icon-btn.xs { width: 24px; height: 24px; border-radius: 5px; color: var(--control); }
.icon-btn.xs:hover { color: var(--blue-text); background: var(--blue-soft); }

/* ============================================================ 5. forms */
label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 6px; color: var(--ink); }
.field { margin-bottom: 16px; min-width: 0; }
.field .hint, .hint { font-size: 12px; color: var(--muted); margin-top: 5px; font-weight: 400; }
.field .req { color: var(--red); }
input, select, textarea {
  width: 100%; font: 400 14px var(--body); color: var(--ink); height: 40px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input:hover, select:hover, textarea:hover { border-color: var(--line-3); }
input:focus, select:focus, textarea:focus { border-color: var(--blue-text); box-shadow: var(--ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
input[readonly] { background: var(--surface-2); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--red); }
textarea { resize: vertical; min-height: 92px; padding: 10px 12px; height: auto; line-height: 1.5; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  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='%2369707C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 9.5l5.5 5.5 5.5-5.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input.sm, select.sm { height: 32px; font-size: 13px; }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }

input[type=checkbox], input[type=radio] {
  appearance: none; -webkit-appearance: none; width: 17px; height: 17px; padding: 0; margin: 0; flex: none;
  border: 1.5px solid var(--control); background: var(--surface); cursor: pointer; vertical-align: middle;
  display: inline-grid; place-content: center; transition: background .12s, border-color .12s;
}
input[type=checkbox] { border-radius: 5px; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--blue-text); }
input[type=checkbox]:checked, input[type=checkbox]:indeterminate { background: var(--blue); border-color: var(--blue-text); }
input[type=checkbox]:checked::after {
  content: ''; width: 9px; height: 5px; border: 2px solid var(--white); border-top: 0; border-right: 0;
  transform: translateY(-1px) rotate(-45deg);
}
input[type=checkbox]:indeterminate::after { content: ''; width: 9px; height: 2px; background: var(--white); border-radius: 1px; }
input[type=radio]:checked { border-color: var(--blue-text); border-width: 5px; }
.check { display: inline-flex; align-items: center; gap: 9px; font-weight: 500; font-size: 13.5px; cursor: pointer; margin: 0; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; margin: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 36px; height: 20px; border-radius: 999px; background: var(--line-3); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--white); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .track { background: var(--blue); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

.input-group { display: flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.input-group:focus-within { border-color: var(--blue-text); box-shadow: var(--ring); }
.input-group input { border: 0; box-shadow: none !important; background: transparent; min-width: 0; }
.input-group .prefix, .input-group .suffix { display: flex; align-items: center; padding: 0 12px; color: var(--muted); font-weight: 600; font-size: 13px; background: var(--surface-2); }
.input-group .prefix { border-right: 1px solid var(--line); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .suffix { border-left: 1px solid var(--line); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-icon { position: relative; }
.input-icon > .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon > input { padding-left: 40px; }
.input-icon > .reveal { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.input-icon > .reveal + input, .input-icon.has-reveal > input { padding-right: 44px; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-error, .form-ok {
  display: block; padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 14px; font-weight: 500;
}
.form-error > .i, .form-ok > .i { margin-right: 6px; vertical-align: -3px; }
.form-error { background: var(--red-soft); color: var(--red); }
.form-ok { background: var(--green-soft); color: var(--green); }
.form-ok a, .form-error a { color: inherit; text-decoration: underline; font-weight: 600; }

/* segmented control (7 / 30 / 90 days) */
.seg { display: inline-flex; gap: 2px; background: var(--grey-soft); border-radius: 9px; padding: 3px; }
.seg button {
  border: 0; background: transparent; font: 600 12.5px var(--body); height: 30px; padding: 0 13px;
  border-radius: 7px; cursor: pointer; color: var(--muted); white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,32,.1); }

/* ============================================================ 6. pills + chips */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; line-height: 1;
  padding: 5px 10px 5px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--grey-soft); color: var(--grey);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.active, .badge.approved, .badge.done, .badge.open, .badge.deposit, .badge.verified, .badge.credited, .badge.success, .badge.green
  { background: var(--green-soft); color: var(--green); }
.badge.paused, .badge.pending, .badge.unverified, .badge.waiting, .badge.processing, .badge.warn, .badge.amber
  { background: var(--amber-soft); color: var(--amber); }
.badge.banned, .badge.rejected, .badge.suspended, .badge.failed, .badge.danger, .badge.red
  { background: var(--red-soft); color: var(--red); }
.badge.cancelled, .badge.closed, .badge.expired, .badge.unused, .badge.grey { background: var(--grey-soft); color: var(--grey); }
.badge.topup, .badge.topdown, .badge.new_account, .badge.share, .badge.ban_refund, .badge.adjustment, .badge.blue
  { background: var(--blue-soft); color: var(--blue-text); }
.badge.plain::before { display: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 11px;
  font-size: 12px; font-weight: 600; background: var(--sand-soft); color: var(--sand-700); white-space: nowrap;
}
.chip b { color: var(--ink); }
.chip.blue { background: var(--blue-soft); color: var(--blue-text); }
.chip.dark { background: var(--black); color: var(--white); }
.chip.outline { background: transparent; border: 1px solid var(--line-2); color: var(--ink-2); }
.fees { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-right: 6px; vertical-align: middle; }
.dot.green { background: var(--green-dot); } .dot.amber { background: var(--amber-dot); } .dot.blue { background: var(--blue); } .dot.grey { background: var(--faint); }

.avatar {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--blue); color: var(--white); font: 600 12px var(--body); letter-spacing: .02em;
}
.avatar.lg { width: 42px; height: 42px; font-size: 14px; }

.copy-line { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.copy-line .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: normal; }

/* ============================================================ 7. cards + stats */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; min-width: 0;
}
.card + .card { margin-top: 16px; }
.card.flush { padding: 0; }
.card.flush > .card-head { padding: 18px 20px 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; }
.card-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.card-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ico-sq {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: var(--blue-soft); color: var(--blue-text);
}
.ico-sq.sand { background: var(--sand-soft); color: var(--sand-700); }
.ico-sq.green { background: var(--green-soft); color: var(--green); }
.ico-sq.amber { background: var(--amber-soft); color: var(--amber); }
.ico-sq.red { background: var(--red-soft); color: var(--red); }
.ico-sq.dark { background: var(--black); color: var(--white); }

.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; min-width: 0; position: relative; overflow: hidden;
}
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--muted); padding-top: 2px; }
.stat-value { font-family: var(--head); font-size: 26px; font-weight: 600; margin-top: 8px; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-foot { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.stat .ico-sq { width: 32px; height: 32px; margin: -4px -4px 0 0; }
.stat.tone-hero { background: var(--blue); border-color: var(--blue-text); color: var(--white); }
.stat.tone-hero::after {
  content: ''; position: absolute; right: -40px; bottom: -60px; width: 220px; height: 180px; pointer-events: none;
  background: url('/img/pattern-gray.png') 0 0 / 420px auto; opacity: .16; transform: rotate(-8deg);
}
.stat.tone-hero, .stat.tone-hero .stat-value { color: var(--white); } /* also inside links that inherit colour */
.stat.tone-hero .stat-label, .stat.tone-hero .stat-foot { color: rgba(255,255,255,.85); }
.stat.tone-hero .ico-sq { background: rgba(255,255,255,.14); color: var(--white); }
.stat.tone-hero .chip { background: rgba(255,255,255,.16); color: var(--white); }
.stat.tone-warn { border-color: var(--amber-line); background: linear-gradient(180deg, var(--amber-tint), var(--surface) 70%); }
.stat.tone-warn .stat-value { color: var(--amber); }
.stat.tone-warn .ico-sq { background: var(--amber-soft); color: var(--amber); }
.stat.tone-danger { border-color: var(--red-line); background: linear-gradient(180deg, var(--red-tint), var(--surface) 70%); }
.stat.tone-danger .stat-value { color: var(--red); }
.stat.tone-danger .ico-sq { background: var(--red-soft); color: var(--red); }
a.stat { color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
a.stat:hover { border-color: var(--blue-200); box-shadow: var(--shadow-md); }

/* key/value rows */
.kv { display: grid; gap: 0; }
.kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { font-variant-numeric: tabular-nums; text-align: right; }

/* list rows (top accounts, activity) */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .meta { font-size: 12px; color: var(--muted); }
.list-row .val { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }


/* ============================================================ 8. alerts */
.alert {
  border-radius: var(--radius); padding: 13px 16px; margin-bottom: 16px; display: flex; gap: 12px;
  align-items: center; flex-wrap: wrap; border: 1px solid transparent; font-weight: 500;
}
.alert > .i:first-child { flex: none; }
.alert .alert-body { flex: 1; min-width: 200px; }
.alert .alert-body strong { display: block; margin-bottom: 2px; }
.alert.warn { background: var(--amber-soft); color: var(--amber-text); border-color: var(--amber-line); }
.alert.warn > .i:first-child { color: var(--amber-dot); }
.alert.info { background: var(--blue-soft); color: var(--blue-700); border-color: var(--blue-100); }
.alert.danger { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.alert.success { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.alert.neutral { background: var(--surface); color: var(--ink-2); border-color: var(--line); }

/* ============================================================ 9. tabs (M.tabs) */
.mtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.mtabs::-webkit-scrollbar { display: none; }
.mtabs button {
  position: relative; border: 0; background: none; padding: 10px 12px 12px; font: 600 13.5px var(--body);
  color: var(--muted); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px;
}
.mtabs button:hover { color: var(--ink); }
.mtabs button.on { color: var(--blue-text); }
.mtabs button.on::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--blue); }
.tab-count { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--grey-soft); color: var(--muted); }
.mtabs button.on .tab-count { background: var(--blue-soft); color: var(--blue-text); }

/* ============================================================ 10. tables */
/* plain tables */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 11px var(--cell-x); border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2);
}
td { padding: var(--cell-y) var(--cell-x); border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* M.table */
.dt { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card > .dt, .card .dt { border: 0; box-shadow: none; border-radius: 0; margin: 0 -20px -20px; }
/* A flush card has no padding, so the table must not pull itself out of it. */
.card.flush > .dt, .card.flush .dt { margin: 0; }
.card > .dt .dt-bar, .card .dt .dt-bar { padding-top: 0; }
.dt-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; flex-wrap: wrap; }
.dt-tools, .dt-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.dt-right { margin-left: auto; }
.dt-tools .btn, .dt-right .btn { height: 36px; }
.dt-search { position: relative; margin: 0; font-weight: 400; }
.dt-search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.dt-search input { height: 36px; width: 260px; max-width: 100%; padding-left: 36px; font-size: 13.5px; background: var(--surface); }
.dt-fcount { font-size: 11px; background: var(--blue); color: var(--white); border-radius: 999px; padding: 1px 7px; font-weight: 600; }
.dt-selinfo { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; padding: 0 4px 0 10px; height: 36px; border-left: 1px solid var(--line); }
.dt-selinfo b { color: var(--blue-text); }
.dt-filters { display: flex; align-items: flex-end; gap: 12px; padding: 0 16px 14px; flex-wrap: wrap; }
.dt-filter { margin: 0; font-weight: 400; min-width: 160px; }
.dt-filter span { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.dt-filter select { height: 34px; font-size: 13px; }
.dt-filters .link { height: 34px; }
.dt-scroll { overflow-x: auto; border-top: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
.dt-table th { position: relative; user-select: none; }
.dt-table th:first-child, .dt-table td:first-child { padding-left: 18px; }
.dt-table th:last-child, .dt-table td:last-child { padding-right: 18px; }
.dt-table th.sortable { cursor: pointer; }
.dt-table th.sortable:hover { color: var(--ink); }
.dt-table th.sorted { color: var(--blue-text); }
.th-in { display: inline-flex; align-items: center; gap: 6px; }
.dt-table th.num .th-in { flex-direction: row-reverse; }
.sort-ind { display: inline-flex; flex-direction: column; gap: 2px; }
.sort-ind i { display: block; width: 0; height: 0; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; opacity: .35; }
.sort-ind i:first-child { border-bottom: 4px solid currentColor; }
.sort-ind i:last-child { border-top: 4px solid currentColor; }
.sort-ind.asc i:first-child, .sort-ind.desc i:last-child { opacity: 1; }
.dt-table td { background: var(--surface); transition: background .1s; }
.dt-table tbody tr:hover td { background: var(--surface-2); }
.dt-table.clickable tbody tr:not(.dt-empty) { cursor: pointer; }
.dt-table.clickable tbody tr:not(.dt-empty):hover td { background: var(--hover); }
.dt-table tr.selected td { background: var(--blue-softer); }
.dt-table .dt-check { width: 44px; padding-right: 0; }
.dt-table tr.dt-empty td { padding: 0; }
.dt-table tr.dt-empty:hover td { background: var(--surface); }
.dt-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.dt-rpp { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; font-size: 12.5px; color: var(--muted); }
.dt-rpp select { width: auto; height: 30px; font-size: 12.5px; padding: 0 28px 0 10px; background-position: right 7px center; }
.dt-pager { display: inline-flex; align-items: center; gap: 6px; }
.dt-range { margin-right: 10px; }
.dt-pages { font-weight: 600; color: var(--ink); margin-right: 4px; font-variant-numeric: tabular-nums; }
.dt-pager .icon-btn { border: 1px solid var(--line-2); background: var(--surface); }
.cell-main { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: 12px; color: var(--muted); }

/* ============================================================ 11. overlays */
.modal-back, .drawer-back {
  position: fixed; inset: 0; background: rgba(16,24,32,.45); z-index: 80;
  opacity: 0; transition: opacity .16s ease;
}
.modal-back { display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-back.in, .drawer-back.in { opacity: 1; }
.modal {
  background: var(--surface); border-radius: 14px; width: 100%; max-width: 520px; max-height: calc(100vh - 40px); overflow-y: auto;
  padding: 22px 24px 20px; box-shadow: var(--shadow-lg); transform: translateY(8px) scale(.985); transition: transform .16s ease;
}
.modal.wide { max-width: 760px; }
.modal-back.in .modal { transform: none; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 0 -8px 4px 0; }
.modal-head h2 { font-size: 18px; padding-top: 6px; }
.modal h2 { margin-bottom: 4px; }
.modal .sub { color: var(--muted); margin: 2px 0 18px; font-size: 13px; }
.modal-body { margin-top: 14px; }
.modal .sub + .form-error, .modal .sub + .form-error + .modal-body { margin-top: 0; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin: 20px -24px -20px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 14px 14px; position: sticky; bottom: -20px; }
.modal.confirm { max-width: 420px; text-align: left; }
.modal.confirm .sub { margin-bottom: 4px; }
.confirm-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue-text); margin-bottom: 14px; }
.confirm-ico.danger { background: var(--red-soft); color: var(--red); }

.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.drawer-back.in .drawer { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 16px 22px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { padding: 20px 22px 28px; overflow-y: auto; flex: 1; }
.drawer-foot { position: sticky; bottom: -28px; margin: 20px -22px -28px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; gap: 10px; justify-content: flex-end; }

.toast {
  position: fixed; bottom: 24px; right: 24px; display: flex; align-items: center; gap: 10px;
  background: var(--black); color: var(--white); padding: 12px 16px 12px 14px; border-radius: 10px; font-weight: 500;
  z-index: 120; box-shadow: var(--shadow-lg); max-width: min(420px, calc(100vw - 32px)); animation: toast-in .2s ease;
}
.toast .i { color: var(--dk-blue); }
.toast.success .i { color: var(--dk-green); }
.toast.error { background: var(--red); }
.toast.error .i { color: var(--white); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ============================================================ 12. dropdowns + bell */
.dd { position: relative; }
.dd-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60;
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .12s, transform .12s, visibility .12s;
}
.dd.open > .dd-panel { opacity: 1; visibility: visible; transform: none; }
.dd-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 8px 10px 6px; }
.dd-item {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left;
  font: 500 13.5px var(--body); color: var(--ink); padding: 9px 10px; border-radius: 8px; cursor: pointer;
}
.dd-item:hover { background: var(--hover); text-decoration: none; }
.dd-item.on { color: var(--blue-text); }
.dd-item .i:last-child:not(:first-child) { margin-left: auto; }
.dd-item.danger { color: var(--red); }

.bell-panel { width: 380px; max-width: calc(100vw - 24px); padding: 0; overflow: hidden; }
.bell-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.bell-list { max-height: 420px; overflow-y: auto; }
.bell-list .empty-state { padding: 34px 20px; }
.notif {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; border: 0; background: none; text-align: left; cursor: pointer;
  padding: 12px 16px; border-bottom: 1px solid var(--line); font: inherit; color: inherit; position: relative;
}
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--hover); }
.notif.unread { background: var(--blue-softer); }
.notif.unread:hover { background: var(--blue-soft); }
.notif-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.tone-green { background: var(--green-soft); color: var(--green); }
.tone-red { background: var(--red-soft); color: var(--red); }
.tone-amber { background: var(--amber-soft); color: var(--amber); }
.tone-blue { background: var(--blue-soft); color: var(--blue-text); }
.notif-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-text strong { font-size: 13px; }
.notif-text span { font-size: 12.5px; color: var(--ink-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-text em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); flex: none; margin-top: 6px; }

/* ============================================================ 13. charts + progress */
.chart { position: relative; width: 100%; min-width: 0; overflow: hidden; }
.chart svg { display: block; max-width: 100%; overflow: visible; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.chart .grid.base { stroke: var(--line-2); }
.chart .tick { font: 500 11px var(--body); fill: var(--muted); }
.chart .hit { fill: transparent; }
.chart .bar { transition: opacity .12s; }
.chart .bar.dim { opacity: .35; }
.chart .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .guide { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip {
  position: absolute; display: none; pointer-events: none; background: var(--black); color: var(--white); z-index: 5;
  border-radius: 8px; padding: 7px 10px; font-size: 12px; white-space: nowrap; box-shadow: var(--shadow-md);
}
.chart-tip span { display: block; color: rgba(255,255,255,.72); font-size: 11px; margin-bottom: 2px; }
.chart-tip b { display: flex; align-items: center; gap: 6px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-tip b i { width: 8px; height: 8px; border-radius: 2px; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; }

.stackbar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--grey-soft); gap: 2px; }
.stackbar span { display: block; height: 100%; min-width: 3px; }
.stackbar.empty { gap: 0; }

.progress { display: flex; align-items: center; gap: 10px; min-width: 0; }
.progress-track { flex: 1; height: 8px; border-radius: 999px; background: var(--grey-soft); overflow: hidden; min-width: 40px; }
.progress-track span { display: block; height: 100%; border-radius: 999px; background: var(--blue); transition: width .4s ease; }
.progress-num { font-size: 12.5px; font-weight: 600; min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.progress.tone-green .progress-track span { background: var(--green-dot); }
.progress.tone-warn .progress-track span, .progress.tone-amber .progress-track span { background: var(--amber-dot); }
.progress.tone-warn .progress-num, .progress.tone-amber .progress-num { color: var(--amber); }
.progress.tone-danger .progress-track span, .progress.tone-red .progress-track span { background: var(--red-dot); }
.progress.tone-danger .progress-num, .progress.tone-red .progress-num { color: var(--red); }
.progress.tone-dark .progress-track span { background: var(--black); }

/* ============================================================ 14. empty + loading */
.empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-ico { width: 48px; height: 48px; border-radius: 14px; background: var(--grey-soft); color: var(--faint); display: grid; place-items: center; margin: 0 auto 12px; }
.empty-title { font-weight: 600; color: var(--ink); font-size: 14px; }
.empty-state p { margin: 4px auto 0; max-width: 360px; font-size: 13px; }
.empty-action { margin-top: 16px; }

.loading { color: var(--muted); padding: 60px 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 13px; }
.loading::before { content: ''; width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--blue-100); border-top-color: var(--blue-text); animation: spin .8s linear infinite; }

.skel {
  display: block; height: 12px; border-radius: 6px; margin: 10px 0;
  background: linear-gradient(90deg, var(--grey-soft) 0%, var(--surface-2) 50%, var(--grey-soft) 100%); background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.skel.h24 { height: 24px; } .skel.w40 { width: 40%; } .skel.w60 { width: 60%; } .skel.w80 { width: 80%; }
.skel-card .skel:first-child { margin-top: 0; }
.skel-wrap .grid { margin-bottom: 16px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- stepper (M.stepper) */
.stepper { list-style: none; margin: 0 0 22px; padding: 0; display: grid; grid-template-columns: repeat(var(--steps, 4), minmax(0, 1fr)); gap: 0; counter-reset: s; }
.step { display: flex; align-items: center; gap: 10px; position: relative; padding-right: 14px; min-width: 0; }
.step:not(:last-child)::after { content: ''; flex: 1; height: 2px; border-radius: 2px; background: var(--line-2); min-width: 16px; }
.step.done:not(:last-child)::after { background: var(--blue); }
.step-dot {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font: 600 13px var(--body); background: var(--surface); border: 1.5px solid var(--line-2); color: var(--muted);
  transition: background .2s, border-color .2s, color .2s;
}
.step.done .step-dot { background: var(--blue); border-color: var(--blue-text); color: var(--white); }
.step.active .step-dot { border-color: var(--blue-text); color: var(--blue-text); background: var(--blue-soft); box-shadow: 0 0 0 4px rgba(2,55,215,.1); }
.step-label { display: flex; flex-direction: column; font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.step-label small { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.step.active .step-label, .step.done .step-label { color: var(--ink); }
.step.active .step-label small { color: var(--blue-text); }

/* ---------- countdown (M.countdown) */
.countdown {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  font: 600 13px var(--body); font-variant-numeric: tabular-nums; background: var(--blue-soft); color: var(--blue-text);
}
.countdown.warn { background: var(--amber-soft); color: var(--amber); }
.countdown.danger { background: var(--red-soft); color: var(--red); animation: blink 1s ease-in-out infinite; }
.countdown.ended { background: var(--grey-soft); color: var(--grey); }
@keyframes blink { 50% { opacity: .55; } }

/* ---------- timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; display: flex; gap: 14px; padding: 0 0 22px; min-width: 0; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before { content: ''; position: absolute; left: 11px; top: 26px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--line); }
.timeline > li:last-child::before { display: none; }
.timeline > li.done::before { background: var(--blue); }
.tl-dot {
  position: relative; width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--line-2); color: var(--white); z-index: 1;
}
.timeline > li.done .tl-dot { background: var(--blue); border-color: var(--blue-text); }
.timeline > li.done .tl-dot::after { content: ''; width: 8px; height: 4.5px; border: 2px solid var(--white); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.timeline > li.active .tl-dot { border-color: var(--blue-text); }
.timeline > li.active .tl-dot::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); }
.timeline > li.active .tl-dot::before {
  content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--blue); opacity: 0;
  animation: tl-pulse 1.6s ease-out infinite;
}
.timeline > li.error .tl-dot { background: var(--red); border-color: var(--red); }
@keyframes tl-pulse { 0% { transform: scale(.6); opacity: .6; } 100% { transform: scale(1.35); opacity: 0; } }
.tl-body { flex: 1; min-width: 0; padding-top: 1px; }
.tl-title { font-weight: 600; color: var(--ink); }
.timeline > li.pending .tl-title { color: var(--muted); font-weight: 500; }
.tl-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.tl-extra { margin-top: 10px; }

/* ---------- decorative deposit address block */
.addr-block {
  display: flex; gap: 18px; align-items: center; padding: 18px; border-radius: 14px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--black) 0%, var(--black-2) 100%); color: var(--white); isolation: isolate;
}
.addr-block::before {
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: .35;
  background: url('/img/pattern.png') 0 0 / 420px auto;
  -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000); mask-image: linear-gradient(90deg, transparent 30%, #000);
}
.addr-art-wrap { flex: none; background: var(--white); color: var(--black); border-radius: 12px; padding: 10px; display: grid; place-items: center; position: relative; }
.addr-art-wrap .addr-art { display: block; }
/* real QR (M.qr): keep the centre clear so it scans — no logo overlay */
.addr-art-wrap:has(> .qr)::after { content: none; }
svg.qr { display: block; max-width: 100%; height: auto; }
.qr-wrap { display: inline-grid; place-items: center; padding: 10px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.addr-art-wrap::after {
  content: ''; position: absolute; width: 30px; height: 30px; border-radius: 8px; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: var(--white) url('/img/symbol-blue.png') center / 16px auto no-repeat; box-shadow: 0 0 0 3px var(--white);
}
.addr-info { flex: 1; min-width: 0; }
.addr-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.6); }
.addr-value { font-family: var(--mono); font-size: 14.5px; font-weight: 600; margin: 6px 0 12px; word-break: break-all; line-height: 1.45; }
.addr-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.addr-tags .chip { background: rgba(255,255,255,.1); color: var(--white); }
.addr-block .btn.secondary { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); color: var(--white); }
.addr-block .btn.secondary:hover { background: rgba(255,255,255,.18); }
.demo-ribbon {
  display: inline-flex; align-items: center; gap: 6px; font: 600 10.5px var(--body); letter-spacing: .12em; text-transform: uppercase;
  color: var(--amber); background: var(--amber-soft); border: 1px dashed var(--amber-dot); padding: 4px 9px; border-radius: 6px;
}

/* ============================================================ 15. shell */
.app { display: flex; min-height: 100vh; }
.sb {
  width: var(--sb-w); flex: none; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40;
  transition: width .18s ease;
}
.sb-top { padding: 18px 18px 10px; min-height: var(--tb-h); display: flex; flex-direction: column; justify-content: center; }
.sb-logo { display: flex; align-items: center; height: 28px; }
.sb-logo img { display: block; }
.sb-logo .logo-full { height: 34px; width: auto; }
.sb-logo .logo-mark { height: 26px; width: auto; display: none; }
.sb-nav { flex: 1; overflow-y: auto; padding: 8px 12px; scrollbar-width: thin; }
.sb-section { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 16px 12px 6px; white-space: nowrap; }
.sb-nav a {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 7px 12px; border-radius: 9px; line-height: 1.25;
  color: var(--ink-2); font-weight: 500; margin-bottom: 2px; position: relative;
  transition: background .12s, color .12s;
}
.sb-nav a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.sb-nav a .ni { display: grid; place-items: center; width: 22px; flex: none; color: var(--faint); transition: color .12s; }
.sb-nav a:hover .ni { color: var(--ink-2); }
.sb-nav a.active { background: var(--blue-soft); color: var(--blue-text); font-weight: 600; }
.sb-nav a.active .ni { color: var(--blue-text); }
.sb-nav a.active::before { content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--blue); }
.nl { overflow: hidden; text-overflow: ellipsis; }
/* long labels (PT, or next to a count) wrap to a second line instead of being cut */
.sb-nav a .nl { min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.sb-nav .count {
  margin-left: auto; background: var(--red); color: var(--white); font-size: 11px; font-weight: 600; line-height: 18px;
  border-radius: 999px; padding: 0 6px; min-width: 20px; text-align: center;
}
.sb-foot { padding: 10px 12px 14px; border-top: 1px solid var(--line); }
.sb-collapse {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 38px; padding: 0 12px; border: 0; border-radius: 9px;
  background: none; color: var(--muted); font: 500 13px var(--body); cursor: pointer; white-space: nowrap;
}
.sb-collapse:hover { background: var(--hover); color: var(--ink); }
.sb-collapse .i { flex: none; transition: transform .18s; }
.sb-scrim { display: none; }

.app.sb-collapsed .sb { width: var(--sb-w-min); }
.app.sb-collapsed .sb-top { padding: 18px 0 10px; align-items: center; }
.app.sb-collapsed .sb-logo .logo-full { display: none; }
.app.sb-collapsed .sb-logo .logo-mark { display: block; }
.app.sb-collapsed .sb-nav { padding: 8px 10px; }
.app.sb-collapsed .sb-nav a { justify-content: center; padding: 0; gap: 0; height: 40px; }
.app.sb-collapsed .sb-nav a .nl { display: none; }
.app.sb-collapsed .sb-nav a.active::before { left: -10px; }
.app.sb-collapsed .sb-nav .count { position: absolute; top: 4px; right: 6px; min-width: 0; width: 9px; height: 9px; padding: 0; font-size: 0; border: 2px solid var(--surface); box-sizing: content-box; }
.app.sb-collapsed .sb-section { font-size: 0; padding: 10px 0 4px; }
.app.sb-collapsed .sb-section::after { content: ''; display: block; height: 1px; background: var(--line); margin: 0 10px; }
.app.sb-collapsed .sb-collapse { justify-content: center; padding: 0; gap: 0; }
.app.sb-collapsed .sb-collapse .nl { display: none; }
.app.sb-collapsed .sb-collapse .i { transform: scaleX(-1); }

.frame { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--tb-h); display: flex; align-items: center; gap: 12px; padding: 0 var(--pad);
  background: var(--topbar-bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
  backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px);
}
.tb-menu { display: none !important; }
.tb-title { font-size: 19px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-right { display: flex; align-items: center; gap: 8px; flex: none; }
.tb-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 8px; border-radius: 10px;
  border: 1px solid transparent; background: none; cursor: pointer; color: var(--ink-2); font: 600 12.5px var(--body);
  position: relative; transition: background .12s, border-color .12s;
}
.tb-btn:hover, .dd.open > .tb-btn { background: var(--hover); color: var(--ink); }
.tb-btn.icon-only { width: 38px; padding: 0; justify-content: center; }
.tb-btn > .i-chevron-down { color: var(--faint); }
.lang-btn { border-color: var(--line); padding: 0 9px; }
.flag-wrap { display: inline-flex; width: 20px; height: 14px; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px rgba(16,24,32,.12); flex: none; }
.flag-wrap .flag { display: block; }
.user-btn { padding: 0 6px 0 3px; }
.bell-count {
  position: absolute; top: 1px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--red); color: var(--white); font-size: 10px; font-weight: 600; line-height: 16px; text-align: center; border: 2px solid var(--white); box-sizing: content-box;
}
.tb-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 6px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); margin-right: 4px; max-width: 360px; min-width: 0;
}
.tb-chip-ico { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue-text); flex: none; }
.tb-chip-label { font-weight: 600; font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tb-chip-label::after { content: ''; display: inline-block; width: 1px; height: 14px; background: var(--line-2); margin-left: 10px; vertical-align: -2px; }
.tb-chip-value { font-weight: 600; font-size: 14px; color: var(--blue-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.user-panel { min-width: 260px; }
.user-card { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; min-width: 0; }
.user-card > div { min-width: 0; }
.user-card strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card > div span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { padding: 26px var(--pad) 64px; width: 100%; max-width: 1440px; min-width: 0; margin: 0 auto; flex: 1; }

/* ============================================================ 16. Magni Console (admin door) */
body.door-admin {
  --bg: #F1F2F5;
  --line: #E4E6EB;
  --line-2: #D6D9E0;
  --hover: #F2F3F6;
  --surface-2: #F8F9FB;
  --cell-y: 9px;
  --cell-x: 12px;
  --tb-h: 58px;
  --pad: 24px;
  font-size: 13.5px;
}
.door-admin .sb { background: var(--black); border-right-color: var(--black); color: var(--dk-text); }
.door-admin .sb-top { border-bottom: 1px solid rgba(255,255,255,.06); padding-bottom: 14px; }
.door-admin .sb-logo .logo-full { height: 32px; }
.sb-tag {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 10px; align-self: flex-start;
  font: 600 10px var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--dk-blue);
  background: rgba(2,55,215,.22); border: 1px solid rgba(110,142,240,.3); padding: 4px 9px; border-radius: 6px; white-space: nowrap;
}
.sb-tag .pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--dk-green); box-shadow: 0 0 0 3px rgba(74,222,155,.18); }
.door-admin .sb-section { color: var(--dk-muted); }
.door-admin .sb-nav a { color: var(--dk-text); min-height: 38px; }
.door-admin .sb-nav a .ni { color: var(--dk-muted); }
.door-admin .sb-nav a:hover { background: rgba(255,255,255,.06); color: var(--white); }
.door-admin .sb-nav a:hover .ni { color: var(--white); }
.door-admin .sb-nav a.active { background: rgba(2,55,215,.28); color: var(--white); }
.door-admin .sb-nav a.active .ni { color: var(--dk-blue); }
.door-admin .sb-nav a.active::before { background: var(--dk-blue); }
.door-admin .sb-foot { border-top-color: rgba(255,255,255,.06); }
.door-admin .sb-collapse { color: var(--dk-muted); }
.door-admin .sb-collapse:hover { background: rgba(255,255,255,.06); color: var(--white); }
.door-admin .app.sb-collapsed .sb-nav .count { border-color: var(--black); }
.door-admin .app.sb-collapsed .sb-section::after { background: rgba(255,255,255,.08); }
.door-admin .app.sb-collapsed .sb-tag { font-size: 0; gap: 0; padding: 5px; letter-spacing: 0; align-self: center; }
.door-admin .topbar { background: var(--topbar-bg); }
.door-admin .tb-title { font-size: 17px; }
.door-admin .avatar { background: var(--blue); }
.door-admin .card { padding: 18px; border-radius: 10px; }
.door-admin .stat { padding: 15px 16px; border-radius: 10px; }
.door-admin .stat-value { font-size: 23px; }
.door-admin .dt { border-radius: 10px; }
.door-admin .card .dt, .door-admin .card > .dt { margin: 0 -18px -18px; }
.door-admin .dt-bar { padding: 10px 12px; }
.door-admin .dt-table th:first-child, .door-admin .dt-table td:first-child { padding-left: 14px; }
.door-admin .dt-table th:last-child, .door-admin .dt-table td:last-child { padding-right: 14px; }
.door-admin th { font-size: 10.5px; padding-top: 9px; padding-bottom: 9px; }
.door-admin .dt-tools .btn, .door-admin .dt-right .btn, .door-admin .dt-search input { height: 32px; }
.door-admin .dt-selinfo { height: 32px; }
.door-admin .grid { gap: 14px; }
.door-admin .mtabs button { font-size: 13px; padding: 9px 10px 11px; }

/* ============================================================ 17. auth pages (login, sign-up, verify, Magni gate) */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-side {
  background: var(--black); color: var(--white); display: flex; flex-direction: column; justify-content: space-between;
  padding: 36px 52px; position: relative; overflow: hidden; isolation: isolate; gap: 28px;
}
.auth-side::before {
  content: ''; position: absolute; inset: -10% -10% -10% -10%; z-index: -2;
  background: url('/img/pattern.png') 0 0 / 600px auto repeat; opacity: .55;
  -webkit-mask-image: radial-gradient(ellipse at 80% 20%, #000 0%, transparent 65%);
  mask-image: radial-gradient(ellipse at 80% 20%, #000 0%, transparent 65%);
}
.auth-side::after {
  content: ''; position: absolute; z-index: -1; width: 620px; height: 620px; right: -220px; bottom: -260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(2,55,215,.55), rgba(2,55,215,0) 65%);
}
.auth-side > * { position: relative; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand img { height: 24px; width: auto; }
.auth-side h1 { font-size: 40px; line-height: 1.1; max-width: 480px; font-weight: 600; letter-spacing: -.005em; }
.auth-side h1 em { font-style: normal; color: var(--dk-blue); }
.auth-side p { color: var(--sand); max-width: 440px; font-size: 15px; margin: 16px 0 0; }
.auth-points { list-style: none; padding: 0; margin: 30px 0 0; display: grid; gap: 14px; max-width: 460px; }
.auth-points li { display: flex; align-items: flex-start; gap: 12px; color: var(--dk-text); font-weight: 500; }
.auth-points li strong { display: block; color: var(--white); font-weight: 600; }
.auth-points li small { display: block; color: rgba(220,225,232,.72); font-size: 12.5px; font-weight: 400; margin-top: 2px; line-height: 1.45; }
.auth-points .ico-sq { flex: none; margin-top: 2px; }
.auth-points .ico-sq { width: 30px; height: 30px; border-radius: 8px; background: rgba(2,55,215,.35); color: var(--dk-blue); }
.auth-mock {
  margin-top: 32px; max-width: 420px; border-radius: 16px; padding: 18px 20px; background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.auth-mock .lbl { font-size: 11.5px; color: rgba(255,255,255,.6); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.auth-legal { font-size: 12px; color: rgba(255,255,255,.6); }
.auth-main { display: flex; flex-direction: column; padding: 22px 28px; background: var(--surface); min-width: 0; }
.auth-top { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-height: 40px; }
.auth-top .auth-mlogo { display: none; margin-right: auto; height: 20px; }
.auth-center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 28px 0; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card > .logo { height: 30px; margin-bottom: 32px; }
.auth-card h2 { font-size: 26px; margin-bottom: 8px; letter-spacing: -.005em; }
.auth-card .sub { color: var(--muted); margin: 0 0 26px; font-size: 14px; }
.auth-card .field label { display: flex; justify-content: space-between; }
.auth-card .btn.block { height: 46px; font-size: 14px; margin-top: 6px; }
.auth-card .btn.block + .btn.block { margin-top: 10px; }
.auth-foot { margin-top: 20px; font-size: 13px; color: var(--muted); text-align: center; }
.auth-foot a { font-weight: 600; }
.auth-state { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 22px; background: var(--blue-soft); color: var(--blue-text); }
.auth-state.ok { background: var(--green-soft); color: var(--green); }
.auth-state.bad { background: var(--red-soft); color: var(--red); }
.auth-state.wait::after { content: ''; width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid var(--blue-100); border-top-color: var(--blue-text); animation: spin .8s linear infinite; }
.lang-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--grey-soft); }
.lang-switch button {
  display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; cursor: pointer; height: 30px; padding: 0 10px;
  border-radius: 7px; font: 600 12px var(--body); color: var(--muted);
}
.lang-switch button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,32,.1); }
.lang-switch .flag-wrap { width: 18px; height: 12.6px; }
.lang-switch .flag { width: 18px; height: 12.6px; }

/* ============================================================ 18. legacy page pieces (support chat, deposit box) */
.address-box { background: var(--surface-2); border: 1px dashed var(--sand); border-radius: 10px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.address-box .mono { font-size: 14px; flex: 1; min-width: 0; color: var(--ink); font-weight: 600; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 12px; margin-top: 16px; }
.facts div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.facts b { display: block; font-family: var(--head); font-size: 16px; margin-top: 2px; }
.facts span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.calc { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-size: 13px; }
.calc div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.calc div > :last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.calc .total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 9px; font-weight: 600; }
.calc .total.over { color: var(--red); }
.details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; font-size: 12.5px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; word-break: break-word; }

.chat { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.chat > .card + .card { margin-top: 0; }
.ticket-list { padding: 8px; }
.ticket-list .item { padding: 11px 12px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; }
.ticket-list .item + .item { margin-top: 2px; }
.ticket-list .item:hover { background: var(--hover); }
.ticket-list .item.on { border-color: var(--blue-200); background: var(--blue-soft); }
.ticket-list .item strong { display: block; font-size: 13.5px; margin-bottom: 4px; }
.messages { display: flex; flex-direction: column; gap: 10px; max-height: 56vh; overflow-y: auto; padding: 4px 2px 10px; }
.msg { max-width: 76%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg .meta { font-size: 11px; opacity: .7; margin-top: 4px; }
.msg.mine { align-self: flex-end; background: var(--blue); color: var(--white); border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; background: var(--alabaster); border-bottom-left-radius: 4px; }
.reply { display: flex; gap: 10px; margin-top: 12px; align-items: flex-end; }
.reply textarea { min-height: 54px; }

/* ============================================================ 19. responsive */
@media (max-width: 1180px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .auth-side { padding: 36px 36px; }
  .auth-side h1 { font-size: 32px; }
}
@media (max-width: 900px) {
  :root { --pad: 16px; }
  body.door-admin { --pad: 16px; }
  .sb {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100%; width: 272px !important; transform: translateX(-102%);
    transition: transform .22s cubic-bezier(.2,.8,.2,1), visibility 0s .22s; box-shadow: none;
    visibility: hidden; /* off-canvas links stay out of the Tab order */
  }
  .app.sb-open .sb { transform: none; visibility: visible; box-shadow: var(--shadow-lg); transition: transform .22s cubic-bezier(.2,.8,.2,1); }
  .app.sb-open .sb-scrim { display: block; position: fixed; inset: 0; background: rgba(16,24,32,.4); z-index: 35; }
  /* the collapsed desktop state never applies to the mobile drawer */
  .app.sb-collapsed .sb-top { padding: 18px 18px 10px; align-items: stretch; }
  .app.sb-collapsed .sb-logo .logo-full { display: block; }
  .app.sb-collapsed .sb-logo .logo-mark { display: none; }
  .app.sb-collapsed .sb-nav a { justify-content: flex-start; padding: 7px 12px; gap: 12px; height: auto; }
  .app.sb-collapsed .sb-nav a .nl { display: -webkit-box; }
  .app.sb-collapsed .sb-nav .count { position: static; width: auto; height: auto; min-width: 20px; padding: 0 6px; font-size: 11px; border: 0; }
  .app.sb-collapsed .sb-section { font-size: 10.5px; padding: 16px 12px 6px; }
  .app.sb-collapsed .sb-section::after { display: none; }
  .door-admin .app.sb-collapsed .sb-tag { font-size: 10px; gap: 7px; padding: 4px 9px; letter-spacing: .16em; align-self: flex-start; }
  .sb-foot { display: none; }
  .tb-menu { display: inline-flex !important; margin-left: -6px; }
  .topbar { gap: 6px; }
  .tb-title { font-size: 17px; }
  .tb-chip { padding: 0 12px 0 5px; }
  .tb-chip-label { display: none; }
  .main { padding: 18px var(--pad) 56px; }
  .chat, .grid.cols-2, .grid.cols-2-1, .grid.cols-1-2, .grid.cols-3-2 { grid-template-columns: minmax(0, 1fr); }
  .msg { max-width: 90%; }
  .auth-wrap { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }
  .auth-top .auth-mlogo { display: block; }
  .auth-main { padding: 18px 20px; }
  .auth-card > .logo { display: none; }
  .toast { right: 16px; left: 16px; bottom: 16px; max-width: none; }
}
@media (max-width: 640px) {
  .grid.cols-4, .grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .tb-chip { display: none !important; }
  .lang-btn .lang-code, .lang-btn .i-chevron-down, .user-btn .i-chevron-down { display: none; }
  .tb-right { gap: 2px; }
  .card { padding: 16px; }
  .card .dt, .card > .dt { margin: 0 -16px -16px; }
  .door-admin .card { padding: 16px; }
  .door-admin .card .dt, .door-admin .card > .dt { margin: 0 -16px -16px; }
  .dt-bar { padding: 12px; }
  .dt-tools { width: 100%; }
  .dt-search { flex: 1 1 100%; }
  .dt-search input { width: 100%; }
  .dt-right { margin-left: 0; }
  .dt-filter { flex: 1 1 140px; min-width: 0; }
  .dt-foot { padding: 10px 12px; }
  .dt-range { display: none; }
  .stat-value { font-size: 23px; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { max-width: none !important; border-radius: 16px 16px 0 0; max-height: 92vh; padding: 20px 18px 18px; }
  .modal .actions { margin: 18px -18px -18px; padding: 12px 18px; border-radius: 0; bottom: -18px; }
  .modal .actions .btn { flex: 1; }
  .bell-panel { position: fixed; left: 12px; right: 12px; top: calc(var(--tb-h) + 4px); width: auto; }
  .page-head h1 { font-size: 20px; }
  .stepper { display: flex; }
  .step { flex: 1 1 0; padding-right: 8px; gap: 8px; }
  .step.active { flex: 3 1 0; }
  .step:last-child { flex-grow: 0; flex-basis: auto; padding-right: 0; }
  .step.active:last-child { flex-grow: 1; }
  .step:not(.active) .step-label { display: none; }
  .step:not(:last-child)::after { min-width: 10px; }
  .addr-block { flex-direction: column; align-items: stretch; text-align: left; }
  .addr-art-wrap { align-self: center; }
  .auth-card h2 { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* login side panel: demo list of ad accounts (no amounts on client-facing pages) */
.auth-mock .acc-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.auth-mock .lbl + .acc-row { border-top: 0; margin-top: 6px; }
.auth-mock .acc-ico { width: 24px; height: 24px; border-radius: 6px; background: var(--blue); color: var(--white); display: grid; place-items: center; font: 600 13px var(--body); flex: none; }
.auth-mock .acc-name { flex: 1; min-width: 0; color: var(--white); }
.auth-mock .acc-pill { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.auth-mock .acc-pill.live { background: rgba(20,128,74,.22); color: var(--dk-green); }
.auth-mock .acc-pill.ready { background: rgba(2,55,215,.3); color: var(--dk-blue); }

/* QR inside the payment step: never shrink, centred next to the address */
.addr-block .qr-wrap { flex: none; align-self: center; line-height: 0; }

/* ======================================================================================================
   Auth pages v2 (2026-10-19) — dark, centred, single column. Built only from the Magni identity:
   the symbol as a giant thin outline (brand post 1), a Klein Blue light rising from the bottom (post 3),
   the blue dot pattern, Glancyr + Montserrat. Inspired by the layout of modern auth pages, not a copy.
   ====================================================================================================== */
body.auth-dark { background: #0B1016; color: #E8ECF1; }
.ax { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; overflow: hidden; isolation: isolate; }
.ax-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.ax-dots { position: absolute; inset: 0; background: url('/img/pattern.png') center top / 1100px auto repeat; opacity: .16;
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 100%, #000 0%, transparent 75%); mask-image: radial-gradient(ellipse 70% 55% at 50% 100%, #000 0%, transparent 75%); }
.ax-outline { position: absolute; left: -6vw; top: -10vh; height: 126vh; width: auto; opacity: .17;
  -webkit-mask-image: linear-gradient(90deg, #000 38%, transparent 78%); mask-image: linear-gradient(90deg, #000 38%, transparent 78%); }
.ax-glow { position: absolute; right: -4vw; bottom: -24vh; height: 78vh; width: auto; opacity: .46; transform: rotate(-4deg);
  -webkit-mask-image: linear-gradient(180deg, #000 35%, transparent 92%); mask-image: linear-gradient(180deg, #000 35%, transparent 92%); }
.ax-light { position: absolute; left: 50%; bottom: -38vh; width: 130vw; height: 72vh; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(2,55,215,.42), rgba(2,55,215,.12) 55%, rgba(2,55,215,0)); }
.ax-grain { position: absolute; inset: 0; background: url('/img/auth-grain.png'); opacity: .55; mix-blend-mode: overlay; }
.ax-top { display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding: 26px 34px; }
.ax-brand { display: inline-flex; }
.ax-brand img { height: 22px; width: auto; display: block; }
.ax-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px 16px 40px; }
.ax-card { width: 100%; max-width: 440px; text-align: center; }
.ax-card.wide { max-width: 480px; }
/* Terms and privacy: long text on the same dark background */
.ax-main-doc { align-items: flex-start; padding-top: 24px; }
.ax-doc { width: 100%; max-width: 760px; text-align: left; color: #D4DAE2; font-size: 15px; line-height: 1.65; }
.ax-doc .ax-mark { margin: 0 0 20px; }
.ax-doc h1 { font-size: 30px; margin: 0 0 6px; color: #fff; }
.ax-doc h2 { font-size: 18px; margin: 28px 0 8px; color: #fff; }
.ax-doc p, .ax-doc ul { margin: 0 0 12px; }
.ax-doc ul { padding-left: 20px; }
.ax-doc li { margin-bottom: 6px; }
.ax-doc b { color: #fff; }
.ax-doc a { color: #A9BEFF; }
.ax-doc-date { color: #A3ADBA; font-size: 13px; margin-bottom: 24px !important; }
.ax-doc-back { margin-top: 36px !important; font-size: 14px; }
.ax-terms { display: flex; gap: 10px; align-items: flex-start; text-align: left; font-size: 13.5px; color: #C3CBD6; margin: 4px 0 18px; line-height: 1.5; }
.ax-terms input { margin-top: 2px; flex: none; }
.ax-terms a { color: #fff; font-weight: 600; }
.ax-terms a:hover { color: #A9BEFF; }
.ax-mark { position: relative; width: 104px; height: 104px; margin: 0 auto 26px; border-radius: 26px; display: grid; place-items: center;
  background: linear-gradient(180deg, #1D2631, #121820); border: 1px solid rgba(255,255,255,.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 18px 48px rgba(0,0,0,.5), 0 0 60px rgba(2,55,215,.28); }
.ax-mark::before { content: ''; position: absolute; inset: -40px; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(2,55,215,.30), transparent); }
.ax-mark img { height: 54px; width: auto; }
.ax-mark.sm { width: 72px; height: 72px; border-radius: 19px; }
.ax-mark.sm img { height: 36px; }
.ax h1 { font-family: var(--head); font-weight: 600; font-size: 30px; line-height: 1.15; letter-spacing: -.01em; color: #fff; margin: 0 0 10px; }
.ax-sub { color: #C3CBD6; font-size: 15px; margin: 0 0 28px; }
.ax-sub a { color: #fff; font-weight: 600; }
.ax-sub a:hover { color: #A9BEFF; }
.ax form { text-align: left; }
.ax .field { margin-bottom: 16px; }
.ax label { color: #E2E7EE; font-weight: 600; font-size: 13.5px; margin-bottom: 7px; }
.ax input:not([type=checkbox]):not([type=radio]) { height: 48px; border-radius: 12px; padding: 0 14px; font-size: 15px;
  background: #141B23; color: #fff; border: 1px solid rgba(255,255,255,.10); box-shadow: inset 0 1px 0 rgba(255,255,255,.035); }
.ax input::placeholder { color: #7D8896; opacity: 1; }
.ax input:hover { border-color: rgba(255,255,255,.18); }
.ax input:focus { border-color: #4B74FF; box-shadow: 0 0 0 3px rgba(2,55,215,.38); outline: none; }
.ax input:-webkit-autofill { -webkit-text-fill-color: #fff; -webkit-box-shadow: 0 0 0 40px #141B23 inset; caret-color: #fff; }
.ax .ax-pw { position: relative; }
.ax .ax-pw input { padding-right: 48px; }
.ax .ax-pw .reveal { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); color: #B4BDC9; background: transparent; border: 0; }
.ax .ax-pw .reveal:hover { color: #fff; background: rgba(255,255,255,.06); }
.ax-forgot { display: inline-block; margin-top: 8px; font-size: 13px; color: #C3CBD6; }
.ax-forgot:hover { color: #A9BEFF; }
.ax-note a { color: #C3CBD6; }
.ax-note a:hover { color: #A9BEFF; }
.ax .grid2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 0 12px; }
.ax .hint { color: #A3ADBA; font-size: 12.5px; margin-top: 6px; }
.ax .btn { height: 48px; border-radius: 12px; font-weight: 600; font-size: 14.5px; }
.ax .btn.ax-btn { margin-top: 6px; background: #0237D7; color: #fff; border-color: transparent;
  box-shadow: 0 10px 28px rgba(2,55,215,.38), inset 0 1px 0 rgba(255,255,255,.18); }
.ax .btn.ax-btn:hover { background: #1747EA; }
.ax .btn.ax-btn:disabled { opacity: .6; }
.ax .btn.secondary { background: rgba(255,255,255,.04); color: #E8ECF1; border: 1px solid rgba(255,255,255,.13); box-shadow: none; }
.ax .btn.secondary:hover { background: rgba(255,255,255,.08); }
.ax .form-error { background: rgba(214,48,56,.12); color: #FF9CA1; border: 1px solid rgba(255,120,126,.28); text-align: left; }
.ax .form-ok { background: rgba(20,128,74,.14); color: #8BE2B2; border: 1px solid rgba(120,220,160,.26); text-align: left; }
.ax .form-ok a { color: #fff; text-decoration: underline; }
.ax-or { display: flex; align-items: center; gap: 12px; color: #6B7684; font-size: 12.5px; margin: 22px 0; }
.ax-or::before, .ax-or::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.09); }
.ax-note { margin: 26px 0 0; color: #A3ADBA; font-size: 13px; }
.ax-foot { text-align: center; padding: 0 16px 22px; color: #8D98A6; font-size: 12.5px; }
.ax .lang-switch { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09); }
.ax .lang-switch button { color: #D2D9E2; }
.ax .lang-switch button.on { background: rgba(255,255,255,.12); color: #fff; box-shadow: none; }
.ax .auth-state { margin: 0 auto 22px; width: 58px; height: 58px; border-radius: 15px; background: rgba(2,55,215,.18); color: #A9BEFF; }
.ax .auth-state.ok { background: rgba(20,128,74,.18); color: #8BE2B2; }
.ax .auth-state.bad { background: rgba(214,48,56,.16); color: #FF9CA1; }
.ax .auth-state.wait::after { border-color: rgba(169,190,255,.25); border-top-color: #A9BEFF; }
.ax :focus-visible { outline: 2px solid #A9BEFF; outline-offset: 2px; }
@media (max-width: 1100px) {
  .ax-outline { left: -30vw; opacity: .10; }
  .ax-glow { right: -24vw; height: 56vh; opacity: .34; }
}
@media (max-width: 640px) {
  .ax-top { padding: 18px 16px; }
  .ax h1 { font-size: 25px; }
  .ax-mark { width: 88px; height: 88px; border-radius: 22px; }
  .ax-mark img { height: 46px; }
  .ax-outline { left: -42vw; top: -6vh; height: 78vh; opacity: .10; }
  .ax-glow { right: -46vw; bottom: -18vh; height: 44vh; opacity: .32; }
  .ax .grid2 { grid-template-columns: minmax(0,1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  .ax-card { animation: ax-in .5s ease-out both; }
  @keyframes ax-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

/* ======================================================================================================
   Splash / loading screen (2026-10-19) — shown the instant /app or /admin opens; the Magni symbol fills
   with Klein Blue from the bottom while a light sweeps across it. Stays ~2 s right after a log-in
   (time for the first data), otherwise only until the page is ready. M.splashDone() removes it.
   ====================================================================================================== */
.splash { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; background: #0B1016; color: #E8ECF1;
  overflow: hidden; isolation: isolate; transition: opacity .55s ease, transform .55s ease, visibility 0s linear .55s; }
.splash.out { opacity: 0; transform: scale(1.015); visibility: hidden; }
.splash-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.splash-bg .ax-light { position: absolute; left: 50%; bottom: -42vh; width: 130vw; height: 76vh; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(2,55,215,.40), rgba(2,55,215,.10) 55%, rgba(2,55,215,0)); }
.splash-bg .ax-grain { position: absolute; inset: 0; background: url('/img/auth-grain.png'); opacity: .5; mix-blend-mode: overlay; }
.splash-core { display: flex; flex-direction: column; align-items: center; gap: 28px; padding: 24px; text-align: center; }
.splash-mark { position: relative; width: 98px; height: 120px; }
.splash-mark::before { content: ''; position: absolute; inset: -70px; border-radius: 50%; z-index: -1;
  background: radial-gradient(closest-side, rgba(2,55,215,.42), transparent); animation: splash-pulse 2.4s ease-in-out infinite; }
.splash-ghost { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .14; }
.splash-fill { position: absolute; inset: 0;
  -webkit-mask: url('/img/symbol-hd.png') center / contain no-repeat; mask: url('/img/symbol-hd.png') center / contain no-repeat; }
.splash-fill::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 0;
  background: linear-gradient(0deg, #0237D7 0%, #2E5BF0 55%, #7FA0FF 100%); animation: splash-rise 1.6s cubic-bezier(.6,.05,.25,1) .15s forwards; }
.splash-fill::after { content: ''; position: absolute; top: -20%; bottom: -20%; width: 45%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent); transform: skewX(-18deg);
  animation: splash-sweep 2.2s ease-in-out 1.2s infinite; }
.splash-bar { position: relative; width: 168px; height: 2px; border-radius: 2px; background: rgba(255,255,255,.10); overflow: hidden; }
.splash-bar span { position: absolute; top: 0; bottom: 0; width: 40%; left: -40%; border-radius: 2px;
  background: linear-gradient(90deg, transparent, #4B74FF, #A9BEFF); animation: splash-bar 1.3s ease-in-out infinite; }
.splash-text { margin: 0; font-family: var(--head); font-weight: 600; font-size: 15px; letter-spacing: .02em; color: #E2E7EE; }
.splash-sub { margin: -18px 0 0; font-size: 12.5px; color: #8D98A6; letter-spacing: .14em; text-transform: uppercase; }
@keyframes splash-rise { to { height: 100%; } }
@keyframes splash-sweep { 0% { left: -60%; } 55%, 100% { left: 130%; } }
@keyframes splash-bar { to { left: 100%; } }
@keyframes splash-pulse { 0%, 100% { opacity: .65; transform: scale(.94); } 50% { opacity: 1; transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) {
  .splash-fill::before { animation: none; height: 100%; }
  .splash-fill::after, .splash-bar span, .splash-mark::before { animation: none; }
}


/* ======================================================================================================
   Dark theme for the inside of both doors (owner's request, 2026-10-19: "o mesmo visual escuro também por
   dentro"). Same tokens, dark values: surfaces step up from the brand Black, Klein Blue stays the
   button/fill colour, and blue used as text switches to a lighter tint (--blue-text) so it stays legible.
   Contrast checked against --surface: --ink ≈ 15:1, --muted ≥ 6:1, --blue-text ≥ 7:1.
   ====================================================================================================== */
body.door-client, body.door-admin {
  color-scheme: dark;
  --blue-text: #8FA9FF;
  --blue-dark: #1747EA;
  --blue-700: #A9BEFF;
  --blue-soft: #142249;
  --blue-100: #1B2E5C;
  --blue-200: #2A4180;
  --blue-softer: #111C33;
  --alabaster: #1A222C;
  --sand-soft: #2A2620;
  --sand-700: #DCC9A6;
  --ink: #EEF2F6;
  --ink-2: #C6CDD6;
  --muted: #9AA4B2;
  --faint: #5F6B7A;
  --control: #6B7787;
  --bg: #0B1016;
  --surface: #121A23;
  --surface-2: #0F161E;
  --line: #1F2934;
  --line-2: #273340;
  --line-3: #344252;
  --hover: #18212C;
  --black-2: #1C2733;
  --green: #4BD39E;
  --green-soft: #10291F;
  --green-dot: #2BC48A;
  --green-dark: #86E6C0;
  --green-line: #1D4536;
  --amber: #F5AE4D;
  --amber-soft: #2E2210;
  --amber-dot: #F29A1F;
  --amber-text: #F7C67F;
  --amber-line: #4A3618;
  --amber-tint: #1C1810;
  --red: #FF7A80;
  --red-soft: #331618;
  --red-dot: #E5484D;
  --red-dark: #FFA3A8;
  --red-line: #5A2428;
  --red-tint: #211315;
  --grey: #A7B0BC;
  --grey-soft: #1A222C;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.25);
  --shadow-md: 0 6px 16px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.3);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.55), 0 6px 16px rgba(0,0,0,.35);
  --ring: 0 0 0 3px rgba(75,116,255,.38);
  --topbar-bg: rgba(11,16,22,.82);
  background: var(--bg);
}
/* the console sidebar keeps the brand Black, a step above the page */
body.door-admin .sb { background: #101820; border-right-color: var(--line); }
body.door-client .sb { background: #0E151C; border-right-color: var(--line); }
body.door-client .sb-nav a.active, body.door-admin .sb-nav a.active { background: rgba(2,55,215,.24); color: #fff; }
body.door-client .sb-nav a.active .ni { color: var(--blue-text); }
/* the soft blue light of the entry screens, very faint, at the foot of every page */
body.door-client .frame, body.door-admin .frame { background:
  radial-gradient(120% 60% at 50% 120%, rgba(2,55,215,.10), transparent 60%) fixed, var(--bg); }
/* toasts were black on a light page: give them an edge on the dark one */
body.door-client .toast, body.door-admin .toast { border: 1px solid var(--line-2); }
/* the QR code and the decorative address block must stay dark-on-white to scan */
body.door-client .qr-wrap { background: #fff; border-color: transparent; }
/* solid status fills carry white text: keep the deep tones there (white ≥ 4.5:1), the light tints are for text */
body.door-client .btn.danger.solid, body.door-admin .btn.danger.solid { background: #C42730; border-color: #C42730; }
body.door-client .btn.success, body.door-admin .btn.success { background: #11795A; }
body.door-client .toast.error, body.door-admin .toast.error { background: #C42730; }
body.door-client .sb-nav .count, body.door-admin .sb-nav .count,
body.door-client .bell-count, body.door-admin .bell-count { background: #C42730; }
body.door-client .bell-count, body.door-admin .bell-count { border-color: var(--bg); }

/* Item 9: low / used-up balance bar under the top bar, on every client page */
.funds-banner { display: flex; align-items: center; gap: 12px; padding: 10px 24px; border-bottom: 1px solid; font-size: 14px; }
.funds-banner.warn { background: var(--amber-soft); color: var(--amber-text); border-color: var(--amber-line); }
.funds-banner.danger { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.funds-banner .fb-ico { flex: none; display: flex; }
.funds-banner.danger .fb-ico { animation: fb-pulse 1.6s ease-in-out infinite; }
.funds-banner .fb-text { flex: 1; min-width: 0; }
.funds-banner .fb-text strong { margin-right: 4px; }
.funds-banner .btn { flex: none; }
.funds-banner .fb-close { flex: none; color: inherit; }
@keyframes fb-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .funds-banner.danger .fb-ico { animation: none; } }
@media (max-width: 640px) { .funds-banner { flex-wrap: wrap; padding: 10px 16px; } .funds-banner .fb-text { flex-basis: calc(100% - 40px); } }
.tb-chip.chip-danger { border-color: var(--red-line); color: var(--red); }
.tb-chip.chip-danger .tb-chip-value { color: var(--red); }
.tb-chip.chip-warn { border-color: var(--amber-line); }
.tb-chip.chip-warn .tb-chip-value { color: var(--amber-text); }
