/* ============================================================
   AppShell — chrome for A/B/C layouts. Classic adds nothing.
   All values pull from theme tokens; works across all 7 themes.
   ============================================================ */

.app-shell { min-height: 100vh; background: var(--color-background); color: var(--color-text); font-family: var(--pos-font-body); }
.app-shell--classic { display: contents; } /* truly invisible wrapper */

/* Non-classic shells fill the flex container of .app-layout */
.app-shell--a,
.app-shell--b,
.app-shell--c { flex: 1; min-width: 0; }

/* ───────────────────────── A: Calm Sidebar ───────────────────────── */
.app-shell--a {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
.ash-a__sidebar {
  background: var(--color-surface);
  border-right: 1px solid var(--pos-divider);
  padding: 22px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.ash-a__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 6px;
}
.ash-a__brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--color-primary);
  color: var(--color-btn-primary-text, #fff);
  display: grid; place-items: center;
  font-size: 18px; font-weight: 800;
}
.ash-a__brand-text {
  font-family: var(--pos-font-display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
}
.ash-a__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.ash-a__nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px;
  border: 0; border-radius: 10px;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background 120ms ease;
}
.ash-a__nav-item:hover { background: color-mix(in oklab, var(--color-text) 6%, var(--color-surface)); }
.ash-a__nav-item.is-active {
  background: color-mix(in oklab, var(--color-primary) 14%, var(--color-surface));
  color: var(--color-primary);
  font-weight: 600;
}
.ash-a__nav-icon {
  width: 22px;
  display: inline-grid; place-items: center;
  font-size: 17px;
  font-family: var(--pos-font-mono);
}
.ash-a__nav-label { font-size: 14px; }
.ash-a__user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in oklab, var(--color-text) 5%, var(--color-surface));
  border: 1px solid var(--pos-divider);
}
.ash-a__user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-btn-primary-text, #fff);
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
  font-family: var(--pos-font-mono);
}
.ash-a__user-meta { flex: 1; min-width: 0; }
.ash-a__user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ash-a__user-role { font-size: 10px; color: var(--color-text-secondary); font-family: var(--pos-font-mono); text-transform: uppercase; letter-spacing: 0.05em; }
.ash-a__user-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-text-secondary); flex-shrink: 0; }
.ash-a__user-dot.is-on { background: var(--color-success); }
.ash-a__main { overflow: auto; min-width: 0; }

/* ───────────────────────── B: Dense Pro ───────────────────────── */
.app-shell--b {
  display: grid;
  grid-template-columns: 56px 1fr;
  min-height: 100vh;
}
.ash-b__rail {
  background: var(--color-surface);
  border-right: 1px solid var(--pos-divider);
  display: flex; flex-direction: column;
  padding: 8px 0;
  gap: 4px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.ash-b__rail::-webkit-scrollbar { display: none; }
.ash-b__rail-brand {
  width: 56px; height: 48px;
  display: grid; place-items: center;
  font-size: 22px;
  color: var(--color-primary);
  margin-bottom: 4px;
}
.ash-b__rail-btn {
  width: 56px; height: 48px;
  border: 0; background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 20px;
  font-family: var(--pos-font-mono);
  position: relative;
  transition: color 120ms ease, background 120ms ease;
}
.ash-b__rail-btn:hover { background: color-mix(in oklab, var(--color-text) 6%, transparent); color: var(--color-text); }
.ash-b__rail-btn.is-active { color: var(--color-primary); background: color-mix(in oklab, var(--color-primary) 12%, transparent); }
.ash-b__rail-btn.is-active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 2px 2px 0;
  background: var(--color-primary);
}
.ash-b__rail-spacer { flex: 1; }
.ash-b__rail-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-btn-primary-text, #fff);
  display: grid; place-items: center;
  font-weight: 700; font-size: 11px;
  font-family: var(--pos-font-mono);
  margin: 0 auto 8px;
}
.ash-b__col { display: flex; flex-direction: column; min-width: 0; }
.ash-b__topbar {
  height: 44px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--pos-divider);
  background: var(--color-surface);
  flex-shrink: 0;
}
.ash-b__cmdk {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  background: color-mix(in oklab, var(--color-text) 8%, var(--color-surface));
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--pos-font-mono);
  font-size: 12px;
  cursor: pointer;
  min-width: 320px;
}
.ash-b__cmdk:hover { background: color-mix(in oklab, var(--color-text) 12%, var(--color-surface)); }
.ash-b__cmdk-key { font-weight: 700; padding: 2px 6px; border-radius: 4px; background: var(--color-background); border: 1px solid var(--color-border); }
.ash-b__cmdk-hint { color: var(--color-text-secondary); }
.ash-b__status-group { display: flex; align-items: center; gap: 14px; font-family: var(--pos-font-mono); font-size: 11px; color: var(--color-text-secondary); }
.ash-b__clock { font-variant-numeric: tabular-nums; }
.ash-b__status { display: inline-flex; align-items: center; gap: 6px; }
.ash-b__status-dot { width: 8px; height: 8px; border-radius: 50%; }
.ash-b__status-dot.is-ok  { background: var(--color-success); box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-success) 25%, transparent); }
.ash-b__status-dot.is-bad { background: var(--color-error);   box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-error)   25%, transparent); }
.ash-b__main { flex: 1; overflow: auto; min-width: 0; }

