/* ==========================================================================
   GhepAOV — MODERN ESPORTS STUDIO DESIGN SYSTEM
   Mobile-First 60FPS · Zero list blur · Transform/Opacity motion only
   ========================================================================== */
:root {
  color-scheme: dark;

  /* Surfaces (Deep Obsidian) */
  --bg: #090B10;
  --bg-elevated: #0E121B;
  --surface: #111520;
  --surface-raised: #171D2C;
  --surface-inset: #0B0E15;

  /* Hairline Borders */
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-accent: rgba(245, 158, 11, 0.45);
  --border-cyan: rgba(6, 182, 212, 0.45);

  /* Typography */
  --text: #F1F5F9;
  --muted: #94A3B8;
  --subtle: #64748B;

  /* Esports Accents */
  --accent: #F59E0B;
  --accent-hover: #FBBF24;
  --accent-ink: #090B10;
  --accent-soft: rgba(245, 158, 11, 0.12);

  --cyan: #06B6D4;
  --cyan-hover: #22D3EE;
  --cyan-soft: rgba(6, 182, 212, 0.12);

  /* Semantic */
  --jade: #10B981;
  --jade-soft: rgba(16, 185, 129, 0.12);
  --danger: #EF4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --warning: #F59E0B;

  /* Fonts */
  --font-body: 'Be Vietnam Pro', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Be Vietnam Pro', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
  --font-jp: var(--font-display);

  /* Radii & Motion */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --motion: 180ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);

  /* Legacy Variable Aliases (preserved for inline styles & secondary templates) */
  --ink-950: #06080C;
  --ink-900: var(--bg);
  --ink-800: var(--surface);
  --ink-700: var(--surface-raised);
  --ink-600: #1E2638;
  --ink-500: #2A354D;
  --ink-400: #475569;
  --paper: var(--text);
  --paper-dim: var(--muted);
  --paper-mute: var(--subtle);
  --sakura-100: #CFFAFE;
  --sakura-300: #67E8F9;
  --sakura-400: var(--cyan);
  --sakura-500: var(--cyan);
  --sakura-600: #0891B2;
  --sakura-glow: transparent;
  --jade-400: #34D399;
  --jade-500: var(--jade);
  --gold-300: #FCD34D;
  --gold-400: var(--accent);
  --gold-500: #D97706;
  --danger-400: #F87171;
  --indigo-400: #818CF8;
  --shadow-soft: var(--shadow);
  --shadow-deep: var(--shadow);
  --shadow-glow: none;
}

/* ==========================================================================
   BASE & RESET
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-padding-top: 76px;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.6 var(--font-body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
  color: var(--text);
}
h1 { font-size: clamp(22px, 3vw, 28px); font-weight: 800; }
h2 { font-size: clamp(18px, 2.2vw, 22px); }
h3 { font-size: 15px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a, input, select, textarea { touch-action: manipulation; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
svg { vertical-align: middle; flex-shrink: 0; }
img { max-width: 100%; display: block; }
::selection { background: rgba(245, 158, 11, 0.3); color: #fff; }
.mono, .mono-num, .n, .u-bal, .id-code, .vault-value, .code-chip, .value-display {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

a, button, input, select, textarea {
  transition: background-color var(--motion) ease, border-color var(--motion) ease, color var(--motion) ease, opacity var(--motion) ease, transform var(--motion) var(--ease-out);
}
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
[hidden], .hidden { display: none !important; }
.ui-icon { display: inline-block; }

.skip-link {
  position: fixed; top: -80px; left: 16px; z-index: 10000;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 14px; border-radius: var(--radius-sm); font-weight: 700;
}
.skip-link:focus { top: 12px; }

/* ==========================================================================
   APP SHELL: HEADER + SIDEBAR + FOOTER
   ========================================================================== */
.app-header {
  height: 60px;
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 16px;
}
.header-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.app-brand { display: flex; gap: 10px; align-items: center; min-width: 0; max-width: 100%; }
.brand-symbol {
  display: grid; place-items: center;
  width: 34px; height: 34px; flex-shrink: 0;
  border: 1px solid var(--border-accent);
  background: var(--accent-soft);
  border-radius: 9px;
  color: var(--accent);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.brand-text strong { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font: 600 9px/1 var(--font-mono); letter-spacing: 0.14em; color: var(--cyan); margin-top: 3px; white-space: nowrap; }

.header-account { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.balance-link {
  display: inline-flex; gap: 8px; align-items: center;
  padding: 5px 10px 5px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
}
.balance-link:hover { border-color: var(--border-accent); background: var(--surface-raised); }
.balance-meta { display: flex; align-items: baseline; gap: 6px; }
.balance-meta small { color: var(--subtle); font-size: 10px; font-weight: 600; }
.balance-meta strong { color: var(--text); font-family: var(--font-mono); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.balance-plus {
  display: grid; place-items: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700; font-size: 14px; line-height: 1;
}

.account-menu { position: relative; }
.account-menu summary {
  display: flex; gap: 8px; align-items: center;
  padding: 4px 10px 4px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer; list-style: none; font-size: 12px; font-weight: 600;
}
.account-menu summary:hover { border-color: var(--border-strong); }
.account-menu summary::-webkit-details-marker { display: none; }
.user-avatar {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--cyan-soft);
  border: 1px solid var(--border-cyan);
  color: var(--cyan); font-weight: 700; font-size: 12px;
}
.user-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chevron { color: var(--subtle); display: inline-flex; }
.account-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 210px;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 6px;
  box-shadow: var(--shadow);
  z-index: 150;
}
.dropdown-user-meta {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.dropdown-user-meta small { display: block; font-size: 10px; color: var(--subtle); }
.dropdown-user-meta strong { display: block; font-size: 13px; color: var(--text); }
.account-dropdown a, .account-dropdown button {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; width: 100%; border: 0;
  color: var(--muted); background: none; text-align: left;
  font-size: 12px; font-weight: 500; border-radius: var(--radius-sm);
}
.account-dropdown a:hover, .account-dropdown button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}
.account-dropdown .dropdown-logout { color: var(--danger-400); }

.app-frame { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100dvh - 60px); }
.app-navigation {
  position: sticky; top: 60px; height: calc(100dvh - 60px);
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 16px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--bg-elevated);
}
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  display: block; font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; color: var(--subtle);
  padding: 6px 10px 6px;
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; font-size: 13px; font-weight: 500;
  color: var(--muted);
  padding: 8px 12px; border-radius: var(--radius-md);
}
.nav-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-tag {
  margin-left: auto; font-size: 9px; font-weight: 600;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.05); color: var(--subtle);
  white-space: nowrap;
}
.nav-help {
  margin-top: auto; padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.nav-help > a {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--muted); padding: 8px 10px; border-radius: var(--radius-sm);
}
.nav-help > a:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }

.app-main { min-width: 0; display: flex; flex-direction: column; }
#main-content { flex: 1; }
#main-content:focus { outline: none; }
.app-footer {
  border-top: 1px solid var(--border);
  margin: 32px 28px 0;
  display: flex; gap: 20px; align-items: center;
  padding: 18px 0 24px;
  font-size: 11px; color: var(--subtle);
}
.footer-links { display: flex; gap: 16px; }
.footer-links a:hover { color: var(--text); }
.footer-copy { margin-left: auto; font-family: var(--font-mono); }

.mobile-menu { display: none; }
.icon-button {
  display: inline-grid; place-items: center;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--muted);
  border-radius: var(--radius-sm); width: 36px; height: 36px;
}
.icon-button:hover { color: var(--text); background: var(--surface-raised); border-color: var(--border-strong); }
@media (min-width: 951px) { .icon-button.mobile-menu { display: none; } }

/* ==========================================================================
   PRIMITIVES: BUTTONS, INPUTS, BADGES, ALERTS, TABLES
   ========================================================================== */
.btn, .btn-primary, .btn-secondary, .btn-ghost, .btn-sakura, .auth-btn, .cp-btn,
.submit, .btn-generate, .btn-start, .btn-merge, .btn-download, .btn-retry,
.btn-dl, .btn-tg, .copy-btn, .btn-add, .btn-sub, .btn-grant, .btn-revoke,
.zalo-confirm, .zalo-btn-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
  font-size: 13px; font-weight: 600; line-height: 1.3;
  text-decoration: none; white-space: nowrap;
}
.btn:hover, .btn-retry:hover, .btn-secondary:hover, .btn-ghost:hover {
  background: #1F273B; border-color: rgba(255, 255, 255, 0.25);
}
.btn:active, .btn-primary:active, .btn-merge:active, .btn-download:active {
  transform: scale(0.985);
}
.btn-primary, .btn-sakura, .auth-btn, .cp-btn, .submit, .btn-generate,
.btn-start, .btn-merge, .btn-download, .zalo-confirm {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.btn-primary:hover, .btn-sakura:hover, .auth-btn:hover, .cp-btn:hover, .submit:hover,
.btn-generate:hover, .btn-start:hover, .btn-merge:hover, .btn-download:hover, .zalo-confirm:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 12px; }
.btn-lg { min-height: 46px; padding: 12px 20px; font-size: 14px; }
.btn-add, .btn-grant {
  background: var(--jade-soft); border-color: rgba(16, 185, 129, 0.4); color: var(--jade-400);
}
.btn-add:hover, .btn-grant:hover { background: rgba(16, 185, 129, 0.2); }
.btn-danger, .btn-sub, .btn-revoke {
  color: var(--danger-400); background: var(--danger-soft); border-color: rgba(239, 68, 68, 0.35);
}
.btn-danger:hover, .btn-sub:hover, .btn-revoke:hover { background: rgba(239, 68, 68, 0.2); }
.btn-tg, .btn-dl { color: var(--cyan); border-color: var(--border-cyan); background: var(--cyan-soft); }
.btn-tg:hover, .btn-dl:hover { background: rgba(6, 182, 212, 0.2); }
.zalo-btn-link {
  background: #0068FF; border-color: #0068FF; color: #fff; font-weight: 700;
}
.zalo-btn-link:hover { background: #1A78FF; }

.field, .m-field { margin-bottom: 16px; }
.field label, .m-field > label, .evo-item label, .ca-label {
  display: block; font-size: 12px; font-weight: 600;
  color: #CBD5E1; margin-bottom: 7px;
}
.input,
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=hidden]):not([type=submit]),
select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--surface-inset);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.input:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-soft);
}
input::placeholder, textarea::placeholder { color: var(--subtle); }
input[type=checkbox], input[type=radio], input[type=range] { accent-color: var(--accent); }
input[type=range] { width: 100%; min-width: 0; cursor: pointer; }
textarea { resize: vertical; min-height: 120px; }
input:disabled, select:disabled { opacity: 0.6; cursor: not-allowed; }
.ms-locked { border-color: var(--border-accent) !important; color: var(--accent) !important; font-family: var(--font-mono); font-weight: 700; }

.hint, .ca-hint, .as-sub, .na-sub, .pu-sub {
  font-size: 11px; line-height: 1.55; color: var(--subtle); margin-top: 6px;
}
.error {
  padding: 12px 14px; border-radius: var(--radius-md);
  background: var(--danger-soft); border: 1px solid rgba(239, 68, 68, 0.35);
  color: #FCA5A5; font-size: 12px; font-weight: 500;
}
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 15px; border: 1px solid var(--border);
  border-radius: var(--radius-md); background: var(--surface);
  margin: 14px 0; font-size: 13px;
}
.alert-error { color: #FCA5A5; border-color: rgba(239, 68, 68, 0.35); background: var(--danger-soft); }
.alert-success { color: #6EE7B7; border-color: rgba(16, 185, 129, 0.35); background: var(--jade-soft); }
.alert-info { color: #67E8F9; border-color: var(--border-cyan); background: var(--cyan-soft); }

.badge, .badge-admin, .badge-warn, .soon-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--muted); background: rgba(255, 255, 255, 0.04);
}
.badge.ok, .badge.live { color: var(--jade-400); border-color: rgba(16, 185, 129, 0.35); background: var(--jade-soft); }
.badge.die { color: var(--danger-400); border-color: rgba(239, 68, 68, 0.35); background: var(--danger-soft); }
.badge.err, .badge.wait, .badge-warn { color: var(--accent); border-color: var(--border-accent); background: var(--accent-soft); }
.badge-admin { color: var(--cyan); border-color: var(--border-cyan); background: var(--cyan-soft); }

.empty {
  padding: 36px 20px; text-align: center; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface-inset);
}
.empty .ico, .empty .ic { font-size: 28px; margin-bottom: 8px; }
.empty a { display: inline-flex; margin-top: 14px; color: var(--accent); font-weight: 600; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 10px/1 var(--font-mono);
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent);
}
.eyebrow-cyan { color: var(--cyan); }

.page-heading, .section-heading {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 24px;
}
.heading-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-heading h1 { margin: 8px 0; }
.page-heading p, .section-heading p { color: var(--muted); font-size: 13px; max-width: 520px; }
.section-heading h2 { margin: 6px 0 0; }
.section-heading p { text-align: right; max-width: 320px; }
.row-2col, .row-2, .row-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--cyan); font-size: 12px; font-weight: 600; margin-top: 16px; }
.back-link:hover { color: var(--cyan-hover); }

.table-wrap, .history-table { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 12px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--subtle); background: var(--surface-inset); }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
button svg { pointer-events: none; }

/* ==========================================================================
   HOME / OVERVIEW PAGE
   ========================================================================== */
