/* STEAMCO Admin Shell
   Faithfully reproduces the old Svelte Sidebar.svelte styles in vanilla CSS.
   Depends on admin-tokens.css for all design tokens. */

/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--s-font-sans);
  font-size: var(--s-font-size-base);
  line-height: var(--s-font-line-height-normal);
  color: var(--s-color-fg-primary);
  background: var(--s-color-bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ══════════════════════════════════════════
   SHELL GRID
   ══════════════════════════════════════════ */

.admin-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  grid-template-rows: auto 1fr;
  height: 100vh;
  background: var(--s-color-bg-app);
  transition: grid-template-columns var(--s-duration-normal)
    cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-shell[data-sidebar="rail"] {
  grid-template-columns: 44px 1fr;
}

/* Browse mode: full nav + browse panel side by side */
.admin-shell[data-sidebar="browse"] {
  grid-template-columns: 440px 1fr;
}

.admin-shell.dragging {
  transition: none;
}

/* ══════════════════════════════════════════
   SHELL HEADER (full-width top bar)
   ══════════════════════════════════════════ */

.shell-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--s-space-3);
  padding: var(--s-space-1) var(--s-space-3);
  min-height: 36px;
  background: var(--s-color-bg-panel);
  border-bottom: 1px solid var(--s-color-border-subtle);
  flex-shrink: 0;
  z-index: 10;
}

.shell-breadcrumb {
  font-size: var(--s-font-size-1);
  color: var(--s-color-fg-muted);
  font-weight: 500;
}

.shell-header-spacer {
  flex: 1;
}

.shell-header-actions {
  display: flex;
  align-items: center;
  gap: var(--s-space-2);
}

.shell-header-actions .header-icon-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--s-radius-1);
  background: transparent;
  color: var(--s-color-fg-muted);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  padding: 0;
}

.shell-header-actions .header-icon-btn:hover {
  background: var(--s-color-hover-bg);
  color: var(--s-color-fg-primary);
}

/* ══════════════════════════════════════════
   SIDEBAR CONTAINER
   Matches old .sidebar exactly
   ══════════════════════════════════════════ */

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 30;
  flex-shrink: 0;
  transition: width var(--s-duration-normal) cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--s-color-bg-panel);
  border-right: 1px solid var(--s-color-border-subtle);
}

.sidebar.dragging {
  transition: none;
  user-select: none;
}

/* Overlay scrollbars — 4px, no layout shift */
.sidebar * {
  scrollbar-width: thin;
}
.sidebar ::-webkit-scrollbar {
  width: 4px;
}
.sidebar ::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar ::-webkit-scrollbar-thumb {
  background: var(--s-color-border-subtle);
  border-radius: var(--s-radius-1);
}
.sidebar ::-webkit-scrollbar-thumb:hover {
  background: var(--s-color-fg-muted);
}

/* ══════════════════════════════════════════
   SHELL HEADER ELEMENTS (logo, breadcrumbs, toggle)
   ══════════════════════════════════════════ */

.header-brand-btn {
  display: flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--s-space-0) var(--s-space-1);
  border-radius: var(--s-radius-1);
  transition:
    color 0.15s,
    opacity 0.2s ease,
    width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.header-brand-btn:hover {
  color: var(--s-color-fg-primary);
}

.sidebar-title {
  font-size: var(--s-font-size-1);
  font-weight: var(--s-font-weight-bold);
  margin: 0;
  color: var(--s-color-fg-primary);
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  border-radius: var(--s-radius-1);
  color: var(--s-color-fg-muted);
  cursor: pointer;
  transition: color var(--s-duration-fast) var(--s-ease-out);
}

.header-icon-btn:hover {
  color: var(--s-color-fg-primary);
}

/* Toggle icon: show open icon in rail, close icon when expanded */
.icon-panel-open {
  display: none;
}
.icon-panel-close {
  display: block;
}
.admin-shell[data-sidebar="rail"] .icon-panel-open {
  display: block;
}
.admin-shell[data-sidebar="rail"] .icon-panel-close {
  display: none;
}

/* ══════════════════════════════════════════
   BREADCRUMBS (between header and search)
   ══════════════════════════════════════════ */

.sidebar-breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--s-space-1);
  padding: var(--s-space-2) var(--s-space-3);
  font-size: var(--s-font-size-0);
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.2s ease;
  max-height: 30px;
}

.bc-link {
  color: var(--s-color-fg-muted);
  text-decoration: none;
  transition: color var(--s-duration-fast) var(--s-ease-out);
  flex-shrink: 0;
}

.bc-link:hover {
  color: var(--s-color-fg-primary);
}

.bc-sep {
  color: var(--s-color-fg-soft);
  flex-shrink: 0;
  font-size: var(--s-font-size-0);
}

.bc-current {
  color: var(--s-color-fg-primary);
  font-weight: var(--s-font-weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ══════════════════════════════════════════
   SEARCH ROW
   ══════════════════════════════════════════ */

.sidebar-search-row {
  padding: var(--s-space-1) var(--s-space-2);
  flex-shrink: 0;
  border-bottom: 1px solid var(--s-color-border-subtle);
}

.nav-search-field {
  display: flex;
  align-items: center;
  gap: var(--s-space-2);
  padding: 0 var(--s-space-3);
  margin: 0;
  height: 28px;
  background: oklch(0.5 0.04 var(--brand-hue, 180) / 0.03);
  border: 1px solid transparent;
  border-radius: var(--s-radius-1);
  transition:
    border-color 0.15s,
    opacity 0.2s ease;
  cursor: text;
}

.nav-search-field:focus-within {
  border-color: var(--s-color-border-subtle);
}

/* Rail mode: collapse search to icon only */
.sidebar[data-state="rail"] .nav-search-field {
  background: transparent;
  border-color: transparent;
  padding: 0 var(--s-space-3);
}

.sidebar[data-state="rail"] .sidebar-search-input,
.sidebar[data-state="rail"] .keyboard-hint,
.sidebar[data-state="rail"] .search-scope-chip {
  opacity: 0;
  pointer-events: none;
  width: 0;
  flex: 0;
  padding: 0;
  overflow: hidden;
}

.nav-search-icon-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  flex-grow: 0;
  color: var(--s-color-fg-muted);
}

.sidebar-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--s-font-size-1);
  color: var(--s-color-fg-primary);
  font-family: inherit;
  min-width: 0;
}

