/* ==========================================================================
   DIGIDOX UNIFIED DESIGN SYSTEM — Sora & Inter Aesthetic
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #f6f5ff;
  --bg-soft: #eeecfb;
  --surface: #ffffff;
  --surface-2: #f8f7ff;
  --surface-3: #ece8ff;
  --text: #14122b;
  --muted: #6a678a;
  --text-dim: #8b88ab;
  --line: #e4e1fb;
  --primary: #6c4bff;
  --primary-2: #00c2a8;
  --primary-ink: #ffffff;
  --danger: #e5334f;
  --warning: #f59e0b;
  --success: #00c2a8;
  --glow1: rgba(108,75,255,.18);
  --glow2: rgba(0,194,168,.16);
  --shadow: 0 24px 60px -20px rgba(60,40,160,.28);
  --shadow-sm: 0 4px 14px rgba(60,40,160,.08);
  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 8px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --font-heading: "Sora", sans-serif;
  --font-mono: "JetBrains Mono", SFMono-Regular, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0b1f;
    --bg-soft: #14112e;
    --surface: #171433;
    --surface-2: #1e1a42;
    --surface-3: #282357;
    --text: #f1efff;
    --muted: #a29fc8;
    --text-dim: #7a76a3;
    --line: #2a2655;
    --primary: #8b72ff;
    --primary-2: #2ee6c8;
    --primary-ink: #0d0b1f;
    --danger: #ff6b81;
    --warning: #fbbf24;
    --success: #2ee6c8;
    --glow1: rgba(139,114,255,.25);
    --glow2: rgba(46,230,200,.14);
    --shadow: 0 24px 60px -20px rgba(0,0,0,.7);
    --shadow-sm: 0 4px 14px rgba(0,0,0,.3);
  }
}

:root[data-theme="dark"], :root.dark, body.dark {
  --bg: #0d0b1f;
  --bg-soft: #14112e;
  --surface: #171433;
  --surface-2: #1e1a42;
  --surface-3: #282357;
  --text: #f1efff;
  --muted: #a29fc8;
  --text-dim: #7a76a3;
  --line: #2a2655;
  --primary: #8b72ff;
  --primary-2: #2ee6c8;
  --primary-ink: #0d0b1f;
  --danger: #ff6b81;
  --warning: #fbbf24;
  --success: #2ee6c8;
  --glow1: rgba(139,114,255,.25);
  --glow2: rgba(46,230,200,.14);
  --shadow: 0 24px 60px -20px rgba(0,0,0,.7);
  --shadow-sm: 0 4px 14px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.6;
  background:
    radial-gradient(900px 500px at 8% -10%, var(--glow1), transparent 60%),
    radial-gradient(800px 500px at 100% 10%, var(--glow2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--primary-2); outline-offset: 2px; border-radius: 8px; }

.container { width: min(1120px, 100% - 40px); margin-inline: auto; }
.muted { color: var(--muted); }
.center { text-align: center; }

h1, h2, h3, h4, .brand, .btn, .card-title {
  font-family: var(--font-heading);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 68px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
}
.brand:hover { text-decoration: none; }

/* Dynamic Theme Logo */
.logo-theme {
  height: 32px;
  width: auto;
  max-height: 32px;
  display: block;
  border-radius: 8px;
}
@media (max-width: 640px) {
  .logo-theme { height: 27px; max-height: 27px; }
}
.logo-light { display: none; }
.logo-dark { display: block; }

:root[data-theme="light"] .logo-dark,
body:not(.dark)[data-theme="light"] .logo-dark {
  display: none !important;
}
:root[data-theme="light"] .logo-light,
body:not(.dark)[data-theme="light"] .logo-light {
  display: block !important;
}

