/* Captcha API UI — phong cách gần GameToolPlatform, màu thương hiệu teal (không tím). */
:root {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --surface-2: #f7fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #0d9488;
  --primary-600: #0f766e;
  --primary-soft: #ccfbf1;
  --success: #059669;
  --success-soft: #d1fae5;
  --warning: #b45309;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #0369a1;
  --info-soft: #e0f2fe;
  --neutral-soft: #eef2f6;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 6px 20px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.14);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: Consolas, "SF Mono", Menlo, monospace;
  --sidebar-w: 250px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.nav-lock { overflow: hidden; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 0.5em; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.small { font-size: 12.5px; }

/* Shell — fill viewport PC + mobile */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  background: linear-gradient(to right, var(--surface) var(--sidebar-w), var(--bg) var(--sidebar-w));
}
.main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
}
.menu-backdrop { display: none; }
.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.topbar-title strong {
  font-size: 1.05rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-title .muted {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-btn {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
}
.page-header-desktop { display: block; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px 8px 16px;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--primary), #22d3ee);
  color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 35%, transparent);
}
.brand strong { display: block; font-size: 0.95rem; font-weight: 800; }
.brand small { color: var(--muted); font-size: 12px; }

.nav-group {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 12px 6px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: none;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  padding: 9px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 500;
}
.sidebar nav a:hover { background: var(--neutral-soft); text-decoration: none; }
.sidebar nav a.active {
  background: var(--primary-soft);
  color: var(--primary-600);
  font-weight: 700;
}

.logout { margin-top: auto; padding: 8px; }
.logout button {
  width: 100%;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}
.logout button:hover { background: var(--neutral-soft); }

.content {
  padding: 24px 28px 40px;
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  min-width: 0;
  width: 100%;
  max-width: none;
  flex: 1;
}
.page-header { margin-bottom: 18px; }
.page-header h1 {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.page-header p { margin: 0; color: var(--muted); max-width: 42rem; }

/* Buttons */
.btn {
  font: inherit;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: background 0.15s, transform 0.05s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--primary-600); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; border-color: transparent; }
.btn-primary:hover { background: var(--primary-600); }
.btn-danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn-danger:hover { filter: brightness(0.94); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.secondary,
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn.secondary:hover,
.btn-secondary:hover { background: var(--surface-2); }
.actions:not(td) { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Cards / panels */
.panel,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.panel h2,
.card h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 700;
}

/* Stats — cột co giãn full ngang theo số thẻ (2 thẻ = 50/50, 5 thẻ admin = chia đều) */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 14px;
  margin-bottom: 18px;
  width: 100%;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  min-width: 0;
  text-align: center;
}
.stat span,
.stat .label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.stat strong,
.stat .value {
  display: block;
  margin-top: 4px;
  font-size: 1.3rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* Forms */
label.field,
.login-form label,
.import-form label {
  display: block;
  margin-bottom: 12px;
}
label.field > span,
.login-form label,
.import-form > label {
  font-size: 13px;
  font-weight: 600;
}
label.field > .hint {
  font-weight: 400;
  color: var(--muted);
}
.login-form label,
.import-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input[type="checkbox"] { width: auto; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  align-items: flex-end;
}
.toolbar label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.toolbar input,
.toolbar select { min-width: 180px; width: auto; }
.inline-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.inline-form input { width: auto; min-width: 100px; }
.cust-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.cust-actions .credit-amount {
  width: 120px;
  min-width: 100px;
}

/* Tables */
.table-wrap,
.panel,
.card {
  max-width: 100%;
  width: 100%;
}
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
/* Mọi bảng: min theo nhãn cột, chữ dài kéo ngang trước, không xuống dòng khi còn chỗ trống */
table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 0;
  table-layout: auto;
  font-size: 13.5px;
}
th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  width: 1%;
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  text-align: left;
  white-space: nowrap;
}
th.col-num,
td.col-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  width: 1%;
}
th.col-actions,
td.col-actions,
td.actions {
  width: 1%;
  white-space: nowrap;
}
td.col-actions form,
td.actions form {
  margin: 0;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  gap: 4px;
}
td.col-actions .btn,
td.actions .btn {
  width: auto;
  min-height: 32px;
}
td .mono,
td code,
td .key-full {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  max-width: none;
}
/* Chỉ dùng khi thật sự cần cho phép xuống dòng (vd JSON dài) */
td.col-wrap {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  width: auto;
}
tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}
tbody tr:hover td { background: var(--primary-soft); }
tbody tr:last-child td { border-bottom: 0; }
.panel > table,
.card > table { margin: -4px 0; }
code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--neutral-soft);
  padding: 2px 6px;
  border-radius: 6px;
}
pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* Badges / alerts */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--neutral-soft);
  color: var(--muted);
}
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert-error {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--text);
}
.alert-ok {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 30%, transparent);
  color: var(--text);
}
.callout {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--info-soft);
  border: 1px solid color-mix(in srgb, var(--info) 30%, transparent);
  margin-bottom: 14px;
}
.key-box {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.04em;
  background: var(--warning-soft);
  border: 1px dashed var(--warning);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: inline-block;
  word-break: break-all;
  user-select: all;
}

