/* Pulse design system — Phase 0 tokens and components (tech doc 7.11).
   Layer 1: core tokens; layer 2: semantic tokens; layer 3: brand overrides set per property (--brand-*). */
:root {
  --brand-primary: #0f5e6e;
  --brand-accent: #c8872b;
  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;

  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --ink: #1b2430;
  --muted: #5b6675;
  --line: #d9dee5;
  --focus: #2563eb;

  --ok: #1d7a46;       --ok-bg: #e5f4ea;
  --info: #1f5fae;     --info-bg: #e6eefa;
  --warn: #9a6200;     --warn-bg: #fdf1dc;
  --danger: #b3261e;   --danger-bg: #fbe7e6;
  --neutral: #4b5563;  --neutral-bg: #eceff3;

  /* The second colour in every icon. Teal reads as "live" against both the navy ink of a card and the
     white of the sidebar, and it stays put when a property overrides --brand-primary. */
  --icon-accent: #2bb3a3;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .10);
  --space: 16px;
  /* Report charts: categorical slots in fixed order (validated palette), light surface. */
  --chart-1: #2a78d6; --chart-2: #eb6834; --chart-3: #1baf7a; --chart-grid: #e3e7ec;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --surface: #161c23;
    --surface-2: #1d252e;
    --ink: #e6e9ee;
    --muted: #9aa5b3;
    --line: #2a333e;
    --ok-bg: #0f2a1b; --info-bg: #0f2036; --warn-bg: #2b1f07; --danger-bg: #331412; --neutral-bg: #232a33;
    --ok: #5fcf8f; --info: #7cb0f5; --warn: #f0b457; --danger: #f28b82; --neutral: #b7c0cc;
    --icon-accent: #3ccfbc;  /* lifted, so the accent keeps its contrast on a dark surface */
    --chart-1: #3987e5; --chart-2: #d95926; --chart-3: #199e70; --chart-grid: #2a333e;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font-sans); font-size: 14px; line-height: 1.45; background: var(--bg); color: var(--ink); }
a { color: var(--brand-primary); }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 17px; margin: 0 0 8px; font-weight: 600; }
h3 { font-size: 15px; margin: 0 0 6px; font-weight: 600; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

/* Shell */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--brand-primary); color: #fff; padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; padding: 4px 8px 16px; }
.brand-center { justify-content: center; color: var(--brand-primary); }
/* The Pulse HMS mark (concept 4, "Operational Flow") on a white tile, so it reads on the brand-coloured sidebar and on white. */
.brand-mark { width: 34px; height: 34px; flex: none; border-radius: 9px; background: #fff; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(16, 24, 40, .18); }
.brand-mark img { width: 28px; height: 28px; display: block; }
.brand-center .brand-mark { width: 44px; height: 44px; border-radius: 11px; }
.brand-center .brand-mark img { width: 36px; height: 36px; }
.brand-name { font-weight: 600; font-size: 16px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; padding: 8px 10px; border-radius: var(--radius-sm); opacity: .9; }
.nav-item:hover { background: rgba(255, 255, 255, .10); opacity: 1; }
.nav-item.active { background: rgba(255, 255, 255, .18); opacity: 1; font-weight: 600; }
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; display: grid; place-items: center; }
.sidebar :focus-visible { outline-color: #fff; }

/* Sidebar categories (NavMenu.razor). One heading per NavItem.Group; clicking it (or Enter / Space) opens its pages directly underneath,
   inside the sidebar: an accordion, several categories may be open at once. Nothing in the sidebar is ever positioned over the page. */
.nav-filter { position: relative; margin: 0 0 8px; }
.nav-filter-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); display: grid; opacity: .75; pointer-events: none; }
.nav-filter-input { width: 100%; font: inherit; color: #fff; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22);
  border-radius: var(--radius-sm); padding: 7px 10px 7px 32px; }
