/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 var(--space-5); font-weight: 700; font-size: 15px; letter-spacing: -.01em; color: var(--text); text-decoration: none; flex: none; min-width: 0; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { flex: none; width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent-bright), var(--accent)); color: #fff; display: grid; place-items: center; box-shadow: 0 1px 2px rgba(16,24,40,.15), inset 0 1px 0 rgba(255,255,255,.18); }
.brand-mark svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-org { font-weight: 450; color: var(--text-subtle); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; }
.nav { flex: 1; overflow-y: auto; padding: var(--space-2) var(--space-3) var(--space-4); display: flex; flex-direction: column; gap: 1px; }
.nav-section { margin: var(--space-5) var(--space-3) var(--space-2); font-size: 11px; font-weight: var(--weight-medium); color: var(--text-subtle); letter-spacing: .06em; }
.nav-link { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 var(--space-3); border-radius: var(--radius); color: var(--text-muted); font-weight: var(--weight-medium); font-size: 13.5px; text-decoration: none; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.nav-link .icon { color: var(--text-subtle); }
.nav-link:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-soft-text); font-weight: 600; }
.nav-link[aria-current="page"] .icon { color: var(--accent-bright); }
.nav-link .count { margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.sidebar-foot { border-top: 1px solid var(--line); padding: var(--space-3); }
.account-btn { width: 100%; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2); border: 0; border-radius: var(--radius); background: transparent; text-align: left; }
.account-btn:hover { background: var(--surface-hover); }
.account-btn .who { min-width: 0; flex: 1; line-height: 1.3; }
.account-btn .who strong { display: block; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-btn .who span { font-size: var(--text-xs); color: var(--text-subtle); }
.menu { position: fixed; z-index: 50; min-width: 200px; background: var(--surface-raised); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: var(--space-1); }
.menu button, .menu a { display: flex; align-items: center; gap: var(--space-2); width: 100%; height: 34px; padding: 0 var(--space-3); border: 0; background: transparent; border-radius: var(--radius-sm); color: var(--text); font-size: 13.5px; text-align: left; text-decoration: none; }
.menu button:hover, .menu a:hover, .menu button:focus-visible, .menu a:focus-visible { background: var(--surface-hover); text-decoration: none; outline: none; }
.menu .icon { color: var(--text-subtle); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-1) 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.appbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-3); height: var(--topbar-h); padding: 0 var(--space-8); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; }
.appbar .menu-toggle { display: none; }
.appbar .spacer { flex: 1; }
.global-search { position: relative; width: min(360px, 40vw); min-width: 0; }
.global-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-subtle); pointer-events: none; }
.global-search input { width: 100%; height: 34px; padding: 0 44px 0 34px; border: 1px solid var(--control-border); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.global-search input:focus-visible { outline: none; border-color: var(--accent-bright); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-bright) 20%, transparent); }
.global-search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--text-subtle); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 5px; background: var(--bg); }
.page { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--space-4) var(--space-8) var(--space-12); display: flex; flex-direction: column; gap: var(--space-6); }
.page-header { display: flex; align-items: flex-end; gap: var(--space-4); flex-wrap: wrap; }
.page-header .titles { flex: 1; min-width: min(240px, 100%); overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 6px; }
.page-header h1 { font-size: 24px; letter-spacing: -.02em; }
.page-header p { color: var(--text-muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.stat { padding: var(--space-4) var(--space-5); display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
.stat .label { color: var(--text-muted); font-size: var(--text-sm); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 28px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---------- Standalone (login, password, connect) ---------- */
.standalone { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--space-8) var(--space-4); gap: var(--space-6);
  background: radial-gradient(900px 420px at 50% -8%, color-mix(in srgb, var(--accent-bright) 12%, transparent), transparent 70%), var(--bg); }
.standalone .brand { height: auto; padding: 0; font-size: 17px; }
.standalone-card { width: min(400px, 100%); box-shadow: var(--shadow); }
.standalone-card.wide { width: min(500px, 100%); }
.standalone-card .card-body { padding: var(--space-8); display: flex; flex-direction: column; gap: var(--space-5); }
.standalone-foot { color: var(--text-subtle); font-size: var(--text-sm); text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 40; transform: translateX(-100%); visibility: hidden; transition: transform var(--dur) var(--ease), visibility 0s linear var(--dur); }
  .shell[data-nav-open="true"] .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); transition: transform var(--dur) var(--ease); }
  .shell[data-nav-open="true"]::after { content: ""; position: fixed; inset: 0; background: var(--backdrop); z-index: 30; }
  .appbar { padding: 0 var(--space-3); background: var(--surface); border-bottom-color: var(--line); }
  .appbar .menu-toggle { display: inline-flex; }
  .global-search { width: auto; flex: 1; }
  .global-search kbd, .appbar .appbar-action { display: none; }
  .page { padding: var(--space-5) var(--space-4) var(--space-10); gap: var(--space-5); }
  .page-header h1 { font-size: 21px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
  .grid-3 .stat { padding: var(--space-3); }
  .grid-3 .stat .label { font-size: var(--text-xs); }
  .grid-3 .stat .value { font-size: var(--text-xl); }
  .list-item { padding: var(--space-3) var(--space-4); }
  .hide-narrow { display: none; }
  .standalone-card .card-body { padding: var(--space-6); }
}