.overview-page { padding: 28px; max-width: 1440px; margin: 0 auto; }
.studio-launch {
  display: grid; grid-template-columns: 1.15fr 0.95fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.launch-copy { padding: 32px; display: flex; flex-direction: column; justify-content: center; }
.launch-copy h2 { font-size: clamp(22px, 2.5vw, 34px); line-height: 1.2; margin: 12px 0; }
.launch-copy > p { font-size: 13px; color: var(--muted); max-width: 460px; margin-bottom: 22px; }
.launch-cta-row { display: flex; gap: 10px; flex-wrap: wrap; }
.launch-steps {
  list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  padding: 20px 0 0; margin: 24px 0 0; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--muted);
}
.launch-steps b { display: block; font: 700 12px var(--font-mono); color: var(--cyan); margin-bottom: 3px; }

.launch-visual {
  display: grid; place-items: center; padding: 28px;
  background: var(--surface-inset);
  border-left: 1px solid var(--border);
  background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}
.layout-sheet {
  max-width: 360px; width: 100%;
  background: var(--surface);
  padding: 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
}
.sheet-caption {
  display: flex; justify-content: space-between; align-items: center;
  font: 700 9px var(--font-mono); letter-spacing: 0.1em; color: var(--muted); margin-bottom: 12px;
}
.sheet-pill {
  padding: 2px 6px; border-radius: 4px;
  background: var(--jade-soft); color: var(--jade-400); border: 1px solid rgba(16, 185, 129, 0.3);
}
.sheet-profile {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface-raised);
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-md);
}
.sheet-profile > span {
  display: grid; place-items: center; width: 44px; height: 44px;
  background: var(--cyan-soft); border: 1px solid var(--border-cyan);
  border-radius: var(--radius-sm); color: var(--cyan);
}
.sheet-profile b { font-size: 12px; display: block; }
.sheet-profile small { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.sheet-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.sheet-cards > div {
  height: 54px; background: var(--surface-inset);
  border: 1px solid var(--border); border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--subtle);
}
.sheet-cards > div.is-featured { border-color: var(--border-accent); color: var(--accent); background: var(--accent-soft); }
.sheet-cards small { font: 700 9px var(--font-mono); color: var(--text); }
.sheet-top { display: flex; align-items: center; gap: 5px; margin-top: 8px; }
.sheet-top > span { font: 700 9px var(--font-mono); color: var(--cyan); margin-right: auto; }
.sheet-top i { height: 18px; flex: 1; max-width: 42px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: 4px; }
.sheet-disclaimer { display: block; margin-top: 10px; font-size: 10px; color: var(--subtle); }

.overview-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 20px 0 32px; }
.overview-stats > a, .overview-stats > div {
  padding: 18px 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); min-width: 0;
}
.overview-stats > a:hover { border-color: var(--border-strong); background: var(--surface-raised); }
.overview-stats .stat-accent:hover { border-color: var(--border-accent); }
.overview-stats .stat-cyan:hover { border-color: var(--border-cyan); }
.overview-stats span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 500; }
.overview-stats strong { display: block; font-size: 26px; font-weight: 700; margin: 10px 0 6px; color: var(--text); }
.overview-stats strong small { font-size: 14px; margin-left: 3px; color: var(--muted); }
.overview-stats em { font-size: 11px; font-style: normal; color: var(--subtle); }
.overview-stats .stat-accent em { color: var(--accent); }
.overview-stats .stat-cyan em { color: var(--cyan); }

.service-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.service-card {
  position: relative; padding: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  display: flex; flex-direction: column; align-items: flex-start;
}
.service-card:hover { border-color: var(--border-strong); background: var(--surface-raised); }
.service-icon {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--radius-md); background: var(--cyan-soft);
  border: 1px solid var(--border-cyan); color: var(--cyan);
}
.service-card h3 { margin: 14px 0 8px; }
.service-card p { font-size: 12px; color: var(--muted); margin-bottom: 18px; }
.service-card > span:last-child {
  display: flex; gap: 6px; align-items: center;
  font-size: 12px; font-weight: 600; color: var(--accent); margin-top: auto;
}
.service-planned { background: var(--surface-inset); }

.payment-note {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px; margin-top: 22px;
  background: var(--surface); border: 1px solid var(--border-cyan); border-radius: var(--radius-lg);
}
.payment-note > svg { color: var(--cyan); flex-shrink: 0; }
.payment-note strong { font-size: 13px; display: block; }
.payment-note p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.payment-note > a { font-size: 12px; font-weight: 600; color: var(--cyan); margin-left: auto; white-space: nowrap; }

/* ==========================================================================
   MERGE STUDIO WORKSPACE
   ========================================================================== */
