/* Functional bridge: keeps NexusAI visual language while rendering GameIOS PHP features. */
:root {
  --sidebar-w: 292px;
  --radius: 20px;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --info: #3b82f6;
  --app-gutter: clamp(16px, 2.2vw, 34px);
  --panel-pad: clamp(18px, 2.1vw, 28px);
  --panel-gap: clamp(18px, 2vw, 26px);
  --field-h: 46px;
}

body.nexus-auth-body,
body.nexus-app-body,
body.nexus-public-body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--tx);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

.nexus-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 1.04rem;
  font-weight: 800;
  color: var(--tx) !important;
  text-decoration: none;
  white-space: nowrap;
}
.nexus-brand .logo-i { display: inline-flex; }
.nexus-brand span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nexus-topbar-lite { height: var(--nav) !important; }
.nexus-topbar-lite .container,
.nexus-topbar-lite .container-fluid { min-width: 0; }
.nexus-topbar-lite .btn,
.nexus-topbar-lite button { white-space: nowrap; }
.nexus-topbar-lite .d-flex { min-width: 0; }

/* Landing */
.nexus-public-body #hero {
  min-height: 92vh;
  padding-left: max(0px, env(safe-area-inset-left));
  padding-right: max(0px, env(safe-area-inset-right));
}
.nexus-public-body .h1 {
  font-size: clamp(2.35rem, 7vw, 5.6rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.045em;
  margin-bottom: 24px;
}
.feature-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  color: var(--pur);
  font-size: 1.28rem;
  margin-bottom: 18px;
}
.landing-flow {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--tx2);
  font-weight: 700;
}
.landing-flow span {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--bg3);
  border: 1px solid var(--bd);
}
.price-big { font-size: 2rem; font-weight: 850; margin: 14px 0; }
.border-highlight {
  border-color: rgba(139, 92, 246, 0.45) !important;
  box-shadow: 0 24px 80px rgba(139, 92, 246, 0.12);
}
.nexus-footer {
  border-top: 1px solid var(--bd);
  padding: 30px 0;
  color: var(--tx3);
}

/* Auth */
.nexus-auth-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--nav) + 38px) 18px 44px;
}
.auth-card {
  width: min(100%, 500px);
  padding: clamp(22px, 4vw, 34px);
  border-radius: 26px;
  background: var(--sf) !important;
  border: 1px solid var(--bd) !important;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.16);
}
.auth-brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
.auth-brand-block h1 { font-size: 1.42rem; margin: 0; font-weight: 800; }
.auth-brand-block p { margin: 3px 0 0; color: var(--tx3); font-size: 0.92rem; }
.auth-form { display: grid; gap: 16px; }
.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
  color: var(--tx2);
  font-size: 0.94rem;
}
.auth-links a { color: var(--tx2); }
.auth-links a:hover { color: var(--tx); }
.oauth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.oauth-row .btn { justify-content: center; }
.center-text { text-align: center; }
.center-text h2 { font-size: clamp(3rem, 18vw, 4.5rem); font-weight: 850; }
.muted { color: var(--tx3) !important; }

/* App shell */
.nexus-app-shell {
  display: grid;
  grid-template-columns: minmax(260px, var(--sidebar-w)) minmax(0, 1fr);
  gap: var(--panel-gap);
  min-height: 100vh;
  padding: calc(var(--nav) + 28px) var(--app-gutter) 36px;
}
.nexus-sidebar {
  position: sticky;
  top: calc(var(--nav) + 28px);
  height: calc(100vh - var(--nav) - 56px);
  padding: 20px;
  overflow: auto;
  scrollbar-width: thin;
}
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--bd);
  margin-bottom: 16px;
}
.sidebar-profile > div { min-width: 0; }
.sidebar-profile b {
  display: block;
  max-width: 190px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-profile small { display: block; color: var(--tx3); font-size: 0.8rem; }
.avatar-circle {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 15px;
  background: var(--grad);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 850;
}
.nexus-side-nav { display: grid; gap: 9px; }
.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 12px 13px;
  border-radius: 14px;
  color: var(--tx2) !important;
  text-decoration: none;
  border: 1px solid transparent;
  font-weight: 700;
}
.side-link i { width: 20px; text-align: center; flex: 0 0 20px; }
.side-link span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side-link:hover,
.side-link.active {
  color: var(--tx) !important;
  background: rgba(139, 92, 246, 0.11);
  border-color: rgba(139, 92, 246, 0.24);
}
.nexus-main-content { min-width: 0; }
.page-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}
.page-title-row h1 {
  font-size: clamp(1.72rem, 4vw, 2.75rem);
  font-weight: 850;
  letter-spacing: -0.035em;
  margin: 0;
  line-height: 1.12;
}
.nexus-user-chip {
  align-items: center;
  gap: 9px;
  padding: 7px 13px;
  border: 1px solid var(--bd);
  border-radius: 999px;
  background: var(--sf);
}
.nexus-user-chip span { font-weight: 750; }
.nexus-user-chip small { color: var(--tx3); }
.app-menu-toggle {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex: 0 0 42px;
}
.app-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1040;
}

