:root {
    color-scheme: light;
    --ink: #1d2d49;
    --muted: #68778e;
    --line: #dce5ef;
    --surface: #ffffff;
    --canvas: #f3f6fb;
    --accent: #e26046;
    --accent-dark: #c94832;
    --teal: #168b79;
    --danger: #b43c4b;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background:
        radial-gradient(ellipse at 4% 0%, rgb(35 171 151 / 12%), transparent 28rem),
        radial-gradient(ellipse at 96% 5%, rgb(244 170 75 / 14%), transparent 25rem),
        var(--canvas);
    color: var(--ink);
    font: 16px/1.5 "Segoe UI", Arial, sans-serif;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.6rem, 3vw, 2.2rem); }
h2 { margin-bottom: 0; font-size: 1.25rem; }
a { color: #167765; }
a:hover { color: var(--accent-dark); }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem max(1.25rem, calc((100% - 1120px) / 2));
    background: linear-gradient(115deg, #173b58, #176f70 72%, #168b79);
    color: white;
    box-shadow: 0 8px 26px rgb(22 53 75 / 16%);
}
.topbar .eyebrow { color: #ffd16a; }
.topbar .button.secondary { border-color: rgb(255 255 255 / 35%); background: rgb(255 255 255 / 12%); color: white; }
.topbar .button.secondary:hover { background: rgb(255 255 255 / 22%); }
.topbar form { margin: 0; }

.page { width: min(1120px, calc(100% - 2rem)); margin: 2rem auto; }
.panel, .login-card {
    padding: clamp(1.1rem, 3vw, 1.75rem);
    margin-bottom: 1.25rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 10px 28px rgb(31 55 83 / 7%);
}
.panel { border-top: 4px solid #21a58d; }
.calendar-panel { border-top-color: #f0ad49; }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.coach-nav, .student-nav { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; margin-bottom: -1rem; }
.eyebrow { margin-bottom: .35rem; color: var(--teal); font-size: .72rem; font-weight: 750; letter-spacing: .12em; }
.muted, .hint { color: var(--muted); }
.hint { margin: 1rem 0 0; font-size: .9rem; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; align-items: end; }
.stack { display: grid; gap: .7rem; }
label { display: grid; gap: .4rem; font-size: .9rem; font-weight: 650; }
input, select {
    width: 100%;
    min-height: 42px;
    padding: .6rem .7rem;
    border: 1px solid #bdceca;
    border-radius: 7px;
    background: white;
    color: var(--ink);
    font: inherit;
}
input:focus, select:focus { outline: 3px solid rgb(18 107 89 / 18%); border-color: var(--accent); }

button {
    min-height: 42px;
    padding: .65rem 1rem;
    border: 0;
    border-radius: 9px;
    background: linear-gradient(135deg, #e96d4d, #d94f3e);
    color: white;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    box-shadow: 0 4px 10px rgb(205 74 52 / 16%);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
button:hover { background: linear-gradient(135deg, #da5b3e, #c94332); box-shadow: 0 6px 14px rgb(205 74 52 / 23%); transform: translateY(-1px); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid rgb(18 139 121 / 38%); outline-offset: 2px; }
button.secondary { border: 1px solid var(--line); background: #f7f9fc; color: var(--ink); box-shadow: none; }
button.secondary:hover { background: #eaf0f6; }
button.small { min-height: 34px; padding: .4rem .7rem; font-size: .87rem; }
.form-action { display: flex; align-items: end; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .8rem .65rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f1f6fa; color: #52657d; font-size: .82rem; font-weight: 750; }
tbody tr { transition: background .15s ease; }
tbody tr:nth-child(even) { background: #fbfcfe; }
tbody tr:hover { background: #f1f8f6; }
.badge { display: inline-block; padding: .2rem .55rem; border-radius: 99px; background: #e4f4ef; color: #176e5d; font-size: .8rem; font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.actions form { margin: 0; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.inline-form input, .inline-form select { width: auto; min-width: 115px; min-height: 34px; padding: .35rem; font-size: .85rem; }
.student-select { min-width: 0; padding: .55rem; border: 1px solid var(--line); border-radius: 7px; }
.student-select legend, .student-select summary { color: var(--accent); cursor: pointer; font-size: .84rem; font-weight: 700; }
.student-select label { display: flex; align-items: center; gap: .4rem; margin-top: .35rem; font-weight: 500; }
.student-select input[type="checkbox"] { width: auto; min-height: 0; margin: 0; }
.student-select .hint { margin: .55rem 0 0; }
.completion-price[hidden] { display: none; }

.slot-list { display: grid; gap: .7rem; }
.slot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 0; border-top: 1px solid var(--line); }
.slot p { margin: .2rem 0 0; }
.calendar-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: 1rem; }
.calendar-navigation, .calendar-view-switch { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.calendar-navigation strong { margin-left: .35rem; }
.calendar-link { display: inline-flex; min-height: 36px; align-items: center; padding: .35rem .7rem; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); font-size: .9rem; font-weight: 650; text-decoration: none; }
.calendar-link:hover, .calendar-link.current { border-color: #ed9778; background: #fff0e9; color: #a94331; }
.calendar-link.calendar-arrow { width: 42px; min-height: 38px; justify-content: center; padding: 0; color: #167765; font-size: 1.45rem; line-height: 1; }
.calendar-link.calendar-arrow:hover { border-color: #8bcbbb; background: #e8f7f2; color: #0e6556; }
.calendar-scroll { overflow-x: auto; }
.calendar-grid { display: grid; min-width: 980px; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .55rem; }
.calendar-grid.day-view { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.calendar-day { min-height: 170px; padding: .65rem; border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(160deg, #fff, #f9fbfe); box-shadow: 0 3px 10px rgb(31 55 83 / 4%); }
.calendar-day h3 { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem .5rem; margin: 0 0 .65rem; padding-bottom: .45rem; border-bottom: 2px solid #e8eef4; color: #38536d; font-size: .9rem; }
.calendar-events { display: grid; gap: .45rem; }
.calendar-gap { padding: .25rem .55rem; border-left: 2px dashed #9aa9a5; color: var(--muted); font-size: .75rem; }
.calendar-event { padding: .6rem; border-left: 4px solid var(--teal); border-radius: 8px; background: #eaf8f4; font-size: .84rem; }
.calendar-event.lesson-event { border-left-color: #5385cb; background: #edf4ff; }
.calendar-event.student-lesson-event { border-left-color: #9461c5; background: #f5efff; }
.calendar-event p { margin: .25rem 0 0; }
.calendar-booking { margin-top: .5rem; }
.calendar-event-management { margin-top: .55rem; padding-top: .4rem; border-top: 1px solid rgb(23 43 42 / 12%); }
.calendar-event-management summary { color: #176e5d; cursor: pointer; font-size: .8rem; font-weight: 700; }
.calendar-completion { display: flex; flex-wrap: wrap; align-items: end; gap: .45rem; margin-top: .55rem; }
.calendar-completion label { min-width: 130px; font-size: .8rem; }
.calendar-completion input, .calendar-completion select { min-height: 34px; padding: .3rem; }
.calendar-invitees { margin-top: .4rem; }
.calendar-invitee { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .6rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.calendar-invite-form { margin-top: .55rem; }
.calendar-invite-form button { margin-top: .5rem; }
.calendar-cancel-form { margin-top: .6rem; }
.calendar-event-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem; }
.calendar-status { display: inline-block; padding: .12rem .45rem; border-radius: 99px; font-size: .72rem; font-weight: 700; }
.calendar-status.available, .calendar-status.accepted, .calendar-status.completed { background: #d9f3e8; color: #146448; }
.calendar-status.pending { background: #fff0cb; color: #82570b; }
.calendar-status.closed { background: #ffe4e7; color: #a32d43; }
.calendar-participants { color: var(--muted); }
.calendar-empty { padding: .4rem 0 .7rem; color: var(--muted); font-size: .84rem; }
.calendar-add { margin-top: .75rem; padding-top: .55rem; border-top: 1px solid var(--line); }
.calendar-add summary { color: #167765; cursor: pointer; font-size: .84rem; font-weight: 700; }
.calendar-add form { margin-top: .6rem; }
.calendar-add label { font-size: .82rem; }
.calendar-add input, .calendar-add select { min-height: 36px; padding: .4rem; font-size: .84rem; }
.empty { padding: 1.25rem; border-radius: 8px; background: var(--canvas); color: var(--muted); }
.notice { padding: .8rem 1rem; margin-bottom: 1rem; border-radius: 8px; }
.notice.success { border: 1px solid #b8e4d2; background: #e2f6ed; color: #155d46; }
.notice.error { border: 1px solid #f1c4c9; background: #fff0f1; color: var(--danger); }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 1rem; background: linear-gradient(120deg, rgb(13 34 52 / 56%), rgb(14 79 75 / 38%)), url("/images/login-background.jpg") center / cover no-repeat fixed; }
.login-card { width: min(420px, 100%); padding: 2rem; border: 0; border-top: 5px solid #f2b84b; box-shadow: 0 24px 60px rgb(8 27 47 / 26%); }
.login-card h1 { margin-bottom: .5rem; }
.login-card .muted { margin-bottom: 1.5rem; }
.login-card button { margin-top: .5rem; }

@media (max-width: 700px) {
    .topbar { align-items: flex-start; padding: 1.1rem 1rem; }
    .page { width: calc(100% - 1rem); margin: 1rem auto; }
    .section-heading { align-items: flex-start; }
    .coach-nav, .student-nav { margin-top: .75rem; margin-bottom: 0; }
    .calendar-scroll, .table-wrap { overflow: visible; }
    .calendar-grid { min-width: 0; grid-template-columns: minmax(0, 1fr); }
    .calendar-day { min-height: 0; }
    .calendar-toolbar { align-items: stretch; }
    .calendar-navigation { display: grid; width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .calendar-navigation .calendar-link { justify-content: center; padding-inline: .35rem; }
    .calendar-navigation .calendar-arrow { justify-self: center; }
    .calendar-navigation strong { grid-column: 1 / -1; margin: .25rem 0 0; text-align: center; }
    .calendar-view-switch { width: 100%; }
    .calendar-view-switch .calendar-link { flex: 1; justify-content: center; }
    .lesson-table, .lesson-table tbody { display: block; width: 100%; }
    .lesson-table thead { display: none; }
    .lesson-table tbody tr {
        display: block;
        margin-bottom: .8rem;
        padding: .35rem .75rem;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: white;
        box-shadow: 0 4px 14px rgb(31 55 83 / 6%);
    }
    .lesson-table tbody td {
        display: grid;
        min-width: 0;
        grid-template-columns: minmax(5.5rem, 34%) minmax(0, 1fr);
        gap: .45rem;
        padding: .55rem 0;
        border-bottom: 1px solid var(--line);
        overflow-wrap: anywhere;
    }
    .lesson-table tbody td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: .76rem;
        font-weight: 750;
    }
    .lesson-table tbody td:last-child { border-bottom: 0; }
    .lesson-table .lesson-state, .lesson-table .lesson-approvals { grid-column: 2; min-width: 0; }
    .lesson-table .lesson-state { display: grid; gap: .25rem; }
    .lesson-table td.actions { display: block; min-width: 0; }
    .lesson-table td.actions form { width: 100%; margin-top: .4rem; }
    .lesson-table td.actions button { width: 100%; white-space: normal; }
}
