/* RManS — the shared stylesheet.
 *
 * Taken from the approved Chief-screen design (`app/design/chief-screens/assets/app.css`,
 * PR #112, approved by the Owner on 2026-11-05): its tokens, top bar, layout, cards,
 * tables, badges, banners and form controls. Those are the primitives every increment's
 * screen is built from, so a page inherits the approved look by extending `base.html`.
 *
 * What is deliberately not here: the design's screen-specific grids (the 13-block year
 * grid, the on-call month grid, the units board, the preparer strip). Each belongs to
 * the increment that builds that screen — 0.3 for the year grid, 0.5–0.9 for the rest —
 * and copying them here now would be styling for pages that do not exist.
 *
 * The mock's three layout patterns ARE here, ported from the same source file so every
 * screen that extends `base.html` inherits them. All are inert until a screen's own
 * markup reaches for them:
 *   drawer             .drawer (add `open` to slide it in, .drawer-right for the other
 *                      edge), .drawer-backdrop, .icon-btn for the opener
 *   bottom sheet       .sheet-backdrop > .sheet (a sheet from the bottom edge below
 *                      720px, a centred dialog at 720px and up)
 *   pinned 1st column  .sticky-first on a <table> inside a .table-wrap
 * The shared toast region (`#toast-region`, from the mock's .toast-wrap) sits at the
 * end of `base.html` inside `{% block body_end %}`.
 *
 * No build step, no external fonts, no CDN. One file, served by Django's staticfiles.
 */

:root {
  color-scheme: light;
  --ink: #14181f;
  --ink-2: #39414d;
  --muted: #5b6572;
  --faint: #7b8492;
  --line: #e2e6ec;
  --line-strong: #c8cfda;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --accent: #1f5fa8;
  --accent-ink: #17497f;
  --accent-soft: #eaf1f9;
  --gap: #8a5a00;
  --gap-bg: #fdf3e0;
  --gap-line: #e4c78d;
  --conflict: #a8271f;
  --conflict-bg: #fdecea;
  --conflict-line: #f0b7b2;
  --unconfirmed: #553a9e;
  --unconfirmed-bg: #f2eefc;
  --unconfirmed-line: #cfc2ef;
  --ok: #1c6b41;
  --ok-bg: #e9f5ee;
  --ok-line: #b6ddc6;
  --warn: #8a5a00;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

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

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; margin-bottom: .5rem; }
h2 { font-size: 1.05rem; margin: 1.4rem 0 .5rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 .6rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip {
  position: absolute; left: -999px; top: 0; background: var(--surface);
  padding: .6rem 1rem; z-index: 100; border: 1px solid var(--line);
}
.skip:focus { left: .5rem; top: .5rem; }

/* ---------- top bar (Phase 0.4's frame) ---------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; flex-direction: column; gap: .35rem;
  padding: .5rem 1rem .4rem;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
/* Row 1: the product name, and sign out. */
.bar-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.bar-top form { margin: 0; }

.brand {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; color: var(--ink);
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: .8rem; font-weight: 700;
  letter-spacing: .02em; flex: none;
}
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; }
.brand a { color: inherit; }

/* Row 2: the account's name and which home it is in, on its own line under the product
   name (Owner, 2026-11-08, 0.4 S5). */
.who {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center;
  column-gap: .5rem; min-width: 0; text-align: center;
}
.who strong { font-size: .9rem; font-weight: 600; overflow-wrap: anywhere; }
.who span { font-size: .75rem; color: var(--muted); }
.who span::before { content: "\00b7\00a0"; }

/* Row 3: the tabs, as in the resident view. The active one sits in the middle; when every
   tab fits CSS centres the group, and otherwise the bar scrolls inside itself and the
   inline script in the shell centres the active tab. The destination tabs are rendered
   from the registry; the home tabs are the two homes (0.4 BD4-58). */
.tabbar {
  display: flex; align-items: center; justify-content: safe center; gap: 4px;
  min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px;
}
.tabbar::-webkit-scrollbar { display: none; }
.tabs-group, .tab-form { display: contents; }
.tab {
  flex: none;
  font-size: .8rem; font-weight: 600; color: var(--muted);
  padding: .35rem .7rem; border-radius: 999px; white-space: nowrap;
  background: none; border: 0; margin: 0; width: auto;
  font-family: inherit; cursor: pointer; text-decoration: none;
}
a.tab:hover, button.tab:hover { color: var(--ink); background: var(--surface); text-decoration: none; }
.tab[aria-current="page"] {
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}

/* ---------- the resident's frame (the Owner, 2026-11-13) ---------- */
.rtools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .4rem; position: relative; min-width: 0; }
.rtools form { margin: 0; }
.rswitch {
  display: inline-flex; align-items: center; min-height: 36px; padding: .35rem .65rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--accent-soft);
  color: var(--accent-ink); font: inherit; font-size: .78rem; font-weight: 600;
  white-space: nowrap; width: auto; margin: 0; cursor: pointer;
}
.rswitch:hover { border-color: var(--accent); background: var(--surface); }
/* The 44px circle icon button, for the two top bars only: the resident bar and the
   Chief's bar-top tools (bell, Settings gear). The drawer's opener keeps its own 38px
   square `.icon-btn` further down — the scope here never reaches it. */
.rbar .icon-btn,
.topbar .bar-top .icon-btn {
  position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; list-style: none;
  padding: 0;
}
.rbar .icon-btn::-webkit-details-marker { display: none; }
.rbar .icon-btn:hover,
.topbar .bar-top .icon-btn:hover { background: var(--bg); text-decoration: none; }
/* The button of the page you are on (the Owner's 0.4 mock): the gear on the Settings
   page and the pages its entries open, the bell on the notices page. */
.topbar .bar-top .icon-btn[aria-current="page"],
.rtools a.icon-btn[aria-current="page"] {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink);
}
.rcount {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--conflict); color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--surface);
}
.rmenu { position: relative; }
.rmenu-list {
  position: absolute; right: 0; top: 50px; z-index: 50; min-width: 13rem; padding: .35rem;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.rmenu-list a, .rmenu-list button {
  display: block; width: 100%; text-align: left; padding: .75rem; min-height: 44px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--ink); font: inherit; text-decoration: none; cursor: pointer;
}
.rmenu-list a:hover, .rmenu-list button:hover { background: var(--bg); }
.rmenu-list form { margin: 0; }
.rmenu-list .rout { color: var(--conflict); border-top: 1px solid var(--line); border-radius: 0; margin-top: .25rem; }
.rtabs .tab { flex: 1; text-align: center; padding: .6rem .7rem; font-size: .9rem; }

