/* ================================================================
   MAPTECH INTERNET — Design System
   Aesthetic: Dark-mode premium ISP. Deep slate + electric teal.
   Fonts: Plus Jakarta Sans (display) + JetBrains Mono (codes)
================================================================ */

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

/* ---- Tokens ---- */
:root {
  --brand:       #00D4AA;
  --brand-dim:   rgba(0,212,170,.15);
  --brand-dk:    #00a886;
  --accent:      #3B82F6;
  --warn:        #F59E0B;
  --danger:      #EF4444;
  --danger-dim:  rgba(239,68,68,.12);
  --success:     #10B981;
  --success-dim: rgba(16,185,129,.12);

  /* Dark surfaces */
  --bg:          #0B0F19;
  --surface:     #111827;
  --surface-2:   #1A2235;
  --surface-3:   #1F2D42;
  --border:      rgba(255,255,255,.08);
  --border-brand:rgba(0,212,170,.3);

  /* Text */
  --text:        #F1F5F9;
  --text-2:      #94A3B8;
  --text-3:      #475569;

  /* Shadows */
  --glow:        0 0 40px rgba(0,212,170,.12);
  --shadow:      0 4px 24px rgba(0,0,0,.4);
  --shadow-lg:   0 12px 48px rgba(0,0,0,.5);

  --radius:      14px;
  --radius-sm:   8px;
  --radius-lg:   20px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4,h5 { font-family: 'Plus Jakarta Sans', sans-serif; line-height: 1.2; font-weight: 700; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dk); }
img { max-width: 100%; display: block; }
code, .mono { font-family: 'JetBrains Mono', monospace; }

