/* =======================================================================================
   Dekhing — Enterprise Shell & Design System (Phase 1)
   Additive layer on top of style.css. Reuses the existing slate/green palette and
   Fira Sans/Code typography. Introduces:
     • an 8px design-token scale (spacing, radius, elevation, motion, type)
     • a collapsible left sidebar + top navbar (desktop/tablet ≥1024px)
     • a mobile navigation drawer (<1024px)
     • the redesigned hub → device Dashboard

   Nothing here changes app behaviour: navigation is driven by shell.js clicking the
   existing hub buttons, so every workflow/socket/Firestore call fires exactly as before.
======================================================================================= */

:root {
  /* ---- 8px spacing scale ---- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px;
  --sp-9: 48px; --sp-10: 64px;

  /* ---- radius ---- */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-2xl: 28px; --r-pill: 999px;

  /* ---- elevation (consistent shadow scale) ---- */
  --el-1: 0 1px 2px rgba(0,0,0,.30);
  --el-2: 0 4px 14px rgba(0,0,0,.34);
  --el-3: 0 12px 34px rgba(0,0,0,.42);
  --el-4: 0 22px 60px rgba(0,0,0,.52);
  --ring-accent: 0 0 0 1px rgba(34,197,94,.30), 0 0 30px rgba(34,197,94,.12);

  /* ---- surfaces (built from existing palette) ---- */
  --s-0: var(--color-background);          /* #020617 */
  --s-1: #0B1220;                          /* nav / bars */
  --s-2: var(--color-surface);             /* #0F172A cards */
  --s-3: var(--color-surface-raised);      /* #1E293B raised */
  --s-hover: #16233b;
  --hairline: rgba(148,163,184,.12);
  --hairline-strong: rgba(148,163,184,.20);
  --glass-nav: rgba(11,18,32,.82);

  /* ---- text ---- */
  --t-hi: var(--color-on-surface);         /* #F8FAFC */
  --t-mid: #CBD5E1;
  --t-lo: var(--color-on-surface-muted);   /* #94A3B8 */
  --t-faint: #64748B;

  /* ---- accent ---- */
  --accent: var(--color-primary);          /* #22C55E */
  --accent-dim: var(--color-primary-dim);  /* #16A34A */
  --accent-soft: rgba(34,197,94,.12);
  --accent-soft-2: rgba(34,197,94,.18);

  /* ---- type scale (compact) ---- */
  --fs-display: 22px; --fs-h1: 19px; --fs-h2: 16px; --fs-title: 14px;
  --fs-body: 13.5px; --fs-sm: 12.5px; --fs-cap: 11.5px; --fs-label: 10.5px;

  /* ---- motion ---- */
  --ease: cubic-bezier(.4,0,.2,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --dur-1: 140ms; --dur-2: 220ms; --dur-3: 320ms;

  /* ---- shell metrics ---- */
  --ent-sidebar-w: 264px;
  --ent-sidebar-w-collapsed: 76px;
  --ent-topbar-h: 64px;
  --ent-content-left: var(--ent-sidebar-w);
}

body.ent-collapsed { --ent-content-left: var(--ent-sidebar-w-collapsed); }

/* Monospace tabular for data readouts inside the shell */
.mono, .ent-stat-value, .ent-hero-clock, .ent-badge-mono {
  font-family: "Fira Code", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

/* =======================================================================================
   SHELL VISIBILITY  — shell.js sets exactly one body state:
     .ent-shell-on   → hub + document screens (sidebar + topbar + offset content)
     .ent-immersive  → camera / remote control (full-bleed, chrome hidden)
     .ent-no-shell   → device picker / auth (full-bleed, chrome hidden)
======================================================================================= */
#entSidebar, #entTopbar, #entScrim, #entMobileMenu { display: none; }

.ent-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;
}

@media (min-width: 1024px) {
  body.ent-shell-on #entSidebar { display: flex; }
  body.ent-shell-on #entTopbar  { display: flex; }
  /* Offset the visible document screen to clear the sidebar + topbar. style.css forces
     .app-screen{width:100%;min-height:100dvh}, so we must also shrink width/height here
     or the screen overflows past the right/bottom edges. */
  body.ent-shell-on .app-screen {
    left: var(--ent-content-left);
    top: var(--ent-topbar-h);
    width: calc(100% - var(--ent-content-left));
    height: calc(100% - var(--ent-topbar-h));
    min-height: 0;
    transition: left var(--dur-2) var(--ease), width var(--dur-2) var(--ease);
  }
  /* the old floating status pill is superseded by the topbar status cluster on desktop */
  body.ent-shell-on #statusPill { display: none; }
  body.ent-shell-on .in-use-banner:not(.hidden) { left: calc(var(--ent-content-left) + 50%); }
}

/* Mobile: sidebar becomes an off-canvas drawer, topbar hidden, screens keep full-bleed. */
@media (max-width: 1023px) {
  #entTopbar { display: none !important; }
  body.ent-shell-on #entSidebar,
  body.ent-immersive #entSidebar { display: flex; }
  #entSidebar {
    width: min(84vw, 300px);
    transform: translateX(-100%);
    transition: transform var(--dur-3) var(--ease-out);
    z-index: 1200;
  }
  body.ent-drawer-open #entSidebar { transform: translateX(0); }
  body.ent-drawer-open #entScrim {
    display: block; position: fixed; inset: 0; z-index: 1150;
    background: rgba(2,6,23,.62); backdrop-filter: blur(2px);
    animation: ent-fade var(--dur-2) var(--ease);
  }
  /* floating hamburger — dashboard only, so it never overlaps a document screen's back button */
  #entMobileMenu { display: none; }
  body.ent-shell-on.ent-dash-active #entMobileMenu { display: inline-flex; }
}

