/*
 * HotelX design system — the C8 base (roadmap C8 / D10, first real pass).
 *
 * Tokens first, then the app shell, then components. Deliberately restrained and
 * operational: this is a system staff stare at for a whole shift, so it favours
 * legibility, tabular data and calm colour over decoration. Theme-aware via
 * prefers-color-scheme; a [data-theme] override on <html> wins when set.
 */

/* ---- Tokens ------------------------------------------------------------- */
:root {
  --ink: #16201f;
  --ink-soft: #3c4a48;
  --muted: #63716f;
  --faint: #9aa8a5;
  --rule: #dce3e1;
  --rule-strong: #c4cecb;
  --paper: #eef1f0;
  --surface: #f7f9f8;
  --card: #ffffff;
  --card-hover: #f2f5f4;
  --brand: #0f6f5c;
  --brand-ink: #ffffff;
  --brand-soft: #e4f0ec;
  --good: #1f7a4d;
  --good-soft: #e3f2e9;
  --warn: #8c6210;
  --warn-soft: #f6edd7;
  --bad: #a13437;
  --bad-soft: #f6e3e3;
  --info: #275ea6;
  --info-soft: #e2ebf6;

  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Consolas, 'Liberation Mono', monospace;

  --r-sm: 5px;
  --r: 8px;
  --r-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 32, 30, 0.06), 0 1px 3px rgba(16, 32, 30, 0.05);
  --shadow: 0 4px 16px rgba(16, 32, 30, 0.08);

  --sidebar-w: 15rem;
  --topbar-h: 3.5rem;

  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
}

:root[data-theme='dark'],
:root:not([data-theme='light']) {
  /* placeholder so bare :root above is the light source of truth */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --ink: #e7edeb;
    --ink-soft: #c2ccca;
    --muted: #8ea09d;
    --faint: #61706d;
    --rule: #26302f;
    --rule-strong: #333f3d;
    --paper: #0c1211;
    --surface: #101817;
    --card: #141d1c;
    --card-hover: #1a2423;
    --brand: #46b89b;
    --brand-ink: #06110e;
    --brand-soft: #14322b;
    --good: #57c187;
    --good-soft: #14301f;
    --warn: #d6a63c;
    --warn-soft: #322a12;
    --bad: #e0817f;
    --bad-soft: #331c1c;
    --info: #6ea3e4;
    --info-soft: #16263c;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  }
}
:root[data-theme='dark'] {
  --ink: #e7edeb;
  --ink-soft: #c2ccca;
  --muted: #8ea09d;
  --faint: #61706d;
  --rule: #26302f;
  --rule-strong: #333f3d;
  --paper: #0c1211;
  --surface: #101817;
  --card: #141d1c;
  --card-hover: #1a2423;
  --brand: #46b89b;
  --brand-ink: #06110e;
  --brand-soft: #14322b;
  --good: #57c187;
  --good-soft: #14301f;
  --warn: #d6a63c;
  --warn-soft: #322a12;
  --bad: #e0817f;
  --bad-soft: #331c1c;
  --info: #6ea3e4;
  --info-soft: #16263c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}
html,
body,
#root {
  height: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--brand);
  text-decoration: none;
}
h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.01em;
}