/* ---- Utils ---- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-2); }
.mt-1 { margin-top: 8px; }  .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; } .gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.items-center { align-items: center; }
.w-full { width: 100%; }

/* ================================================================
   BUTTONS
================================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  border: none; border-radius: 10px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600; font-size: 14px;
  cursor: pointer; transition: all .2s;
  text-decoration: none; width: 100%;
  position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,0);
  transition: background .2s;
}
.btn:hover::after { background: rgba(255,255,255,.06); }

.btn-primary   { background: var(--brand); color: #0B0F19; font-weight: 700; }
.btn-primary:hover { background: var(--brand-dk); color: #0B0F19; }
.btn-accent    { background: var(--accent); color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-ghost     { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-outline   { background: transparent; border: 1.5px solid var(--brand); color: var(--brand); }
.btn-outline:hover { background: var(--brand-dim); }
.btn-sm        { padding: 7px 14px; font-size: 12px; border-radius: 7px; width: auto; }
.btn-xs        { padding: 5px 10px; font-size: 11px; border-radius: 6px; width: auto; }
.btn:disabled  { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ================================================================
   FORM ELEMENTS
================================================================ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-2); margin-bottom: 7px;
  text-transform: uppercase; letter-spacing: .7px;
}
.form-control {
  width: 100%; padding: 11px 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  color: var(--text); font-family: 'Plus Jakarta Sans', sans-serif; font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-control:focus  { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,212,170,.12); }
.form-control.error  { border-color: var(--danger); }
.form-control::placeholder { color: var(--text-3); }
select.form-control  { cursor: pointer; }

.form-hint { font-size: 12px; color: var(--text-2); margin-top: 5px; }

/* ================================================================
   ALERTS
================================================================ */
.alert {
  padding: 12px 16px; border-radius: 9px;
  font-size: 14px; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid transparent;
}
.alert-error   { background: var(--danger-dim);  color: #FCA5A5; border-color: rgba(239,68,68,.25); }
.alert-success { background: var(--success-dim); color: #6EE7B7; border-color: rgba(16,185,129,.25); }
.alert-info    { background: var(--brand-dim);   color: var(--brand); border-color: var(--border-brand); }
.alert-warn    { background: rgba(245,158,11,.1); color: #FCD34D; border-color: rgba(245,158,11,.25); }

/* ================================================================
   BADGES
================================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .3px;
}
.badge-success { background: var(--success-dim); color: #6EE7B7; }
.badge-danger  { background: var(--danger-dim);  color: #FCA5A5; }
.badge-warn    { background: rgba(245,158,11,.12); color: #FCD34D; }
.badge-muted   { background: rgba(255,255,255,.06); color: var(--text-2); }
.badge-brand   { background: var(--brand-dim); color: var(--brand); }

/* ================================================================
   SPINNER
================================================================ */
.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .6s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   ██████╗  ██████╗ ██████╗ ████████╗ █████╗ ██╗
   ██╔══██╗██╔═══██╗██╔══██╗╚══██╔══╝██╔══██╗██║
   ██████╔╝██║   ██║██████╔╝   ██║   ███████║██║
   ██╔═══╝ ██║   ██║██╔══██╗   ██║   ██╔══██║██║
   ██║     ╚██████╔╝██║  ██║   ██║   ██║  ██║███████╗
   ╚═╝      ╚═════╝ ╚═╝  ╚═╝   ╚═╝   ╚═╝  ╚═╝╚══════╝
   Captive portal + public pages
================================================================ */

/* ---- Animated mesh background ---- */
.portal-wrap {
  min-height: 100vh;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 32px 16px 48px;
  position: relative; overflow: hidden;
}
.portal-wrap::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(0,212,170,.13) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(59,130,246,.10) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(0,212,170,.05) 0%, transparent 70%);
  pointer-events: none;
}
.portal-wrap > * { position: relative; z-index: 1; }

/* Logo */
.portal-logo { text-align: center; margin-bottom: 28px; }
.portal-logo .logo-mark {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; margin: 0 auto 14px;
  box-shadow: 0 8px 32px rgba(0,212,170,.3);
}
.portal-logo h1 {
  font-size: 24px; font-weight: 800; color: var(--text);
  letter-spacing: -.3px;
}
.portal-logo p { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.portal-logo .device-info {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; padding: 4px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; font-size: 11px; color: var(--text-2); font-family: 'JetBrains Mono', monospace;
}

/* Portal card */
.portal-card {
  width: 100%; max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), var(--glow);
  overflow: hidden;
}

/* Tabs */
.portal-tabs { display: flex; border-bottom: 1px solid var(--border); }
.portal-tab {
  flex: 1; padding: 15px 10px;
  text-align: center;
  font-weight: 600; font-size: 13px;
  color: var(--text-2); cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .2s; background: transparent;
  border-top: none; border-left: none; border-right: none;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.portal-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.portal-tab:hover:not(.active) { color: var(--text); }

.portal-body { padding: 24px; }

/* Voucher input */
.voucher-input-wrap {
  display: flex; gap: 8px;
}
.voucher-input-wrap .form-control {
  flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 16px;
  letter-spacing: 2px; text-transform: uppercase; font-weight: 600;
}
.voucher-input-wrap .btn { width: auto; padding: 11px 20px; }

/* Plan cards */
.plan-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.plan-card {
  border: 1.5px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  cursor: pointer; transition: all .2s;
  display: flex; align-items: center; gap: 14px;
  background: var(--surface-2);
}
.plan-card:hover  { border-color: var(--brand); background: var(--surface-3); }
.plan-card.selected { border-color: var(--brand); background: rgba(0,212,170,.06); box-shadow: 0 0 0 1px rgba(0,212,170,.2); }
.plan-card input[type=radio] { display: none; }
.plan-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--brand-dim); display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.plan-info { flex: 1; }
.plan-name { font-weight: 700; font-size: 14px; color: var(--text); }
.plan-desc { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.plan-price { font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 18px; color: var(--brand); }

/* ---- Success page ---- */
.success-wrap {
  min-height: 100vh;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  position: relative; overflow: hidden;
}
.success-wrap::before {
  content: ''; position: fixed; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0,212,170,.15) 0%, transparent 60%);
  pointer-events: none;
}
.success-card {
  position: relative; z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  max-width: 420px; width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg), var(--glow);
}
.success-icon {
  width: 68px; height: 68px; border-radius: 50%;
  background: var(--success-dim); border: 2px solid rgba(16,185,129,.3);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px; font-size: 30px;
}
.voucher-code-display {
  background: var(--surface-2);
  border: 1.5px dashed var(--border-brand);
  border-radius: 12px; padding: 20px; margin: 20px 0;
}
.voucher-code-display .code {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600; font-size: 28px; letter-spacing: 4px; color: var(--brand);
}
.voucher-code-display .plan-label { font-size: 12px; color: var(--text-2); margin-top: 6px; }
.copy-btn {
  background: none; border: 1px solid var(--border-brand);
  color: var(--brand); border-radius: 6px; padding: 4px 10px;
  font-size: 12px; cursor: pointer; margin-top: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif; transition: all .2s;
}
.copy-btn:hover { background: var(--brand-dim); }

