/* ==========================================================================
   Wedding Bharat — Admin Command Centre (/admin), 2026-10-12.
   Self-contained: the admin page loads only this stylesheet. Navy navigation,
   warm-neutral workspace, the brand's wine/rose, violet and gold as accents.
   ========================================================================== */
:root {
  --a-nav: #121933;
  --a-nav-2: #1B2445;
  --a-nav-text: #C9CEE0;
  --a-nav-muted: #7F88A8;
  --a-bg: #F6F3EF;
  --a-surface: #FFFFFF;
  --a-line: #ECE6DF;
  --a-line-strong: #DCD3C9;
  --a-ink: #1D1A26;
  --a-ink-2: #4F4A5C;
  --a-ink-3: #8A8496;
  --a-rose: #8A1E4C;
  --a-rose-soft: #FBECF1;
  --a-violet: #6D5BD0;
  --a-violet-soft: #EFECFB;
  --a-gold: #B8892E;
  --a-gold-soft: #FBF3E2;
  --a-green: #1F7A4D;
  --a-green-soft: #E6F4EC;
  --a-amber: #A86A00;
  --a-amber-soft: #FDF2DC;
  --a-red: #B42323;
  --a-red-soft: #FCE9E9;
  --a-blue: #2D5BB8;
  --a-blue-soft: #E8EFFC;
  --a-radius: 14px;
  --a-radius-sm: 9px;
  --a-shadow: 0 1px 2px rgba(29, 26, 38, 0.04), 0 6px 18px -10px rgba(29, 26, 38, 0.12);
  --a-focus: 0 0 0 3px rgba(109, 91, 208, 0.35);
  --a-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --a-display: 'Playfair Display', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--a-bg); color: var(--a-ink); font: 14px/1.5 var(--a-font); -webkit-font-smoothing: antialiased; }
a { color: var(--a-rose); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--a-focus); border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* ---------- Gate (signed out / not admin / two-factor) ---------- */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(120% 80% at 0% 0%, #1E2850 0%, var(--a-nav) 60%); }
.gate__card { width: 100%; max-width: 440px; background: var(--a-surface); border-radius: 18px; padding: 32px 30px; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.5); }
.gate__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.gate__brand img { height: 40px; width: auto; }
.gate__brand span { font-family: var(--a-display); font-weight: 600; font-size: 18px; color: var(--a-rose); }
.gate h1 { font-family: var(--a-display); font-size: 24px; margin: 0 0 8px; }
.gate p { color: var(--a-ink-2); margin: 0 0 16px; }
.gate .qr { display: block; width: 180px; height: 180px; margin: 4px auto 12px; border: 1px solid var(--a-line); border-radius: 10px; }
.gate code { word-break: break-all; font-weight: 600; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--a-nav); color: var(--a-nav-text); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 18px 12px; }
.side__brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; text-decoration: none; }
.side__brand img { height: 36px; width: auto; filter: brightness(0) invert(1); opacity: 0.95; }
.side__brand b { display: block; color: #fff; font-family: var(--a-display); font-size: 16px; font-weight: 600; }
.side__brand small { display: block; color: var(--a-nav-muted); font-size: 11px; letter-spacing: 0.04em; }
.side__group { margin: 14px 0 4px; padding: 0 10px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--a-nav-muted); }
.side__link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--a-nav-text); text-decoration: none; font-weight: 500; font-size: 13.5px; }
.side__link svg { width: 17px; height: 17px; flex: none; opacity: 0.85; }
.side__link:hover { background: var(--a-nav-2); color: #fff; }
.side__link[aria-current="page"] { background: linear-gradient(90deg, rgba(109, 91, 208, 0.38), rgba(109, 91, 208, 0.12)); color: #fff; }
.side__badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--a-rose); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 19px; }
.side__foot { margin-top: auto; padding: 14px 10px 4px; font-size: 11.5px; color: var(--a-nav-muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: rgba(246, 243, 239, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--a-line); }
.top__menu { display: none; background: none; border: 0; padding: 6px; cursor: pointer; }
.top__search { position: relative; flex: 1; max-width: 520px; }
.top__search input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--a-line-strong); border-radius: 10px; background: var(--a-surface); }
.top__search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--a-ink-3); }
.search-pop { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--a-surface); border: 1px solid var(--a-line); border-radius: 12px; box-shadow: var(--a-shadow); max-height: 420px; overflow-y: auto; padding: 6px; }
.search-pop a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--a-ink); }
.search-pop a:hover, .search-pop a:focus-visible { background: var(--a-bg); }
.search-pop small { color: var(--a-ink-3); }
.search-pop p { margin: 8px 10px; color: var(--a-ink-3); }
.top__me { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.top__avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--a-violet-soft); color: var(--a-violet); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.top__me small { display: block; color: var(--a-ink-3); font-size: 11px; }

