/* ===================================================================
   CMB.TECH Data Wall — Visual System
   Brand reskin: CMB navy + CMB red, serif display headings,
   light intranet-style home cards, navy bottom command bar.
   Windows 11 laptop-first, touch-first, 55" wall target.
   =================================================================== */

:root {
  /* --- CMB.TECH brand --- */
  --navy:           #16294f;
  --navy-deep:      #0e1f40;
  --navy-700:       #1d3666;
  --red:            #e1241a;
  --red-dark:       #c01d13;
  --blue:           #1f6fb2;
  --teal:           #14a07a;

  /* --- Backgrounds (light, intranet style) --- */
  --bg:             #eaf0f7;
  --bg-surface:     #ffffff;
  --bg-elevated:    #ffffff;
  --bg-deep:        #f2f6fb;

  /* --- Borders & shadows --- */
  --border:         #dbe3ee;
  --border-focus:   #1f6fb2;
  --shadow-card:    0 8px 24px rgba(18, 38, 74, 0.12);
  --shadow-overlay: 0 24px 60px rgba(14, 30, 62, 0.28);

  /* --- Text (on light surfaces) --- */
  --text:           #17284a;
  --text-muted:     #4c5d72;
  --text-dim:       #8492a4;

  /* --- Accent palette by content type (brand-aligned) --- */
  --powerbi:        #e1241a;
  --powerbi-bg:     rgba(225, 36, 26, 0.10);
  --navigation:     #1f6fb2;
  --navigation-bg:  rgba(31, 111, 178, 0.10);
  --weather:        #3a9bd9;
  --weather-bg:     rgba(58, 155, 217, 0.12);
  --awareness:      #14a07a;
  --awareness-bg:   rgba(20, 160, 122, 0.12);
  --operator:       #6b7a8d;
  --operator-bg:    rgba(107, 122, 141, 0.12);
  --local:          #14a07a;
  --local-bg:       rgba(20, 160, 122, 0.12);
  --error:          #d83a2f;
  --success:        #2e9e5b;

  /* --- Typography (serif display like the CMB hero, clean sans body) --- */
  --font-display:   "Georgia", "Cambria", "Times New Roman", serif;
  --font-body:      "Segoe UI", "Helvetica Neue", "Arial", sans-serif;

  /* --- Layout --- */
  --bar-height:     72px;
  --radius-lg:      16px;
  --radius-md:      12px;
  --radius-sm:      9px;
  --radius-pill:    999px;
  --gap:            16px;
  --shell-pad:      20px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow: hidden; height: 100%; }

body {
  background:
    radial-gradient(1200px 420px at 50% -12%, rgba(31, 111, 178, 0.12), transparent 60%),
    radial-gradient(900px 360px at 100% 0%, rgba(225, 36, 26, 0.05), transparent 55%),
    linear-gradient(180deg, #f5f8fc 0%, #e7edf5 100%);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* ===== Shell grid ===== */
/* Content fills the top; a single command bar (with shell + rotation controls)
   is anchored at the bottom for touch reach on a large wall screen. Explicit row
   placement so toggling `hidden` on the idle bar never reassigns the 1fr main row. */
.shell {
  height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 0;
  overflow: hidden;
}

.home,
.content-pane { grid-row: 1; }
.idle-bar     { grid-row: 2; }
.top-bar      { grid-row: 3; }

/* ===== COMMAND BAR (single, bottom-anchored, CMB navy) ===== */
/* 3-zone grid: brand (left) | controls (centered, position-stable) | status (right).
   The side columns are equal (1fr), so the centered control cluster never shifts
   when the breadcrumb or Home countdown text changes width. */
.top-bar {
  min-height: var(--bar-height);
  padding: 6px var(--shell-pad);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 12px;
  background: linear-gradient(180deg, var(--navy-700) 0%, var(--navy-deep) 100%);
  color: #ffffff;
  border-top: 3px solid var(--red);   /* CMB red brand edge */
  z-index: 100;
}

.top-bar__brand {
  grid-column: 1;
  justify-self: stretch;   /* fill the column so content clips here, not over the controls */
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  overflow: hidden;   /* let the breadcrumb/meta truncate instead of pushing controls */
}

/* --- CMB.TECH logo --- */
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  color: #ffffff;
}

.brand-logo__mark { flex-shrink: 0; }

.brand-logo__word {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 1.06rem;
  letter-spacing: 0.01em;
  line-height: 1;
}

.brand-logo__tech { color: var(--red); }

.brand-sep {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.22);
  flex-shrink: 0;
}

