/* =========================================================
   CareOS — Dashboard charts & app-shell styles
   Used by: CareOS Dashboard.html
   ========================================================= */

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background: var(--bg);
}

.aside {
  background: var(--bone-100);
  border-right: 1px solid var(--line);
  padding: var(--s-6) var(--s-5);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.aside .brand { margin-bottom: var(--s-7); }
.aside .nav { display: flex; flex-direction: column; gap: 2px; }
.aside .nav .sec {
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: var(--tr-eyebrow); text-transform: uppercase;
  color: var(--muted); padding: var(--s-5) 10px var(--s-2);
}
.aside .nav a {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 8px 10px; border-radius: var(--r-3);
  font-size: var(--fs-sm); color: var(--text-soft);
  text-decoration: none;
  transition: background var(--t-fast) var(--ease-out-expo), color var(--t-fast) var(--ease-out-expo);
}
.aside .nav a:hover { background: var(--surface-2); color: var(--ink); }
.aside .nav a.active { background: var(--ink); color: var(--bone-50); }
.aside .nav a .ic {
  width: 14px; height: 14px; border-radius: 3px;
  background: currentColor; opacity: 0.35;
}
.aside .nav a.active .ic { opacity: 1; }
.aside .nav a .count {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 10px;
  opacity: 0.5;
}
.aside .user {
  margin-top: auto; padding-top: var(--s-5);
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: var(--s-3);
}
.aside .user .col { gap: 1px; }
.aside .user .name { font-size: var(--fs-sm); font-weight: 500; }
.aside .user .role { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }

/* ---------- Main column ---------- */
.main {
  display: flex; flex-direction: column;
  min-width: 0;
}

.appbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-5) var(--s-8);
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.appbar .crumbs {
  font-family: var(--font-mono); font-size: var(--fs-xs);
  color: var(--muted); letter-spacing: var(--tr-eyebrow); text-transform: uppercase;
}
.appbar .crumbs span { color: var(--ink); }
.appbar .meta { display: flex; align-items: center; gap: var(--s-5); }
.appbar .clock { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-soft); }

.content {
  padding: var(--s-8) var(--s-8) var(--s-11);
  display: flex; flex-direction: column; gap: var(--s-7);
}

/* ---------- Dashboard hero ---------- */
.hero-row {
  display: grid; grid-template-columns: 1.4fr 1fr;
  gap: var(--s-7);
  align-items: end;
}
.hero-row h1 {
  font-family: var(--font-display);
  font-size: 64px; line-height: 0.96;
  letter-spacing: var(--tr-display);
  margin: 0; font-weight: 400;
}
.hero-row h1 em { font-style: italic; color: var(--sage-700); }
.hero-row .sub {
  margin-top: var(--s-3);
  font-size: var(--fs-md); color: var(--text-soft); line-height: 1.45;
  max-width: 48ch;
}

/* ---------- Stat strip ---------- */
.stat-strip {
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-5);
  overflow: hidden;
}
.stat-strip .cell {
  padding: var(--s-6);
  display: flex; flex-direction: column; gap: var(--s-3);
  border-right: 1px solid var(--line);
  transition: background var(--t-fast) var(--ease-out-expo);
  cursor: pointer;
}
.stat-strip .cell:last-child { border-right: 0; }
.stat-strip .cell:hover { background: var(--bone-100); }
.stat-strip .cell .label {
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: var(--tr-eyebrow); text-transform: uppercase;
  color: var(--muted);
}
.stat-strip .cell .value {
  font-family: var(--font-display); font-size: 56px;
  line-height: 1; letter-spacing: var(--tr-display);
  color: var(--ink);
}
.stat-strip .cell .value .u { font-family: var(--font-mono); font-size: 18px; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.stat-strip .cell .foot {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono); font-size: var(--fs-xs);
  color: var(--text-soft);
}
.stat-strip .cell .delta.up { color: var(--sage-700); }
.stat-strip .cell .delta.down { color: var(--coral-600); }
.stat-strip .cell .delta.flat { color: var(--muted); }
.stat-strip .cell .spark { height: 22px; width: 60px; }

