/* App frame: sidebar, top bar, content area, the mobile drawer. */
.app { display: flex; height: 100vh; height: 100dvh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar); flex: none; display: flex; flex-direction: column;
  border-right: 1px solid var(--divider); background: var(--page); padding: 16px 12px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; padding: 4px 10px 18px; color: rgb(var(--fg)); }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: rgb(var(--primary)); display: grid; place-items: center; }
.brand-mark svg { width: 20px; height: 20px; fill: #00261d; stroke: none; }
.brand-mark .brand-lock { fill: none; stroke: rgb(var(--primary)); stroke-width: 1.6; }
.nav a, .device-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 999px;
  color: var(--text); font-weight: 500; cursor: pointer;
}
.nav a:hover, .device-link:hover { background: var(--hover); }
.nav a.active, .device-link.active { background: var(--selected); color: rgb(var(--fg)); }
.nav a svg { color: var(--muted); }
.nav a.active svg { color: var(--accent-text); }
.badge { margin-left: auto; background: rgb(var(--primary)); color: #00261d; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 0 8px; height: 20px; line-height: 1; display: inline-flex; align-items: center; }
.nav-title { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--muted); text-transform: uppercase; padding: 20px 12px 6px; }
.device-link { gap: 11px; padding: 7px 12px; }
.device-link .dev-ico { width: 32px; height: 32px; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-sm); display: grid; place-items: center; color: var(--muted); position: relative; }
.device-link .dev-ico svg { width: 18px; height: 18px; }
.device-link .dev-text { min-width: 0; display: flex; flex-direction: column; }
.device-link .dev-name { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-link .dev-sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--page); position: absolute; right: -2px; bottom: -2px; background: var(--faint); }
.dot.ok { background: rgb(var(--primary)); } .dot.late { background: var(--warn); } .dot.missing, .dot.error { background: var(--danger); }
.sidebar-foot { margin-top: auto; display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); padding: 16px 12px 4px; }
.sidebar-foot svg { width: 16px; height: 16px; }
.empty-nav { font-size: 13px; color: var(--muted); padding: 6px 12px; }

/* Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; min-height: 68px; }
.icon-btn.menu-btn { display: none; }
.search { flex: 1; min-width: 0; max-width: 640px; display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 999px; padding: 0 16px; height: 44px; border: 1px solid var(--divider); }
.search:focus-within { border-color: var(--accent-text); box-shadow: 0 0 0 3px rgb(var(--primary) / .3); }
.search svg { color: var(--muted); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; color: var(--text); min-width: 0; }
.search input:disabled { cursor: default; }
.version-picker { position: relative; margin-left: auto; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--divider); background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap; }
.pill:hover { background: var(--inset); }
.pill .chev { width: 16px; height: 16px; color: var(--muted); }
.menu { position: absolute; right: 0; top: 46px; z-index: 30; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--divider); width: 300px; max-height: 60vh; overflow-y: auto; padding: 6px; }
.menu .menu-group { font-size: 12px; color: var(--faint); font-weight: 600; padding: 10px 10px 4px; }
.menu button { display: flex; width: 100%; justify-content: space-between; gap: 10px; border: 0; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--hover); }
.menu button.active { background: var(--selected); font-weight: 600; }
.menu button small { color: var(--muted); }

.content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 24px 40px; }
.scrim { display: none; }
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgb(0 20 15 / .35); }
  .icon-btn.menu-btn { display: grid; }
  .topbar { padding: 10px 16px; gap: 8px; }
  .content { padding: 4px 16px 32px; }
  .pill { padding: 0 11px; }
  #versionLabel, .pill .chev, .btn .lbl { display: none; }
  .btn:has(.lbl) { padding: 0 11px; }
  .list-row .btn { height: 34px; padding: 0 12px; }
}
/* lock state */
.lock-pill svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.lock-pill.unlocked { background: linear-gradient(rgb(var(--primary) / .2), rgb(var(--primary) / .2)) var(--surface); border-color: transparent; color: var(--accent-text); }
body.bare .sidebar, body.bare .topbar, body.bare .scrim { display: none; }
body.bare .content { padding: 0 16px; }