.signout {
  font-size: .8rem; color: var(--muted); padding: .35rem .5rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  margin: 0; width: auto; font-weight: 600; cursor: pointer;
}
.signout:hover { background: var(--bg); color: var(--ink); }

/* ---------- Layout standard (UI-R, the Owner, 2026-11-13) ----------
 *
 * ONE responsive standard for every page, phones first (375 and 390 px wide). The Owner:
 * "i think the problem with content not approporaite to screen is related to all pages and
 * content and should be standarized" and "also the not fitting the screen goes also for both
 * rota and vacation". A page that follows the primitives below fits the screen without a
 * rule of its own; a page that needs a width of its own is a defect in the page.
 * `docs/core/UI-REVIEW-LIST.md` ("Layout standard") says how to add a page, and
 * `workspace/tests/test_no_sideways_scroll_browser.py` fails the build when a page scrolls
 * sideways at 375 or 390 px.
 *
 *   page container   .page-main (inside .page-body): side padding, a max width (46rem;
 *                    78rem with `body.wide`), centred, never wider than the viewport.
 *   long text        everything in .page-main wraps (overflow-wrap: anywhere): a UUID, an
 *                    email, a URL, a code, a long name. Flex and grid children of the
 *                    layout classes below get min-width: 0 so they can shrink.
 *   media, pre       img, svg, video never exceed the width; <pre> scrolls inside itself.
 *   stacking         at 620px and below .grid.two, .grid.two-even, .grid.three, .kv,
 *                    .pl-two, .finder fields, the page head and the action rows are one
 *                    column.
 *   action rows      .btn-row, .row-actions, .page-head .actions, .finder-actions and
 *                    .pl-actions wrap and never push past the edge; on a phone every button
 *                    and button-link in them is a 44px tap target.
 *   forms            inputs, selects and textareas are full width and 16px on a phone;
 *                    labels and fields stack. .field-narrow / .field-wide cap a field's
 *                    width on a wide screen only (they are full width on a phone).
 *   narrow page      .narrow (+ .pad) is a plain single-column body, as the error pages use.
 *   tables           THE DEFAULT is the labelled stacked card: below 620px every <table>
 *                    becomes one card per row and each <td data-label="..."> prints its own
 *                    label (`identity/tests/test_table_data_labels.py` guards the labels).
 *                    A table that genuinely needs its grid is an explicit SCROLLING MATRIX:
 *                    it carries `sticky-first` (first column pinned; app.css), `matrix`
 *                    (no pinned column), `pl-grid` (the year grid) or `pl-table` (the
 *                    placements tables, in `.pl-wrap`), and it sits inside its own
 *                    `.table-wrap` / `.pl-wrap` box, which scrolls sideways while the page
 *                    itself does not.
 *   width on a page  never an inline `style="...width..."`; use the classes above.
 */

.page-body { display: block; min-height: calc(100vh - 60px); width: 100%; max-width: 100%; }

.page-main {
  flex: 1 1 auto; min-width: 0;
  width: 100%; max-width: 46rem; margin-inline: auto;
  padding: 1.4rem 1.6rem 4rem;
}
body.wide .page-main { max-width: 78rem; }

/* Long words, codes, emails, URLs, UUIDs and names wrap instead of widening the page. */
.page-main, .topbar, .banner, .auth-card { overflow-wrap: anywhere; }

/* A flex or grid child may shrink below its content, so a long word cannot push its row wider
   than the screen. `:where()` keeps this at zero specificity: any rule can still override. */
:where(.page-head, .card-head, .banner, .list li, .row-actions, .btn-row, .finder, .finder-actions,
       .grid, .stack, .kv, .settings-list, .pl-head, .pl-actions, .pl-toolbar, .pl-card__head,
       .pl-two, .pl-strip, .pl-legend, .toast) > * { min-width: 0; }

img, svg, video, canvas, iframe, object { max-width: 100%; }
img, video, canvas { height: auto; }
pre {
  max-width: 100%; overflow-x: auto; margin: 0 0 .6rem;
  overflow-wrap: normal; white-space: pre;
}
pre code { overflow-wrap: normal; white-space: inherit; }