.merge-page { padding: 24px 28px 40px; max-width: 1520px; margin: 0 auto; }
.merge-hero {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.merge-hero h1 { margin-top: 6px; }
.merge-hero p { margin-top: 6px; color: var(--muted); font-size: 13px; }
.workflow-nav { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.workflow-nav li {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--subtle);
  font: 600 11px var(--font-mono);
}
.workflow-nav li:first-child {
  color: var(--accent); border-color: var(--border-accent); background: var(--accent-soft);
}

/* Studio Preview / Readiness Strip */
.studio-preview-dock {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.studio-dock-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px;
}
.studio-dock-head strong { font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 7px; color: var(--text); }
.studio-dock-head strong svg { color: var(--cyan); }
.dock-mode-badge {
  font: 700 10px var(--font-mono); padding: 3px 8px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border-accent);
}
.studio-readiness-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
}
.readiness-pill {
  padding: 9px 10px; border-radius: var(--radius-sm);
  background: var(--surface-inset); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.readiness-pill small { font-size: 10px; color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readiness-pill span { font: 600 11px var(--font-mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readiness-pill.is-ready { border-color: rgba(16, 185, 129, 0.35); background: var(--jade-soft); }
.readiness-pill.is-ready span { color: var(--jade-400); }

.merge-grid {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(380px, 1.08fr);
  gap: 20px; align-items: start;
}
.left-col, .right-col { min-width: 0; }
.section-line {
  font: 700 10px var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--subtle); margin: 4px 0 10px;
}

.m-card {
  padding: 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.m-title {
  display: flex; gap: 10px; align-items: center;
  font-weight: 700; font-size: 14px; margin-bottom: 16px; color: var(--text);
}
.m-title .num {
  display: grid; place-items: center; width: 24px; height: 24px;
  background: var(--cyan-soft); color: var(--cyan);
  border: 1px solid var(--border-cyan); border-radius: 6px;
  font: 700 11px var(--font-mono);
}

.radio-group, .border-options { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-label, .border-option {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); padding: 9px 12px;
  font-size: 12px; font-weight: 500; border-radius: var(--radius-md);
  cursor: pointer; background: var(--surface-inset); min-height: 40px;
}
.radio-label:hover, .border-option:hover { border-color: var(--border-strong); }
.radio-label:has(input:checked), .border-option:has(input:checked) {
  border-color: var(--border-accent); background: var(--accent-soft); color: var(--text);
}
.radio-label.disabled { opacity: 0.45; cursor: not-allowed; }
.color-preview {
  width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  border: 1px solid rgba(255, 255, 255, 0.35); flex-shrink: 0;
}

.cost-badge {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding: 10px 12px;
  background: var(--surface-inset); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--muted); font-size: 12px;
}
.cost-badge strong { color: var(--accent); font-family: var(--font-mono); font-size: 13px; }

.search-box { margin-bottom: 10px; }
.chip-grid {
  display: flex; gap: 7px; flex-wrap: wrap;
  max-height: 220px; overflow-y: auto;
  padding-right: 4px;
}
.chip, .skin-chip, .phukien-chip {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 11px; background: var(--surface-inset);
  color: var(--muted); font-size: 12px; font-weight: 500; cursor: pointer;
}
.chip:hover, .skin-chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.selected, .chip.active, .skin-chip.active {
  background: var(--cyan-soft); border-color: var(--cyan); color: var(--cyan); font-weight: 600;
}
.selected-count {
  display: inline-block; margin-top: 10px;
  color: var(--cyan); font: 600 11px var(--font-mono);
}

.label-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; margin-bottom: 7px; gap: 8px; }
.label-row label { font-weight: 600; color: #CBD5E1; margin: 0; }
.sample-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--cyan); cursor: pointer; font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 5px; background: var(--cyan-soft);
}
.sample-link:hover { background: rgba(6, 182, 212, 0.22); }

.upload-box {
  position: relative; min-height: 118px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  border: 1.5px dashed rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
  padding: 16px 12px; cursor: pointer;
}
.upload-box:hover, .upload-box:focus-visible, .upload-box.is-dragover {
  border-color: var(--cyan); background: var(--cyan-soft);
}
.upload-box.has-file {
  border-style: solid; border-color: rgba(16, 185, 129, 0.5); background: rgba(16, 185, 129, 0.05);
}
.upload-box .t { font-size: 12px; font-weight: 600; color: var(--text); }
.upload-box .s { font-size: 11px; color: var(--subtle); margin-top: 4px; }
.filename { margin-top: 8px; font: 600 11px var(--font-mono); color: var(--jade-400); overflow-wrap: anywhere; }
.hidden-file {
  position: absolute; width: 1px !important; height: 1px;
  opacity: 0; overflow: hidden; padding: 0 !important; pointer-events: none;
}
.upload-thumb {
  display: block; height: 64px; max-width: 100%;
  object-fit: contain; border-radius: 6px; margin: 8px auto 0;
  border: 1px solid var(--border);
}

.option-panel { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px; }
.toggle-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.toggle-btn {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-inset); color: var(--muted);
  padding: 9px 10px; font-size: 11px; font-weight: 600; min-height: 38px;
}
.toggle-btn:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }
.toggle-btn.active, .toggle-btn.on {
  border-color: var(--cyan); background: var(--cyan-soft); color: var(--cyan);
}
.toggle-sub { margin-top: 10px; }
.toggle-sub input { max-width: 72px; min-height: 36px !important; text-align: center; font-family: var(--font-mono); }
.evo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Action Dock (Sticky right on desktop, Fixed Bottom Bar on mobile) */
.merge-action-dock {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}
.dock-summary-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px; font-size: 12px;
}
.dock-summary-label { color: var(--muted); }
.dock-summary-cost { font: 700 13px var(--font-mono); color: var(--accent); }
.btn-merge { width: 100%; min-height: 48px; font-size: 14px; }

.loading {
  display: none; margin-top: 12px; padding: 14px 16px;
  background: var(--surface-inset); border: 1px solid var(--border-cyan);
  color: var(--cyan); border-radius: var(--radius-md); font-size: 12px; font-weight: 500;
}
.loading-bar-track {
  height: 4px; background: rgba(255, 255, 255, 0.08);
  border-radius: 999px; overflow: hidden; margin-top: 10px;
}
.loading-bar-fill {
  height: 100%; width: 45%; background: var(--cyan);
  border-radius: 999px;
  animation: studioProgress 1.15s ease-in-out infinite;
}
#result { font-size: 12px; margin-top: 12px; overflow-wrap: anywhere; }

/* ==========================================================================
   OVERLAYS: EDITOR, COLOR GRADING & BOTTOM-SHEET MODALS
   ========================================================================== */
.result-overlay, .modal, .zalo-modal, .export-modal {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(5, 7, 12, 0.86);
  padding: 20px; overflow-y: auto;
  align-items: center; justify-content: center;
}
.result-overlay.show, .result-overlay.active,
.modal.show, .modal.active,
.zalo-modal.show,
.export-modal.show, .export-modal.open {
  display: flex;
}

