* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

:root {
    --bg: #f6f5f1;
    --panel: #ffffff;
    --ink: #1f2933;
    --muted: #64707d;
    --line: #d8dedb;
    --accent: #2f6f73;
    --accent-strong: #214f52;
    --yellow: #f4d35e;
    --green: #9bcf8f;
    --blue: #c7e1f3;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: var(--accent-strong);
    text-decoration: none;
}

a:hover,
a:focus {
    text-decoration: underline;
}

button,
input,
textarea,
select {
    font: inherit;
}

.site-header {
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 2;
}

.brand {
    color: var(--ink);
    flex: 0 0 auto;
    font-weight: 800;
    white-space: nowrap;
}

nav {
    align-items: center;
    display: flex;
    flex: 0 1 auto;
    gap: 16px;
    justify-content: flex-end;
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
}

nav form {
    align-items: center;
    display: flex;
    margin: 0;
}

button,
.button {
    align-items: center;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    font-weight: 700;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    white-space: nowrap;
}

button:hover,
.button:hover {
    background: var(--accent-strong);
    text-decoration: none;
}

nav button {
    background: transparent;
    border: 0;
    color: var(--accent-strong);
    min-height: auto;
    padding: 0;
}

nav button:hover {
    background: transparent;
    text-decoration: underline;
}

.language-select {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--accent-strong);
    cursor: pointer;
    font-weight: 700;
    min-height: 34px;
    padding: 5px 30px 5px 10px;
    width: auto;
}

.hero {
    align-items: center;
    display: grid;
    gap: 48px;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    margin: 0 auto;
    max-width: 1180px;
    min-height: calc(100vh - 64px);
    padding: 56px 32px;
}

.hero-copy {
    max-width: 720px;
}

.hero h1 {
    font-size: 56px;
    line-height: 1.04;
    margin: 12px 0 20px;
}

.hero p {
    color: var(--muted);
    font-size: 20px;
    line-height: 1.5;
    max-width: 660px;
}

.eyebrow {
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0 0 8px;
    text-transform: uppercase;
}

.actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 28px;
}

.hero .actions a:not(.button) {
    color: var(--accent-strong);
    font-weight: 700;
}

.services,
.workspace,
.auth-layout {
    margin: 0 auto;
    max-width: 1180px;
    padding: 32px;
}

.services {
    display: grid;
    gap: 18px;
    grid-template-columns: 1fr;
    padding: 0;
}