/* One row of buttons and links: it wraps, and never runs past the edge. */
fieldset { min-width: 0; max-width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.btn-row button, .btn-row form { margin-top: 0; }

/* Width caps, in place of inline styles. Full width on a phone (see the 620px block). */
.narrow { width: 100%; max-width: 40rem; }
.pad { padding: 1rem; }
.field-narrow { max-width: 16rem; }
.field-wide { max-width: 32rem; }
.field-full { width: 100%; max-width: 100%; }

/* Plain pages that do not extend base.html's frame (the error pages): the document's own
   16px type on white, so a fault page never inherits the frame. */
body.plain { font: 16px/1.5 system-ui, sans-serif; background: #fff; color: CanvasText; }
body.plain h1 { font-size: 2em; margin: .67em 0; }

.page-head { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.page-head .titles { min-width: 0; flex: 1 1 22rem; }
.page-head .sub { margin: .3rem 0 0; color: var(--muted); font-size: .875rem; max-width: 62rem; }
.page-head .actions { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }

/* ---------- surfaces ---------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card + .card { margin-top: 1rem; }
.card-head {
  display: flex; align-items: center; gap: .75rem;
  padding: .8rem 1rem; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.card-head h2 { font-size: .95rem; margin: 0; }
.card-head .hint { margin-left: auto; font-size: .78rem; color: var(--muted); }
.card-body { padding: 1rem; }
.card-body.tight { padding: .6rem; }
.card-foot {
  padding: .7rem 1rem; border-top: 1px solid var(--line);
  font-size: .78rem; color: var(--muted); background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}

.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
.grid.two-even { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.stack { display: grid; gap: .75rem; }

.muted { color: var(--muted); }
.small { font-size: .8rem; }
.tiny { font-size: .72rem; }

/* A code-like value: a UUID, an address, a permission name. */
code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: .85em; background: var(--bg); border: 1px solid var(--line);
  border-radius: 5px; padding: .05rem .3rem;
}

/* ---------- buttons and form controls ---------- */

button {
  margin: .6rem 0 0; padding: .45rem .8rem; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font: inherit; font-size: .83rem; font-weight: 600; cursor: pointer;
}
button:hover { background: var(--accent-ink); }
button.secondary {
  background: var(--surface); color: var(--ink); border-color: var(--line-strong);
}
button.secondary:hover { background: var(--bg); }
button.danger { background: var(--surface); color: var(--conflict); border-color: #e7b6b1; }
button.danger:hover { background: var(--conflict-bg); }

label { display: block; font-weight: 600; margin: .9rem 0 .25rem; font-size: .85rem; }
input, select, textarea {
  width: 100%; padding: .5rem .6rem; font: inherit; font-size: .9rem;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink);
}
input[type="checkbox"], input[type="radio"] { width: auto; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}

/* ---------- a broken rule, under the field it is about (BD-119) ----------
 *
 * The Owner read the sign-up page on 2026-11-06 and asked for every blocking rule to
 * be visible on the page rather than in a sentence that could be read either way:
 * "make it in red if not applied to not move forward for exaemple wrong passward the
 * boc outline should appear in red with comment under it".
 *
 * Colour is never the only signal: the outline comes with a "✗" mark, a visually
 * hidden "Error:" that a screen reader reads, and the sentence itself in the summary
 * at the top, which links back to this field.
 */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

input.input-error, select.input-error, textarea.input-error {
  border: 2px solid var(--conflict);
  background: var(--surface);
}
input.input-error:focus, select.input-error:focus, textarea.input-error:focus {
  outline-color: var(--conflict); border-color: var(--conflict);
}

.field-error {
  margin: .35rem 0 0; font-size: .875rem; font-weight: 600; color: var(--conflict);
}
.field-error-mark { margin-right: .3rem; }

.error-summary {
  border: 1px solid var(--conflict-line); border-left: 6px solid var(--conflict);
  background: var(--conflict-bg); color: var(--ink);
  padding: .8rem 1rem; border-radius: var(--radius-sm); margin: 0 0 1rem;
  font-size: .9rem;
}
.error-summary p { margin: 0 0 .4rem; }
.error-summary ul { margin: 0; padding-left: 1.1rem; }
.error-summary a { color: var(--conflict); }

/* The password rules, shown before anything is typed and marked as they are met. */
.rules {
  list-style: none; margin: .35rem 0 0; padding: 0;
  font-size: .85rem; color: var(--muted);
}
.rules li { display: flex; gap: .4rem; align-items: baseline; }
.rules .rule-mark { width: 1rem; text-align: center; font-weight: 700; }
.rules .rule-met { color: var(--ok); }
.rules .rule-not-met { color: var(--conflict); font-weight: 600; }

/* ---------- notes and banners ---------- */

.hint { font-size: .875rem; color: var(--muted); margin-top: .25rem; }

.notice {
  padding: .7rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid #cfe0f2; background: var(--accent-soft);
  font-size: .85rem; color: var(--ink-2); margin: 0 0 1rem;
}
.notice.warn { border-color: var(--gap-line); background: var(--gap-bg); color: var(--gap); }
.notice.error { border-color: var(--conflict-line); background: var(--conflict-bg); color: var(--conflict); }
.notice strong { color: var(--ink); }

.banner {
  display: flex; gap: .6rem; align-items: flex-start;
  padding: .7rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
  font-size: .82rem; color: var(--ink-2); margin-bottom: 1rem;
}
.banner.info { background: var(--accent-soft); border-color: #cfe0f2; }
.banner.delegate { background: #fdf6ec; border-color: #efd9b6; }
.banner.conflict { background: var(--conflict-bg); border-color: var(--conflict-line); }
.banner.gap { background: var(--gap-bg); border-color: var(--gap-line); }
.banner strong { color: var(--ink); }
.banner .banner-icon { font-size: 1rem; line-height: 1.2; }

/* ---------- badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: .28rem;
  padding: .1rem .4rem; border-radius: 999px;
  font-size: .7rem; font-weight: 700; letter-spacing: .01em;
  border: 1px solid transparent; white-space: nowrap;
}
.badge.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.badge.gap { color: var(--gap); background: var(--gap-bg); border-color: var(--gap-line); }
.badge.conflict { color: var(--conflict); background: var(--conflict-bg); border-color: var(--conflict-line); }
.badge.unconfirmed { color: var(--unconfirmed); background: var(--unconfirmed-bg); border-color: var(--unconfirmed-line); }
.badge.info { color: var(--accent-ink); background: var(--accent-soft); border-color: #cfe0f2; }
.badge.neutral { color: var(--ink-2); background: var(--bg); border-color: var(--line); }
.badge.delegate { color: #6b3f00; background: #fdf1e2; border-color: #ecd0a8; }

/* ---------- tables ---------- */

/* A scrolling matrix scrolls inside its own box (see "Layout standard"): its words do not
   break mid-word, so its columns keep a readable width and the box scrolls instead. */
table.sticky-first, table.matrix, table.pl-grid, table.pl-table { overflow-wrap: normal; }
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .45rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; color: var(--faint); white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }

/* The cell that holds a row's forms: wide enough to type a name into, and stacked so
   two forms do not sit side by side (0.1's roster and placements pages). */
td.actions { min-width: 20rem; }
td.actions form + form { margin-top: .75rem; padding-top: .5rem; border-top: 1px solid var(--line); }

.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.row-actions button { margin-top: 0; padding: .35rem .7rem; font-size: .85rem; }

/* ---------- confirm-first destructive buttons (`_confirm_submit.html`, UI-2) ----------
 *
 * A <details> with no script: closed, the <summary> keeps the exact footprint of the
 * button it replaces, so a row that held one plain button shifts nothing, in `.row-actions`
 * or anywhere else. Opened, the consequence sentence and the two real buttons appear below;
 * on a phone those get a full 44px tap target, because the extra step is meant to be
 * deliberate. */

details.confirm { display: inline-block; }
details.confirm > summary {
  list-style: none; cursor: pointer; display: inline-block;
  margin: .6rem 0 0; padding: .45rem .8rem; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: .83rem; font-weight: 600;
}
details.confirm > summary::-webkit-details-marker { display: none; }
details.confirm > summary::marker { content: ""; }
details.confirm > summary:hover { background: var(--bg); }
.row-actions details.confirm { margin: 0; }
.row-actions details.confirm > summary { margin-top: 0; padding: .35rem .7rem; font-size: .85rem; }

.confirm-body {
  margin-top: .5rem; padding: .7rem .8rem; max-width: 26rem;
  border: 1px solid var(--conflict-line); border-radius: var(--radius-sm);
  background: var(--conflict-bg);
}
.confirm-body p { margin: 0 0 .6rem; font-size: .85rem; color: var(--ink); }
.confirm-body button { margin: 0 .5rem 0 0; }

@media (max-width: 620px) {
  details.confirm > summary, .confirm-body button { min-height: 44px; }
}

/* ---------- the roster's two tabs, search and short list (0.4 S5 part 2) ----------
 *
 * Current residents / Add a resident are two pages, drawn as the same pill pair the top bar
 * uses, so a tab is a link and needs no script. The finder is one row on a wide screen and
 * stacks on a phone. */

.subtabs {
  display: flex; gap: 4px; width: fit-content; max-width: 100%;
  overflow-x: auto; scrollbar-width: none;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px; margin: 0 0 1rem;
}
.subtabs::-webkit-scrollbar { display: none; }
.sub-tab {
  flex: none; font-size: .85rem; font-weight: 600; color: var(--muted);
  padding: .4rem .9rem; border-radius: 999px; white-space: nowrap; text-decoration: none;
}
.sub-tab:hover { color: var(--ink); background: var(--surface); text-decoration: none; }
.sub-tab[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.finder {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem .8rem;
  margin: 0 0 1rem;
}
.finder-field { flex: 1 1 11rem; min-width: 0; }
.finder-field.finder-search { flex: 2 1 16rem; }
.finder-field label { margin-top: 0; }
.finder-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding-bottom: .1rem; }
.finder-actions button { margin: 0; }

a.button-link {
  display: inline-block; padding: .4rem .8rem; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: .83rem; font-weight: 600; text-decoration: none;
}
a.button-link:hover { background: var(--bg); text-decoration: none; }

.roster-list td a { font-weight: 600; }
.back { margin: 0 0 .6rem; font-size: .85rem; }

details.add-new { margin-top: 1rem; }
details.add-new > summary {
  cursor: pointer; padding: .8rem 1rem; font-weight: 650; font-size: .95rem;
}
details.add-new[open] > summary { border-bottom: 1px solid var(--line); }

/* A read-only history, closed by default (UI-REVIEW-LIST.md §B, item 3): the summary
 * reads like a quiet link, not a button, since opening it changes nothing. */
details.history { margin-top: .6rem; }
details.history > summary {
  cursor: pointer; display: inline-block; color: var(--accent); font-weight: 600;
  font-size: .85rem; list-style: none; padding: .1rem 0;
}
details.history > summary::-webkit-details-marker { display: none; }
details.history > summary:hover { text-decoration: underline; }
details.history[open] > summary ~ * { margin-top: .6rem; }

@media (max-width: 620px) {
  /* A 44px-high tap target, the accepted minimum, for the closed control on a phone. */
  details.history > summary { display: flex; align-items: center; min-height: 44px; }
}

.settings-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .6rem; }
.settings-link {
  display: block; padding: .9rem 1rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-weight: 650; color: var(--ink);
}
.settings-link:hover { background: var(--surface-2); text-decoration: none; }

/* ---------- keys and lists ---------- */

.kv { display: grid; grid-template-columns: minmax(7rem, 34%) minmax(0, 1fr); gap: .15rem .6rem; font-size: .85rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: .5rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .6rem; align-items: flex-start; }
.list li:last-child { border-bottom: 0; }
.list li .grow { flex: 1; min-width: 0; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .grid.two { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .brand small { display: none; }
  .page-main { padding: 1rem .9rem 6rem; }
  .page-head h1 { font-size: 1.25rem; }
}

@media (max-width: 620px) {
  .topbar { padding: .45rem .6rem .4rem; }
  .card-head { padding: .6rem .7rem; }
  .card-head .hint { margin-left: 0; }
  .card-body { padding: .7rem; }
  table { font-size: .82rem; }

  /* -- Layout standard: stacking (grids, columns, card rows, form rows, action rows) -- */
  .page-main { padding: 1rem .75rem 5rem; }
  .grid.two, .grid.two-even, .grid.three, .pl-two { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dd { margin-bottom: .35rem; }
  .page-head .titles { flex-basis: 100%; }
  .page-head .actions, .btn-row, .row-actions, .finder-actions, .pl-actions { width: 100%; }
  .finder-field, .finder-field.finder-search { flex: 1 1 100%; }
  /* a form row (label + field + button, as 0.5's setup forms are) stacks: label over field */
  .row-actions > label, .row-actions > fieldset, .btn-row > label { flex: 1 1 100%; }

  /* -- buttons: a 44px tap target, and a long label wraps rather than push past the edge -- */
  button:not(.tab):not(.icon-btn):not(.undo), a.button-link, .btn, .sub-tab { min-height: 44px; }
  button, a.button-link, .btn { max-width: 100%; }
  .btn { max-width: 100%; }
  a.button-link { display: inline-flex; align-items: center; }

  /* -- forms: full width and 16px (iOS Safari zooms the page on focus below that); labels and
        fields stack. A field's width cap is for wide screens only. -- */
  input, select, textarea { width: 100%; max-width: 100%; font-size: 1rem; }
  input[type="checkbox"], input[type="radio"] { width: auto; }
  .field-narrow, .field-wide { max-width: none; }

  /* The default for every <table> that is not a scrolling matrix (`sticky-first`, `matrix`,
     `pl-grid`, `pl-table`): one card per row, each cell prints its own `data-label`. */
  :where(table:not(.sticky-first, .matrix, .pl-grid, .pl-table)),
  :where(table:not(.sticky-first, .matrix, .pl-grid, .pl-table)) :is(thead, tbody, tfoot, tr, th, td) {
    display: block;
  }
  :where(table:not(.sticky-first, .matrix, .pl-grid, .pl-table)) thead { display: none; }
  :where(table:not(.sticky-first, .matrix, .pl-grid, .pl-table)) th[scope="row"] { display: none; }
  :where(table:not(.sticky-first, .matrix, .pl-grid, .pl-table)) tr { border-bottom: 1px solid var(--line); padding: .5rem 0; }
  :where(table:not(.sticky-first, .matrix, .pl-grid, .pl-table)) td { border: 0; padding: .15rem 0; }
  :where(table:not(.sticky-first, .matrix, .pl-grid, .pl-table)) td::before { content: attr(data-label) ": "; font-weight: 600; color: var(--faint); }
  :where(table:not(.sticky-first, .matrix, .pl-grid, .pl-table)) td:not([data-label])::before { content: none; }
  td.actions { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- print ---------- */

@media print {
  .topbar, .skip, .signout, .tabbar { display: none !important; }
  .page-body { display: block; }
  .page-main { padding: 0; max-width: none; }
  body { background: #fff; font-size: 10pt; }
  .card { box-shadow: none; break-inside: avoid; }
  .table-wrap { overflow: visible; }
}

/* ---------- patterns from the mock (drawer, bottom sheet, pinned first column) ----------
 *
 * Ported from `app/design/chief-screens/assets/app.css`, the same approved mock as the
 * rest of this file. Each pattern is a class a screen composes itself; nothing below
 * changes how an existing page renders, because no current template uses these names.
 */

/* The mock's overlay-panel backdrop serves both the sheet and the drawer; a screen
   that renders the element with `hidden` gets nothing. */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .35); z-index: 60;
}
.drawer-backdrop[hidden] { display: none; }

/* Drawer: an off-canvas panel, full height, on the left (or `.drawer-right` on the
   right). Inert until the screen adds the `open` class — the screen's own few lines of
   inline script flip the class and keep the opener's aria-expanded in step, as in the
   mock. Below the top bar's own content it shows; the screen owns focus. */
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 70;
  width: min(84vw, 19rem); overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: .9rem .6rem 2rem;
  transform: translateX(-102%); transition: transform .18s ease;
}
.drawer.open { transform: none; box-shadow: var(--shadow-lg); }
.drawer-right {
  left: auto; right: 0; border-right: 0; border-left: 1px solid var(--line);
  transform: translateX(102%);
}

/* The drawer's opener, the mock's 38px square button. */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-size: 1.1rem; cursor: pointer;
}

/* Bottom sheet: anchored to the bottom edge on a phone, a centred dialog from 720px.
   Same form as the mock's; a screen closes it by removing the element or re-adding
   `hidden` on the backdrop. */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .35); z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-backdrop[hidden] { display: none; }
@media (min-width: 720px) {
  .sheet-backdrop { align-items: center; }
}
.sheet {
  background: var(--surface); width: 100%; max-width: 34rem;
  border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg);
  max-height: 88vh; overflow-y: auto;
}
@media (min-width: 720px) { .sheet { border-radius: 16px; } }
.sheet header {
  display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface);
}
/* The app's shared h2 carries a top margin the mock's did not; the sheet's title sits
   in a bar, so it is reset here. */
