:root {
  --plum: #7C3AED;
  --plum-d: #6D28D9;
  --pink: #EC297B;
  --bg: #F6F4FC;
  --card: #ffffff;
  --line: #eae4f7;
  --text: #1c1530;
  --muted: #726b88;
  --field: #ffffff;
  --field-line: #d9d1ee;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --sidebar-w: 244px;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(30,16,60,.06), 0 8px 24px rgba(30,16,60,.05);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--err); font-size: 14px; min-height: 18px; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 20% -10%, #efe7ff 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 10%, #ffe6f3 0%, transparent 55%), #f1ecfb; }
/* Auth card is always light so the logo (with white letter-counters) sits on
   white and the form stays readable regardless of the viewer's OS theme. */
.login-card { width: 100%; max-width: 400px; background: #ffffff; color: #1c1530;
  border: 1px solid #eae4f7; border-radius: 20px; padding: 32px;
  box-shadow: 0 10px 40px rgba(30,16,60,.12); }
.login-card h1 { color: #1c1530; }
.login-card .muted { color: #6b6480; }
.login-card input { background: #fff; color: #1c1530; border-color: #d9d1ee; }
.login-card input::placeholder { color: #8b849c; }
.login-card button.ghost { background: #fff; color: #1c1530; border-color: #e5e0f0; }
.login-card .divider span { background: #fff; }
.login-logo-wrap { text-align: center; }
.login-brand { font-weight: 900; font-size: 30px; letter-spacing: -.5px; margin-bottom: 10px; }
.login-brand span, .side-brand span, .brandtxt span { background: linear-gradient(90deg, var(--pink), var(--plum));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }

/* ---------- Inputs / buttons ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 0; }
label.check { display: flex; align-items: center; gap: 9px; font-weight: 500; color: var(--text); margin-top: 0; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select {
  width: 100%; margin-top: 6px; padding: 12px 13px; font-size: 15px;
  border: 1px solid var(--field-line); border-radius: 11px; background: var(--field);
  color: var(--text); outline: none;
}
input::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus { border-color: var(--plum); box-shadow: 0 0 0 3px rgba(124,58,237,.12); }
label.check input { width: auto; margin: 0; }

button { font: inherit; cursor: pointer; border-radius: 11px; padding: 11px 16px;
  border: 1px solid transparent; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
button svg { width: 18px; height: 18px; }
button.primary { background: var(--plum); color: #fff; }
button.primary:hover { background: var(--plum-d); }
button.ghost { background: #fff; color: var(--text); border-color: var(--line); }
button.ghost:hover { border-color: var(--plum); color: var(--plum); }
button.wide { width: 100%; }
button.link { background: none; border: none; color: var(--plum); padding: 0; font-size: 13px; }
button.small { padding: 7px 13px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; margin-top: 18px; }
.row button { flex: 1; }

.divider { text-align: center; margin: 20px 0; position: relative; color: var(--muted); font-size: 13px; }
.divider::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }
.divider span { background: var(--card); padding: 0 12px; position: relative; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: linear-gradient(180deg, #2a1a4d, #1c1235);
  color: #e9e3fb; display: flex; flex-direction: column; padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { font-weight: 900; font-size: 24px; padding: 6px 10px 20px; letter-spacing: -.5px; }
.side-brand small { display: block; font-size: 11px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: #a99fd6; margin-top: 2px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item { justify-content: flex-start; background: transparent; color: #cfc6ee; border: none;
  padding: 11px 12px; border-radius: 11px; font-weight: 600; width: 100%; }
.nav-item svg { width: 19px; height: 19px; opacity: .9; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.14); color: #fff; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid rgba(255,255,255,.1); margin-top: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--pink), var(--plum));
  color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.side-name { font-size: 14px; font-weight: 600; color: #fff; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .link { color: #b9aee6; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 26px; background: rgba(255,255,255,.7);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { margin: 0; font-size: 20px; }
.menu-btn { display: none; background: none; border: none; color: var(--text); padding: 4px; }
.menu-btn svg { width: 24px; height: 24px; }
.main { padding: 26px; max-width: 960px; width: 100%; }

/* ---------- Cards / panels ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.panel.narrow { max-width: 520px; }
.panel-head { display: flex; align-items: center; margin-bottom: 6px; }
.panel-head h2 { margin: 0; font-size: 17px; }
.toggles { display: flex; gap: 20px; margin-top: 16px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); }
.stat-card .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 10px; }
.stat-card .ic svg { width: 18px; height: 18px; color: #fff; }
.stat-card b { font-size: 24px; display: block; }
.stat-card span { font-size: 13px; color: var(--muted); }
.ic.p1 { background: linear-gradient(135deg,#a855f7,#7c3aed); }
.ic.p2 { background: linear-gradient(135deg,#ec4899,#db2777); }
.ic.p3 { background: linear-gradient(135deg,#0ea5e9,#2563eb); }
.ic.p4 { background: linear-gradient(135deg,#10b981,#059669); }

/* ---------- Event cards ---------- */
.ev { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.ev-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; cursor: pointer; }
.ev-ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg,#f3e8ff,#fce7f3); }
.ev-ic svg { width: 20px; height: 20px; color: var(--plum); }
.ev-head h3 { margin: 0; font-size: 16px; }
.ev-code { color: var(--muted); font-size: 13px; }
.badge { font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 20px; }
.badge.active { background: #dcfce7; color: var(--ok); }
.badge.pending { background: #ffedd5; color: var(--warn); }
.spacer { flex: 1; }
.chev { color: var(--muted); transition: transform .2s; }
.ev.open .chev { transform: rotate(180deg); }

.ev-body { padding: 4px 18px 18px; border-top: 1px solid var(--line); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 16px 0; }
.stat { background: var(--bg); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 18px; }
.stat span { font-size: 12px; color: var(--muted); }

.section-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 10px; }
.pending-item, .addon { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.pending-item img { width: 54px; height: 54px; object-fit: cover; border-radius: 9px; background: #eee; }

@media (max-width: 760px) {
  .sidebar { position: fixed; z-index: 30; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .main { padding: 18px; }
}

@media (prefers-color-scheme: dark) {
  :root { --bg: #120e1e; --card: #1b1530; --line: #2b2246; --text: #f0ecfa;
    --muted: #a79fc0; --field: #241c3a; --field-line: #3a2f57; }
  .topbar { background: rgba(27,21,48,.7); }
  button.ghost { background: #241c3a; }
  .stat { background: #241c3a; }
  .ev-ic { background: linear-gradient(135deg,#2c1f4a,#3a1f38); }
}

/* ---------- Logos ---------- */
.login-logo { display: block; width: 200px; max-width: 70%; margin: 0 auto 14px; }
.side-brand { display: flex; align-items: center; gap: 10px; }
.side-mark { width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0; }
.side-brand .brandtxt { line-height: 1.05; }

/* Admin site: distinct charcoal/indigo sidebar to differentiate from host dashboard */
.sidebar.admin { background: linear-gradient(180deg, #1e293b, #0f172a); }
.sidebar.admin .side-brand small { color: #7dd3fc; }
.sidebar.admin .nav-item.active { background: rgba(56,189,248,.18); }
.grant-row { display:flex; gap:20px; flex-wrap:wrap; margin:10px 0; align-items:center; }

/* Plans header row */
.view-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,10,30,.55); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px; z-index: 100; }
.modal { width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal-head { display: flex; align-items: center; margin-bottom: 6px; }
.modal-head h2 { margin: 0; font-size: 19px; }
.icon-btn { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 18px; padding: 4px 8px; cursor: pointer; }
.modal-body { margin-bottom: 8px; }
.modal-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