.top-bar__title {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.01em;
  color: #ffffff;
  flex-shrink: 0;
}

.top-bar__page {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
  min-width: 0;
}

.top-bar__page:not(:empty)::before {
  content: "/ ";
  color: rgba(255, 255, 255, 0.4);
}

/* Secondary context line (installation + autostart countdown on Home) */
.top-bar__meta {
  font-size: 0.82rem;
  color: rgba(173, 198, 230, 0.92);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
  min-width: 0;
}

.top-bar__commands {
  grid-column: 2;
  justify-self: center;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

/* Rotation controls group inside the single command bar (content-only) */
.top-bar__rotation {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 8px;
  margin-left: 4px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.top-bar__status {
  grid-column: 3;
  justify-self: stretch;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

/* --- Command buttons (light-on-navy) --- */
.cmd-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 12px 18px;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 100ms ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.cmd-btn svg { flex-shrink: 0; }

.cmd-btn:hover,
.cmd-btn:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.18);
}

.cmd-btn:active {
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.18);
}

/* Disabled state (generic) */
.cmd-btn:disabled,
.cmd-btn[disabled] {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
  transform: none;
}

.cmd-btn--home {
  color: #ffffff;
  font-weight: 700;
}

.cmd-btn--home:hover,
.cmd-btn--home:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.22);
}

/* Primary CTAs: Start Rotation + Pause/Continue use CMB red */
.cmd-btn--rotate,
.cmd-btn--accent {
  background: var(--red);
  color: #ffffff;
  border-color: var(--red);
  font-weight: 700;
}

.cmd-btn--rotate:hover,
.cmd-btn--rotate:focus-visible,
.cmd-btn--accent:hover,
.cmd-btn--accent:focus-visible {
  background: var(--red-dark);
  border-color: var(--red-dark);
  color: #ffffff;
}

/* Pause/Continue fixed width so the swap doesn't shift neighbours */
.cmd-btn--accent {
  min-width: 132px;
  justify-content: center;
}

/* --- Status chips (on navy) --- */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

.chip--idle {
  background: rgba(225, 36, 26, 0.22);
  border-color: rgba(225, 36, 26, 0.5);
  color: #ffd3ce;
}

/* Network chip doubles as the Status panel trigger (button) */
.chip--network {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  gap: 6px;
  transition: background 150ms ease, border-color 150ms ease, transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
}

.chip--network::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.chip--network:hover,
.chip--network:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.32);
}

.chip--network:active { transform: scale(0.96); }

/* ===== IDLE PROGRESS BAR ===== */
.idle-bar {
  height: 3px;
  background: rgba(225, 36, 26, 0.14);
  overflow: hidden;
  flex-shrink: 0;
}

.idle-bar__fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--red) 0%, #ff8377 100%);
  transform-origin: left;
  transition: transform 1s linear;
}

/* When warning phase is active, bar pulses subtly */
.idle-bar--warning .idle-bar__fill {
  background: var(--red);
  animation: idlePulse 2s ease-in-out infinite;
}

@keyframes idlePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ===== HOME VIEW (light, intranet style) ===== */
.home {
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--shell-pad);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* --- Tile groups --- */
.tile-groups {
  display: grid;
  gap: 14px;
  max-width: 1480px;
  margin: 6px auto 0;
}

/* Awareness + Operator side by side on wide screens */
.tile-groups--split-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.tile-group {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(18, 38, 74, 0.05);
}

.tile-group__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.tile-group__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
}

.tile-group__desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* --- Operator group visual separation --- */
.tile-group--operator {
  background: var(--bg-deep);
  border-color: var(--border);
}

.tile-group--operator .tile-group__title {
  color: var(--operator);
}

/* --- Tile grid --- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(244px, 1fr));
  gap: 12px;
}

/* --- Tiles --- */
.tile {
  position: relative;
  min-height: 148px;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 2px rgba(18, 38, 74, 0.04);
  transition: transform 120ms ease, border-color 180ms ease, box-shadow 180ms ease;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

.tile::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  transition: width 150ms ease;
}

.tile:hover,
.tile:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
}

.tile:hover::before,
.tile:focus-visible::before { width: 6px; }

.tile:active {
  transform: translateY(0) scale(0.98);
}