.sheet header h2 { font-size: 1rem; margin: 0; }
.sheet header .close { margin-left: auto; }
.sheet .body { padding: 1rem; }
.sheet footer {
  display: flex; gap: .5rem; justify-content: flex-end; padding: .8rem 1rem;
  border-top: 1px solid var(--line); position: sticky; bottom: 0;
  background: var(--surface); flex-wrap: wrap;
}

/* Pinned first column: add .sticky-first to any wide table inside a .table-wrap; the
   first cell of every row stays visible while the rest scrolls sideways. The first
   cell needs an opaque background, and on hover it follows the row. */
table.sticky-first th:first-child, table.sticky-first td:first-child {
  position: sticky; left: 0; z-index: 1; background: var(--surface);
  box-shadow: 1px 0 0 var(--line);
}
table.sticky-first thead th:first-child { z-index: 3; }
table.sticky-first tbody tr:hover td:first-child { background: var(--surface-2); }
@media (max-width: 620px) {
  /* A table that asks for a pinned column is a scrolling matrix: the stacked-card default
     (above) leaves it alone, so it keeps its table shape and scrolls inside .table-wrap. */
  table.sticky-first, table.matrix { min-width: 28rem; }
}

/* Buttons as the mock styles them, for the controls a drawer, sheet or toast carries —
   including the ones that are links. The app's unclassed <button> keeps its own look;
   a screen opts either idiom per control. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .45rem .8rem; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-size: .83rem; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--ink); border-color: var(--line-strong);
  white-space: nowrap;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.danger { color: var(--conflict); border-color: #e7b6b1; background: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.sm { padding: .28rem .55rem; font-size: .76rem; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 620px) {
  /* Layout standard: a long label wraps on a phone instead of pushing past the edge. */
  .btn { white-space: normal; text-align: center; }
}