/* ---- App shell ---------------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 100%;
  height: 100%;
}
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: var(--topbar-h);
  padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--rule);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.brand .mark {
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: var(--r-sm);
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 0.85rem;
  font-weight: 800;
}
.nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-3) var(--sp-2);
}
.nav-group-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--faint);
  padding: var(--sp-3) var(--sp-3) var(--sp-1);
}
.nav a {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0.5rem var(--sp-3);
  margin: 1px 0;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  font-weight: 500;
}
.nav a:hover {
  background: var(--card-hover);
  color: var(--ink);
}
.nav a.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}
.nav a .ico {
  width: 1.1rem;
  text-align: center;
  opacity: 0.85;
}
.sidebar-foot {
  border-top: 1px solid var(--rule);
  padding: var(--sp-3);
  font-size: 0.78rem;
  color: var(--muted);
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--rule);
  background: var(--card);
}
.topbar .crumb {
  font-weight: 600;
  font-size: 1rem;
}
.topbar .ctx {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  color: var(--muted);
  font-size: 0.82rem;
}
.topbar .who {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--ink);
}
.avatar {
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 0.78rem;
}
.content {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-5);
}
.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}
.page-head h1 {
  font-size: 1.3rem;
}
.page-head .sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 2px;
}

/* ---- Cards, grids ------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.card.pad {
  padding: var(--sp-4) var(--sp-5);
}
.card + .card,
.stack > * + * {
  margin-top: var(--sp-4);
}
.grid {
  display: grid;
  gap: var(--sp-4);
}
.grid.stats {
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}
.stat {
  padding: var(--sp-4);
}
.stat .n {
  font-size: 1.7rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  font-weight: 650;
}
.stat .l {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-top: 2px;
}
.section-title {
  font-size: 0.95rem;
  font-weight: 650;
  margin: var(--sp-5) 0 var(--sp-3);
}

/* ---- Tables ------------------------------------------------------------- */
.tablewrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
thead th {
  text-align: left;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
  padding: 0.55rem var(--sp-4);
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
tbody td {
  padding: 0.6rem var(--sp-4);
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover td {
  background: var(--card-hover);
}
td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.mono {
  font-family: var(--mono);
  font-size: 0.85em;
}

/* ---- Pills / badges ----------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--rule);
  white-space: nowrap;
}
.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(--info-soft);
  color: var(--info);
  border-color: transparent;
}
.dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

/* ---- Buttons ------------------------------------------------------------ */
button,
.btn {
  font: inherit;
  font-weight: 600;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  background: var(--brand);
  color: var(--brand-ink);
  transition:
    background 0.12s ease,
    opacity 0.12s ease;
}
button:hover,
.btn:hover {
  filter: brightness(1.05);
}
button:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: default;
  filter: none;
}
button.ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--rule-strong);
}
button.ghost:hover {
  background: var(--card-hover);
  filter: none;
}
button.subtle {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--rule);
}
button.mini {
  padding: 0.28rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
}
button.danger {
  background: var(--bad);
  color: #fff;
}
button.linklike {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--brand);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
button.linklike:hover {
  filter: none;
  opacity: 0.8;
}
.btn-row {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ---- Forms -------------------------------------------------------------- */
label.field {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
input,
select,
textarea {
  width: 100%;
  font: inherit;
  padding: 0.5rem 0.65rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
  border-color: var(--brand);
}
.form-row {
  margin-bottom: var(--sp-3);
}
/* A fault named under the field that caused it, rather than one generic line
   at the bottom of the form (premium UI L5 — every error says how to fix it).
   Paired with aria-describedby on the input, so it is announced too. */
.field-err {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--bad);
  margin-top: 0.35rem;
}
input[aria-invalid='true'] {
  border-color: var(--bad);
}
/* The tenant and property ids are both UUIDs. Monospace lets the eye compare
   them character by character, which proportional type does not. */
input.mono {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: var(--sp-3);
}

/* ---- Messages / states -------------------------------------------------- */
.msg {
  font-size: 0.85rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--r-sm);
  margin: var(--sp-3) 0;
}
.msg.bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.msg.good {
  background: var(--good-soft);
  color: var(--good);
}
.msg.info {
  background: var(--info-soft);
  color: var(--info);
}
.empty {
  color: var(--muted);
  padding: var(--sp-5);
  text-align: center;
  font-size: 0.9rem;
}
.spinner {
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid var(--rule-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.loading {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--muted);
  padding: var(--sp-6);
  justify-content: center;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Banner ------------------------------------------------------------- */
.banner {
  border-left: 3px solid var(--brand);
  background: var(--brand-soft);
  color: var(--ink);
  padding: 0.6rem 0.9rem;
  border-radius: var(--r-sm);
  margin-bottom: var(--sp-4);
  font-size: 0.88rem;
}

/* ---- Login -------------------------------------------------------------- */
.login-screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background: radial-gradient(1200px 600px at 50% -10%, var(--brand-soft), var(--paper) 60%);
}
.login-card {
  width: 100%;
  max-width: 22rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: var(--sp-6);
}
.login-card .brand {
  border: 0;
  height: auto;
  padding: 0 0 var(--sp-4);
  font-size: 1.25rem;
}
.login-card .tag {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: var(--sp-4);
}
.login-card button[type='submit'] {
  width: 100%;
  margin-top: var(--sp-3);
}
.hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: var(--sp-3);
}

/* ---- Modal -------------------------------------------------------------- */
.modal-scrim {
  position: fixed;
  inset: 0;
  /* ~70% opaque: heavy enough to drop the page behind below 3:1 contrast, so
     the dialog is the only thing left to read (premium UI L8). 0.45 looked
     tidy and left the page competing for attention. */
  background: rgba(8, 10, 14, 0.7);
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  z-index: 50;
}
.modal {
  width: 100%;
  max-width: 26rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: var(--sp-5);
}
.modal h3 {
  font-size: 1.05rem;
  margin-bottom: var(--sp-3);
}
.modal .btn-row {
  justify-content: flex-end;
  margin-top: var(--sp-4);
}

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 780px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    z-index: 40;
    width: var(--sidebar-w);
    height: 100%;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
  }
  .sidebar.open {
    transform: none;
    box-shadow: var(--shadow);
  }
  .menu-toggle {
    display: inline-grid !important;
  }
}
.menu-toggle {
  display: none;
  place-items: center;
  background: transparent;
  border: 1px solid var(--rule-strong);
  color: var(--ink);
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
}