/* Accent stripe colors */
.tile[data-accent="powerbi"]::before     { background: var(--powerbi); }
.tile[data-accent="navigation"]::before  { background: var(--navigation); }
.tile[data-accent="weather"]::before     { background: var(--weather); }
.tile[data-accent="awareness"]::before   { background: var(--awareness); }
.tile[data-accent="operator"]::before    { background: var(--operator); }
.tile[data-accent="local"]::before       { background: var(--local); }

.tile:hover[data-accent="powerbi"],
.tile:focus-visible[data-accent="powerbi"]     { border-color: rgba(225, 36, 26, 0.45); }
.tile:hover[data-accent="navigation"],
.tile:focus-visible[data-accent="navigation"]  { border-color: rgba(31, 111, 178, 0.45); }
.tile:hover[data-accent="weather"],
.tile:focus-visible[data-accent="weather"]     { border-color: rgba(58, 155, 217, 0.45); }
.tile:hover[data-accent="awareness"],
.tile:focus-visible[data-accent="awareness"]   { border-color: rgba(20, 160, 122, 0.45); }
.tile:hover[data-accent="operator"],
.tile:focus-visible[data-accent="operator"]    { border-color: rgba(107, 122, 141, 0.4); }
.tile:hover[data-accent="local"],
.tile:focus-visible[data-accent="local"]       { border-color: rgba(20, 160, 122, 0.45); }

/* Unwired / planned tile */
.tile--unwired {
  opacity: 0.7;
  cursor: default;
  border-style: dashed;
  border-width: 1.5px;
  box-shadow: none;
  background: var(--bg-deep);
}

.tile--unwired::before {
  opacity: 0.4;
}

.tile--unwired:hover,
.tile--unwired:focus-visible {
  transform: none;
  box-shadow: none;
}

.tile__coming-soon {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: rgba(31, 111, 178, 0.10);
  border: 1px solid rgba(31, 111, 178, 0.28);
  color: var(--blue);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tile__badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tile__badge--powerbi     { background: var(--powerbi-bg);    color: var(--powerbi); }
.tile__badge--navigation  { background: var(--navigation-bg); color: var(--navigation); }
.tile__badge--weather     { background: var(--weather-bg);    color: var(--weather); }
.tile__badge--awareness   { background: var(--awareness-bg);  color: var(--awareness); }
.tile__badge--operator    { background: var(--operator-bg);   color: var(--operator); }
.tile__badge--local       { background: var(--local-bg);      color: var(--local); }
.tile__badge--external    { background: var(--navigation-bg); color: var(--navigation); }

.tile__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--navy);
}

.tile__subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.tile__action-hint {
  margin: auto 0 0;
  padding-top: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.03em;
}

.tile__action-hint svg {
  flex-shrink: 0;
  opacity: 0.75;
}

.tile__status {
  margin: auto 0 0;
  padding-top: 4px;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-style: italic;
}

/* ===== CONTENT PANE ===== */
.content-pane {
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.content-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--bg);
}

/* Loading spinner inside content pane */
.content-pane::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid rgba(31, 111, 178, 0.2);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.content-pane--loading::after {
  opacity: 1;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 92px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  animation: toastIn 300ms ease;
}

.toast__body {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  text-align: center;
  box-shadow: var(--shadow-overlay);
}

.toast__title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
}

.toast__text {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== OVERLAYS (Error, Offline) ===== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 26, 56, 0.55);
  backdrop-filter: blur(6px);
  animation: overlayIn 250ms ease;
}

.overlay__card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  max-width: 460px;
  width: 90%;
  box-shadow: var(--shadow-overlay);
}

.overlay__card h2 {
  margin: 16px 0 8px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--navy);
}

.overlay__card p {
  margin: 0 0 20px;
  color: var(--text-muted);
  line-height: 1.5;
}

.overlay__icon {
  display: inline-flex;
}

.overlay__icon--error { color: var(--red); }
.overlay__icon--offline { color: var(--blue); }

.overlay__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ===== STATUS DRAWER ===== */
.status-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: var(--bar-height);
  width: 340px;
  max-width: 90vw;
  z-index: 250;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-overlay);
  overflow-y: auto;
  animation: drawerIn 200ms ease;
}

.status-drawer__inner {
  padding: 24px;
}

.status-drawer__inner h2 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  color: var(--navy);
}

.diag-list {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
}

.diag-list dt {
  color: var(--text-dim);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 2px;
}

.diag-list dd {
  margin: 0;
  word-break: break-word;
  font-size: 0.9rem;
  color: var(--text);
}

@keyframes drawerIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: none;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 100ms ease, background 150ms ease, opacity 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.96);
}

.btn--primary {
  background: var(--red);
  color: #ffffff;
}

