/* ═══════════════════════════════════════════════════════════════════════════
   HBL · Lakhpati brand design system
   Palette: royal medallion blue · metallic gold · diamond white · black
   ═══════════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700;800&family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&family=Noto+Sans+Gujarati:wght@400;500;600;700&display=swap');

:root {
  /* Brand — matched to official medallion logo */
  --black: #000000;
  --blue-deepest: #000000;
  --blue-deep: #010510;
  --blue-royal: #002366;
  --blue-coin: #0A2060;
  --blue-mid: #1A3A7A;
  --blue-glow: #0E2D7E;
  --gold-deep: #9A7B1A;
  --gold: #C5A028;
  --gold-rich: #D4AF37;
  --gold-bright: #E8C547;
  --gold-pale: #F5E1A0;
  --champagne: #E8D5A0;
  --diamond: rgba(255, 255, 255, 0.9);
  --gold-border: rgba(212, 175, 55, 0.35);
  --gold-border-strong: rgba(212, 175, 55, 0.55);
  --gold-glow: rgba(212, 175, 55, 0.25);
  --gold-shine: rgba(232, 197, 71, 0.12);

  /* Metallic gradients */
  --gradient-gold: linear-gradient(145deg, #F4D03F 0%, #D4AF37 35%, #C5A028 70%, #9A7B1A 100%);
  --gradient-gold-btn: linear-gradient(180deg, #F0D060 0%, #D4AF37 45%, #B8922A 100%);
  --gradient-navy: linear-gradient(180deg, var(--blue-coin) 0%, var(--blue-royal) 100%);
  --gradient-navy-deep: linear-gradient(180deg, var(--blue-deep) 0%, var(--black) 100%);
  --gradient-dark-page:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(212, 175, 55, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(0, 35, 102, 0.45) 0%, transparent 60%),
    linear-gradient(180deg, var(--black) 0%, var(--blue-deep) 50%, var(--black) 100%);
  --gradient-panel: linear-gradient(180deg, rgba(0, 35, 102, 0.55) 0%, rgba(1, 5, 16, 0.85) 100%);
  --gradient-medallion-ring:
    0 0 0 1px var(--gold-deep),
    0 0 0 3px var(--gold-rich),
    0 0 0 5px rgba(255, 255, 255, 0.15),
    0 0 0 7px var(--gold-deep),
    0 4px 24px rgba(212, 175, 55, 0.35);

  /* UI tokens */
  --bg: #F4F5F8;
  --card: #FFFFFF;
  --border: #DDE1EA;
  --border-strong: #B8C0D0;
  --text: #0D1526;
  --text-muted: #4A5568;
  --text-faint: #7A8499;
  --accent: var(--blue-royal);
  --accent-gold: var(--gold);
  --success: #047857;
  --warn: #B45309;
  --danger: #B91C1C;
  --info: #1D4ED8;
  --live: #DC2626;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 35, 102, 0.1);
  --shadow-lg: 0 12px 32px rgba(0, 35, 102, 0.14);
  --shadow-gold: 0 4px 20px rgba(212, 175, 55, 0.3);
}

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

html, body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.gu { font-family: 'Noto Sans Gujarati', sans-serif; }
.mono { font-family: 'JetBrains Mono', monospace; }
.serif { font-family: 'Cinzel', serif; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; border: none; background: transparent; }

/* ═══ BRAND LOGO ═══ */
.logo-circle,
.logo-mini {
  flex-shrink: 0;
  background: transparent;
  box-shadow: none;
  border: none;
  display: block;
  line-height: 0;
  padding: 0;
}
.logo-circle { width: 36px; height: 36px; }
.logo-mini { width: 36px; height: 36px; }
.logo-circle.lg { width: 95px; height: 95px; }
.logo-circle.md { width: 72px; height: 72px; }
.logo-circle.sm { width: 38px; height: 38px; }
.logo-mark {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ═══ DARK CINEMATIC THEME (login, home, host, contestant) ═══ */
body.theme-dark {
  background: var(--gradient-dark-page);
  min-height: 100vh;
  color: var(--champagne);
}
.theme-dark .login-shell {
  background: var(--gradient-panel);
  border: 1px solid var(--gold-border-strong);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65), 0 0 80px rgba(212, 175, 55, 0.06);
  position: relative;
}
.theme-dark .phone-shell {
  background: var(--gradient-panel);
  border: 1.5px solid var(--gold-border-strong);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}
.theme-dark .login-shell::before,
.theme-dark .login-shell::after {
  content: '';
  position: absolute;
  width: 36px;
  height: 36px;
  pointer-events: none;
}
.theme-dark .login-shell::before {
  top: -1px; left: -1px;
  border-top: 2px solid var(--gold-rich);
  border-left: 2px solid var(--gold-rich);
}
.theme-dark .login-shell::after {
  top: -1px; right: -1px;
  border-top: 2px solid var(--gold-rich);
  border-right: 2px solid var(--gold-rich);
}

/* ═══ SIDEBAR LAYOUT (admin / super admin) ═══ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--gradient-navy);
  color: white;
  padding: 18px 0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--gold-border);
  box-shadow: inset -1px 0 0 rgba(212, 175, 55, 0.08);
}
.sidebar.super-theme {
  background: var(--gradient-navy-deep);
  border-right: 2px solid var(--gold-rich);
  box-shadow: inset -2px 0 12px rgba(212, 175, 55, 0.08);
}
.sidebar .brand {
  padding: 4px 22px 18px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 11px;
}
.sidebar .brand .logo-circle {
  width: 40px;
  height: 40px;
}
.sidebar .brand .b-text { font-size: 14px; font-weight: 700; line-height: 1.2; font-family: 'Cinzel', serif; }
.sidebar .brand .b-text .small {
  font-size: 9px;
  opacity: 0.7;
  font-weight: 400;
  letter-spacing: 0.14em;
  display: block;
  margin-top: 2px;
  color: var(--gold-pale);
  font-family: 'Inter', sans-serif;
}
.sidebar .sect-label {
  font-size: 9px;
  padding: 14px 22px 6px;
  color: rgba(232, 213, 160, 0.45);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 22px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
  border-left: 3px solid transparent;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.sidebar .nav-item:hover { background: rgba(212, 175, 55, 0.06); text-decoration: none; }
.sidebar .nav-item.active {
  background: rgba(212, 175, 55, 0.1);
  border-left-color: var(--gold-bright);
  color: white;
  font-weight: 600;
}
.sidebar .nav-item .icon { width: 18px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.sidebar .nav-item .badge {
  margin-left: auto;
  background: var(--gradient-gold);
  color: var(--blue-deep);
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 700;
}
.sidebar .nav-item .badge.alert { background: var(--live); color: white; }
.sidebar-footer {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 14px 22px;
  border-top: 1px solid rgba(212, 175, 55, 0.15);
  font-size: 11px;
  color: rgba(232, 213, 160, 0.5);
  background: inherit;
}
.sidebar-footer a { color: var(--gold-bright); }

/* ═══ TOP BAR ═══ */
.main { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFBFD 100%);
  height: 56px;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, transparent, var(--gold-rich), transparent) 1;
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}
.topbar .crumb { font-size: 13px; color: var(--text-muted); }
.topbar .crumb .arrow { color: var(--text-faint); margin: 0 8px; }
.topbar .crumb .current { color: var(--text); font-weight: 600; }
.topbar .search {
  margin-left: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 14px 7px 34px;
  font-size: 12px;
  color: var(--text-muted);
  width: 280px;
  position: relative;
  font-family: inherit;
}
.topbar .search-wrap { position: relative; margin-left: auto; }
.topbar .search-wrap::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  pointer-events: none;
  z-index: 1;
}
.topbar .user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 18px;
  border-left: 1px solid var(--border);
}
.topbar .user-chip .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient-navy);
  border: 2px solid var(--gold-rich);
  color: var(--gold-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.topbar .user-chip .info { font-size: 12px; line-height: 1.3; }
.topbar .user-chip .info .name { font-weight: 600; color: var(--text); }
.topbar .user-chip .info .role { color: var(--text-faint); font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; }
.topbar a.logout {
  color: var(--text-muted);
  font-size: 12px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  margin-left: 10px;
}

/* ═══ PAGE CONTENT ═══ */
.content { padding: 24px 28px; flex-grow: 1; }
.page-title { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.page-title h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  font-family: 'Cinzel', serif;
}
.page-title .sub { font-size: 13px; color: var(--text-muted); }

/* ═══ CARDS ═══ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-gold);
}
.card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Cinzel', serif;
}
.card h3 .right-link { font-size: 12px; color: var(--accent); font-weight: 500; font-family: 'Inter', sans-serif; }
.card h3 .right-link:hover { text-decoration: underline; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 18px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-gold);
}
.stat-card .label { font-size: 11px; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; }
.stat-card .num { font-size: 30px; font-weight: 700; color: var(--text); line-height: 1; margin-bottom: 8px; font-family: 'Cinzel', serif; }
.stat-card .num .small { font-size: 16px; color: var(--text-faint); font-weight: 400; font-family: 'Inter', sans-serif; }
.stat-card .trend { font-size: 12px; color: var(--success); }
.stat-card .trend.down { color: var(--danger); }
.stat-card .trend.neutral { color: var(--text-muted); }

/* ═══ TABLE ═══ */
.table-wrap { background: white; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  padding: 11px 14px;
  background: linear-gradient(180deg, #FAFBFD 0%, #F4F5F8 100%);
  color: var(--blue-royal);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--gold-pale);
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr.clickable { cursor: pointer; transition: background 0.1s; }
.table tr.clickable:hover { background: rgba(0, 35, 102, 0.03); }
.table .row-avatar { display: flex; align-items: center; gap: 10px; }
.table .av-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gradient-gold);
  color: var(--blue-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--gold-deep);
}