.sidebar-search-input::placeholder {
  color: var(--s-color-fg-muted);
}

.keyboard-hint {
  font-size: var(--s-font-size-0);
  padding: 1px var(--s-space-1);
  background: var(--s-color-bg-subtle);
  border: 1px solid var(--s-color-border-subtle);
  border-radius: var(--s-radius-1);
  color: var(--s-color-fg-muted);
  font-family: var(--s-font-mono);
  flex-shrink: 0;
}

/* Scope chip — shows context label + close button in search field during browse mode */
.search-scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 4px 1px 6px;
  font-family: var(--s-font-sans);
  font-size: 11px;
  line-height: 1;
  color: var(--brand-accent-dark);
  background: oklch(0.5 0.04 var(--brand-hue, 180) / 0.1);
  border: 1px solid oklch(0.5 0.04 var(--brand-hue, 180) / 0.15);
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    background var(--s-duration-fast) var(--s-ease-out),
    border-color var(--s-duration-fast) var(--s-ease-out);
}

.search-scope-chip:hover {
  background: oklch(0.5 0.04 var(--brand-hue, 180) / 0.18);
  border-color: oklch(0.5 0.04 var(--brand-hue, 180) / 0.25);
}

.search-scope-label {
  font-weight: var(--s-font-weight-medium);
}

.search-scope-close {
  font-size: 14px;
  line-height: 1;
  opacity: 0.5;
  transition: opacity var(--s-duration-fast) var(--s-ease-out);
}

.search-scope-chip:hover .search-scope-close {
  opacity: 1;
}

/* ══════════════════════════════════════════
   PANELS CONTAINER
   ══════════════════════════════════════════ */