/* ---- Home page ---- */
.home-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  background: rgba(17,24,39,.8);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 100;
}
.home-nav .brand-name {
  font-weight: 800; font-size: 17px; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.home-nav .brand-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
  box-shadow: 0 0 8px var(--brand);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: .7; }
}

.home-hero {
  padding: 64px 20px 80px;
  text-align: center;
  position: relative;
}
.home-hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 0%, rgba(0,212,170,.12), transparent 70%);
  pointer-events: none;
}
.home-hero h1 {
  font-size: clamp(32px, 6vw, 52px);
  font-weight: 800; letter-spacing: -1.5px; line-height: 1.1;
  position: relative;
}
.home-hero h1 em { font-style: normal; color: var(--brand); }
.home-hero p { font-size: 17px; color: var(--text-2); margin: 16px auto 32px; max-width: 400px; }
.home-hero .hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.home-hero .hero-btns .btn { width: auto; min-width: 160px; }

.home-plans {
  max-width: 520px; margin: 0 auto;
  padding: 0 20px 64px;
}
.home-plans h2 { font-size: 22px; font-weight: 800; margin-bottom: 20px; text-align: center; }

.plan-feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 20px 22px;
  margin-bottom: 12px;
  display: flex; justify-content: space-between; align-items: center;
  transition: border-color .2s, box-shadow .2s;
}
.plan-feature-card:hover { border-color: var(--border-brand); box-shadow: 0 0 20px rgba(0,212,170,.08); }
.plan-feature-card .left .name { font-weight: 700; font-size: 16px; }
.plan-feature-card .left .dur  { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.plan-feature-card .price-block { font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 22px; color: var(--brand); text-align: right; }
.plan-feature-card .price-block small { display: block; font-size: 11px; font-weight: 400; color: var(--text-2); }

.home-footer {
  text-align: center; padding: 24px;
  color: var(--text-3); font-size: 12px;
  border-top: 1px solid var(--border);
}

/* ================================================================
   ADMIN LAYOUT
================================================================ */
.admin-layout { display: flex; min-height: 100vh; background: var(--bg); }

/* ---- Sidebar ---- */
.admin-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,212,170,.3);
}
.sidebar-logo .logo-text { font-size: 13px; font-weight: 700; line-height: 1.2; }
.sidebar-logo .logo-text small { display: block; font-size: 10px; color: var(--text-2); font-weight: 400; }

.sidebar-nav { flex: 1; padding: 12px 8px; }
.nav-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-3); padding: 10px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .15s; text-decoration: none;
  margin-bottom: 2px; border: none; background: none; width: 100%; text-align: left;
}
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand-dim); color: var(--brand); font-weight: 600; }
.nav-item.active .nav-icon { filter: drop-shadow(0 0 4px var(--brand)); }
.nav-item.danger:hover { background: var(--danger-dim); color: #FCA5A5; }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9px;
  background: var(--surface-2);
}
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #0B0F19; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info .uname { font-size: 13px; font-weight: 600; truncate: ellipsis; }
.sidebar-user-info .urole { font-size: 11px; color: var(--text-2); }

/* ---- Main content ---- */
.admin-main { flex: 1; overflow-x: hidden; display: flex; flex-direction: column; }

.admin-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 50;
}
.admin-topbar .page-title { font-size: 18px; font-weight: 700; }
.admin-topbar .topbar-right { display: flex; align-items: center; gap: 12px; }

