:root {
  --primary: #360952;
  --primary-dark: #240538;
  --secondary: #ca86f3;
  --back-blue: #8dd9ff;
  --lay-pink: #ff94bc;
  --inplay-green: #31b840;
  --bg-page: #f3f4f8;
  --bg-card: #ffffff;
  --text-main: #1e1b2e;
  --text-muted: #6b7280;
  --border: #e5e7eb;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Roboto Condensed", "Segoe UI", Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* Login Overlay */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary), #54147d);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  width: 100%;
  max-width: 420px;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
}

.brand-logo {
  height: 32px;
  object-fit: contain;
}

.badge-b2c {
  background: var(--secondary);
  color: var(--primary-dark);
  font-weight: 800;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
}

.login-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 6px 0 18px;
}

.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
  color: var(--primary);
}

.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 14px;
}

.login-error {
  background: #fee2e2;
  color: #b91c1c;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* Layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 265px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-meta {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 800;
  font-size: 16px;
  color: #fff;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--secondary);
  font-weight: 600;
}

.sidebar-nav {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.82);
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s;
}

.nav-item:hover {
  background: rgba(202, 134, 243, 0.18);
  color: #fff;
}

.nav-item.active {
  background: var(--secondary);
  color: var(--primary-dark);
  font-weight: 800;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-external {
  display: block;
  text-align: center;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
}

.btn-external.secondary {
  background: var(--inplay-green);
  color: #fff;
}

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

.admin-header {
  background: #fff;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-left h1 {
  font-size: 20px;
  color: var(--primary);
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #dcfce7;
  color: #15803d;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  background: var(--inplay-green);
  border-radius: 50%;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

/* Panels & Cards */
.tab-panel {
  display: none;
  padding: 22px 24px;
}

.tab-panel.active {
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.kpi-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px 18px;
  border-left: 4px solid var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.kpi-card.accent {
  border-left-color: var(--secondary);
}

.kpi-card.green {
  border-left-color: var(--inplay-green);
}

.kpi-label {
  font-size: 11.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  margin-top: 6px;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 15px;
  color: var(--primary);
  font-weight: 800;
}

.grid-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
}

.grid-3col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; }
.w-full { width: 100%; }
.text-muted { color: var(--text-muted); font-size: 13px; }

/* Tables */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  background: var(--primary);
  color: #fff;
  text-align: left;
  padding: 9px 11px;
  font-size: 11.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:hover td {
  background: #faf5ff;
}

/* Badges & Buttons */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-back { background: var(--back-blue); color: #0c4a6e; }
.badge-lay { background: var(--lay-pink); color: #831843; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-purple { background: #f3e8ff; color: var(--primary); }

.btn-primary {
  background: linear-gradient(90deg, var(--primary), #5b1387);
  color: #fff;
  border: 0;
  padding: 9px 16px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.btn-secondary {
  background: var(--secondary);
  color: var(--primary-dark);
  border: 0;
  padding: 9px 16px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 7px 13px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
}

.btn-sm {
  background: var(--primary);
  color: #fff;
  border: 0;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  margin-right: 4px;
}

.btn-success-sm {
  background: var(--inplay-green);
  color: #fff;
  border: 0;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  margin-right: 4px;
}

.btn-danger-sm {
  background: #dc2626;
  color: #fff;
  border: 0;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

/* Forms */
.form-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.form-inline input,
.form-inline select,
.input-sm,
.filter-group select {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-stack label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}

.form-stack input,
.form-stack select {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.setting-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: #f9fafb;
  padding: 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.setting-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}

.setting-field input[type="text"],
.setting-field input[type="number"],
.setting-field input[type="color"] {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  border-left: 4px solid var(--secondary);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}