/* Package price cards — 4 cột (1/2/3/5 máy); 1 gói chỉ chiếm 1 ô */
.price-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
}
@media (max-width: 1100px) {
  .price-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.price-grid > .pkg-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.price-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.price-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.price-card h3 { margin: 0; font-size: 1.05rem; }
.price-card .price {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--success);
  font-variant-numeric: tabular-nums;
}
.price-card .credits { color: var(--muted); font-size: 13px; }
.price-card form { margin-top: auto; padding-top: 12px; }
.price-card .btn { width: 100%; }

/* Auth */
.login-page,
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent),
    radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, #22d3ee 14%, transparent), transparent),
    var(--bg);
}
.login-card,
.auth-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
}
.login-card h1,
.auth-card h1 {
  margin: 12px 0 6px;
  font-size: 1.35rem;
  font-weight: 800;
}
.login-card p,
.auth-card p { margin: 0 0 1.1rem; color: var(--muted); }
.login-form { display: grid; gap: 4px; }
.login-form .btn { width: 100%; margin-top: 8px; }
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  margin-bottom: 4px;
}
.auth-brand .brand-mark {
  width: 72px;
  height: 72px;
  font-size: 18px;
  border-radius: 16px;
}
.auth-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.25;
}
.auth-title b { font-size: 18px; font-weight: 800; }
.auth-title small { font-weight: 600; color: var(--muted); font-size: 13px; }

.auth-tabs {
  display: flex;
  background: var(--neutral-soft);
  border-radius: 12px;
  padding: 4px;
  margin: 18px 0 16px;
  gap: 2px;
}
.auth-tab {
  flex: 1;
  text-align: center;
  border: 0;
  background: none;
  padding: 9px 8px;
  border-radius: 9px;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
}
.auth-tab:hover { text-decoration: none; color: var(--text); }
.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.auth-form { display: grid; gap: 2px; }
.auth-form .field { margin-bottom: 12px; }
.auth-form .field > span:first-child {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text);
}
.auth-form .hint {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 5px;
  font-weight: 400;
}
.btn-block { width: 100%; margin-top: 6px; border-radius: 12px; min-height: 46px; }

/* Tài khoản — layout giống shop GTP */
.account-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  margin-bottom: 16px;
}
.account-panel > .card { margin-bottom: 0; }
/* Mobile: số dư trước hồ sơ */
.account-balance { order: 1; padding: 14px 16px; }
.account-profile { order: 2; }
.account-licenses { order: 3; }
.account-balance .balance-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  align-items: start;
}
.account-balance .balance-col-solved {
  padding-left: 16px;
  border-left: 1px solid var(--border);
}
.account-balance .label { font-size: 12.5px; font-weight: 600; }
.account-balance .balance-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--success);
  margin: 4px 0 0;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.account-balance .solved-value { color: var(--info); }