.sidebar-panels {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar-panels.dragging,
.sidebar-panels.dragging .nav-column,
.sidebar-panels.dragging .telescope-panel,
.sidebar.dragging .header-brand-btn,
.sidebar.dragging .sidebar-breadcrumbs,
.sidebar.dragging .tree-item,
.sidebar.dragging .tree-nav,
.sidebar.dragging .nav-group-header,
.sidebar.dragging .tree-label,
.sidebar.dragging .sidebar-footer,
.sidebar.dragging .sidebar-footer *,
.sidebar.dragging .sidebar-search-row,
.sidebar.dragging .sidebar-search-row * {
  transition: none;
}

/* ══════════════════════════════════════════
   NAV COLUMN
   ══════════════════════════════════════════ */

.nav-column {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  transition: flex var(--s-duration-normal) cubic-bezier(0.4, 0, 0.2, 1);
}

/* In browse mode, nav keeps its natural width; browse panel takes the rest */
.sidebar[data-state="browse"] .nav-column {
  flex: 0 0 auto;
  width: 200px;
}

/* Fully hidden nav column (available but not used by browse mode) */
.nav-column.hidden {
  flex: 0 0 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.nav-column.compact {
  flex: 0 0 44px;
  overflow-y: auto;
}

/* Compact mode: zero out tree-nav padding so icons center in 44px rail */
.nav-column.compact .tree-nav {
  padding-left: 0;
  padding-right: 0;
}

/* Compact mode: tree items become icon-centered, tightly packed */
.nav-column.compact .tree-item {
  overflow: visible;
  justify-content: center;
  padding: 6px 0;
  min-height: 0;
  gap: 0;
}

/* Hide L2/L3 depth items entirely in compact — only L1 icons show */
.nav-column.compact .tree-item.depth-1,
.nav-column.compact .tree-item.depth-2 {
  display: none;
}

.nav-column.compact .tree-chevron {
  width: 0;
  overflow: hidden;
  opacity: 0;
}

.nav-column.compact .tree-label {
  opacity: 0;
  width: 0;
  flex: 0;
  overflow: hidden;
}

.nav-column.compact .nav-group-header {
  opacity: 0;
  pointer-events: none;
  height: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.nav-column.compact .tree-children {
  opacity: 0;
  pointer-events: none;
  max-height: 0 !important;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* ══════════════════════════════════════════
   TREE VIEW & NAV
   ══════════════════════════════════════════ */

.tree-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.tree-nav {
  display: flex;
  flex-direction: column;
  padding: var(--s-space-1) var(--s-space-2);
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  transition: padding var(--s-duration-normal) cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Nav Group Headers ── */

.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--s-space-1) var(--s-space-3);
  margin-top: var(--s-space-4);
  border-radius: var(--s-radius-1);
  transition:
    color 0.15s,
    height 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    margin 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.2s ease;
}

.nav-group-header:hover {
  color: var(--s-color-fg-primary);
}

.nav-group-header.active .nav-group-label {
  color: var(--s-color-fg-primary);
}

.nav-group-label {
  font-size: var(--s-font-size-0);
  font-weight: var(--s-font-weight-semibold);
  color: var(--s-color-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-group-chevron {
  color: var(--s-color-fg-muted);
  display: flex;
  align-items: center;
  opacity: 0.3;
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.nav-group-header:hover .nav-group-chevron {
  opacity: 0.85;
  transform: translateY(2px);
}

.nav-group-header.active .nav-group-chevron {
  opacity: 0.5;
}

/* ══════════════════════════════════════════
   TREE ITEMS (L0, L1, L2)
   ══════════════════════════════════════════ */

.tree-item {
  display: flex;
  align-items: center;
  gap: var(--s-space-4);
  padding: var(--s-space-1) var(--s-space-3);
  color: var(--s-color-fg-primary);
  text-decoration: none;
  transition:
    color 0.15s,
    background-color 0.15s,
    padding 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    gap 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  min-height: 28px;
  border-radius: var(--s-radius-1);
  font-size: var(--s-font-size-1);
  line-height: 1.2;
  overflow: hidden;
  cursor: pointer;
}

.tree-item.depth-1 {
  padding-left: 38px;
  font-size: var(--s-font-size-0);
  min-height: 26px;
}

.tree-item.depth-2 {
  padding-left: 52px;
  font-size: var(--s-font-size-0);
  min-height: 24px;
}

.tree-item:hover {
  color: var(--s-color-fg-primary);
  background: var(--s-color-bg-subtle);
}

.tree-item.active {
  color: var(--brand-accent-dark);
  font-weight: var(--s-font-weight-medium);
  background: oklch(0.5 0.04 var(--brand-hue, 180) / 0.06);
}

.tree-item.section-active {
  color: var(--s-color-fg-primary);
  font-weight: var(--s-font-weight-medium);
}

/* Has-children affordance */
.tree-item.has-children {
  cursor: pointer;
}

.tree-item.has-children:hover .tree-chevron {
  opacity: 1;
}

/* ── Tree Icon (16x16 Lucide icon slot) ── */

.tree-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  min-height: 16px;
  flex-shrink: 0;
  color: var(--s-color-fg-muted);
  transition: color var(--s-duration-fast) var(--s-ease-out);
  overflow: visible;
}

.tree-item:hover .tree-icon,
.tree-item.active .tree-icon {
  color: inherit;
}

/* ── Tree Label ── */

.tree-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    opacity 0.2s ease,
    width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Tree Chevron ── */

.tree-chevron {
  color: var(--s-color-fg-muted);
  display: flex;
  align-items: center;
  opacity: 0.3;
  flex-shrink: 0;
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.tree-item:hover .tree-chevron {
  opacity: 0.85;
  transform: translateY(2px);
}

.tree-item.section-active .tree-chevron {
  opacity: 0.5;
}

/* ── Browse Trigger Button ── */

.tree-browse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--s-radius-1);
  color: var(--s-color-fg-soft);
  opacity: 0;
  margin-left: auto;
  flex-shrink: 0;
  transition:
    opacity var(--s-duration-fast) var(--s-ease-out),
    color var(--s-duration-fast) var(--s-ease-out),
    background var(--s-duration-fast) var(--s-ease-out);
}

.tree-item:hover .tree-browse-btn {
  opacity: 1;
}

.tree-browse-btn:hover {
  color: var(--s-color-fg-primary);
  background: var(--s-color-bg-subtle);
}

/* Hide browse trigger in compact/rail mode */
.nav-column.compact .tree-browse-btn {
  display: none;
}

/* ── Create Button (sidebar +) ── */

.nav-create-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: var(--s-radius-1);
  background: transparent;
  color: var(--s-color-fg-soft);
  cursor: pointer;
  opacity: 0;
  margin-left: auto;
  flex-shrink: 0;
  transition:
    opacity var(--s-duration-fast) var(--s-ease-out),
    color var(--s-duration-fast) var(--s-ease-out),
    background var(--s-duration-fast) var(--s-ease-out);
}

.tree-item:hover .nav-create-btn {
  opacity: 1;
}

.nav-create-btn:hover {
  color: var(--s-color-fg-primary);
  background: var(--s-color-bg-subtle);
}

/* Hide create button in compact/rail mode */
.nav-column.compact .nav-create-btn {
  display: none;
}

[data-state="rail"] .nav-create-btn {
  display: none;
}

/* ── Tree Children (inline expand) ── */

.tree-children {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.12s ease-out;
}

.tree-children.expanded {
  max-height: 2000px;
  transition: max-height 0.25s ease-in;
}

/* ══════════════════════════════════════════
   TELESCOPE PANEL
   ══════════════════════════════════════════ */

.telescope-panel {
  flex: 0 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid transparent;
  transition:
    flex 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s ease;
  opacity: 0;
}

.telescope-panel.visible {
  flex: 1 1 0;
  overflow-y: auto;
  border-left-color: var(--s-color-border-subtle);
  opacity: 1;
  transition:
    flex 1.2s cubic-bezier(0.25, 0.1, 0.25, 1),
    border-color 1.2s cubic-bezier(0.25, 0.1, 0.25, 1),
    opacity 0.8s ease;
}

.telescope-nav {
  display: flex;
  flex-direction: column;
  padding: var(--s-space-1) 0 var(--s-space-1) var(--s-space-1);
  flex: 1;
  opacity: 1;
  transition: opacity var(--s-duration-slow) var(--s-ease-out);
}

.telescope-nav.content-fade {
  opacity: 0;
}

.telescope-item {
  display: flex;
  align-items: center;
  gap: var(--s-space-2);
  padding: var(--s-space-1) var(--s-space-0);
  color: var(--s-color-fg-primary);
  text-decoration: none;
  transition:
    color 0.15s,
    background-color 0.15s;
  white-space: nowrap;
  min-height: 26px;
  border-radius: var(--s-radius-1);
  font-size: var(--s-font-size-0);
  line-height: 1.2;
  cursor: pointer;
}

.telescope-item:hover {
  color: var(--s-color-fg-primary);
  background: var(--s-color-bg-subtle);
}

.telescope-item.active {
  color: var(--brand-accent-dark);
  font-weight: var(--s-font-weight-medium);
  background: oklch(0.5 0.04 var(--brand-hue, 180) / 0.06);
}

.telescope-item.section-active {
  color: var(--s-color-fg-primary);
  font-weight: var(--s-font-weight-medium);
}

.telescope-item.telescope-sub {
  padding-left: var(--s-space-4);
  font-size: var(--s-font-size-0);
  min-height: 24px;
}

.telescope-no-matches {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-space-1);
  padding: var(--s-space-5) var(--s-space-3);
  text-align: center;
}

.no-matches-text {
  font-size: var(--s-font-size-0);
  color: var(--s-color-fg-muted);
}

.no-matches-hint {
  font-size: var(--s-font-size-0);
  color: var(--s-color-fg-soft);
}

/* ══════════════════════════════════════════
   L3 BROWSE PANEL
   Back button, title, search, scrollable item list
   ══════════════════════════════════════════ */

.browse-panel-back {
  display: flex;
  align-items: center;
  gap: var(--s-space-2);
  padding: var(--s-space-2) var(--s-space-2);
  margin-bottom: var(--s-space-1);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--s-font-sans);
  font-size: var(--s-font-size-0);
  color: var(--s-color-fg-muted);
  border-radius: var(--s-radius-1);
  transition:
    color var(--s-duration-fast) var(--s-ease-out),
    background var(--s-duration-fast) var(--s-ease-out);
}

.browse-panel-back:hover {
  color: var(--s-color-fg-primary);
  background: var(--s-color-bg-subtle);
}

.browse-panel-title {
  font-size: var(--s-font-size-1);
  font-weight: var(--s-font-weight-semibold);
  color: var(--s-color-fg-primary);
  padding: 0 var(--s-space-2);
  margin-bottom: var(--s-space-3);
}

.browse-panel-search {
  padding: 0 var(--s-space-2);
  margin-bottom: var(--s-space-3);
}

.browse-panel-search-input {
  width: 100%;
  padding: var(--s-space-2) var(--s-space-3);
  font-family: var(--s-font-sans);
  font-size: var(--s-font-size-0);
  color: var(--s-color-fg-primary);
  background: var(--s-color-bg-surface);
  border: 1px solid var(--s-color-border-subtle);
  border-radius: var(--s-radius-1);
  outline: none;
  transition: border-color var(--s-duration-fast) var(--s-ease-out);
  box-sizing: border-box;
}

.browse-panel-search-input:focus {
  border-color: var(--s-color-focus-border);
}

.browse-panel-search-input::placeholder {
  color: var(--s-color-fg-soft);
}

.browse-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-space-1) var(--s-space-1);
}

