/* ---------------------------------------------------------------------------
   Design tokens. Light is the default palette; dark is layered on top so a
   kitchen tablet left on auto-brightness stays readable either way.
--------------------------------------------------------------------------- */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e8ebf0;
  --border: #dde1e8;
  --border-strong: #c6ccd8;
  --text: #14181f;
  --text-dim: #5b6472;
  --text-faint: #8b95a5;

  --accent: #2f6df6;
  --accent-soft: #e6eeff;
  --good: #12855b;
  --good-soft: #e2f5ec;
  --warn: #b96a06;
  --warn-soft: #fdf0dd;
  --bad: #c62f42;
  --bad-soft: #fdeaec;
  --info: #6b46d6;

  --c1: #2f6df6; --c2: #12a594; --c3: #d97706; --c4: #8b5cf6;
  --c5: #e11d48; --c6: #0891b2; --c7: #65a30d; --c8: #db2777;

  --radius: 14px;
  --radius-sm: 9px;
  /* Measured from the real header, which grows a second row when the tab
     bar cannot fit. Everything sticky below it hangs off this. */
  --topbar-h: 58px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .18);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --surface: #161b23;
    --surface-2: #1c222c;
    --surface-3: #252c38;
    --border: #29313d;
    --border-strong: #3a4453;
    --text: #e9edf3;
    --text-dim: #9aa5b5;
    --text-faint: #6d7889;

    --accent: #5b8bff;
    --accent-soft: #1a2542;
    --good: #34d399;
    --good-soft: #10291f;
    --warn: #f0a94c;
    --warn-soft: #2e2413;
    --bad: #f87171;
    --bad-soft: #2e1719;
    --info: #a78bfa;

    --c1: #5b8bff; --c2: #2dd4bf; --c3: #fbbf24; --c4: #a78bfa;
    --c5: #fb7185; --c6: #22d3ee; --c7: #a3e635; --c8: #f472b6;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
  }
}

:root[data-theme="dark"] {
  --bg: #0d1117; --surface: #161b23; --surface-2: #1c222c; --surface-3: #252c38;
  --border: #29313d; --border-strong: #3a4453;
  --text: #e9edf3; --text-dim: #9aa5b5; --text-faint: #6d7889;
  --accent: #5b8bff; --accent-soft: #1a2542;
  --good: #34d399; --good-soft: #10291f;
  --warn: #f0a94c; --warn-soft: #2e2413;
  --bad: #f87171; --bad-soft: #2e1719; --info: #a78bfa;
  --c1: #5b8bff; --c2: #2dd4bf; --c3: #fbbf24; --c4: #a78bfa;
  --c5: #fb7185; --c6: #22d3ee; --c7: #a3e635; --c8: #f472b6;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.015em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6rem; }
a { color: var(--accent); }

/* --------------------------------------------------------------- layout -- */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem clamp(.75rem, 3vw, 1.5rem);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; letter-spacing: -.02em; }
.brand-mark { font-size: 1.25rem; }
.brand-sub { color: var(--text-faint); font-weight: 500; font-size: .78rem; display: block; letter-spacing: 0; }
.topbar-spacer { flex: 1; }

/* ----------------------------------------------------------------- bell --
   Quiet by design. A count on the button when something is waiting, nothing
   at all when it is not. */
.bell { position: relative; font-size: 1rem; }
.bell.has-unread { color: var(--accent); }
.bell-badge {
  position: absolute; top: 1px; right: 1px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--bad); color: #fff;
  font-size: .65rem; font-weight: 700; line-height: 16px; text-align: center;
}