@keyframes ent-fade { from { opacity: 0; } to { opacity: 1; } }

/* =======================================================================================
   SIDEBAR
======================================================================================= */
#entSidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--ent-sidebar-w);
  flex-direction: column;
  background: linear-gradient(180deg, var(--s-1), var(--s-0));
  border-right: 1px solid var(--hairline);
  z-index: 1000;
  transition: width var(--dur-2) var(--ease);
  overflow: hidden;
}

.ent-side-head {
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--ent-topbar-h); min-height: var(--ent-topbar-h);
  padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--hairline);
}
.ent-logo {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent-soft); border: 1px solid var(--accent-soft-2);
  color: var(--accent); box-shadow: var(--ring-accent);
}
.ent-logo svg { width: 20px; height: 20px; }
.ent-wordmark { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.ent-wordmark b { font-size: 15px; font-weight: 700; letter-spacing: -.01em; color: var(--t-hi); }
.ent-wordmark span { font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--t-faint); }
body.ent-collapsed .ent-wordmark { display: none; }

.ent-side-nav {
  flex: 1 1 auto; overflow-y: auto; overflow-x: hidden;
  padding: var(--sp-4) var(--sp-3);
  scrollbar-width: thin; scrollbar-color: var(--hairline-strong) transparent;
}
.ent-side-nav::-webkit-scrollbar { width: 8px; }
.ent-side-nav::-webkit-scrollbar-thumb { background: var(--hairline-strong); border-radius: 8px; }

.ent-nav-group { margin-bottom: var(--sp-5); }
.ent-nav-label {
  font-size: var(--fs-label); font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--t-faint); padding: 0 var(--sp-3); margin-bottom: var(--sp-2);
}
body.ent-collapsed .ent-nav-label { opacity: 0; height: 8px; margin: 0; overflow: hidden; }

.ent-nav-item {
  position: relative;
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%;
  padding: 10px var(--sp-3);
  margin-bottom: 2px;
  border: 0; background: transparent;
  border-radius: var(--r-md);
  color: var(--t-lo);
  font-size: var(--fs-body); font-weight: 500; text-align: left;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.ent-nav-item svg { width: 20px; height: 20px; flex: 0 0 20px; }
.ent-nav-item .ent-nav-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ent-nav-item:hover { background: var(--s-hover); color: var(--t-hi); }
.ent-nav-item.is-active { background: var(--accent-soft); color: var(--accent); }
.ent-nav-item.is-active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
  box-shadow: 0 0 12px rgba(34,197,94,.6);
}
.ent-nav-item .ent-nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: var(--r-pill);
  background: var(--accent-soft-2); color: var(--accent);
}
body.ent-collapsed .ent-nav-item { justify-content: center; padding: 11px 0; }
body.ent-collapsed .ent-nav-item .ent-nav-text,
body.ent-collapsed .ent-nav-item .ent-nav-badge { display: none; }