:root[data-theme="dark"] .logo-light,
body.dark .logo-light {
  display: none !important;
}
:root[data-theme="dark"] .logo-dark,
body.dark .logo-dark {
  display: block !important;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .logo-dark { display: none; }
  :root:not([data-theme="dark"]) .logo-light { display: block; }
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  font-size: 1rem;
  font-weight: 800;
  box-shadow: 0 4px 12px var(--glow1);
}
.nav { display: flex; gap: 4px; margin-inline: auto; }
.nav a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 500;
  font-size: .94rem;
}
.nav a:hover { color: var(--text); background: var(--line); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--surface); box-shadow: 0 0 0 1px var(--line); }

.header-actions { display: flex; gap: 8px; align-items: center; }
.lang-select, .icon-btn {
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color .15s, transform .15s;
}
.lang-select { padding: 0 10px; }
.icon-btn { width: 38px; font-size: 1.05rem; }
.icon-btn:hover, .lang-select:hover { border-color: var(--primary); transform: translateY(-1px); }

/* Hero */
.hero { padding: 72px 0 64px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.merchant-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .85rem;
  font-weight: 600;
}
.merchant-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-2);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-2) 25%, transparent);
}
h1 {
  font-size: clamp(2.3rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.03em;
  margin: 22px 0 16px;
  background: linear-gradient(120deg, var(--text) 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead { font-size: 1.1rem; color: var(--muted); max-width: 46ch; margin: 0 0 32px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; max-width: 46ch; }
.steps li { display: flex; gap: 14px; align-items: flex-start; color: var(--muted); font-size: .96rem; }
.steps b {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--primary);
  font-weight: 700;
  font-size: .85rem;
  font-family: var(--font-heading);
}

/* Card & Form */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  position: relative;
}
.card + .card { margin-top: 20px; }
.card-title { font-size: 1.2rem; font-weight: 700; margin: 0 0 22px; }

.form-group { margin-bottom: 20px; position: relative; }
label { display: block; margin-bottom: 8px; font-weight: 600; font-size: .92rem; }

/* Modern Universal Form Inputs */
input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="file"]),
select, textarea {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
  box-sizing: border-box;
}
textarea { height: auto; padding: 14px 16px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="file"]):focus,
select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 22%, transparent);
}
.help { margin: 8px 0 0; font-size: .82rem; color: var(--muted); }
.error { color: var(--danger); font-size: .85rem; margin-top: 6px; font-weight: 500; }
.error:empty { display: none; }

.terms { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: .92rem; }
.terms input { width: 20px; height: 20px; accent-color: var(--primary); margin: 0; }
.terms label { margin: 0; font-weight: 400; }
.terms .error { flex-basis: 100%; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 26px;
  border-radius: 14px;
  border: 0;
  font-weight: 700;
  font-size: 1rem;
  font-family: var(--font-heading);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
  text-decoration: none !important;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  width: 100%;
  color: #fff;
  background: linear-gradient(120deg, var(--primary), #9a4bff 55%, var(--primary-2) 140%);
  box-shadow: 0 12px 28px -10px var(--primary);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px -10px var(--primary);
  color: #fff;
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn-ghost {
  height: 44px;
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger {
  height: 40px;
  background: color-mix(in srgb, var(--danger) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger);
  padding: 0 14px;
  font-size: .85rem;
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}
.btn-sm {
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: .86rem;
}
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding: 18px 22px;
  border-radius: 16px;
  border: 1px dashed var(--line);
}
.status-row p { margin: 0; font-weight: 500; }

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-family: var(--font-heading);
}
.badge-pending {
  background: color-mix(in srgb, var(--warning) 16%, transparent);
  color: var(--warning);
  border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
}
.badge-processing {
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
}
.badge-completed {
  background: color-mix(in srgb, var(--primary-2) 16%, transparent);
  color: var(--primary-2);
  border: 1px solid color-mix(in srgb, var(--primary-2) 30%, transparent);
}
.badge-canceled {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
}

/* Notices */
.notice {
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 20px;
  border: 1px solid;
}
.notice strong { display: block; margin-bottom: 4px; font-family: var(--font-heading); }
.notice p { margin: 0; font-size: .9rem; }
.notice-warning {
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--warning) 35%, var(--line));
}
.notice-warning strong { color: var(--warning); }
.notice-info {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
}
.notice-info strong { color: var(--primary); }