.inbox-panel {
  position: absolute; top: calc(var(--topbar-h, 56px) - 4px); right: clamp(.5rem, 3vw, 1.5rem);
  z-index: 60; width: min(360px, calc(100vw - 1.5rem));
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 16px 40px rgb(0 0 0 / .18);
  overflow: hidden;
}
.inbox-head {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .6rem .85rem; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.inbox-list { max-height: min(60dvh, 460px); overflow-y: auto; }
.inbox-item {
  padding: .7rem .85rem; border-bottom: 1px solid var(--border); cursor: pointer;
  border-left: 3px solid transparent;
}
.inbox-item:last-child { border-bottom: 0; }
.inbox-item:hover { background: var(--surface-2); }
.inbox-item.unread { border-left-color: var(--accent); background: var(--accent-soft); }
.inbox-item.unread:hover { background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface)); }
.inbox-title { font-weight: 650; font-size: .88rem; }
.inbox-body {
  color: var(--text-dim); font-size: .8rem; margin-top: .2rem; white-space: pre-line;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.inbox-when { color: var(--text-faint); font-size: .72rem; margin-top: .3rem; }
.inbox-empty { padding: 1.1rem .85rem; text-align: center; }
.inbox-empty p { margin: 0; font-size: .82rem; }

/* ------------------------------------------------------------- side nav --
   Two stores will not fit in one row of tabs, so navigation lives down the
   side where each section can be named. */
.body-row { display: flex; flex: 1; min-height: 0; align-items: flex-start; }

.sidebar {
  position: sticky; top: var(--topbar-h); z-index: 30;
  flex: 0 0 208px; width: 208px;
  max-height: calc(100dvh - var(--topbar-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: .8rem .6rem 1.2rem;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: grid; gap: .15rem; align-content: start;
}

.side-group { display: grid; gap: .1rem; margin-bottom: .5rem; }

.side-head {
  display: flex; align-items: center; justify-content: space-between; gap: .4rem;
  width: 100%; padding: .4rem .55rem; margin-bottom: .1rem;
  background: none; border: 0; border-radius: var(--radius-sm);
  color: var(--text-faint); cursor: pointer;
  font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
}
.side-head:hover { background: var(--surface-2); color: var(--text-dim); }
.side-caret { transition: transform .15s; display: inline-block; transform: rotate(-90deg); }
.side-head.open .side-caret { transform: rotate(0deg); }

.side-items { display: grid; gap: .1rem; }

.side-link {
  display: block; padding: .45rem .65rem;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  font-size: .89rem; font-weight: 550;
  color: var(--text-dim); text-decoration: none;
}
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active {
  background: var(--accent-soft); color: var(--accent);
  border-left-color: var(--accent); font-weight: 650;
}

.nav-toggle { display: none; font-size: 1.1rem; }
.nav-scrim { display: none; }

.main { flex: 1; min-width: 0; max-width: 1320px; margin: 0 auto; padding: clamp(.85rem, 2.5vw, 1.6rem); }

.page-head {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end;
  justify-content: space-between; margin-bottom: 1.1rem;
}
.page-head .sub { color: var(--text-dim); font-size: .9rem; }

/* ---------------------------------------------------------------- cards -- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; margin-bottom: .85rem; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: .5rem; }
.card-note { color: var(--text-faint); font-size: .8rem; font-weight: 450; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* ---------------------------------------------------------------- stats -- */
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .85rem .95rem;
}
.stat-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); font-weight: 650; }
.stat-value { font-size: 1.7rem; font-weight: 680; letter-spacing: -.03em; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: .95rem; font-weight: 550; color: var(--text-dim); margin-left: .15rem; }
.stat-sub { font-size: .8rem; color: var(--text-dim); margin-top: .2rem; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.stat-spark { margin-top: .45rem; }

.delta { font-weight: 640; font-variant-numeric: tabular-nums; font-size: .8rem; }
.delta.up { color: var(--bad); }
.delta.down { color: var(--good); }
.delta.flat { color: var(--text-faint); }
.delta.good-up { color: var(--good); }
.delta.bad-down { color: var(--bad); }

/* ---------------------------------------------------------------- pills -- */
.pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .15rem .5rem; border-radius: 999px;
  font-size: .74rem; font-weight: 620; letter-spacing: .01em;
  background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border);
}
.pill.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad  { background: var(--bad-soft);  color: var(--bad);  border-color: transparent; }
.pill.info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* --------------------------------------------------------------- alerts -- */
.alert {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .7rem .85rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  margin-bottom: .5rem;
}
.alert-icon { font-size: 1rem; line-height: 1.35; }
.alert-title { font-weight: 640; font-size: .92rem; }
.alert-detail { font-size: .84rem; color: var(--text-dim); }
.alert.high { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }

/* --------------------------------------------------------------- tables -- */
.table-wrap { overflow-x: auto; margin: 0 -1.1rem -1rem; padding: 0 1.1rem 1rem; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: .5rem .6rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); font-weight: 650; position: sticky; top: 0;
  background: var(--surface); z-index: 1;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
td .muted { color: var(--text-faint); }
.row-flag-high td:first-child { box-shadow: inset 3px 0 var(--bad); }
.row-flag-low td:first-child { box-shadow: inset 3px 0 var(--accent); }

/* A banded heading inside the table body, for lists grouped by category. */
tbody tr.row-group td, tbody tr.row-group:hover td {
  background: var(--surface-2);
  padding-top: .55rem; padding-bottom: .45rem;
}
.row-group-name {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 700; color: var(--text);
}
.row-group-meta { font-size: .75rem; color: var(--text-faint); margin-left: .6rem; }

/* ------------------------------------------------------------- controls -- */
button, .btn {
  font: inherit; font-weight: 600; font-size: .88rem;
  padding: .5rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
}
button:hover, .btn:hover { background: var(--surface-2); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); background: transparent; }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

input, select, textarea {
  font: inherit; font-size: .92rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: .5rem .65rem; width: 100%;
}
/* Placeholders carry the suggested quantity on the entry screen. They must
   never be mistakable for a value that has actually been keyed in. */
input::placeholder {
  color: var(--text-faint);
  font-weight: 400;
  font-style: italic;
  opacity: .75;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 1px; border-color: var(--accent);
}
label.field { display: block; margin-bottom: .7rem; }
label.field > span { display: block; font-size: .78rem; font-weight: 620; color: var(--text-dim); margin-bottom: .25rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px; }
.seg button { border: none; background: transparent; border-radius: 999px; padding: .32rem .8rem; font-size: .82rem; color: var(--text-dim); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Many categories will not fit on one line of a phone, so this variant wraps. */
.seg.seg-wrap { flex-wrap: wrap; max-width: 100%; }
.seg-count {
  margin-left: .35rem; font-size: .72rem; font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
.seg button.active .seg-count { color: var(--text-dim); }

.filter-bar { justify-content: space-between; }
.inline-check {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .82rem; color: var(--text-dim); white-space: nowrap;
}
.inline-check input { width: auto; margin: 0; }

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.toolbar input[type="date"], .toolbar input[type="month"], .toolbar select { width: auto; min-width: 150px; }

/* --------------------------------------------------------------- login --- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.pin-display {
  font-family: var(--mono); font-size: 1.8rem; letter-spacing: .5rem;
  height: 3rem; display: grid; place-items: center; margin: .5rem 0 1rem;
  color: var(--text);
}
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.keypad button { height: 58px; font-size: 1.3rem; font-weight: 600; }

/* -------------------------------------------------------------- toasts --- */
.toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: .4rem; width: min(420px, calc(100vw - 2rem)); }
/* Lift toasts clear of the entry screen's fixed action bar. */
.toast {
  padding: .6rem .85rem; border-radius: var(--radius-sm); font-size: .88rem; font-weight: 550;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  animation: toast-in .18s ease;
}
.toast.good { border-color: color-mix(in srgb, var(--good) 45%, transparent); color: var(--good); }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- misc --- */
.boot { min-height: 100dvh; display: grid; place-content: center; text-align: center; color: var(--text-dim); gap: .5rem; }
/* Set here rather than in the markup, so the housekeeping site never flashes
   the breakfast icon on the way in. */
.boot-mark { font-size: 2.5rem; }
/* In CSS rather than the markup, so the mark is painted with the first frame
   instead of waiting for a module to load. */
.boot-mark::after { content: '🕘'; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--text-faint); }
.empty h3 { color: var(--text-dim); margin-bottom: .35rem; }
.muted { color: var(--text-faint); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius-sm); height: 1rem; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* On a phone the sidebar becomes a drawer. Nineteen links down the side would
   otherwise leave no room for the page they lead to. */
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; top: var(--topbar-h); bottom: 0; left: 0;
    width: 250px; flex-basis: 250px; max-height: none;
    transform: translateX(-100%); transition: transform .18s ease;
    box-shadow: var(--shadow); z-index: 45;
  }
  .shell.nav-open .sidebar { transform: translateX(0); }
  .shell.nav-open .nav-scrim {
    display: block; position: fixed; inset: var(--topbar-h) 0 0 0;
    background: rgba(8, 12, 20, .4); z-index: 40;
  }
}