.account-balance .btn {
  width: 100%;
  min-height: 38px;
  padding: 7px 12px;
  font-size: 13px;
  margin-top: 12px;
}
.account-licenses .btn { width: 100%; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.card-head h2 { margin: 0; }
.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 16px;
  align-items: center;
}
.kv > dt { color: var(--muted); font-size: 13px; }
.kv > dd { margin: 0; font-weight: 600; }
.mt { margin-top: 14px; }
.m0 { margin: 0; }
.mfa-qr {
  display: flex;
  justify-content: center;
  margin: 12px auto;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  width: fit-content;
}

@media (min-width: 900px) {
  .account-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: stretch;
    gap: 16px;
  }
  .account-profile {
    grid-column: 1;
    grid-row: 1 / -1;
    order: unset;
    display: flex;
    flex-direction: column;
    height: 100%;
  }
  .account-profile .kv {
    margin-top: auto;
    padding-top: 8px;
  }
  .account-balance { grid-column: 2; grid-row: 1; order: unset; }
  .account-licenses { grid-column: 2; grid-row: 2; order: unset; }
}
@media (max-width: 560px) {
  .kv { grid-template-columns: 1fr; }
  .kv > dd { margin-bottom: 8px; }
  .price-grid { grid-template-columns: 1fr; }
}

.pager {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
  color: var(--muted);
}
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 18px;
  margin: 0;
}
.meta-grid dt { color: var(--muted); font-size: 12.5px; margin: 0 0 2px; }
.meta-grid dd { margin: 0; font-weight: 600; word-break: break-all; }

@media (min-width: 901px) {
  .menu-toggle { display: none !important; }
  .topbar { display: none !important; }
  .page-header-desktop { display: block; }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    background: var(--bg);
  }
  .main-col { min-height: 100dvh; }
  .topbar { display: flex; }
  .page-header-desktop { display: none; }
  .menu-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  .shell.nav-open .menu-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(300px, 86vw);
    height: 100dvh;
    border-right: 1px solid var(--border);
    border-bottom: 0;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
  }
  .shell.nav-open .sidebar { transform: none; }
  .sidebar nav {
    flex-direction: column;
    flex-wrap: nowrap;
  }
  .sidebar nav a {
    min-height: 44px;
    padding: 12px 14px;
  }
  .content {
    padding: 14px 14px 28px;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
  .stats {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat { padding: 14px; }
  .stat strong, .stat .value { font-size: 1.25rem; }
  .panel, .card { padding: 16px 14px; border-radius: 12px; }
  .btn { min-height: 44px; padding: 10px 14px; }
  .btn-sm { min-height: 36px; }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar input,
  .toolbar select { width: 100%; min-width: 0; }
  .toolbar .btn { width: 100%; }
  .actions:not(td) { flex-direction: column; }
  .actions:not(td) .btn { width: 100%; }
  .inline-form { width: 100%; }
  .inline-form input { flex: 1; min-width: 0; width: 100%; }
  .price-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .key-box { display: block; width: 100%; font-size: 13px; }
  .auth-wrap { padding: 16px; align-items: flex-start; padding-top: 48px; }
  .auth-card, .login-card { padding: 22px 18px; width: 100%; }
  table { font-size: 13px; }
  th, td { padding: 10px 10px; }
}

@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .topbar-title .muted { display: none; }
}

@media (min-width: 1280px) {
  .content { padding: 28px 36px 48px; }
}