.ent-side-foot { padding: var(--sp-3); border-top: 1px solid var(--hairline); }
.ent-side-device {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 10px var(--sp-3); margin-bottom: var(--sp-2);
  border-radius: var(--r-md); background: rgba(2,6,23,.4); border: 1px solid var(--hairline);
}
.ent-side-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: var(--t-faint); }
.ent-side-device:has(.is-online) .ent-side-dot { background: var(--accent); box-shadow: 0 0 10px rgba(34,197,94,.7); }
.ent-side-device-main { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.ent-side-device-main b { font-size: var(--fs-sm); font-weight: 700; color: var(--t-hi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ent-side-device-state { font-size: var(--fs-cap); font-style: normal; color: var(--t-faint); }
.ent-side-device-state.is-online { color: var(--accent); }
body.ent-collapsed .ent-side-device { justify-content: center; }
body.ent-collapsed .ent-side-device-main { display: none; }
.ent-side-foot .ent-side-btn {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  padding: 10px var(--sp-3); margin-top: 2px;
  border: 1px solid var(--hairline); border-radius: var(--r-md);
  background: transparent; color: var(--t-mid);
  font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.ent-side-foot .ent-side-btn svg { width: 18px; height: 18px; flex: 0 0 18px; }
.ent-side-foot .ent-side-btn:hover { background: var(--s-hover); color: var(--t-hi); border-color: var(--hairline-strong); }
.ent-side-foot .ent-side-btn.danger:hover { color: var(--color-error); border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.08); }
body.ent-collapsed .ent-side-foot .ent-side-btn { justify-content: center; }
body.ent-collapsed .ent-side-foot .ent-side-btn span { display: none; }

/* collapse toggle rail button (desktop only) */
.ent-collapse-btn {
  position: absolute; top: 50%; right: -13px; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%;
  display: none; place-items: center; z-index: 1001;
  background: var(--s-3); border: 1px solid var(--hairline-strong); color: var(--t-lo);
  cursor: pointer; box-shadow: var(--el-2);
  transition: color var(--dur-1) var(--ease), transform var(--dur-2) var(--ease);
}
@media (min-width: 1024px) { body.ent-shell-on .ent-collapse-btn { display: grid; } }
.ent-collapse-btn:hover { color: var(--accent); }
.ent-collapse-btn svg { width: 14px; height: 14px; transition: transform var(--dur-2) var(--ease); }
body.ent-collapsed .ent-collapse-btn svg { transform: rotate(180deg); }

/* =======================================================================================
   TOPBAR
======================================================================================= */
#entTopbar {
  position: fixed; top: 0; right: 0; left: var(--ent-content-left);
  height: var(--ent-topbar-h);
  align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-6);
  background: var(--glass-nav);
  border-bottom: 1px solid var(--hairline);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  z-index: 900;
  transition: left var(--dur-2) var(--ease);
}
.ent-topbar-title { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.ent-topbar-title b { font-size: var(--fs-h2); font-weight: 700; letter-spacing: -.01em; color: var(--t-hi); }
.ent-topbar-title span { font-size: var(--fs-cap); color: var(--t-faint); }
.ent-topbar-spacer { flex: 1 1 auto; }

.ent-topbar-status {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 7px 14px; border-radius: var(--r-pill);
  background: var(--s-2); border: 1px solid var(--hairline);
  font-size: var(--fs-sm); font-weight: 600; color: var(--t-mid);
}
.ent-topbar-status .ent-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--t-faint); }
.ent-topbar-status.is-online .ent-dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(34,197,94,.14), 0 0 12px rgba(34,197,94,.7); }
.ent-topbar-status .ent-clock { color: var(--t-lo); font-size: var(--fs-cap); }