.result-card {
  position: relative; width: min(1440px, 100%);
  max-height: calc(100dvh - 40px); overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl); padding: 24px 28px;
  box-shadow: var(--shadow);
}
.close-result, .modal-close {
  position: absolute; right: 16px; top: 16px;
  display: grid; place-items: center;
  border: 1px solid var(--border-strong);
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: var(--surface-raised); color: var(--text); z-index: 5; cursor: pointer;
}
.close-result:hover, .modal-close:hover { background: #263047; }

.preview-title { font-size: 20px; font-weight: 800; padding-right: 44px; }
.preview-sub { font-size: 12px; color: var(--muted); margin: 6px 0 18px; }

.layout-editor {
  min-height: 160px; padding: 16px;
  background: var(--surface-inset);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: auto; max-height: 62dvh;
}
.layout-row {
  display: flex; gap: 6px; padding: 10px 0; min-height: 70px;
  border-bottom: 1px dashed var(--border); min-width: max-content;
}
.layout-row:last-child { border-bottom: 0; }
.layout-slot, .slot, .layout-item {
  position: relative; display: inline-flex; flex-direction: column; align-items: center;
  width: 82px; height: 110px; flex-shrink: 0;
  cursor: grab; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); overflow: hidden;
  background-size: contain; background-repeat: no-repeat; background-position: center;
}
.layout-slot[data-type=item2] { width: 230px; max-width: none; }
.layout-slot[data-type=phukien_banner] { width: 220px; max-width: none; cursor: default; }
.layout-slot[aria-pressed=true] { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.slot-badge {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(9, 11, 16, 0.88);
  font: 700 9px var(--font-mono); padding: 3px; text-align: center; color: var(--text);
}
.drag-over { outline: 2px solid var(--cyan); }
.dragging { opacity: 0.4; }

.action-buttons { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.action-buttons .btn-download { flex: 1; min-width: 180px; }

.result-card #adjustStep {
  display: grid; grid-template-columns: minmax(0, 1fr) 310px;
  column-gap: 24px; align-items: start;
}
.result-card #adjustStep > .preview-title,
.result-card #adjustStep > .preview-sub { grid-column: 1 / -1; }
.preset-bar {
  grid-column: 2; grid-row: 3;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px;
}
.preset-select { font-size: 12px; min-height: 38px !important; flex: 1; min-width: 130px; }
.preview-container {
  grid-column: 1; grid-row: 3 / span 14;
  min-height: 440px; max-height: 74dvh; overflow: auto;
  background: #06080C; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px; text-align: center;
  position: sticky; top: 0;
}
.preview-container img { width: auto; max-width: 100%; margin: 0 auto; border-radius: 6px; }
.brightness-control {
  grid-column: 2;
  display: grid; grid-template-columns: 98px minmax(0, 1fr) 34px;
  gap: 8px; align-items: center; margin: 0; padding: 9px 0;
  border-bottom: 1px solid var(--border); font-size: 11px;
}
.value-display { font: 600 11px var(--font-mono); text-align: right; color: var(--cyan); }
#adjustStep > .action-buttons, #downloadStatus, .save-preset-box { grid-column: 2; }
.save-preset-box { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.save-preset-box input { flex: 1; min-width: 140px; }

.modal-content {
  position: relative; max-width: 920px; width: 100%;
  background: var(--surface); padding: 48px 20px 20px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-xl);
  text-align: center; box-shadow: var(--shadow);
}
.modal-content img { max-height: 78dvh; margin: 0 auto; object-fit: contain; border-radius: var(--radius-md); }

.zalo-card {
  position: relative; width: min(460px, 100%);
  padding: 28px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}
.zalo-card h2 { font-size: 20px; margin: 10px 0 6px; }
.zalo-card > p { font-size: 13px; color: var(--muted); }
.zalo-icon-wrap { font-size: 28px; line-height: 1; }
.zalo-steps {
  display: grid; gap: 10px; padding: 14px;
  background: var(--surface-inset); border: 1px solid var(--border);
  border-radius: var(--radius-md); margin: 16px 0; font-size: 12px;
}
.zalo-steps .step { display: flex; gap: 10px; align-items: flex-start; }
.zalo-step-num {
  display: grid; place-items: center; width: 20px; height: 20px; flex-shrink: 0;
  border-radius: 50%; background: var(--cyan-soft); color: var(--cyan);
  font: 700 11px var(--font-mono);
}
.zalo-btn-link, .zalo-confirm { width: 100%; margin-top: 10px; }
.zalo-hint { font-size: 11px !important; color: var(--subtle); text-align: center; margin-top: 12px; }

.export-modal > div, .export-modal > .box {
  background: var(--surface); padding: 24px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-xl);
  width: min(480px, 100%); box-shadow: var(--shadow);
  display: grid; gap: 8px;
}
.export-modal .box h3 { margin-bottom: 6px; font-size: 16px; }
.export-modal .box button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 14px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--surface-inset);
  color: var(--text); font-size: 13px; font-weight: 500; text-align: left;
}
.export-modal .box button:hover { border-color: var(--cyan); background: var(--cyan-soft); }
.export-modal .box button .num {
  display: grid; place-items: center; width: 22px; height: 22px;
  border-radius: 6px; background: var(--surface-raised); color: var(--accent);
  font: 700 11px var(--font-mono);
}
.export-modal .box button.cancel { justify-content: center; color: var(--muted); margin-top: 4px; }

/* ==========================================================================
   AUTH, PAYMENT, HISTORY, INVITE, CHECK ACC, UPDATES, ADMIN & SYSTEM
   ========================================================================== */
.auth-shell, .cp-shell { min-height: 75dvh; display: grid; place-items: center; padding: 32px 20px; }
.auth-box, .cp-box {
  width: min(430px, 100%); padding: 28px;
  border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface);
}
.auth-head, .cp-head { margin-bottom: 24px; }
.auth-title, .cp-title { font-size: 24px; margin: 12px 0 4px; }
.auth-sub, .cp-sub { font-size: 13px; color: var(--muted); }
.auth-seal, .cp-seal {
  width: 42px; height: 42px; display: grid; place-items: center;
  background: var(--accent-soft); border: 1px solid var(--border-accent);
  color: var(--accent); border-radius: var(--radius-md); font-size: 18px;
}
.auth-btn, .cp-btn { width: 100%; margin-top: 8px; min-height: 44px; }
.auth-foot, .cp-foot { font-size: 12px; color: var(--muted); margin-top: 20px; }
.auth-foot a, .cp-foot a { color: var(--cyan); font-weight: 600; }
.input-wrap { position: relative; }
.input-wrap .ico, .auth-box .field > .ico, .cp-box .field > .ico { display: none; }

.pay-wrap, .hist-wrap, .inv-wrap, .ca-wrap, .admin-panel-wrap,
.au-wrap, .as-wrap, .na-wrap, .pu-wrap, .pp-wrap, .up-wrap {
  padding: 28px; max-width: 1400px; margin: 0 auto;
}
.pay-head, .hist-head, .inv-head, .ca-head, .admin-panel-head, .au-head, .up-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 24px;
}
.pay-head h1, .hist-head h1, .inv-head h1, .ca-head h1, .admin-panel-head h1, .au-head h1, .up-head h1 { margin: 8px 0 4px; }
.pay-head p, .hist-head p, .inv-head p, .ca-head p, .admin-panel-head p, .au-head p, .up-head p {
  color: var(--muted); font-size: 13px;
}

.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.pay-card, .ca-card, .as-card, .na-card, .pu-card, .pp-card, .hero-card, .chart-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px; margin-bottom: 18px;
}
.pay-card .ct { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 14px; margin-bottom: 16px; color: var(--text); }
.pay-card .ct svg { color: var(--cyan); }
.amount-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0 16px; }
.amount-chip {
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-inset); color: var(--text);
  font: 700 13px var(--font-mono); text-align: center;
}
.amount-chip:hover { border-color: var(--border-strong); }
.amount-chip.active, .amount-chip.selected {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent);
}
.amount-input-wrap { position: relative; }
.amount-input { padding-right: 34px !important; font-family: var(--font-mono); font-weight: 600; }
.amount-suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--subtle); font-family: var(--font-mono); }
.amount-preview { min-height: 22px; padding: 8px 0 12px; color: var(--cyan); font: 600 12px var(--font-mono); }
.btn-generate { width: 100%; min-height: 46px; }
.pay-note { display: flex; align-items: flex-start; gap: 10px; font-size: 12px; color: var(--muted); padding: 12px 0 0; }
.pay-note > svg { flex-shrink: 0; margin-top: 2px; color: var(--cyan); }

