/* Calendar page. Uses the tokens defined in sportcal.css. */
.calendar-dashboard {
    display: grid;
    grid-template-columns: clamp(200px, 14vw, 263px) minmax(0, 1fr) clamp(240px, 17.5vw, 336px);
    min-height: calc(100vh - var(--header-height));
    color: var(--text);
    background: var(--surface-raised);
}
.calendar-dashboard h1 { font-family: var(--font-display); }
.calendar-dashboard a:hover { text-decoration: underline; }
.calendar-sidebar, .calendar-rail { min-width: 0; padding: 20px 17px; }
.calendar-sidebar { border-right: 1px solid var(--border); }
.calendar-rail { display: flex; flex-direction: column; gap: 22px; padding-bottom: 0; border-left: 1px solid var(--border); }
.calendar-workspace { min-width: 0; padding: 21px clamp(16px, 1.5vw, 29px) 36px; }
.dashboard-label { margin: 0 0 11px; color: var(--text-muted); font: 10px/1.45 var(--font-mono); letter-spacing: .13em; text-transform: uppercase; }
.dashboard-muted { color: var(--text-muted); font-size: 12px; line-height: 1.5; }

/* Sidebar */
.mini-calendar { padding: 11px 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-accent); }
.mini-heading { display: flex; align-items: center; gap: var(--space-1); margin-bottom: 6px; }
.mini-heading strong { margin-right: auto; font: 700 17px var(--font-display); white-space: nowrap; }
.mini-heading a { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-sm); color: var(--text-muted); }
.mini-days { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.mini-weekday, .mini-day { display: grid; place-items: center; min-height: 26px; color: var(--text-muted); font: 11px var(--font-mono); }
.mini-day.has-events { position: relative; color: var(--text); font-weight: 500; }
.mini-day.has-events::after { content: ""; position: absolute; bottom: 2px; width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.mini-day.has-conflict { color: var(--warning-text); }
.mini-day.mini-today { color: var(--surface); background: var(--text); border-radius: var(--radius-sm); }
.sidebar-conflicts { margin-top: 22px; padding-top: 9px; }
.sidebar-conflicts h2 { display: flex; justify-content: space-between; align-items: center; color: var(--warning-text); }
.sidebar-conflicts h2 span { font: 700 20px var(--font-display); }
.sidebar-conflict { display: grid; gap: var(--space-1); margin: 13px 0; padding-left: 10px; border-left: 4px solid var(--color-sunset); border-radius: 3px; }
.sidebar-conflict strong { font-size: 12px; }
.sidebar-conflict small { color: var(--warning-text); font: 10px var(--font-mono); text-transform: uppercase; }
.sidebar-filters { margin-top: 27px; }
.sport-filter { --sport-color: var(--text-subtle); display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 9px; padding: 6px 4px; border-radius: var(--radius-sm); color: var(--text-muted); font-size: 12px; }
.sport-filter i, .dashboard-event i, .conflict-fixture i, .rail-result i, .rail-upcoming i, .dashboard-list i { flex: none; width: 7px; height: 7px; border-radius: 2px; background: var(--sport-color); }
.sport-filter b { min-width: 22px; border-radius: 12px; background: color-mix(in srgb, var(--sport-color) 18%, var(--surface)); color: var(--text); font: 11px var(--font-mono); text-align: center; }
.selected-filter { color: var(--text); font-weight: 700; background: color-mix(in srgb, var(--sport-color) 10%, transparent); }
.sidebar-links { display: grid; gap: 9px; margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 12px; }

/* Heading and controls */
.dashboard-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: var(--space-3); margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.dashboard-heading .dashboard-label { margin-bottom: 2px; }
.dashboard-heading h1 { margin: 0; font-size: clamp(38px, 3.4vw, 50px); letter-spacing: -.01em; }
.month-summary { margin: 8px 0 0; color: var(--text-muted); font: 11px var(--font-mono); }
.dashboard-controls, .dashboard-tabs { display: flex; align-items: center; gap: 6px; }
.dashboard-tabs { gap: 14px; margin-left: 6px; padding-left: 14px; border-left: 1px solid var(--border); }
.dashboard-controls .calendar-arrow { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); font-size: 18px; }
.dashboard-today, .dashboard-tabs a { padding: 6px 3px; color: var(--text-muted); font: 11px var(--font-mono); text-transform: uppercase; }
.dashboard-tabs [aria-current] { color: var(--text); border-bottom: 2px solid var(--text); }

/* Featured conflict */
.dashboard-conflict { margin-bottom: 22px; padding: var(--space-4) 21px; border: 1px solid var(--warning-border); border-radius: var(--radius); background: var(--warning-bg); }
.conflict-heading { display: flex; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.conflict-heading .dashboard-label, .conflict-heading time { margin: 0; color: var(--warning-text); font-size: 10px; }
.conflict-heading time { font-family: var(--font-mono); text-align: right; }
.conflict-fixtures { display: grid; grid-template-columns: minmax(0, 1fr) 55px minmax(0, 1fr); gap: 18px; }
.conflict-fixture { display: grid; align-content: start; gap: 3px; }
.conflict-fixture strong { margin-bottom: 4px; font: 700 22px/1.1 var(--font-display); }
.conflict-fixture .dashboard-label { display: flex; align-items: center; gap: 6px; margin: 0; }
.conflict-versus { display: grid; place-items: center; border-inline: 1px solid var(--warning-border); color: var(--warning-text); font: 800 16px var(--font-display); text-transform: uppercase; }
.fixture-meta { color: var(--text-muted); font: 11px/1.3 var(--font-mono); }
.filter-notice { color: var(--warning-text); font-size: 12px; }
.filter-notice a { text-decoration: underline; }

/* Month grid */
.dashboard-grid-scroll { overflow-x: auto; }
.dashboard-grid { width: 100%; table-layout: fixed; border-collapse: collapse; }
.dashboard-grid th { height: 29px; padding: 6px 8px; border: 1px solid var(--border); color: var(--text-muted); font: 10px var(--font-mono); text-align: left; text-transform: uppercase; }
.dashboard-day { height: 94px; padding: 6px 8px; border: 1px solid var(--border); vertical-align: top; }
.dashboard-day:target { background: var(--surface-today); }
.dashboard-day-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; font: 700 19px var(--font-display); }
.dashboard-day.outside-month { background: var(--surface-muted); color: var(--text-subtle); }
.dashboard-day.current-day { background: var(--surface-today); }
.current-day time { color: var(--text-accent); }
.conflict-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-sunset); }
.dashboard-event-list, .dashboard-list { list-style: none; margin: 0; padding: 0; }
.dashboard-event-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.dashboard-event-list li, .dashboard-event { min-width: 0; }
.dashboard-event { display: flex; align-items: start; gap: 5px; padding: 3px 5px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--sport-color) 16%, var(--surface)); font-size: 10px; font-weight: 600; line-height: 1.25; }
.dashboard-event i { width: 6px; height: 6px; margin-top: 3px; }
.dashboard-event span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-event.event-conflict { box-shadow: inset 0 0 0 1px var(--color-sunset); }