/* GTP wallet / bank / thanh toán — copied styles */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }
.wallet-top { align-items: stretch; margin-bottom: 16px; }
.wallet-balance { display: flex; flex-direction: column; justify-content: center; }
.wallet-balance .price { font-size: 1.75rem; font-weight: 800; color: var(--success); margin: 6px 0 8px; }
.row-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-form .grow { flex: 1; min-width: 140px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--neutral-soft); color: var(--muted); }
.chip.ok { background: var(--success-soft); color: var(--success); }
.chip.info { background: var(--info-soft); color: var(--info); }
/* Nhãn tên khóa: nền phủ cả chuỗi (gói lượt = xanh dương nhẹ, gói máy = xanh lá). */
.chip.key-kind-label {
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 700;
  max-width: 100%;
  white-space: normal;
  text-align: left;
  line-height: 1.35;
}
.key-name .chip.key-kind-label { margin-bottom: 4px; }
.bank-card { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.bank-qr-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: 16px; background: #fff; cursor: zoom-in; font: inherit; text-decoration: none; color: inherit; }
.bank-qr-btn:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); text-decoration: none; }
.bank-qr { display: block; width: auto; height: auto; max-width: min(340px, 100%); max-height: 360px; object-fit: contain; border-radius: 10px; }
.bank-info { display: grid; gap: 10px; min-width: 0; }
.bank-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bank-row > .muted { min-width: 110px; }
.transfer-key { padding: 4px 10px; border: 2px dashed var(--primary); border-radius: 10px; background: var(--surface-2); letter-spacing: .5px; }
.bank-hint { margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); color: var(--muted); }
.bank-list { display: grid; gap: 12px; }
.active-banks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.active-banks li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.active-bank-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.active-bank-note { margin: 0; }
@media (max-width: 640px) { .bank-card { grid-template-columns: 1fr; } .bank-qr-btn { justify-self: center; } }
.pay-card { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.pay-qr img { display: block; width: auto; height: auto; max-width: 220px; max-height: 280px; border-radius: 14px; border: 1px solid var(--border); object-fit: contain; background: #fff; }
.pay-noqr { width: 180px; height: 120px; display: grid; place-items: center; border: 1px dashed var(--border); border-radius: 14px; color: var(--muted); font-size: 13px; background: var(--surface-2); }
.pay-body { flex: 1; min-width: 240px; }
.pay-prefix-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pay-prefix-bar h3 { margin: 0; }
.pay-prefix-edit { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.pay-prefix-edit input { height: 36px; width: 110px; text-transform: uppercase; margin: 0; }
.callout { padding: 12px 14px; border-radius: 12px; background: var(--info-soft); color: var(--info); border: 1px solid color-mix(in srgb, var(--info) 20%, transparent); }
.callout.warning {
  background: var(--warning-soft);
  color: var(--text);
  border-color: color-mix(in srgb, var(--warning) 35%, transparent);
}
.callout.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 2px solid color-mix(in srgb, var(--danger) 45%, transparent);
}
.sec-alert-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sec-alert-table { margin-top: 10px; overflow-x: auto; }
.sec-alert-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sec-alert-table th,
.sec-alert-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--danger);
  color: #fff;
}
.email-proof {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  margin: 4px 0 6px;
  word-break: break-all;
}
.alert-bad { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; }
.dep-actions { display: inline-block; }
.dep-actions > summary { list-style: none; cursor: pointer; }
.dep-panel { margin-top: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); min-width: 260px; }
.row-check { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; }
.row-check input { width: auto; }
.page-head-inline { display: flex; align-items: center; gap: 12px; margin: 8px 0 14px; }
.page-head-inline h2 { margin: 0; }
.mb { margin-bottom: 16px; }

.key-name { font-weight: 600; }
.key-copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
  width: max-content;
}
.key-full {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--neutral-soft);
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  line-height: 1.35;
  display: inline-block;
  width: max-content;
  max-width: none;
}
.bound-ips {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  width: max-content;
}
.bound-ips .key-full {
  flex: none;
  display: inline-block;
  width: max-content;
  max-width: none;
  white-space: nowrap;
  word-break: normal;
}