/* ---- Dashboard ---------------------------------------------------------- */
/*
 * Bolder than the rest of the system on purpose: this is the screen a manager
 * opens the morning with, and the one number they want is occupancy. Everything
 * else on the page is sized relative to that.
 *
 * No chart library and no invented series — /api/dashboard carries no history,
 * so the only visuals here are proportions of figures that actually exist.
 */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.sync-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--card);
  white-space: nowrap;
}
.sync-flag.clear {
  color: var(--good);
  border-color: var(--good-soft);
  background: var(--good-soft);
}
.sync-flag.behind {
  color: var(--warn);
  border-color: var(--warn-soft);
  background: var(--warn-soft);
}
.sync-flag .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.sync-flag.behind .pulse {
  animation: sync-pulse 2s ease-in-out infinite;
}
@keyframes sync-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

/* Hero: occupancy */
.hero-occ {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: var(--sp-5);
  align-items: center;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}
.occ-pct {
  font-size: clamp(3.4rem, 11vw, 6rem);
  font-weight: 700;
  line-height: 0.88;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
  display: flex;
  align-items: baseline;
}
.occ-pct span {
  font-size: 0.32em;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-left: 0.12em;
  color: var(--muted);
}
.occ-cap {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 0.7rem;
  white-space: nowrap;
}
.occ-bar {
  display: flex;
  height: 2.6rem;
  border-radius: var(--r);
  overflow: hidden;
  gap: 2px;
  background: var(--rule);
}
.occ-bar .seg {
  display: block;
  flex-basis: 0;
  min-width: 3px;
}
.seg.occ,
.dot.occ {
  background: var(--brand);
}
.seg.free,
.dot.free {
  background: var(--good-soft);
}
.seg.out,
.dot.out {
  background: var(--bad-soft);
}
.occ-key {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.occ-key span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.occ-key .dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid var(--rule-strong);
}

/* Money */
.money {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}
/* Two rows, not four columns. The headline figures carry a currency code plus
   seven digits and separators; four of those abreast overflow their tracks at any
   size worth calling a headline. */
.money-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--sp-4) var(--sp-5);
}
.money-sub {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--sp-4) var(--sp-5);
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--rule);
}
/* Grid items default to min-content width, so a long currency string overflows
   its track and lands on the neighbour. These figures are the longest strings on
   the page: NGN plus seven digits plus separators. */
