/* Huddle — app styles. Navy + electric lime, team color as accent. Light + dark. */
:root {
  --navy: #0b1530;
  --navy-2: #13224a;
  --lime: #c6f432;
  --team: #c6f432;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --text: #0b1530;
  --muted: #5b6478;
  --line: #e1e6f0;
  --primary-bg: var(--team);
  --primary-fg: #0b1530;
  --yes: #15803d; --yes-bg: #dcfce7;
  --maybe: #b45309; --maybe-bg: #fef3c7;
  --no: #b91c1c; --no-bg: #fee2e2;
  --game: #c2410c; --game-bg: #ffedd5;
  --practice: #1d4ed8; --practice-bg: #dbeafe;
  --event: #7e22ce; --event-bg: #f3e8ff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(11 21 48 / .06), 0 6px 24px rgb(11 21 48 / .06);
  --tabs-h: 64px;
  --top-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070d1f;
    --surface: #101a33;
    --surface-2: #17244a;
    --text: #eef2ff;
    --muted: #9aa4bf;
    --line: #213058;
    --yes: #4ade80; --yes-bg: #0f2e1d;
    --maybe: #fbbf24; --maybe-bg: #33270a;
    --no: #f87171; --no-bg: #3a1414;
    --game: #fb923c; --game-bg: #3a1d0b;
    --practice: #60a5fa; --practice-bg: #0f2347;
    --event: #c084fc; --event-bg: #2b1446;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 28px rgb(0 0 0 / .35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 12px); }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
img, svg, video { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -.02em; }
h1 { font-size: 1.6rem; font-weight: 850; }
h2 { font-size: 1.1rem; font-weight: 800; display: flex; align-items: center; gap: .4rem; }
h3 { font-size: 1rem; font-weight: 750; }
p { margin: 0; }
small { font-size: .82em; }
:focus-visible { outline: 3px solid var(--team); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 99; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

.ic { width: 20px; height: 20px; flex: none; }
.ic.lg { width: 28px; height: 28px; }
.ic.xl { width: 44px; height: 44px; }
.ic.rot90 { transform: rotate(90deg); width: 16px; height: 16px; opacity: .7; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ Shell */
#app { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr); }
#app > * { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: calc(var(--top-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 12px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.titlebar-drag { display: none; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 850; font-size: 1.1rem; letter-spacing: -.02em; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
img.logo { object-fit: cover; }
.team-switch {
  display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 70vw; padding: 6px 10px 6px 6px;
  background: none; border: 0; border-radius: 12px; cursor: pointer; font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em;
}
.team-switch:hover { background: var(--surface-2); }
.team-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-dot { width: 26px; height: 26px; border-radius: 8px; flex: none; box-shadow: inset 0 0 0 2px rgb(0 0 0 / .08), 0 0 0 3px var(--navy); }
.team-dot.lg { width: 34px; height: 34px; border-radius: 10px; }
.team-dot.img { background: none; object-fit: cover; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .1), 0 0 0 3px var(--navy); }
.team-dot.img.lg { border-radius: 10px; }

main { width: 100%; max-width: 1080px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-left)) calc(var(--tabs-h) + var(--safe-b) + 24px); outline: none; }
#app.no-chrome main { padding-bottom: calc(32px + var(--safe-b)); }
#app.no-chrome .tabs { display: none; }

.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 30; height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(1.6) blur(14px);
  border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; font-size: .72rem; font-weight: 700; color: var(--muted); position: relative; }