/* ---------- Card primitives ---------- */
.dash-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-5);
  padding: var(--s-6);
  display: flex; flex-direction: column;
  gap: var(--s-5);
}
.dash-card .card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--s-4);
}
.dash-card .card-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px; letter-spacing: var(--tr-display); font-weight: 400;
  line-height: 1;
}
.dash-card .card-head .eyebrow { display: block; margin-bottom: 4px; }
.dash-card .card-head .actions {
  display: flex; gap: var(--s-2); align-items: center;
}
.dash-card .card-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: var(--s-3);
  border-top: 1px dashed var(--line);
  font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--muted);
}

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--s-6);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-6);
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-6);
}

/* ---------- Chart: staffing planned vs actual ---------- */
.chart {
  width: 100%; height: 280px;
  position: relative;
}
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .axis text {
  font-family: var(--font-mono); font-size: 10px;
  fill: var(--muted); letter-spacing: 0.08em; text-transform: uppercase;
}
.chart .grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }

/* Animated stroke draw */
.chart .draw {
  stroke-dasharray: var(--len, 2000);
  stroke-dashoffset: var(--len, 2000);
  animation: drawIn 1400ms var(--ease-out-expo) forwards;
}
.chart .draw.d-200 { animation-delay: 200ms; }
.chart .draw.d-400 { animation-delay: 400ms; }
@keyframes drawIn { to { stroke-dashoffset: 0; } }

/* Bars rise */
.chart .bar {
  transform-origin: bottom center;
  animation: barGrow 720ms var(--ease-out-expo) both;
}
@keyframes barGrow {
  from { transform: scaleY(0); opacity: 0; }
  to   { transform: scaleY(1); opacity: 1; }
}

.legend {
  display: flex; gap: var(--s-5); font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: var(--tr-eyebrow); text-transform: uppercase; color: var(--muted);
}
.legend .swc {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 2px; margin-right: 6px; vertical-align: middle;
}

/* ---------- Donut / Compliance ---------- */
.donut-wrap {
  display: flex; align-items: center; gap: var(--s-6);
}
.donut {
  --p: 87;
  position: relative;
  width: 160px; height: 160px;
}
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut .center {
  position: absolute; inset: 0; display: grid; place-items: center;
  text-align: center;
}
.donut .center .v {
  font-family: var(--font-display);
  font-size: 48px; line-height: 1; letter-spacing: var(--tr-display);
}
.donut .center .l {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--muted); letter-spacing: var(--tr-eyebrow); text-transform: uppercase;
  margin-top: 4px;
}
.donut .ring-track { stroke: var(--bone-200); }
.donut .ring-fill {
  stroke: var(--sage-600);
  stroke-dasharray: 440;
  stroke-dashoffset: 440;
  animation: ringFill 1400ms var(--ease-out-expo) 200ms forwards;
}
@keyframes ringFill { to { stroke-dashoffset: calc(440 - (440 * var(--p) / 100)); } }

.legend-list { display: flex; flex-direction: column; gap: var(--s-3); flex: 1; }
.legend-list .l-item {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: var(--s-4); align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.legend-list .l-item:first-child { border-top: 0; }
.legend-list .l-item .dot { width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; vertical-align: middle; display: inline-block; }
.legend-list .l-item .v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-soft); }

/* ---------- Heatmap ---------- */
.heatmap {
  display: grid;
  grid-template-columns: 120px repeat(24, 1fr);
  gap: 2px;
  font-size: var(--fs-xs);
}
.heatmap .row-label {
  padding: 6px 0;
  font-family: var(--font-ui); font-size: var(--fs-sm);
  color: var(--text-soft);
  display: flex; align-items: center;
}
.heatmap .col-label {
  padding: 0 0 6px;
  font-family: var(--font-mono); font-size: 9.5px;
  color: var(--muted); text-align: center;
  letter-spacing: 0.05em;
}
.heatmap .hx {
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  background: var(--bone-200);
  transition: transform var(--t-fast) var(--ease-out-expo), outline var(--t-fast) var(--ease-out-expo);
  cursor: pointer;
}
.heatmap .hx:hover { transform: scale(1.4); outline: 1px solid var(--ink); z-index: 2; }