/* Credentials layout */
.creds { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.cred-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
  padding: 20px;
}
.cred-panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.cred-panel-ico {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
}
.cred-panel-head h4 { margin: 0; font-size: 1.05rem; }
.cred-panel-head p { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }
.cred-table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.cred-line {
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cred-key {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.cred-val-wrap { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cred-val { font-size: .95rem; font-weight: 600; word-break: break-all; }
.cred-val.mono, code { font-family: var(--font-mono); }
.cred-copy-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  font-size: .95rem;
}
.cred-copy-btn:hover { color: var(--primary); background: var(--bg); }

.cred-sub { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.cred-sub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: .92rem;
}
.cred-hint { font-size: .78rem; color: var(--muted); font-weight: 400; }
.backup-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(5, auto);
  grid-auto-columns: minmax(0, 1fr);
  column-gap: clamp(24px, 6vw, 60px);
  row-gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
}
.backup-code {
  display: block;
  font-family: var(--font-mono);
  font-size: .92rem;
  letter-spacing: .06em;
  color: var(--text);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}
.backup-code:hover { background: var(--bg); color: var(--primary); }
.backup-note { margin: 12px 0 0; font-size: .82rem; color: var(--muted); }
.backup-copy.is-copied {
  color: var(--primary-2);
  border-color: var(--primary-2);
}

/* ==========================================================================
   ADMIN DASHBOARD LAYOUT (Matching Sora/Inter Purple-Cyan Design)
   ========================================================================== */

.admin-body { background: var(--bg); }
.admin-wrap {
  display: block;
  width: 100%;
  min-height: 100vh;
}

.admin-wrap.not-authed {
  display: flex !important;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}
.admin-wrap.not-authed .admin-main {
  width: 100%;
  max-width: 480px;
  padding: 24px 16px;
  margin: auto;
}

/* Off-canvas Slide-out Sidebar (Hidden by default) */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 300;
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.35);
}
.sidebar.open {
  transform: translateX(0);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 11, 31, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 290;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-burger-btn {
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  transition: transform .15s, border-color .15s;
}
.sidebar-burger-btn:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}

.sidebar-header { margin-bottom: 30px; padding: 0 4px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--muted);
  font-weight: 600;
  font-size: .92rem;
  transition: all .15s ease;
  text-decoration: none;
}
.sidebar a:hover {
  background: var(--bg);
  color: var(--text);
}
.sidebar a.active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 14%, var(--surface)), color-mix(in srgb, var(--primary-2) 10%, var(--surface)));
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--line));
  box-shadow: 0 4px 14px var(--glow1);
}
.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--line);
}
.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .85rem;
}
.sidebar-user-name { font-size: .84rem; font-weight: 700; }
.sidebar-user-role { font-size: .72rem; color: var(--primary-2); font-weight: 600; }

.admin-main { padding: 32px 48px; width: 100%; max-width: 100%; box-sizing: border-box; }
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.admin-top-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.admin-title-area {
  min-width: 0;
}
.admin-breadcrumb {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-bottom: 2px;
}
#viewTitle {
  margin: 0;
  font-size: 1.95rem;
  font-family: var(--font-heading);
  letter-spacing: -.02em;
}
.admin-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.admin-top-actions .icon-btn {
  width: 42px;
  height: 42px;
  font-size: 1.15rem;
}
.admin-top-actions .btn {
  height: 42px;
  padding: 0 18px;
  font-size: 0.9rem;
}

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 30px;
  width: 100%;
}
@media (max-width: 1280px) {
  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}