.tab .ic { width: 23px; height: 23px; }
.tab-ic { position: relative; display: grid; place-items: center; width: 52px; height: 30px; border-radius: 99px; transition: background .2s; }
.tab.active { color: var(--text); }
.tab.active .tab-ic { background: color-mix(in srgb, var(--team) 35%, transparent); }
.badge { position: absolute; top: -4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #ef4444; color: #fff; font-size: .68rem; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--surface); }
.badge.static { position: static; border: 0; display: inline-grid; }

@media (min-width: 960px) {
  #app:not(.no-chrome) { grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: auto 1fr; }
  #app:not(.no-chrome) .topbar { grid-column: 1 / -1; }
  #app:not(.no-chrome) .tabs {
    position: sticky; top: var(--top-h); height: calc(100dvh - var(--top-h)); grid-row: 2; grid-column: 1;
    display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; border-top: 0; border-right: 1px solid var(--line); background: transparent; backdrop-filter: none;
  }
  #app:not(.no-chrome) .tab { flex-direction: row; justify-content: flex-start; gap: 10px; font-size: .95rem; padding: 4px 8px; border-radius: 12px; }
  #app:not(.no-chrome) .tab:hover { background: var(--surface-2); }
  #app:not(.no-chrome) main { grid-column: 2; padding-bottom: 40px; }
}

/* Window Controls Overlay (installed desktop app) */
.wco .topbar {
  position: fixed; left: env(titlebar-area-x, 0); top: env(titlebar-area-y, 0); width: env(titlebar-area-width, 100%); height: env(titlebar-area-height, var(--top-h));
  padding: 0 12px; app-region: drag; -webkit-app-region: drag;
}
.wco .topbar a, .wco .topbar button { app-region: no-drag; -webkit-app-region: no-drag; }
.wco #app { padding-top: env(titlebar-area-height, var(--top-h)); }
.wco .team-switch, .wco .brand { font-size: .9rem; }

.boot { min-height: 60vh; display: grid; place-items: center; }
.boot .logo { width: 72px; height: 72px; animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); opacity: .8; } }

