/* ═══════════════════════════════════════════════════════
   MODERN SLATE — SkyProTV Mail Admin
   Deep slate • Electric blue • Clean minimal
   Aesthetic: Modern Professional
═══════════════════════════════════════════════════════ */

:root {
  --bg:          #0b0f19;
  --bg2:         #111827;
  --bg3:         #1a2234;
  --surface:     #1e293b;
  --surface2:    #253349;
  --surface3:    #2d3d56;
  --surface4:    #364963;

  --gold-bright: #60a5fa;
  --gold:        #3b82f6;
  --gold-dim:    #2563eb;
  --gold-glow:   rgba(59,130,246,0.18);
  --gold-border: rgba(59,130,246,0.22);
  --gold-border2:rgba(59,130,246,0.45);

  --text:        #e2e8f0;
  --text2:       #94a3b8;
  --text3:       #64748b;
  --text4:       #475569;

  --crimson:     #6366f1;
  --crimson-dim: rgba(99,102,241,0.15);

  --green:       #34d399;
  --green-dim:   rgba(52,211,153,0.14);
  --red:         #f87171;
  --red-dim:     rgba(248,113,113,0.14);
  --amber:       #fbbf24;
  --amber-dim:   rgba(251,191,36,0.14);

  --sb-bg:       #070b14;
  --sb-bg2:      #0c1120;
  --sb-text:     #cbd5e1;
  --sb-muted:    #4b6584;
  --sb-active:   rgba(59,130,246,0.12);

  --shadow-sm:   0 2px 12px rgba(0,0,0,0.4);
  --shadow:      0 4px 24px rgba(0,0,0,0.5);
  --shadow-lg:   0 8px 48px rgba(0,0,0,0.6);
  --shadow-gold: 0 0 24px rgba(59,130,246,0.1);
  --shadow-inset:inset 0 1px 0 rgba(59,130,246,0.06);

  --radius-base: 12px;
  --radius-sm:  7px;
  --radius-xs:  4px;
  --radius-pill: 999px;
}

body.light {
  --bg:          #f1f5f9;
  --bg2:         #e2e8f0;
  --bg3:         #cbd5e1;
  --surface:     #ffffff;
  --surface2:    #f8fafc;
  --surface3:    #f1f5f9;
  --surface4:    #e2e8f0;
  --gold:        #2563eb;
  --gold-bright: #3b82f6;
  --gold-dim:    #60a5fa;
  --gold-glow:   rgba(37,99,235,0.1);
  --gold-border: rgba(37,99,235,0.2);
  --gold-border2:rgba(37,99,235,0.4);
  --text:        #0f172a;
  --text2:       #475569;
  --text3:       #64748b;
  --text4:       #94a3b8;
  --crimson:     #4f46e5;
  --crimson-dim: rgba(79,70,229,0.1);
  --green:       #059669;
  --green-dim:   rgba(5,150,105,0.1);
  --red:         #dc2626;
  --red-dim:     rgba(220,38,38,0.1);
  --amber:       #d97706;
  --amber-dim:   rgba(217,119,6,0.1);
  --sb-bg:       #0f172a;
  --sb-bg2:      #1e293b;
  --sb-text:     #e2e8f0;
  --sb-muted:    #64748b;
  --sb-active:   rgba(59,130,246,0.14);
  --shadow-sm:   0 2px 12px rgba(0,0,0,0.06);
  --shadow:      0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg:   0 8px 48px rgba(0,0,0,0.12);
  --shadow-gold: 0 0 24px rgba(59,130,246,0.06);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 100% 60% at 50% 0%, rgba(59,130,246,0.04) 0%, transparent 70%),
    radial-gradient(ellipse 80% 40% at 0% 100%, rgba(99,102,241,0.02) 0%, transparent 60%);
}

img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--sb-bg) 0%, var(--sb-bg2) 100%);
  border-right: 1px solid var(--gold-border);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}