.ent-icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center;
  border-radius: var(--r-md); border: 1px solid var(--hairline);
  background: var(--s-2); color: var(--t-mid); cursor: pointer;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.ent-icon-btn:hover { background: var(--s-hover); color: var(--t-hi); border-color: var(--hairline-strong); }
.ent-icon-btn svg { width: 19px; height: 19px; }

.ent-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: linear-gradient(145deg, var(--accent-dim), var(--accent));
  color: #04140A; font-weight: 800; font-size: 14px;
  border: 1px solid rgba(255,255,255,.14); box-shadow: var(--el-1);
}

/* floating hamburger (mobile) */
#entMobileMenu {
  position: fixed; top: max(20px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left));
  width: 44px; height: 44px; z-index: 800;
  border-radius: var(--r-md); border: 1px solid var(--hairline);
  background: var(--glass-nav); color: var(--t-hi); cursor: pointer;
  align-items: center; justify-content: center;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: var(--el-2);
}
#entMobileMenu svg { width: 22px; height: 22px; }
/* keep the hamburger clear of screens that already have their own top-left back button */
body.ent-immersive #entMobileMenu { display: none !important; }

/* =======================================================================================
   DASHBOARD  (redesigned #hubScreen)
======================================================================================= */
#hubScreen.ent-dashboard {
  display: block;
  overflow-y: auto; overflow-x: hidden;
  /* extra top space clears the floating status pill (top-centre chrome) */
  padding: max(80px, calc(env(safe-area-inset-top) + 68px)) var(--sp-6) var(--sp-7);
  background:
    radial-gradient(1200px 420px at 15% -10%, rgba(34,197,94,.08), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(42,61,110,.14), transparent 55%),
    var(--color-background);
}
.ent-dash-inner { max-width: 1400px; margin: 0 auto; }

/* section rhythm */
.ent-section { margin-top: var(--sp-6); }
.ent-section:first-child { margin-top: 0; }
.ent-section-head { display: flex; align-items: baseline; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.ent-section-head h2 { margin: 0; font-size: var(--fs-h2); font-weight: 700; letter-spacing: -.01em; color: var(--t-hi); }
.ent-section-head p { margin: 0; font-size: var(--fs-sm); color: var(--t-faint); }

/* ---- Device hero ---- */
.ent-hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr; gap: var(--sp-5);
  padding: var(--sp-5);
  border-radius: var(--r-xl);
  background: linear-gradient(145deg, rgba(30,41,59,.72), rgba(15,23,42,.86));
  border: 1px solid var(--hairline);
  box-shadow: var(--el-3);
}
.ent-hero::after {
  content: ""; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(34,197,94,.14), transparent 62%); pointer-events: none;
}
.ent-hero-device { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); }
.ent-phone {
  position: relative; width: 84px; height: 164px; border-radius: 20px;
  background: linear-gradient(160deg, #1f2937, #0b1220);
  border: 2px solid rgba(148,163,184,.22);
  box-shadow: var(--el-4), inset 0 1px 0 rgba(255,255,255,.06);
  display: grid; place-items: center;
}
.ent-phone::before { content: ""; position: absolute; top: 12px; width: 44px; height: 5px; border-radius: 3px; background: rgba(148,163,184,.3); }
.ent-phone-glow { color: var(--accent); opacity: .9; filter: drop-shadow(0 0 14px rgba(34,197,94,.5)); }
.ent-phone-glow svg { width: 32px; height: 32px; }

.ent-hero-main { min-width: 0; display: flex; flex-direction: column; }
.ent-hero-top { display: flex; align-items: flex-start; gap: var(--sp-4); flex-wrap: wrap; }
.ent-hero-name { margin: 0; font-size: var(--fs-display); font-weight: 800; letter-spacing: -.02em; color: var(--t-hi); overflow-wrap: anywhere; }
.ent-hero-sub { margin: 4px 0 0; font-size: var(--fs-body); color: var(--t-lo); }
.ent-conn-badge {
  display: inline-flex; align-items: center; gap: 7px; margin-left: auto;
  padding: 7px 14px; border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 700;
  background: rgba(148,163,184,.10); border: 1px solid var(--hairline); color: var(--t-lo);
}
.ent-conn-badge .ent-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--t-faint); }
.ent-conn-badge.is-online { background: var(--accent-soft); border-color: var(--accent-soft-2); color: var(--accent); }
.ent-conn-badge.is-online .ent-dot { background: var(--accent); box-shadow: 0 0 10px rgba(34,197,94,.8); animation: ent-pulse 2s ease-in-out infinite; }
@keyframes ent-pulse { 0%,100%{transform:scale(1);opacity:1} 50%{transform:scale(.7);opacity:.65} }

