:root {
  --bg: #0b1220;
  --panel: #121a2b;
  --panel2: #182236;
  --text: #e8eefc;
  --muted: #9aabcc;
  --accent: #5eb1ff;
  --accent2: #7dffc3;
  --fuel: #5eb1ff;
  --carmel: #ffb86b;
  --chip: #1e2b44;
  --chip-on: #2a4a7a;
  --danger: #ff6b8a;
  --border: #24314d;
  --radius: 12px;
  --tap: 44px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #1a2744 0%, var(--bg) 55%);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100%;
}
a { color: var(--accent); }
.sticky {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(10px);
  background: rgba(11,18,32,.88);
  border-bottom: 1px solid var(--border);
  padding-top: var(--safe-t);
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}
.brand { display: flex; gap: 10px; align-items: center; }
.logo { display: flex; align-items: center; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; gap: 0; line-height: 1.1; }
.title { font-weight: 800; letter-spacing: .02em; font-size: 22px; line-height: 1.1; }
.ver { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.sub { display: none; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.clock { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.badge { padding: 4px 8px; border-radius: 999px; background: var(--chip); font-size: 12px; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 12px 12px 40px; }
.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.row.scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  flex-wrap: nowrap;
  scrollbar-width: thin;
}
.row.scroll::-webkit-scrollbar { height: 6px; }
.row.scroll::-webkit-scrollbar-thumb { background: #3a4d72; border-radius: 99px; }
.row.wrap-row { flex-wrap: wrap; }
.chip-label { color: var(--muted); font-size: 12px; min-width: 48px; flex: 0 0 auto; }
.seg { display: flex; gap: 6px; flex: 1 1 auto; flex-wrap: nowrap; }
.chips {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  min-width: 0;
}
#typeRow {
  align-items: center;
}
.times {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px 20px;
  align-items: flex-start;
  margin-bottom: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.time-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}
.time-block-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.time-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.changes-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  padding: 0;
  min-height: var(--tap);
}
.changes-title {
  font-weight: 700;
  margin: 0;
}
.changes-plus {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  background: var(--chip);
  flex: 0 0 auto;
}
.changes-toggle.open .changes-plus { background: var(--chip-on); }
.changes-body { font-size: 13px; }
.changes-body ul {
  margin: 6px 0 0;
  padding-left: 18px;
}
.changes-body li { margin: 4px 0; }
.changes-body .chg-new { color: var(--accent2); }
.changes-body .chg-moved { color: #ffd56b; }
.changes-body .chg-changed { color: var(--carmel); }
.changes-body .chg-cancelled { color: var(--danger); }
.day-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.day-col {
  min-width: 0;
}
.day-col .day {
  margin-top: 8px;
}
#toggleStarred.on {
  background: #4a3a12;
  border-color: #ffd56b;
  color: #ffd56b;
}
.time-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  color: var(--text);
  font-size: 13px;
}
input[type="time"] {
  background: #0d1526;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  min-height: var(--tap);
  font: inherit;
  color-scheme: dark;
}
.phone-hint { color: var(--muted); font-size: 12px; }
.hide-row { margin-bottom: 0; }
.seg button, .chip, .btn {
  border: 1px solid var(--border);
  background: var(--chip);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  min-height: var(--tap);
  cursor: pointer;
  white-space: nowrap;
  font: inherit;
}
.seg button.on, .chip.on { background: var(--chip-on); border-color: var(--accent); color: #fff; }
.btn.primary { background: #1f4f8a; border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn:active, .seg button:active, .chip:active { transform: scale(.98); }
.search, .select, label input, label textarea {
  background: #0d1526;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: var(--tap);
  font: inherit;
}
.search { flex: 1; min-width: 160px; }
.search.short { max-width: 140px; flex: 0 1 140px; }
.select { min-width: 120px; }
.controls .btn.on, #togglePast.on, #toggleHide.on {
  background: #24553a;
  border-color: var(--accent2);
}
.day {
  margin: 14px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
/* Desktop: two days side by side — leave phone single column */
@media (min-width: 900px) {
  .wrap { max-width: 1200px; }
  #typeRow {
    flex-wrap: wrap;
    overflow: visible;
    align-items: flex-start;
  }
  #typeRow .chips {
    flex: 1 1 100%;
    flex-wrap: wrap;
  }
  .times {
    flex-wrap: wrap;
    overflow: visible;
  }
  .day-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    align-items: start;
  }
  .day-col {
    background: rgba(0,0,0,.12);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px 8px 8px;
  }
  .day-col .day { margin-top: 6px; }
}
.session.removed,
.session.removed .time,
.session.removed .name,
.session.removed .where,
.session.removed .tag,
.session.removed .note-preview,
.session.removed .muted {
  color: #ff4d4d !important;
}
.session.removed {
  background: rgba(255, 60, 60, 0.12);
  border-color: #ff4d4d;
}
.session.removed .tag {
  background: rgba(255, 60, 60, 0.2);
}
.session {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.session:hover { background: rgba(255,255,255,.03); border-color: var(--border); }
.session-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.session-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.time { font-variant-numeric: tabular-nums; color: var(--accent2); font-weight: 600; font-size: 13px; flex: 0 0 auto; }
.meta { min-width: 0; }
.name { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; word-break: normal; }
.where {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
  font-size: 12px;
}
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #22304c;
  color: var(--muted);
}
.tag.fuel { background: rgba(94,177,255,.15); color: var(--fuel); }
.tag.carmel { background: rgba(255,184,107,.15); color: var(--carmel); }
.tag.popweaver { background: rgba(167,139,250,.18); color: #7c3aed; }
.panel.important {
  border-color: #b45309;
  background: #fff7ed;
  color: #1c1917;
}
.panel.important .changes-title { color: #9a3412; font-weight: 800; }
.panel.important .changes-body,
.panel.important .changes-body li,
.panel.important .muted {
  color: #292524 !important;
}
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.iconbtn {
  width: var(--tap);
  height: var(--tap);
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--chip);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}
.iconbtn.star.on { color: #ffd56b; border-color: #ffd56b; }
.note-preview { color: var(--muted); font-size: 12px; margin-top: 2px; }
.foot {
  text-align: center;
  padding: 24px 12px calc(24px + var(--safe-b));
  color: var(--muted);
  font-size: 13px;
}
.foot-tools {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  max-width: 280px;
  margin: 14px auto 8px;
}
.foot-tools .btn {
  display: block;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}
.foot-note {
  max-width: 420px;
  margin: 8px auto 0;
  line-height: 1.4;
}
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.auth-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: grid;
  gap: 12px;
}
.auth-card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.err { color: var(--danger); min-height: 1.2em; }
dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  padding: 0;
  width: min(420px, calc(100vw - 24px));
}
dialog::backdrop { background: rgba(0,0,0,.55); }
#noteForm { display: grid; gap: 10px; padding: 16px; }
#noteForm label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; }
.hidden { display: none !important; }
.empty { color: var(--muted); padding: 24px 8px; text-align: center; }