.browse-panel-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 5px var(--s-space-2);
  font-family: var(--s-font-sans);
  font-size: var(--s-font-size-0);
  line-height: 1.4;
  color: var(--s-color-fg-secondary);
  background: none;
  border: none;
  border-radius: var(--s-radius-1);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    color var(--s-duration-fast) var(--s-ease-out),
    background var(--s-duration-fast) var(--s-ease-out);
}

.browse-panel-item:hover {
  color: var(--s-color-fg-primary);
  background: var(--s-color-bg-subtle);
}

.browse-panel-item.active {
  color: var(--brand-accent-dark);
  font-weight: var(--s-font-weight-medium);
  background: oklch(0.5 0.04 var(--brand-hue, 180) / 0.06);
}

.browse-panel-empty {
  padding: var(--s-space-4) var(--s-space-2);
  font-size: var(--s-font-size-0);
  color: var(--s-color-fg-soft);
  text-align: center;
}

/* ══════════════════════════════════════════
   BREADCRUMBS (in main header)
   ══════════════════════════════════════════ */

.s-breadcrumbs {
  font-family: var(--s-font-sans);
  font-size: var(--s-font-size-0);
}

.s-breadcrumbs__list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.s-breadcrumbs__item {
  display: flex;
  align-items: center;
  gap: var(--s-space-1);
}

.s-breadcrumbs__link {
  color: var(--s-color-fg-muted);
  text-decoration: none;
  padding: 1px var(--s-space-1);
  border-radius: var(--s-radius-1);
  transition:
    color var(--s-duration-fast) var(--s-ease-out),
    background var(--s-duration-fast) var(--s-ease-out);
}

.s-breadcrumbs__link:hover {
  color: var(--s-color-fg-primary);
  background: var(--s-color-hover-bg);
}

.s-breadcrumbs__separator {
  color: var(--s-color-fg-soft);
  user-select: none;
}

.s-breadcrumbs__current {
  color: var(--s-color-fg-primary);
  font-weight: var(--s-font-weight-medium);
}

/* ══════════════════════════════════════════
   RESIZE HANDLE
   ══════════════════════════════════════════ */

