:root {
  --navy: #0f2540;
  --navy-2: #16335a;
  --accent: #1e7e34;
  --accent-2: #3788d8;
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e2e8f0;
  --text: #1a2433;
  --muted: #6b7785;
  --danger: #c92a2a;
  --warn: #e8590c;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15,37,64,.08), 0 4px 16px rgba(15,37,64,.06);
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: "DM Sans", system-ui, sans-serif; color: var(--text);
  background: var(--bg); display: flex; flex-direction: column; min-height: 100vh;
}
h1,h2,h3 { font-family: "Outfit", sans-serif; color: var(--navy); }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.block { display: block; width: 100%; }
.nowrap { white-space: nowrap; }

/* Top bar */
.top-bar { background: var(--navy); color: #fff; }
.top-bar-inner { max-width: 1100px; margin: 0 auto; padding: .7rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.logo-link { display: flex; align-items: center; gap: .7rem; color: #fff; }
.logo-link:hover { text-decoration: none; }
.logo-img { height: 38px; width: auto; border-radius: 4px; }
.logo-title { font-family: "Outfit"; font-weight: 700; font-size: 1.1rem; color: #fff; display: block; line-height: 1.1; }
.logo-tagline { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: #9fb3cc; }
.top-nav { display: flex; align-items: center; gap: 1rem; }
.nav-link { color: #cfdbe9; font-weight: 500; font-size: .95rem; }
.nav-link:hover, .nav-link.active { color: #fff; text-decoration: none; }
.nav-admin { color: #ffd9a0; }
.nav-user-name { color: #9fb3cc; font-size: .9rem; }
.nav-logout { color: #ff9a9a; }
.nav-muted { color: #8497ad; }

/* Flash */
.flash-container { max-width: 1100px; margin: .8rem auto 0; padding: 0 1rem; }
.flash { padding: .7rem 1rem; border-radius: 10px; margin-bottom: .5rem; cursor: pointer; font-size: .92rem; }
.flash-success { background: #e6f5ec; color: #1e7e34; }
.flash-error { background: #fdecea; color: var(--danger); }
.flash-info, .flash-warning { background: #fff6e6; color: #8a5800; }

/* Layout */
.main-content { flex: 1; max-width: 1100px; width: 100%; margin: 0 auto; padding: 1.5rem 1rem; }
.site-footer { background: var(--navy); color: #9fb3cc; font-size: .82rem; }
.footer-inner { max-width: 1100px; margin: 0 auto; padding: 1rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.footer-inner a { color: #cfdbe9; }
.footer-sep { opacity: .5; }
.beta-banner { position: fixed; bottom: 0; left: 0; right: 0; background: var(--warn);
  color: #fff; text-align: center; font-size: .8rem; padding: .35rem; z-index: 50; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1rem; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font-weight: 600; font-size: .92rem; cursor: pointer; }
.btn:hover { text-decoration: none; border-color: #c7d2e0; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #196b2c; }
.btn-muted { background: #eef1f5; }
.btn-danger { background: #fff; color: var(--danger); border-color: #f1c4c4; }
.btn-danger:hover { background: #fdecea; }
.btn-subscribe { background: var(--accent-2); color: #fff; border-color: var(--accent-2); }
.btn-sm { padding: .3rem .6rem; font-size: .82rem; border-radius: 8px; }
.block.btn { margin-top: .6rem; }

/* Calendar page */
.cal-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.2rem 1.5rem; }
.cal-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .8rem; margin-bottom: 1rem; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem; }
.legend-item { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line);
  background: #fff; border-radius: 20px; padding: .3rem .8rem; font-size: .85rem; cursor: pointer; color: var(--muted); }
.legend-item.active { border-color: var(--navy); color: var(--navy); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
#calendar { --fc-border-color: var(--line); font-size: .9rem; }
.fc .fc-button-primary { background: var(--navy); border-color: var(--navy); }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--accent); border-color: var(--accent); }
.fc-event { cursor: pointer; }
.fc-event.fc-cancelled { text-decoration: line-through; opacity: .65; }
.legend-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 .3rem; }
.legend-item.toggle:not(.active) { opacity: .4; text-decoration: line-through; }
.legend-item.toggle.disabled { opacity: .25; pointer-events: none; }
.tier-key { display: inline-flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--muted); }
.tier-key.dim { opacity: .3; }
.tier-key .tk { display: inline-flex; align-items: center; gap: .25rem; }

/* Modals */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,37,64,.45);
  z-index: 100; align-items: center; justify-content: center; padding: 1rem; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); max-width: 440px; width: 100%; padding: 1.5rem; box-shadow: var(--shadow); }
.modal h3 { margin-top: 0; }
.copy-label { display: block; margin-top: 1rem; font-size: .82rem; color: var(--muted); }
.copy-box { margin-top: .3rem; padding: .6rem .8rem; background: #f4f6f9; border: 1px dashed #c7d2e0;
  border-radius: 8px; font-family: monospace; font-size: .82rem; word-break: break-all; cursor: pointer; position: relative; }
.copy-box.copied .copy-hint::after { content: " ✓ copied"; color: var(--accent); }
.copy-hint { color: var(--muted); float: right; font-family: "DM Sans"; }
.ev-when { font-weight: 600; color: var(--navy); }
.ev-loc, .ev-desc { color: var(--muted); white-space: pre-wrap; }

/* Auth pages (match the other WESA portals) */
.page-auth .main-content { display: flex; align-items: center; justify-content: center; }
.auth-wrapper { width: 100%; max-width: 440px; }
.auth-card { width: 100%; background: var(--card); border-radius: 16px;
  padding: 2.4rem 2rem; box-shadow: var(--shadow); border: 1px solid var(--line); }
.auth-header { text-align: center; margin-bottom: 1.6rem; }
.auth-logo { height: 64px; width: auto; margin-bottom: .9rem; border-radius: 8px;
  background: var(--navy); padding: 8px 12px; }
.auth-header h1 { font-size: 1.5rem; color: var(--navy); margin: 0 0 .4rem; }
.auth-subtitle { color: var(--muted); font-size: .9rem; line-height: 1.5; margin: 0; }
.auth-icon { display: flex; align-items: center; justify-content: center; width: 64px; height: 64px;
  background: #e6f5ec; border-radius: 50%; margin: 0 auto 1rem; color: var(--accent); }
.auth-form .form-group { margin-bottom: 1.2rem; text-align: left; }
.auth-form label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: .35rem; }
.phone-input-wrap { display: flex; align-items: stretch; }
.phone-prefix { display: flex; align-items: center; padding: 0 14px; background: var(--bg);
  border: 1px solid var(--line); border-right: none; border-radius: 8px 0 0 8px;
  font-weight: 600; color: var(--muted); }
.phone-input-wrap input { border-radius: 0 8px 8px 0; }
.auth-form input[type=tel], .auth-form input[type=text] { width: 100%; padding: .6rem .8rem;
  border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; }
.form-hint { font-size: .8rem; color: var(--muted); margin: 6px 0 0; }
.btn-full { width: 100%; }
.otp-input-group { display: flex; gap: 10px; justify-content: center; }
.otp-digit { width: 48px; height: 56px; text-align: center; font-size: 1.5rem; font-weight: 700;
  font-family: "Outfit", sans-serif; border: 1px solid var(--line); border-radius: 8px; }
.otp-digit:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.auth-actions { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-top: 1rem; }
.auth-sep { color: var(--muted); }
.btn-text { background: none; border: none; color: var(--accent); font-family: inherit;
  font-size: .88rem; font-weight: 500; cursor: pointer; padding: 4px; }
.btn-text:hover { text-decoration: underline; }
.btn-text:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.auth-footer { text-align: center; font-size: .85rem; color: var(--muted); margin-top: 1.2rem;
  padding-top: 1.2rem; border-top: 1px solid var(--line); }
.auth-footer a { color: var(--accent); }

/* Admin */
.admin-wrap, .form-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }
.form-wrap { max-width: 720px; margin: 0 auto; }
.admin-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.events-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.events-table th { text-align: left; color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--line); padding: .5rem .6rem; }
.events-table td { border-bottom: 1px solid var(--line); padding: .6rem; vertical-align: top; }
.events-table .actions { display: flex; gap: .4rem; align-items: center; }
.events-table .actions form { margin: 0; }
.pill { background: #eef1f5; border-radius: 20px; padding: .15rem .6rem; font-size: .78rem; }
.pill-warn { background: #fff1e6; color: var(--warn); }
.pill-ok { background: #e6f5ec; color: var(--accent); }
.row-inactive { opacity: .55; }
.inline-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1rem 0 1.5rem; }
.inline-form input { padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; font-size: .95rem; flex: 1; min-width: 160px; }

/* Forms */
.form-wrap label { font-weight: 600; font-size: .9rem; display: block; margin: .9rem 0 .25rem; }
.form-wrap input[type=text], .form-wrap input[type=date], .form-wrap input[type=time],
.form-wrap input[type=number], .form-wrap textarea, .form-wrap select {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; font-size: .95rem; font-family: inherit; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.row { margin-top: .6rem; }
.check, .radio { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500 !important; }
.recurrence { border: 1px solid var(--line); border-radius: 10px; padding: .5rem 1rem 1rem; margin-top: 1.2rem; }
.recurrence legend { font-weight: 700; font-family: "Outfit"; color: var(--navy); padding: 0 .4rem; }
.weekday-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--line);
  border-radius: 8px; padding: .3rem .6rem; font-size: .85rem; cursor: pointer; }
.end-row { display: flex; flex-direction: column; gap: .5rem; }
.end-row input[type=date], .end-row input[type=number] { width: auto; display: inline-block; }
.form-actions { display: flex; gap: .6rem; margin-top: 1.5rem; }

/* Subscription builder */
.sub-section { border: 1px solid var(--line); border-radius: 10px; padding: .5rem 1rem 1rem; margin-top: 1.2rem; }
.sub-section legend { font-weight: 700; font-family: "Outfit"; color: var(--navy); padding: 0 .4rem; }
.sub-label { display: block; font-size: .82rem; color: var(--muted); margin: .8rem 0 .35rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .4rem .6rem; }
.team-tier-head { grid-column: 1 / -1; font-weight: 600; color: var(--navy); font-size: .85rem; margin-top: .5rem; }
.sub-links { margin-bottom: .5rem; }
.sub-divider { border: none; border-top: 1px solid var(--line); margin: 1.4rem 0; }
#gamesOpts { transition: opacity .15s; }
.preset-radio { display: flex; align-items: center; gap: .6rem; padding: .55rem .2rem; border-bottom: 1px solid var(--line); font-weight: 500 !important; }
.preset-radio:last-of-type { border-bottom: none; }
.preset-radio input { flex: 0 0 auto; }
.preset-extra { margin: .2rem 0 .6rem 1.9rem; }
.preset-extra select { padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 8px; font-size: .95rem; min-width: 220px; }
.preset-extra[data-for="custom"] { margin-left: 0; }

@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; }
  .logo-tagline { display: none; }
  .top-nav { gap: .7rem; font-size: .9rem; }
}