/* ═══ BADGES ═══ */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge.pending { background: #FEF3C7; color: var(--warn); }
.badge.approved, .badge.pass { background: #D1FAE5; color: var(--success); }
.badge.review { background: #DBEAFE; color: var(--info); }
.badge.rejected { background: #FEE2E2; color: var(--danger); }
.badge.live { background: var(--live); color: white; }
.badge.draft { background: #E5E7EB; color: #4B5563; }
.badge.diff-1 { background: #D1FAE5; color: var(--success); }
.badge.diff-2 { background: #DBEAFE; color: var(--info); }
.badge.diff-3 { background: #FEF3C7; color: var(--warn); }
.badge.diff-4 { background: #FED7AA; color: #C2410C; }
.badge.diff-5 { background: #FEE2E2; color: var(--danger); }
.badge.ai { background: var(--gradient-gold); color: var(--blue-deep); border: 1px solid var(--gold-deep); }

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  font-family: inherit;
  border: 1px solid transparent;
}
.btn.primary {
  background: var(--gradient-navy);
  color: white;
  border-color: var(--blue-mid);
  box-shadow: 0 2px 8px rgba(0, 35, 102, 0.25);
}
.btn.primary:hover {
  background: linear-gradient(180deg, var(--blue-mid) 0%, var(--blue-royal) 100%);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 35, 102, 0.3);
}
.btn.secondary {
  background: white;
  color: var(--accent);
  border-color: var(--accent);
}
.btn.secondary:hover { background: rgba(0, 35, 102, 0.04); text-decoration: none; }
.btn.gold {
  background: var(--gradient-gold-btn);
  color: var(--blue-deep);
  border: 1px solid var(--gold-deep);
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  font-family: 'Cinzel', serif;
  letter-spacing: 0.04em;
}
.btn.gold:hover {
  filter: brightness(1.06);
  box-shadow: var(--shadow-gold);
  text-decoration: none;
}
.btn.danger { background: var(--danger); color: white; }
.btn.danger:hover { background: #991717; text-decoration: none; }
.btn.ghost { color: var(--text-muted); background: white; border-color: var(--border); }
.btn.ghost:hover { background: var(--bg); text-decoration: none; }
.btn.sm { padding: 5px 12px; font-size: 11px; }
.btn.lg { padding: 12px 26px; font-size: 14px; }
.btn.block { width: 100%; }

/* ═══ PROGRESS BARS ═══ */
.bar { width: 100%; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.bar .fill { height: 100%; background: var(--gradient-gold); transition: width 0.3s; }
.bar.lg { height: 10px; }

/* ═══ TWO-COL / THREE-COL ═══ */
.row-2-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.row-3-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 18px; }
.row-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }

/* ═══ ROLE BANNER ═══ */
.demo-banner {
  background: var(--gradient-gold);
  color: var(--blue-deep);
  padding: 6px 28px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
  border-bottom: 1px solid var(--gold-deep);
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.2);
}
.demo-banner a { color: var(--blue-deep); text-decoration: underline; font-weight: 700; margin-left: 12px; }

/* ═══ TIMELINE ═══ */
.timeline { display: flex; flex-direction: column; gap: 14px; }
.timeline-item { display: flex; gap: 12px; align-items: flex-start; }
.timeline-item .marker {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}
.timeline-item .marker.pending { background: var(--info); }
.timeline-item .marker.empty { background: #D1D5DB; color: white; }
.timeline-item .content-tl { font-size: 12px; line-height: 1.5; }
.timeline-item .content-tl strong { display: block; color: var(--text); margin-bottom: 2px; }
.timeline-item .content-tl .meta { color: var(--text-muted); font-size: 11px; }
.timeline-item.dim { opacity: 0.5; }

/* ═══ FILTER CHIPS ═══ */
.filter-row {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-row .label { font-size: 11px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.05em; }
.chip {
  background: var(--accent);
  color: white;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip .x { cursor: pointer; opacity: 0.7; }
.chip .x:hover { opacity: 1; }
.chip.add { background: var(--bg); color: var(--accent); border: 1px dashed var(--accent); cursor: pointer; }

/* ═══ STORY HOOK ═══ */
.story-hook {
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.08), rgba(245, 225, 160, 0.15));
  border-left: 3px solid var(--gold-rich);
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.story-hook strong { color: var(--blue-royal); }

/* ═══ FORM ELEMENTS ═══ */
.input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: white;
}
.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-rich);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}
.field-row { margin-bottom: 16px; }
.field-row label { display: block; font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 6px; letter-spacing: 0.02em; }
.field-row .hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ═══ MODAL OVERLAY ═══ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay.show { display: flex; }
.modal {
  background: white;
  border-radius: 12px;
  padding: 28px 30px;
  max-width: 520px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  border-top: 3px solid var(--gold-rich);
}
.modal h2 { font-size: 20px; margin-bottom: 8px; color: var(--text); font-family: 'Cinzel', serif; }
.modal p { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ═══ TOAST ═══ */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--blue-royal);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 200;
  max-width: 360px;
  border-left: 3px solid var(--gold-rich);
}
.toast.success { background: var(--success); border-left-color: var(--gold-bright); }
.toast.error { background: var(--danger); }
.toast.show { display: block; animation: slideUp 0.2s ease-out; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