.sidebar::before {
  content: '';
  display: block; flex-shrink: 0;
  height: 3px;
  background: linear-gradient(90deg,
    transparent 0%, var(--gold-dim) 15%, var(--gold-bright) 40%,
    var(--gold) 50%, var(--gold-bright) 60%, var(--gold-dim) 85%, transparent 100%);
}

.logo { padding: 20px 18px 16px; border-bottom: 1px solid var(--gold-border); }
.logo img { max-width: 140px; max-height: 44px; margin-bottom: 10px; }
.logo > div {
  font-size: 17px; font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 0.03em;
  text-shadow: 0 0 24px rgba(96,165,250,0.3), 0 2px 4px rgba(0,0,0,0.5);
  font-family: system-ui, -apple-system, sans-serif;
}
.logo small {
  display: inline-flex; align-items: center;
  margin-top: 6px; font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold);
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.22);
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-family: system-ui, sans-serif;
}

.nav {
  flex: 1; padding: 12px 10px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto; overflow-x: hidden; min-height: 0;
}
.nav::-webkit-scrollbar { width: 3px; }
.nav::-webkit-scrollbar-thumb { background: var(--gold-border); border-radius: 3px; }

.nav button {
  position: relative; border: none;
  text-align: left; border-radius: var(--radius-sm);
  padding: 10px 14px 10px 18px;
  background: transparent; color: var(--sb-muted);
  cursor: pointer; font-weight: 400;
  font-size: 13.5px; font-family: system-ui, sans-serif;
  transition: all 0.2s ease; letter-spacing: 0.01em;
  overflow: hidden;
}
.nav button::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px; height: 65%;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border-radius: 0 2px 2px 0;
  transition: transform 0.2s ease;
}
.nav button:hover { background: rgba(59,130,246,0.07); color: var(--sb-text); }
.nav button.active { background: var(--sb-active); color: var(--gold-bright); font-weight: 600; }
.nav button.active::before { transform: translateY(-50%) scaleY(1); }

.footer-user {
  padding: 14px 18px;
  border-top: 1px solid var(--gold-border);
  flex-shrink: 0; background: var(--sb-bg);
}
.footer-user .u-name {
  font-size: 13.5px; font-weight: 700; color: var(--gold-bright);
  font-family: system-ui, sans-serif; letter-spacing: 0.01em;
}
.footer-user .u-email {
  font-size: 11.5px; color: var(--sb-muted);
  margin: 2px 0 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: system-ui, sans-serif;
}

.main {
  min-width: 0; display: flex; flex-direction: column;
  background: var(--bg);
  background-image: radial-gradient(ellipse 60% 40% at 80% 10%, rgba(59,130,246,0.03) 0%, transparent 60%);
}

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg2);
  border-bottom: 1px solid var(--gold-border);
  padding: 0 28px;
  display: flex; align-items: stretch; gap: 16px;
  min-height: 56px;
}
.topbar::after {
  content: '';
  position: absolute; bottom: -1px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.4;
}
.topbar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.topbar h1 {
  font-size: 20px; font-weight: 700;
  letter-spacing: 0.01em; line-height: 1.2; margin: 0;
  color: var(--gold-bright);
  text-shadow: 0 0 20px rgba(96,165,250,0.2);
  font-family: system-ui, -apple-system, sans-serif;
}
.topbar .muted { font-size: 11.5px; font-family: system-ui, sans-serif; margin-top: 1px; }
.top-actions { display: flex; gap: 8px; align-items: center; }

.page-body { padding: 24px 28px; flex: 1; }

.ornate-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 0 20px; color: var(--gold);
}
.ornate-divider::before, .ornate-divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-border2), transparent);
}

.grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-base);
  padding: 20px 22px;
  position: relative; overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
  box-shadow: var(--shadow-sm), var(--shadow-inset);
}
.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
  opacity: 0; transition: opacity 0.25s;
}
.card::after {
  content: '●';
  position: absolute; top: 10px; right: 12px;
  font-size: 5px; color: var(--gold-border2); opacity: 0;
  transition: opacity 0.25s;
}
.card:hover { border-color: var(--gold-border2); box-shadow: var(--shadow), var(--shadow-gold); transform: translateY(-2px); }
.card:hover::before, .card:hover::after { opacity: 1; }