/* live stat tiles — populated from real telemetry when present, em-dash otherwise */
.ent-hero-stats {
  margin-top: var(--sp-4); display: grid; gap: var(--sp-2);
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
}
.ent-stat {
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: rgba(2,6,23,.4); border: 1px solid var(--hairline);
}
.ent-stat-label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-cap); font-weight: 600; color: var(--t-faint); text-transform: uppercase; letter-spacing: .06em; }
.ent-stat-label svg { width: 13px; height: 13px; }
.ent-stat-value { margin-top: 3px; font-size: 15px; font-weight: 700; color: var(--t-hi); }
.ent-stat-value small { font-size: 11px; color: var(--t-lo); font-weight: 500; }

.ent-hero-controls { margin-top: var(--sp-6); display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.ent-hero-controls .ent-qbtn { flex: 0 0 auto; }

/* Session actions on the hero (Switch Device / Disconnect) */
.ent-hero-actions { margin-top: var(--sp-5); display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: center; }
.ent-hero-btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 11px var(--sp-5);
  border-radius: var(--r-md);
  border: 1px solid var(--hairline-strong);
  background: var(--s-2); color: var(--t-hi);
  font-size: var(--fs-body); font-weight: 600; cursor: pointer;
  transition: transform var(--dur-1) var(--ease), background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.ent-hero-btn svg { width: 18px; height: 18px; }
.ent-hero-btn:hover { transform: translateY(-2px); background: var(--s-hover); border-color: var(--accent-soft-2); box-shadow: var(--el-2); }
.ent-hero-btn:active { transform: translateY(0) scale(.99); }
.ent-hero-btn.danger { color: #FCA5A5; }
.ent-hero-btn.danger:hover { color: #FECACA; background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.45); box-shadow: 0 8px 24px rgba(239,68,68,.16); }
.ent-hero-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Quick actions ---- */
.ent-quick-grid {
  display: grid; gap: var(--sp-3);
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
}
.ent-qbtn {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 14px var(--sp-4);
  border-radius: var(--r-md);
  background: var(--s-2); border: 1px solid var(--hairline);
  color: var(--t-hi); font-size: var(--fs-body); font-weight: 600; text-align: left;
  cursor: pointer;
  transition: transform var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.ent-qbtn .ent-qicon {
  width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center;
  border-radius: 10px; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-soft-2);
}
.ent-qbtn .ent-qicon svg { width: 19px; height: 19px; }
.ent-qbtn:hover { transform: translateY(-2px); border-color: var(--accent-soft-2); background: var(--s-hover); box-shadow: var(--el-2); }
.ent-qbtn:active { transform: translateY(0) scale(.99); }

/* ---- Module cards ---- */
.ent-modules { display: grid; gap: var(--sp-6); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.ent-module {
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--s-2); border: 1px solid var(--hairline);
  box-shadow: var(--el-1);
}
.ent-module-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.ent-module-head .ent-micon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: rgba(148,163,184,.1); color: var(--t-mid); }
.ent-module-head .ent-micon svg { width: 18px; height: 18px; }
.ent-module-head h3 { margin: 0; font-size: var(--fs-title); font-weight: 700; color: var(--t-hi); }
.ent-module-list { display: flex; flex-direction: column; gap: var(--sp-2); }

/* the existing hub buttons (openCameraCard etc.) re-skinned as module rows */
.ent-module .hub-card {
  flex: none; width: 100%;
  flex-direction: row; align-items: center; gap: var(--sp-3);
  padding: 12px var(--sp-3); min-height: 0;
  border-radius: var(--r-md);
  background: transparent; border: 1px solid transparent;
  box-shadow: none;
  text-align: left;
}
.ent-module .hub-card::before { display: none; }
.ent-module .hub-card:hover { transform: none; background: var(--s-hover); border-color: var(--hairline); box-shadow: none; }
.ent-module .hub-card:active { transform: scale(.995); }
.ent-module .hub-card-icon {
  width: 38px; height: 38px; flex: 0 0 38px; margin: 0;
  border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--accent-soft-2);
  color: var(--accent); box-shadow: none;
}
.ent-module .hub-card-icon svg { width: 20px; height: 20px; }
.ent-module .hub-card-title { font-size: var(--fs-body); font-weight: 600; color: var(--t-hi); }
.ent-module .hub-card-sub { font-size: var(--fs-cap); color: var(--t-faint); text-align: left; }
.ent-module .hub-card-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.ent-module .hub-card-chev { margin-left: auto; color: var(--t-faint); flex: 0 0 auto; transition: transform var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.ent-module .hub-card:hover .hub-card-chev { color: var(--accent); transform: translateX(3px); }
.ent-module .hub-card-chev svg { width: 18px; height: 18px; }

/* dashboard hidden by default until active (keeps showScreen semantics) */
#hubScreen.hidden { display: none !important; }

/* =======================================================================================
   RESPONSIVE
======================================================================================= */
/* Tablet / mobile: no fixed topbar, drawer nav, comfortable padding that clears the
   floating hamburger and the safe-area. */
@media (max-width: 1023px) {
  #hubScreen.ent-dashboard {
    padding: max(76px, calc(env(safe-area-inset-top) + 64px))
             max(var(--sp-4), env(safe-area-inset-right))
             calc(env(safe-area-inset-bottom) + var(--sp-7))
             max(var(--sp-4), env(safe-area-inset-left));
  }
  .ent-modules { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--sp-4); }
}