.services article,
.tool-section,
.auth-panel,
.resource-card,
.list-item {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.services article {
    padding: 24px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

p,
small {
    color: var(--muted);
}

.auth-layout {
    display: grid;
    min-height: calc(100vh - 64px);
    place-items: center;
}

.auth-panel {
    max-width: 560px;
    padding: 28px;
    width: 100%;
}

.stack,
.assignment-form,
.card-form,
.profile-form {
    display: grid;
    gap: 14px;
}

label {
    color: var(--muted);
    display: grid;
    font-size: 13px;
    font-weight: 700;
    gap: 6px;
}

input,
textarea,
select {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    min-height: 40px;
    padding: 9px 10px;
    width: 100%;
}

textarea {
    line-height: 1.45;
    resize: vertical;
}

.terms-box {
    background: #f8faf9;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 10px;
    padding: 14px;
}

.terms-box h2 {
    font-size: 16px;
    margin: 0;
}

.terms-box ul {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
    margin: 0;
    padding-left: 18px;
}

.terms-box li + li {
    margin-top: 6px;
}

.checkbox-row {
    align-items: start;
    color: var(--ink);
    display: grid;
    font-size: 13px;
    gap: 8px;
    grid-template-columns: 18px minmax(0, 1fr);
    line-height: 1.35;
}

.terms-intro {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.terms-link {
    background: transparent;
    border: 0;
    border-radius: 0;
    color: var(--accent-strong);
    display: inline;
    font-weight: 700;
    min-height: auto;
    padding: 0;
    text-decoration: underline;
}

.terms-link:hover {
    background: transparent;
    color: var(--accent);
}

.terms-dialog {
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    max-height: min(720px, calc(100vh - 32px));
    max-width: 640px;
    padding: 0;
    width: calc(100% - 32px);
}

.schedule-dialog { border: 1px solid var(--line); border-radius: 8px; max-height: min(780px, calc(100vh - 32px)); max-width: 900px; padding: 0; width: calc(100% - 32px); }
.schedule-dialog::backdrop { background: rgba(31, 41, 51, 0.45); }

.terms-dialog::backdrop {
    background: rgba(31, 41, 51, 0.45);
}

.terms-dialog-header {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    padding: 18px 20px;
}

.terms-dialog-header h2 { margin: 0; font-size: 20px; }

.terms-dialog-body { max-height: min(520px, calc(100vh - 180px)); overflow-y: auto; padding: 20px; }
.terms-dialog-body h3 { font-size: 15px; margin: 20px 0 6px; }
.terms-dialog-body p { line-height: 1.55; }

.icon-button { background: transparent; border: 0; color: var(--ink); font-size: 28px; line-height: 1; min-height: 32px; padding: 0 6px; }
.icon-button:hover { background: transparent; color: var(--accent-strong); }

.week-calendar { display: grid; grid-template-columns: 72px repeat(5, minmax(100px, 1fr)); overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.week-calendar > div { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); font-size: 13px; font-weight: 700; min-height: 44px; padding: 12px 8px; text-align: center; }
.calendar-corner, .calendar-time { background: #f8faf9; color: var(--muted); }
.calendar-slot { align-items: stretch; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); display: block; min-height: 44px; padding: 0; }
.calendar-slot input { height: 1px; opacity: 0; position: absolute; width: 1px; }
.calendar-slot span, .calendar-slot.unavailable { align-items: center; display: flex; font-size: 12px; font-weight: 700; justify-content: center; min-height: 44px; padding: 8px; }
.calendar-slot span { background: #edf7ed; color: #285d31; cursor: pointer; }
.calendar-slot input:checked + span { background: var(--accent); color: #fff; }
.calendar-slot.occupied { background: #f7d7d7; color: #8d1f1f; }
.calendar-slot.unavailable { background: #f4f5f4; color: #9aa2a6; }

.requests-table { border-collapse: collapse; width: 100%; }
.requests-table th, .requests-table td { border-bottom: 1px solid var(--line); padding: 12px; text-align: left; }
.requests-table th { color: var(--muted); font-size: 13px; }
.requests-table tbody tr:hover { background: #edf7ed; }
.resource-types { display: grid; gap: 20px; grid-template-columns: repeat(3, 1fr); margin-bottom: 28px; }
.resource-types button { font-size: 24px; min-height: 84px; }
.pdf-source-fields { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

.admin-workspace { max-width: 1280px; padding-top: 40px; }
.admin-section { padding: 28px; }
.admin-section + .admin-section { margin-top: 24px; }
.admin-section .section-heading { align-items: flex-start; display: flex; justify-content: space-between; margin-bottom: 20px; }
.admin-section .section-heading h1, .admin-section .section-heading h2 { margin-bottom: 6px; }
.requests-table { background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.requests-table thead { background: #f1f5f3; }
.requests-table th { letter-spacing: 0; text-transform: uppercase; }
.requests-table td { vertical-align: top; }
.requests-table tbody tr { transition: background 120ms ease; }
.admin-section .card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.admin-section .resource-card { min-height: 110px; padding: 18px; }
.resource-card-heading { align-items: flex-start; display: flex; gap: 12px; justify-content: space-between; }
.resource-card-heading h3 { margin-bottom: 8px; }
.resource-card-heading .icon-button { font-size: 20px; }
.payments-table td small { color: var(--muted); display: block; margin-top: 4px; }
.payment-action { align-items: center; display: flex; gap: 8px; margin: 0; }
.payment-action input { min-height: 34px; padding: 6px 8px; width: 86px; }
.payment-action span { color: var(--muted); font-size: 13px; font-weight: 800; }
.payment-action button { min-height: 34px; padding: 0 10px; }
.payment-action .danger-button { background: #f9e2e2; border-color: #eab9b9; color: #9b2929; }
.payment-action .danger-button:hover { background: #f2cece; }
.confirmation-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.payment-placeholder { color: var(--muted); font-size: 13px; margin: 16px 0 0; }
.payment-request { align-items: center; }
.payment-pending { color: var(--muted); font-size: 13px; font-weight: 700; }
.admin-week-calendar { display: grid; gap: 6px; grid-template-columns: 72px repeat(5, minmax(140px, 1fr)); overflow-x: auto; }
.admin-week-calendar .calendar-corner,
.admin-week-calendar .calendar-day,
.admin-week-calendar .calendar-time { align-items: center; background: #e7ece9; border-radius: 6px; color: #39434b; display: flex; font-size: 13px; font-weight: 800; justify-content: center; min-height: 52px; padding: 8px; text-align: center; }
.admin-calendar-slot { background: #fff; border: 1px solid var(--line); border-radius: 6px; min-height: 72px; min-width: 0; }
.admin-calendar-slot.occupied-slot { background: #f2a65a; border-color: #c96f18; color: #3d280f; }
.admin-calendar-slot.occupied-slot summary small { color: #5f421e; }
.admin-calendar-slot.hidden-slot { background: #f1f3f2; color: var(--muted); }
.admin-calendar-slot.unavailable-slot { align-items: center; background: #f1f3f2; color: #8b949b; display: flex; font-size: 12px; font-weight: 700; justify-content: center; padding: 8px; text-align: center; }
.admin-calendar-slot summary { cursor: pointer; display: grid; gap: 4px; list-style: none; min-height: 70px; padding: 12px; text-align: center; }
.admin-calendar-slot summary::-webkit-details-marker { display: none; }
.admin-calendar-slot summary strong { overflow-wrap: anywhere; }
.admin-calendar-slot summary small { color: var(--muted); }
.slot-controls { border-top: 1px solid var(--line); display: grid; gap: 10px; padding: 12px; }
.slot-controls form { display: grid; gap: 8px; margin: 0; }
.slot-controls label { color: var(--muted); font-size: 12px; font-weight: 700; }
.slot-controls select { margin-top: 4px; width: 100%; }
.slot-controls button { min-height: 34px; padding: 0 10px; }
.message-compose-section .section-heading p,
.teacher-messages-section .section-heading p { color: var(--muted); margin-bottom: 0; }
.message-list { display: grid; gap: 10px; }
.teacher-message { border: 1px solid var(--line); border-radius: 6px; }
.teacher-message.unread { border-left: 4px solid var(--accent); }
.teacher-message summary { align-items: center; cursor: pointer; display: flex; gap: 16px; justify-content: space-between; list-style: none; padding: 14px 16px; }
.teacher-message summary::-webkit-details-marker { display: none; }
.teacher-message summary span:first-child { display: grid; gap: 3px; }
.teacher-message small { color: var(--muted); }
.message-status { color: var(--accent-strong); font-size: 13px; font-weight: 700; white-space: nowrap; }
.teacher-message-body { border-top: 1px solid var(--line); padding: 16px; }
.teacher-message-body p { line-height: 1.55; white-space: pre-wrap; }
.teacher-message-body form { margin: 0; }
.empty-state { color: var(--muted); margin: 0; }

.checkbox-row input {
    margin: 2px 0 0;
    min-height: 18px;
    padding: 0;
    width: 18px;
}

.notice {
    background: #fff7d6;
    border: 1px solid #e6c766;
    border-radius: 6px;
    color: #6f5500;
    padding: 10px 12px;
}

.workspace {
    display: grid;
    gap: 24px;
}

.page-title {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
}

.page-title h1 {
    font-size: 34px;
    margin-bottom: 0;
}

.share-link {
    background: var(--blue);
    border-radius: 6px;
    color: #16425f;
    font-weight: 700;
    padding: 9px 12px;
}

.share-link.secondary {
    background: #eef3f0;
    color: #34424d;
}

.share-link.danger {
    background: #eef3f0;
    color: #b42318;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.inline-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

.current-slot-row {
    align-items: center;
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.current-slot-row h2,
.current-slot-row p {
    margin: 0;
}

.current-slot-row p {
    font-size: 18px;
    font-weight: 800;
    text-align: center;
}

.current-slot-row .share-link {
    justify-self: end;
}

.tool-section {
    padding: 20px;
}

.section-heading {
    align-items: end;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-heading h2 {
    margin: 0;
}

.section-heading p {
    margin: 0;
}

.payment-panel .section-heading {
    align-items: start;
}

.payment-summary {
    align-items: end;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(120px, 1fr)) auto auto;
}

.payment-summary div {
    display: grid;
    gap: 4px;
}

.payment-summary span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.payment-summary strong {
    font-size: 18px;
}

.payment-summary form {
    margin: 0;
}

.secondary-button {
    background: #eef3f0;
    border-color: #d8dedb;
    color: #34424d;
}

.secondary-button:hover {
    background: #dfe8e4;
}

.timetable {
    display: grid;
    gap: 6px;
    grid-template-columns: 72px repeat(5, minmax(112px, 1fr));
    overflow-x: auto;
}

.corner,
.day,
.hour,
.slot {
    align-items: center;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    min-height: 48px;
    padding: 8px;
    text-align: center;
}

.day,
.hour {
    background: #e7ece9;
    color: #39434b;
    font-size: 13px;
    font-weight: 800;
}

.slot {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.15;
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    position: relative;
    transition:
        background-color 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease,
        transform 160ms ease;
    white-space: normal;
    width: 100%;
}

button.slot,
.slot-choice .slot {
    cursor: pointer;
}

button.slot:hover,
.slot-choice:hover .slot {
    box-shadow: 0 8px 18px rgba(31, 41, 51, 0.16);
    transform: translateY(-2px) scale(1.015);
    z-index: 1;
}

button.slot:focus-visible,
.slot-choice input:focus-visible + .slot {
    outline: 3px solid rgba(45, 127, 177, 0.35);
    outline-offset: 2px;
    transform: translateY(-2px) scale(1.015);
    z-index: 1;
}

.slot-choice {
    display: block;
    position: relative;
}

.slot-choice input {
    height: 1px;
    left: 50%;
    min-height: 0;
    opacity: 0;
    padding: 0;
    pointer-events: none;
    position: absolute;
    top: 50%;
    width: 1px;
}

.slot-choice .slot {
    min-height: 48px;
}

.slot-choice input:checked + .slot {
    background: var(--blue);
    border-color: #2d7fb1;
    box-shadow: inset 0 0 0 2px #2d7fb1;
}

.slot-choice input:disabled + .slot {
    cursor: not-allowed;
}

.slot.available {
    background: #e9f7e7;
    border-color: #91c986;
    color: #1c4720;
}

.slot.demand,
.slot.requested {
    background: var(--yellow);
    border-color: #e1b72a;
    color: #4f3b00;
}

.slot.selected {
    background: var(--blue);
    border-color: #77add0;
}

.slot.assigned {
    background: #ffe6e3;
    border-color: #d96d64;
    color: #8f1f18;
}

.slot.assigned.selected,
.slot-choice input:checked + .slot.assigned {
    background: #ffd2cd;
    border-color: #bd4137;
    box-shadow: inset 0 0 0 2px #bd4137;
}

.slot.blocked {
    background: #fff1f0;
    border-color: #f0b4ae;
    color: #9f1d16;
}

.slot.blocked.selected,
.slot-choice input:checked + .slot.blocked {
    background: #ffe6e3;
    border-color: #d96d64;
    box-shadow: inset 0 0 0 2px #d96d64;
}

.slot.unavailable {
    background: #f0f1f2;
    border-color: #e1e4e8;
    color: #8a929b;
    font-weight: 600;
}

.slot.static {
    cursor: default;
    transform: none;
}

.slot.static:hover {
    box-shadow: none;
    transform: none;
    z-index: auto;
}

.admin-slot {
    align-content: center;
    flex-direction: column;
    gap: 6px;
    min-height: 74px;
}

@media (prefers-reduced-motion: reduce) {
    .slot {
        transition: none;
    }

    button.slot:hover,
    button.slot:focus-visible,
    .slot-choice:hover .slot,
    .slot-choice input:focus-visible + .slot {
        transform: none;
    }
}

.admin-slot.assigned {
    background: #ffe6e3;
    border-color: #d96d64;
    color: #8f1f18;
}

.admin-slot form {
    margin: 0;
}

.admin-slot button {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(56, 64, 74, 0.28);
    color: #26313d;
    font-size: 12px;
    min-height: 28px;
    padding: 0 10px;
}

.admin-slot button:hover {
    background: #fff;
}

.wide-field {
    margin: 16px 0;
}

.card-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.resource-card {
    overflow: hidden;
    padding: 18px;
}

.resource-card iframe {
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 6px;
    margin-top: 12px;
    width: 100%;
}

.lesson-admin-card {
    display: grid;
    gap: 12px;
}

.lesson-assignment-form {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 12px;
    padding-top: 12px;
}

.resource-body {
    color: var(--ink);
    line-height: 1.55;
}

.admin-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.schedule-grid {
    display: grid;
    gap: 12px;
}

.schedule-form {
    align-items: end;
    background: #f8faf9;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 12px;
    grid-template-columns: 90px minmax(0, 1fr) minmax(0, 1fr) 110px auto;
    padding: 12px;
}

.schedule-form strong {
    align-self: center;
}

.schedule-segment {
    border: 1px solid var(--line);
    border-radius: 7px;
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(90px, 1fr));
    margin: 0;
    padding: 10px;
}

.schedule-segment legend {
    font-weight: 700;
    padding: 0 5px;
}

.list {
    display: grid;
    gap: 12px;
}

.list-item {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 14px;
}

.list-item span,
.list-item small {
    display: block;
    margin-top: 4px;
}

.list-item form {
    align-items: center;
    display: flex;
    gap: 8px;
}

.request-card {
    align-items: stretch;
    grid-template-columns: 1fr;
}

.request-card-title {
    min-width: 0;
}

.request-card-actions {
    border-top: 1px solid var(--line);
    justify-content: space-between;
    padding-top: 12px;
}

.request-card-actions select {
    max-width: 260px;
}

.profile-form {
    align-items: end;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.assignment-form {
    align-items: end;
    grid-template-columns: 1fr;
}

.assignment-form button,
.profile-form button {
    align-self: end;
    justify-self: start;
}

.checkbox-row {
    align-items: center;
    display: flex;
    gap: 8px;
    min-height: 40px;
}

.checkbox-row input {
    min-height: auto;
    width: auto;
}

.card-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-form .wide-field,
.student-picker {
    grid-column: 1 / -1;
    margin: 0;
}

.student-picker {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 10px;
    padding: 14px;
}

.student-picker legend {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    padding: 0 6px;
}

@media (max-width: 860px) {
    .site-header {
        gap: 12px;
        min-height: 58px;
        padding: 0 16px;
    }

    nav {
        gap: 12px;
    }

    .admin-grid,
    .assignment-form,
    .payment-summary,
    .schedule-form,
    .card-form {
        grid-template-columns: 1fr;
    }

    .schedule-segment {
        grid-template-columns: 1fr;
    }

    .workspace,
    .auth-layout {
        padding: 20px;
    }

    .hero {
        gap: 28px;
        grid-template-columns: 1fr;
        min-height: auto;
        padding: 40px 20px;
    }

    .hero h1 {
        font-size: 40px;
    }

    .section-heading,
    .page-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .current-slot-row {
        align-items: flex-start;
        grid-template-columns: 1fr;
    }

    .current-slot-row p {
        text-align: left;
    }

    .current-slot-row .share-link {
        justify-self: start;
    }

    .profile-form,
    .list-item {
        grid-template-columns: 1fr;
    }

    .list-item form {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .pdf-source-fields {
        grid-template-columns: 1fr;
    }
}