.sidebar-resize-handle {
  position: absolute;
  right: -3px;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: var(--s-z-raised);
  transition: background var(--s-duration-fast) var(--s-ease-out);
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle[data-dragging="true"] {
  background: var(--s-color-prominent-bg);
  opacity: 0.4;
}

/* ══════════════════════════════════════════
   RAIL TOOLTIP
   Matches old: brandscale bg/fg/border, 0.12s fade
   ══════════════════════════════════════════ */

.rail-tooltip {
  position: fixed;
  z-index: var(--s-z-max, 9999);
  transform: translateY(-50%);
  padding: var(--s-space-1) var(--s-space-3);
  background: var(--s-brand-200);
  color: var(--s-brand-800);
  font-size: var(--s-font-size-0);
  font-weight: var(--s-font-weight-medium);
  line-height: 1.3;
  border-radius: var(--s-radius-1);
  border: 1px solid var(--s-brand-300);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.rail-tooltip.visible {
  opacity: 1;
  animation: rail-tooltip-in 0.12s ease;
}

@keyframes rail-tooltip-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ══════════════════════════════════════════
   MAIN CONTENT AREA
   ══════════════════════════════════════════ */

.main-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ── Shell header breadcrumb (L1 section only) ── */
.shell-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--s-space-1);
}

.shell-breadcrumb-sep {
  font-size: 12px;
  color: var(--s-color-fg-soft);
}

.shell-breadcrumb-link {
  font-size: var(--s-font-size-1);
  font-weight: 500;
  color: var(--s-color-fg-muted);
  text-decoration: none;
  white-space: nowrap;
}
.shell-breadcrumb-link:hover {
  color: var(--s-color-fg-primary);
}

/* Density toggle — show only the icon matching the active density mode */
.density-icon {
  display: none;
}
[data-density="condensed"] .density-icon--condensed {
  display: block;
}
[data-density="standard"] .density-icon--standard,
:root:not([data-density]) .density-icon--standard {
  display: block;
}
[data-density="expanded"] .density-icon--expanded {
  display: block;
}

/* Content Area */
.content-area {
  flex: 1;
  overflow: auto;
  padding: var(--s-space-5);
}

.content-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--s-space-5);
  color: var(--s-color-fg-soft);
}

.placeholder-icon {
  font-size: 48px;
  opacity: 0.5;
}

.content-placeholder p {
  font-size: var(--s-font-size-1);
  margin: 0;
}

/* ══════════════════════════════════════════
   COMMAND PALETTE
   ══════════════════════════════════════════ */

.command-palette-backdrop[hidden] {
  display: none !important;
}

.command-palette-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--s-color-backdrop-scrim, oklch(0.25 0.01 180 / 0.75));
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: var(--s-space-7);
  z-index: var(--s-z-modal-backdrop);
  animation: fadeIn var(--s-duration-fast) var(--s-ease-out);
}

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

.command-palette {
  background: var(--s-surface-elevation-1-bg);
  border: 1px solid var(--s-color-border-strong);
  border-radius: var(--s-radius-3);
  width: 90%;
  max-width: 500px;
  overflow: hidden;
  box-shadow: var(--s-shadow-xl);
  animation: slideDown var(--s-duration-normal) var(--s-ease-out);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.command-palette-header {
  padding: var(--s-space-4);
  border-bottom: 1px solid var(--s-color-border-subtle);
}

.command-palette-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: var(--s-font-size-1);
  color: var(--s-color-fg-primary);
  font-family: var(--font-sans, "Figtree", sans-serif);
  padding: var(--s-space-3) 0;
}

.command-palette-input:focus {
  border: none;
  outline: none;
}

.command-palette-input::placeholder {
  color: var(--s-color-fg-soft);
}

.command-palette-results {
  max-height: 300px;
  overflow-y: auto;
  padding: var(--s-space-3) 0;
}

.command-palette-empty {
  padding: var(--s-space-5) var(--s-space-4);
  text-align: center;
  color: var(--s-color-fg-soft);
  font-size: var(--s-font-size-0);
}

.command-palette-footer {
  padding: var(--s-space-3) var(--s-space-4);
  border-top: 1px solid var(--s-color-border-subtle);
  font-size: var(--s-font-size-0);
  color: var(--s-color-fg-soft);
  display: flex;
  justify-content: flex-end;
}

.command-palette-hint {
  display: flex;
  gap: var(--s-space-2);
  align-items: center;
}

.command-palette-hint kbd {
  background: var(--s-color-bg-subtle);
  color: var(--s-color-fg-muted);
  padding: var(--s-space-2) var(--s-space-3);
  border-radius: var(--s-radius-1);
  font-family: var(--s-font-mono);
  font-size: var(--s-font-size-min);
  font-weight: 500;
}

/* Command Palette Results */
.command-palette-result {
  display: flex;
  align-items: center;
  gap: var(--s-space-3);
  padding: var(--s-space-3) var(--s-space-4);
  cursor: pointer;
  transition: background var(--s-duration-fast) var(--s-ease-out);
}

.command-palette-result:hover,
.command-palette-result:focus-visible {
  background: var(--s-color-hover-bg, var(--s-color-bg-subtle));
  outline: none;
}

.command-result-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--s-color-fg-muted);
}

.command-result-label {
  font-size: var(--s-font-size-1);
  color: var(--s-color-fg-primary);
  font-weight: 500;
}

.command-result-path {
  font-size: var(--s-font-size-0);
  color: var(--s-color-fg-soft);
  margin-left: auto;
}

/* ══════════════════════════════════════════
   FOCUS RINGS (Accessibility)
   ══════════════════════════════════════════ */

.header-icon-btn:focus-visible,
.header-brand-btn:focus-visible,
.header-action:focus-visible,
.nav-group-header:focus-visible,
.tree-item:focus-visible,
.telescope-item:focus-visible,
.command-palette-input:focus-visible {
  outline: 2px solid var(--s-color-focus-border);
  outline-offset: -2px;
  border-radius: var(--s-radius-1);
}

/* ══════════════════════════════════════════
   SIDEBAR FOOTER (ported from SidebarFooter.svelte)
   ══════════════════════════════════════════ */

.sidebar-footer {
  border-top: 1px solid var(--s-color-border-subtle);
  flex-shrink: 0;
  position: relative;
}