/* ───────────────────────── C: Adaptive ───────────────────────── */
.app-shell--c { display: flex; flex-direction: column; min-height: 100vh; }
.ash-c__topbar { display: none; }
.ash-c__main { flex: 1; overflow: auto; padding-bottom: 68px; }
.ash-c__tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 64px;
  background: var(--color-surface);
  border-top: 1px solid var(--pos-divider);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.ash-c__tab {
  border: 0; background: transparent;
  color: var(--color-text-secondary);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  padding: 6px 0;
  cursor: pointer;
  font: inherit;
  transition: color 120ms ease;
  position: relative;
}
.ash-c__tab.is-active { color: var(--color-primary); }
.ash-c__tab.is-active::after {
  content: ''; position: absolute; top: 0;
  width: 32px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--color-primary);
}
.ash-c__tab-icon { font-size: 22px; font-family: var(--pos-font-mono); }
.ash-c__tab-label { font-size: 10px; font-weight: 600; letter-spacing: 0.02em; }

@media (min-width: 900px) {
  .ash-c__topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 1px solid var(--pos-divider);
    background: var(--color-surface);
    position: sticky; top: 0; z-index: 40;
  }
  .ash-c__brand { display: flex; align-items: center; gap: 10px; }
  .ash-c__brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--color-primary); color: var(--color-btn-primary-text, #fff); display: grid; place-items: center; font-weight: 800; font-size: 16px; }
  .ash-c__brand-text { font-family: var(--pos-font-display); font-weight: 800; font-size: 16px; letter-spacing: -0.02em; }
  .ash-c__topnav { display: flex; gap: 4px; }
  .ash-c__topnav-btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: 0;
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    font-weight: 500; font-size: 13px;
    font-family: inherit;
  }
  .ash-c__topnav-btn:hover { background: color-mix(in oklab, var(--color-text) 6%, var(--color-surface)); }
  .ash-c__topnav-btn.is-active {
    background: color-mix(in oklab, var(--color-primary) 14%, var(--color-surface));
    color: var(--color-primary);
    font-weight: 600;
  }
  .ash-c__user { width: 34px; height: 34px; border-radius: 50%; background: var(--color-primary); color: var(--color-btn-primary-text, #fff); display: grid; place-items: center; font-weight: 700; font-family: var(--pos-font-mono); font-size: 12px; }
  .ash-c__tabbar { display: none; }
  .ash-c__main { padding-bottom: 0; }
}

/* ── Suppress per-layout chrome when AppShell is active ── */
/* Row-level chrome (headers/bars): safe to remove from layout entirely. */
.app-shell--a .layout-a__header,
.app-shell--b .layout-b__status-bar,
.app-shell--c .dirC-header { display: none !important; }

/* Column/rail chrome: must use visibility:hidden, not display:none.        */
/* display:none removes the item from grid placement, collapsing the column. */
.app-shell--a .layout-a__sidebar,
.app-shell--b .layout-b__rail,
.app-shell--c .dirC-nav-rail {
  visibility: hidden !important;
  pointer-events: none !important;
}
