* { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
    --schedule-bg: var(--bg);
    --schedule-surface: var(--surface);
    --schedule-raised: var(--surface-hover);
    --schedule-text: var(--text-primary);
    --schedule-secondary: var(--text-secondary);
    --schedule-muted: var(--text-muted);
    --schedule-border: var(--border);
    --schedule-border-strong: var(--border-strong);
    --schedule-accent: var(--accent);
    --schedule-accent-hover: var(--accent-hover);
    --schedule-accent-soft: var(--accent-subtle);
    --schedule-danger: var(--error);
    --schedule-danger-bg: var(--error-bg);
    --schedule-shadow: 0 14px 36px rgba(15, 23, 42, 0.1);
}

html {
    min-width: 300px;
    min-height: 100%;
    background: var(--schedule-bg);
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--schedule-bg);
    color: var(--schedule-text);
    font-family: var(--type-family-body, "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
    font-size: var(--type-body-product-size, 0.9rem);
    line-height: var(--type-body-product-line, 1.5);
    -webkit-font-smoothing: antialiased;
}
html.is-embedded, html.is-embedded body { min-height: 0; }
html.is-embedded .schedule-shell { min-height: 0; }

button, a { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.schedule-shell {
    width: 100%;
    max-width: 1160px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 24px;
}

.schedule-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 18px;
}

.schedule-heading { min-width: 0; }

h1, h2, h3, p { overflow-wrap: anywhere; }
h1 {
    margin: 0;
    font-family: var(--type-family-display, "Space Grotesk", sans-serif);
    font-size: var(--type-headline-size, 1.5rem);
    line-height: var(--type-headline-line, 1.2);
    letter-spacing: var(--type-headline-tracking, -0.5px);
}

.schedule-timezone {
    margin: 5px 0 0;
    color: var(--schedule-muted);
    font-size: var(--type-body-compact-size, 0.8rem);
}

.schedule-view-toggle {
    display: inline-flex;
    flex-shrink: 0;
    padding: 3px;
    border: 1px solid var(--schedule-border);
    border-radius: 8px;
    background: var(--schedule-raised);
}
.schedule-view-toggle button + button { margin-left: 2px; }

.schedule-view-toggle button {
    min-height: 44px;
    padding: 8px 14px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--schedule-secondary);
    font-size: var(--type-control-sm-size, 0.8rem);
    font-weight: var(--type-control-weight, 600);
    cursor: pointer;
}

.schedule-view-toggle button[aria-pressed="true"] {
    background: var(--schedule-accent-soft);
    color: var(--schedule-accent);
}

.schedule-view-toggle button:hover { color: var(--schedule-text); }
button:focus-visible, a:focus-visible, summary:focus-visible {
    outline: 3px solid var(--schedule-accent);
    outline-offset: 2px;
}

.schedule-toolbar {
    display: grid;
    grid-template-columns: 44px auto 1fr 44px;
    align-items: center;
    gap: 8px;
    min-height: 64px;
    padding: 8px 12px;
    border: 1px solid var(--schedule-border);
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
    background: var(--schedule-surface);
}

.schedule-toolbar h2 {
    margin: 0;
    padding: 0 8px;
    text-align: center;
    font-family: var(--type-family-display, "Space Grotesk", sans-serif);
    font-size: var(--type-title-size, 1.125rem);
    line-height: var(--type-title-line, 1.25);
}

.schedule-icon-button,
.schedule-today-button {
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--schedule-border-strong);
    border-radius: 8px;
    background: var(--schedule-surface);
    color: var(--schedule-secondary);
    cursor: pointer;
}
.schedule-icon-button { display: grid; place-items: center; padding: 0; }
.schedule-icon-button svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; }
.schedule-today-button { padding: 8px 14px; font-weight: 600; }
.schedule-icon-button:hover, .schedule-today-button:hover { background: var(--schedule-raised); color: var(--schedule-text); }
.schedule-icon-button:disabled { opacity: 0.4; cursor: default; }

.schedule-content {
    min-height: 300px;
    border: 1px solid var(--schedule-border);
    border-radius: 0 0 12px 12px;
    background: var(--schedule-surface);
    box-shadow: var(--schedule-shadow);
    overflow: hidden;
}

.schedule-status {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    border: 1px solid var(--schedule-border);
    border-radius: 0 0 12px 12px;
    background: var(--schedule-surface);
    color: var(--schedule-secondary);
    box-shadow: var(--schedule-shadow);
}
.schedule-status .schedule-spinner { margin-right: 10px; }

.schedule-status[hidden] { display: none !important; }
.schedule-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--schedule-border);
    border-top-color: var(--schedule-accent);
    border-radius: 50%;
    animation: schedule-spin 0.8s linear infinite;
}
@keyframes schedule-spin { to { transform: rotate(360deg); } }