/* Stack the hero below ~760px: device art on top, details centered, stats as a tidy
   left-aligned grid so the tiles stay readable. */
@media (max-width: 760px) {
  .ent-hero { grid-template-columns: 1fr; gap: var(--sp-5); padding: var(--sp-5); text-align: center; }
  .ent-hero-device { order: -1; }
  .ent-hero-top { justify-content: center; flex-direction: column; align-items: center; gap: var(--sp-3); }
  .ent-conn-badge { margin-left: 0; }
  .ent-hero-name { font-size: 20px; }
  .ent-hero-stats { text-align: left; grid-template-columns: repeat(2, 1fr); margin-top: var(--sp-4); }
  .ent-stat-label { justify-content: flex-start; }
  .ent-phone { width: 76px; height: 148px; }
  .ent-section { margin-top: var(--sp-6); }
  .ent-modules { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  #hubScreen.ent-dashboard { padding-left: max(var(--sp-3), env(safe-area-inset-left)); padding-right: max(var(--sp-3), env(safe-area-inset-right)); }
  .ent-hero { padding: var(--sp-4); border-radius: var(--r-lg); }
  .ent-hero-name { font-size: 19px; }
  .ent-hero-stats { gap: var(--sp-2); }
  .ent-stat { padding: var(--sp-3); }
  .ent-stat-value { font-size: 15px; }
  .ent-phone { width: 72px; height: 140px; }
  .ent-section-head h2 { font-size: var(--fs-title); }
  .ent-module { padding: var(--sp-4); border-radius: var(--r-lg); }
}

@media (max-width: 340px) {
  .ent-hero-stats { grid-template-columns: 1fr; }
}

/* focus visibility across new interactive elements */
.ent-nav-item:focus-visible, .ent-qbtn:focus-visible, .ent-icon-btn:focus-visible,
.ent-side-btn:focus-visible, .ent-collapse-btn:focus-visible, #entMobileMenu:focus-visible,
.ent-module .hub-card:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  #entSidebar, #entTopbar, .app-screen, .ent-conn-badge.is-online .ent-dot { transition: none !important; animation: none !important; }
}