/* ── Expanded Mode ── */
.sidebar-footer .footer-row {
  display: flex;
  align-items: center;
  gap: var(--s-space-2);
  padding: var(--s-space-3) var(--s-space-4);
  width: 100%;
}

.sidebar-footer .footer-compact {
  display: none;
}

/* Rail mode: swap layouts */
.sidebar[data-state="rail"] .sidebar-footer .footer-row {
  display: none;
}

.sidebar[data-state="rail"] .sidebar-footer .footer-compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-space-1);
  padding: var(--s-space-3) 0;
  width: 100%;
}

/* Avatar */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--s-brand-200);
  color: var(--s-brand-700);
  font-size: var(--s-font-size-0);
  font-weight: var(--s-font-weight-semibold);
  line-height: 1;
  user-select: none;
}

.avatar-xs {
  width: 22px;
  height: 22px;
  font-size: 10px;
}

.footer-avatar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Identity: name + role */
.footer-identity {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 0;
}

.footer-name {
  font-size: var(--s-font-size-0);
  font-weight: var(--s-font-weight-medium);
  color: var(--s-color-fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.footer-role-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-space-1);
  padding: 1px var(--s-space-1) 1px 0;
  margin: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--s-radius-1);
  transition: background-color var(--s-duration-fast) var(--s-ease-out);
  max-width: fit-content;
}

.footer-role-btn:hover {
  background: var(--s-color-hover-bg);
}

.footer-role {
  font-size: var(--s-font-size-0);
  color: var(--s-color-fg-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.footer-chevron {
  color: var(--s-color-fg-muted);
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity var(--s-duration-fast) var(--s-ease-out);
}

.footer-role-btn:hover .footer-chevron {
  opacity: 1;
}

/* Action buttons (expanded) */
.footer-actions {
  display: flex;
  align-items: center;
  gap: var(--s-space-1);
  flex-shrink: 0;
}

.footer-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  border-radius: var(--s-radius-1);
  color: var(--s-color-fg-muted);
  cursor: pointer;
  transition:
    background-color 0.15s,
    color 0.15s;
  text-decoration: none;
}

.footer-action-btn:hover {
  background: var(--s-color-hover-bg);
  color: var(--s-color-fg-primary);
}

/* Rail buttons (compact) */
.footer-rail-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: var(--s-radius-1);
  color: var(--s-color-fg-muted);
  cursor: pointer;
  transition:
    background-color 0.15s,
    color 0.15s;
  text-decoration: none;
}

.footer-rail-btn:hover {
  background: var(--s-color-hover-bg);
  color: var(--s-color-fg-primary);
}

/* ── Status Indicator ── */
.status-indicator {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--s-color-status-success);
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}

.status-btn:hover .status-indicator {
  transform: scale(1.3);
  box-shadow: 0 0 0 2px oklch(0.95 0.02 145);
}

.status-indicator.online {
  background: var(--s-color-status-success);
}

.status-indicator.degraded {
  background: var(--s-color-status-warning);
}

.status-indicator.offline {
  background: var(--s-color-status-danger);
}

.status-indicator.placeholder {
  background: var(--s-color-fg-muted);
  opacity: 0.3;
}

/* ── Status Popover (portaled to body) ── */
.status-popover {
  position: fixed;
  z-index: 1000;
  background: var(--s-color-bg-panel);
  border: 1px solid var(--s-color-border-subtle);
  border-radius: var(--s-radius-2);
  box-shadow: 0 4px 16px oklch(0 0 0 / 0.12);
  min-width: 220px;
  max-width: 300px;
  overflow: hidden;
  font-family: var(--font-sans, "Figtree", sans-serif);
  opacity: 0;
  transition: opacity 100ms ease-out;
}

.status-popover.visible {
  opacity: 1;
}

.status-popover .popover-header {
  display: flex;
  align-items: center;
  gap: var(--s-space-3);
  padding: var(--s-space-3) var(--s-space-4);
  border-bottom: 1px solid var(--s-color-border-subtle);
  background: var(--s-color-bg-subtle);
}

.status-popover .popover-title {
  flex: 1;
  font-size: var(--s-font-size-0);
  font-weight: var(--s-font-weight-semibold);
  color: var(--s-color-fg-primary);
}

.status-popover .popover-summary {
  font-size: var(--s-font-size-0);
  font-weight: var(--s-font-weight-medium);
  padding: var(--s-space-0) var(--s-space-2);
  border-radius: 999px;
}

.status-popover .popover-summary.online {
  background: oklch(0.95 0.05 145);
  color: oklch(0.35 0.15 145);
}

.status-popover .popover-summary.degraded {
  background: oklch(0.95 0.05 85);
  color: oklch(0.4 0.15 85);
}

.status-popover .popover-summary.offline {
  background: oklch(0.95 0.05 25);
  color: oklch(0.4 0.15 25);
}

.status-popover .popover-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  margin-left: var(--s-space-1);
  border: none;
  background: transparent;
  border-radius: var(--s-radius-1);
  color: var(--s-color-fg-muted);
  cursor: pointer;
  transition:
    background-color 0.15s,
    color 0.15s;
  flex-shrink: 0;
}

.status-popover .popover-close-btn:hover {
  background: var(--s-color-bg-panel);
  color: var(--s-color-fg-primary);
}

.status-popover .popover-services {
  list-style: none;
  margin: 0;
  padding: var(--s-space-3) 0;
}

.status-popover .popover-service {
  display: flex;
  align-items: center;
  gap: var(--s-space-3);
  padding: var(--s-space-2) var(--s-space-4);
  font-size: var(--s-font-size-0);
}