/* heat scale via opacity over sage */
.heatmap .hx[data-v="0"] { background: var(--bone-200); }
.heatmap .hx[data-v="1"] { background: oklch(94% 0.025 165); }
.heatmap .hx[data-v="2"] { background: oklch(88% 0.045 165); }
.heatmap .hx[data-v="3"] { background: oklch(78% 0.070 165); }
.heatmap .hx[data-v="4"] { background: oklch(66% 0.090 165); }
.heatmap .hx[data-v="5"] { background: oklch(46% 0.080 165); }
.heatmap .hx.alert { background: oklch(70% 0.150 30); }

/* ---------- Live feed ---------- */
.feed { display: flex; flex-direction: column; gap: 2px; }
.feed .item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: var(--s-4);
  align-items: start;
  padding: 12px 0;
  border-top: 1px dashed var(--line);
}
.feed .item:first-child { border-top: 0; }
.feed .item .time {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--muted); padding-top: 2px;
}
.feed .item .body { font-size: var(--fs-sm); line-height: 1.5; color: var(--text); }
.feed .item .body .who { font-weight: 500; }
.feed .item .body .ctx { color: var(--muted); }
.feed .item .tag {
  align-self: start;
}

/* ---------- Bed board ---------- */
.bed-board {
  display: grid; grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}
.bed {
  aspect-ratio: 1.4 / 1;
  border-radius: var(--r-3);
  border: 1px solid var(--line);
  background: var(--bone-50);
  padding: 8px;
  display: flex; flex-direction: column; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--muted);
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out-expo), box-shadow var(--t-fast) var(--ease-out-expo);
}
.bed:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); z-index: 2; }
.bed .num { color: var(--text); font-size: 11px; }
.bed.occupied { background: var(--sage-100); border-color: var(--sage-200); color: var(--sage-700); }
.bed.occupied .num { color: var(--sage-800); }
.bed.critical { background: oklch(94% 0.04 30); border-color: oklch(85% 0.08 30); color: var(--coral-600); }
.bed.critical .num { color: var(--coral-600); }
.bed.dirty { background: oklch(94% 0.045 75); border-color: oklch(86% 0.07 75); color: oklch(40% 0.10 75); }
.bed.dirty .num { color: oklch(40% 0.10 75); }
.bed.empty { background: var(--bone-50); border-style: dashed; }

/* Additional bed statuses for non-ICU categories */
.bed.observation { background: oklch(94% 0.04 220); border-color: oklch(86% 0.06 220); color: oklch(38% 0.10 240); }
.bed.observation .num { color: oklch(28% 0.10 240); }
.bed.monitored { background: var(--sage-50); border-color: var(--sage-200); color: var(--sage-700); }
.bed.monitored .num { color: var(--sage-800); }
.bed.preop { background: oklch(94% 0.04 280); border-color: oklch(85% 0.06 280); color: var(--plum-500); }
.bed.preop .num { color: var(--plum-500); }
.bed.postop { background: oklch(94% 0.05 165); border-color: var(--sage-200); color: var(--sage-700); }
.bed.postop .num { color: var(--sage-800); }
.bed.recovery { background: var(--sage-100); border-color: var(--sage-300); color: var(--sage-700); }
.bed.recovery .num { color: var(--sage-800); }
.bed.labor { background: oklch(94% 0.05 350); border-color: oklch(85% 0.08 350); color: oklch(45% 0.12 350); }
.bed.labor .num { color: oklch(45% 0.12 350); }
.bed.postpartum { background: oklch(95% 0.035 350); border-color: oklch(88% 0.05 350); color: oklch(40% 0.10 350); }
.bed.postpartum .num { color: oklch(40% 0.10 350); }
.bed.triage-t1, .bed.t1 { background: oklch(92% 0.05 30); border-color: var(--coral-400); color: var(--coral-600); position: relative; }
.bed.triage-t1::after, .bed.t1::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--coral-500); animation: bedPulse 1.2s var(--ease-in-out-soft) infinite; }
@keyframes bedPulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(1.5); } }
.bed.t2 { background: oklch(94% 0.05 50); border-color: oklch(82% 0.10 50); color: oklch(48% 0.14 50); }
.bed.t2 .num { color: oklch(48% 0.14 50); }
.bed.t3 { background: oklch(94% 0.05 75); border-color: oklch(85% 0.09 75); color: oklch(45% 0.12 75); }
.bed.t3 .num { color: oklch(45% 0.12 75); }
.bed.t4 { background: oklch(95% 0.03 165); border-color: var(--sage-200); color: var(--sage-700); }
.bed.t4 .num { color: var(--sage-800); }
.bed.hold { background: repeating-linear-gradient(45deg, var(--bone-100), var(--bone-100) 4px, var(--bone-200) 4px, var(--bone-200) 8px); border-color: var(--line-strong); color: var(--text-soft); }
.bed.blocked { background: var(--bone-200); border-style: dashed; border-color: var(--line-strong); color: var(--muted); }

