/* FPS Calendar Platform — admin and public chrome.
   The printed calendar carries its own styles (views/templates/_document.php);
   nothing here is ever applied to a rendered sheet. */

:root {
    --fps-navy: #1d2d3d;
    --fps-navy-700: #416180;
    --fps-accent: #597ea3;
    --fps-accent-soft: #eef6ff;
    --fps-ink: #1d1f20;
    --fps-muted: #5f676b;
    --fps-line: #dde1e4;
    --fps-bg: #f4f5f7;
    --sidebar-w: 232px;
}

body {
    background: var(--fps-bg);
    color: var(--fps-ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
}

/* ------------------------------------------------------------------ layout */

.admin-layout { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: var(--sidebar-w);
    flex: none;
    background: var(--fps-navy);
    color: #cfd8e0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-content { flex: 1; padding: 24px 28px 48px; min-width: 0; }

.sidebar-brand { display: flex; gap: 11px; align-items: center; padding: 18px 16px 16px; }
.sidebar-brand-mark {
    width: 38px; height: 38px; flex: none; border-radius: 7px;
    background: var(--fps-accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; letter-spacing: 0.05em;
}
.sidebar-brand-title { color: #fff; font-weight: 600; font-size: 16px; line-height: 1.1; }
.sidebar-brand-sub { font-size: 11px; color: #8fa3b5; }

.sidebar-nav { padding: 8px; display: flex; flex-direction: column; gap: 2px; }

.sidebar-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 7px;
    color: #cfd8e0; text-decoration: none; font-size: 14px;
}
.sidebar-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar-link.active { background: var(--fps-accent); color: #fff; font-weight: 600; }
.sidebar-link i { font-size: 16px; }

.sidebar-foot { margin-top: auto; padding: 8px 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.sidebar-foot .sidebar-link { padding-left: 0; }
.sidebar-user { border-top: 1px solid rgba(255, 255, 255, 0.12); padding-top: 12px; }
.sidebar-user-name { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-user-role { font-size: 11px; color: #8fa3b5; }

/* ------------------------------------------------------------------- pages */

.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head h1 { font-size: 23px; font-weight: 650; margin: 0; }
.page-head .lede { color: var(--fps-muted); font-size: 14px; margin: 3px 0 0; }

.card { border: 1px solid var(--fps-line); border-radius: 10px; box-shadow: none; }
.card-header { background: #fff; border-bottom: 1px solid var(--fps-line); font-weight: 600; }

.badge-soft { background: var(--fps-accent-soft); color: var(--fps-navy-700); font-weight: 600; }
.badge-draft { background: #fff3cd; color: #7a5b00; font-weight: 600; }
.badge-published { background: #d7f0e0; color: #17603a; font-weight: 600; }

.empty-state { text-align: center; padding: 44px 20px; color: var(--fps-muted); }
.empty-state i { font-size: 34px; opacity: 0.35; display: block; margin-bottom: 10px; }

/* -------------------------------------------------------- year/calendar grid */

.year-card { margin-bottom: 18px; }
.year-card .year-dates { color: var(--fps-muted); font-size: 13px; }

.calendar-row {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 16px; border-top: 1px solid var(--fps-line);
}
.calendar-row:hover { background: #fafbfc; }
.calendar-row .name { font-weight: 600; }
.calendar-row .meta { color: var(--fps-muted); font-size: 12.5px; }

/* --------------------------------------------------------------- the editor */

.editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
    gap: 20px;
    align-items: start;
}
@media (max-width: 1200px) { .editor-grid { grid-template-columns: 1fr; } }

.editor-main { min-width: 0; }
.event-table { font-size: 14px; }
.event-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fps-muted); font-weight: 600; }
.event-table td { vertical-align: middle; }
.event-table tr.is-selected > td { background: var(--fps-accent-soft); }
/* A disabled date stays listed so it can be switched back on; dim everything
   but its own switch so the row still reads as actionable. */
.event-table tr.is-disabled > td:not(.event-flag) { opacity: 0.5; }
.event-date { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.event-month-head td {
    background: #eef1f4; font-size: 11px; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--fps-muted);
}

/* The calendar chips are the whole sharing model in one control: each chip is
   one calendar, lit when the date applies to it. */
.cal-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.cal-chip {
    border: 1px solid var(--fps-line); background: #fff; color: var(--fps-muted);
    border-radius: 999px; padding: 1px 9px; font-size: 11.5px; font-weight: 600;
    cursor: pointer; line-height: 1.6; white-space: nowrap;
}
.cal-chip:hover { border-color: var(--fps-accent); }
.cal-chip.on { background: var(--fps-navy); border-color: var(--fps-navy); color: #fff; }
.cal-chip.overridden { box-shadow: inset 0 -3px 0 #e0a800; }
.cal-chip:disabled { opacity: 0.5; cursor: default; }

.type-dot {
    width: 22px; height: 14px; flex: none; display: inline-block;
    border: 1px solid #9aa1a6; vertical-align: -2px; border-radius: 2px;
}

.preview-panel { position: sticky; top: 18px; }
/* With the audit under it the panel outgrows the screen, and a sticky element
   taller than the viewport cannot be scrolled to its bottom. Scroll it on its
   own instead, so the preview stays put beside a long list of dates. */
@media (min-width: 1201px) {
    .preview-panel { max-height: calc(100vh - 36px); overflow-y: auto; }
}

/* Employee dates: the back page of the Employee calendar, one X per group. */
.employee-table { font-size: 14px; }
.employee-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fps-muted); font-weight: 600; vertical-align: bottom; }
.employee-table td { vertical-align: middle; }
.emp-cell {
    min-width: 44px; min-height: 30px; padding: 2px 6px; border: 1px dashed var(--fps-line);
    border-radius: 6px; background: #fff; color: var(--fps-navy); line-height: 1.1;
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
}
.emp-cell:not(:disabled):hover { border-color: var(--fps-accent); border-style: solid; }
.emp-cell .emp-x { font-weight: 700; visibility: hidden; }
.emp-cell.is-off { border: 2px solid var(--fps-navy); }
.emp-cell.is-off .emp-x { visibility: visible; }
.emp-cell .emp-note { font-size: 10.5px; color: var(--fps-muted); max-width: 110px; }
.emp-cell:not(.is-off) .emp-note { margin-top: -1.1em; }
.emp-cell:disabled { cursor: default; opacity: 1; }

/* Work calendars: the table above the holidays on the Employee calendar's back page. */
.work-table { font-size: 13.5px; }
.work-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fps-muted); font-weight: 600; vertical-align: bottom; }
.work-table tbody th { font-weight: 700; white-space: nowrap; vertical-align: middle; }
.work-table .work-empty { background: #e9ecef; }
.work-cell {
    width: 100%; min-height: 48px; border: 0; background: #fff; padding: 5px 4px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15;
}
.work-cell:not(:disabled):hover { background: var(--fps-accent-soft); }
.work-cell:disabled { cursor: default; }
.work-days { font-size: 17px; font-weight: 700; color: var(--fps-navy); font-variant-numeric: tabular-nums; }
.work-window { font-size: 11.5px; color: var(--fps-muted); white-space: nowrap; }
.work-personal { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fps-muted); }

/* Day count audit */
.audit { font-size: 13px; }
.audit-window { margin-bottom: 10px; }
.audit-sum { width: 100%; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.audit-sum th { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fps-muted); font-weight: 600; text-align: right; }
.audit-sum td { padding: 3px 0; vertical-align: top; border-top: 1px solid var(--fps-line); }
.audit-sum td + td { text-align: right; width: 58px; font-weight: 600; }
.audit-sum summary { cursor: pointer; }
.audit-sum .audit-total td { border-top: 2px solid var(--fps-navy); font-weight: 700; color: var(--fps-navy); }
.audit-dates { color: var(--fps-muted); font-size: 12px; margin: 3px 0 0 14px; }
.audit-checks { list-style: none; padding: 0; margin: 0 0 12px; }
.audit-checks li { display: flex; gap: 7px; padding: 6px 8px; border-radius: 6px; margin-bottom: 4px; }
.audit-check-warning { background: #fff4d6; color: #5c4200; }
.audit-check-info { background: var(--fps-accent-soft); color: var(--fps-navy-700); }
.audit-clear { color: #2f6b3a; margin-bottom: 12px; }
.audit-month { border-top: 1px solid var(--fps-line); }
.audit-month summary { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; cursor: pointer; font-weight: 600; }
.audit-month-counts { color: var(--fps-muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.audit-days { width: 100%; margin-bottom: 8px; }
.audit-days th { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fps-muted); font-weight: 600; padding: 2px 4px; }
.audit-days td { padding: 3px 4px; border-top: 1px solid #eef0f2; vertical-align: top; }
.audit-days .audit-date { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.audit-days .audit-no { text-align: right; font-variant-numeric: tabular-nums; width: 52px; }
.audit-days tr.is-plain td { color: var(--fps-muted); }
.audit-days tr.is-off td { background: #fbeff3; }
.audit-days tr.is-weekend td { color: var(--fps-muted); background: #f4f5f6; }
.audit-entry { font-size: 12px; color: var(--fps-ink); }
.audit-entry span { color: var(--fps-muted); }
.audit-entry-decides { font-weight: 600; }
.audit-entry-outranked, .audit-entry-agrees, .audit-entry-weekend, .audit-entry-note { color: var(--fps-muted); }
.preview-frame {
    width: 100%; border: 1px solid var(--fps-line); border-radius: 8px;
    background: #fff; aspect-ratio: 11 / 8.5;
}
.preview-frame.portrait { aspect-ratio: 8.5 / 11; }

.stat-strip { display: flex; gap: 18px; flex-wrap: wrap; }
.stat-strip .stat-value { font-size: 22px; font-weight: 700; line-height: 1; color: var(--fps-navy); }
.stat-strip .stat-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--fps-muted); }
.stat-strip .stat-override { color: #a37500; }

/* --------------------------------------------------------------- login page */

.login-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(160deg, #1d2d3d 0%, #2c455d 55%, #416180 100%);
    padding: 24px 16px;
}
.login-card {
    background: #fff; border-radius: 14px; padding: 32px;
    width: 100%; max-width: 410px; box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}
.login-head { text-align: center; margin-bottom: 22px; }
.login-mark {
    width: 52px; height: 52px; border-radius: 11px; margin: 0 auto 12px;
    background: var(--fps-navy); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; letter-spacing: 0.05em;
}
.login-head h1 { font-size: 21px; font-weight: 650; margin: 0; }
.login-head p { color: var(--fps-muted); font-size: 13px; margin: 2px 0 0; }
.login-foot { margin: 22px 0 0; font-size: 12.5px; color: var(--fps-muted); text-align: center; }

/* -------------------------------------------------------------- public list */

.public-wrap { max-width: 880px; margin: 0 auto; padding: 40px 20px 64px; }
.public-head { border-bottom: 2px solid var(--fps-navy); padding-bottom: 12px; margin-bottom: 22px; }
.public-year { font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--fps-accent); font-weight: 700; margin: 26px 0 8px; }

/* ------------------------------------------------------------------ mobile */

@media (max-width: 860px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; height: auto; position: static; }
    .sidebar-nav { flex-direction: row; overflow-x: auto; }
    .sidebar-foot { flex-direction: row; align-items: center; padding-top: 0; }
    .sidebar-user { border-top: 0; padding-top: 0; }
    .admin-content { padding: 16px; }
}

/* ---------------------------------------------------------------- versions */

.badge-version { background: #ede7f6; color: #4a2f80; font-weight: 600; font-size: 11.5px; }

.versions-block { border-top: 1px solid var(--fps-line); background: #fbfbfd; border-radius: 0 0 10px 10px; }
.versions-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
    padding: 9px 16px;
}
.versions-title { font-weight: 600; font-size: 13px; color: #4a2f80; }
.versions-empty { padding: 0 16px 11px; color: var(--fps-muted); font-size: 13px; }
.version-row { border-left: 3px solid #b39ddb; }
.version-row.is-disabled { border-left-color: var(--fps-line); opacity: 0.75; }
.version-row .version-note { color: var(--fps-muted); font-size: 12.5px; font-style: italic; margin-top: 2px; }
.version-stats { font-size: 12.5px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.35; }
.version-stats span { color: var(--fps-muted); }
.versions-disabled > summary { padding: 7px 16px; font-size: 13px; color: var(--fps-muted); cursor: pointer; }

.delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.version-stats .delta-up, .delta-up { color: #17603a; }
.version-stats .delta-down, .delta-down { color: #a3261d; }

.version-banner {
    display: flex; gap: 10px; align-items: flex-start;
    background: #f4effb; border: 1px solid #d9cdee; color: #33215a; font-size: 14px;
}
.version-banner > i { font-size: 18px; line-height: 1.2; }
.version-banner.alert-secondary { background: #f1f2f4; border-color: var(--fps-line); color: var(--fps-ink); }
.version-banner-note { margin-top: 4px; font-style: italic; color: #5b4a7a; }

/* ----------------------------------------------------------------- compare */

.compare-totals th, .compare-totals td { vertical-align: middle; }
.compare-totals thead th { font-size: 12px; color: var(--fps-muted); font-weight: 600; }
.compare-totals tbody th { font-weight: 600; width: 250px; }
.compare-totals td.num { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.compare-totals tr.is-changed > * { background: #fffaeb; }

.compare-days, .compare-dates { font-size: 13.5px; }
.compare-days th, .compare-dates th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fps-muted); font-weight: 600; }
.compare-days td, .compare-dates td { vertical-align: top; }
.compare-month td {
    background: #f6f7f9; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--fps-muted);
}
.compare-month td:last-child { text-transform: none; letter-spacing: 0; font-weight: 600; }
.compare-date { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.cmp-swatch {
    display: inline-block; width: 18px; height: 13px; vertical-align: -2px; margin-right: 6px;
    border: 1px solid #c9ced2; border-radius: 2px;
}
.cmp-type { font-weight: 600; }
.cmp-event { color: var(--fps-muted); }
.cmp-counts { font-size: 12px; color: var(--fps-muted); }

.compare-kind { font-weight: 600; }
.compare-kind-added, .compare-kind-switched_on { background: #d7f0e0; color: #17603a; }
.compare-kind-removed, .compare-kind-switched_off { background: #f8dcd9; color: #8a2017; }
.compare-kind-changed { background: #fff3cd; color: #7a5b00; }

/* Printing the compare report for a meeting: just the report. */
@media print {
    .admin-sidebar, .no-print, .toast-container { display: none !important; }
    .admin-content { padding: 0; }
    body { background: #fff; }
    .compare-days tr, .compare-dates tr { break-inside: avoid; }
}

.calendar-delete-effects { padding-left: 18px; margin-bottom: 14px; color: var(--fps-ink); }
.calendar-delete-effects li + li { margin-top: 5px; }

.version-sheets { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 12.5px; }
.version-sheet { white-space: nowrap; color: var(--fps-ink); }
.version-sheet a { color: var(--fps-muted); margin-left: 4px; text-decoration: none; }
.version-sheet a:hover { color: var(--fps-accent); }
