:root {
  --bg: #070c16;
  --surface: #0d1526;
  --surface-2: #121d33;
  --surface-3: #182642;
  --border: rgba(255, 255, 255, 0.09);
  --border-gold: rgba(212, 175, 90, 0.34);
  --gold: #d4af5a;
  --gold-bright: #f2d479;
  --text: #eef3fb;
  --muted: #93a3bf;
  --soft: #6f7f9e;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(900px 550px at 15% -10%, rgba(212, 175, 90, 0.09), transparent 60%), var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.font-display {
  font-family: 'Cinzel', Georgia, serif;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 410px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 32px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

/* Layout */
.admin-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 10px 10px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}

.sidebar-brand img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}

.nav-item.active {
  background: rgba(212, 175, 90, 0.13);
  border-color: var(--border-gold);
  color: var(--gold-bright);
  font-weight: 600;
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.main-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(7, 12, 22, 0.78);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
}

.content {
  padding: 24px 28px 54px;
  max-width: 1360px;
  width: 100%;
}

/* Components */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-title {
  margin: 0 0 14px;
  font-size: 0.96rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.kpi-label {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--soft);
}

.kpi-val {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 4px 0 2px;
  line-height: 1.15;
}

.kpi-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.45fr 0.85fr;
  gap: 16px;
  margin-bottom: 18px;
}

.grid-equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.search-input {
  min-width: 260px;
  padding: 9px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--gold);
}

/* Buttons & Badges */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #091122;
}

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--border-gold);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.badge-gold {
  background: rgba(212, 175, 90, 0.16);
  color: var(--gold-bright);
}

.badge-ok {
  background: rgba(52, 211, 153, 0.15);
  color: #86efac;
}

.badge-warn {
  background: rgba(251, 191, 36, 0.15);
  color: #fde68a;
}

.badge-danger {
  background: rgba(248, 113, 113, 0.16);
  color: #fecaca;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--soft);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 13px;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.89rem;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--gold);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.88rem;
  margin: 6px 0;
  cursor: pointer;
}

.alert {
  padding: 12px 15px;
  border-radius: 12px;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.alert-warn {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: #fde68a;
  margin-bottom: 18px;
}

.alert-danger {
  background: rgba(248, 113, 113, 0.13);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

/* Push composer specifics */
.target-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.target-tab {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.target-tab.active {
  background: rgba(212, 175, 90, 0.15);
  border-color: var(--border-gold);
  color: var(--gold-bright);
}

.user-picker-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  padding: 6px;
}

.user-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.user-picker-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.ios-push-preview {
  background: linear-gradient(145deg, rgba(28, 37, 56, 0.94), rgba(17, 24, 39, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

/* Modals & Toasts */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 14, 0.78);
  backdrop-filter: blur(6px);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.65);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 500;
  background: var(--surface-3);
  border: 1px solid var(--border-gold);
  color: var(--text);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

.toast.err {
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

.hidden {
  display: none !important;
}

.mobile-menu-btn {
  display: none;
}

@media (max-width: 1040px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-2,
  .grid-equal {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: -260px;
    width: 248px;
    z-index: 45;
    transition: left 0.2s ease;
  }
  .sidebar.open {
    left: 0;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .content {
    padding: 18px 16px 40px;
  }
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}
