:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: #24332f;
    background: #f7f7f4;
    line-height: 1.55;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: #315c52; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #315c52; outline-offset: 3px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.16; letter-spacing: -.035em; }
h2 { font-size: 1.2rem; line-height: 1.3; }
.eyebrow { color: #4c6860; font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.lead { max-width: 38rem; color: #51605b; font-size: 1.1rem; }
.text-link { display: inline-block; font-weight: 650; text-underline-offset: .22em; }
.icon-button { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 0; border-radius: .6rem; color: inherit; background: transparent; font-size: 1.35rem; }
.icon-button:hover, .sidebar-link:hover { background: #e9eeeb; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 5rem minmax(0, 1fr); transition: grid-template-columns .2s ease; }
.admin-shell.sidebar-expanded { grid-template-columns: 15rem minmax(0, 1fr); }
.admin-sidebar { grid-column: 1; grid-row: 1 / 3; padding: 1.25rem .75rem; background: #fff; border-right: 1px solid #dce3de; }
.sidebar-heading { display: flex; align-items: center; justify-content: center; min-height: 3rem; margin-bottom: 2.5rem; padding: 0 .4rem; }
.sidebar-brand { display: none; font-weight: 800; letter-spacing: .09em; }
.sidebar-expanded .sidebar-heading { justify-content: space-between; }
.sidebar-expanded .sidebar-brand { display: inline; }
.sidebar-link { display: flex; align-items: center; justify-content: center; gap: .8rem; min-height: 3rem; margin-bottom: .3rem; padding: .5rem .85rem; border-radius: .6rem; color: #24332f; text-decoration: none; font-weight: 600; }
.sidebar-link[aria-current="page"] { background: #e7efea; color: #234c41; }
.nav-symbol { font-size: 1.3rem; line-height: 1; }
.nav-label { display: none; }
.sidebar-expanded .sidebar-link { justify-content: flex-start; }
.sidebar-expanded .nav-label { display: inline; }
.admin-topbar { display: none; }
.admin-main { grid-column: 2; grid-row: 1; padding: clamp(2rem, 5vw, 5rem); }
.content-wrap { max-width: 56rem; }
.welcome-card { display: flex; gap: 1.5rem; margin-top: 2.5rem; padding: clamp(1.5rem, 4vw, 2.5rem); background: #fff; border: 1px solid #dce3de; border-radius: 1rem; box-shadow: 0 12px 32px rgba(24, 48, 40, .04); }
.welcome-card p { color: #51605b; }
.card-mark { display: grid; flex: 0 0 3rem; place-items: center; height: 3rem; border-radius: .75rem; background: #e7efea; color: #315c52; font-size: 1.5rem; }
.mobile-close, .mobile-menu-button, .drawer-overlay { display: none; }

.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 2rem 1rem; }
.auth-wrap { width: min(100%, 27rem); }
.auth-brand { margin-bottom: 1.5rem; font-weight: 800; letter-spacing: .08em; }
.auth-brand span, .topbar-brand span { margin-left: .5rem; color: #51605b; font-weight: 400; letter-spacing: 0; }
.auth-card { padding: clamp(1.5rem, 5vw, 2.5rem); background: #fff; border: 1px solid #dce3de; border-radius: 1rem; box-shadow: 0 12px 32px rgba(24, 48, 40, .06); }
.auth-card h1 { font-size: 2rem; }
.auth-intro { color: #51605b; }
.login-form { display: grid; gap: .55rem; margin-top: 1.75rem; }
.login-form label { font-weight: 650; }
.login-form input { width: 100%; min-height: 2.75rem; margin-bottom: .8rem; padding: .55rem .75rem; border: 1px solid #82958b; border-radius: .5rem; background: #fff; color: #24332f; }
.login-form input[aria-invalid="true"] { border-color: #9b3737; }
.primary-button { min-height: 2.75rem; padding: .6rem 1rem; border: 1px solid #315c52; border-radius: .5rem; background: #315c52; color: #fff; font-weight: 650; }
.primary-button:hover { background: #24483f; }
.danger-link { display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; padding: .6rem 1rem; border: 1px solid #9b3737; border-radius: .5rem; background: #9b3737; color: #fff; font-weight: 650; text-decoration: none; text-align: center; }
.danger-link:hover { background: #762828; color: #fff; }
.danger-link:focus-visible { outline-color: #762828; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .75rem; }
.form-error { padding: .75rem; border-left: 3px solid #9b3737; background: #fbefed; color: #702727; }
.account-card { max-width: 38rem; }
.account-form { margin-top: 1.75rem; }

.listing-page { max-width: 78rem; }
.listing-page h1 { margin-top: .65rem; }
.listing-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.listing-heading h1 { margin-bottom: 0; }
.listing-heading .primary-button { display: inline-block; margin-left: auto; text-decoration: none; white-space: nowrap; }
.listing-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 1rem; padding: 1.25rem; margin: 1.5rem 0; background: #fff; border: 1px solid #dce3de; border-radius: .75rem; }
.listing-filters > div { display: grid; gap: .3rem; flex: 1 1 10rem; }
.listing-filters label { font-weight: 650; }
.listing-filters input, .listing-filters select { width: 100%; min-height: 2.75rem; padding: .45rem .6rem; border: 1px solid #82958b; border-radius: .5rem; background: #fff; color: #24332f; }
.listing-filters > .form-actions { display: flex; flex: 1 1 100%; justify-content: flex-end; }
.contract-form { display: grid; gap: 1.5rem; margin: 1.5rem 0; padding: clamp(1.25rem, 3vw, 2rem); background: #fff; border: 1px solid #dce3de; border-radius: .75rem; }
.contract-form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 1.5rem; }
.contract-form-field { min-width: 0; }
.contract-form-field label { display: block; font-weight: 650; }
.contract-form-field input, .contract-form-field select { display: block; width: 100%; min-height: 2.75rem; margin-top: .3rem; padding: .45rem .6rem; border: 1px solid #82958b; border-radius: .5rem; background: #fff; color: #24332f; }
.contract-form-field input[aria-invalid="true"], .contract-form-field select[aria-invalid="true"] { border-color: #9b3737; }
.grade-close-form { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; }
.grade-close-form label { flex: 1 1 100%; font-weight: 650; }
.grade-close-form input { min-width: 0; min-height: 2.75rem; padding: .45rem .6rem; border: 1px solid #82958b; border-radius: .5rem; }
.grade-back { margin-top: 1.5rem; }
.contract-form-field p, .contract-form-weekdays p { margin: .35rem 0 0; }
.contract-form #hours-help { color: #51605b; font-size: .9rem; }
.contract-form-weekdays { grid-column: 1 / -1; }
.contract-form-weekdays fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.contract-form-weekdays legend { margin-bottom: .6rem; padding: 0; font-weight: 650; }
.contract-form-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .5rem 1rem; }
.contract-form-days label { display: inline-flex; align-items: center; gap: .5rem; min-height: 2rem; cursor: pointer; }
.contract-form-days input[type="checkbox"] { flex: none; width: 1.1rem; height: 1.1rem; margin: 0; accent-color: #315c52; }
.contract-form > .form-actions { justify-self: end; }
.listing-table-wrap { overflow-x: auto; background: #fff; border: 1px solid #dce3de; border-radius: .75rem; }
.contracts-table-wrap { margin-top: 1.5rem; }
.listing-table { width: 100%; border-collapse: collapse; text-align: left; }
.listing-table caption { padding: .9rem 1rem; text-align: left; font-weight: 650; }
.listing-table th, .listing-table td { padding: .8rem 1rem; border-top: 1px solid #dce3de; vertical-align: top; }
.listing-table thead { background: #e9eeeb; }
.listing-table tbody tr:hover { background: #f7f7f4; }
.listing-table tfoot td { text-align: right; font-weight: 650; background: #f7f7f4; }
.table-row-actions { display: inline-flex; align-items: center; gap: .5rem; flex: none; }
.table-action-link { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 1px solid #315c52; border-radius: .5rem; background: #fff; color: #315c52; vertical-align: middle; text-decoration: none; }
.table-action-link:hover, .table-action-link:focus-visible { background: #e7efea; color: #234c41; }
.table-action-link svg { width: 1.4rem; height: 1.4rem; }
.table-delete-button { min-height: 2.75rem; padding: .4rem .75rem; border: 1px solid #9b3737; border-radius: .5rem; background: #fff; color: #9b3737; font-weight: 650; }
.table-delete-button:hover, .table-delete-button:focus-visible { background: #fbefed; }
.listing-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1.5rem; }
.calendar-intro { margin: 1.5rem 0; max-width: 56rem; color: #51605b; }
.calendar-page > section { margin-top: 2rem; }
.calendar-summary, .calendar-day, .calendar-weeks li { padding: 1rem 1.25rem; background: #fff; border: 1px solid #dce3de; border-radius: .75rem; }
.calendar-summary p:last-child { margin-bottom: 0; }
.calendar-weeks, .calendar-visits, .calendar-weekdays, .calendar-weeks-grid, .calendar-week { list-style: none; margin: 0; padding: 0; }
.calendar-weeks { display: grid; gap: .75rem; }
.calendar-weeks li { display: flex; flex-wrap: wrap; gap: .35rem 1rem; justify-content: space-between; }
.calendar-weeks li span:last-child { flex-basis: 100%; }
.calendar-note { color: #51605b; }
.calendar-grid { width: 100%; }
.calendar-weekdays, .calendar-week { display: grid; grid-template-columns: repeat(var(--calendar-columns), minmax(0, 1fr)); }
.calendar-weekdays li { min-width: 0; padding: .75rem; background: #e9eeeb; border: 1px solid #dce3de; font-weight: 650; }
.calendar-day { min-width: 0; overflow-wrap: anywhere; }
.calendar-week .calendar-day { border-radius: 0; padding: .75rem; }
.calendar-week .calendar-blank { background: #f7f7f4; border: 1px solid #dce3de; }
.calendar-day h3 { margin: 0 0 .75rem; font-size: 1rem; }
.calendar-day p { margin: 0; }
.calendar-visits li { display: grid; gap: .15rem; padding: .65rem 0; border-top: 1px solid #dce3de; }
.calendar-visits li span { white-space: nowrap; }
.calendar-inline-times { min-width: 0; }
.calendar-inline-times summary { cursor: pointer; width: fit-content; min-height: 2.75rem; align-content: center; color: #315c52; font-weight: 650; }
.calendar-inline-times summary:focus-visible { outline: 3px solid #315c52; outline-offset: 2px; }
.calendar-edit-times { display: grid; gap: .5rem; margin: .5rem 0; }
.calendar-edit-times label { display: block; font-weight: 650; }
.calendar-edit-times input { display: block; width: 100%; min-width: 0; min-height: 2.75rem; margin-top: .3rem; padding: .45rem .6rem; border: 1px solid #82958b; border-radius: .5rem; }
.calendar-edit-times input:focus-visible { outline: 3px solid #315c52; outline-offset: 2px; }
.calendar-edit-form > .form-actions { margin-top: 1.5rem; }
.schedule-page { max-width: none; }
.schedule-page > section { margin-top: 2.5rem; }
.schedule-page .calendar-grid { display: grid; grid-template-columns: repeat(var(--calendar-days), minmax(0, 1fr)) minmax(10rem, 1.3fr); }
.schedule-page .calendar-grid > h2 { grid-column: 1 / -1; margin: 0; padding: .75rem 1rem; background: #e9eeeb; border: 1px solid #dce3de; text-transform: capitalize; }
.schedule-page .calendar-grid > .calendar-note, .schedule-page .calendar-weeks-grid { grid-column: 1 / -1; }
.schedule-page .calendar-grid > .calendar-note { padding: 1rem; border: 1px solid #dce3de; border-top: 0; }
.schedule-page .calendar-weeks-grid { display: grid; gap: .75rem; margin-top: .75rem; }
.schedule-page .calendar-week { grid-template-columns: repeat(var(--calendar-days), minmax(0, 1fr)) minmax(10rem, 1.3fr); gap: .5rem; }
.schedule-page .calendar-day { font-size: .87rem; }
.schedule-page .calendar-week .calendar-day { padding: 0; border-color: #b9c7bf; }
.schedule-page .calendar-week .calendar-day:not(.schedule-week-total) { display: flex; flex-direction: column; }
.schedule-day-content { flex: 1; min-width: 0; }
.schedule-date-band { display: flex; flex-direction: column; justify-content: space-between; height: 6.25rem; overflow-y: auto; padding: .65rem .75rem; background: #e9eeeb; border-bottom: 2px solid #b9c7bf; line-height: 1.35; overflow-wrap: anywhere; }
.schedule-page .calendar-day .schedule-date-band h3, .schedule-page .schedule-week-total > .schedule-date-band { margin: 0; line-height: inherit; }
.schedule-absence { min-height: 1.35em; font-weight: 650; }
.schedule-day-content > .calendar-note { padding: .75rem; }
.schedule-day-content > .calendar-visits { padding: .25rem .75rem .75rem; }
.schedule-week-total p { margin: .35rem .75rem; }
.schedule-day-hours { width: 100%; padding: .65rem .75rem; border-top: 2px solid #b9c7bf; background: #e9eeeb; color: #24332f; font-weight: 650; line-height: 1.5; }
.schedule-day-hours p + p { margin-top: .2rem; }
.schedule-page .calendar-day.schedule-holiday { background: #e5f1f9; border-color: #adc9dc; color: #24332f; }
.schedule-page .schedule-holiday .schedule-date-band { background: #d5e9f6; border-color: #adc9dc; }
.schedule-page .calendar-day.schedule-vacation { background: #f6e9ed; border-color: #d6b5bf; color: #24332f; }
.schedule-page .schedule-vacation .schedule-date-band { background: #eed9e0; border-color: #d6b5bf; }
.schedule-page .schedule-holiday .calendar-note { color: #40566a; }
.schedule-page .schedule-manual-time, .schedule-page .schedule-holiday .schedule-manual-time { color: #9b3737; font-weight: 750; }
.schedule-page .calendar-visits li span { white-space: normal; }
.schedule-visit { min-width: 0; }
.schedule-visit summary { overflow-wrap: anywhere; }
.schedule-visit-form { min-width: 0; padding: .5rem 0; }
.schedule-visit-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .75rem; margin: .75rem 0; }
.schedule-visit-fields label { display: block; font-weight: 650; }
.schedule-visit-fields input { width: 100%; min-width: 0; min-height: 2.75rem; padding: .45rem .6rem; margin-top: .3rem; border: 1px solid #82958b; border-radius: .5rem; }
.schedule-visit-fields input:focus-visible, .schedule-visit button:focus-visible { outline: 3px solid #315c52; outline-offset: 2px; }
.schedule-visit .form-actions { margin-top: .75rem; }
.schedule-visit .form-actions button { white-space: normal; }
.schedule-restore-form { margin-top: .5rem; }
.schedule-restore-button { min-height: 2.75rem; max-width: 100%; padding: .5rem .75rem; border: 1px solid #9b3737; border-radius: .5rem; background: #fff; color: #702727; font-weight: 650; cursor: pointer; white-space: normal; text-align: center; }
.schedule-restore-button:hover { background: #fbefed; }
.schedule-restore-button:focus-visible { outline: 3px solid #9b3737; outline-offset: 2px; }
.schedule-week-total { background: #e9eeeb; }
.schedule-worker-summary, .schedule-users { margin-top: 1rem; }
.schedule-balance { font-weight: 750; white-space: nowrap; }
.schedule-deficit { color: #9b3737; }
.schedule-surplus { color: #286148; }
.schedule-raw { display: inline-block; margin-bottom: .25rem; }
.schedule-balance-open, .schedule-balance-fallback { margin-top: 1rem; }
.schedule-balance-fallback { padding: 1.25rem; background: #fff; border: 1px solid #dce3de; border-radius: .75rem; }
.schedule-balance-fallback summary { cursor: pointer; color: #315c52; font-weight: 650; }
.schedule-balance-dialog { width: min(40rem, calc(100% - 2rem)); max-height: calc(100% - 2rem); padding: clamp(1rem, 4vw, 2rem); border: 1px solid #82958b; border-radius: .75rem; color: #24332f; background: #fff; }
.schedule-balance-dialog::backdrop { background: rgba(19, 36, 30, .55); }
.schedule-balance-dialog h2 { margin-bottom: .75rem; }
.schedule-balance-dialog fieldset, .schedule-balance-fallback fieldset { margin: 1.25rem 0; border: 0; padding: 0; }
.schedule-balance-dialog legend, .schedule-balance-fallback legend { font-weight: 700; }
.schedule-balance-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; margin-top: .75rem; }
.schedule-balance-fields label { display: block; font-weight: 650; }
.schedule-balance-fields input { width: 100%; min-height: 2.75rem; margin-top: .3rem; padding: .45rem .6rem; border: 1px solid #82958b; border-radius: .5rem; }
.schedule-balance-dialog .form-actions, .schedule-balance-fallback .form-actions { margin-top: 1.5rem; }
@media (max-width: 1500px) {
    .schedule-page .calendar-blank { display: none; }
    .schedule-page .calendar-weeks-grid, .schedule-page .calendar-week { display: grid; gap: .75rem; }
    .schedule-page .calendar-weeks-grid { gap: 1rem; }
    .schedule-page .calendar-week { grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
    .schedule-page .calendar-week .calendar-day { border-radius: .75rem; padding: 0; overflow: hidden; }
    .schedule-page .schedule-date-band { padding: .75rem 1.25rem; }
    .schedule-page .schedule-day-content > .calendar-note { padding: 1rem 1.25rem; }
    .schedule-page .schedule-day-content > .calendar-visits { padding: .25rem 1.25rem; }
    .schedule-page .schedule-week-total p { margin: .35rem 1.25rem; }
    .schedule-page .schedule-day-hours { padding: .65rem 1.25rem; }
    .schedule-week-total { order: var(--calendar-days); }
}
@media (max-width: 767px) {
    .schedule-page .calendar-week { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1100px) {
    .calendar-weekdays, .calendar-blank { display: none; }
    .calendar-weeks-grid, .calendar-week { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: .75rem; }
    .calendar-weeks-grid { gap: 1rem; }
    .calendar-week .calendar-day { border-radius: .75rem; padding: 1rem 1.25rem; }
}
@media (max-width: 900px) {
    .listing-table thead { display: none; }
    .listing-table tbody tr { display: block; padding: .6rem 0; border-top: 1px solid #dce3de; }
    .listing-table tbody th, .listing-table tbody td { display: flex; gap: 1rem; justify-content: space-between; border: 0; padding: .4rem 1rem; overflow-wrap: anywhere; }
    .listing-table [data-label]::before { content: attr(data-label); flex: 0 0 8rem; font-weight: 650; }
}

@media (max-width: 767px) {
    .admin-shell, .admin-shell.sidebar-expanded { display: block; }
    .admin-topbar { display: flex; align-items: center; gap: .75rem; min-height: 4rem; padding: .5rem 1rem; background: #fff; border-bottom: 1px solid #dce3de; }
    .topbar-brand { font-weight: 800; }
    .mobile-menu-button, .mobile-close { display: inline-grid; }
    .desktop-collapse { display: none; }
    .admin-sidebar { position: fixed; z-index: 3; inset: 0 auto 0 0; width: min(18rem, 85vw); overflow-y: auto; transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility .2s ease; }
    .drawer-open .admin-sidebar { transform: translateX(0); visibility: visible; }
    .sidebar-heading, .sidebar-expanded .sidebar-heading { justify-content: space-between; }
    .sidebar-brand, .sidebar-expanded .sidebar-brand, .nav-label, .sidebar-expanded .nav-label { display: inline; }
    .sidebar-link, .sidebar-expanded .sidebar-link { justify-content: flex-start; }
    .drawer-overlay { position: fixed; z-index: 2; inset: 0; width: 100%; border: 0; background: rgba(19, 36, 30, .44); }
    .drawer-open .drawer-overlay { display: block; }
    .admin-main { padding: 2.5rem 1.25rem; }
    .welcome-card { flex-direction: column; }
    .listing-heading { flex-wrap: wrap; }
    .contract-form-fields { grid-template-columns: minmax(0, 1fr); }
    .contract-form > .form-actions { width: 100%; }
    .form-actions > * { flex: 1 1 9rem; }
}
@media (prefers-reduced-motion: reduce) {
    .admin-shell, .admin-sidebar { transition: none; }
}