.card .muted {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 10px; font-family: system-ui, sans-serif;
  color: var(--text3);
}

.stat {
  font-size: 34px; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1;
  color: var(--gold-bright);
  font-family: 'Courier New', monospace;
  text-shadow: 0 0 20px rgba(96,165,250,0.15);
}

.kpi-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 20px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-base);
  margin-bottom: 20px;
  padding: 22px 24px;
  position: relative;
  box-shadow: var(--shadow-sm), var(--shadow-inset);
}
.panel::before {
  content: '';
  position: absolute; top: 0; left: 24px; right: 24px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-border2), transparent);
}
.panel::after {
  content: '●';
  position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  font-size: 8px; color: var(--gold); text-shadow: 0 0 8px rgba(59,130,246,0.5); line-height: 1;
}
.panel h2 {
  font-size: 10px; font-weight: 800;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 18px;
  display: flex; align-items: center; gap: 10px;
  font-family: system-ui, sans-serif;
}
.panel h2::before {
  content: '';
  display: inline-block; width: 3px; height: 13px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border-radius: 2px; flex-shrink: 0;
}
.panel h2::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold-border), transparent); }
.panel .table-wrap {
  margin: 0 -24px -22px;
  border-radius: 0 0 var(--radius-base) var(--radius-base);
  border-left: none; border-right: none; border-bottom: none;
  border-top: 1px solid var(--gold-border);
}

.form-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }

label {
  font-size: 10px; font-weight: 800;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text3); font-family: system-ui, sans-serif;
}

input, select, textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--gold-border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  outline: none; font-size: 13.5px;
  font-family: system-ui, sans-serif;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}
input::placeholder, textarea::placeholder { color: var(--text4); opacity: 0.8; }
input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  background: var(--surface3);
  box-shadow: 0 0 0 3px var(--gold-glow), inset 0 1px 3px rgba(0,0,0,0.15);
}
textarea { resize: vertical; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none; border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-weight: 600; font-size: 13px;
  cursor: pointer; transition: all 0.18s ease;
  letter-spacing: 0.03em; white-space: nowrap;
  font-family: system-ui, sans-serif;
  position: relative; overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 60%);
  pointer-events: none;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn:active { transform: translateY(0) scale(0.98); filter: brightness(0.95); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; }

.btn-primary {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 40%, #2563eb 100%);
  color: #ffffff; font-weight: 700;
  border: 1px solid rgba(96,165,250,0.4);
  box-shadow: 0 4px 18px rgba(59,130,246,0.35), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-primary:hover { box-shadow: 0 6px 28px rgba(59,130,246,0.5); }

.btn-success {
  background: linear-gradient(135deg, #34d399, #059669);
  color: #d4ffd4; border: 1px solid rgba(52,211,153,0.3);
  box-shadow: 0 4px 14px rgba(5,150,105,0.3);
}
.btn-warning {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #451a03; border: 1px solid rgba(251,191,36,0.35);
  box-shadow: 0 4px 14px rgba(217,119,6,0.3);
}
.btn-danger {
  background: linear-gradient(135deg, #f87171, #dc2626);
  color: #ffe0e0; border: 1px solid rgba(248,113,113,0.3);
  box-shadow: 0 4px 14px rgba(220,38,38,0.3);
}
.btn-light {
  background: var(--surface3); color: var(--text2);
  border: 1px solid var(--gold-border);
  box-shadow: var(--shadow-sm);
}
.btn-light:hover { background: var(--surface4); color: var(--text); border-color: var(--gold-border2); }

.table-wrap { overflow: auto; border-radius: var(--radius-sm); border: 1px solid var(--gold-border); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th {
  background: linear-gradient(180deg, var(--surface3), var(--surface2));
  padding: 11px 16px; text-align: left;
  font-size: 10px; font-weight: 800;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gold); white-space: nowrap;
  border-bottom: 1px solid var(--gold-border);
  font-family: system-ui, sans-serif;
}
td {
  padding: 11px 16px; font-size: 13px;
  border-bottom: 1px solid rgba(59,130,246,0.07);
  color: var(--text); vertical-align: middle;
  font-family: system-ui, sans-serif;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: rgba(59,130,246,0.05); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  font-family: system-ui, sans-serif;
}
.badge-success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(52,211,153,0.25); }
.badge-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(248,113,113,0.25); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card {
  width: min(440px,100%);
  background: var(--surface);
  border: 1px solid var(--gold-border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg), var(--shadow-gold);
  padding: 40px 36px; position: relative; overflow: hidden;
}
.login-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), var(--gold-bright), var(--gold), var(--gold-bright), var(--gold-dim), transparent);
}
.login-title {
  font-size: 26px; font-weight: 700; margin-bottom: 4px;
  color: var(--gold-bright);
  font-family: system-ui, -apple-system, sans-serif;
  text-shadow: 0 0 20px rgba(96,165,250,0.2);
  letter-spacing: 0.01em;
}