/* List view */
.dashboard-list a { display: grid; grid-template-columns: 115px 8px 1fr minmax(0, 145px); align-items: center; gap: 10px; padding: 14px 4px; border-bottom: 1px solid var(--border); }
.dashboard-list time, .dashboard-list a > span { color: var(--text-muted); font-size: 11px; }

/* Right rail */
.partner-card { display: grid; gap: var(--space-2); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.partner-card strong { font: 700 24px var(--font-display); }
.partner-card a { color: var(--text-accent); font-size: 11px; }
.team-group { margin: var(--space-3) 0 var(--space-1); color: var(--text-muted); font: 600 10px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.team-list { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.team-member { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 10px; }
.team-member img, .team-initial { width: 40px; height: 40px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; object-fit: contain; }
.team-initial { display: grid; place-items: center; background: var(--surface-accent); color: var(--text); font: 700 16px var(--font-display); }
.team-member span { display: grid; gap: 2px; min-width: 0; }
.team-member strong { font-size: 13px; }
.team-member small { color: var(--text-muted); font-size: 11px; line-height: 1.35; }
.rail-heading { margin-bottom: 6px; padding-bottom: var(--space-2); border-bottom: 1px solid var(--border); }
.rail-upcoming, .rail-result { display: grid; align-items: center; gap: 10px; min-width: 0; }
.rail-upcoming { grid-template-columns: 38px minmax(0, 1fr) 8px; padding: 7px 0; }
.rail-upcoming time { padding: 5px 0; border-radius: var(--radius); background: var(--surface-accent); text-align: center; }
.rail-upcoming time strong { font: 700 18px/1 var(--font-display); }
.rail-upcoming strong { font-size: 13px; }
.rail-upcoming small, .rail-result small { display: block; margin-top: 2px; color: var(--text-muted); font-size: 10px; }
.rail-upcoming time small { font: 9px var(--font-mono); text-transform: uppercase; }
.rail-upcoming i { width: 8px; height: 8px; border-radius: 50%; }
.rail-result { grid-template-columns: 7px minmax(0, 1fr) auto; padding: 11px 0; border-bottom: 1px solid var(--border); }
.rail-result strong { font-size: 14px; }
.rail-result b { font: 500 11px var(--font-mono); text-align: right; }
.rail-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: auto -17px 0; background: var(--brand-bg); color: var(--text-on-brand); text-align: center; }
.rail-stats div { padding: 13px 4px; }
.rail-stats div + div { border-left: 1px solid rgb(255 255 255 / .12); }
.rail-stats dd { margin: 0 0 5px; font: 700 32px var(--font-display); }
.rail-stats div:first-child dd { color: #64cef5; }
.rail-stats div:nth-child(2) dd { color: #ff9477; }
.rail-stats dt { color: #c5d2df; font: 9px var(--font-mono); text-transform: uppercase; }

/* Week view */
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); }
.week-day { display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 320px; padding: 8px 7px 12px; border-left: 1px solid var(--border); }
.week-day:first-child { border-left: 0; }
.week-day.outside-month { background: var(--surface-muted); }
.week-day.current-day { background: var(--surface-today); }
.week-day-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 2px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.week-day-heading small { color: var(--text-muted); font: 10px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.week-day-heading time { font: 700 22px var(--font-display); }
.current-day .week-day-heading time { color: var(--text-accent); }
.week-event { display: grid; gap: 2px; min-width: 0; padding: 6px 7px; border-left: 3px solid var(--sport-color); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--sport-color) 12%, var(--surface)); }
.week-event strong { font-size: 12px; line-height: 1.25; overflow-wrap: anywhere; }
.week-event small, .week-event-time { overflow: hidden; color: var(--text-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.week-event-time { font-family: var(--font-mono); }
.week-event.event-conflict { box-shadow: inset 0 0 0 1px var(--color-sunset); }
.week-empty { margin: 4px 0 0; color: var(--text-muted); font-size: 11px; }

/* Day view */
.day-agenda { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.day-event { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 18px; padding: var(--space-4) 6px; border-bottom: 1px solid var(--border); }
.day-event time { font: 500 14px var(--font-mono); }
.day-event time small { display: block; margin-top: 3px; color: var(--text-muted); font-size: 11px; font-weight: 400; }
.day-event-body { display: grid; gap: 3px; min-width: 0; padding-left: 14px; border-left: 3px solid var(--sport-color); }
.day-event-body .dashboard-label { display: flex; align-items: center; gap: 6px; margin: 0; }
.day-event-body .dashboard-label i { width: 7px; height: 7px; border-radius: 2px; background: var(--sport-color); }
.day-event-body b { color: var(--warning-text); font-weight: 500; }
.day-event-body strong { font: 700 22px var(--font-display); }
.day-event-body small { color: var(--text-muted); font-size: 12px; }
.day-event.event-conflict { background: var(--warning-bg); }

/* Event drawer */
.event-drawer { position: fixed; inset: 0 0 0 auto; width: min(460px, 100vw); max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0; padding: 0; overflow-y: auto; border: 0; background: var(--bg); color: var(--text); }
.event-drawer::backdrop { background: var(--scrim); }
.drawer-close { position: absolute; top: var(--space-2); right: var(--space-2); z-index: 2; width: var(--tap); height: var(--tap); border: 0; border-radius: 50%; background: rgb(255 255 255 / .12); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
.drawer-loading { padding: var(--space-6) var(--space-5); color: var(--text-muted); font-size: 13px; }
.drawer-event { display: grid; gap: var(--space-4); padding-bottom: var(--space-6); }
.drawer-hero { display: grid; gap: var(--space-3); padding: var(--space-6) var(--space-5) var(--space-5); background: var(--brand-bg); color: var(--text-on-brand); border-bottom: 4px solid var(--sport-color); }
.drawer-hero .sport-tag { color: var(--text-on-brand); background: rgb(255 255 255 / .12); }
.drawer-hero h2 { margin: 0 var(--space-6) 0 0; font-size: 34px; line-height: 1.05; }
.drawer-host { display: flex; align-items: center; gap: var(--space-3); color: var(--text-on-brand); }
.drawer-host .association-logo { width: 40px; height: 40px; border-radius: var(--radius); font-size: 16px; }
.drawer-host span { display: grid; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgb(255 255 255 / .35); }
.drawer-host small { color: var(--brand-text-muted); font-size: 11px; font-weight: 400; text-decoration: none; }
.drawer-facts { display: grid; gap: 0; margin: 0 var(--space-4); padding: 0; list-style: none; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.drawer-facts li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: var(--space-3); padding: var(--space-4); }
.drawer-facts li + li { border-top: 1px solid var(--border); }
.drawer-fact-icon { width: 40px; height: 40px; padding: 9px; border-radius: var(--radius); background: color-mix(in srgb, var(--sport-color) 14%, var(--surface)); color: var(--text); }
.drawer-facts div { display: grid; gap: 2px; align-content: center; font-size: 14px; }
.drawer-facts strong { font-weight: 700; }
.drawer-facts span { color: var(--text); }
.drawer-facts small { color: var(--text-muted); font-size: 12px; }
.drawer-facts a { justify-self: start; margin-top: 2px; color: var(--text-accent); font-size: 13px; font-weight: 600; }
.drawer-card { margin: 0 var(--space-4); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.drawer-card h3 { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-2); color: var(--text-muted); font: 500 11px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.drawer-card h3 svg { width: 14px; height: 14px; }
.drawer-card .prose { margin: 0; color: var(--text); font-size: 14px; line-height: 1.6; }
.drawer-card .drawer-more { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; margin-top: var(--space-2); color: var(--text-accent); font-size: 13px; font-weight: 600; text-decoration: none; }
.drawer-card .drawer-more:hover { text-decoration: underline; }
.drawer-result { background: var(--success-bg); border-color: transparent; }
.drawer-winner { margin: 0 0 var(--space-1); font: 700 24px var(--font-display); }
.drawer-winner b { margin-left: var(--space-2); font: 500 16px var(--font-mono); color: var(--text-accent); }
.drawer-record { margin: 0 0 var(--space-2); color: var(--record-text); font-size: 13px; font-weight: 700; }
.drawer-conflicts { background: var(--warning-bg); border-color: var(--warning-border); }
.drawer-conflicts h3 { color: var(--warning-text); }
.drawer-conflicts ul { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.drawer-conflicts a { display: grid; color: var(--text); font-size: 14px; }
.drawer-conflicts a span { color: var(--text-muted); font-size: 12px; }
.drawer-share { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 var(--space-4); }
.drawer-share-button { display: inline-flex; flex: 1; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--tap); padding: 0 var(--space-4); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; }
.drawer-share-button svg { width: 18px; height: 18px; }
.drawer-share-button:hover { border-color: var(--text-muted); }

@media (max-width: 930px) {
    .calendar-dashboard { grid-template-columns: 200px minmax(0, 1fr); }
    .calendar-rail { grid-column: 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: var(--space-4); border-top: 1px solid var(--border); }
    .rail-stats { align-self: start; margin: 0; }
    .week-grid { grid-template-columns: minmax(0, 1fr); }
    .week-day { display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: start; column-gap: var(--space-3); min-height: 0; border-left: 0; border-top: 1px solid var(--border); }
    .week-day:first-child { border-top: 0; }
    .week-day > :not(.week-day-heading) { grid-column: 2; }
    .week-day-heading { grid-column: 1; grid-row: 1; flex-direction: column; align-items: flex-start; padding: 0; border-bottom: 0; }
    .week-empty { margin: 2px 0; }
}
@media (max-width: 680px) {
    .calendar-dashboard { display: flex; flex-direction: column; }
    .calendar-workspace { order: -1; padding: var(--space-4) var(--space-3); }
    .calendar-sidebar, .calendar-rail { border-inline: 0; border-top: 1px solid var(--border); }
    .calendar-sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
    .calendar-sidebar > .dashboard-label { display: none; }
    .sidebar-filters, .sidebar-conflicts, .sidebar-links { margin: 0; }
    .dashboard-controls { flex-wrap: wrap; }
    .dashboard-tabs { gap: 10px; }
    .dashboard-conflict { padding: var(--space-3); }
    .conflict-fixtures { grid-template-columns: minmax(0, 1fr) 25px minmax(0, 1fr); gap: var(--space-2); }
    .conflict-fixture strong { font-size: 18px; }
    .dashboard-day { height: 65px; padding: 3px; }
    .dashboard-grid th { padding: 4px; }
    .dashboard-event { gap: 2px; padding: 2px; font-size: 9px; }
    .dashboard-event i { display: none; }
    .dashboard-list a { grid-template-columns: 75px 6px minmax(0, 1fr); }
    .dashboard-list a > span { grid-column: 3; }
    .day-event { grid-template-columns: 76px minmax(0, 1fr); gap: 10px; padding: 14px 2px; }
    .day-event time { font-size: 12px; }
    .day-event-body { padding-left: 10px; }
    .day-event-body strong { font-size: 19px; }
}
@media (max-width: 390px) {
    .calendar-rail { grid-template-columns: minmax(0, 1fr); }
}

/* Sport icons in the calendar */
.sport-filter { grid-template-columns: auto 1fr auto; }
.sport-filter .sport-icon { font-size: 13px; }
.dashboard-event .sport-icon { width: auto; height: auto; background: none; font-size: 10px; }
.dashboard-list a { grid-template-columns: 115px auto 1fr minmax(0, 145px); }
.dashboard-list .sport-icon { font-size: 14px; }
.conflict-fixture .sport-icon, .day-event-body .sport-icon { font-size: 12px; }
.week-event-time { display: flex; align-items: center; gap: 5px; }
.week-event .sport-icon { width: 1.5em; height: 1.5em; font-size: 11px; }
.rail-result { grid-template-columns: auto minmax(0, 1fr) auto; }
.rail-result .sport-icon { font-size: 13px; }
@media (max-width: 680px) {
    .dashboard-event-list { grid-template-columns: repeat(auto-fill, minmax(18px, 1fr)); gap: 2px; }
    .dashboard-event { justify-content: center; padding: 2px 0; }
    .dashboard-event .sport-icon { display: inline-grid; font-size: 12px; }
    .dashboard-event .chip-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .dashboard-list a { grid-template-columns: 75px auto minmax(0, 1fr); }
}

/* Phones: larger tap targets and swipe hint */
.swipe-hint { display: none; }
@media (max-width: 800px) and (pointer: coarse), (max-width: 680px) {
    .swipe-hint { display: block; margin: 6px 0 0; color: var(--text-subtle); font: 10px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
}
@media (max-width: 800px) {
    .dashboard-controls .calendar-arrow { width: var(--tap); height: var(--tap); font-size: 22px; }
    .dashboard-today, .dashboard-tabs a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 6px; font-size: 12px; }
    .sport-filter { min-height: var(--tap); padding: 4px 6px; font-size: 14px; }
    .sidebar-conflict { min-height: var(--tap); align-content: center; }
    .sidebar-links a { display: inline-flex; align-items: center; min-height: var(--tap); font-size: 14px; }
    .mini-heading a { width: var(--tap); height: var(--tap); font-size: 18px; }
    .mini-weekday, .mini-day { min-height: 36px; font-size: 13px; }
    .rail-upcoming, .rail-result { min-height: 56px; }
    .week-event { min-height: var(--tap); padding: 8px 10px; }
    .week-event strong { font-size: 14px; }
    .week-event small, .week-event-time { font-size: 12px; }
    .week-day-heading { min-height: var(--tap); }
    .dashboard-day { height: 72px; }
    .dashboard-event { min-height: 22px; }
}
@media (max-width: 680px) {
    .dashboard-controls { display: grid; grid-template-columns: auto auto 1fr; width: 100%; gap: var(--space-2); }
    .dashboard-today { justify-self: end; }
    .dashboard-tabs { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 0; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-muted); }
    .dashboard-tabs a { justify-content: center; border-radius: 6px; }
    .dashboard-tabs [aria-current] { border-bottom: 0; background: var(--surface); box-shadow: 0 1px 3px rgb(10 35 66 / .15); font-weight: 600; }
    .calendar-workspace.is-leaving-left, .calendar-workspace.is-leaving-right { opacity: .5; transition: opacity .15s; }
}
.dashboard-event .sport-icon svg { width: 11px; height: 11px; }
.sport-filter .sport-icon { font-size: 16px; }
.rail-result .sport-icon { font-size: 16px; }
.sidebar-conflict .inline-icon { color: inherit; }
@media (max-width: 680px) {
    .dashboard-event .sport-icon svg { width: 13px; height: 13px; }
    .dashboard-event { color: color-mix(in srgb, var(--sport-color) 72%, var(--text)); }
}

/* Forecast in the calendar */
.dashboard-day-heading { gap: 4px; }
.dashboard-day-heading .weather-badge { margin-left: auto; font-size: 10px; }
.dashboard-day-heading .conflict-dot { order: 2; }
.week-day-heading .weather-badge { margin-left: auto; }
.day-weather { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--radius); background: var(--surface-accent); font-size: 13px; }
.day-weather svg { flex: none; width: 26px; height: 26px; color: var(--text-accent); }
@media (max-width: 930px) { .week-day-heading .weather-badge { margin-left: 0; } }
@media (max-width: 680px) { .dashboard-day-heading .weather-badge span:not(.sr-only), .dashboard-day-heading .weather-badge { font-size: 0; } .dashboard-day-heading .weather-badge svg { width: 12px; height: 12px; } }
.calendar-sidebar > :first-child { margin-top: 0; }

/* Mobile alignment fixes for the calendar page (phones) */
@media (max-width: 680px) {
    .calendar-sidebar { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); padding: var(--space-4) var(--space-3); }
    .sidebar-conflicts { padding-top: var(--space-2); }
    .sidebar-conflicts h2 a, .rail-heading a { display: inline-flex; align-items: center; min-height: var(--tap); }
    .sidebar-conflicts h2 { margin-bottom: 0; }
    /* Sport filters become one scrolling row of chips instead of a long column. */
    .sidebar-filters { display: flex; flex-wrap: nowrap; gap: var(--space-2); margin: 0 calc(var(--space-3) * -1); padding: 0 var(--space-3) var(--space-1); overflow-x: auto; scrollbar-width: none; }
    .sidebar-filters::-webkit-scrollbar { display: none; }
    .sidebar-filters > .dashboard-label { display: none; }
    .sport-filter { flex: none; grid-template-columns: auto auto auto; min-height: var(--tap); padding: 4px 10px 4px 6px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
    .selected-filter { border-color: var(--sport-color); }
    .sidebar-links { display: none; }
    .calendar-rail { padding: var(--space-4) var(--space-3) 0; gap: var(--space-4); }
    .partner-card a { display: inline-flex; align-items: center; min-height: var(--tap); font-size: 13px; }
    /* Month grid: one full-width icon chip per event, easier to tap. */
    .dashboard-day { height: auto; min-height: 64px; }
    .dashboard-event-list { grid-template-columns: minmax(0, 1fr); gap: 3px; }
    .dashboard-event { min-height: 24px; align-items: center; }
    .dashboard-heading { gap: var(--space-2); }
    .conflict-fixture .fixture-meta { overflow-wrap: anywhere; }
    /* Event slide-out */
    .drawer-hero { padding: var(--space-5) var(--space-4) var(--space-4); }
    .drawer-hero h2 { font-size: 28px; }
    .drawer-facts, .drawer-card, .drawer-share { margin-inline: var(--space-3); }
    .drawer-facts li { grid-template-columns: 36px minmax(0, 1fr); padding: var(--space-3); }
    .drawer-fact-icon { width: 36px; height: 36px; padding: 8px; }
    .drawer-facts a { display: inline-flex; align-items: center; min-height: 36px; }
    .drawer-share { flex-direction: column; }
    .drawer-share-button { flex: none; width: 100%; }
}

/* List view: phones stack icon | date, title, venue (the old rule pushed the icon into the title column) */
.dashboard-list strong { min-width: 0; overflow-wrap: anywhere; }
.dashboard-list a > span:last-child { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 680px) {
    .dashboard-list a { grid-template-columns: 30px minmax(0, 1fr); grid-template-areas: "icon time" "icon title" "icon venue"; column-gap: var(--space-3); row-gap: 3px; align-items: start; min-height: var(--tap); padding: 12px 2px; }
    .dashboard-list .sport-icon { grid-area: icon; align-self: center; font-size: 15px; }
    .dashboard-list time { grid-area: time; font-size: 12px; }
    .dashboard-list strong { grid-area: title; font-size: 16px; line-height: 1.25; }
    .dashboard-list a > span:last-child { grid-area: venue; font-size: 12px; }
}
/* Event search (build .15): a search bar above the calendar with live results that open the slide-out. */
.event-search { position: relative; z-index: 20; display: flex; align-items: center; margin-bottom: var(--space-4); scroll-margin-top: calc(var(--header-height) + var(--space-3)); }
.event-search input { flex: 1; min-width: 0; height: var(--tap); padding: 0 calc(var(--tap) + 2px) 0 42px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: 16px; appearance: none; -webkit-appearance: none; }
.event-search input::placeholder { color: var(--text-subtle); opacity: 1; }
.event-search input::-webkit-search-cancel-button, .event-search input::-webkit-search-decoration { -webkit-appearance: none; }
.event-search input:focus { border-color: var(--text-accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.event-search-icon { position: absolute; left: 13px; width: 19px; height: 19px; color: var(--text-muted); pointer-events: none; }
.event-search.is-loading .event-search-icon { animation: search-pulse .8s ease-in-out infinite alternate; }
@keyframes search-pulse { to { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .event-search.is-loading .event-search-icon { animation: none; } }
.event-search-clear { position: absolute; right: 1px; display: grid; place-items: center; width: var(--tap); height: calc(var(--tap) - 2px); padding: 0; border: 0; border-radius: 0 var(--radius) var(--radius) 0; background: none; color: var(--text-muted); cursor: pointer; }
.event-search-clear[hidden] { display: none; }
.event-search-clear svg { width: 18px; height: 18px; }
.event-search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; max-height: min(65vh, 520px); overflow-y: auto; overscroll-behavior: contain; padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); }
.event-search-results[hidden] { display: none; }
.search-group { margin: var(--space-2) var(--space-2) var(--space-1); color: var(--text-muted); font: 10px/1.45 var(--font-mono); letter-spacing: .13em; text-transform: uppercase; }
.search-group:first-child { margin-top: var(--space-1); }
.search-list { margin: 0 0 var(--space-2); padding: 0; list-style: none; }
.search-result { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--space-3); min-height: var(--tap); padding: 10px var(--space-2); border-radius: var(--radius-sm); }
.calendar-dashboard .search-result:hover, .search-result:hover { text-decoration: none; background: var(--surface-muted); }
.search-result:focus-visible { outline-offset: -2px; background: var(--surface-muted); }
.search-result .sport-icon { margin-top: 2px; font-size: 16px; }
.search-result-body { display: grid; gap: 2px; min-width: 0; }
.search-result time { color: var(--text-accent); font: 11px var(--font-mono); text-transform: uppercase; }
.search-result strong { font: 700 18px/1.15 var(--font-display); overflow-wrap: anywhere; }
.search-result small { color: var(--text-muted); font-size: 12px; overflow-wrap: anywhere; }
.search-result .search-snippet { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-subtle); }
.search-empty { margin: 0; padding: var(--space-3) var(--space-2); color: var(--text-muted); font-size: 13px; }
/* No-JavaScript search page */
.search-page { max-width: 760px; margin: 0 auto; padding: var(--space-5) var(--space-4) var(--space-7); background: var(--surface-raised); }
.search-page h1 { margin: 0 0 var(--space-4); font-size: clamp(36px, 5vw, 50px); }
.search-page-results { padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
@media (max-width: 680px) {
    .event-search { margin-bottom: var(--space-3); }
    .event-search { scroll-margin-top: 64px; }
    .event-search-results { max-height: 55vh; max-height: 55dvh; }
    .search-result .search-snippet { -webkit-line-clamp: 2; }
}

/* Phones (build .16): sport filters come before Conflicts in the sidebar; desktop order unchanged. */
@media (max-width: 680px) {
    .calendar-sidebar > .sidebar-filters { order: -1; }
}