/* ---------- Bed category tabs ---------- */
.bb-tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin: 0 0 var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--line);
}
.bb-tab {
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.06em;
  padding: 6px 10px; border-radius: var(--r-pill);
  background: transparent; border: 1px solid var(--line); color: var(--text-soft);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background var(--t-fast) var(--ease-out-expo), color var(--t-fast) var(--ease-out-expo), border-color var(--t-fast) var(--ease-out-expo);
}
.bb-tab:hover { background: var(--surface-2); color: var(--ink); }
.bb-tab.is-active { background: var(--ink); color: var(--bone-50); border-color: var(--ink); }
.bb-tab .tnum { font-size: 10px; opacity: 0.7; }
.bb-tab.is-active .tnum { opacity: 0.9; }

.bb-legend {
  display: flex; flex-wrap: wrap; gap: var(--s-4);
  margin-top: var(--s-3); padding-top: var(--s-3);
  border-top: 1px dashed var(--line);
  font-family: var(--font-mono); font-size: 10px;
  color: var(--muted); letter-spacing: 0.05em;
}
.bb-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.bb-legend .sw { width: 10px; height: 10px; border-radius: 2px; border: 1px solid var(--line); }

/* ---------- Tonight tab / on-floor list ---------- */
.on-floor .row-line {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: var(--s-4);
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.on-floor .row-line:first-child { border-top: 0; }
.on-floor .name { font-weight: 500; letter-spacing: -0.01em; font-size: var(--fs-sm); }
.on-floor .role { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }
.on-floor .meter {
  width: 80px; height: 4px;
  background: var(--bone-200); border-radius: 999px; overflow: hidden;
}
.on-floor .meter > i {
  display: block; height: 100%;
  background: var(--sage-500);
  width: var(--p, 60%);
  border-radius: 999px;
  transition: width 720ms var(--ease-out-expo);
}
.on-floor .meter.warn > i { background: var(--amber-500); }
.on-floor .meter.bad > i  { background: var(--coral-500); }
.on-floor .hours {
  font-family: var(--font-mono); font-size: var(--fs-xs);
  color: var(--text-soft); min-width: 60px; text-align: right;
}

/* ---------- Alert list ---------- */
.alerts { display: flex; flex-direction: column; gap: var(--s-3); }
.alert {
  display: grid; grid-template-columns: 4px 1fr auto;
  gap: var(--s-4); align-items: center;
  padding: var(--s-4) var(--s-4) var(--s-4) 0;
  background: var(--bone-50);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  overflow: hidden;
  transition: transform var(--t-fast) var(--ease-out-expo), box-shadow var(--t-fast) var(--ease-out-expo);
}
.alert:hover { transform: translateX(2px); box-shadow: var(--shadow-1); }
.alert .stripe { align-self: stretch; background: var(--bone-400); }
.alert.critical .stripe { background: var(--coral-500); }
.alert.caution .stripe { background: var(--amber-500); }
.alert.info .stripe { background: var(--sage-500); }
.alert .body { padding-left: var(--s-3); }
.alert .body .ttl { font-size: var(--fs-sm); font-weight: 500; letter-spacing: -0.01em; line-height: 1.3; }
.alert .body .sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.alert .cta {
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: var(--tr-eyebrow); text-transform: uppercase;
  color: var(--muted); padding: 6px 10px; border-radius: var(--r-2);
  border: 1px solid var(--line); background: transparent; cursor: pointer;
  transition: color var(--t-fast) var(--ease-out-expo), border-color var(--t-fast) var(--ease-out-expo);
}
.alert .cta:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- Department list with bars ---------- */
.dept-list { display: flex; flex-direction: column; gap: 0; }
.dept-row {
  display: grid;
  grid-template-columns: 130px 1fr 60px 60px;
  gap: var(--s-4); align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  transition: background var(--t-fast) var(--ease-out-expo);
  cursor: pointer;
}
.dept-row:first-child { border-top: 0; }
.dept-row:hover { background: var(--bone-100); margin: 0 calc(var(--s-4) * -1); padding-left: var(--s-4); padding-right: var(--s-4); border-radius: var(--r-3); }
.dept-row .dept-name { font-size: var(--fs-sm); font-weight: 500; letter-spacing: -0.01em; }
.dept-row .dept-bar {
  height: 8px; background: var(--bone-200); border-radius: 999px; overflow: hidden;
  position: relative;
}
.dept-row .dept-bar i {
  position: absolute; left: 0; top: 0; bottom: 0;
  border-radius: 999px;
  background: var(--ink);
  width: var(--p, 60%);
  animation: barFill 900ms var(--ease-out-expo) both;
}
.dept-row .dept-bar i.planned {
  background: var(--bone-400);
  width: var(--planned, 100%);
}
.dept-row .dept-bar i.actual {
  background: var(--sage-600);
  width: var(--actual, 80%);
}
.dept-row .dept-bar i.actual.over { background: var(--coral-500); }
@keyframes barFill { from { width: 0; } }
.dept-row .num {
  font-family: var(--font-mono); font-size: var(--fs-xs);
  text-align: right; color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

/* ---------- Reveal anims ---------- */
.r {
  opacity: 0; transform: translateY(14px);
  transition:
    opacity var(--t-medium) var(--ease-out-expo),
    transform var(--t-medium) var(--ease-out-expo);
}
.r.in { opacity: 1; transform: none; }

.r-hero {
  opacity: 0; transform: translateY(20px); filter: blur(6px);
  transition:
    opacity var(--t-cine) var(--ease-out-expo),
    transform var(--t-cine) var(--ease-out-expo),
    filter var(--t-cine) var(--ease-out-expo);
}
.r-hero.in { opacity: 1; transform: none; filter: none; }

/* responsive */
@media (max-width: 1280px) {
  .app { grid-template-columns: 200px 1fr; }
  .content { padding: var(--s-7) var(--s-6) var(--s-10); }
  .appbar { padding: var(--s-4) var(--s-6); }
  .hero-row h1 { font-size: 52px; }
  .stat-strip .cell .value { font-size: 44px; }
}
@media (max-width: 1100px) {
  .stat-strip { grid-template-columns: repeat(3, 1fr); }
  .stat-strip .cell:nth-child(n+4) { border-top: 1px solid var(--line); }
  .stat-strip .cell:nth-child(3n) { border-right: 0; }
  .grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .bed-board { grid-template-columns: repeat(6, 1fr); }
  .appbar .search { width: 180px !important; }
  .donut-wrap { flex-direction: column; align-items: stretch; gap: var(--s-5); }
  .donut { margin: 0 auto; }
}
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .aside {
    position: sticky; top: 0; height: auto; z-index: 30;
    padding: var(--s-4) var(--s-5);
    flex-direction: row; align-items: center; justify-content: space-between;
    overflow: hidden;
  }
  .aside .brand { margin-bottom: 0; }
  .aside .nav, .aside .user { display: none; }
  .aside.open { flex-direction: column; align-items: stretch; height: auto; max-height: 80vh; overflow-y: auto; padding: var(--s-5); }
  .aside.open .brand { margin-bottom: var(--s-5); }
  .aside.open .nav, .aside.open .user { display: flex; }
  .aside .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: var(--r-3);
    background: transparent; border: 1px solid var(--line); color: var(--text);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease-out-expo);
  }
  .aside .menu-btn:hover { background: var(--surface-2); }
  .aside .menu-btn .bars { width: 14px; height: 1.5px; background: currentColor; position: relative; }
  .aside .menu-btn .bars::before, .aside .menu-btn .bars::after { content: ""; position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor; }
  .aside .menu-btn .bars::before { top: -5px; }
  .aside .menu-btn .bars::after  { top: 5px; }
  .hero-row { grid-template-columns: 1fr; }
  .hero-row h1 { font-size: 40px; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .stat-strip .cell:nth-child(3n) { border-right: 1px solid var(--line); }
  .stat-strip .cell:nth-child(2n) { border-right: 0; }
  .stat-strip .cell:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stat-strip .cell .value { font-size: 38px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .bed-board { grid-template-columns: repeat(4, 1fr); }
  .content { padding: var(--s-6) var(--s-5) var(--s-9); gap: var(--s-6); }
  .appbar { padding: var(--s-3) var(--s-5); gap: var(--s-3); }
  .appbar .meta { gap: var(--s-3); }
  .appbar .search { display: none; }
  .heatmap { grid-template-columns: 90px repeat(24, minmax(14px, 1fr)); font-size: 9px; }
  .heatmap .row-label { font-size: var(--fs-xs); }
  /* horizontal scroll for wide tables/heatmaps */
  .scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 560px) {
  .stat-strip { grid-template-columns: 1fr; }
  .stat-strip .cell { border-right: 0 !important; border-top: 1px solid var(--line); }
  .stat-strip .cell:first-child { border-top: 0; }
  .bed-board { grid-template-columns: repeat(3, 1fr); }
  .heatmap { grid-template-columns: 70px repeat(24, 12px); }
  .dash-card { padding: var(--s-5); }
  .dash-card .card-head h3 { font-size: 22px; }
  .hero-row h1 { font-size: 32px; }
  .appbar .clock, .appbar .kbd { display: none; }
}

/* Menu button hidden on desktop */
.aside .menu-btn { display: none; }

/* ---------- Collapsible sidebar (desktop) ---------- */
.app { transition: grid-template-columns var(--t-base) var(--ease-out-expo); }
.app.aside-collapsed { grid-template-columns: 68px 1fr; }
.aside { transition: padding var(--t-base) var(--ease-out-expo); }
.aside .brand span:not(.brand-mark),
.aside .nav .sec,
.aside .nav a .count,
.aside .user .col,
.aside .user .role,
.aside .user .name {
  transition: opacity var(--t-fast) var(--ease-out-expo);
}
.app.aside-collapsed .aside { padding-left: 12px; padding-right: 12px; }
.app.aside-collapsed .aside .brand { gap: 0; justify-content: center; }
.app.aside-collapsed .aside .brand > span:not(.brand-mark) { display: none; }
.app.aside-collapsed .aside .nav .sec { opacity: 0; height: 0; padding: 0; margin: 0; overflow: hidden; pointer-events: none; }
.app.aside-collapsed .aside .nav a { justify-content: center; padding: 10px 0; gap: 0; }
.app.aside-collapsed .aside .nav a > *:not(.ic) { display: none; }
.app.aside-collapsed .aside .nav a .ic { width: 16px; height: 16px; opacity: 0.7; }
.app.aside-collapsed .aside .nav a.active .ic { opacity: 1; }
.app.aside-collapsed .aside .user { justify-content: center; }
.app.aside-collapsed .aside .user .col { display: none; }

/* Collapse / theme toggle buttons in appbar */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--r-3);
  background: transparent; border: 1px solid var(--line);
  color: var(--text-soft); cursor: pointer;
  transition: background var(--t-fast) var(--ease-out-expo),
              color var(--t-fast) var(--ease-out-expo),
              border-color var(--t-fast) var(--ease-out-expo);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.icon-btn .sun, .icon-btn .moon { display: none; }
:root[data-theme="dark"] .icon-btn .sun { display: inline-block; }
:root:not([data-theme="dark"]) .icon-btn .moon { display: inline-block; }
.icon-btn .collapse-ic line { transition: transform var(--t-base) var(--ease-out-expo); transform-origin: center; }
.app.aside-collapsed .icon-btn .collapse-ic { transform: scaleX(-1); }