/* Thẻ gói captcha — ảnh + thông tin, chữ căn giữa */
.pkg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-align: center;
}
.pkg-card > .chip { align-self: center; }
.pkg-media {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
  aspect-ratio: 16 / 9;
  max-height: 240px;
}
.pkg-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pkg-media-empty {
  height: 100%;
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  padding: 12px;
}
.pkg-title {
  margin: 0;
  width: 100%;
  text-align: center;
  font-size: 0.85rem; /* mobile */
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  line-height: 1.3;
}
@media (min-width: 901px) {
  .pkg-title { font-size: 1rem; } /* PC */
}
.pkg-features {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.pkg-features li {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.35;
  text-align: center;
}
.pkg-features li::before {
  content: "";
  position: static;
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 2px;
  background: var(--primary);
  transform: rotate(45deg);
}
.pkg-price {
  width: 100%;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--success);
  text-align: center;
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.2;
}
.pkg-price strong { font-size: inherit; font-weight: inherit; color: inherit; }
.pkg-price .muted { font-size: 12.5px; font-weight: 600; }
.pkg-price-inline {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}
.pkg-price-inline .muted { font-size: 0.85em; }
.pkg-buy { margin-top: auto; width: 100%; }
.pkg-buy .btn { width: 100%; }
.pkg-card-ip > .btn { width: 100%; margin-top: auto; }
.pkg-meta { text-align: center; width: 100%; }

.plan-with-image {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
}
.plan-with-image .table-wrap {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none; /* fill phần còn lại bên trái ảnh */
  height: fit-content;
}
.pkg-image-block {
  flex: 0 0 var(--pkg-img-w, 240px);
  width: var(--pkg-img-w, 240px);
  min-width: 0;
}
.pkg-image-block .pkg-media {
  width: 100%;
  height: var(--pkg-img-h, auto);
  aspect-ratio: 16 / 9;
  max-height: none;
  object-fit: cover;
}
.pkg-image-block .pkg-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pkg-image-block .pkg-media-empty {
  min-height: 0;
  height: 100%;
  font-size: 12.5px;
}
.plan-footer-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  width: 100%;
}
.plan-footer-left {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: none;
}
.plan-footer-left .spacer { flex: 1; min-width: 8px; }
.plan-footer-right {
  flex: 0 0 var(--pkg-img-w, 240px);
  width: var(--pkg-img-w, 240px);
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.file-pick-btn {
  margin: 0;
  cursor: pointer;
}
.pkg-img-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.pkg-img-actions .pkg-img-action-form {
  display: contents;
}
.pkg-img-actions .btn,
.pkg-img-actions .file-pick-btn {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}
.pkg-img-actions .credit-img-name,
.pkg-img-actions #machineImageName {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 7rem;
}
@media (max-width: 900px) {
  .plan-with-image,
  .plan-footer-actions {
    flex-wrap: wrap;
  }
  .plan-with-image .table-wrap,
  .plan-footer-left {
    max-width: 100%;
  }
  .pkg-image-block,
  .plan-footer-right {
    flex-basis: 100%;
    width: 100%;
    max-width: 320px;
  }
}

/* Bảng form chỉnh gói: giữ fixed để ô input không kéo bảng vô hạn */
.plan-edit table { min-width: 0; width: 100%; table-layout: fixed; }
.plan-edit .pl-name { max-width: 100%; }
.plan-edit th,
.plan-edit td {
  padding: 6px 8px;
  vertical-align: middle;
  white-space: normal;
  width: auto;
}
.plan-edit th:first-child,
.plan-edit td:first-child { text-align: center; width: 56px; }
.plan-edit input[type="text"],
.plan-edit input[type="number"] {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  font-size: 13px;
}
.plan-edit td:nth-child(3) {
  white-space: nowrap;
}
.plan-edit td:nth-child(3) .pl-days {
  width: 4.5rem;
  display: inline-block;
  vertical-align: middle;
}
.plan-edit td:nth-child(3) .small {
  display: inline;
  margin-left: 4px;
  white-space: nowrap;
}

.plan-dialog,
.app-confirm {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: 400px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  color: var(--text);
}
.app-confirm.reset-pw-dialog {
  max-width: 520px;
}
.reset-pw-dialog .pw-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.reset-pw-dialog .pw-row input {
  flex: 1 1 180px;
  min-width: 0;
  margin: 0;
}
.reset-pw-dialog .pw-row .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.reset-pw-dialog .field-hint {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
}
.reset-pw-dialog .field em {
  color: var(--danger);
  font-style: normal;
}
.reset-pw-dialog .reset-pw-note {
  margin: 0;
  line-height: 1.45;
}
.reset-pw-dialog .app-confirm-actions {
  justify-content: flex-end;
  margin-top: 4px;
}
.plan-dialog::backdrop,
.app-confirm::backdrop { background: rgba(15, 23, 42, 0.45); }
.app-confirm-body {
  margin: 0;
  padding: 20px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.app-confirm-body h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
}
.app-confirm-body > p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.app-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin: 0 -18px -16px;
  padding: 12px 18px 16px;
}