/* Layout helpers */
.grid { display: grid; gap: var(--panel-gap); }
.stats-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: var(--panel-gap); }
.admin-stats-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.two-col,
.pay-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.package-grid,
.guide-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full { grid-column: 1 / -1; }

.panel,
.stat-card,
.guide-card,
.package-card,
.oauth-help,
.create-box {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: var(--radius);
  padding: var(--panel-pad);
  margin-bottom: var(--panel-gap);
}
.grid > .panel,
.grid > .stat-card,
.grid > .guide-card,
.grid > .package-card { margin-bottom: 0; }
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.panel-head > div { min-width: 0; }
.panel-head h3,
.panel h3,
.package-card h3,
.guide-card h4 {
  margin: 0 0 8px;
  font-weight: 800;
  color: var(--tx);
  line-height: 1.25;
}
.panel-head p,
.package-card p,
.guide-card p {
  margin: 0;
  color: var(--tx2);
  line-height: 1.6;
}
.stackable { align-items: center; }
.head-actions,
.hero-actions,
.package-actions,
.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.head-actions form,
.hero-actions form,
.package-actions form,
.actions form { margin: 0; }
.head-actions { justify-content: flex-end; }
.package-actions { align-items: stretch; }
.package-actions form { flex: 1 1 180px; }
.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  align-items: center;
  gap: var(--panel-gap);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.13), rgba(59, 130, 246, 0.08)), var(--sf);
}
.hero-panel h2 {
  font-size: clamp(1.6rem, 4vw, 2.55rem);
  font-weight: 850;
  line-height: 1.12;
  letter-spacing: -0.035em;
}
.eyebrow {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--pur);
  font-weight: 850;
  margin-bottom: 10px;
}
.hero-box,
.wallet-hero-box,
.quota-box,
.wheel-ui {
  border: 1px solid var(--bd);
  background: var(--bg3);
  border-radius: 18px;
  padding: 22px;
  min-width: 0;
}
.hero-box code,
.wallet-hero-box code,
.copy-row code,
code {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.hero-box strong,
.wallet-hero-box strong,
.quota-box strong { display: block; font-size: clamp(1.55rem, 5vw, 2rem); }
.hero-box span,
.wallet-hero-box span,
.quota-box span { display: block; color: var(--tx2); }
.stat-card { min-height: 126px; }
.stat-card span { display: block; color: var(--tx3); font-size: 0.88rem; }
.stat-card strong {
  display: block;
  font-size: clamp(1.45rem, 3.3vw, 1.85rem);
  font-weight: 850;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-top: 5px;
  overflow-wrap: anywhere;
}
.stat-card small { color: var(--tx3); }

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
}
.form-grid label,
.auth-form label {
  display: grid;
  gap: 9px;
  color: var(--tx2);
  font-weight: 700;
  min-width: 0;
}
.form-grid label small,
label small { color: var(--tx3); font-weight: 500; line-height: 1.5; }
.search-form { display: flex; gap: 10px; align-items: center; margin: 0; }
.search-form input { min-width: min(240px, 34vw); }
input,
select,
textarea {
  width: 100%;
  min-height: var(--field-h);
  border: 1px solid var(--bd2);
  background: var(--bg3);
  color: var(--tx);
  border-radius: 13px;
  padding: 12px 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
input:focus,
select:focus,
textarea:focus {
  border-color: rgba(139, 92, 246, 0.7);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12);
}
input[disabled] { opacity: 0.68; }
textarea { min-height: 114px; resize: vertical; }
.mini-input { max-width: 124px; min-height: 40px; padding: 9px 10px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 13px !important;
  border: 1px solid var(--bd2) !important;
  background: transparent;
  color: var(--tx) !important;
  font-weight: 800;
  padding: 10px 15px;
  line-height: 1.15;
  transition: 0.22s;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--pur) !important;
  background: rgba(139, 92, 246, 0.08);
  color: var(--tx) !important;
}
.btn.primary,
.btn.bgrd {
  background: var(--grad) !important;
  border-color: transparent !important;
  color: #fff !important;
}
.btn.primary:hover { box-shadow: 0 8px 24px rgba(139, 92, 246, 0.32); }
.btn.ghost { background: transparent !important; }
.btn.danger {
  background: rgba(239, 68, 68, 0.13) !important;
  border-color: rgba(239, 68, 68, 0.28) !important;
  color: #fecaca !important;
}
.btn.small {
  min-height: 36px;
  padding: 8px 11px;
  font-size: 0.85rem;
  border-radius: 11px !important;
}
.btn.full,
.full .btn { width: 100%; }