.status-popover .service-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-popover .service-dot.online {
  background: var(--s-color-status-success);
}
.status-popover .service-dot.degraded {
  background: var(--s-color-status-warning);
}
.status-popover .service-dot.offline {
  background: var(--s-color-status-danger);
}

.status-popover .service-name {
  flex: 1;
  color: var(--s-color-fg-primary);
}

.status-popover .service-status {
  font-size: var(--s-font-size-0);
  text-transform: capitalize;
}

.status-popover .service-status.online {
  color: oklch(0.45 0.15 145);
}
.status-popover .service-status.degraded {
  color: oklch(0.5 0.15 85);
}
.status-popover .service-status.offline {
  color: oklch(0.5 0.15 25);
}

.status-popover .popover-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-space-1);
  padding: var(--s-space-3) var(--s-space-4);
  border-top: 1px solid var(--s-color-border-subtle);
  font-size: var(--s-font-size-0);
  color: var(--s-color-fg-muted);
  text-decoration: none;
  transition:
    background-color 0.15s,
    color 0.15s;
}

.status-popover .popover-link:hover {
  background: var(--s-color-bg-subtle);
  color: var(--s-color-fg-primary);
}

/* ══════════════════════════════════════════
   FOOTER POPOVERS (account menu, feedback)
   Portaled to document.body, same as status popover
   ══════════════════════════════════════════ */

.footer-popover {
  position: fixed;
  z-index: 1000;
  background: var(--s-color-bg-panel);
  border: 1px solid var(--s-color-border-subtle);
  border-radius: var(--s-radius-2);
  box-shadow: 0 4px 16px oklch(0 0 0 / 0.12);
  min-width: 180px;
  max-width: 300px;
  overflow: hidden;
  font-family: var(--font-sans, "Figtree", sans-serif);
  opacity: 0;
  transition: opacity 100ms ease-out;
}

.footer-popover.visible {
  opacity: 1;
}

/* ── Account Menu ── */

.account-menu {
  padding: var(--s-space-2) 0;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--s-space-3);
  width: 100%;
  padding: var(--s-space-2) var(--s-space-4);
  border: none;
  background: none;
  cursor: pointer;
  font-size: var(--s-font-size-0);
  color: var(--s-color-fg-primary);
  font-family: inherit;
  transition:
    background-color 0.1s,
    color 0.1s;
  text-align: left;
}

.menu-item:hover {
  background: var(--s-color-hover-bg);
}

.menu-item-danger {
  color: var(--s-color-status-danger);
}

.menu-item-danger:hover {
  background: oklch(0.96 0.04 19);
}

[data-theme="dark"] .menu-item-danger:hover {
  background: oklch(0.2 0.04 19);
}

.menu-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--s-color-fg-muted);
}

.menu-item:hover .menu-item-icon {
  color: inherit;
}

.menu-item-label {
  flex: 1;
}

.menu-separator {
  height: 1px;
  background: var(--s-color-border-subtle);
  margin: var(--s-space-2) 0;
}

/* ── Feedback Popover ── */

.feedback-popover {
  min-width: 280px;
  max-width: 340px;
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: var(--s-space-3);
  padding: var(--s-space-3) var(--s-space-4);
  border-bottom: 1px solid var(--s-color-border-subtle);
}

.feedback-title {
  flex: 1;
  font-size: var(--s-font-size-0);
  font-weight: var(--s-font-weight-semibold);
  color: var(--s-color-fg-primary);
}

.feedback-body {
  padding: var(--s-space-3) var(--s-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-space-3);
}

.feedback-type-row {
  display: flex;
  gap: var(--s-space-2);
}

.feedback-type-btn {
  display: flex;
  align-items: center;
  gap: var(--s-space-1);
  padding: var(--s-space-1) var(--s-space-3);
  border: 1px solid var(--s-color-border-subtle);
  border-radius: var(--s-radius-1);
  background: transparent;
  color: var(--s-color-fg-muted);
  font-size: var(--s-font-size-0);
  font-family: inherit;
  cursor: pointer;
  transition:
    background-color 0.1s,
    color 0.1s,
    border-color 0.1s;
}

.feedback-type-btn:hover {
  background: var(--s-color-bg-subtle);
  color: var(--s-color-fg-primary);
}

.feedback-type-btn.active {
  background: oklch(0.5 0.04 var(--brand-hue, 180) / 0.08);
  border-color: oklch(0.5 0.04 var(--brand-hue, 180) / 0.2);
  color: var(--s-color-fg-primary);
}

.feedback-textarea {
  width: 100%;
  min-height: 80px;
  padding: var(--s-space-2) var(--s-space-3);
  border: 1px solid var(--s-color-border-subtle);
  border-radius: var(--s-radius-1);
  background: transparent;
  color: var(--s-color-fg-primary);
  font-size: var(--s-font-size-0);
  font-family: inherit;
  line-height: var(--s-font-line-height-normal);
  resize: vertical;
  transition: border-color 0.15s;
}

.feedback-textarea:focus {
  outline: none;
  border-color: var(--s-color-focus-border);
}

.feedback-textarea::placeholder {
  color: var(--s-color-fg-soft);
}

.feedback-footer {
  padding: var(--s-space-2) var(--s-space-4) var(--s-space-3);
  display: flex;
  justify-content: flex-end;
}

.feedback-submit-btn {
  padding: var(--s-space-1) var(--s-space-4);
  border: none;
  border-radius: var(--s-radius-1);
  background: var(--s-color-prominent-bg);
  color: var(--s-color-prominent-fg);
  font-size: var(--s-font-size-0);
  font-weight: var(--s-font-weight-medium);
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.15s;
}