.schedule-empty {
    display: grid;
    place-items: center;
    min-height: 300px;
    padding: 36px 20px;
    text-align: center;
}
.schedule-empty h3 { margin: 0; font-family: var(--type-family-display, "Space Grotesk", sans-serif); font-size: var(--type-title-size, 1.125rem); }
.schedule-empty p { max-width: 50ch; margin: 8px 0 0; color: var(--schedule-secondary); }

.month-weekdays,
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.month-weekdays { border-bottom: 1px solid var(--schedule-border); }
.month-weekdays span {
    padding: 10px 8px;
    color: var(--schedule-muted);
    font-size: var(--type-label-size, 0.75rem);
    font-weight: var(--type-label-weight, 600);
    letter-spacing: var(--type-label-tracking, 0.8px);
    text-align: center;
    text-transform: uppercase;
}
.month-day {
    min-width: 0;
    min-height: 116px;
    padding: 8px;
    border-right: 1px solid var(--schedule-border);
    border-bottom: 1px solid var(--schedule-border);
    border-top: 0;
    border-left: 0;
    background: var(--schedule-surface);
    color: var(--schedule-text);
    font: inherit;
    text-align: left;
}
.month-day:nth-child(7n) { border-right: 0; }
.month-day:nth-last-child(-n + 7) { border-bottom: 0; }
.month-day.is-outside { background: var(--schedule-raised); }
.month-day.is-past { color: var(--schedule-muted); }
.month-day.is-unavailable { color: var(--schedule-muted); cursor: default; }
.month-date {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-bottom: 5px;
    border-radius: 99px;
    font-size: var(--type-caption-size, 0.75rem);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.month-day.is-today .month-date { background: var(--schedule-accent); color: var(--text-on-accent, #fff); }
.month-count { display: none; }
.month-session {
    display: block;
    width: 100%;
    min-height: 44px;
    margin-top: 4px;
    padding: 5px 6px;
    border: 0;
    border-radius: 6px;
    background: var(--schedule-raised);
    color: var(--schedule-text);
    text-align: left;
    cursor: pointer;
}
.month-session-time { display: block; color: var(--schedule-secondary); font-size: var(--type-caption-size, 0.75rem); font-variant-numeric: tabular-nums; }
.month-session strong { display: block; margin-top: 1px; font-size: var(--type-body-compact-size, 0.8rem); line-height: 1.25; }
.month-session.is-changed { background: var(--schedule-accent-soft); }
.month-session.is-cancelled { background: var(--schedule-danger-bg); color: var(--schedule-danger); text-decoration: line-through; }
.month-session.is-unavailable { background: var(--schedule-danger-bg); }
.month-session.is-unavailable .month-session-time { color: var(--schedule-danger); }
.month-more { margin: 5px 0 0; color: var(--schedule-muted); font-size: var(--type-caption-size, 0.75rem); }
.month-more { min-height: 44px; padding: 8px 0; border: 0; background: transparent; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.month-detail { border-top: 1px solid var(--schedule-border-strong); }

.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); min-height: 340px; }
.week-day { min-width: 0; padding: 14px 9px; border-right: 1px solid var(--schedule-border); }
.week-day:last-child { border-right: 0; }
.week-day h3 { margin: 0 0 12px; font-family: var(--type-family-display, "Space Grotesk", sans-serif); font-size: var(--type-body-compact-size, 0.8rem); text-align: center; }
.week-day h3 span { display: block; margin-bottom: 2px; color: var(--schedule-muted); font-family: var(--type-family-body, "DM Sans", sans-serif); font-size: var(--type-caption-size, 0.75rem); text-transform: uppercase; }
.week-session { margin-top: 8px; padding: 9px; border-radius: 7px; background: var(--schedule-raised); overflow-wrap: anywhere; }
.week-session summary { min-height: 44px; cursor: pointer; }
.week-session-time, .week-session strong { display: block; }
.week-session-time { color: var(--schedule-secondary); font-size: var(--type-caption-size, 0.75rem); font-variant-numeric: tabular-nums; }
.week-session strong { margin-top: 3px; font-size: var(--type-body-compact-size, 0.8rem); line-height: 1.25; }
.week-session p { margin: 4px 0 0; color: var(--schedule-muted); font-size: var(--type-caption-size, 0.75rem); }
.week-session.is-cancelled { background: var(--schedule-danger-bg); }
.week-session.is-cancelled .week-session-time, .week-session.is-cancelled strong { color: var(--schedule-danger); text-decoration: line-through; }
.week-session.is-unavailable { background: var(--schedule-danger-bg); }
.week-session.is-unavailable .week-session-time { color: var(--schedule-danger); }
.week-empty { margin: 22px 0 0; color: var(--schedule-muted); font-size: var(--type-caption-size, 0.75rem); text-align: center; }

.agenda { margin: 0; padding: 0; list-style: none; }
.agenda-day { padding: 18px 20px; border-bottom: 1px solid var(--schedule-border); }
.agenda-day:last-child { border-bottom: 0; }
.agenda-date { margin: 0 0 10px; font-family: var(--type-family-display, "Space Grotesk", sans-serif); font-size: var(--type-title-sm-size, 1rem); }
.agenda-date span { margin-left: 6px; color: var(--schedule-muted); font-family: var(--type-family-body, "DM Sans", sans-serif); font-size: var(--type-caption-size, 0.75rem); font-weight: 500; }
.agenda-session {
    padding: 0;
    border-top: 1px solid var(--schedule-border);
}
.agenda-date + .agenda-session { border-top: 0; }
.agenda-session summary, .agenda-session-heading { min-height: 44px; padding: 12px 0; }
.agenda-session summary { cursor: pointer; }
.agenda-time { color: var(--schedule-secondary); font-variant-numeric: tabular-nums; }
.agenda-session .agenda-time { display: inline-block; width: 28%; padding-right: 16px; vertical-align: top; }
.agenda-details { display: inline-block; width: 66%; vertical-align: top; }
.agenda-details strong { display: block; font-family: var(--type-family-display, "Space Grotesk", sans-serif); font-size: var(--type-title-sm-size, 1rem); }
.agenda-meta { margin: 4px 0 0; color: var(--schedule-muted); font-size: var(--type-body-compact-size, 0.8rem); }
.agenda-session.is-cancelled .agenda-time, .agenda-session.is-cancelled strong { color: var(--schedule-danger); text-decoration: line-through; }
.agenda-session.is-unavailable .agenda-time { color: var(--schedule-danger); }
.session-detail-body { padding: 0 0 14px; }
.agenda-session > .session-detail-body { padding-left: 28%; }
.session-detail-body p { margin: 4px 0 0; }
.session-public-details { color: var(--schedule-secondary); }
.session-status { display: inline-block; margin-top: 5px; padding: 2px 7px; border-radius: 99px; background: var(--schedule-danger-bg); color: var(--schedule-danger); font-size: var(--type-caption-size, 0.75rem); font-weight: 600; }
.session-status.is-changed { background: var(--schedule-accent-soft); color: var(--schedule-accent); }

.schedule-footer {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 60px;
    padding: 14px 4px;
    color: var(--schedule-muted);
    font-size: var(--type-caption-size, 0.75rem);
}
.schedule-signup { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; color: var(--schedule-accent); font-size: var(--type-control-size, 0.85rem); font-weight: 600; text-underline-offset: 3px; }
.schedule-signup:hover { color: var(--schedule-accent-hover); }
.schedule-retry { min-height: 44px; margin-top: 18px; padding: 8px 18px; border: 1px solid var(--schedule-accent); border-radius: 8px; background: var(--schedule-accent); color: var(--text-on-accent, #fff); font-weight: 600; cursor: pointer; }

@media (max-width: 640px) {
    .schedule-shell { padding: 16px; }
    .schedule-header { align-items: stretch; grid-template-columns: 1fr; row-gap: 14px; }
    .schedule-view-toggle { width: 100%; }
    .schedule-view-toggle button { flex: 1; padding-left: 8px; padding-right: 8px; }
    .schedule-toolbar { grid-template-columns: 44px 1fr 44px; }
    .schedule-today-button { grid-column: 1 / -1; grid-row: 2; width: 100%; }
    .schedule-toolbar h2 { font-size: var(--type-title-sm-size, 1rem); }
    .month-weekdays span { padding-left: 2px; padding-right: 2px; font-size: var(--type-caption-size, 0.75rem); letter-spacing: 0; }
    .month-day { display: grid; min-height: 56px; padding: 4px; place-items: center; cursor: pointer; }
    .month-day.is-selected { background: var(--schedule-accent-soft); box-shadow: inset 0 0 0 2px var(--schedule-accent); }
    .month-date { width: 26px; height: 26px; margin: 0 auto; }
    .month-count { display: block; margin-top: -4px; color: var(--schedule-muted); font-size: var(--type-caption-size, 0.75rem); font-variant-numeric: tabular-nums; }
    .month-day.is-unavailable .month-count { visibility: hidden; }
    .agenda-day { padding: 16px; }
    .agenda-session summary, .agenda-session-heading { padding: 14px 0; }
    .agenda-session .agenda-time,
    .agenda-details { display: block; width: 100%; padding-right: 0; }
    .agenda-details { margin-top: 3px; }
    .agenda-session > .session-detail-body { padding-left: 0; }
    .schedule-footer { align-items: flex-start; grid-template-columns: 1fr; row-gap: 16px; }
}

@media (max-width: 360px) {
    .schedule-shell { padding-left: 4px; padding-right: 4px; }
}

@media (prefers-reduced-motion: reduce) {
    .schedule-spinner { animation: none; }
}