.qr-frame {
  background: #ffffff; border-radius: var(--radius-lg); padding: 14px;
  width: min(270px, 100%); margin: 12px auto 16px;
  display: grid; place-items: center; min-height: 220px; color: #334155;
}
.qr-frame:has(.qr-placeholder:not([style*="display:none"])) {
  background: var(--surface-inset); border: 1.5px dashed var(--border-strong); color: var(--muted);
}
.qr-frame img { width: 100%; height: auto; border-radius: 6px; }
.qr-placeholder { text-align: center; color: var(--muted); font-size: 12px; }
.qr-placeholder svg { margin: 0 auto 10px; color: var(--subtle); }
.qr-status {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 12px; color: var(--muted); padding: 6px;
}
.qr-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.info-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); padding: 12px 0; font-size: 13px;
}
.info-row:last-of-type { border-bottom: 0; }
.info-row .lbl { color: var(--subtle); min-width: 96px; font-size: 12px; }
.info-row .val { flex: 1; overflow-wrap: anywhere; font-weight: 600; }
.copy-btn { padding: 6px 10px; min-height: 32px; font-size: 11px; }
.copy-btn .ok { display: none; }
.copy-btn.done .default { display: none; }
.copy-btn.done .ok { display: inline-flex; color: var(--jade-400); }
.pay-success:empty { display: none; }
.pay-success {
  padding: 16px 20px; margin-bottom: 18px;
  border: 1px solid rgba(16, 185, 129, 0.45); background: var(--jade-soft);
  border-radius: var(--radius-lg); color: var(--jade-400); text-align: center;
}
.countdown { font: 700 12px var(--font-mono); color: var(--accent); }

/* History */
.hud, .stats-grid, .stat-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0;
}
.hud > .box, .sbox, .stat {
  padding: 16px; background: var(--surface-inset);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.stats-grid .sbox, .stat-grid .stat { background: var(--surface); padding: 20px; border-radius: var(--radius-lg); }
.l, .lbl { color: var(--subtle); font-size: 11px; font-weight: 600; }
.n { font-size: 22px; font-weight: 700; margin-top: 6px; color: var(--text); }
.hist-list, .list { display: grid; gap: 14px; }
.rec {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); padding: 20px;
}
.rec-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.rec-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 14px; align-items: stretch; }
.time, .status, .id-hint, .date, .ts { font-size: 11px; color: var(--subtle); }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--jade-400); font-weight: 600; }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--jade-400); }
.vault {
  padding: 14px; background: var(--surface-inset); border: 1px solid var(--border);
  border-radius: var(--radius-md); display: grid; gap: 10px; overflow-wrap: anywhere;
}
.vault-row, .link-row, .id-line, .id-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.vault-label, .id-label { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--subtle); min-width: 82px; }
.vault-value, .id-code { font-size: 12px; font-weight: 600; color: var(--text); }
.image-id-box { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
.copy-id-btn {
  padding: 5px 10px; font-size: 11px; font-weight: 600;
  background: var(--surface-raised); color: var(--cyan);
  border: 1px solid var(--border-cyan); border-radius: 6px; cursor: pointer;
}
.id-actions { margin-top: 10px; }

/* Invite */
.hero-card { display: grid; gap: 14px; }
.hero-tag { color: var(--cyan); font: 700 11px var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.hero-title { font-size: 20px; font-weight: 700; }
.hero-desc, .note { color: var(--muted); font-size: 13px; }
.link-row .link-input { flex: 1; min-width: 0; font-family: var(--font-mono); }
.code-chip { color: var(--accent); padding: 7px 12px; border: 1px solid var(--border-accent); background: var(--accent-soft); border-radius: 6px; font-weight: 700; }
.sec-title { font-size: 16px; font-weight: 700; margin: 24px 0 12px; display: flex; align-items: center; gap: 8px; }
.sec-title .count { font: 600 12px var(--font-mono); color: var(--cyan); }
.item, .log-row {
  padding: 14px 16px; border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-md); display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.item .uname { font-weight: 700; }
.uid { font: 600 11px var(--font-mono); color: var(--subtle); margin-left: 6px; }
.delta { color: var(--jade-400); font-family: var(--font-mono); font-weight: 700; margin-left: auto; }

/* Check Acc */
.ca-card h3 { margin-bottom: 12px; }
.ca-card .row-grid { grid-template-columns: 1.5fr 1fr 1fr; margin-top: 14px; }
.cost-box {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; margin-top: 14px;
  background: var(--surface-inset); border: 1px solid var(--border);
  border-radius: var(--radius-md); font-size: 13px;
}
.cost-box .val { font: 700 13px var(--font-mono); color: var(--accent); }
.ca-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.progress-card { display: none; }
.progress-card.on { display: block; }
.prog-bar { height: 8px; background: var(--surface-inset); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin: 14px 0; }
.prog-bar > div, .prog-bar > span {
  display: block; height: 100%; width: 0%;
  background: var(--cyan); transition: width 200ms ease;
}
.prog-stats { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.prog-stats .n { font-size: 13px; }
.prog-stats .live .n { color: var(--jade-400); }
.prog-stats .die .n { color: var(--danger-400); }
.filter-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.tab-btn {
  border: 1px solid var(--border); background: var(--surface-inset);
  color: var(--muted); padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
}
.tab-btn.active { border-color: var(--cyan); background: var(--cyan-soft); color: var(--cyan); }
.tab-btn.spacer { margin-left: auto; }
.results-list {
  max-height: 440px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-inset);
}
.result-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  font: 500 12px var(--font-mono); overflow-wrap: anywhere;
}
.result-row:last-child { border-bottom: 0; }
.result-row .acc { font-weight: 700; color: var(--text); margin-bottom: 4px; }
.result-row .info { color: var(--muted); font-size: 11px; }
.hit-line-wrap { display: flex; align-items: center; gap: 8px; }
.hit-line { color: var(--jade-400); cursor: pointer; font-size: 11px; }
.copy-hit-btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 5px;
  padding: 2px 7px; font-size: 11px;
}

/* Updates */
.up-wrap .latest {
  background: var(--surface); padding: 24px;
  border: 1px solid var(--border-cyan); border-radius: var(--radius-lg); margin-bottom: 24px;
}
.up-wrap .latest .tag { font: 700 11px var(--font-mono); color: var(--cyan); text-transform: uppercase; margin-bottom: 8px; }
.up-wrap .latest .meta { display: flex; gap: 16px; color: var(--subtle); font-size: 12px; margin-top: 8px; }
.up-wrap .latest .body { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); white-space: pre-line; }
.up-wrap .hist-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.up-wrap .item { display: block; cursor: pointer; }
.up-wrap .item .item-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.up-wrap .item .left, .up-wrap .item .right { display: flex; align-items: center; gap: 10px; }
.up-wrap .item .ttl { font-size: 14px; font-weight: 600; }
.up-wrap .item .item-body { display: none; padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; white-space: pre-line; }
.up-wrap .item.open .item-body { display: block; }
.up-wrap .item.open .arrow { transform: rotate(180deg); }
.admin-actions { display: flex; gap: 10px; margin-top: 20px; }
.del { color: var(--danger-400); border: 1px solid rgba(239, 68, 68, 0.35); background: var(--danger-soft); border-radius: var(--radius-sm); padding: 6px 12px; font-size: 12px; }

