:root {
    color-scheme: light;
    --ink: #17233c;
    --muted: #4a5871;
    --line: #d7dfed;
    --accent: #244eb0;
    --deep: #172b56;
    --surface: #fff;
    --background: #f3f6fc;
    font: 100%/1.5 system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); }
.shell { max-width: 70rem; margin-inline: auto; padding-inline: clamp(1rem, 3vw, 2rem); }
main.shell { padding-block: clamp(1.75rem, 4vw, 3.5rem); }
.top { background: var(--deep); color: white; }
.top-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 4.5rem; padding-block: .6rem; }
.brand { display: inline-flex; gap: .6rem; align-items: center; color: white; font-size: 1.3rem; font-weight: 750; text-decoration: none; }
.brand span { display: grid; place-items: center; width: 2rem; height: 2rem; background: #dce8ff; color: var(--deep); border-radius: .55rem; }
nav { display: flex; flex-wrap: wrap; gap: .3rem; }
nav a { color: #e3ebff; text-decoration: none; padding: .5rem .65rem; border-radius: .4rem; }
nav a:hover, nav [aria-current] { background: #324779; color: white; }
.portal, .signout { margin-inline-start: auto; }
.portal { color: #dce8ff; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.15; letter-spacing: -.035em; margin-bottom: .45rem; }
h2 { font-size: 1.3rem; line-height: 1.3; }
h3 { font-size: 1.125rem; line-height: 1.35; }
p + p { margin-top: .5rem; }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: .14em; }
button, input, textarea { font: inherit; }
button, .button {
    color: white; background: var(--accent); border: 1px solid transparent; border-radius: .55rem;
    padding: .62rem 1rem; text-decoration: none; font-weight: 650; display: inline-block; cursor: pointer; text-align: center;
}
button:hover, .button:hover { background: #193d90; }
.secondary { color: #22458e; border-color: #b6c8ed; background: #eef4ff; }
.secondary:hover { background: #e0ebff; }
.quiet { background: transparent; padding: .45rem .7rem; border-color: #8296c0; }
.quiet:hover { background: #324779; }
.danger { background: #9c2c37; }
.danger:hover { background: #7d2029; }
:focus-visible { outline: 3px solid #3475de; outline-offset: 3px; }
.top :focus-visible { outline-color: #c3d7ff; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: .85rem; padding: clamp(1rem, 3vw, 1.45rem); }
.auth { max-width: 29rem; margin: clamp(.5rem, 5vw, 4rem) auto; padding: clamp(1.25rem, 4vw, 2rem); }
.auth form, .auth-link { margin-top: 1.2rem; }
.auth button { width: 100%; }
.muted, .optional, small { color: var(--muted); }
.optional { font-weight: 400; }
.stack { display: grid; gap: 1rem; }
.stack > button { justify-self: start; }
.stack > small { margin-top: -.7rem; }
label { display: block; font-weight: 600; }
input:not([type=checkbox]), textarea {
    display: block; width: 100%; min-width: 0; margin-top: .3rem; padding: .52rem .6rem;
    border: 1px solid #9aacc8; border-radius: .42rem; color: var(--ink); background: #fff;
}
input[type=checkbox] { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: .55rem; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.notice { padding: .75rem 1rem; border: 1px solid #9ecab7; background: #e3f7ed; color: #15583b; border-radius: .55rem; margin-bottom: 1.1rem; }
.error { border-color: #dda6ad; background: #fff0f2; color: #852332; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.2rem; }
.empty { color: var(--muted); margin-top: 1rem; }
.event-summary, .slot-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.event-summary, .slot, .reservation, .schedule-row { margin-top: .65rem; }
.event-summary h2 { margin-top: .15rem; }
.when { color: #385789; font-weight: 650; font-size: .925rem; }
.section-title { margin-top: 1.6rem; margin-bottom: .45rem; }
.day { margin-top: 1.25rem; color: #344a70; font-size: 1rem; }
.description { white-space: pre-wrap; overflow-wrap: anywhere; margin: .55rem 0; }
.names { margin-top: .3rem; overflow-wrap: anywhere; }
.back { display: inline-block; margin-bottom: .8rem; }
.form-card { max-width: 48rem; margin-top: 1rem; }
.tag { border-radius: .45rem; padding: .25rem .55rem; color: #15583b; background: #e3f7ed; font-weight: 650; }
.save-bar { position: sticky; bottom: 0; padding-block: .8rem; background: var(--background); }
details { border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .65rem; }
summary { color: var(--accent); cursor: pointer; width: fit-content; }
details form { margin-top: .7rem; }
fieldset { margin: 0; border: 1px solid var(--line); padding: .55rem .8rem; }
fieldset .check + .check { margin-top: .45rem; }
.schedule-row { display: grid; grid-template-columns: minmax(9rem, 14rem) 1fr auto; gap: .75rem; align-items: start; }
.room-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; margin-top: 1.25rem; }
.reservation h3 { margin-bottom: .4rem; }
.room-calendar { margin-top: 1.15rem; }
.calendar-head, .calendar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.calendar-head { justify-content: space-between; margin-bottom: .9rem; }
.calendar-actions .button { padding: .36rem .65rem; }
.calendar-scroll { overflow-x: auto; }
.calendar { width: 100%; min-width: 39rem; table-layout: fixed; border-collapse: collapse; }
.calendar th { text-align: left; padding: .4rem; color: var(--muted); }
.calendar td { height: 5rem; border: 1px solid var(--line); padding: .35rem; vertical-align: top; }
.calendar .outside { background: var(--background); }
.calendar .busy { background: #edf4ff; }
.calendar time { font-weight: 650; }
.calendar time[aria-current] { background: var(--accent); color: #fff; padding: .1rem .35rem; border-radius: .3rem; }
.calendar td a { display: block; margin-top: .3rem; padding: .23rem .32rem; background: #dce8ff; border-radius: .3rem; overflow-wrap: anywhere; font-size: .875rem; }
.calendar td a strong { display: block; }
.reservation:target { outline: 2px solid var(--accent); }
.members { list-style: none; padding: 0; display: grid; gap: .65rem; }
.member-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: .65rem; overflow-wrap: anywhere; }
@media (max-width: 48rem) {
    .top-inner { flex-wrap: wrap; gap: .35rem .7rem; }
    nav { order: 2; width: 100%; }
    nav a { padding-inline: .5rem; }
    .room-grid { grid-template-columns: 1fr; }
}
@media (max-width: 35rem) {
    .pair, .schedule-row { grid-template-columns: 1fr; gap: .4rem; }
    .page-head, .event-summary { flex-direction: column; align-items: start; }
    .slot-head { flex-wrap: wrap; }
}