/* The toast, and the shared region `base.html` renders for it (empty until a screen
   raises one). Position and palette are the mock's; the region hides itself while
   empty so it can take no click and start nothing. */
.toast-wrap {
  position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 80;
  display: grid; gap: .4rem; width: min(92vw, 30rem);
}
.toast-wrap:empty { display: none; }
.toast {
  background: #1c2430; color: #fff; border-radius: 10px; padding: .6rem .8rem;
  font-size: .82rem; box-shadow: var(--shadow-lg);
  display: flex; gap: .6rem; align-items: center;
}
.toast .undo {
  margin-left: auto; background: none; border: 0; color: #9fc6f5;
  font: inherit; font-weight: 700; cursor: pointer;
}

/* Small primitives the mock carries and the screens composed of the patterns use. */
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.dot { width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; display: inline-block; }
.empty { padding: 1.5rem 1rem; text-align: center; color: var(--muted); font-size: .85rem; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid.three { grid-template-columns: minmax(0, 1fr); }
}

@media print {
  .drawer, .drawer-backdrop, .sheet-backdrop, .sheet, .toast-wrap { display: none !important; }
}

/* ---------- sign-in, sign-up and recovery (Owner, 2026-11-09) ----------
 *
 * "Branded card": the RManS mark and name, then one centred card, then quiet links. The
 * brand is the signed-in frame's own (`.brand`, `.brand-mark`); only the layout is new.
 * Mobile first: the card fills the width on a phone and is capped at 26rem above that.
 */

body.auth .page-body { min-height: 0; }
body.auth .page-main {
  max-width: 26rem; margin: 0 auto; padding: 1.5rem 1rem 3rem;
}
.auth-brand { display: flex; justify-content: center; margin: 1rem 0 1.1rem; }
.auth-brand .brand { font-size: 1.15rem; }
.auth-brand .brand-mark { width: 38px; height: 38px; font-size: .95rem; border-radius: 10px; }
.auth-brand .brand small { font-size: .78rem; }