.view { padding: 24px 28px 48px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-family: var(--a-display); font-size: 26px; font-weight: 600; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--a-ink-2); }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--a-gold); margin: 0 0 4px; }

/* ---------- Controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--a-line-strong); background: var(--a-surface); font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; color: var(--a-ink); white-space: nowrap; }
.btn:hover { border-color: var(--a-ink-3); }
.btn--primary { background: var(--a-rose); border-color: var(--a-rose); color: #fff; }
.btn--primary:hover { background: #6E1640; border-color: #6E1640; }
.btn--good { background: var(--a-green); border-color: var(--a-green); color: #fff; }
.btn--danger { color: var(--a-red); border-color: #EBC2C2; }
.btn--danger:hover { background: var(--a-red-soft); border-color: var(--a-red); }
.btn--sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.seg { display: inline-flex; background: var(--a-surface); border: 1px solid var(--a-line-strong); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--a-ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--a-violet-soft); color: var(--a-violet); }
.input, .select, .textarea { padding: 8px 11px; border: 1px solid var(--a-line-strong); border-radius: 9px; background: var(--a-surface); min-width: 0; }
.textarea { width: 100%; min-height: 80px; resize: vertical; }
/* Labelled form in a card (Promotions editor, to-do 24). */
.form-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 16px; align-items: center; font-size: 13px; }
.form-grid > label, .form-grid > span { color: var(--a-ink-2); font-weight: 600; }
.form-grid .input { width: 100%; max-width: 520px; }
.form-hint { display: block; margin: 6px 0; color: var(--a-ink-3); }
.form-check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500 !important; color: var(--a-ink) !important; }
.ad-preview { display: block; max-width: 320px; max-height: 120px; margin-top: 8px; border-radius: 8px; border: 1px solid var(--a-line); }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .form-grid > span:empty { display: none; } }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { flex: 1; min-width: 200px; max-width: 360px; }
.toolbar__spacer { margin-left: auto; }

