:root {
    --bg: #f3f5f7;
    --surface: #ffffff;
    --text: #1e2933;
    --muted: #66727e;
    --border: #d9e0e6;
    --primary: #1c5d78;
    --primary-dark: #15475c;
    --success: #24734d;
    --success-bg: #e7f5ed;
    --danger: #a93636;
    --danger-bg: #faeaea;
    --warning: #8a6415;
    --warning-bg: #fff4d6;
    --closed-bg: #eceff2;
    --full-bg: #fae5e5;
    --yours-bg: #e1effa;
    --shadow: 0 10px 28px rgba(24, 39, 51, .08);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }
.site-header { background: #173f52; color: #fff; box-shadow: 0 2px 9px rgba(0,0,0,.18); }
.header-inner { max-width: 1220px; min-height: 66px; margin: auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { color: #fff; font-weight: 750; font-size: 1.12rem; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.main-nav { display: flex; align-items: center; gap: 6px; }
.main-nav a { color: #dceaf0; padding: 10px 11px; border-radius: 7px; }
.main-nav a:hover, .main-nav a.active { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.nav-toggle { display: none; color: #fff; border: 0; background: transparent; font-size: 1.6rem; }
.page-shell { max-width: 1220px; margin: 0 auto; padding: 28px 24px 50px; }
.site-footer { max-width: 1220px; margin: 0 auto; padding: 20px 24px 34px; color: var(--muted); font-size: .88rem; }
h1, h2, h3 { line-height: 1.16; margin-top: 0; }
h1 { font-size: clamp(1.65rem, 3vw, 2.25rem); margin-bottom: 8px; }
h2 { font-size: 1.28rem; }
.muted { color: var(--muted); }
.block { display: block; margin-top: 3px; color: var(--muted); }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading-actions { display: inline-flex; align-items: center; gap: 10px; flex-direction: row; flex-wrap: nowrap; }
.content-card, .auth-card, .stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.content-card { padding: 22px; margin-bottom: 22px; }
.narrow-card { max-width: 660px; }
.wide-card { max-width: 760px !important; }
.auth-card { max-width: 460px; margin: 46px auto; padding: 30px; }
.auth-page { display: grid; place-items: start center; padding: 30px 18px; }
.auth-page .auth-card { width: min(760px, 100%); }
.button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--primary); border-radius: 8px; padding: 10px 16px; background: var(--primary); color: #fff; font-weight: 700; cursor: pointer; text-decoration: none; }
.button:hover { background: var(--primary-dark); text-decoration: none; }
.button:disabled { opacity: .62; cursor: wait; }
.button.secondary { background: #fff; color: var(--primary); }
.button.secondary:hover { background: #eef5f8; }
.icon-button { width: 42px; height: 38px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); cursor: pointer; font-size: 1.15rem; }
.link-button { border: 0; padding: 0; background: transparent; color: var(--primary); cursor: pointer; }
.danger-text { color: var(--danger); }
.alert { border: 1px solid; border-radius: 9px; padding: 11px 14px; margin: 0 0 16px; }
.alert-success { color: var(--success); background: var(--success-bg); border-color: #aad6bd; }
.alert-danger { color: var(--danger); background: var(--danger-bg); border-color: #e6b6b6; }
.alert-warning { color: var(--warning); background: var(--warning-bg); border-color: #ead18b; }
.hidden { display: none !important; }
.stacked-form { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 20px; align-items: end; }
.full-field { grid-column: 1 / -1; }
label { display: grid; gap: 6px; font-weight: 650; color: #34424e; }
label small, small { font-weight: 400; font-size: .82rem; color: var(--muted); }
input, select { width: 100%; min-height: 43px; padding: 9px 11px; border: 1px solid #bdc8d1; border-radius: 7px; background: #fff; color: var(--text); }
input:focus, select:focus { outline: 3px solid rgba(28,93,120,.14); border-color: var(--primary); }
input:disabled { background: #edf0f2; color: #79838c; }
.checkbox-label { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.checkbox-label input { width: 18px; min-height: 18px; height: 18px; }
.check-group { display: grid; gap: 13px; padding-bottom: 5px; }
.inline-form, .filter-form { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; }
.inline-form label, .filter-form label { min-width: 150px; }
.filter-form label:last-of-type { min-width: 220px; flex: 1; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.calendar-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 13px 16px; margin-bottom: 12px; }
.calendar-toolbar h2 { margin: 0; text-align: center; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 10px 20px; color: var(--muted); font-size: .88rem; margin: 0 2px 12px; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-box { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--border); }
.legend-box.available { background: var(--success-bg); }
.legend-box.yours { background: #8ec8ff; }
.legend-box.full { background: var(--full-bg); }
.legend-box.closed { background: var(--closed-bg); }
.calendar { padding: 12px; overflow: hidden; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays span { padding: 8px; text-align: center; color: var(--muted); font-size: .78rem; text-transform: uppercase; font-weight: 750; letter-spacing: .04em; }
.calendar-grid { border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.calendar-day { position: relative; min-height: 108px; padding: 10px; border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: left; background: #fff; color: var(--text); cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.calendar-day.status-available { background: var(--success-bg); }
.calendar-day.status-available:hover { outline: 3px solid rgba(36,115,77,.22); z-index: 1; }
.calendar-day.status-yours {
    background: #8ec8ff;
    color: #083c66;
    box-shadow: inset 0 0 0 1px #5eaeea;
}
.calendar-day.status-full { background: var(--full-bg); }
.calendar-day.status-pending {
    background: #fff5d8;
    color: #684a05;
    box-shadow: inset 0 0 0 1px #e8cf86;
}
.calendar-day.status-closed { background: var(--closed-bg); color: #727d86; }
.calendar-day:disabled { cursor: default; }
.calendar-day.outside-month { opacity: .58; }
.day-number { font-size: 1rem; font-weight: 780; }
.day-label { font-size: .78rem; font-weight: 650; }
.day-note { font-size: .72rem; line-height: 1.25; color: var(--muted); overflow-wrap: anywhere; }
.day-requesters { margin-top: auto; display: grid; gap: 2px; }
.day-requester { font-size: .68rem; line-height: 1.2; color: #25303a; background: rgba(255,255,255,.55); border-radius: 4px; padding: 1px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-requester.requester-approved {
    color: #0d3c5f;
    background: #d8ecff;
    box-shadow: inset 0 0 0 1px #77acd7;
    font-weight: 650;
}
.day-requester.requester-pending {
    color: #7a540d;
    background: #ffe8b3;
    box-shadow: inset 0 0 0 1px #d0a24d;
    font-weight: 700;
}
.day-requester.more { color: var(--muted); background: rgba(255,255,255,.35); }
.calendar-loading, .calendar-error { grid-column: 1 / -1; padding: 45px; text-align: center; color: var(--muted); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.reservation-dialog { width: min(620px, calc(100vw - 28px)); border: 0; border-radius: 13px; padding: 0; box-shadow: 0 24px 70px rgba(0,0,0,.32); }
.reservation-dialog::backdrop { background: rgba(12,24,34,.58); }
.dialog-card { position: relative; padding: 28px; }
.dialog-close { position: absolute; right: 14px; top: 10px; border: 0; background: transparent; font-size: 1.8rem; color: var(--muted); cursor: pointer; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 21px; }
.admin-tabs { display: flex; gap: 5px; overflow-x: auto; margin: -7px 0 24px; padding-bottom: 4px; }
.admin-tabs a { white-space: nowrap; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); }
.admin-tabs a.active { color: #fff; background: var(--primary); border-color: var(--primary); }
.admin-tabs a:hover { text-decoration: none; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; margin-bottom: 22px; }
.stat-card { padding: 19px; }
.stat-card span { display: block; color: var(--muted); font-size: .87rem; }
.stat-card strong { display: block; font-size: 2rem; margin-top: 5px; }
.stat-card-link { display: block; color: inherit; text-decoration: none; }
.stat-card-link:hover { text-decoration: none; box-shadow: inset 0 0 0 1px rgba(28,93,120,.28); }
.pending-shortcut-grid { grid-template-columns: minmax(220px, 320px); }
.pending-shortcut-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-direction: row;
    min-height: 43px;
    padding: 10px 14px;
    margin: 0;
    border-radius: 8px;
}
.pending-shortcut-button span {
    display: inline-flex;
    align-items: center;
    color: var(--muted);
    font-size: .84rem;
    font-weight: 700;
}
.pending-shortcut-button strong {
    display: inline-flex;
    margin-top: 0;
    font-size: .95rem;
    line-height: 1;
    color: var(--text);
    background: #ffcb2f;
    border-radius: 999px;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    align-items: center;
    justify-content: center;
}
.page-heading-actions .pending-shortcut-button { order: 1; }
.page-heading-actions [data-open-reservation] { order: 2; }
.card-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 13px; }
.card-heading h2 { margin: 0; }
.table-card { padding: 0; overflow: hidden; }
.table-card .card-heading { padding: 20px 22px 6px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .91rem; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: #f6f8fa; color: #4d5a65; font-size: .76rem; text-transform: uppercase; letter-spacing: .035em; }
tbody tr:last-child td { border-bottom: 0; }
.disabled-row { opacity: .66; background: #fafafa; }
.empty-state { text-align: center; padding: 30px; color: var(--muted); }
.actions-cell { width: 90px; }
.status { display: inline-block; border-radius: 999px; padding: 4px 9px; font-size: .76rem; font-weight: 750; }
.status-active { color: var(--success); background: var(--success-bg); }
.status-pending { color: var(--warning); background: var(--warning-bg); }
.status-rejected { color: var(--danger); background: #f7e0e0; }
.status-cancelled { color: var(--danger); background: var(--danger-bg); }
.request-actions { display: flex; gap: 8px; }
.request-actions form { margin: 0; }
.mine-reservations-panel { position: relative; }
.mine-filter-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.mine-filter-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px 10px;
}
.mine-filter-title {
    color: var(--muted);
    font-size: .74rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.mine-filter-bar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    background: #e9f0f4;
    border: 1px solid #c5d4de;
    border-radius: 999px;
}
.mine-filter-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 112px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: #385064;
    font-size: .85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.mine-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #cfdeea;
    color: #274056;
    font-size: .72rem;
    font-weight: 800;
}
#mine-filter-active:checked ~ .mine-filter-wrap .mine-filter-label[for="mine-filter-active"],
#mine-filter-all:checked ~ .mine-filter-wrap .mine-filter-label[for="mine-filter-all"] {
    color: #fff;
    background: linear-gradient(180deg, #39b7ff 0%, #1e9ee8 100%);
    border-color: #0f87cc;
    box-shadow: 0 4px 14px rgba(28, 93, 120, .35);
}
#mine-filter-active:checked ~ .mine-filter-wrap .mine-filter-label[for="mine-filter-active"] .mine-filter-count,
#mine-filter-all:checked ~ .mine-filter-wrap .mine-filter-label[for="mine-filter-all"] .mine-filter-count {
    background: #ffcb2f;
    color: #2d3f4f;
}
#mine-filter-active:checked ~ .table-wrap .mine-reservation-row[data-status]:not([data-status="active"]):not([data-status="pending"]) {
    display: none;
}
.mine-empty-active { display: none; }
#mine-filter-active:checked ~ .table-wrap .mine-empty-active {
    display: table-row;
}
.details-cell { max-width: 320px; overflow-wrap: anywhere; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88em; }
@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .two-column { grid-template-columns: 1fr; }
    .calendar-day { min-height: 91px; padding: 7px; }
    .day-label { font-size: .7rem; }
    .mine-filter-wrap { align-items: stretch; flex-direction: column; gap: 8px; }
}
@media (max-width: 700px) {
    .header-inner { padding: 0 16px; min-height: 60px; }
    .nav-toggle { display: block; }
    .main-nav { display: none; position: absolute; left: 12px; right: 12px; top: 61px; z-index: 20; flex-direction: column; align-items: stretch; padding: 10px; background: #173f52; border-radius: 0 0 10px 10px; box-shadow: var(--shadow); }
    .main-nav.open { display: flex; }
    .page-shell { padding: 22px 12px 42px; }
    .page-heading { align-items: stretch; flex-direction: column; }
    .page-heading-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
    .form-grid { grid-template-columns: 1fr; }
    .full-field { grid-column: auto; }
    .calendar { padding: 4px; }
    .calendar-weekdays span { padding: 5px 2px; font-size: .67rem; }
    .calendar-day { min-height: 77px; padding: 5px; gap: 4px; }
    .day-label { font-size: .61rem; line-height: 1.14; }
    .day-note { display: none; }
    .day-requesters { display: none; }
    .calendar-legend { font-size: .76rem; gap: 8px 12px; }
    .dialog-card { padding: 23px 18px; }
    .dialog-actions { flex-direction: column-reverse; }
    .dialog-actions .button { width: 100%; }
}