.btn--primary:hover { background: var(--red-dark); }

.btn--secondary {
  background: var(--bg-deep);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--secondary:hover { background: #e7edf5; }

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn--ghost:hover { background: var(--bg-deep); color: var(--text); }

/* ===== ROTATION CONTROLS (inside the single command bar, on navy) ===== */
/* --- Rotation timer --- */
.rotation-timer {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  padding: 6px 16px;
  min-width: 132px;   /* fixed so the ticking value doesn't resize the bar */
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  transition: opacity 200ms ease;
}

.rotation-timer__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.6);
}

.rotation-timer__value {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

/* Dimmed when rotation is paused */
.rotation-timer--paused { opacity: 0.5; }
.rotation-timer--paused .rotation-timer__value { color: rgba(255, 255, 255, 0.75); }

/* --- Numbered dashboard switcher --- */
.switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 42vw;
}

.switcher__btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}

.switcher__btn:hover,
.switcher__btn:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
}

.switcher__btn:active { transform: scale(0.94); }

.switcher__btn--active {
  background: var(--red);
  border-color: var(--red);
  color: #ffffff;
}

.switcher__empty {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  font-style: italic;
}

/* ===== MENU OVERLAY ===== */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  background: rgba(13, 26, 56, 0.55);
  backdrop-filter: blur(6px);
  animation: overlayIn 250ms ease;
}

.menu-overlay__panel {
  width: 460px;
  max-width: 92vw;
  height: 100%;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-overlay);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  overflow-y: auto;
  animation: drawerInLeft 220ms ease;
}

@keyframes drawerInLeft {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

.menu-overlay__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.menu-overlay__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--navy);
}

.menu-overlay__sub {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.menu-overlay__hint {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1.4;
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.menu-overlay__foot {
  margin-top: auto;
  padding-top: 12px;
}

.menu-overlay__foot .btn { width: 100%; }

/* --- Menu item row --- */
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.menu-item--active {
  border-color: var(--blue);
  background: rgba(31, 111, 178, 0.08);
}

.menu-item__main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.menu-item__num {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--powerbi-bg);
  color: var(--powerbi);
  font-weight: 700;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.menu-item__num--off {
  background: var(--bg-deep);
  color: var(--text-dim);
}

.menu-item__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.menu-item__label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-item__sub {
  color: var(--text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-item--unwired { opacity: 0.6; }

/* --- Rotation membership toggle --- */
.menu-toggle {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius-pill);
  background: #cdd7e3;
  cursor: pointer;
  transition: background 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.menu-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(18, 38, 74, 0.25);
  transition: transform 150ms ease;
}

.menu-toggle--on { background: var(--red); }
.menu-toggle--on::after {
  transform: translateX(20px);
  background: #ffffff;
}

.menu-toggle:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ===== Hidden utility ===== */
[hidden] { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .tile-groups--split-row {
    grid-template-columns: 1fr;
  }

  .tile-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .cmd-btn span {
    display: none;
  }

  .cmd-btn {
    padding: 12px;
    min-height: 44px;
  }

  /* Icon-only at narrow widths — drop the fixed widths */
  .cmd-btn--accent { min-width: 0; }
  .cmd-btn--rotate span { display: none; }
  .rotation-timer { min-width: 0; }

  .top-bar__page {
    display: none;
  }

  .rotation-timer__label { display: none; }

  .switcher { max-width: 34vw; }
}

@media (max-width: 600px) {
  :root {
    --shell-pad: 12px;
    --bar-height: 56px;
  }

  .tile-grid {
    grid-template-columns: 1fr;
  }

  .tile {
    min-height: 130px;
  }

  .top-bar__status {
    display: none;
  }

  .top-bar__meta { display: none; }

  .brand-sep,
  .top-bar__title { display: none; }   /* keep the logo, drop extra brand text */

  .menu-overlay__panel {
    width: 100%;
    max-width: 100%;
    border-right: none;
  }

  .switcher__btn {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
  }

  .top-bar__rotation {
    padding-left: 4px;
    margin-left: 2px;
  }
}

/* ===== Scrollbar styling (Windows) ===== */
.home::-webkit-scrollbar {
  width: 8px;
}

.home::-webkit-scrollbar-track {
  background: transparent;
}

.home::-webkit-scrollbar-thumb {
  background: rgba(23, 40, 74, 0.22);
  border-radius: 4px;
}

.home::-webkit-scrollbar-thumb:hover {
  background: rgba(23, 40, 74, 0.4);
}