@media (max-width: 720px) {
  .stat-value { font-size: 1.45rem; }
  /* The guest counts scroll away with everything else on a phone. Pinned, they
     ate a third of the screen under an already-tall header, leaving barely
     enough room for the item list they are supposed to sit above. */
}

/* The header at phone width.
   The property name, who is signed in, and four buttons will not fit across
   390px: the name wrapped to three lines and "Sign out" fell off the edge. The
   name is the thing that can go — anyone holding the phone knows which hotel
   they work at, and the buttons are the part that has to stay reachable. */
@media (max-width: 560px) {
  .topbar { gap: .35rem; padding-inline: .5rem; }
  .brand { font-size: .92rem; min-width: 0; }
  .brand > div {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34vw;
  }
  .brand-sub { display: none; }
  .topbar .btn-sm { padding-inline: .5rem; }
}



/* An everyday item still missing a figure when a submission was attempted. */
.item.needed {
  border-color: var(--bad);
  background: color-mix(in srgb, var(--bad-soft) 60%, var(--surface));
}
.item.needed .item-name::after {
  content: 'needs a figure';
  display: inline-block;
  margin-left: .4rem;
  padding: .05rem .4rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bad) 16%, transparent);
  color: var(--bad);
  font-weight: 650;
  font-size: .72rem;
  white-space: nowrap;
  vertical-align: middle;
}

/* A problem with what was typed, shown beside the fields that caused it.
   Modal dialogs sit above every toast, so form errors must live in the form. */
.form-error {
  margin: .6rem 0 0;
  padding: .6rem .75rem;
  border-radius: var(--radius-sm);
  background: var(--bad-soft);
  border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
  color: var(--bad);
  font-size: .86rem;
  font-weight: 550;
  line-height: 1.45;
}

/* The toast host is a popover so it shares the top layer with modal dialogs
   and can never be painted behind one. Strip the browser's default chrome. */
.toasts[popover] {
  inset: auto;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  overflow: visible;
}
.toasts[popover]:not(:popover-open) { display: none; }
.toasts[popover]:popover-open { display: grid; }

/* --------------------------------------------------------------- printing --
   Reports are saved as PDF through the browser's own print dialog. The charts
   are SVG, so they come out as vector rather than a screenshot. Everything
   below is about removing the furniture and making dark mode print sensibly. */

.print-header, .print-footer { display: none; }