.feedback-submit-btn:hover {
  background: var(--s-color-prominent-bg-hover);
}

.feedback-sent {
  text-align: center;
  font-size: var(--s-font-size-0);
  color: var(--s-color-fg-muted);
  padding: var(--s-space-3) 0;
  margin: 0;
}

/* Focus rings for footer buttons */
.footer-action-btn:focus-visible,
.footer-rail-btn:focus-visible,
.footer-role-btn:focus-visible,
.status-btn:focus-visible {
  outline: 2px solid var(--s-color-focus-border);
  outline-offset: -2px;
  border-radius: var(--s-radius-1);
}

/* ══════════════════════════════════════════
   DARK MODE OVERRIDES
   ══════════════════════════════════════════ */

[data-theme="dark"] .tree-item.active {
  color: var(--brand-accent-light);
  background: oklch(0.5 0.04 var(--brand-hue, 180) / 0.1);
}

[data-theme="dark"] .telescope-item.active {
  color: var(--brand-accent-light);
  background: oklch(0.5 0.04 var(--brand-hue, 180) / 0.1);
}

/* ══════════════════════════════════════════
   IFRAME EMBED (for press/authoring etc.)
   ══════════════════════════════════════════ */

.content-area.has-iframe,
.content-area.has-lab {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.lab-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ══════════════════════════════════════════
   LAB SOURCE PATH (placeholder pages)
   ══════════════════════════════════════════ */

.lab-source-path {
  font-size: var(--s-font-size-0);
  color: var(--s-color-fg-soft);
  font-family: var(--s-font-mono);
}

/* ══════════════════════════════════════════
   REDUCED MOTION
   ══════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .admin-shell,
  .sidebar,
  .sidebar-header,
  .header-brand-btn,
  .header-icon-btn,
  .nav-search-field,
  .nav-column,
  .tree-nav,
  .tree-item,
  .tree-label,
  .tree-chevron,
  .tree-children,
  .telescope-panel,
  .telescope-nav,
  .telescope-item,
  .telescope-indicator,
  .nav-group-header,
  .nav-group-chevron,
  .sidebar-breadcrumbs,
  .rail-tooltip,
  .sidebar-resize-handle,
  .command-palette-backdrop,
  .command-palette {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}

/* ══════════════════════════════════════════
   LARGE POPOVER / MODAL (portal-based)
   Shared component for full-screen modals
   ══════════════════════════════════════════ */

.large-popover-container {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--s-duration-normal) var(--s-ease-out);
}

.large-popover-container.large-popover-visible {
  opacity: 1;
}

.large-popover-scrim {
  position: absolute;
  inset: 0;
  background: var(--s-color-backdrop-scrim);
  cursor: pointer;
}

.large-popover-modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: calc(100vw - 120px);
  height: calc(100vh - 80px);
  max-width: 1400px;
  max-height: 900px;
  background: var(--s-color-bg-surface);
  border-radius: var(--s-radius-3);
  box-shadow: none;
  overflow: hidden;
}

.large-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-space-5);
  padding: var(--s-space-5) var(--s-space-6);
  border-bottom: 1px solid var(--s-color-border-subtle);
  background: var(--s-color-bg-surface);
  flex-shrink: 0;
}

.large-popover-title {
  margin: 0;
  padding: 0;
  font-size: var(--s-font-size-2);
  font-weight: 600;
  color: var(--s-color-fg-primary);
  line-height: var(--s-font-line-height-tight);
}

.large-popover-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  border-radius: var(--s-radius-2);
  color: var(--s-color-fg-muted);
  cursor: pointer;
  transition:
    background-color var(--s-duration-fast) var(--s-ease-out),
    color var(--s-duration-fast) var(--s-ease-out);
  flex-shrink: 0;
}

.large-popover-close-btn:hover {
  background: var(--s-color-hover-bg);
  color: var(--s-color-fg-primary);
}

.large-popover-close-btn:active {
  background: var(--s-color-bg-active);
}

.large-popover-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--s-color-bg-surface);
  padding: var(--s-space-6);
}

.large-popover-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--s-color-bg-surface);
}

/* ── Small screen layout ── */
@media (max-width: 768px) {
  .large-popover-modal {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .large-popover-header {
    padding: var(--s-space-4) var(--s-space-5);
  }

  .large-popover-body {
    padding: var(--s-space-4) var(--s-space-5);
  }

  .large-popover-title {
    font-size: var(--s-font-size-1);
  }
}

/* ══════════════════════════════════════════
   RESPONSIVE (mobile)
   ══════════════════════════════════════════ */

@media (max-width: 768px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 999;
    width: 248px;
  }

  .sidebar[data-state="rail"] {
    transform: translateX(-248px);
  }

  .main-content {
    width: 100%;
  }
}

/* Content-area and command-palette scrollbars */
.tree-nav::-webkit-scrollbar,
.command-palette-results::-webkit-scrollbar,
.content-area::-webkit-scrollbar {
  width: 4px;
}

.tree-nav::-webkit-scrollbar-track,
.command-palette-results::-webkit-scrollbar-track,
.content-area::-webkit-scrollbar-track {
  background: transparent;
}

.tree-nav::-webkit-scrollbar-thumb,
.command-palette-results::-webkit-scrollbar-thumb,
.content-area::-webkit-scrollbar-thumb {
  background: var(--s-color-border-subtle);
  border-radius: var(--s-radius-1);
}

.tree-nav::-webkit-scrollbar-thumb:hover,
.command-palette-results::-webkit-scrollbar-thumb:hover,
.content-area::-webkit-scrollbar-thumb:hover {
  background: var(--s-color-fg-muted);
}
