/* App styles on top of Bootstrap 5.3 (app/static/vendor/bootstrap).
   Bootstrap gives the base look; this file sets the accent color, the
   rotation and status colors, and the few app-specific pieces. */

/* ---- Theme: white background, one calm accent (deep blue) ---------------- */
:root {
  --brand: #1f4e79; --brand-dark: #173b5c; --brand-ink: #fff;
  --bs-primary: #1f4e79; --bs-primary-rgb: 31, 78, 121;
  --bs-link-color: #1f4e79; --bs-link-color-rgb: 31, 78, 121;
  --bs-link-hover-color: #173b5c; --bs-link-hover-color-rgb: 23, 59, 92;
  --bs-body-bg: #fff; --bs-body-font-size: 1rem;
  --line: var(--bs-border-color); --muted: var(--bs-secondary-color);
  --ok: var(--bs-success-text-emphasis); --ok-bg: var(--bs-success-bg-subtle);
  --warn: var(--bs-warning-text-emphasis); --warn-bg: var(--bs-warning-bg-subtle);
  --bad: var(--bs-danger-text-emphasis); --bad-bg: var(--bs-danger-bg-subtle);
  --me: #fff3a3;
  /* Rotation colors (the name is always shown too) */
  --heavy: #b42318; --heavy-bg: #fdecea;      /* ICU tier: Hurley ICU, McLaren */
  --ss: #9d174d; --ss-bg: #fce7f3;            /* Select Saginaw tier */
  --floor: #c2410c; --floor-bg: #fff1e3;      /* Hurley Floor */
  --genesis: #8a6100; --genesis-bg: #fff8d1;  /* Genesis tier: Genesis and GB Office */
  --office: #2e7d32; --office-bg: #e8f5e9;    /* Flint and Grand Blanc offices */
  --vac: #6d28d9; --vac-bg: #ede9fe;          /* Vacation: clearly not office green */
}
.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
}
.app-navbar { background: var(--brand); padding-top: max(.5rem, env(safe-area-inset-top)); }
.app-navbar .nav-link.active { font-weight: 600; text-decoration: underline; text-underline-offset: 6px; }

/* Large tap targets on phones */
.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
.btn-sm { min-height: 36px; }
.form-control, .form-select { min-height: 44px; }
.navbar-toggler { min-height: 44px; }