@media print {
  /* Force the light palette: printing a dark theme wastes ink and reads badly.
     Both explicit-theme selectors are listed so a chosen theme cannot win. */
  :root,
  :root[data-theme="dark"],
  :root[data-theme="light"] {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f4f6f8;
    --surface-3: #e9edf1;
    --border: #d4dae1;
    --border-strong: #b3bcc7;
    --text: #101418;
    --text-dim: #4a535e;
    --text-faint: #6f7884;
    --accent: #1f5fd0;
    --accent-soft: #e8f0fd;
    --good: #0f7048;  --good-soft: #e6f4ed;
    --warn: #9a5800;  --warn-soft: #fbf0de;
    --bad:  #b02436;  --bad-soft:  #fbe9eb;
    --c1: #1f5fd0; --c2: #0d8f80; --c3: #b96604; --c4: #6d43c4;
    --c5: #c01f42; --c6: #0a7591; --c7: #4f8209; --c8: #b32270;
    --shadow: none;
  }

  html, body {
    background: #fff;
    font-size: 11pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  @page { margin: 14mm 12mm; }

  /* Furniture nobody wants on paper. */
  .topbar, .sidebar, .nav-scrim, .toolbar, .toasts,
  button, .btn, dialog { display: none !important; }

  .main { max-width: none; padding: 0; margin: 0; }
  .page-head { margin-bottom: .5rem; }
  .page-head .btn-row, .page-head .seg { display: none !important; }

  .print-header { display: block; margin-bottom: 10mm; }
  .print-brand {
    display: flex; align-items: center; gap: .4rem;
    font-size: 10pt; color: #4a535e; margin-bottom: 2mm;
  }
  .print-title { font-size: 20pt; margin: 0; letter-spacing: -.02em; }
  .print-subtitle { font-size: 11pt; color: #4a535e; margin-top: 1mm; }
  .print-note { font-size: 9.5pt; color: #4a535e; margin-top: 2mm; font-style: italic; }
  .print-meta {
    font-size: 9pt; color: #6f7884; margin-top: 3mm;
    padding-top: 2mm; border-top: 1px solid #d4dae1;
  }

  .print-footer {
    display: block; margin-top: 8mm; padding-top: 3mm;
    border-top: 1px solid #d4dae1;
    font-size: 8.5pt; color: #6f7884; line-height: 1.5;
  }

  /* Keep a card, a chart or a table row from being split across pages. */
  .card {
    break-inside: avoid; page-break-inside: avoid;
    box-shadow: none; border: 1px solid #d4dae1;
    margin-bottom: 5mm; padding: 4mm 5mm;
  }
  .stat, .alert, tr { break-inside: avoid; page-break-inside: avoid; }
  h1, h2, h3 { break-after: avoid; page-break-after: avoid; }

  /* Grids collapse to something a page can hold. */
  .grid-4 { grid-template-columns: repeat(4, 1fr); gap: 3mm; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); gap: 3mm; }
  .grid-2 { grid-template-columns: repeat(2, 1fr); gap: 3mm; }

  .stat { border: 1px solid #d4dae1; padding: 2.5mm 3mm; }
  .stat-value { font-size: 14pt; }
  .stat-label { font-size: 7.5pt; }
  .stat-sub { font-size: 8pt; }

  table { font-size: 8.5pt; }
  th, td { padding: 1.4mm 2mm; }
  thead { display: table-header-group; }   /* repeat headers across pages */
  .table-wrap { overflow: visible; margin: 0; padding: 0; }

  /* Charts must not be clipped by their scroll container. */

  a { color: inherit; text-decoration: none; }
}

/* Plain-language explanations of each report panel. */
/* ---- the bell ---------------------------------------------------------- */
/* Submitted checks land here as well as in an inbox, so somebody who lives in
   the app never has to open email to find out a round came in — and so a mail
   failure has somewhere to say so. */

.bell-wrap { position: relative; }
.bell { position: relative; font-size: 1rem; }
.bell.has-unread { color: var(--text); }
.bell-count {
  display: none; position: absolute; top: -2px; right: -2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--bad); color: #fff;
  font-size: .65rem; font-weight: 700; line-height: 16px; text-align: center;
}
.bell-count.on { display: block; }

.bell-panel {
  display: none; position: absolute; right: 0; top: calc(100% + .5rem); z-index: 60;
  width: min(360px, calc(100vw - 1.5rem));
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.bell-panel.open { display: block; }
.bell-head {
  padding: .6rem .8rem; border-bottom: 1px solid var(--border);
  font-size: .85rem; background: var(--surface-2);
}
.bell-list { max-height: min(60vh, 460px); overflow-y: auto; overscroll-behavior: contain; padding: .3rem; }

.bell-item {
  display: flex; gap: .55rem; align-items: flex-start;
  padding: .55rem .6rem; border-radius: var(--radius-sm);
  text-decoration: none; color: inherit;
  border-left: 3px solid transparent;
}
.bell-item:hover { background: var(--surface-2); }
.bell-item.unread { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.bell-item.level-high { border-left-color: var(--bad); }
.bell-item.level-warn { border-left-color: var(--warn); }
.bell-icon { font-size: .95rem; line-height: 1.35; }
.bell-text { min-width: 0; }
.bell-title { font-size: .88rem; font-weight: 640; line-height: 1.3; }
.bell-body { font-size: .8rem; color: var(--text-dim); line-height: 1.35; margin-top: .1rem; }
.bell-when { font-size: .72rem; color: var(--text-faint); margin-top: .15rem; }

@media print { .bell-wrap { display: none; } }

/* The erase panel's count of what a chosen period holds. Sits between the
   dates and the button on purpose: it is the last thing read before the one
   action in this system that cannot be undone. */
.erase-preview { margin: .9rem 0 0; }
.erase-preview .alert { margin-bottom: 0; }

/* -------------------------------------------------------------- attendance --
   Two ideas carry the whole section: four status colours used identically
   everywhere, and a week grid dense enough to read a fortnight of a hotel's
   staff without scrolling sideways. */

/* The tint on a row of the day list. Kept to a left edge and a wash rather than
   a full-strength background — a page where every other row shouts is a page
   nobody scans. */
.row-att-red td:first-child   { box-shadow: inset 3px 0 var(--bad); }
.row-att-amber td:first-child { box-shadow: inset 3px 0 var(--warn); }
.row-att-green td:first-child { box-shadow: inset 3px 0 var(--good); }
.row-att-red    { background: color-mix(in srgb, var(--bad-soft) 45%, transparent); }
.row-att-amber  { background: color-mix(in srgb, var(--warn-soft) 40%, transparent); }
.row-muted td   { opacity: .62; }

/* One cell of the week grid: a mark, and the hours under it. Square-ish so
   seven of them plus a name fit across a laptop. */
.att-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 2.6rem; min-height: 2.4rem; gap: .05rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.att-cell:hover { border-color: var(--accent); }
.att-cell-mark  { font-size: .9rem; font-weight: 700; line-height: 1; }
.att-cell-hours { font-size: .68rem; color: var(--text-faint); line-height: 1; }

.att-cell.att-green { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.att-cell.att-amber { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.att-cell.att-red   { background: var(--bad-soft);  color: var(--bad);  border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.att-cell.att-grey  { background: var(--surface-2); color: var(--text-faint); }

.att-legend {
  display: flex; flex-wrap: wrap; gap: .8rem; align-items: center;
  margin-top: .6rem; font-size: .8rem; color: var(--text-dim);
}
.att-legend-item { display: inline-flex; align-items: center; gap: .35rem; }
.att-legend-item .att-cell { min-width: 1.7rem; min-height: 1.7rem; }
.att-legend-item .att-cell-mark { font-size: .72rem; }

/* The rota grid. A cell following the standing pattern is deliberately faint,
   and one set by hand is not — "I gave him Thursday off" and "the pattern never
   had him on Thursday" must not look the same. */
.rota-table td { padding: .3rem; }
.rota-cell {
  min-width: 5.5rem; padding: .3rem .4rem; font-size: .8rem;
  border-radius: var(--radius-sm);
}
.rota-cell.rota-pattern { color: var(--text-faint); background: var(--surface-2); border-style: dashed; }
.rota-cell.rota-set     { color: var(--text); font-weight: 600; }
.rota-cell.rota-dirty   { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.rota-weekend { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.rota-locked {
  padding: .35rem .4rem; font-size: .78rem; text-align: center;
  color: var(--text-faint); background: var(--surface-2); border-radius: var(--radius-sm);
}

/* The unsaved-changes bar sticks to the top of the rota, because filling in a
   fortnight scrolls it a long way from any button at the bottom. */
.rota-savebar {
  position: sticky; top: 0; z-index: 5;
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: var(--radius-sm); padding: .5rem .7rem;
}

.att-rules .card { margin-bottom: 0; }

@media print {
  .att-cell { border: 1px solid #d4dae1; }
  .att-legend, .rota-savebar { display: none; }
}

/* The rota's totals. A shift with nobody on it is the one thing on this page
   worth shouting about, so it is the only thing that changes colour. */
.rota-total td {
  border-top: 1px solid var(--border);
  padding: .3rem .4rem;
  font-variant-numeric: tabular-nums;
  font-size: .8rem;
  color: var(--text-dim);
  text-align: center;
}
.rota-total td:first-child, .rota-total td:nth-child(2) { text-align: left; }
.rota-gap { color: var(--bad); font-weight: 700; }