/* Popup chào — giống shop GTP */
.welcome-modal {
  border: none;
  border-radius: 22px;
  padding: 0;
  max-width: 440px;
  width: calc(100% - 28px);
  background: #fff;
  color: #0f172a;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}
.welcome-modal::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(2px);
}
.welcome-modal-inner {
  margin: 0;
  padding: 22px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.welcome-modal-title {
  margin: 0;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.35;
  color: #0f172a;
}
@media (max-width: 640px) {
  .welcome-modal-title { font-size: 1.05rem; }
}
.welcome-modal-body {
  margin: 0;
  text-align: center;
  font-size: 0.98rem;
  line-height: 1.55;
  color: #334155;
  word-break: break-word;
}
.welcome-modal-body a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: underline;
  border: none;
  outline: none;
  box-shadow: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
}
.welcome-modal-body a:focus,
.welcome-modal-body a:focus-visible {
  outline: none;
  border: none;
  box-shadow: none;
}
.welcome-modal-links {
  margin: 2px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.welcome-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
}
.welcome-btn-ghost {
  background: #fff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 12px !important;
  min-height: 40px;
  padding: 8px 14px;
  font-weight: 600;
}
.welcome-btn-ghost:hover { background: #f8fafc !important; }
.welcome-btn-close {
  background: #6366f1 !important;
  border-color: #6366f1 !important;
  color: #fff !important;
  border-radius: 12px !important;
  min-height: 40px;
  padding: 8px 18px;
  font-weight: 700;
}
.welcome-btn-close:hover { background: #4f46e5 !important; border-color: #4f46e5 !important; }
.contact-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: inherit;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s;
}
a.contact-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  text-decoration: none;
}
.contact-btn span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.contact-btn b { font-size: 0.95rem; font-weight: 800; color: #0f172a; line-height: 1.2; }
.contact-btn small { color: #64748b; font-size: 0.8rem; line-height: 1.2; }
.contact-btn.zalo { border-color: #0068ff55; }
.contact-btn.fb { border-color: #1877f255; }
.contact-btn.web { border-color: #0d948855; }
.contact-logo {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 10px;
  object-fit: cover;
  display: block;
}
.plan-dialog-body {
  margin: 0;
  padding: 20px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.plan-dialog-body h3 { margin: 0; font-size: 1.15rem; font-weight: 800; }
.plan-dialog-body > .muted { margin: -6px 0 0; }
.plan-dialog-features {
  margin: 0;
  gap: 6px;
  font-size: 13px;
  align-items: flex-start;
}
.plan-dialog-features li {
  justify-content: flex-start;
  text-align: left;
}
.credit-buy-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.credit-buy-labels,
.credit-buy-boxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: stretch;
}
.credit-buy-labels span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.credit-buy-qty {
  width: 100%;
  margin: 0;
  min-height: 44px;
  box-sizing: border-box;
}
.credit-buy-total-box {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-sizing: border-box;
}
.credit-buy-total-box strong {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--success);
  font-variant-numeric: tabular-nums;
  text-align: left;
  line-height: 1.2;
}
.plan-options { display: flex; flex-direction: column; gap: 8px; }
.plan-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  background: var(--surface-2);
  margin: 0;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.plan-option:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}
.plan-option:has(input:checked) {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.plan-option input[type="radio"] {
  width: auto;
  min-width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  flex: none;
  accent-color: var(--primary);
  cursor: pointer;
}
.plan-option-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
}
.plan-option-price {
  flex: none;
  font-weight: 800;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--success);
}
.plan-dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin: 0 -18px -16px;
  padding: 12px 18px 16px;
}