/* Admin Dashboard / Users / Settings / Notifications */
.admin-panel-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.admin-panel-link {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--border); background: var(--surface);
  padding: 20px; border-radius: var(--radius-lg);
}
.admin-panel-link:hover { border-color: var(--border-cyan); background: var(--surface-raised); }
.admin-panel-link .ic { color: var(--cyan); }
.admin-panel-link .t { font-size: 14px; font-weight: 700; }
.admin-panel-link .d { color: var(--muted); font-size: 12px; margin-top: 3px; }
.admin-panel-link .arrow { margin-left: auto; color: var(--accent); flex-shrink: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 20px; padding-bottom: 22px; }
.chart-bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.chart-bar .b { width: 100%; min-height: 4px; background: var(--cyan); border-radius: 4px 4px 0 0; }
.chart-bar .lbl { position: absolute; top: calc(100% + 6px); font: 600 10px var(--font-mono); color: var(--subtle); }

.as-card, .na-card, .pu-card { max-width: 960px; margin: 0 auto; }
.mt-box, .switch-row {
  display: flex; gap: 16px; align-items: center; justify-content: space-between;
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-inset); margin: 12px 0;
}
.mt-title { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mt-desc { font-size: 12px; color: var(--muted); margin-top: 4px; }
.mt-badge { font: 700 10px var(--font-mono); padding: 2px 7px; border-radius: 5px; background: rgba(255,255,255,0.06); color: var(--muted); }
.mt-badge.on { background: var(--jade-soft); color: var(--jade-400); }
.mt-badge.gold { background: var(--accent-soft); color: var(--accent); }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; inset: 0; cursor: pointer; background: #2A354D; border-radius: 999px; }
.switch-slider::before {
  content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #F1F5F9; border-radius: 50%; transition: transform 180ms ease;
}
.switch input:checked + .switch-slider { background: var(--jade); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }
.switch-btn { width: 44px; height: 24px; border: 0; border-radius: 999px; background: #2A354D; padding: 3px; display: flex; flex-shrink: 0; }
.switch-knob { width: 18px; height: 18px; border-radius: 50%; background: #fff; }
.switch-btn.on { background: var(--accent); justify-content: flex-end; }
.preview, .preview-box { padding: 16px; background: var(--surface-inset); border: 1px solid var(--border); border-radius: var(--radius-md); margin: 16px 0; font-size: 13px; }
.color-row { display: flex; gap: 10px; align-items: center; }

.search-bar { display: flex; gap: 10px; margin: 18px 0; }
.search-bar button { min-width: 96px; }
.u-table { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.u-row {
  display: grid; grid-template-columns: 64px 1.2fr 120px 1.6fr 1.3fr 120px;
  gap: 14px; min-width: 940px; padding: 14px 16px;
  border-bottom: 1px solid var(--border); align-items: center;
}
.u-row:last-child { border-bottom: 0; }
.u-head { background: var(--surface-inset); font: 700 10px var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--subtle); }
.bal-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.bal-form input { max-width: 115px; min-height: 34px !important; padding: 6px 8px !important; font-family: var(--font-mono); }
.bal-form input[name="days"] { min-width: 104px; width: 104px !important; }
.bal-form button { min-height: 34px; padding: 5px 10px; font-size: 12px; }
.u-name { font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.u-id { color: var(--subtle); font: 600 12px var(--font-mono); }
.u-bal { font-weight: 700; color: var(--accent); }
.free-days { font: 600 11px var(--font-mono); color: var(--jade-400); margin-bottom: 4px; }
.free-days.empty { border: 0; padding: 0; background: none; text-align: left; color: var(--subtle); }
.self-note { font-size: 11px; color: var(--subtle); }

/* Privacy & Studio Coming */
.pp-card { max-width: 920px; margin: 0 auto; }
.pp-title { font-size: 24px; margin-bottom: 10px; }
.pp-title small { font-size: 12px; color: var(--subtle); font-weight: 500; margin-left: 8px; }
.pp-meta, .pp-foot { color: var(--subtle); font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; margin: 12px 0; }
.pp-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.pp-section h2 { font-size: 17px; margin-bottom: 10px; }
.pp-section h3 { font-size: 14px; margin: 12px 0 6px; color: var(--text); }
.pp-section ul { padding-left: 20px; margin: 8px 0; }
.pp-section a { color: var(--cyan); }
.studio-coming { padding: 40px 28px; max-width: 1160px; margin: 0 auto; }
.studio-pill { font: 700 11px var(--font-mono); color: var(--cyan); letter-spacing: 0.1em; }
.studio-coming h1 { margin: 12px 0; }
.studio-coming > p { color: var(--muted); }
.studio-feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 24px 0; }
.studio-feature-grid article { padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.studio-feature-grid h3 { margin-bottom: 8px; }
.studio-feature-grid p { font-size: 12px; color: var(--muted); }

/* System / Error Pages */
.db-wrap, .err-wrap, .mt-wrap, .mm-wrap, .fm-wrap {
  min-height: 70dvh; padding: 32px 20px; display: grid; place-items: center;
}
.db-card, .err-card, .mt-card, .mm-card, .fm-card {
  width: min(560px, 100%); padding: 32px;
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--surface); text-align: center;
}
.db-title, .err-title, .mt-card .mt-title, .mm-title, .fm-title { font-size: 22px; margin: 14px 0; justify-content: center; }
.db-desc, .err-desc, .mt-card .mt-desc, .mm-desc, .fm-desc { color: var(--muted); font-size: 13px; margin: 12px 0; }
.db-actions, .err-actions, .mm-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.db-btn, .err-btn, .fm-btn {
  display: inline-flex; align-items: center; padding: 10px 16px;
  background: var(--accent); color: var(--accent-ink); border-radius: var(--radius-md);
  font-weight: 700; font-size: 13px;
}
.db-msg, .err-msg, .fm-code {
  display: block; overflow-wrap: anywhere; padding: 14px;
  background: var(--surface-inset); border: 1px solid var(--border);
  border-radius: var(--radius-md); font: 600 13px var(--font-mono); margin: 16px 0;
}
.fm-back { display: block; color: var(--cyan); font-size: 13px; margin-top: 16px; }
.db-badge, .err-badge, .mm-badge, .mt-card .mt-badge { font: 700 11px var(--font-mono); color: var(--accent); }

/* ==========================================================================
   TOASTS & SITE BULLETIN
   ========================================================================== */
#wmk-toast-stack {
  position: fixed; right: 20px; top: 72px; z-index: 1000;
  display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.wmk-toast {
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius-md);
  padding: 12px 14px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms var(--ease-out);
  pointer-events: auto;
}
.wmk-toast.is-visible { opacity: 1; transform: translateY(0); }
.wmk-toast.success { border-left-color: var(--jade); }
.wmk-toast.warn { border-left-color: var(--accent); }
.wmk-toast.error { border-left-color: var(--danger); }

.site-bulletin {
  position: fixed; bottom: 20px; right: 20px; z-index: 110;
  width: min(340px, calc(100vw - 32px)); padding: 18px 20px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface-raised); box-shadow: var(--shadow);
}
.bulletin-close { position: absolute; right: 10px; top: 10px; width: 30px; height: 30px; }
.bulletin-badge { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bulletin-badge small { color: var(--accent); font: 700 10px var(--font-mono); letter-spacing: 0.08em; }
.site-bulletin h3 { font-size: 15px; margin-bottom: 6px; padding-right: 28px; }
.site-bulletin p { font-size: 12px; color: var(--muted); }

@keyframes studioProgress {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(240%); }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1200px) {
  .app-frame { grid-template-columns: 208px minmax(0, 1fr); }
  .overview-stats, .service-grid { grid-template-columns: repeat(2, 1fr); }
  .merge-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
  .admin-panel-links { grid-template-columns: repeat(2, 1fr); }
  .ca-card .row-grid { grid-template-columns: 1fr; }
}

@media (max-width: 950px) {
  .app-frame { grid-template-columns: 1fr; }
  .app-navigation {
    position: fixed; top: 60px; bottom: 0; left: 0; z-index: 120;
    width: 268px; height: calc(100dvh - 60px);
    transform: translateX(-100%);
    transition: transform 200ms var(--ease-out);
    will-change: transform;
  }
  .app-navigation.is-open { transform: translateX(0); }
  .navigation-backdrop { position: fixed; inset: 60px 0 0; background: rgba(0, 0, 0, 0.65); z-index: 115; }
  .mobile-menu { display: inline-grid; }
  .studio-launch { grid-template-columns: 1fr; }
  .launch-visual { border-left: 0; border-top: 1px solid var(--border); }
  .merge-grid { grid-template-columns: 1fr; }
  .result-card #adjustStep { grid-template-columns: minmax(0, 1fr) 260px; column-gap: 18px; }
  .pay-grid { grid-template-columns: 1fr; }
  .rec-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .app-header { height: 56px; padding: 0 12px; gap: 8px; }
  .header-left { gap: 8px; }
  .app-brand { gap: 8px; }
  .brand-text strong { font-size: 13px; }
  .brand-text small { font-size: 7.5px; letter-spacing: 0.1em; }
  .brand-symbol { width: 28px; height: 28px; }
  .header-account { gap: 6px; }
  .balance-meta small, .user-name, .account-menu .chevron { display: none; }
  .balance-link { padding: 4px 6px 4px 8px; gap: 5px; }
  .balance-meta strong { font-size: 11.5px; }
  .balance-plus { width: 18px; height: 18px; font-size: 13px; }
  .account-menu summary { padding: 2px; border-radius: 50%; }
  .app-navigation { top: 56px; height: calc(100dvh - 56px); }
  .navigation-backdrop { top: 56px; }

  .overview-page, .pay-wrap, .hist-wrap, .inv-wrap, .ca-wrap,
  .admin-panel-wrap, .au-wrap, .as-wrap, .na-wrap, .pu-wrap, .pp-wrap, .up-wrap {
    padding: 18px 14px 28px;
  }
  .merge-page { padding: 16px 14px 110px; }
  .app-footer { margin: 20px 14px 0; flex-wrap: wrap; gap: 10px; }

  .page-heading, .section-heading, .pay-head, .hist-head, .inv-head, .ca-head, .au-head {
    flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 18px;
  }
  .section-heading p { text-align: left; }
  .row-2col, .row-2 { grid-template-columns: 1fr; }
  .studio-readiness-grid { grid-template-columns: repeat(2, 1fr); }
  .toggle-grid { grid-template-columns: 1fr; }
  .overview-stats, .service-grid, .stats-grid, .stat-grid, .admin-panel-links, .studio-feature-grid {
    grid-template-columns: 1fr 1fr; gap: 10px;
  }
  .admin-panel-links, .studio-feature-grid { grid-template-columns: 1fr; }
  .hud { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .hud > .box { padding: 10px; }
  .hud .n { font-size: 17px; }
  .m-card, .pay-card, .ca-card, .rec { padding: 16px; }

  /* Sticky Bottom Action Bar on Mobile Merge Workspace */
  .merge-action-dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0;
    border-top: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    padding: 10px 14px max(12px, env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
  }
  .dock-summary-row { margin-bottom: 8px; }
  .btn-merge { min-height: 46px; }

  /* Mobile Toast & Bulletin positioning so they never clash with sticky bar */
  #wmk-toast-stack { top: 64px; right: 12px; left: 12px; max-width: none; }
  .site-bulletin { bottom: 96px; right: 14px; left: 14px; width: auto; }

  /* Fullscreen Mobile Studio Overlay (#resultOverlay) */
  .result-overlay { padding: 0; }
  .result-card {
    width: 100%; height: 100dvh; max-height: 100dvh;
    border-radius: 0; border: 0;
    padding: 16px 14px max(16px, env(safe-area-inset-bottom));
  }
  .preview-title { font-size: 17px; }
  .layout-editor { padding: 10px; max-height: 58dvh; }
  .result-card #adjustStep { grid-template-columns: 1fr; }
  .preset-bar, .preview-container, .brightness-control,
  #adjustStep > .action-buttons, #downloadStatus, .save-preset-box {
    grid-column: 1; grid-row: auto;
  }
  .preview-container { position: relative; min-height: 200px; max-height: 44dvh; margin-bottom: 12px; }
  .brightness-control { grid-template-columns: 104px minmax(0, 1fr) 32px; padding: 10px 0; }
  .result-card .action-buttons {
    position: sticky; bottom: 0;
    margin: 12px -14px 0; padding: 10px 14px max(10px, env(safe-area-inset-bottom));
    background: var(--bg-elevated); border-top: 1px solid var(--border-strong); z-index: 4;
  }

  /* Bottom Sheet Modals on Mobile */
  .modal, .zalo-modal, .export-modal {
    padding: 0;
    align-items: flex-end;
    justify-content: center;
  }
  .modal-content, .zalo-card, .export-modal > div, .export-modal > .box {
    width: 100%; max-width: 100%;
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
    max-height: 90dvh; overflow-y: auto;
    padding: 22px 16px max(22px, env(safe-area-inset-bottom));
  }
  .modal-content { padding-top: 44px; }
  .modal-content::before, .zalo-card::before, .export-modal > .box::before {
    content: ''; display: block; width: 38px; height: 4px;
    border-radius: 999px; background: rgba(255, 255, 255, 0.22);
    margin: -8px auto 14px;
  }
  .modal-content img { max-height: 68dvh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important; transition: none !important; scroll-behavior: auto !important;
  }
}