/* ------------------------------------------------------------------ Primitives */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card, section + section { margin-top: 14px; }
.stack > * + * { margin-top: 12px; }
.stack-sm > * + * { margin-top: 4px; }
.row { display: flex; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.gap { gap: 10px; }
.gap { gap: 10px; }
.gap-sm { gap: 4px; }
.row.between, .between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.center { text-align: center; justify-content: center; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hint { color: var(--muted); font-size: .86rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lead { font-size: 1.05rem; margin-bottom: 18px; }
.notes { white-space: pre-wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid transparent; background: var(--surface-2); color: var(--text);
  font-weight: 750; text-decoration: none; cursor: pointer; transition: transform .08s, filter .15s, background .15s; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary-bg); color: var(--primary-fg); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger, .danger { color: var(--no); }
.btn.danger:not(.ghost) { background: var(--no); color: #fff; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .9rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.on-dark { background: rgb(255 255 255 / .12); color: #fff; border-color: rgb(255 255 255 / .18); }
.btn.on-dark:hover { background: rgb(255 255 255 / .2); }
.btn.loading { opacity: .7; pointer-events: none; }
.btn.loading::after { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn[disabled] { opacity: .5; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; cursor: pointer; color: inherit; text-decoration: none; flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn[disabled] { opacity: .3; }
.link { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font-weight: 600; }
.link.tiny { text-decoration: none; opacity: .5; }
.link.tiny .ic { width: 14px; height: 14px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); font-size: .8rem; font-weight: 700; }
.pill .ic { width: 14px; height: 14px; }
.pill.warn { background: var(--maybe-bg); color: var(--maybe); }
.pill.demo { background: var(--navy); color: var(--lime); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: .76rem; font-weight: 750; background: var(--surface-2); color: var(--muted); text-decoration: none; }
.chip .ic { width: 14px; height: 14px; }
.chip.game { background: var(--game-bg); color: var(--game); }
.chip.practice { background: var(--practice-bg); color: var(--practice); }
.chip.event { background: var(--event-bg); color: var(--event); }
.chip.danger { background: var(--no-bg); color: var(--no); }
.chip.tiny { padding: 1px 7px; font-size: .68rem; background: color-mix(in srgb, var(--team) 40%, transparent); color: var(--text); }
.chips.filter .chip { padding: 6px 12px; font-size: .82rem; }
.chips.filter .chip.on { outline: 2px solid currentColor; }
.chips.filter .chip.all.on { background: var(--primary-bg); color: var(--primary-fg); outline: 0; }

.avatar {
  --h: 200; width: 40px; height: 40px; border-radius: 50%; flex: none; display: inline-grid; place-items: center;
  background: hsl(var(--h) 70% 88%); color: hsl(var(--h) 60% 26%); font-weight: 800; font-size: .85rem; letter-spacing: .02em;
}
@media (prefers-color-scheme: dark) { .avatar { background: hsl(var(--h) 45% 28%); color: hsl(var(--h) 90% 88%); } }
.avatar.sm { width: 30px; height: 30px; font-size: .7rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-space { width: 30px; flex: none; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend { font-size: .85rem; font-weight: 700; color: var(--muted); padding: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { border-color: color-mix(in srgb, var(--team) 60%, var(--navy)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--team) 30%, transparent); }
.code-input { font-size: 1.6rem !important; font-weight: 800; letter-spacing: .35em; text-align: center; text-transform: uppercase; }
.w-sm { width: 110px; flex: none; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.check.tiny { font-size: .82rem; color: var(--muted); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--navy); }
@media (prefers-color-scheme: dark) { input[type=checkbox] { accent-color: var(--lime); } }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 14px; max-width: 100%; }
.seg.wrap { flex-wrap: wrap; }
.seg > a, .seg > label > span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: .9rem; text-decoration: none; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg > label { display: contents; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg > a.on, .seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 3px solid var(--team); }
.seg.sm > a { padding: 6px 12px; font-size: .85rem; }
.seg .ic { width: 16px; height: 16px; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { display: block; width: 34px; height: 34px; border-radius: 10px; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .15); cursor: pointer; }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text); }
.swatch input:focus-visible + span { outline: 3px solid var(--team); }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 700; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 40px; height: 24px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgb(0 0 0 / .3); }
.switch input:checked + span { background: var(--yes); }
.switch input:checked + span::after { transform: translateX(16px); }

.list { list-style: none; margin: 0; padding: 0; }
.list.card { padding: 4px 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; text-decoration: none; min-height: 60px; }
.list-row b { display: block; }
.list-row small { display: block; color: var(--muted); }
a.list-row:hover { background: var(--surface-2); }
.list li + li { border-top: 1px solid var(--line); }
.list .ic:last-child { opacity: .4; }

.jersey { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--navy); color: var(--lime); font-weight: 900; font-size: .9rem; flex: none; font-variant-numeric: tabular-nums; }
.jersey.big { width: 44px; height: 44px; font-size: 1.1rem; border-radius: 12px; }
.jersey.huge { width: 84px; height: 84px; font-size: 2.2rem; border-radius: 20px; }
@media (prefers-color-scheme: dark) { .jersey { background: var(--lime); color: var(--navy); } }

/* Page header + toolbar */
.page-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.page-head > .row { flex-wrap: wrap; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 2px; }
.section-head a { font-size: .88rem; font-weight: 700; color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; }
.section-head a .ic { width: 16px; height: 16px; }
.month { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 4px 4px; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty h3 { color: var(--text); }
.empty .ic { opacity: .5; }
.empty .btn { margin-top: 10px; }
.muted-card { color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted-card a { color: var(--text); font-weight: 700; }

/* ------------------------------------------------------------------ Auth */
.auth { max-width: 440px; margin: 4vh auto 0; }
.auth.wide { max-width: 860px; }
.auth-hero { text-align: center; margin-bottom: 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.auth-hero .logo { width: 72px; height: 72px; filter: drop-shadow(0 10px 24px rgb(11 21 48 / .25)); }
.auth-hero h1 { font-size: 2rem; }
.auth-hero p { color: var(--muted); max-width: 34ch; }
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.grid2 .card + .card { margin-top: 0; }

/* ------------------------------------------------------------------ Home */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 22px 20px; color: #fff; display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between;
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--team) 55%, transparent) 0, transparent 55%), linear-gradient(135deg, var(--navy), var(--navy-2));
  box-shadow: var(--shadow);
}
.hero::after { content: ''; position: absolute; inset: auto -20% -60% auto; width: 260px; height: 260px; border-radius: 50%; border: 28px solid color-mix(in srgb, var(--team) 25%, transparent); pointer-events: none; }
.hero h1 { font-size: clamp(1.6rem, 6vw, 2.3rem); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 800; color: var(--team); margin-bottom: 6px; }
.hero-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: .88rem; opacity: .85; }
.hero-stats .role { text-transform: capitalize; background: rgb(255 255 255 / .15); padding: 0 8px; border-radius: 99px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; position: relative; z-index: 1; }
.home-grid { display: grid; gap: 18px; margin-top: 18px; grid-template-columns: minmax(0, 1fr); }
.home-grid > * { min-width: 0; }
@media (min-width: 760px) { .home-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; } }
.announce { display: block; text-decoration: none; border-left: 4px solid var(--team); }
.announce p { margin-top: 8px; }
.chat-preview { display: block; text-decoration: none; }
.chat-preview .row + .row { margin-top: 6px; }
.nudge { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.nudge p { color: var(--muted); font-size: .9rem; }

/* Event cards */
.event-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; position: relative; }
.event-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--practice); }
.event-card.game::before { background: var(--game); }
.event-card.event::before { background: var(--event); }
.event-card.cancelled { opacity: .65; }
.event-card.cancelled h3 { text-decoration: line-through; }
.event-link { display: flex; gap: 14px; padding: 14px 14px 10px 18px; text-decoration: none; }
.event-link:hover h3 { text-decoration: underline; }
.event-date { width: 52px; flex: none; text-align: center; border-radius: 12px; background: var(--surface-2); padding: 6px 0; line-height: 1.05; }
.event-date b { display: block; font-size: 1.5rem; font-weight: 900; }
.event-date span { font-size: .72rem; text-transform: uppercase; font-weight: 800; color: var(--muted); letter-spacing: .06em; }
.event-card h3 { margin: 6px 0 4px; font-size: 1.05rem; }
.event-card.big h3 { font-size: 1.25rem; }
.meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .88rem; }
.meta .ic { width: 15px; height: 15px; }
.event-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 14px 12px 18px; border-top: 1px dashed var(--line); }
.tally { font-size: .82rem; color: var(--muted); }
.tally .yes { color: var(--yes); } .tally .maybe { color: var(--maybe); } .tally .no { color: var(--no); }

