:root {
  --bg: #050912;
  --panel: rgba(13, 22, 36, .88);
  --panel-strong: #0d1725;
  --line: rgba(143, 184, 222, .13);
  --text: #f3f8ff;
  --muted: #7890a9;
  --cyan: #13d8ff;
  --blue: #1677ff;
  --purple: #846dff;
  --danger: #ff5570;
  --success: #36df9a;
  --radius: 22px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.ambient { position: fixed; border-radius: 50%; filter: blur(90px); pointer-events: none; opacity: .15; z-index: 0; }
.ambient-one { width: 260px; height: 260px; background: #0877ff; right: -130px; top: 90px; }
.ambient-two { width: 220px; height: 220px; background: #00e1ff; left: -150px; bottom: 120px; }

.loading-screen, .state-screen { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 18px; padding: 32px; text-align: center; position: relative; z-index: 3; }
.loading-logo { width: 110px; height: 110px; border-radius: 30px; box-shadow: 0 0 55px rgba(19,216,255,.22); }
.loading-screen p, .state-screen p { color: var(--muted); margin: 0; max-width: 320px; line-height: 1.55; }
.loading-line { width: 150px; height: 3px; background: #121f31; overflow: hidden; border-radius: 99px; }
.loading-line span { display: block; width: 45%; height: 100%; background: linear-gradient(90deg,var(--blue),var(--cyan)); animation: load 1.1s ease-in-out infinite alternate; }
@keyframes load { from { transform: translateX(-20%); } to { transform: translateX(140%); } }
.state-icon { font-size: 52px; }
.state-screen h1 { margin: 0; font-size: 26px; }

.app-shell { width: min(100%, 780px); margin: auto; min-height: 100vh; position: relative; z-index: 1; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.topbar { height: 72px; padding: calc(10px + env(safe-area-inset-top)) 18px 8px; display: flex; align-items: center; justify-content: space-between; }
.brand-lockup { display: flex; align-items: center; gap: 11px; text-transform: uppercase; letter-spacing: .08em; }
.brand-lockup div { display: grid; font-size: 15px; line-height: 1; }
.brand-lockup span { color: var(--cyan); font-size: 10px; letter-spacing: .28em; margin-top: 5px; }
.brand-logo { width: 42px; height: 42px; border-radius: 13px; border: 1px solid rgba(19,216,255,.35); }
.profile-button { width: 40px; height: 40px; border-radius: 14px; border: 1px solid rgba(19,216,255,.25); background: linear-gradient(145deg,#142b43,#0b1522); font-weight: 800; color: var(--cyan); }
main { padding: 6px 16px 24px; }
.view { display: none; animation: viewIn .25s ease; }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.hero-card { min-height: 260px; border-radius: 28px; overflow: hidden; position: relative; border: 1px solid rgba(71,177,255,.24); box-shadow: 0 22px 60px rgba(0,0,0,.35); }
.hero-media { position: absolute; inset: 0; background: linear-gradient(0deg,rgba(3,8,15,.96) 4%,rgba(3,8,15,.13) 75%), linear-gradient(90deg,rgba(0,50,100,.24),transparent), url('/assets/hero.png') center 34%/cover; transform: scale(1.02); }
.hero-content { position: absolute; left: 22px; right: 22px; bottom: 22px; }
.eyebrow, .page-title span, .section-heading span, .sheet-head span { display: block; color: var(--cyan); font-size: 10px; letter-spacing: .2em; font-weight: 800; }
.hero-content h1 { margin: 7px 0 4px; font-size: clamp(28px,8vw,42px); line-height: 1; letter-spacing: -.04em; }
.hero-content p { margin: 0; color: #b5c5d6; }
.live-pill { position: absolute; top: 16px; right: 16px; padding: 8px 11px; border-radius: 99px; background: rgba(3,9,16,.72); border: 1px solid rgba(255,255,255,.11); backdrop-filter: blur(12px); font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.live-pill i { display: inline-block; width: 6px; height: 6px; background: var(--success); border-radius: 50%; box-shadow: 0 0 12px var(--success); margin-right: 6px; }

.section-heading { display: flex; align-items: end; justify-content: space-between; margin: 28px 2px 13px; }
.section-heading h2 { margin: 4px 0 0; font-size: 20px; letter-spacing: -.02em; }
.text-button { border: 0; background: transparent; color: #78cfff; font-size: 12px; padding: 8px 0 2px 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.stat-card { padding: 15px 12px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg,rgba(16,31,48,.9),rgba(8,16,27,.86)); }
.stat-card span { display: block; color: var(--muted); font-size: 10px; margin-bottom: 8px; }
.stat-card b { font-size: 24px; letter-spacing: -.04em; }
.stat-card i { float: right; font-style: normal; font-size: 14px; }

.event-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(135deg,rgba(16,31,49,.94),rgba(8,14,24,.9)); position: relative; overflow: hidden; }
.event-card::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; background: linear-gradient(var(--cyan),var(--blue)); border-radius: 0 9px 9px 0; }
.event-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.event-type { color: var(--cyan); font-weight: 800; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.event-date { color: var(--muted); font-size: 11px; }
.event-card h3 { margin: 12px 0 5px; font-size: 18px; }
.event-card p { margin: 0; color: #9cb1c6; font-size: 13px; }
.event-actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.danger-link { color: #ff7c90; border: 0; background: rgba(255,85,112,.08); border-radius: 10px; padding: 8px 11px; font-size: 11px; }
.empty-card { border: 1px dashed rgba(130,174,215,.2); border-radius: var(--radius); padding: 30px 22px; text-align: center; color: var(--muted); }
.empty-card strong { display: block; color: var(--text); margin-bottom: 7px; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-card { min-height: 116px; text-align: left; padding: 16px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel); position: relative; overflow: hidden; }
.quick-card::after { content: ""; position: absolute; width: 70px; height: 70px; right: -25px; bottom: -30px; border-radius: 50%; background: var(--accent,var(--blue)); filter: blur(22px); opacity: .22; }
.quick-card span { font-size: 24px; display: block; margin-bottom: 18px; }
.quick-card b { display: block; font-size: 14px; }
.quick-card small { display: block; color: var(--muted); margin-top: 3px; font-size: 10px; }

.page-title { padding: 18px 3px 4px; }
.page-title h1 { margin: 7px 0 5px; font-size: 34px; letter-spacing: -.04em; }
.page-title p { color: var(--muted); margin: 0; font-size: 13px; }
.stack-list { display: grid; gap: 11px; margin-top: 22px; }
.fab { position: sticky; bottom: 96px; margin: 24px auto 0; display: flex; gap: 9px; align-items: center; justify-content: center; border: 0; border-radius: 16px; padding: 14px 20px; background: linear-gradient(135deg,#087eff,#10c9ee); box-shadow: 0 14px 35px rgba(11,141,255,.28); font-weight: 800; }
.fab span { font-size: 20px; line-height: 0; }

.group-rail { display: flex; gap: 10px; overflow-x: auto; padding: 20px 1px 5px; scrollbar-width: none; }
.group-rail::-webkit-scrollbar { display: none; }
.group-chip { flex: 0 0 auto; min-width: 140px; text-align: left; padding: 14px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); }
.group-chip.active { border-color: rgba(19,216,255,.5); background: linear-gradient(145deg,rgba(16,84,118,.42),rgba(9,21,34,.9)); }
.group-chip b { display: block; font-size: 13px; }
.group-chip small { color: var(--muted); }
.member-list { display: grid; gap: 9px; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); background: rgba(10,19,31,.82); border-radius: 16px; }
.avatar { width: 42px; height: 42px; display: grid; place-content: center; border-radius: 14px; background: linear-gradient(145deg,#163554,#0c1928); color: var(--cyan); font-weight: 900; }
.member-row div:nth-child(2) { flex: 1; min-width: 0; }
.member-row b, .member-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-row small { color: var(--muted); margin-top: 3px; font-size: 11px; }
.member-status { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px rgba(54,223,154,.5); }

.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.admin-card { min-height: 150px; text-align: left; padding: 17px; border-radius: 21px; border: 1px solid var(--line); background: linear-gradient(145deg,rgba(17,31,48,.96),rgba(8,15,25,.94)); position: relative; overflow: hidden; }
.admin-card::after { content: ""; position: absolute; inset: auto -30px -50px auto; width: 110px; height: 110px; border-radius: 50%; background: var(--glow); filter: blur(34px); opacity: .25; }
.admin-card.cyan { --glow: var(--cyan); }.admin-card.blue { --glow: var(--blue); }.admin-card.purple { --glow: var(--purple); }.admin-card.steel { --glow: #91a4bb; }
.admin-icon { display: block; font-size: 28px; margin-bottom: 25px; }
.admin-card b, .admin-card small { display: block; position: relative; z-index: 1; }
.admin-card small { color: var(--muted); font-size: 10px; margin-top: 5px; }

.bottom-nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(100%,780px); display: flex; justify-content: space-around; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(124,170,210,.13); background: rgba(5,10,18,.91); backdrop-filter: blur(20px); z-index: 20; }
.nav-item { flex: 1; display: grid; justify-items: center; gap: 4px; padding: 8px 4px; border: 0; background: transparent; color: #60758c; }
.nav-item span { font-size: 21px; line-height: 1; }
.nav-item b { font-size: 9px; font-weight: 700; }
.nav-item.active { color: var(--cyan); }

.sheet-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(0,3,8,.68); backdrop-filter: blur(5px); }
.sheet { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 31; width: min(100%,780px); max-height: 92dvh; overflow-y: auto; padding: 8px 18px calc(22px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; border: 1px solid rgba(129,184,228,.18); background: #0a121e; box-shadow: 0 -30px 80px rgba(0,0,0,.5); animation: sheetIn .25s ease; }
@keyframes sheetIn { from { transform: translate(-50%,100%); } }
.sheet-handle { width: 46px; height: 4px; background: #26384b; border-radius: 99px; margin: 2px auto 18px; }
.sheet-head { display: flex; align-items: start; justify-content: space-between; margin-bottom: 20px; }
.sheet-head h2 { margin: 5px 0 0; font-size: 24px; }
.close-button { width: 38px; height: 38px; border-radius: 13px; border: 1px solid var(--line); background: #111e2e; color: #9ab0c5; font-size: 25px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #91a7bc; font-size: 11px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; color: var(--text); border: 1px solid rgba(128,173,211,.16); background: #0e1a29; border-radius: 14px; padding: 13px 14px; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(19,216,255,.55); box-shadow: 0 0 0 3px rgba(19,216,255,.07); }
.field textarea { min-height: 105px; resize: vertical; }
.primary-button { width: 100%; border: 0; border-radius: 15px; padding: 14px 18px; background: linear-gradient(135deg,#087eff,#12cceb); box-shadow: 0 12px 28px rgba(8,126,255,.22); font-weight: 850; }
.secondary-button { width: 100%; border: 1px solid var(--line); border-radius: 15px; padding: 13px 18px; background: #101c2b; margin-top: 9px; }
.toast { position: fixed; z-index: 50; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom)); width: min(calc(100% - 32px),450px); padding: 13px 16px; border: 1px solid rgba(57,222,160,.25); background: rgba(11,27,31,.95); color: #dfffee; border-radius: 15px; text-align: center; box-shadow: 0 16px 40px rgba(0,0,0,.35); animation: toastIn .2s ease; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%,10px); } }

@media (min-width: 680px) {
  main { padding-left: 24px; padding-right: 24px; }
  .hero-card { min-height: 330px; }
  .stats-grid { gap: 14px; }
  .quick-grid, .admin-grid { grid-template-columns: repeat(4,1fr); }
}