.muted { color: var(--text2); }
.domain-chip {
  display: inline-flex; align-items: center;
  background: rgba(59,130,246,0.08);
  border: 1px solid var(--gold-border);
  padding: 3px 11px; border-radius: var(--radius-pill);
  margin: 3px 4px 0 0; font-size: 12px; font-weight: 500;
  color: var(--text2); font-family: system-ui, sans-serif;
}
.bulk-box { min-height: 160px; font-family: 'Courier New', monospace; font-size: 13px; line-height: 1.7; }

.version-box {
  margin-top: 12px; padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: rgba(59,130,246,0.06);
  border: 1px solid rgba(59,130,246,0.14);
  font-size: 11px; line-height: 1.7;
  font-family: system-ui, sans-serif;
}
.version-label { font-size: 9px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; }
.version-meta { color: var(--text4); }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gold-border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-border2); }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--gold-glow);
}

.mobile-menu-btn {
  display: none;
  background: var(--surface);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px; cursor: pointer;
  font-size: 18px; color: var(--gold);
  flex-shrink: 0; transition: all 0.15s;
}
.mobile-menu-btn:hover { background: var(--surface2); }
.topbar-logout { display: none; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 200; backdrop-filter: blur(4px); }
.sidebar-overlay.open { display: block; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: -260px; width: 240px; height: 100vh; z-index: 300;
    transition: left 0.24s cubic-bezier(0.4,0,0.2,1); box-shadow: var(--shadow-lg);
  }
  .sidebar.open { left: 0; }
  .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }
  .topbar-logout { display: inline-flex !important; }
  .footer-user .actions { display: none; }
  .version-box { display: none; }
  .grid, .kpi-row, .form-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 16px; }
  .page-body { padding: 16px; }
  .topbar h1 { font-size: 18px; }
  .topbar .muted { display: none; }
}

@media (max-width: 640px) {
  .grid, .kpi-row, .form-grid { grid-template-columns: 1fr; }
  .panel { padding: 16px 18px; }
  .panel .table-wrap { margin: 0 -18px -16px; }
  .top-actions, .actions { flex-direction: column; align-items: stretch; }
  .btn { width: 100%; min-height: 44px; }
  input, select, textarea { min-height: 44px; font-size: 16px !important; }
  th, td { padding: 9px 12px; font-size: 12px; }
  .stat { font-size: 28px; }
  .login-card { padding: 28px 20px; }
  .login-title { font-size: 22px; }
}

@media (max-width: 900px) { .dash-2col { grid-template-columns: 1fr !important; } }

button, a { -webkit-tap-highlight-color: rgba(59,130,246,0.15); }
.main { -webkit-overflow-scrolling: touch; }

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .main { padding-bottom: env(safe-area-inset-bottom); }
  .sidebar { padding-bottom: env(safe-area-inset-bottom); }
}