.auth-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.25rem 1.1rem 1.35rem;
}
.auth-card h1 { font-size: 1.35rem; margin-bottom: .6rem; }
.auth-card > p:first-of-type { color: var(--muted); font-size: .9rem; }
.auth-card label:first-of-type { margin-top: .4rem; }
/* 16px inputs: iOS Safari zooms the page on focus below that. */
.auth-card input, .auth-card select { font-size: 1rem; padding: .65rem .7rem; }
.auth-card button { font-size: .95rem; padding: .7rem .9rem; }
.auth-card > .notice:last-child { margin-bottom: 0; }
button.full, button.passkey-btn { width: 100%; margin-top: 1.1rem; }
.auth-card form + form button.full { margin-top: .6rem; }

.auth-links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.1rem;
  margin: 1.1rem 0 0; font-size: .875rem;
}
.auth-links a { padding: .35rem 0; }

@media (min-width: 640px) {
  body.auth .page-main { padding-top: 3rem; }
  .auth-card { padding: 1.6rem 1.5rem 1.7rem; }
}

/* The privacy notice at sign-up (M-17): drawn whole in its own bordered, scrollable region. */
.privacy-notice {
  border: 1px solid var(--border, #c9ced6);
  border-radius: .4rem;
  padding: .7rem .9rem;
  margin: .8rem 0;
  max-height: 22rem;
  overflow-y: auto;
  font-size: .9rem;
}
.privacy-notice h2 { font-size: 1.05rem; margin: 0 0 .4rem; }
.privacy-notice ol { padding-left: 1.2rem; margin: .4rem 0 0; }
.privacy-notice li { margin-bottom: .5rem; }

/* ---------- the resident's Rota tab, Full year (RF-2, the Owner, 2026-11-13) ----------
 *
 * "not nessarly like this but this is an ispiration that you should find a way to fit it on different screens":
 * the inspiration is a table of Block | Date range | Rotation with the rotation cell filled with its colour. On a
 * phone (below 768px) each block is a compact card: the block label and the rotation name on the same row, the dates
 * on a second line. From 768px it is a real table. Nothing scrolls sideways at any width: long names wrap.
 *
 * This file carries no rotation colour. The page sets a rotation's background and text colour on its element, from
 * `placements/services/rotation_colours.py`, the one place the Owner's legend is written. */

.rota-table { width: 100%; border-collapse: collapse; }
.rota-line {
  padding: .55rem .75rem; border-radius: 6px; font-weight: 650; line-height: 1.25;
  overflow-wrap: anywhere; word-break: break-word; min-width: 0;
}
.rota-line + .rota-line { margin-top: .3rem; }
.rota-own-dates { display: block; margin-top: .1rem; font-size: .8rem; font-weight: 500; }
.rota-badge {
  display: inline-block; padding: .15rem .55rem; border-radius: 6px; font-weight: 650;
  overflow-wrap: anywhere; word-break: break-word; max-width: 100%;
}
.rota-this { font-size: 1.05rem; overflow-wrap: anywhere; }
.rota-next { overflow-wrap: anywhere; }

@media (max-width: 767px) {
  table.rota-table, table.rota-table tbody { display: block; }
  table.rota-table thead { display: none; }
  table.rota-table tr {
    display: grid; grid-template-columns: minmax(2.4rem, auto) minmax(0, 1fr);
    grid-template-areas: "block rot" "dates dates";
    gap: .35rem .75rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--line);
  }
  table.rota-table td { display: block; padding: 0; border: 0; min-width: 0; }
  table.rota-table td::before { content: none !important; display: none !important; }
  table.rota-table td.rota-c-block { grid-area: block; font-size: 1.1rem; }
  table.rota-table td.rota-c-rot { grid-area: rot; }
  table.rota-table td.rota-c-dates { grid-area: dates; font-size: .9rem; }
  .rota-line { font-size: 1.1rem; }
}

@media (min-width: 768px) {
  table.rota-table { display: table; }
  table.rota-table thead { display: table-header-group; }
  table.rota-table tbody { display: table-row-group; }
  table.rota-table tr { display: table-row; }
  table.rota-table th, table.rota-table td { display: table-cell; padding: .45rem .6rem; vertical-align: middle; }
  table.rota-table td::before { content: none !important; display: none !important; }
  table.rota-table td.rota-c-block { white-space: nowrap; width: 5rem; font-weight: 650; }
  table.rota-table td.rota-c-dates { white-space: nowrap; width: 17rem; }
  table.rota-table td.rota-c-rot { padding: .3rem .6rem; }
}

/* ---------- the resident's Vacation tab: block picker (RV-1, the Owner, 2026-11-14) ----------
 *
 * Phone-first, nothing wider than the viewport, every tap target at least 44px, fields at 16px,
 * long words wrap. Open/partly blocks are native <details> with four 7-day week rows and a sticky
 * bottom bar holding the one Submit button. Classes are .vac-*; the page carries no inline style. */

.vac-page [hidden] { display: none !important; }
.vac-page, .vac-page .card, .vac-page .card-body { min-width: 0; overflow-wrap: anywhere; }
.vac-page .card + .card { margin-top: .75rem; }
.vac-page h2 { margin: 0 0 .45rem; font-size: 1.05rem; }
.vac-page .btn {
  min-height: 48px; padding: 0 1rem; margin: 0; font-size: 1rem; white-space: normal; text-align: center;
  text-decoration: none; width: 100%; display: inline-flex; align-items: center; justify-content: center;
}
.vac-page .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.vac-page .btn.danger { color: var(--conflict); border-color: var(--conflict); background: var(--surface); }
.vac-page .btn[disabled] { background: var(--surface-2); color: var(--faint); border-color: var(--line-strong); opacity: 1; cursor: not-allowed; }
.vac-page .vac-big { min-height: 54px; font-size: 1.05rem; font-weight: 650; }
.vac-page summary { cursor: pointer; }
.vac-page summary::-webkit-details-marker { display: none; }
.vac-page summary::marker { content: ""; }
.vac-page summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vac-link { display: inline-flex; align-items: center; min-height: 48px; font-weight: 600; text-decoration: underline; }
.vac-inline-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 .2rem;
  font-weight: 600; color: var(--accent-ink); text-decoration: underline;
}

/* notices */
.vac-page .notice { overflow-wrap: anywhere; }
.vac-page .notice .btn { width: auto; margin-top: .4rem; }
.vac-page .notice.vac-done { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok); }
.vac-page .notice.vac-done strong { color: var(--ok); }