/* Status */
.alert {
  border-radius: 15px;
  border: 1px solid var(--bd);
  padding: 14px 16px;
  margin-bottom: 18px;
  background: var(--bg3);
  color: var(--tx2);
  line-height: 1.55;
}
.alert.success { border-color: rgba(34, 197, 94, 0.28); background: rgba(34, 197, 94, 0.1); color: #86efac; }
.alert.info { border-color: rgba(59, 130, 246, 0.3); background: rgba(59, 130, 246, 0.1); color: #bfdbfe; }
.alert.warning { border-color: rgba(245, 158, 11, 0.3); background: rgba(245, 158, 11, 0.12); color: #fde68a; }
.alert.danger { border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.1); color: #fecaca; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.76rem;
  font-weight: 850;
  border: 1px solid var(--bd);
  background: var(--bg3);
  color: var(--tx2);
  white-space: nowrap;
}
.badge.signed,
.badge.paid,
.badge.active { border-color: rgba(34, 197, 94, 0.3); background: rgba(34, 197, 94, 0.12); color: #86efac; }
.badge.failed,
.badge.cancelled,
.badge.deleted,
.badge.expired { border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.12); color: #fecaca; }
.badge.pending,
.badge.uploaded { border-color: rgba(245, 158, 11, 0.3); background: rgba(245, 158, 11, 0.12); color: #fde68a; }

/* Tables */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--bd);
  border-radius: 18px;
  background: var(--bg3);
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 820px;
}
th,
td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--bd);
  vertical-align: top;
  color: var(--tx2);
  line-height: 1.5;
}
th {
  color: var(--tx);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
td strong { color: var(--tx); overflow-wrap: anywhere; }
td small { display: block; color: var(--tx3); margin-top: 6px; line-height: 1.45; }
td label { display: grid; gap: 7px; margin: 0 0 11px; color: var(--tx2); font-weight: 700; }
td label:last-child { margin-bottom: 0; }
td > input + input,
td > select + input,
td > input + select,
td > select + select,
td small input + input { margin-top: 10px; }
table input,
table select,
table textarea { min-width: 156px; }
table .mini-input { min-width: 90px; }
.actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.empty { text-align: center; color: var(--tx3); padding: 24px !important; }
.highlight-row { outline: 2px solid rgba(139, 92, 246, 0.55); outline-offset: -2px; }
.pagination { display: flex; gap: 9px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pagination a {
  display: inline-flex;
  min-width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  border: 1px solid var(--bd);
  color: var(--tx2);
  background: var(--sf);
}
.pagination a.active,
.pagination a:hover { background: var(--grad); color: #fff; border-color: transparent; }

/* Feature blocks */
.dropzone {
  border: 1.5px dashed rgba(139, 92, 246, 0.45);
  border-radius: 20px;
  background: rgba(139, 92, 246, 0.08);
  padding: clamp(24px, 5vw, 36px);
  text-align: center;
  cursor: pointer;
}
.dropzone input { margin-bottom: 14px; }
.dropzone strong { display: block; color: var(--tx); font-size: 1.15rem; }
.dropzone span { display: block; color: var(--tx3); line-height: 1.55; }
.guide-card b {
  display: inline-flex;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: var(--grad);
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 14px;
}
.mini-list { display: grid; gap: 12px; }
.mini-list > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 15px;
  border-radius: 16px;
  background: var(--bg3);
  border: 1px solid var(--bd);
}
.mini-list > div b { min-width: 0; overflow-wrap: anywhere; }
.mini-list span { color: var(--tx3); font-size: 0.91rem; line-height: 1.45; overflow-wrap: anywhere; }
.compact-list > div { display: block; }
.copy-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 16px 0; }
.copy-row code,
code {
  border: 1px solid var(--bd);
  background: var(--bg3);
  border-radius: 11px;
  padding: 7px 10px;
  color: #c4b5fd;
}
.bank-list { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.bank-mini-card {
  display: grid;
  gap: 5px;
  min-width: 140px;
  padding: 14px;
  border: 1px solid var(--bd);
  background: var(--bg3);
  border-radius: 16px;
  cursor: pointer;
}
.bank-mini-card.active { border-color: var(--pur); background: rgba(139, 92, 246, 0.13); }
.bank-mini-card img { max-width: 52px; max-height: 30px; object-fit: contain; }
.bank-mini-card small { color: var(--tx3); }
.qr-tabs { display: grid; gap: 14px; }
.qr-panel { display: none; }
.qr-panel.active { display: block; }
.qr-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 270px;
  border: 1px solid var(--bd);
  border-radius: 20px;
  background: #fff;
  padding: 16px;
  color: #111;
}
.qr-box img { max-width: 100%; max-height: 310px; }
.bank-info { display: grid; gap: 7px; margin-top: 14px; color: var(--tx2); }
.bank-info p { margin: 0; overflow-wrap: anywhere; }
.wheel-ui { text-align: center; }
.wheel-ui div { font-size: 5rem; line-height: 1; color: var(--pur); animation: spinSlow 6s linear infinite; }
.wheel-ui span { display: block; font-weight: 850; }
.progress { height: 13px; border-radius: 999px; background: var(--bg3); border: 1px solid var(--bd); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--grad); }
.log-box {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  background: #05050a;
  color: #d1d5db;
  border: 1px solid var(--bd);
  border-radius: 18px;
  padding: 18px;
  max-height: 620px;
  overflow: auto;
  line-height: 1.55;
}
.small-log { max-height: 220px; }
.create-box summary {
  cursor: pointer;
  font-weight: 850;
  color: var(--tx);
  margin-bottom: 16px;
  min-height: 34px;
}
.section-title {
  font-size: 1.05rem !important;
  color: var(--tx) !important;
  border-top: 1px solid var(--bd);
  padding-top: 20px;
  margin-top: 8px !important;
}
.oauth-help h4 { font-size: 1rem; margin: 0 0 7px; }
.oauth-help p { margin: 0; color: var(--tx2); line-height: 1.6; }
.bank-cell { display: flex; align-items: center; gap: 10px; min-width: 0; margin-bottom: 10px; }
.bank-cell img { width: 42px; height: 42px; object-fit: contain; border-radius: 12px; background: var(--sf); }
.bank-cell div { min-width: 0; }