.rsvp { display: flex; gap: 6px; flex-wrap: wrap; }
.rsvp-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 750; font-size: .88rem; cursor: pointer; transition: all .15s; }
.rsvp-btn .ic { width: 16px; height: 16px; }
.rsvp-btn:hover { border-color: currentColor; }
.rsvp-btn.yes { color: var(--yes); } .rsvp-btn.maybe { color: var(--maybe); } .rsvp-btn.no { color: var(--no); }
.rsvp-btn.yes.on { background: var(--yes); border-color: var(--yes); color: #fff; }
.rsvp-btn.maybe.on { background: var(--maybe); border-color: var(--maybe); color: #fff; }
.rsvp-btn.no.on { background: var(--no); border-color: var(--no); color: #fff; }
@media (prefers-color-scheme: dark) { .rsvp-btn.on { color: #0b1530 !important; } }
.rsvp.compact .rsvp-btn { min-height: 34px; padding: 0 10px; }
.rsvp.compact .rsvp-btn span { display: none; }
@media (min-width: 520px) { .rsvp.compact .rsvp-btn span { display: inline; } }

/* Event detail */
.event-detail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.event-detail.cancelled .facts { opacity: .6; text-decoration: line-through; }
.facts { margin: 14px 0; display: grid; gap: 12px; }
.facts > div { display: flex; gap: 12px; }
.facts dt { color: var(--muted); padding-top: 2px; }
.facts dd { margin: 0; }
.facts a { font-weight: 700; font-size: .9rem; }
.who-grid { display: grid; gap: 14px; margin-top: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.who h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.who h3 span { opacity: .6; }
.who h3.yes { color: var(--yes); } .who h3.maybe { color: var(--maybe); } .who h3.no { color: var(--no); }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.people li { display: flex; gap: 10px; align-items: center; }
.people small { display: block; color: var(--muted); }
.attendance { list-style: none; margin: 10px 0 0; padding: 0; }
.attendance li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.attendance li + li { border-top: 1px solid var(--line); }
.att { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--yes); }
.att.no { color: var(--no); }
.att.on { background: var(--yes); border-color: var(--yes); color: #fff; }
.att.no.on { background: var(--no); border-color: var(--no); }
.danger-zone { margin-top: 18px; }

/* ------------------------------------------------------------------ Chat */
.chat { display: flex; flex-direction: column; min-height: calc(100dvh - var(--top-h) - var(--tabs-h) - 40px); }
.chat-head { position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top, 0px)); z-index: 5; padding: 8px 0 10px; background: linear-gradient(var(--bg) 70%, transparent); }
.messages { flex: 1; display: flex; flex-direction: column; gap: 2px; padding-bottom: 12px; }
.day-sep { text-align: center; margin: 16px 0 8px; }
.day-sep span { font-size: .75rem; font-weight: 800; color: var(--muted); background: var(--surface-2); padding: 4px 10px; border-radius: 99px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; margin-top: 8px; }
.msg.grouped { margin-top: 2px; }
.msg.mine { flex-direction: row-reverse; }
.msg.mine .avatar-space { display: none; }
.bubble-wrap { max-width: min(78%, 560px); display: flex; flex-direction: column; }
.msg.mine .bubble-wrap { align-items: flex-end; }
.author { font-size: .75rem; font-weight: 750; color: var(--muted); margin: 0 0 3px 12px; }
.bubble { padding: 9px 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); word-wrap: break-word; overflow-wrap: anywhere; }
.msg:not(.mine) .bubble { border-bottom-left-radius: 6px; }
.msg.mine .bubble { background: var(--team); color: #0b1530; border-color: transparent; border-bottom-right-radius: 6px; font-weight: 500; }
.msg.mine .bubble a { color: inherit; }
.msg.announcements .bubble { border-left: 4px solid var(--team); border-radius: 14px; background: var(--surface); color: var(--text); font-size: 1.02rem; }
.msg.pending .bubble { opacity: .65; }
.msg-meta { font-size: .7rem; color: var(--muted); margin: 3px 8px 0; display: flex; align-items: center; gap: 4px; }
.msg-meta .ic { width: 12px; height: 12px; }
.msg-media img { border-radius: 12px; max-height: 280px; margin: -3px -8px 6px; width: calc(100% + 16px); object-fit: cover; }
.composer {
  position: sticky; bottom: calc(var(--tabs-h) + var(--safe-b) + 8px); z-index: 5; display: flex; gap: 8px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 6px; box-shadow: var(--shadow);
}
@media (min-width: 960px) { .composer { bottom: 16px; } }
.composer textarea { border: 0; min-height: 40px; max-height: 160px; padding: 9px 6px; resize: none; background: transparent; box-shadow: none !important; }
.composer .check { padding: 0 6px 4px; }
.composer.readonly { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--muted); padding: 14px; font-size: .9rem; }
.send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--primary-bg); color: var(--primary-fg); display: grid; place-items: center; cursor: pointer; flex: none; }
.send:active { transform: scale(.93); }

/* ------------------------------------------------------------------ Roster */
.player-card { display: flex; gap: 18px; align-items: center; }
.player-card h2 { font-size: 1.4rem; }
.contact-row { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 0 0 8px; display: grid; gap: 8px; }
.contact-row input { min-height: 40px !important; }
.invite .join-code { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--surface-2); border-radius: 14px; padding: 12px; }
.invite .join-code b { font-size: 2rem; letter-spacing: .2em; font-family: ui-monospace, monospace; }
.invite .join-code small { color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.qr { width: 200px; margin: 16px auto 6px; padding: 10px; background: #fff; border-radius: 14px; }
.qr svg { width: 100%; height: auto; }
.qr svg path, .qr svg rect[fill="black"] { fill: #0b1530; }
.invite > .row { margin-top: 14px; }

/* ------------------------------------------------------------------ Photos */
.albums { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.album { text-decoration: none; display: flex; flex-direction: column; gap: 2px; }
.album .cover { aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); margin-bottom: 6px; box-shadow: var(--shadow); }
.album .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.album:hover .cover img { transform: scale(1.04); }
.album small { color: var(--muted); }
.grid-photos { display: grid; gap: 4px; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); border-radius: var(--radius); overflow: hidden; }
.grid-photos.small { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
.photo { position: relative; aspect-ratio: 1; border: 0; padding: 0; background: var(--surface-2); cursor: pointer; overflow: hidden; display: grid; place-items: center; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .play, .photo .uploading { position: absolute; inset: auto 6px 6px auto; background: rgb(0 0 0 / .55); color: #fff; border-radius: 99px; padding: 5px; display: grid; }
.photo .play .ic, .photo .uploading .ic { width: 16px; height: 16px; }
.photo.pending img { opacity: .55; }
.dropzone { border-radius: var(--radius); transition: outline .15s; }
.dropzone.over { outline: 3px dashed var(--team); outline-offset: 6px; }
.lightbox { max-width: min(96vw, 1000px); }
.lightbox figure { margin: 0 0 12px; }
.lightbox img, .lightbox video { max-height: 70vh; margin: 0 auto; border-radius: 12px; }
.lightbox iframe { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 12px; }
.lightbox figcaption { color: var(--muted); font-size: .85rem; text-align: center; margin-top: 8px; }

/* ------------------------------------------------------------------ Settings */
.caps { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.caps li { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; }
.caps li.ok .ic { color: var(--yes); }
.caps li.no { color: var(--muted); }
.caps li.no .ic { color: var(--no); opacity: .7; }
.caps small { display: block; color: var(--muted); }
details summary { cursor: pointer; font-weight: 700; }

/* ------------------------------------------------------------------ Sheets / dialogs */
dialog.sheet {
  width: min(560px, 100vw); max-height: min(88dvh, 900px); margin: auto auto 0; padding: 0; border: 0;
  border-radius: 24px 24px 0 0; background: var(--surface); color: var(--text); box-shadow: 0 -10px 40px rgb(0 0 0 / .25);
  animation: up .25s cubic-bezier(.2, .8, .2, 1);
}
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 24px; animation: pop .2s ease-out; } }
dialog.sheet::backdrop { background: rgb(5 10 25 / .55); backdrop-filter: blur(3px); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px 20px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.sheet-body { padding: 6px 20px calc(20px + var(--safe-b)); overflow: auto; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 12px; }
.progress span { display: block; height: 100%; width: 40%; background: var(--team); border-radius: 99px; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

    .pay-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; width: 100%; text-align: left; cursor: pointer; border-left: 5px solid var(--team); }
    .pay-card .pay-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: color-mix(in srgb, var(--team) 25%, var(--surface)); color: var(--text); flex: none; }
    .pay-card p { margin: 0; }

.finder-row { cursor: pointer; background: none; border: 0; width: 100%; text-decoration: none; }
.finder-row:hover, .finder-row.first { background: var(--surface-2); }

.avatar-btn { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; }
.avatar-btn:focus-visible { outline: 2px solid var(--team); }

.chip.tiny.ok { background: color-mix(in srgb, var(--yes, #22c55e) 18%, var(--surface)); color: var(--text); }
.chip.tiny.warn { background: color-mix(in srgb, #f59e0b 20%, var(--surface)); color: var(--text); }
.chip.tiny.no { background: color-mix(in srgb, var(--no, #ef4444) 15%, var(--surface)); color: var(--text); }

.brand span { color: var(--team); font-weight: 800; }

/* Team logos: square, center-cropped (top/bottom chopped off for non-square art) */
.team-logo-preview, .team-logo, .hero-logo { object-fit: cover; border-radius: 14px; background: var(--surface-2); flex: none; }
.team-logo-preview { width: 56px; height: 56px; }
.team-logo.sm { width: 36px; height: 36px; border-radius: 10px; }
.hero-logo { width: 88px; height: 88px; margin-bottom: 10px; box-shadow: 0 6px 24px rgb(0 0 0 / .25); }

/* Booster hub + photo store */
.booster-pay { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.booster-method { text-align: center; }
.booster-method .qr { background: #fff; padding: 6px; border-radius: 10px; display: inline-block; }
.booster-method .qr svg { width: 110px; height: 110px; }
.flyer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.flyer { border-radius: 12px; overflow: hidden; border: 1px solid var(--surface-2); aspect-ratio: 3/4; }
.flyer img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo { position: relative; }
.photo-status { position: absolute; top: 6px; right: 6px; z-index: 2; }
.sale-chip { position: absolute; top: 6px; right: 6px; }
.watermark { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2;
  background: repeating-linear-gradient(-45deg, transparent 0 14px, rgb(0 0 0 / .04) 14px 28px);
  font: 800 .68rem/1.2 system-ui; color: rgb(255 255 255 / .85); text-shadow: 0 1px 6px rgb(0 0 0 / .8);
  transform: rotate(-18deg); pointer-events: none; letter-spacing: .04em; text-transform: uppercase; }
figure.locked { position: relative; }
figure.locked img, figure.locked video { filter: saturate(.8); }
.watermark.lg { position: absolute; inset: 0; font-size: 1rem; }

/* Reactions */
.reactions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.chip.reaction { border: 1px solid var(--surface-2); background: var(--surface); border-radius: 99px; padding: 2px 9px; font-size: .85rem; cursor: pointer; line-height: 1.5; }
.chip.reaction.mine { border-color: var(--team); background: color-mix(in srgb, var(--team) 18%, var(--surface)); font-weight: 700; }
.reactions.picker { background: var(--surface); border: 1px solid var(--surface-2); border-radius: 14px; padding: 5px; width: fit-content; box-shadow: 0 6px 20px rgb(0 0 0 / .15); margin-top: 4px; }

/* Toasts */
#toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabs-h) + var(--safe-b) + 16px); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; justify-content: space-between; background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: 0 10px 30px rgb(0 0 0 / .3); font-size: .92rem; animation: up .25s ease-out; transition: opacity .3s, transform .3s; }
.toast.ok { border-left: 5px solid var(--lime); }
.toast.err { border-left: 5px solid #f87171; }
.toast.out { opacity: 0; transform: translateY(10px); }
.toast button { background: var(--lime); color: var(--navy); border: 0; border-radius: 10px; padding: 7px 12px; font-weight: 800; cursor: pointer; }
@media (prefers-color-scheme: dark) { .toast { background: #1d2b55; } }

/* View transitions */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Offline tint */
#app.offline .topbar { box-shadow: inset 0 -3px 0 var(--maybe); }

/* ------------------------------------------------------------------ Billing */
#banner:empty { display: none; }
#banner { margin: 0 0 14px; }
#view { outline: none; }
.banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); font-size: .92rem; }
.banner > span { flex: 1; min-width: 200px; }
.banner.warn { background: var(--maybe-bg); color: var(--maybe); border-color: transparent; }
.banner.danger { background: var(--no-bg); color: var(--no); border-color: transparent; }
.banner .btn { background: var(--surface); color: var(--text); }
.banner .btn.primary { background: var(--primary-bg); color: var(--primary-fg); }

/* View-only: hide write controls; the server rejects these regardless */
.view-only [data-write] { display: none !important; }
.view-only .rsvp, .view-only .att { pointer-events: none; opacity: .45; }

.lvl { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 99px; font-size: .78rem; font-weight: 800; background: var(--surface-2); }
.lvl.full { background: var(--yes-bg); color: var(--yes); }
.lvl.trial { background: var(--practice-bg); color: var(--practice); }
.lvl.grace { background: var(--maybe-bg); color: var(--maybe); }
.lvl.readonly, .lvl.locked { background: var(--no-bg); color: var(--no); }
.facts-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

.plans { display: grid; gap: 10px; }
.plan { text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; }
.plan:hover { border-color: var(--text); }
.plan.current { border-color: var(--yes); }
.plan b { font-size: 1.05rem; }
.plan .price { font-weight: 800; }
.plan small { grid-column: 1 / -1; color: var(--muted); }

#update-required { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: rgb(5 10 25 / .72); backdrop-filter: blur(6px); }
#update-required .card { max-width: 380px; width: 100%; }
#update-required .logo { width: 64px; height: 64px; margin: 0 auto; }