/* My days */
.vac-balance { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; text-align: center; margin: .25rem 0 .5rem; }
.vac-balance div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .25rem; min-width: 0; }
.vac-balance strong { display: block; font-size: 1.6rem; line-height: 1.1; }
.vac-balance span { font-size: .8rem; color: var(--muted); }
.vac-balance .left strong { color: var(--accent-ink); }
.vac-more { border-top: 1px solid var(--line); margin-top: .5rem; }
.vac-more > summary, .vac-how > summary {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 48px;
  font-weight: 600; color: var(--accent-ink); list-style: none;
}
.vac-more > summary::after, .vac-how > summary::after, .vac-block > summary::after, .vac-see > summary::after {
  content: ""; width: .55rem; height: .55rem; flex: none; margin-right: .15rem;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s;
}
.vac-more[open] > summary::after, .vac-how[open] > summary::after,
.vac-block[open] > summary::after, .vac-see[open] > summary::after { transform: rotate(225deg); }
.vac-more p, .vac-how p { font-size: .9rem; color: var(--ink-2); }
.vac-more ul { margin: 0 0 .5rem; padding-left: 1.1rem; font-size: .9rem; }

/* compact B1..B13 block list */
.vac-blocks { display: grid; gap: .4rem; grid-template-columns: minmax(0, 1fr); align-items: start; margin-top: .5rem; min-width: 0; }
.vac-block { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); min-width: 0; }
.vac-block[open] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.vac-block.vac-done-row { border-color: var(--ok-line); background: var(--ok-bg); }
.vac-block.vac-locked { background: var(--surface-2); color: var(--muted); }
.vac-row {
  display: grid; grid-template-columns: 2.35rem minmax(0, 1fr) auto; gap: .45rem; align-items: center;
  min-height: 52px; padding: .45rem .65rem; list-style: none; min-width: 0;
}
.vac-row-static { grid-template-columns: 2.35rem minmax(0, 1fr); }
.vac-btag {
  display: inline-flex; align-items: center; justify-content: center; height: 1.75rem; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line-strong); font-size: .82rem; font-weight: 700; color: var(--ink);
}
.vac-block[open] .vac-btag { background: var(--accent); border-color: var(--accent); color: #fff; }
.vac-done-row .vac-btag { background: var(--ok); border-color: var(--ok); color: #fff; }
.vac-locked .vac-btag { color: var(--muted); border-color: var(--line); }
.vac-bmid { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .5rem; min-width: 0; }
.vac-bdates { font-size: .92rem; font-weight: 650; color: var(--ink); }
.vac-locked .vac-bdates { color: var(--ink-2); font-weight: 600; }
.vac-bsum { font-size: .84rem; color: var(--muted); }
.vac-bsum-open { color: var(--accent-ink); font-weight: 600; }
.vac-bsum-partly { color: var(--accent-ink); font-weight: 700; }
.vac-bsum-done { color: var(--ok); font-weight: 700; }
.vac-done-links { display: flex; flex-wrap: wrap; gap: 0 .65rem; width: 100%; }
.vac-pill {
  display: inline-block; padding: .08rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 600; line-height: 1.45;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--muted);
}
.vac-pill-gap { background: var(--gap-bg); border-color: var(--gap-line); color: var(--gap); }

/* expanded four-week calendar inside an open/partly block */
.vac-block-body {
  border-top: 1px solid var(--line); padding: .55rem .65rem; background: var(--surface-2);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm); min-width: 0;
}
.vac-partly-note {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .2rem .6rem;
  padding: .35rem .55rem; margin-bottom: .45rem; background: var(--ok-bg); border: 1px solid var(--ok-line);
  border-radius: var(--radius-sm); font-size: .86rem; color: var(--ink);
}
.vac-step-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem .5rem;
  margin-bottom: .45rem; min-width: 0;
}
.vac-rule-lbl { font-size: .85rem; color: var(--ink-2); }
.vac-counter {
  display: inline-block; padding: .2rem .6rem; border-radius: 99px; font-size: .85rem; font-weight: 700;
  background: var(--accent-soft); border: 1px solid var(--accent); color: var(--accent-ink);
}
.vac-cap-note { margin: 0 0 .45rem; padding: .45rem .65rem; font-size: .88rem; }

.vac-cal { display: grid; gap: .35rem; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.vac-week-row {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  padding: .1rem; min-width: 0;
}
.vac-week-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; min-width: 0;
}
.vac-dcell {
  position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center;
  justify-content: space-between; min-height: 54px; margin: 0; padding: .22rem 1px;
  border: 1.5px solid var(--line-strong); border-radius: 6px; background: var(--surface);
  cursor: pointer; font-weight: 500; text-align: center; min-width: 0; overflow-wrap: normal; user-select: none;
}
.vac-dcell input[type="checkbox"] {
  position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; padding: 0;
  opacity: 0; font-size: 1rem; pointer-events: none;
}
.vac-d-dow { display: block; font-size: .68rem; font-weight: 700; line-height: 1.1; color: var(--muted); }
.vac-hol-tag { font-style: normal; font-size: .62rem; font-weight: 800; color: var(--gap); }
.vac-d-num { display: block; font-size: .88rem; font-weight: 750; line-height: 1.1; color: var(--ink); }
.vac-d-num small { display: block; font-size: .62rem; font-weight: 600; color: var(--muted); }
.vac-d-seat { display: block; font-size: .68rem; font-weight: 700; line-height: 1.1; color: var(--accent-ink); }