@keyframes spinSlow { to { transform: rotate(360deg); } }

/* Light mode refinements */
.lm .btn.danger { color: #991b1b !important; }
.lm .alert.success { color: #166534; }
.lm .alert.info { color: #1d4ed8; }
.lm .alert.warning { color: #92400e; }
.lm .alert.danger { color: #991b1b; }
.lm .badge.signed,
.lm .badge.paid,
.lm .badge.active { color: #166534; }
.lm .badge.failed,
.lm .badge.cancelled,
.lm .badge.deleted,
.lm .badge.expired { color: #991b1b; }
.lm .badge.pending,
.lm .badge.uploaded { color: #92400e; }
.lm table th { background: rgba(99, 71, 246, 0.04); }
.lm .log-box { background: #0f172a; color: #e5e7eb; }
.lm .alert { background: #fff; }
.lm .panel,
.lm .stat-card,
.lm .guide-card,
.lm .package-card,
.lm .oauth-help,
.lm .create-box,
.lm .nexus-sidebar,
.lm .auth-card { box-shadow: 0 18px 55px rgba(30, 41, 59, 0.08); }

/* Responsive */
@media (max-width: 1199px) {
  .stats-grid,
  .admin-stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .package-grid,
  .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-panel { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 991px) {
  .nexus-app-shell {
    grid-template-columns: 1fr;
    padding: calc(var(--nav) + 18px) 14px 26px;
  }
  .nexus-sidebar {
    position: fixed;
    z-index: 1055;
    left: 14px;
    top: calc(var(--nav) + 12px);
    bottom: 14px;
    width: min(330px, calc(100vw - 28px));
    height: auto;
    transform: translateX(calc(-100% - 24px));
    transition: transform 0.25s;
  }
  .nexus-sidebar.open { transform: none; }
  .app-backdrop.open { display: block; }
  .stats-grid,
  .admin-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-head.stackable,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .head-actions { width: 100%; justify-content: flex-start; }
  .search-form { width: 100%; }
  .search-form input,
  .search-form select { min-width: 0; flex: 1; }
}

@media (max-width: 767px) {
  :root { --panel-gap: 16px; --panel-pad: 18px; }
  .nexus-public-body .h1 { font-size: clamp(2.08rem, 13vw, 3.8rem); }
  .sp { padding: 64px 0; }
  .auth-card { padding: 22px; border-radius: 22px; }
  .oauth-row,
  .two-col,
  .pay-grid,
  .package-grid,
  .guide-grid,
  .form-grid,
  .two,
  .four { grid-template-columns: 1fr; }
  .stats-grid,
  .admin-stats-grid { grid-template-columns: 1fr 1fr; gap: 13px; }
  .page-title-row { margin-bottom: 18px; }
  .page-title-row h1 { font-size: clamp(1.55rem, 8vw, 2.15rem); }
  .mini-list > div { display: grid; gap: 6px; }
  .hero-actions,
  .head-actions,
  .package-actions,
  .form-actions { align-items: stretch; }
  .hero-actions .btn,
  .hero-actions form,
  .head-actions .btn,
  .head-actions form,
  .search-form button,
  .package-actions .btn,
  .package-actions form,
  .form-actions .btn { width: 100%; }
  .search-form { flex-direction: column; align-items: stretch; }
  .qr-box { min-height: 220px; }
  .nexus-app-shell { padding-left: 10px; padding-right: 10px; }
  .nexus-brand span:last-child { max-width: min(52vw, 210px); }
  .landing-flow { justify-content: center; }
  .landing-flow i { display: none; }
  .dgrid { grid-template-columns: 1fr !important; }
  .dside { display: none; }
}

@media (max-width: 820px) {
  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap th,
  .table-wrap td,
  .table-wrap tr {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .table-wrap thead { display: none; }
  .table-wrap tbody { display: grid; gap: 14px; }
  .table-wrap tr {
    background: var(--sf);
    border: 1px solid var(--bd);
    border-radius: 18px;
    padding: 6px 0;
    overflow: hidden;
  }
  .table-wrap td {
    border: 0;
    padding: 10px 15px;
    color: var(--tx);
    display: grid;
    gap: 6px;
  }
  .table-wrap td + td { border-top: 1px solid var(--bd); }
  .table-wrap td::before {
    content: attr(data-label);
    color: var(--tx3);
    font-size: 0.7rem;
    line-height: 1.25;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .table-wrap td[data-label=""]::before { display: none; }
  .table-wrap td.actions {
    display: flex;
    align-items: stretch;
    gap: 10px;
  }
  .table-wrap td.actions::before {
    flex: 0 0 100%;
    display: block;
  }
  .table-wrap td.actions .btn,
  .table-wrap td.actions form,
  .table-wrap td.actions button { width: 100%; }
  table input,
  table select,
  table textarea,
  .mini-input {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .nexus-topbar-lite .container,
  .nexus-topbar-lite .container-fluid { padding-left: 10px !important; padding-right: 10px !important; }
  .nexus-topbar-lite .gap-2 { gap: 6px !important; }
  .nexus-topbar-lite .btn { min-height: 38px; padding: 8px 10px !important; border-radius: 11px !important; }
  .nexus-auth-body #nbar a.btn { display: none !important; }
  .nexus-brand { font-size: 0.96rem; }
  .logo-i { width: 32px; height: 32px; border-radius: 10px; }
  .auth-links { display: grid; }
  .bank-mini-card { flex: 1 1 calc(50% - 12px); min-width: 0; }
}

@media (max-width: 420px) {
  .stats-grid,
  .admin-stats-grid { grid-template-columns: 1fr; }
  .nexus-user-chip { display: none !important; }
  .actions .btn,
  .actions form,
  .actions button { width: 100%; }
  .mobile-hide { display: none !important; }
  .panel,
  .stat-card,
  .guide-card,
  .package-card,
  .oauth-help,
  .create-box { border-radius: 16px; }
  .btn { white-space: normal; }
}

/* Spacing pass 3: roomier desktop/mobile layout and cleaner upload form. */
:root {
  --app-gutter: clamp(22px, 3vw, 48px);
  --panel-pad: clamp(24px, 3vw, 40px);
  --panel-gap: clamp(24px, 2.8vw, 36px);
  --field-h: 50px;
}

.nexus-app-shell {
  gap: clamp(26px, 2.8vw, 42px);
  padding-bottom: clamp(38px, 4vw, 60px);
}

.nexus-main-content {
  width: 100%;
  max-width: 1360px;
  margin-inline: auto;
}

.panel-head {
  gap: clamp(20px, 2.4vw, 34px);
  margin-bottom: clamp(24px, 2.6vw, 34px);
}

.panel-head p,
.panel > p,
.guide-card p,
.package-card p {
  max-width: 78ch;
}

.form-grid {
  gap: clamp(20px, 2vw, 28px) clamp(20px, 2.2vw, 30px);
}

.auth-form,
.mini-list,
.qr-tabs,
.bank-info {
  gap: clamp(16px, 1.8vw, 22px);
}

input,
select,
textarea {
  padding: 13px 15px;
}

.btn {
  min-height: 46px;
  padding: 12px 17px;
}

/* Fix the signing page where select, upload box and submit button were too close. */
.upload-panel {
  padding: clamp(28px, 3.5vw, 48px);
}

.upload-panel .panel-head {
  align-items: flex-start;
  margin-bottom: clamp(30px, 3.2vw, 44px);
}

.upload-panel .panel-head h3 {
  margin-bottom: 12px;
}

.upload-panel .panel-head .btn {
  flex: 0 0 auto;
  margin-top: 2px;
}

.upload-form {
  display: grid;
  grid-template-columns: minmax(0, 760px);
  gap: clamp(24px, 2.8vw, 38px);
  align-items: start;
}

.upload-form > label:not(.dropzone) {
  display: grid;
  gap: 12px;
  margin: 0;
  min-width: 0;
  color: var(--tx);
  font-weight: 750;
}

.upload-form > label:not(.dropzone) select,
.upload-form > label:not(.dropzone) input,
.upload-form > label:not(.dropzone) textarea {
  margin-top: 0;
}

.upload-form .dropzone {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  width: 100%;
  min-height: clamp(205px, 24vw, 260px);
  margin: 0;
  padding: clamp(34px, 4.6vw, 58px);
  line-height: 1.55;
}

.upload-form .dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  opacity: 0;
  border: 0;
  cursor: pointer;
}

.upload-form .dropzone::before {
  content: "↑";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: var(--grad);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.22);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.upload-form .dropzone::after {
  content: "Bấm vào khung này để chọn file";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--bd2);
  color: var(--tx2);
  background: rgba(255, 255, 255, 0.48);
  font-size: 0.9rem;
  font-weight: 700;
}

.upload-form .dropzone strong {
  font-size: clamp(1.18rem, 2.2vw, 1.45rem);
  line-height: 1.35;
}

.upload-form .dropzone span {
  max-width: 46ch;
  font-size: 0.98rem;
}

.upload-form > button[type="submit"] {
  justify-self: start;
  min-height: 52px;
  padding-inline: 26px;
  margin-top: 2px;
}

.guide-grid {
  gap: clamp(22px, 2.5vw, 34px);
}

.guide-card,
.stat-card,
.package-card,
.oauth-help,
.create-box {
  padding: clamp(24px, 2.8vw, 34px);
}

@media (min-width: 1400px) {
  .nexus-main-content { max-width: 1320px; }
}

@media (max-width: 991px) {
  :root {
    --app-gutter: 16px;
    --panel-pad: 22px;
    --panel-gap: 22px;
  }
  .nexus-main-content { max-width: none; }
  .upload-panel .panel-head .btn { width: auto; }
}

@media (max-width: 767px) {
  :root {
    --panel-gap: 20px;
    --panel-pad: 20px;
  }
  .panel-head,
  .upload-panel .panel-head {
    gap: 18px;
    margin-bottom: 24px;
  }
  .upload-panel { padding: 22px; }
  .upload-form {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .upload-form .dropzone {
    min-height: 210px;
    padding: 30px 20px;
  }
  .upload-form > button[type="submit"],
  .upload-panel .panel-head .btn {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .upload-panel { padding: 20px 16px; }
  .upload-form .dropzone { min-height: 200px; }
  .upload-form .dropzone::after { width: 100%; }
}