.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.stat-ico {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}
.stat .num {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
  font-family: var(--font-heading);
  letter-spacing: -.03em;
  background: linear-gradient(135deg, var(--text) 40%, var(--primary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat .lbl { font-size: .84rem; color: var(--muted); font-weight: 600; margin-bottom: 6px; }

/* Quick Action Cards */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 36px;
  width: 100%;
}
@media (max-width: 1100px) {
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .quick-grid {
    grid-template-columns: 1fr;
  }
}
.quick-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  cursor: pointer;
  transition: all .2s;
}
.quick-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.quick-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--glow1), var(--glow2));
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  margin-bottom: 14px;
}
.quick-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; font-family: var(--font-heading); }
.quick-desc { font-size: .84rem; color: var(--muted); }

/* Table Wrap */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-top: 14px;
}
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 14px 18px; font-size: .9rem; border-bottom: 1px solid var(--line); }
th {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  background: var(--bg);
  font-family: var(--font-heading);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }
td code {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: .85rem;
  color: var(--primary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 11, 31, .7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  z-index: 200;
  padding: 20px;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 10px;
  font-size: .86rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--primary-2);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-heading);
}

.combo-list {
  position: absolute;
  z-index: 40;
  left: 0; right: 0; top: 100%;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.combo-list div { padding: 10px 14px; cursor: pointer; font-size: .92rem; }
.combo-list div:hover { background: var(--bg); color: var(--primary); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 48px 0 24px;
  margin-top: 48px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
}
.site-footer h4 {
  font-weight: 700;
  font-size: 1rem;
  margin: 0 0 12px;
  font-family: var(--font-heading);
}
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer li a { color: var(--muted); }
.site-footer li a:hover { color: var(--primary); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: .88rem;
  color: var(--muted);
}

/* Toast */
.dgx-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  font-weight: 600;
  font-size: .88rem;
}
.dgx-toast.success { border-color: var(--primary-2); color: var(--primary-2); }

.hidden { display: none !important; }
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Pagination Styles */
.pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}
.pagination-info {
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 500;
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}
.page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--surface);
}
.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--glow1);
}
.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.page-ellipsis {
  padding: 0 4px;
  color: var(--muted);
  font-weight: 700;
  user-select: none;
}

.table-wrap table {
  min-width: 620px;
}

@media (max-width: 900px) {
  .hero { padding: 40px 0; }
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .admin-wrap { display: flex; flex-direction: column; width: 100%; min-height: 100vh; }
  /* Sidebar stays fixed drawer on all devices, NEVER static! */
  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh !important;
    width: min(300px, 85vw);
    z-index: 300;
  }
  .nav { display: none; }
  .header-actions { margin-left: auto; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .admin-main { padding: 20px 16px; width: 100%; max-width: 100%; }
}

@media (max-width: 640px) {
  .admin-main { padding: 14px 10px; }
  .admin-topbar {
    margin-bottom: 18px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .admin-top-left { gap: 10px; flex: 1; min-width: 0; }
  .admin-title-area h1 {
    font-size: 1.35rem !important;
    line-height: 1.15;
  }
  .sidebar-burger-btn {
    width: 38px !important;
    height: 38px !important;
    font-size: 1.15rem !important;
    flex-shrink: 0;
  }
  .admin-top-actions { gap: 8px; flex-shrink: 0; }
  .admin-top-actions .btn {
    height: 36px !important;
    padding: 0 12px !important;
    font-size: 0.8rem !important;
  }
  .admin-top-actions .icon-btn {
    width: 36px !important;
    height: 36px !important;
  }
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin-bottom: 20px;
  }
  .stat {
    padding: 14px 12px;
  }
  .stat .num {
    font-size: 1.6rem;
  }
  .stat-ico {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
  .quick-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
    margin-bottom: 24px;
  }
  .quick-card {
    padding: 16px;
  }
  .pagination-wrap {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
  }
  .card { padding: 18px; }
  .status-row { flex-direction: column; align-items: stretch; text-align: center; }
  .backup-grid { grid-auto-flow: row; grid-template-rows: none; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
  .stat-grid {
    grid-template-columns: 1fr !important;
  }
}