/* ---------- Cards / KPIs ---------- */
.card { background: var(--a-surface); border: 1px solid var(--a-line); border-radius: var(--a-radius); box-shadow: var(--a-shadow); padding: 18px; min-width: 0; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card__head h2 { font-size: 15px; font-weight: 700; margin: 0; }
.card__head a, .card__head .link { font-size: 12.5px; font-weight: 600; text-decoration: none; color: var(--a-violet); background: none; border: 0; cursor: pointer; }
.card__sub { color: var(--a-ink-3); font-size: 12.5px; margin: -6px 0 12px; }
.grid { display: grid; gap: 16px; }
.grid--kpi { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); margin-bottom: 16px; }
.grid--2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); margin-bottom: 16px; }
.grid--halves { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
.kpi { position: relative; }
.kpi__ic { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.kpi__ic svg { width: 18px; height: 18px; }
.kpi__label { color: var(--a-ink-2); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi__value { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; margin: 2px 0; }
.kpi__delta { font-size: 12px; font-weight: 600; color: var(--a-ink-3); }
.kpi__delta.up { color: var(--a-green); }
.kpi__delta.down { color: var(--a-red); }
.kpi__def { font-size: 11.5px; color: var(--a-ink-3); margin: 8px 0 0; line-height: 1.45; }
.tone-rose { background: var(--a-rose-soft); color: var(--a-rose); }
.tone-violet { background: var(--a-violet-soft); color: var(--a-violet); }
.tone-gold { background: var(--a-gold-soft); color: var(--a-gold); }
.tone-green { background: var(--a-green-soft); color: var(--a-green); }
.tone-blue { background: var(--a-blue-soft); color: var(--a-blue); }
.tone-amber { background: var(--a-amber-soft); color: var(--a-amber); }

.attn { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.attn a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--a-line); border-radius: 10px; text-decoration: none; color: var(--a-ink); }
.attn a:hover { border-color: var(--a-violet); }
.attn__n { min-width: 30px; height: 26px; padding: 0 8px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.attn small { display: block; color: var(--a-ink-3); font-size: 11.5px; }
.attn__go { margin-left: auto; color: var(--a-ink-3); }

.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--a-line); }
.rank li:first-child { border-top: 0; }
.rank__n { width: 22px; height: 22px; border-radius: 50%; background: var(--a-bg); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; color: var(--a-ink-2); }
.rank__main { flex: 1; min-width: 0; }
.rank__main small { display: block; color: var(--a-ink-3); }
.rank__val { font-weight: 700; }

/* ---------- Chart ---------- */
.chart { width: 100%; height: 240px; display: block; }
.chart .grid-line { stroke: var(--a-line); stroke-width: 1; }
.chart .axis { fill: var(--a-ink-3); font-size: 11px; }
.chart .area { fill: url(#chartFill); }
.chart .line { fill: none; stroke: var(--a-violet); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--a-violet); }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--a-ink-2); margin-top: 6px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--a-line); border-radius: var(--a-radius); background: var(--a-surface); box-shadow: var(--a-shadow); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--a-ink-3); text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 12px; border-bottom: 1px solid var(--a-line); white-space: nowrap; background: #FCFAF8; }
.t th button { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.t th button::after { content: ' ↕'; opacity: 0.35; }
.t th button[data-dir="asc"]::after { content: ' ↑'; opacity: 1; }
.t th button[data-dir="desc"]::after { content: ' ↓'; opacity: 1; }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--a-line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tr.is-link { cursor: pointer; }
.t tr.is-link:hover td { background: #FCFAF8; }
.t td small { display: block; color: var(--a-ink-3); }
.t .num { text-align: right; font-variant-numeric: tabular-nums; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 2px 0; color: var(--a-ink-3); font-size: 12.5px; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.pill--green { background: var(--a-green-soft); color: var(--a-green); }
.pill--amber { background: var(--a-amber-soft); color: var(--a-amber); }
.pill--red { background: var(--a-red-soft); color: var(--a-red); }
.pill--blue { background: var(--a-blue-soft); color: var(--a-blue); }
.pill--violet { background: var(--a-violet-soft); color: var(--a-violet); }
.pill--grey { background: #F1EEEA; color: var(--a-ink-2); }
.bar { height: 6px; border-radius: 99px; background: var(--a-bg); overflow: hidden; min-width: 70px; }
.bar span { display: block; height: 100%; background: var(--a-violet); border-radius: inherit; }

/* ---------- Detail page ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }
.facts dt { color: var(--a-ink-3); }
.facts dd { margin: 0; word-break: break-word; }
.check { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.check li::before { content: '✕'; display: inline-block; width: 18px; color: var(--a-red); font-weight: 700; }
.check li.ok::before { content: '✓'; color: var(--a-green); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 12.5px; }
.timeline li { border-left: 2px solid var(--a-line-strong); padding-left: 10px; }
.timeline small { color: var(--a-ink-3); display: block; }
.back { display: inline-flex; gap: 6px; align-items: center; margin-bottom: 10px; color: var(--a-ink-2); text-decoration: none; font-weight: 600; font-size: 13px; }

/* ---------- States ---------- */
.empty { text-align: center; padding: 28px 16px; color: var(--a-ink-3); }
.empty b { display: block; color: var(--a-ink-2); margin-bottom: 4px; }
.skeleton { background: linear-gradient(90deg, #EFEAE4 0%, #F7F3EE 50%, #EFEAE4 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.notice { padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.notice--warn { background: var(--a-amber-soft); color: #6E4700; }
.notice--info { background: var(--a-blue-soft); color: #1E3F82; }
.notice--error { background: var(--a-red-soft); color: var(--a-red); }

/* ---------- Dialog + toast ---------- */
.dlg { position: fixed; inset: 0; z-index: 100; background: rgba(18, 25, 51, 0.45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.dlg__box { background: var(--a-surface); border-radius: 16px; width: 100%; max-width: 460px; padding: 22px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.45); }
.dlg__box h3 { margin: 0 0 6px; font-size: 17px; }
.dlg__box p { margin: 0 0 12px; color: var(--a-ink-2); }
.dlg__box label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 6px; }
.dlg__err { color: var(--a-red); font-size: 12.5px; min-height: 18px; margin: 6px 0 0; }
.dlg__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: grid; gap: 8px; }
.toast { background: var(--a-nav); color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: var(--a-shadow); font-size: 13px; max-width: 360px; animation: toastIn .2s ease; }
.toast--error { background: var(--a-red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid--2, .detail, .grid--halves { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 60; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s ease; }
  .shell.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(18, 25, 51, 0.45); }
  .top { padding: 10px 16px; }
  .top__menu { display: inline-flex; }
  .top__me small, .top__me .who { display: none; }
  .view { padding: 18px 16px 40px; }
}
@media (max-width: 640px) {
  .t.stack thead { display: none; }
  .t.stack tr { display: block; padding: 10px 12px; border-bottom: 1px solid var(--a-line); }
  .t.stack td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  .t.stack td::before { content: attr(data-label); color: var(--a-ink-3); font-weight: 600; text-align: left; }
  .t.stack td.num { text-align: right; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