.admin-content { padding: 24px 28px; flex: 1; }

/* ---- Stat cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative; overflow: hidden;
  transition: border-color .2s;
}
.stat-card:hover { border-color: var(--border-brand); }
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  opacity: 0; transition: opacity .2s;
}
.stat-card:hover::before { opacity: 1; }
.stat-card .s-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-2); margin-bottom: 10px; }
.stat-card .s-value { font-family: 'JetBrains Mono', monospace; font-size: 28px; font-weight: 600; color: var(--text); }
.stat-card .s-value.brand { color: var(--brand); }
.stat-card .s-sub { font-size: 12px; color: var(--text-2); margin-top: 6px; }

/* ---- Section card ---- */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}
.section-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.section-card-header h3 { font-size: 15px; font-weight: 700; }
.section-card-body { padding: 20px; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 10px 16px;
  text-align: left; font-size: 11px; text-transform: uppercase;
  letter-spacing: .7px; color: var(--text-2); font-weight: 600;
  background: var(--surface-2); white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,.02); }
.mono-cell { font-family: 'JetBrains Mono', monospace; font-size: 12px; }

/* ---- Checkbox ---- */
.cb-wrap { display: flex; align-items: center; justify-content: center; }
input[type=checkbox] {
  width: 16px; height: 16px; cursor: pointer;
  accent-color: var(--brand);
}

/* ---- Pagination ---- */
.pagination {
  display: flex; align-items: center; gap: 6px;
  padding: 14px 20px; border-top: 1px solid var(--border);
  justify-content: flex-end; flex-wrap: wrap;
}
.page-btn {
  padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
  cursor: pointer; transition: all .15s; text-decoration: none;
  display: inline-flex; align-items: center;
}
.page-btn:hover { border-color: var(--brand); color: var(--brand); }
.page-btn.active { background: var(--brand); color: #0B0F19; border-color: var(--brand); }

/* ---- Settings tabs ---- */
.settings-tabs {
  display: flex; gap: 4px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); flex-wrap: wrap;
}
.settings-tab {
  padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--text-2); cursor: pointer; border: 1px solid transparent;
  transition: all .2s; background: none; font-family: 'Plus Jakarta Sans', sans-serif;
}
.settings-tab.active { background: var(--brand-dim); color: var(--brand); border-color: var(--border-brand); }
.settings-tab:hover:not(.active) { background: var(--surface-3); color: var(--text); }

/* ---- Webhook box ---- */
.webhook-box {
  background: var(--surface-2);
  border: 1px solid var(--border-brand);
  border-radius: 9px; padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
}
.webhook-box .wh-url {
  flex: 1; font-family: 'JetBrains Mono', monospace;
  font-size: 13px; color: var(--brand); word-break: break-all;
}
.webhook-box .wh-copy {
  background: var(--brand-dim); border: 1px solid var(--border-brand);
  color: var(--brand); border-radius: 6px; padding: 6px 12px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif; white-space: nowrap;
  transition: all .2s; flex-shrink: 0;
}
.webhook-box .wh-copy:hover { background: var(--brand); color: #0B0F19; }

/* ---- Form grid ---- */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---- Profile card ---- */
.profile-header {
  display: flex; align-items: center; gap: 16px;
  padding: 24px; border-bottom: 1px solid var(--border);
}
.profile-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #0B0F19; flex-shrink: 0;
}
.profile-info .name { font-size: 18px; font-weight: 700; }
.profile-info .role { font-size: 13px; color: var(--text-2); }