/* ---- Layout helpers -------------------------------------------------------- */
h1 { font-size: 1.5rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: .75rem 0 .4rem; }
section.card { padding: 1rem 1.25rem; margin-bottom: 1rem; }
.card.highlight { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.card form + form { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.narrow { max-width: 420px; margin: 2.5rem auto; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .65rem; align-items: end; }
.grid .wide { grid-column: 1 / -1; }
.inline { display: inline-flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .25rem 0; }
.inline .form-control { width: auto; min-width: 12rem; }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
/* Buttons for one row, e.g. a request window: one line, same height, even gaps, left-aligned.
   Forms inside are only wrappers, so the card rule that separates stacked forms must not apply. */
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; justify-content: flex-start; }
.row-actions form { margin: 0; }
.row-actions .btn { white-space: nowrap; }
.card .row-actions form + form, .card .actions form + form { margin-top: 0; padding-top: 0; border-top: 0; }
main label { display: flex; flex-direction: column; gap: .25rem; font-size: .875rem; color: var(--muted); }
main label.radio { flex-direction: row; align-items: center; gap: .5rem; color: var(--bs-body-color); font-size: 1rem; min-height: 36px; }
main label.radio .form-check-input, td label .form-check-input { margin: 0; width: 1.25rem; height: 1.25rem; }
td label { flex-direction: row; align-items: center; gap: .4rem; }
fieldset.channels { border: 1px solid var(--line); border-radius: .5rem; padding: .5rem .75rem; display: flex; flex-direction: column; gap: .25rem; }
fieldset.channels legend { font-size: .875rem; color: var(--muted); padding: 0 .25rem; float: none; width: auto; margin: 0; }
.hint, .muted { color: var(--muted); }
.hint { font-size: .875rem; }
.warn { color: var(--warn); margin: .25rem 0; }
.error { color: var(--bad); margin: .25rem 0; }
.flash { margin-bottom: 1rem; }
pre { white-space: pre-wrap; font: inherit; font-size: .9rem; margin: .4rem 0; }
details summary { cursor: pointer; margin: .4rem 0; }
code { color: var(--bs-body-color); background: var(--bs-tertiary-bg); padding: 1px 4px; border-radius: 4px; }
.temp-password code { font-size: 1.4rem; padding: .4rem .6rem; user-select: all; }
.weekends { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .5rem; }
.weekends label > span { display: block; font-size: .85rem; margin-top: .15rem; }

/* ---- Tables ----------------------------------------------------------------- */
.scroll { margin-bottom: 1rem; border: 1px solid var(--line); border-radius: .5rem; }
.scroll .table { margin-bottom: 0; }
.table th, .table td { font-size: .875rem; vertical-align: top; }
.table.compact th, .table.compact td { padding: .25rem .4rem; }
.grid-table th:first-child, .grid-table td:first-child { position: sticky; left: 0; z-index: 1; }
.grid-table td { white-space: nowrap; }
.week-table td { white-space: normal; min-width: 120px; }
.nights, .heads { font-size: .75rem; }
.heads { white-space: nowrap; }
.holiday-tag { color: var(--warn); font-weight: 600; }

/* ---- Status colors: pending, approved, declined ------------------------------- */
.badge.status { font-weight: 600; font-size: .75rem; }
.status-approved, .status-granted, .status-published, .status-open, .status-active { background: var(--ok-bg); color: var(--ok); }
.status-pending, .status-waitlisted, .status-draft, .status-escalated { background: var(--warn-bg); color: var(--warn); }
.status-rejected, .status-declined { background: var(--bad-bg); color: var(--bad); }
.status-closed, .status-cancelled, .status-superseded, .status-discarded, .status-withdrawn { background: var(--bs-secondary-bg); color: var(--muted); }

/* ---- Rotation colors, the same everywhere a schedule appears ----------------- */
/* By workload, for rotations added on the Rotations page; the original seven follow. */
/* Tier colors (L2): every rotation is shown in the color of its tier */
.tier-icu { --rot: var(--heavy); --rot-bg: var(--heavy-bg); }
.tier-ss { --rot: var(--ss); --rot-bg: var(--ss-bg); }
.tier-floor { --rot: var(--floor); --rot-bg: var(--floor-bg); }
.tier-genesis { --rot: var(--genesis); --rot-bg: var(--genesis-bg); }
.tier-office { --rot: var(--office); --rot-bg: var(--office-bg); }
.rot { --bs-table-bg: var(--rot-bg); background-color: var(--rot-bg); box-shadow: inset 3px 0 0 var(--rot); }
.rot-head { --bs-table-bg: var(--rot-bg); background-color: var(--rot-bg); color: var(--rot) !important; border-bottom: 3px solid var(--rot) !important; }
.rot-HURLEY_ICU.rot, .rot-MCLAREN.rot, .rot-SELECT_SAGINAW.rot { font-weight: 600; }
.swatch { display: inline-block; width: 22px; height: 14px; border-radius: 3px; padding: 0; background: var(--rot-bg); border: 2px solid var(--rot); }
.swatch.me { background: var(--me); border-color: #d4b800; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: .8rem; color: var(--muted); margin: -.25rem 0 1rem; }
.legend > span { display: inline-flex; align-items: center; gap: .4rem; }
.me { background: var(--me); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.rotation-balance td.uneven { --bs-table-bg: var(--warn-bg); color: var(--warn); }
.forecast td.drifting { --bs-table-bg: var(--warn-bg); color: var(--warn); }
.forecast td.cannot-be-fully-repaired { --bs-table-bg: var(--bad-bg); color: var(--bad); }
.forecast td.largest { font-weight: 700; outline: 2px solid var(--warn); outline-offset: -2px; }
.chip { display: inline-block; border-radius: 4px; padding: 1px 6px; margin: 2px 0; background: var(--rot-bg); color: var(--rot); }

/* ---- Vacation: its own color and label, never shown as the office ------------- */
.who { display: block; }
.who small { display: block; font-size: .7rem; }
.vac { color: var(--vac); border-radius: 4px; padding: 1px 4px; font-weight: 600; }
.vac-full { background: var(--vac-bg); }
.vac-part { background: repeating-linear-gradient(135deg, var(--vac-bg) 0 6px, #fff 6px 12px); border: 1px dashed var(--vac); }
.swatch.vac { border: 2px solid var(--vac); }

/* ---- Vacation picker (flatpickr) ------------------------------------------------- */
.vac-toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.segmented { display: inline-flex; border: 1px solid var(--brand); border-radius: .5rem; overflow: hidden; }
main .segmented label { flex-direction: row; gap: .4rem; padding: .5rem .8rem; color: var(--brand); cursor: pointer; min-height: 44px; align-items: center; font-size: 1rem; }
main .segmented label:has(input:checked) { background: var(--brand); color: var(--brand-ink); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.vac-picker .flatpickr-calendar.inline { width: 100%; max-width: 440px; box-shadow: none; border: 1px solid var(--line); }
.vac-picker .flatpickr-innerContainer, .vac-picker .flatpickr-rContainer, .vac-picker .flatpickr-days,
.vac-picker .dayContainer { width: 100%; min-width: 100%; max-width: 100%; }
.vac-picker .flatpickr-day { max-width: none; flex-basis: 14.2857%; height: 44px; line-height: 44px; position: relative; }
.vac-picker .flatpickr-day.selected { background: var(--vac); border-color: var(--vac); }
.vac-picker .flatpickr-weekdays { width: 100%; }
.vac-picker .flatpickr-day .vac-count { position: absolute; right: 3px; top: 1px; font-size: 9px; line-height: 1; color: var(--muted); }
.vac-picker .flatpickr-day.selected .vac-count { color: #fff; }
.vac-picker .flatpickr-day.vac-full:not(.selected) { box-shadow: inset 0 0 0 2px var(--bad); }
.vac-picker .flatpickr-day.vac-holiday { background: var(--warn-bg); color: var(--warn); text-decoration: none; }
.vac-picker .flatpickr-day.vac-waitlisted.selected { background: #b45309; border-color: #b45309; }
.vac-picker .flatpickr-day.vac-anchor { box-shadow: 0 0 0 3px var(--brand); }
.vac-picker.range-armed .vac-range-hint { color: var(--brand); font-weight: 600; }
.vac-picker .flatpickr-months .flatpickr-month { height: 46px; }
.vac-picker .flatpickr-current-month { font-size: 17px; padding-top: 12px; height: auto; }
.vac-picker .flatpickr-months .flatpickr-prev-month, .vac-picker .flatpickr-months .flatpickr-next-month { padding: 13px 12px; }
.vac-total { font-size: .95rem; margin: .6rem 0 0; }
.vac-total .over { color: var(--bad); }

@media (max-width: 600px) {
  h1 { font-size: 1.3rem; }
  section.card { padding: .85rem 1rem; }
  .inline .form-control { min-width: 0; flex: 1 1 10rem; }
  .row-actions { flex-direction: column; align-items: stretch; width: 11rem; }
  .row-actions form, .row-actions .btn { width: 100%; }
}

/* Requests page views (office manager) */
.status-filter { display: flex; flex-wrap: wrap; gap: .35rem; }
.request-views .nav-tabs { flex-wrap: wrap; }
section.card[id^="req-"] { scroll-margin-top: 4.5rem; }
.weekends label.covered { color: var(--bs-secondary-color); }
.weekends label.covered select { background-color: var(--bs-secondary-bg); }
.status-covered { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }

/* Starting history (home page, one-time step before the first build) */
.starting-history { margin: 1rem 0; }
.starting-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.starting-row label { min-width: 8rem; font-weight: 600; }
.starting-row select { width: auto; min-width: 12rem; }

/* Schedule views: By rotation (default) and By doctor */
.schedule-views { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .5rem 0; }
.grid-table.by-doctor th:first-child, .grid-table.by-doctor td:first-child { background: var(--bs-body-bg); }

/* Reopen window (home page) */
.row-actions details.reopen > summary { list-style: none; }
.row-actions details.reopen > summary::-webkit-details-marker { display: none; }
.row-actions details.reopen[open] { flex-basis: 100%; }
.row-actions details.reopen form { margin-top: .4rem; max-width: 22rem; }

/* Draft editor: large cells, plain colors (red must fix, yellow warning, orange kept on purpose) */
.editor-help { max-width: 60rem; }
.editor.busy { opacity: .6; cursor: wait; }
.editor-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem;
  position: sticky; top: 0; z-index: 3; background: var(--bs-body-bg); padding: .5rem 0; border-bottom: 1px solid var(--bs-border-color); }
.editor-summary, .editor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.editor-actions form { margin: 0; }
.pill { display: inline-block; padding: .35rem .8rem; border-radius: 999px; font-weight: 700; font-size: 1rem; }
.pill-green { background: #d1f2dc; color: #0b5a2a; }
.pill-red { background: #fde2e1; color: #a1100d; }
.pill-yellow { background: #fff3c4; color: #6b5200; }
.pill-orange { background: #ffe1c2; color: #8a3b00; }
.editor-page { padding-left: 1.5rem; padding-right: 1.5rem; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1rem; align-items: start; margin-top: .75rem; }
@media (max-width: 1100px) { .editor-layout { grid-template-columns: 1fr; } .editor-problems { order: -1; } }
.editor-table td { vertical-align: top; min-width: 9.5rem; padding: .25rem; }
.editor-table th.week-cell { vertical-align: top; }
.editor-table .slot { border-radius: 6px; padding: .15rem; margin-bottom: .15rem; position: relative; }
.editor-table .cell-select { width: 100%; min-height: 2.5rem; font-size: .95rem; border: 1px solid rgba(0,0,0,.25);
  border-radius: 6px; background-color: rgba(255,255,255,.85); cursor: pointer; padding: .3rem .4rem; }
.editor-table .cell-select:hover, .editor-table .cell-select:focus { border-color: #0d6efd; box-shadow: 0 0 0 2px rgba(13,110,253,.25); }
.editor-table .slot.empty .cell-select { border: 2px dashed #a1100d; color: #a1100d; }
.editor-table .slot.changed { box-shadow: inset 4px 0 0 #0d6efd; }
.editor-table .slot.changed::after { content: "changed"; position: absolute; top: -.1rem; right: .3rem; font-size: .65rem;
  color: #0d6efd; font-weight: 700; text-transform: uppercase; }
.editor-table .revert { border: 0; background: none; color: #0d6efd; padding: .1rem 0; font-size: .85rem; text-decoration: underline; cursor: pointer; }
.editor-table .revert-form, .editor-table .cell-form { margin: 0; }
.editor-table .vac-note { display: block; font-size: .8rem; }
.editor .hl { outline: 3px solid #e8590c; outline-offset: 1px; }
.editor-problems { position: sticky; top: 4.5rem; max-height: calc(100vh - 6rem); overflow: auto; }
@media (max-width: 1100px) { .editor-problems { position: static; max-height: 40vh; border-bottom: 1px solid var(--line); } }
.editor-problems h2 { font-size: 1.2rem; }
.problem { border-left: 6px solid; border-radius: 6px; padding: .5rem .6rem; margin-bottom: .5rem; cursor: pointer; }
.problem p { margin: 0 0 .3rem; }
.problem .rule { color: var(--bs-secondary-color); font-size: .85rem; }
.problem-red { border-color: #d0021b; background: #fde2e1; }
.problem-orange { border-color: #e8590c; background: #ffe8d1; }
.problem-yellow { border-color: #e0a800; background: #fff8db; }
.problem .override summary { list-style: none; display: inline-block; }
.problem .override summary::-webkit-details-marker { display: none; }
.problem .override-form { margin-top: .4rem; display: grid; gap: .3rem; }
.override-note { color: #8a3b00; }
.ok-note { color: #0b5a2a; font-weight: 600; }
.overridden { color: #8a3b00; }
.status-overridden { background: #ffe1c2; color: #8a3b00; }
.btn-override { color: #8a3b00; border: 1px solid #e8590c; background: #fff; font-weight: 600; }
.btn-override:hover { background: #e8590c; color: #fff; }

/* Draft editor, stage two: locks, suggestions, versions, compare */
.editor { position: relative; }
.editor.busy::before { content: attr(data-busy-text); position: fixed; top: 40%; left: 50%; transform: translateX(-50%);
  z-index: 10; background: var(--bs-body-bg); border: 2px solid #0d6efd; border-radius: 8px; padding: .8rem 1.2rem;
  font-weight: 700; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.editor-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .5rem; }
.editor-tools form { margin: 0; }
.tools-label { font-weight: 600; color: var(--muted); }
.slot-tools { display: flex; justify-content: space-between; align-items: center; min-height: 1.4rem; }
.slot-tools form { margin: 0; }
.lock-btn { border: 0; background: none; padding: 0 .2rem; font-size: 1rem; line-height: 1; cursor: pointer; opacity: .35; }
.lock-btn:hover, .lock-btn:focus { opacity: 1; }
.lock-btn.on { opacity: 1; }
.editor-table .slot.locked { box-shadow: inset 0 0 0 2px #495057; }
.editor-table .slot.locked .cell-select { background-color: rgba(233,236,239,.9); cursor: not-allowed; }
.editor-table .slot.preview { outline: 3px dashed #e8590c; outline-offset: 1px; }
.week-cell .lock-form, .head-with-lock .lock-form { display: inline; }
.head-with-lock { white-space: nowrap; }
.problem-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: flex-start; }
.problem-actions form { margin: 0; }
.suggestion { border: 2px solid #0d6efd; border-radius: 8px; padding: .6rem .7rem; margin-bottom: 1rem; background: var(--bs-body-bg); }
.suggestion h2 { margin-top: 0; }
.option-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .4rem; }
.option-tabs form { margin: 0; }
.option-tab { border: 2px solid #0d6efd; background: #fff; color: #0d6efd; border-radius: 8px; padding: .35rem .7rem; font-weight: 600; }
.option-tab.on { background: #0d6efd; color: #fff; }
.option-changes { max-height: 14rem; overflow: auto; padding-left: 1.1rem; }
.suggestion-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.suggestion-actions form { margin: 0; }
.versions { margin-top: 1.2rem; }
.version-form, .compare-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: flex-end; }
.version-list { padding-left: 1.1rem; }
.version-list .btn-link { padding: 0; }
.compare-sides { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
@media (max-width: 1100px) { .compare-sides { grid-template-columns: 1fr; } }
.who.differs { outline: 3px dashed #e8590c; outline-offset: 1px; }

/* Day view of the draft editor: large clickable days */
.day-link { display: block; font-size: .8rem; font-weight: normal; }
.day-nav { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin-bottom: .5rem; }
.day-week-form { margin: 0; }
.day-table { border-collapse: separate; border-spacing: 4px; width: 100%; }
.day-table th { text-align: left; vertical-align: bottom; font-size: .9rem; }
.day-table th[scope=row] { vertical-align: middle; min-width: 9rem; }
.day-cell { min-width: 6rem; padding: 0; vertical-align: top; }
.day-btn, .day-fixed { display: flex; flex-direction: column; justify-content: center; width: 100%; min-height: 3.4rem;
  border-radius: 8px; padding: .3rem; text-align: center; font-weight: 600; font-size: .95rem; }
.day-btn { border: 2px solid var(--office); background: var(--office-bg); color: var(--office); cursor: pointer; }
.day-btn:hover, .day-btn:focus { box-shadow: 0 0 0 3px rgba(13,110,253,.35); }
.kind-vacation .day-btn, .kind-vacation .day-fixed { border-color: var(--vac); background: var(--vac-bg); color: var(--vac); }
.day-btn.picked { outline: 4px solid #0d6efd; outline-offset: 1px; }
.day-fixed { border: 1px dashed var(--line); background: #f1f3f5; color: var(--muted); font-weight: normal; cursor: not-allowed; }
.kind-holiday .day-fixed { background: var(--warn-bg); color: var(--warn); }
.day-cell.mark-red .day-btn, .day-cell.mark-red .day-fixed { border: 3px solid #a1100d; }
.day-cell.mark-orange .day-btn, .day-cell.mark-orange .day-fixed { border: 3px solid #e8590c; }
.day-cell .mark-text { display: block; font-size: .75rem; font-weight: 600; text-align: center; }
.day-cell.mark-red .mark-text { color: #a1100d; }
.day-cell.mark-orange .mark-text { color: #8a3b00; }
.day-cell.changed .day-btn { box-shadow: inset 4px 0 0 #0d6efd; }
.granted-tag { display: block; font-size: .7rem; font-weight: normal; }
.day-table tr.locked th[scope=row] { color: var(--muted); }
.left-cell { white-space: nowrap; vertical-align: middle; }
.day-form { margin-top: 1rem; padding: .75rem; border: 1px solid var(--line); border-radius: 8px; max-width: 48rem; }
.day-form h2 { font-size: 1.1rem; }
.day-form-fields { display: flex; flex-wrap: wrap; gap: .6rem; }
.day-form-fields .day-reason { flex: 1 1 18rem; }
.day-buttons { display: flex; gap: .6rem; margin-top: .6rem; }
.day-vacation { background: var(--vac); border-color: var(--vac); color: #fff; }
.day-vacation:hover { background: #5b21b6; color: #fff; }

/* Which rotations each doctor can work */
.restricted-note { color: var(--warn); }
.rotation-boxes { display: flex; flex-wrap: wrap; gap: .5rem; border: 0; padding: 0; }
.rotation-box { display: flex; align-items: center; gap: .4rem; padding: .45rem .7rem; border-radius: 6px; cursor: pointer; }
.tier-tally { list-style: none; padding: 0; }
.tier-tally > li { margin-bottom: .25rem; }
.tier-tally ul { margin: 0 0 0 1.2rem; padding: 0; }

/* Night Call tab: a month calendar, large clickable days */
.night-month { font-size: 1.2rem; margin: 0 .5rem; align-self: center; }
.night-cal { width: 100%; max-width: 56rem; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.night-cal th { text-align: center; font-size: .85rem; color: var(--muted); }
.night-cell { height: 4.2rem; vertical-align: top; padding: 0; border-radius: 8px; background: #f8f9fa; border: 1px solid var(--line); }
.night-cell.out { background: transparent; border-color: transparent; }
.night-link { display: flex; flex-direction: column; height: 100%; min-height: 4.2rem; padding: .25rem .35rem; color: inherit; text-decoration: none; border-radius: 8px; }
.night-link:hover, .night-link:focus { box-shadow: 0 0 0 3px rgba(13,110,253,.35); }
.night-date { font-size: .8rem; color: var(--muted); }
.night-doc { font-weight: 600; font-size: .95rem; color: var(--doc); border-left: 4px solid var(--doc); padding-left: .3rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.night-doc.none { color: #a1100d; border-left-color: #a1100d; }
.night-cell.uncovered, .night-cell.mark-red { background: #fde8e8; border: 2px solid #a1100d; }
.night-cell.mark-orange { background: #fff4e6; border: 2px solid #e8590c; }
.night-cell.mark-yellow { background: #fff9db; border: 2px solid #e0b100; }
.night-cell.picked { outline: 4px solid #0d6efd; outline-offset: 1px; }
.n1-mark { font-size: .65rem; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 .2rem; align-self: flex-start; margin-top: auto; }
.night-panel { margin-top: 1rem; padding: .75rem; border: 1px solid var(--line); border-radius: 8px; max-width: 48rem; }
.night-panel h2 { font-size: 1.1rem; }
.night-form { display: grid; gap: .5rem; margin-bottom: .5rem; }
.suggest-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.suggest-list form { margin: 0; }
.night-choice { border: 2px solid var(--line); text-align: left; }
.night-choice small { display: block; font-weight: normal; }
.level-fine { border-color: var(--office); }
.level-soft-warning { border-color: #e0b100; }
.night-counts, .night-log { margin-top: .75rem; }
.night-pill { text-decoration: none; }
.option-changes .night-change { font-weight: 600; color: #1d4ed8; }
.night-change-note { color: #1d4ed8; }

/* Rules page */
.rule-code { font-family: ui-monospace, monospace; font-weight: 700; }
.rule-card h2, .suggestion-card h2 { font-size: 1.1rem; }
.rule-numbers { display: grid; gap: .5rem; max-width: 34rem; }
.number-box { max-width: 8rem; font-size: 1.1rem; }

/* The doctor's schedule page: phone first */
.my-week h3 { font-size: 1rem; margin: .75rem 0 .25rem; }
.my-days { list-style: none; padding: 0; margin: 0; }
.my-day { display: flex; gap: .75rem; align-items: flex-start; padding: .45rem .5rem; border-top: 1px solid var(--line); }
.my-day.weekend { background: #f8f9fa; }
.my-day.off .my-what { color: var(--muted); }
.my-day.vacation { background: var(--vac-bg); }
.my-day.holiday { background: var(--warn-bg); }
.my-date { min-width: 2.6rem; text-align: center; line-height: 1.1; font-size: .85rem; color: var(--muted); }
.my-date b { font-size: 1.15rem; color: inherit; }
.my-what { display: flex; flex-wrap: wrap; gap: .3rem .5rem; align-items: center; }
.my-what .chip small { display: block; font-weight: normal; }
.tag { font-size: .8rem; border: 1px solid var(--line); border-radius: 4px; padding: 0 .35rem; }
.tag-night { border-color: #1d4ed8; color: #1d4ed8; font-weight: 600; }
.tag-weekend { border-color: var(--heavy); color: var(--heavy); }
.my-requests, .my-feedback { padding-left: 1.1rem; }
.my-requests li, .my-feedback li { margin-bottom: .4rem; }
.reply { color: var(--ok); }
.feedback { border-top: 1px solid var(--line); padding: .5rem 0; }
.feedback.handled { color: var(--muted); }
.feedback-handle { display: flex; flex-wrap: wrap; gap: .4rem; max-width: 36rem; }
.feedback-handle input { flex: 1 1 14rem; }


/* Messages (round 21) */
.msg-list .msg-unread .msg-subject, .msg-list .msg-unread .msg-sender { font-weight: 700; }
.msg-list .msg-subject { overflow-wrap: anywhere; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-filters { flex-wrap: wrap; }

/* Round 23: pending changes, the Changes list, the leave prompt */
.changes-list { border: 1px solid var(--line, #dee2e6); border-radius: 8px; padding: .6rem .9rem; margin-top: .6rem; background: #fff; }
.changes-list.has-changes { border-color: #e0a800; background: #fffdf2; }
.changes-list h2 { font-size: 1.1rem; margin: 0 0 .3rem; }
.changes-list .changes { margin: 0 0 .5rem; padding-left: 1.4rem; max-height: 14rem; overflow: auto; }
.changes-list .change { margin-bottom: .15rem; }
.changes-list .change-effect { color: #a1100d; list-style: none; margin-left: -1.2rem; }
.changes-list .change form { display: inline; margin: 0; }
.changes-list .change-undo { padding: 0 .3rem; vertical-align: baseline; }
.changes-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.changes-actions form { margin: 0; }
.leave-dialog { border: 0; border-radius: 10px; padding: 1.2rem 1.4rem; max-width: 30rem; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.leave-dialog::backdrop { background: rgba(0,0,0,.45); }
.leave-dialog h2 { font-size: 1.25rem; }
.leave-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.leave-actions form { margin: 0; }

/* Round 23: the replacement helper, the to-do list, lock help, the short guide */
.helper-btn { border: 1px solid #0d6efd; background: #fff; color: #0d6efd; border-radius: 4px; padding: 0 .35rem; font-size: .8rem; cursor: pointer; }
.helper-btn:hover { background: #0d6efd; color: #fff; }
.helper-open { display: inline; margin: 0; }
.helper-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.helper-actions form { margin: 0; display: flex; gap: .25rem; align-items: center; }
.helper-actions select { width: auto; max-width: 11rem; }
.option-tab.breaks { border-color: #e8590c; }
.option-story p { margin-bottom: .35rem; }
.option-breaks { padding-left: 1.1rem; margin-bottom: .35rem; }
.option-breaks .break-hard { color: #a1100d; }
.option-breaks .break-near { color: #8a3b00; }
.option-breaks .break-soft { color: #6b5200; }
.option-story .night-change { font-weight: 600; }
.lock-tools { align-items: flex-start; gap: .9rem; }
.lock-tools .tool { display: flex; flex-direction: column; max-width: 15rem; }
.lock-tools .tool-name { font-weight: 700; }
.lock-tools .tool-help { color: var(--bs-secondary-color); line-height: 1.2; margin-top: .15rem; }
.editor-guide { border: 2px solid #0d6efd; border-radius: 8px; background: #f2f7ff; padding: .7rem 1rem; margin-top: .6rem; max-width: 62rem; }
.editor-guide h2 { font-size: 1.15rem; }
.editor-guide li { margin-bottom: .3rem; }
.night-pill { font-weight: 700; color: #a1100d; }
.show-all > summary { cursor: pointer; color: var(--bs-secondary-color); margin: .4rem 0; }
/* Replacement helper: options that cancel a granted request sit apart, at the bottom */
.last-resort-section { margin-top: 1rem; padding: .6rem .8rem; border: 2px dashed #c92a2a; border-radius: 8px; background: #fff5f5; }
.option-tab.last-resort { border-color: #c92a2a; color: #c92a2a; }
.option-tab.last-resort.on { background: #c92a2a; color: #fff; }
/* Draft page for the office manager: status line on top, tools, then the schedule; warnings at the bottom */
.draft-status { margin: .25rem 0 .5rem; }
.draft-tools { padding-top: .6rem; padding-bottom: .4rem; }
.draft-tools .tool-buttons { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .4rem; }
.draft-tools .tool-buttons form { margin: 0; }
.draft-warnings { margin-top: 1.5rem; }

/* Weekend swaps */
.swap-note { display: block; margin-top: .15rem; padding: .05rem .3rem; border: 1px dashed #8a3b00; border-radius: .3rem; background: #fff7ed; color: #6b2e00; font-weight: 600; }
.swap-notes-card li { margin-bottom: .35rem; }
.swap-text { font-size: 1.02rem; }
.swap-breaks, .swap-notes { margin-bottom: .5rem; }
.swap-tool { margin: .5rem 0; }
.swap-tool .swap-form { margin-top: .5rem; padding: .75rem; border: 1px solid #d0d7de; border-radius: .5rem; background: #fff; max-width: 60rem; }
.swap-fields { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: end; margin-bottom: .5rem; }
.swap-preview { margin: .5rem 0; padding: .6rem; border-left: 4px solid #1f4e79; background: #f6f8fa; }
.tag-swap { border: 1px dashed #8a3b00; background: #fff7ed; color: #6b2e00; }
.change-swap { font-weight: 600; }

/* Printing the schedule (hospitals fax it): the schedule and its notes, no menus or buttons */
@media print {
  .app-navbar, .flash, form, .btn, .draft-tools, .schedule-views, .editor-bar, .lock-tools, .swap-tool, #feedback, #hospitals, #my-requests, details.override { display: none !important; }
  body { background: #fff; font-size: 10pt; }
  main { padding: 0 !important; max-width: none !important; }
  .card { border: 0; box-shadow: none; padding: 0; margin: 0 0 .5rem; }
  .table-responsive, .scroll { overflow: visible !important; }
  .grid-table { width: 100%; font-size: 8.5pt; }
  .grid-table th, .grid-table td { border: 1px solid #555 !important; padding: 2px 4px !important; }
  .grid-table tr { break-inside: avoid; }
  .swap-note { border: 1px solid #000; background: #fff; color: #000; }
  .swap-notes-card { border: 1px solid #000; padding: .3rem .5rem; break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}