.vac-dcell:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.vac-dcell.vac-hol { border-style: dashed; border-color: var(--gap); background: var(--gap-bg); }
.vac-dcell.vac-bridged { border-style: dashed; border-color: var(--accent); background: var(--accent-soft); }
.vac-dcell:has(input:checked) { border-style: solid; border-color: var(--accent); background: var(--accent); color: #fff; }
.vac-dcell:has(input:checked) .vac-d-dow,
.vac-dcell:has(input:checked) .vac-d-num,
.vac-dcell:has(input:checked) .vac-d-num small,
.vac-dcell:has(input:checked) .vac-d-seat,
.vac-dcell:has(input:checked) .vac-hol-tag { color: #fff; }
.vac-dcell.vac-held-cell {
  border-style: solid; border-color: var(--ok-line); background: var(--ok-bg); cursor: not-allowed;
}
.vac-dcell.vac-held-cell .vac-d-dow,
.vac-dcell.vac-held-cell .vac-d-num,
.vac-dcell.vac-held-cell .vac-d-seat { color: var(--ok); }
.vac-dcell.vac-off, .vac-dcell.vac-cap-off {
  background: var(--surface-2); border-color: var(--line); color: var(--faint); cursor: not-allowed;
}
.vac-dcell.vac-off .vac-d-dow, .vac-dcell.vac-off .vac-d-num, .vac-dcell.vac-off .vac-d-seat,
.vac-dcell.vac-cap-off .vac-d-dow, .vac-dcell.vac-cap-off .vac-d-num, .vac-dcell.vac-cap-off .vac-d-seat {
  color: var(--faint);
}

.vac-week-end {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .15rem .5rem;
  padding: .25rem .15rem .05rem; font-size: .78rem; color: var(--ink-2); min-width: 0;
}
.vac-wk-lbl { color: var(--muted); }
.vac-wk-seats { color: var(--accent-ink); font-weight: 700; }

.vac-grid-notes { margin: .45rem 0 0; font-size: .82rem; color: var(--muted); }
.vac-grid-notes p { margin: 0 0 .25rem; }
.vac-hol-note { color: var(--gap); }

/* sticky bottom bar with ONE button */
.vac-bar {
  position: sticky; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--line-strong);
  margin: .5rem -.65rem -.55rem; padding: .6rem .65rem .7rem; box-shadow: 0 -6px 12px rgba(16, 24, 40, .06);
}

/* approved days */
.vac-held { border: 1px solid var(--ok-line); background: var(--ok-bg); border-radius: var(--radius-sm); padding: .75rem; margin-bottom: .6rem; min-width: 0; }
.vac-held p { margin: 0 0 .3rem; }
.vac-held-dates { font-size: 1.05rem; }
.vac-held-meta { color: var(--ink-2); }
.vac-held-mark { font-size: .9rem; font-weight: 700; color: var(--ok); }
.vac-held-mark::before { content: "\2713\00a0"; }
.vac-held .vac-small { font-size: .85rem; color: var(--muted); }
.vac-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-top: .6rem; align-items: start; }
.vac-act { min-width: 0; }
.vac-act[open], .vac-act:has(details[open]) { grid-column: 1 / -1; }
.vac-act > summary.btn { display: flex; }
.vac-act > form.vac-panel { margin: 0; padding: 0; background: transparent; border: 0; }
.vac-act details.confirm > summary {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px;
  padding: 0 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-size: 1rem; font-weight: 600; text-align: center;
}
.vac-act details.confirm[open] .confirm-body {
  margin-top: .5rem; padding: .75rem; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
.vac-act details.confirm .confirm-body button {
  min-height: 48px; font-size: 1rem; margin-top: .35rem; width: 100%;
}
.vac-panel { margin-top: .5rem; padding: .75rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.vac-panel .vac-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .25rem; }
.vac-fld { display: block; margin: 0 0 .6rem; font-size: .95rem; font-weight: 600; }
.vac-fld input { display: block; width: 100%; min-height: 48px; margin-top: .25rem; font-size: 1rem; font-weight: 400; }

/* the confirmation screen */
.vac-narrow { max-width: 36rem; }
.vac-sentence { font-size: 1.25rem; line-height: 1.4; font-weight: 650; margin: 0 0 .9rem; }
.vac-btnrow { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .5rem 0; }
.vac-quiet { color: var(--muted); font-size: .9rem; margin: 0 0 .25rem; }
.vac-how, .vac-see { border-top: 1px solid var(--line); margin-top: .5rem; }
.vac-see > summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; font-weight: 600; color: var(--accent-ink); }
.vac-see ul { margin: 0 0 .5rem; padding-left: 1.1rem; font-size: .9rem; }
.vac-warn { border-color: var(--gap-line); background: var(--gap-bg); }
.vac-warn h2 { color: #5c3c00; }
.vac-warn ul, .vac-alt { margin: .25rem 0 0; padding-left: 1.2rem; }
.vac-warn li, .vac-alt li { margin-bottom: .4rem; }

@media (max-width: 620px) {
  .vac-choose > .card-body { padding: .75rem .45rem; }
  .vac-row { padding: .45rem .5rem; }
  .vac-block-body { padding: .5rem .35rem; }
  .vac-bar { margin: .5rem -.35rem -.5rem; padding: .55rem .45rem .65rem; }
}

@media (min-width: 621px) {
  .vac-week-row {
    display: grid; grid-template-columns: minmax(0, 1fr) 10.5rem; gap: .5rem; align-items: center;
  }
  .vac-week-end {
    flex-direction: column; align-items: flex-end; justify-content: center; text-align: right;
    padding: .3rem .45rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px;
  }
}

@media (min-width: 768px) {
  .vac-page .btn.vac-big { width: auto; min-width: 16rem; }
  .vac-acts, .vac-btnrow { max-width: 26rem; }
}

/* ---------- vacation setup (UI-CHIEF-VACATION-SETUP) ---------- */
.vac-setup-nav { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.vac-setup-form { display: flex; flex-direction: column; gap: .75rem; margin-top: .6rem; }
.vac-setup-form fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .75rem; margin: 0; min-width: 0; }
.vac-setup-form legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
.vac-setup-form input:not([type="checkbox"]):not([type="radio"]),
.vac-setup-form select,
.vac-setup-form textarea { font-size: 16px; min-height: 44px; max-width: 100%; }
.vac-setup-form .btn { min-height: 44px; }
.vac-setup-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.vac-setup-row > label { flex: 1 1 12rem; min-width: 0; display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; font-weight: 600; }

.chk-grid { display: flex; flex-wrap: wrap; gap: .45rem; }
.chk-grid label {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; min-width: 44px; padding: .4rem .7rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); font-size: .95rem; font-weight: 500; cursor: pointer;
}
.chk-grid label:has(input:checked) {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600;
}
.chk-grid input[type="checkbox"], .chk-grid input[type="radio"] {
  width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent);
}
.vac-scope-actions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-top: .5rem; }
.vac-status-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .5rem; margin: .5rem 0; }
.vac-status-item { padding: .55rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0; overflow-wrap: anywhere; }
.vac-pos-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.vac-pos-grid label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; font-weight: 600; min-width: 0; }
.vac-pos-grid input[type="number"] { width: 100%; min-height: 44px; font-size: 16px; }
@media (min-width: 640px) {
  .vac-pos-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