.nav-filter-input::placeholder { color: rgba(255, 255, 255, .7); }
.nav-filter-input:focus { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .5); }
.nav-filter-input::-webkit-search-cancel-button { filter: invert(1); }
.nav-home { margin-bottom: 4px; }
.nav-cat { position: relative; }
.nav-cat-head { display: flex; gap: 10px; align-items: center; width: 100%; font: inherit; color: #fff; background: none; border: 0;
  text-align: left; cursor: pointer; padding: 8px 10px; border-radius: var(--radius-sm); opacity: .9; }
.nav-cat-head:hover { background: rgba(255, 255, 255, .10); opacity: 1; }
.nav-cat.is-open > .nav-cat-head { opacity: 1; font-weight: 600; }
.nav-cat.has-active:not(.is-open) > .nav-cat-head { background: rgba(255, 255, 255, .14); opacity: 1; font-weight: 600; }
.nav-cat-name { flex: 1; min-width: 0; }
.nav-count { font-size: 11px; line-height: 1; padding: 3px 6px; border-radius: 999px; background: rgba(255, 255, 255, .14); font-variant-numeric: tabular-nums; }
.nav-chevron { width: 7px; height: 7px; margin: 0 2px 0 4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s ease; opacity: .8; }
.nav-cat.is-open .nav-chevron { transform: rotate(-135deg) translate(-1px, -1px); }
.nav-links, .nav-links[hidden] { display: none; }
.nav-cat.is-open > .nav-links { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 18px; padding-left: 8px; border-left: 1px solid rgba(255, 255, 255, .22); }
.nav-empty { font-size: 13px; opacity: .8; margin: 8px 10px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 56px; }
.topbar-property { display: flex; align-items: baseline; gap: 8px; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
/* Business-date banner (every staff page): System, Working and Last audited dates; amber = audit due or date ahead, red = missed or inconsistent. */
.bizdate { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 22px; padding: 7px 24px; background: var(--neutral-bg); color: var(--ink);
  border-bottom: 1px solid var(--line); font-size: 13px; }
.bizdate-item { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.bizdate-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.bizdate strong { font-size: 15px; font-weight: 700; }
.bizdate-working strong { color: var(--brand-primary); }
.bizdate-state { margin-left: auto; font-weight: 600; }
.bizdate-more { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid currentColor; text-decoration: none;
  font-weight: 700; font-size: 12px; color: inherit; }
.bizdate-amber { background: var(--warn-bg); color: var(--warn); border-bottom-color: var(--warn); }
.bizdate-red { background: var(--danger-bg); color: var(--danger); border-bottom-color: var(--danger); }
.bizdate-amber .bizdate-label, .bizdate-red .bizdate-label, .bizdate-amber .bizdate-working strong, .bizdate-red .bizdate-working strong { color: inherit; }
.bd-short { display: none; }
@media screen and (max-width: 768px) {
  .bizdate { padding: 6px 12px; gap: 4px 12px; font-size: 12px; }
  .bizdate strong { font-size: 13px; }
  .bd-long { display: none; }
  .bd-short { display: inline; }
  .bizdate-state { flex: 1 1 auto; margin-left: 0; font-size: 12px; }
}
@media print { .bizdate { display: none !important; } }
/* The page uses every pixel beside the sidebar at every width: no max-width, no dead band on the right (layout decision, batch 5).
   min-width: 0 lets wide tables scroll inside their own .table-wrap instead of widening the page. Long prose keeps a readable measure
   through .measure, never through the container. */
.content { padding: 24px; width: 100%; min-width: 0; }
.measure { max-width: 80ch; }
@media (min-width: 1920px) { .content { padding: 28px 32px; } }
.banner { padding: 8px 24px; font-size: 13px; }
.banner-warn { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--line); }
/* Licence (M02): Pulse is stopped — only the licence page works until a valid licence is installed. */
.banner-danger { background: var(--danger-bg); color: var(--danger); border-bottom: 1px solid var(--danger); }
.licence-lock { max-width: 720px; margin: 48px auto; text-align: center; }

/* Account pages */
.account-shell { min-height: 100vh; display: grid; place-content: center; gap: 12px; padding: 16px; }
.account-card { width: min(420px, 92vw); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 28px; }

/* Page structure */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 8px 14px; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; min-height: 36px; }
.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: inherit; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link { color: var(--brand-primary); text-decoration: underline; }