@media (max-width: 699px) and (orientation: portrait) {
  .session { display: flex; flex-direction: column; }
  .chip-label { min-width: 40px; }
  .seg button, .chip, .btn { padding: 8px 10px; }
  .day-grid {
    display: flex;
    flex-direction: column;
  }
  .day-col {
    background: transparent;
    border: none;
    padding: 0;
  }
  .note-preview {
    display: block;
    font-size: 12px;
    line-height: 1.35;
  }
}
/* Tablet / large phone / landscape: two day columns */
@media (min-width: 700px), (orientation: landscape) and (min-width: 560px) {
  .day-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    align-items: start;
  }
  .day-col {
    background: rgba(0,0,0,.12);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px 8px 8px;
  }
  .day-col .day { margin-top: 6px; }
}
.cal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 2px 8px;
}
.cal-head .btn.on {
  background: #0369a1;
  color: #fff;
}
.session-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .02em;
}
.cal-tools {
  gap: 8px;
  flex-wrap: wrap;
}
.cal-tools .btn {
  flex: 0 0 auto;
}

/* Coach / Skater mode switch */
.mode-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-right: 6px;
}
.mode-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.mode-switch button.on {
  background: var(--accent, #3b82f6);
  color: #fff;
}

/* Available / Claimed badges & buttons */
.btn.avail {
  background: #059669;
  color: #fff;
  border-color: #059669;
}
.btn.avail:hover { filter: brightness(1.08); }
.btn.taken {
  background: #64748b;
  color: #fff;
  border-color: #64748b;
}
.btn.claim {
  background: #d97706;
  color: #fff;
  border-color: #d97706;
}
.badge.claimed {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
  font-weight: 700;
}
.badge.available-mark {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}
.coach-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 8px 0 4px;
}
.coach-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel, #1e293b);
  border: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
}
.coach-chip.on {
  border-color: var(--accent, #3b82f6);
  background: color-mix(in srgb, var(--accent) 20%, transparent);
}
.coach-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 10px;
}
.share-list { max-height: 240px; overflow: auto; margin: 10px 0; }
.share-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.share-item code { font-size: 16px; letter-spacing: 0.06em; word-break: break-all; }
.share-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.redemption-list { margin-top: 8px; font-size: 13px; }
.redemption-list details { margin: 4px 0; }
.session.claimed-row { border-left: 3px solid #f59e0b; }
.session.available-row { border-left: 3px solid #10b981; }
.session.filtered-out { opacity: 0.45; }
.badge.practice-mark, .btn.practice {
  background: #0ea5e9;
  color: #fff;
  font-weight: 800;
  border-color: #0284c7;
}
.badge.game-mark, .btn.game {
  background: #ef4444;
  color: #fff;
  font-weight: 800;
  border-color: #dc2626;
}
#nameDlg, #shareDlg, #addCoachDlg { max-width: 420px; width: 92vw; }
.btn.avail-idle {
  background: #94a3b8;
  color: #fff;
  border-color: #94a3b8;
}
.btn.avail {
  background: #059669;
  color: #fff;
  border-color: #059669;
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.35);
}
.btn.taken {
  background: #b45309;
  color: #fff;
  border-color: #b45309;
}
.coach-actions { width: 100%; align-items: center; }
#btnRemoveCoach { margin-left: auto; }
.badge.new-badge {
  background: #facc15;
  color: #111;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 4px;
}
.tz-banner {
  background: #7c2d12;
  color: #fff;
  text-align: center;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}
.btn.on {
  outline: 2px solid var(--accent, #3b82f6);
}

/* Dual roles: Coach vs Team coach feel distinct */
.coach-chip.coach-chip-personal { border-color: #38bdf8; }
.coach-chip.coach-chip-personal.on { background: #0c4a6e; border-color: #38bdf8; color: #e0f2fe; }
.coach-chip.team-chip { border-color: #a78bfa; }
.coach-chip.team-chip.on { background: #4c1d95; border-color: #a78bfa; color: #ede9fe; }
.btn.team-role { background: #5b21b6; border-color: #7c3aed; color: #fff; }
.btn.coach-role { background: #0369a1; border-color: #0ea5e9; color: #fff; }
.team-role-hint { color: #c4b5fd !important; }
.coach-role-hint { color: #7dd3fc !important; }


/* Family-only star (partner starred; you cannot remove) */
.iconbtn.star.family-star {
  color: #c4b5fd;
  border-color: #a78bfa;
  background: rgba(91, 33, 182, 0.25);
}
.iconbtn.star.family-star.on,
.iconbtn.star.family-star {
  color: #ddd6fe;
  border-color: #a78bfa;
}

/* Toast banner */
.app-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  max-width: min(420px, calc(100vw - 24px));
  padding: 12px 16px;
  border-radius: 12px;
  background: #1e1b4b;
  border: 1px solid #a78bfa;
  color: #ede9fe;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.watch-banner {
  margin: 6px 0 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(91, 33, 182, 0.22);
  border: 1px solid #a78bfa;
  color: #ede9fe;
  font-size: 13px;
  font-weight: 600;
}

/* Help pages */
.help-page { max-width: 820px; margin: 0 auto; padding: 16px 16px 48px; }
.help-page h1 { font-size: 28px; margin: 8px 0 6px; }
.help-page h2 { font-size: 18px; margin: 22px 0 8px; color: #e0f2fe; }
.help-page p, .help-page li { color: var(--text); line-height: 1.55; font-size: 15px; }
.help-page ul { padding-left: 18px; margin: 8px 0 12px; }
.help-page .lead { color: var(--muted); font-size: 16px; margin-bottom: 18px; }
.help-cards { display: grid; gap: 12px; margin: 18px 0 28px; }
@media (min-width: 700px) {
  .help-cards { grid-template-columns: 1fr 1fr 1fr; }
}
.help-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  color: inherit;
  text-decoration: none;
}
.help-card:hover { border-color: #38bdf8; }
.help-card h3 { margin: 0 0 6px; font-size: 17px; }
.help-card p { margin: 0; color: var(--muted); font-size: 14px; }
.help-card.skater { border-top: 3px solid #38bdf8; }
.help-card.coach { border-top: 3px solid #0ea5e9; }
.help-card.team { border-top: 3px solid #a78bfa; }
.help-nav { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }
.help-note {
  background: rgba(14,165,233,.12);
  border: 1px solid #38bdf8;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
}
.help-foot { margin-top: 28px; color: var(--muted); font-size: 13px; }

.watch-until { font-size: 13px; color: #c4b5fd; font-weight: 600; align-self: center; }

.day-row { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; }
.ignore-day { font-size:12px; padding:4px 8px; }
.ignore-day.on { background:#4c1d95; border-color:#a78bfa; color:#ede9fe; }

#viewSelect.view-dirty {
  opacity: 0.55;
}