/* ---- Voucher available pills ---- */
.avail-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.avail-pill {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 18px;
  min-width: 110px;
}
.avail-pill .ap-label { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.avail-pill .ap-count { font-family: 'JetBrains Mono', monospace; font-size: 26px; font-weight: 600; color: var(--brand); }
.avail-pill .ap-name  { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ---- Bulk action bar ---- */
.bulk-bar {
  background: var(--brand-dim);
  border: 1px solid var(--border-brand);
  border-radius: 9px; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.bulk-bar .bulk-info { font-size: 13px; font-weight: 600; color: var(--brand); }

/* ---- Admin login ---- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px;
  position: relative; overflow: hidden;
}
.login-wrap::before {
  content: ''; position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 30% 30%, rgba(0,212,170,.08), transparent 60%),
    radial-gradient(ellipse 50% 40% at 70% 70%, rgba(59,130,246,.06), transparent 60%);
  pointer-events: none;
}
.login-card {
  position: relative; z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px; width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center; margin-bottom: 32px;
}
.login-logo .mark {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  border-radius: 14px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  box-shadow: 0 6px 24px rgba(0,212,170,.3);
}
.login-logo h1 { font-size: 20px; font-weight: 800; }
.login-logo p  { font-size: 13px; color: var(--text-2); margin-top: 4px; }

/* ---- 404 ---- */
.error-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 24px; background: var(--bg);
}
.error-wrap .err-code {
  font-family: 'JetBrains Mono', monospace; font-size: 80px; font-weight: 600;
  color: var(--brand); line-height: 1; margin-bottom: 16px;
  opacity: .4;
}

/* ================================================================
   RESPONSIVE
================================================================ */
@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center;
    padding: 0; overflow-x: auto;
  }
  .sidebar-logo { display: none; }
  .sidebar-nav { display: flex; flex-direction: row; padding: 6px 8px; gap: 4px; }
  .nav-section-label { display: none; }
  .nav-item { white-space: nowrap; padding: 8px 12px; border-radius: 8px; }
  .sidebar-footer { display: none; }
  .admin-content { padding: 16px; }
  .admin-topbar { padding: 12px 16px; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .portal-card { border-radius: 14px; }
}

/* ================================================================
   PLANS MANAGEMENT
================================================================ */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.plan-mgmt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.plan-mgmt-card:hover {
  border-color: var(--border-brand);
  box-shadow: 0 0 24px rgba(0,212,170,.08);
}
.plan-mgmt-card.editing {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(0,212,170,.2);
}

.plan-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.plan-card-title { font-weight: 700; font-size: 15px; }
.plan-card-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px; font-weight: 600; color: var(--brand);
}

.plan-card-body { padding: 16px 18px; }
.plan-card-meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.plan-meta-item { font-size: 13px; color: var(--text-2); }
.plan-meta-item strong { color: var(--text); font-weight: 600; }

.plan-card-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 8px; margin-bottom: 14px;
}
.plan-stat {
  background: var(--surface-2);
  border-radius: 8px; padding: 10px 12px; text-align: center;
}
.plan-stat .ps-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px; font-weight: 600; color: var(--text);
}
.plan-stat .ps-val.green { color: var(--brand); }
.plan-stat .ps-val.red   { color: #FCA5A5; }
.plan-stat .ps-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-2); margin-top: 3px;
}

.plan-card-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
}

/* Edit plan form inline */
.plan-edit-form {
  background: var(--surface-2);
  border: 1.5px solid var(--border-brand);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.plan-edit-form h3 {
  font-size: 15px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}

/* Upload per plan modal backdrop */
.upload-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.upload-modal-card {
  background: var(--surface);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-lg);
  padding: 28px; width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg), var(--glow);
}
.upload-modal-card h3 {
  font-size: 17px; font-weight: 700; margin-bottom: 6px;
}
.upload-modal-card p {
  font-size: 13px; color: var(--text-2); margin-bottom: 18px;
}
.modal-close {
  float: right; background: none; border: none;
  color: var(--text-2); cursor: pointer; font-size: 20px;
  line-height: 1; padding: 0; margin-top: -4px;
}

/* New plan form toggle */
.add-plan-toggle {
  background: var(--surface);
  border: 1.5px dashed var(--border-brand);
  border-radius: var(--radius);
  padding: 20px; text-align: center;
  cursor: pointer; transition: all .2s;
  color: var(--brand);
}
.add-plan-toggle:hover {
  background: var(--brand-dim);
}

.duration-presets {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px;
}
.dur-preset {
  padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); cursor: pointer; transition: all .15s;
}
.dur-preset:hover { border-color: var(--brand); color: var(--brand); }