/* Forms */
.form { display: grid; gap: 12px; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; min-height: 36px; width: 100%; }
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.validation-message { color: var(--danger); font-size: 12px; }
.checkbox { display: flex; gap: 8px; align-items: center; }

/* Tables. A wide table scrolls sideways inside its own box, never the page: in a .table-wrap, or (for the many tables placed straight in a
   card, a section or a grid cell) in whatever element holds it directly. Grid and flex children may shrink below their content's width
   (min-width: 0), so one wide table cannot push a whole column, and with it the page, past the screen. */
/* position: relative keeps absolutely positioned bits inside (a screen-reader-only label in a cell) within the scrolling box. */
.content:has(> table), .content :has(> table) { overflow-x: auto; position: relative; }
.grid > *, .row > *, .form-grid > *, .page-header > *, .rc-filters > * { min-width: 0; }
.table-wrap { overflow-x: auto; position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table a { text-decoration: none; font-weight: 500; }

/* Feedback */
.badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-success { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.alert { border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px; }
.alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--ok-bg); color: var(--ok); }
.alert-info { background: var(--info-bg); color: var(--info); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.empty { text-align: center; padding: 32px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow);
  min-width: 0; }
.grid-kpi > .kpi, .kpis > .kpi { container-type: inline-size; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; }
/* A figure shrinks with its tile (a ₦ amount in a narrow tile), and wraps only as a last resort, never past the tile's edge. */
.kpi-value { font-size: clamp(17px, 15cqi, 26px); font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.kpi-hint { font-size: 12px; color: var(--muted); }
.kpi-danger .kpi-value { color: var(--danger); }
.kpi-warn .kpi-value { color: var(--warn); }
.kpi-success .kpi-value { color: var(--ok); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-primary); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 20, 25, .45); z-index: 40; }
.modal { position: fixed; z-index: 41; top: 6vh; left: 50%; transform: translateX(-50%); width: min(720px, 94vw); max-height: 88vh; overflow: auto; background: var(--surface); border-radius: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 18px; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 10px 20px; background: var(--warn-bg); color: var(--warn); z-index: 100; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* Room rack (M05): fixed semantic colours, never branded, so status reads the same in every hotel. */
.rack { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.rack-tile { border: 1px solid var(--line); border-left-width: 6px; border-radius: 10px; padding: 10px; background: var(--surface); min-height: 92px; }
.rack-number { font-weight: 600; font-variant-numeric: tabular-nums; }
.rack-success { border-left-color: var(--ok); }
.rack-info { border-left-color: var(--info); }
.rack-warn { border-left-color: var(--warn); }
.rack-danger { border-left-color: var(--danger); }
.rack-neutral { border-left-color: var(--line); }
.rack-tile .btn { margin-top: 6px; }

/* Icons. The sprite is inlined once by the layout; every glyph inherits currentColor, so an icon needs no
   colour of its own in the sidebar, on a card, or in dark mode. */
.icon-sprite { display: none; }
.icon { display: inline-block; vertical-align: -0.15em; flex: none; }
.icon-brand { color: var(--brand-primary); }
.icon-success { color: var(--ok); }
.icon-warn { color: var(--warn); }
.icon-danger { color: var(--danger); }
.icon-muted { color: var(--muted); }

/* The rounded-tile treatment from the icon set, for module cards and dashboard headers where there is room
   for it. Not used in the sidebar: a grid of white cards down a coloured slab is far too heavy. */
.icon-tile { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); color: var(--ink);
  display: grid; place-items: center; flex: none; box-shadow: var(--shadow); }
.icon-tile-lg { width: 56px; height: 56px; border-radius: 14px; }
.icon-tile-brand { background: var(--brand-primary); color: #fff; }

/* Roster week (M19): seven day columns that fall back to a single column on a phone. */
.roster { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 8px; overflow-x: auto; }
.roster-day { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 8px; min-height: 140px; }
.roster-day > header { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; margin-bottom: 6px; }
.roster-shift { border: 1px solid var(--line); border-left: 4px solid var(--info); border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; font-size: 13px; }
.roster-shift.is-open { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 7%, transparent); }
.roster-shift.is-breach { border-left-color: var(--danger); }
.roster-shift.is-done { opacity: .65; }
.roster-shift .who { font-weight: 600; }
.roster-cover { font-variant-numeric: tabular-nums; }
.roster-cover.short { color: var(--danger); font-weight: 700; }

/* Role workflow (home page and module dashboards): a role's steps as cards joined by arrows, in the order the job is done;
   a vertical timeline on a phone. Status colours are the semantic tokens, so dark mode needs nothing extra. */
.wf { margin-bottom: 20px; }
.wf-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.wf-head h2 { margin: 0; }
.wf-meta { display: flex; align-items: center; gap: 8px; }
.wf-flow { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 12px; }
.wf-flow > summary { cursor: pointer; }
.wf-flow > summary, .wf-flow-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wf-flow > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.wf-flow[open] > summary::before { transform: rotate(90deg); }
.wf-flow > summary::-webkit-details-marker { display: none; }
.wf-flow > summary h3, .wf-flow-head h3 { margin: 0; }
.wf-summary { flex-basis: 100%; }
.wf-steps { list-style: none; margin: 12px 0 0; padding: 0 0 4px; display: flex; align-items: stretch; overflow-x: auto; }
.wf-step { display: flex; align-items: center; flex: 1 1 0; min-width: 128px; }
.wf-card { display: flex; flex-direction: column; gap: 6px; flex: 1; align-self: stretch; min-height: 150px; padding: 12px;
  border: 1px solid var(--line); border-top: 4px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
  color: var(--ink); text-decoration: none; }
.wf-card:hover { border-color: var(--brand-primary); }
.wf-top { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.wf-num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.wf-count { margin-left: auto; font-size: 26px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.wf-title { font-weight: 600; }
.wf-state { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.wf-help { font-size: 12px; color: var(--muted); }
.wf-next-pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; background: var(--brand-primary); color: #fff; }
.wf-arrow { flex: 0 0 16px; align-self: center; height: 2px; background: var(--muted); position: relative; margin: 0 4px 0 2px; opacity: .6; }
.wf-arrow::after { content: ""; position: absolute; right: -6px; top: -4px; border: 5px solid transparent; border-left-color: var(--muted); border-right: 0; }
.wf-s-clear .wf-card { border-top-color: var(--ok); }
.wf-s-clear .wf-count { color: var(--muted); }
.wf-s-todo .wf-card { border-top-color: var(--warn); background: var(--surface); }
.wf-s-attention .wf-card { border-top-color: var(--danger); background: var(--surface); }
.wf-s-attention .wf-count { color: var(--danger); }
.wf-s-tracking .wf-card { border-top-color: var(--info); }
.wf-s-unavailable .wf-count { color: var(--muted); }
.wf-next .wf-card { border-color: var(--brand-primary); box-shadow: 0 0 0 2px var(--brand-primary); }

@media (max-width: 700px) {
  .wf-steps { flex-direction: column; overflow-x: visible; padding: 0 0 0 16px; border-left: 2px solid var(--line); margin-left: 8px; }
  .wf-step { flex-direction: column; align-items: stretch; min-width: 0; position: relative; }
  .wf-step + .wf-step { margin-top: 12px; }
  .wf-step::before { content: ""; position: absolute; left: -24px; top: 16px; width: 14px; height: 14px; border-radius: 50%; background: var(--line);
    border: 2px solid var(--surface); }
  .wf-s-clear::before { background: var(--ok); }
  .wf-s-todo::before { background: var(--warn); }
  .wf-s-attention::before { background: var(--danger); }
  .wf-s-tracking::before { background: var(--info); }
  .wf-next::before { background: var(--brand-primary); }
  .wf-card { min-height: 0; }
  .wf-arrow { display: none; }
}

/* Touch targets on tablets (XR-24) */
@media (pointer: coarse) {
  .btn, .input, .nav-item, .nav-cat-head { min-height: 48px; }
}

@media (max-width: 1100px) {
  .shell { grid-template-columns: 208px minmax(0, 1fr); }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
}

/* Phone: the sidebar becomes a slide-out drawer over the page (MainLayout.razor, nav.js). Closed, it is off screen and hidden from keyboard and
   screen readers (visibility); open, a backdrop covers the page, which stops scrolling. */
.nav-toggle, .nav-close, .nav-backdrop { display: none; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
@media (max-width: 768px) {
  .shell { display: block; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: min(86vw, 320px); height: 100vh; height: 100dvh;
    transform: translateX(-100%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; box-shadow: none; }
  html.nav-open .sidebar { transform: none; visibility: visible; transition: transform .22s ease; box-shadow: 0 0 32px rgba(16, 24, 40, .35); }
  html.nav-open { overflow: hidden; }
  html.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(16, 24, 40, .45); }
  .nav-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 12px 6px 10px; font: inherit; font-weight: 600;
    color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
  .nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative; }
  .nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
  .nav-toggle-bars::before { top: -6px; }
  .nav-toggle-bars::after { top: 6px; }
  .nav-close { display: grid; place-items: center; width: 44px; height: 44px; flex: none; font-size: 26px; line-height: 1; color: #fff; background: rgba(255, 255, 255, .12);
    border: 0; border-radius: var(--radius-sm); cursor: pointer; }
  .topbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px 12px; }
}
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .sidebar, html.nav-open .sidebar { transition: none; }
}

@media print {
  .nav-toggle, .nav-backdrop, .nav-close { display: none !important; }
  .sidebar, .topbar, .page-actions, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* ---------- Notification bell (user-addressed in-app alerts) and approval progress ---------- */
.bell { position: relative; }
.bell-button { position: relative; background: none; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 6px; cursor: pointer; color: var(--ink); min-height: 36px; }
.bell-button:hover { background: var(--surface-2); }
.bell-count { position: absolute; top: 0; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.bell-panel { position: absolute; right: 0; top: 44px; width: min(380px, 92vw); max-height: 70vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16, 24, 40, .18); z-index: 50; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.bell-item { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 14px; }
.bell-item:hover { background: var(--surface-2); }
.bell-item.unread { border-left: 3px solid var(--brand-accent); font-weight: 500; }
.approval-steps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.approval-step { padding: 2px 8px; border-radius: 10px; font-size: 12px; background: var(--neutral-bg, var(--surface-2)); color: var(--muted); }
.approval-step.done { background: var(--ok-bg); color: var(--ok); }
.approval-step.now { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.approval-step.rejected { background: var(--danger-bg); color: var(--danger); }

/* Report Centre (/reports): catalogue, standard filter bar, viewer and charts. */
.rc-search { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.rc-search .input { flex: 1 1 220px; }
.rc-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.rc-dept { margin: 18px 0 8px; }
.rc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.rc-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.rc-card h3 { margin: 0; font-size: 14px; }
.rc-card h3 a { text-decoration: none; }
.rc-card p { margin: 0; font-size: 13px; }
.rc-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.rc-star { background: none; border: 0; cursor: pointer; font-size: 18px; line-height: 1; color: var(--muted); padding: 0 2px; }
.rc-star.on { color: var(--warn); }
.rc-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.rc-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.rc-field { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.rc-field > label, .rc-field > summary { font-size: 12px; color: var(--muted); }
.rc-grow { flex: 1 1 200px; }
.rc-actions { flex-direction: row; gap: 6px; min-width: 0; }
.rc-range { flex-basis: 100%; margin: 0; }
.rc-multi { position: relative; }
.rc-multi > summary { cursor: pointer; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--surface); color: var(--ink); list-style: none; }
.rc-multi[open] > .rc-options { position: absolute; z-index: 20; top: 100%; left: 0; min-width: 220px; max-height: 260px; overflow: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.rc-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.rc-inline { display: inline-block; width: auto; margin-left: 6px; padding: 4px 8px; }
.rc-table-wrap { max-height: 70vh; overflow: auto; }
.rc-table th { z-index: 1; }
.rc-table td.num, .rc-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rc-table .neg { color: var(--danger); }
.rc-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.rc-table tr.rc-group th { position: static; background: var(--surface); color: var(--ink); text-transform: none; font-size: 13px; }
.rc-table tr.rc-subtotal td { font-weight: 600; background: var(--surface-2); }
.rc-table tfoot th, .rc-table tfoot td { position: sticky; bottom: 0; background: var(--surface-2); color: var(--ink); font-size: 13px; text-transform: none; letter-spacing: 0; }
.rc-table tr.rc-compare td { background: var(--neutral-bg); font-size: 12px; }
.rc-pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 10px 0; }
.rc-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; margin-bottom: 10px; }
.rc-chart { margin: 0; padding: 10px; }
.rc-chart svg { width: 100%; height: 200px; display: block; }
.rc-grid { stroke: var(--chart-grid); stroke-width: 1; }
.rc-axis { fill: var(--muted); font-size: 10px; }
.rc-line { fill: none; stroke-width: 2; }
.rc-dot { stroke: var(--surface); stroke-width: 2; }
.rc-legend { display: flex; gap: 12px; flex-wrap: wrap; margin: 4px 0; }
.rc-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }
.rc-exports { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .rc-field { min-width: 0; flex: 1 1 45%; }
  .rc-actions { flex-basis: 100%; }
  .rc-table-wrap { max-height: none; }
}

/* Report catalogue as tiles or a list (ReportCatalogueView), the Tiles / List switch and the module reports section (ModuleReports). */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.rc-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.rc-bar .rc-tabs { margin-bottom: 0; }
.rc-view { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.rc-view-toggle { display: inline-flex; gap: 4px; }
.rc-catalogue td { vertical-align: middle; }
.rc-catalogue .rc-col-title { min-width: 180px; }
.rc-catalogue .rc-col-desc { min-width: 200px; max-width: 48ch; }
.rc-desc { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rc-catalogue .rc-col-formats, .rc-catalogue .rc-col-when, .rc-catalogue .rc-col-run { white-space: nowrap; }
.rc-catalogue .rc-badges { flex-wrap: nowrap; }
.module-reports { margin-top: 24px; padding-top: 8px; border-top: 1px solid var(--line); }
.module-reports > .rc-toolbar { margin: 0 0 10px; }
.module-reports-title { margin: 0; }
.page-header + .module-reports { margin-top: 0; padding-top: 0; border-top: 0; }

/* 0.12.3: a folio line whose net, service charge and taxes do not add up (flagged until its difference is posted to suspense). */
tr.line-broken > td { background: var(--danger-bg); }
tr.line-broken > td:first-child { box-shadow: inset 3px 0 0 var(--danger); }

/* 0.12.4: the property set-up checklist (Administration → Property set-up). */
.setup-steps { list-style: none; margin: 0; padding: 0; }
.setup-step-head { gap: 8px 12px; }
.setup-step-head h3 { margin: 0; }
.setup-step[data-state="Done"], .setup-step[data-state="Skipped"] { opacity: .85; }
.setup-step[data-state="ToDo"][data-required="true"] { border-left: 3px solid var(--warn); }