.money-row > *,
.money-sub > * {
  min-width: 0;
}
.m-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.m-value {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
  font-weight: 650;
}
.m-big .m-value {
  font-size: clamp(1.6rem, 3.6vw, 2.2rem);
  line-height: 1.05;
  white-space: nowrap;
}
/* The currency sits beside the figure at label size: it is context, not content. */
.m-value .cur {
  font-size: 0.5em;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-right: 0.3em;
  vertical-align: 0.12em;
}
.m-value.paid .cur {
  color: var(--good);
  opacity: 0.7;
}
.m-small .m-value {
  font-size: 1.2rem;
  line-height: 1.25;
  white-space: nowrap;
}
.m-value.paid {
  color: var(--good);
}
.settle {
  margin-top: var(--sp-4);
}
.settle-bar {
  height: 0.5rem;
  border-radius: 999px;
  background: var(--rule);
  overflow: hidden;
}
.settle-bar i {
  display: block;
  height: 100%;
  background: var(--good);
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.settle-cap {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.45rem;
}

/* The house */
.house {
  margin-bottom: var(--sp-4);
}
.house-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.house-head h2 {
  font-size: 1rem;
  margin: 0;
}
.house-head a {
  font-size: 0.8rem;
  color: var(--brand);
}
.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  gap: 0.5rem;
}
.unit {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.7rem 0.75rem;
  border-radius: var(--r);
  border: 1px solid var(--rule);
  background: var(--card);
  color: inherit;
  text-decoration: none;
  transition:
    transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1),
    border-color 0.15s;
}
.unit:hover {
  transform: translateY(-2px);
  border-color: var(--rule-strong);
}
.unit:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.unit.occ {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}
.unit.out {
  background: var(--bad-soft);
  border-color: var(--bad-soft);
}
.u-code {
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.u-hk {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  opacity: 0.75;
}
.unit.occ .u-hk {
  opacity: 0.85;
}

/* Movement */
.flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--sp-3);
}
.flow-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  color: inherit;
  text-decoration: none;
  transition:
    transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1),
    border-color 0.15s;
}
.flow-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
}
.flow-card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.flow-card.alert .f-n {
  color: var(--bad);
}
.f-n {
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.f-l {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 0.4rem;
}
.f-go {
  font-size: 0.8rem;
  color: var(--brand);
  margin-top: 0.75rem;
}

@media (max-width: 620px) {
  .hero-occ {
    grid-template-columns: 1fr;
    gap: var(--sp-4);
  }
  .occ-cap {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sync-flag.behind .pulse {
    animation: none;
  }
  .unit,
  .flow-card,
  .settle-bar i {
    transition: none;
  }
}

/* ---- View toggle & filters --------------------------------------------- */
.viewtoggle {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--card);
}
.viewtoggle button {
  background: transparent;
  border: 0;
  border-right: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}
.viewtoggle button:last-child {
  border-right: 0;
}
.viewtoggle button[aria-pressed='true'] {
  background: var(--brand);
  color: var(--brand-ink);
}
.viewtoggle button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

/* Counts you can click. The totals stay on screen, so narrowing the view never
   costs you the shape of the whole property. */
.filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.filter {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.filter b {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  color: var(--ink);
  margin-right: 0.2rem;
}
.filter:hover {
  border-color: var(--rule-strong);
}
.filter.on {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}
.filter.on b {
  color: var(--brand-ink);
}
.filter:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---- Room board --------------------------------------------------------- */
.room-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.75rem;
}
.room {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--rule-strong);
  border-radius: var(--r);
  padding: 0.85rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.room.occ {
  border-left-color: var(--brand);
}
.room.free {
  border-left-color: var(--good);
}
.room.out {
  border-left-color: var(--bad);
  background: var(--bad-soft);
}
.room header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.r-code {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.r-occ {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.r-type {
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.room footer {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: auto;
}

/* ---- Task lanes --------------------------------------------------------- */
/* Left to right, the way the work actually moves. The lane a card sits in is
   the status, so the pill on the card is confirmation rather than the only cue. */
.head-acts {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}
/* Lanes hold one row and scroll sideways rather than wrapping: a lane that drops
   below its neighbours stops reading as a stage of the same flow. The scroll is
   on this container, so the page body never moves sideways. */
.lanes {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(14rem, 1fr);
  gap: 0.75rem;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 0.4rem;
}
@media (max-width: 760px) {
  .lanes {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    overflow-x: visible;
  }
}
.lane {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.lane > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0 0.15rem 0.1rem;
}
.lane > header h2 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin: 0;
  font-weight: 600;
}
.lane > header span {
  font-size: 0.82rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.lane[data-lane='done'] > header h2 {
  color: var(--good);
}
.lane-empty {
  font-size: 0.78rem;
  color: var(--faint);
  margin: 0;
  padding: 0.5rem 0.15rem;
}
.task {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 0.7rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--shadow-sm);
}
.t-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.t-room {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.t-kind {
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.t-who {
  font-size: 0.74rem;
  color: var(--muted);
}
/* Card actions share a narrow lane, so they get tighter padding than the same
   buttons elsewhere — three of them have to sit on one line. */
.t-acts {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}
.t-acts button {
  padding: 0.3rem 0.55rem;
  font-size: 0.74rem;
}
.t-sev {
  font-size: 0.74rem;
  color: var(--muted);
}
.task.blocking {
  border-left: 3px solid var(--bad);
}

/* ---- Arrivals ----------------------------------------------------------- */
/* A card per arrival rather than a row, because check-in is one decision per
   guest and the decision is the point of the screen. */
.filter.static {
  cursor: default;
  background: var(--card);
}
.filter.static.warn {
  background: var(--warn-soft);
  border-color: var(--warn-soft);
  color: var(--warn);
}
.filter.static.warn b {
  color: var(--warn);
}
.arrivals,
.guests {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.75rem;
}
.arrival,
.guest {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.arrival > header,
.guest > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.a-ref {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}
.a-type {
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.a-dates {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.74rem;
  color: var(--muted);
  padding-top: 0.2rem;
}
.a-dates b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.a-nights {
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  padding: 1px 8px;
  font-weight: 500;
  white-space: nowrap;
}
.a-go {
  margin-top: auto;
  width: 100%;
}

/* ---- In house ----------------------------------------------------------- */
.ledger-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: var(--sp-4) var(--sp-5);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-4);
}
.ledger-strip > * {
  min-width: 0;
}
.m-value.big {
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  line-height: 1.05;
  white-space: nowrap;
}
.m-value .of {
  font-size: 0.6em;
  font-weight: 400;
  color: var(--muted);
}
/* The balance is the content of the card; the room number tells you whose. */
.guest.owing {
  border-left: 4px solid var(--warn);
}
.guest.settled {
  border-left: 4px solid var(--good);
}
.g-room {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.g-state {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.guest.owing .g-state {
  color: var(--warn);
}
.guest.settled .g-state {
  color: var(--good);
}
.g-bal {
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.g-acts {
  display: flex;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.3rem;
}
.g-acts button {
  flex: 1;
}
