/* ============================================================
   BeirutFlow Shell — Windows-metaphor admin chrome.
   Desktop (>=768px): bottom taskbar + Start panel (#s-sidebar) + Win11
   hover previews + flyout submenus. Mobile (<768px): top header kept,
   taskbar hidden, Chrome-style tab-switcher overlay.

   State: localStorage only (taskbar.js). Worst-case failure is cosmetic.
   ============================================================ */

:root {
  --s-taskbar-h: 48px;
  --shell-radius: 12px;
  --shell-bg: var(--s-card-solid-bg);
  --shell-border: var(--s-card-border);
  --shell-accent: var(--bs-primary);
  --shell-shadow: 0 10px 34px rgba(15, 23, 42, 0.18);     /* floating popups */
  --shell-shadow-up: 0 -1px 12px rgba(15, 23, 42, 0.10);  /* taskbar top edge */
  --shell-hover: rgba(15, 23, 42, 0.06);
  --shell-hover-strong: rgba(15, 23, 42, 0.10);
  --shell-chip: rgba(15, 23, 42, 0.045);   /* faint container shared by all tabs */
}

/* Dark theme: the shell border/hover values above are tuned for light surfaces
   (dark ink on light). On the dark Start panel they vanish — re-tint to light
   alphas so dividers, the brand/search/footer rules, and hover states stay
   visible. This is the main reason dark mode felt "empty / unseparated". */
:root.theme-cosmos-dark {
  --shell-border: rgba(255, 255, 255, 0.12);
  --shell-hover: rgba(255, 255, 255, 0.06);
  --shell-hover-strong: rgba(255, 255, 255, 0.10);
  --shell-chip: rgba(255, 255, 255, 0.05);
}

/* ═══════════════════════════════════════════════════════════════
   TASKBAR (desktop only)
   ═══════════════════════════════════════════════════════════════ */
.s-taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--s-taskbar-h);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 10px;
  background: var(--s-sidebar-bg, rgba(252, 254, 255, 0.92));
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-top: 1px solid var(--shell-border);
  box-shadow: var(--shell-shadow-up);
  z-index: 1100;
}
@media (max-width: 767.98px) {
  .s-taskbar { display: none !important; }
}

/* ── Start button (SVG Windows logo) ─────────────────────────── */
/* Serenity hides bare .s-sidebar-toggler at desktop widths; force it. */
.s-taskbar-start {
  display: inline-flex !important;
  visibility: visible !important;
  align-items: center;
  justify-content: center;
  width: 40px !important;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 9px;
  background: var(--shell-accent);
  color: #fff;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.s-taskbar-start:hover { filter: brightness(1.08); }
.s-taskbar-start:active { transform: scale(0.95); }
body.s-sidebar-expanded .s-taskbar-start { filter: brightness(0.9); }
/* Logo glyph rendered as a flat white silhouette on the accent button. */
.s-taskbar-start .s-start-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  pointer-events: none;
  filter: brightness(0) invert(1);
}
/* Dark theme: show the logo in its original colors (no white silhouette). */
.theme-cosmos-dark .s-taskbar-start .s-start-logo { filter: none; }

/* ── Tabs strip (icon-only, fixed width — never expands) ─────── */
.s-taskbar-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.s-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 36px;
  flex-shrink: 0;
  position: relative;
  border-radius: 9px;
  color: var(--s-sidebar-link);
  background: var(--shell-chip);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.s-tab:hover { background: var(--shell-hover-strong); color: var(--bs-body-color); }
.s-tab .s-tab-icon { font-size: 1.05rem; }

/* Open "window" tabs carry a text label (pins stay icon-only). */
.s-tab.s-tab-wide {
  width: auto;
  max-width: 168px;
  padding: 0 10px;
  gap: 0.45rem;
  justify-content: flex-start;
}
.s-tab.is-active.s-tab-wide { max-width: 220px; }
.s-tab-label {
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* When the bar is crowded, open tabs collapse back to icon-only before any
   tab is folded into the overflow flyout. */
.s-tab-collapsed {
  width: 40px !important;
  padding: 0 !important;
  justify-content: center !important;
}
.s-tab-collapsed .s-tab-label { display: none; }

/* State indicators (Windows-like). All tabs share one faint chip container
   (set on .s-tab); open windows are marked by their underline, the active tab
   is clearly accent-filled. */
.s-tab.is-active {
  background: rgba(62, 111, 176, 0.24);
  color: var(--shell-accent);
}
.s-tab-dragging { opacity: 0.45; }   /* tab being drag-reordered */
.s-tab.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 2px;
  width: 60%;
  min-width: 18px;
  height: 3px;
  border-radius: 3px;
  background: var(--shell-accent);
}
/* Open window (not focused): a short, muted GREY tick — quiet, clearly
   different from the active tab's wide accent bar. */
.s-tab.is-running:not(.is-active)::after,
.s-tab.is-history:not(.is-active)::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 3px;
  width: 12px;
  height: 3px;
  border-radius: 3px;
  background: rgba(90, 100, 115, 0.55);
}

/* ── Overflow chevron + flyout list ──────────────────────────── */
.s-taskbar-overflow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--s-sidebar-icon);
  cursor: pointer;
  transition: background 0.15s ease;
}
.s-taskbar-overflow:hover { background: var(--shell-hover-strong); }
.s-taskbar-overflow[hidden] { display: none; }

/* ── System tray (right end): language + theme quick settings ───── */
/* .s-taskbar-tabs is flex:1, so the tray is pushed to the far end. */
.s-taskbar-tray {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  flex-shrink: 0;
  margin-inline-start: 0.25rem;
  padding-inline-start: 0.35rem;
  border-inline-start: 1px solid var(--shell-border);
}
.s-taskbar-tray .s-control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 36px;
  border-radius: 9px;
  background: transparent;
  color: var(--s-sidebar-icon);
  font-size: 1.05rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.s-taskbar-tray .s-control-btn:hover { background: var(--shell-hover-strong); }
.s-taskbar-tray .show > .s-control-btn { background: var(--shell-hover-strong); }
/* Dropups float just above the taskbar; keep them over the tab strip. */
.s-taskbar-tray .dropdown-menu {
  z-index: 1102;
  margin-bottom: 0.4rem;
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius);
  box-shadow: var(--shell-shadow);
}

.s-taskbar-flyout {
  position: fixed;
  bottom: calc(var(--s-taskbar-h) + 8px);
  min-width: 220px;
  max-width: 300px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--shell-radius);
  background: var(--shell-bg);
  border: 1px solid var(--shell-border);
  box-shadow: var(--shell-shadow);
  z-index: 1102;
}
.s-taskbar-flyout[hidden] { display: none; }
.s-flyout-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 8px 11px;
  border-radius: 8px;
  color: var(--s-input-text);
  text-decoration: none;
  font-size: 0.875rem;
}
.s-flyout-item:hover { background: var(--bs-primary-bg-subtle); color: var(--shell-accent); }
.s-flyout-item .fa { width: 1.1rem; text-align: center; }

/* ── Win11 hover preview popover ─────────────────────────────── */
.s-tab-preview {
  position: fixed;
  z-index: 1104;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 260px;
  padding: 7px 8px 7px 11px;
  border-radius: 10px;
  background: var(--shell-bg);
  border: 1px solid var(--shell-border);
  box-shadow: var(--shell-shadow);
  animation: s-pop-in 0.12s ease;
}
.s-tab-preview[hidden] { display: none; }
@keyframes s-pop-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.s-tp-icon { font-size: 1rem; color: var(--shell-accent); flex-shrink: 0; }
.s-tp-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--bs-body-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.s-tp-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--bs-secondary-color);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.s-tp-close:hover { background: var(--shell-hover-strong); color: var(--bs-body-color); }

/* ── Tab context menu (right-click) ──────────────────────────── */
.s-taskbar-ctx {
  position: fixed;
  min-width: 180px;
  padding: 6px;
  border-radius: 10px;
  background: var(--shell-bg);
  border: 1px solid var(--shell-border);
  box-shadow: var(--shell-shadow);
  z-index: 1105;
}
.s-taskbar-ctx[hidden] { display: none; }
.s-ctx-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 8px 11px;
  border-radius: 7px;
  color: var(--s-input-text);
  font-size: 0.875rem;
  cursor: pointer;
}
.s-ctx-item:hover { background: var(--bs-primary-bg-subtle); color: var(--shell-accent); }
.s-ctx-item .fa { width: 1.05rem; text-align: center; }
.s-ctx-sep { height: 1px; margin: 5px 6px; background: var(--shell-border); }

/* Start-panel brand is desktop-shell only; hidden everywhere else. */
.s-start-brand { display: none; }

/* ── Start "Pinned" grid (Win11-style favorites) ─────────────────── */
.s-start-pins[hidden] { display: none; }
.s-startpins-head {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
  padding: 0 0.35rem 0.4rem;
}
.s-startpins-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
}
/* Pin row caps: desktop shows at most 2 rows (8 tiles), mobile a single row
   (4 tiles). Extra pins (shared across devices via localStorage) are hidden
   rather than wrapping into more rows. */
.s-startpins-grid > a:nth-child(n + 9) { display: none; }
@media (max-width: 767.98px) {
  .s-startpins-grid > a:nth-child(n + 5) { display: none; }
}
.s-startpin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.55rem 0.25rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--s-input-text);
  text-align: center;
  transition: background 0.15s ease;
  /* Let the 1fr grid track shrink — without this the item keeps its label's
     intrinsic (nowrap) width and blows the row past the panel edge. */
  min-width: 0;
}
.s-startpin:hover { background: var(--shell-hover); }
.s-startpin-ico { font-size: 1.25rem; color: var(--shell-accent); }
.s-startpin-label {
  font-size: 0.68rem;
  line-height: 1.2;
  width: 100%;
  /* Wrap long module names to 2 lines (reserve the height so every tile is the
     same height regardless of label length), instead of overflowing. */
  min-height: 2.4em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Divider between the Pinned zone and the app/nav list. Hidden when there are
   no pins (or during search) — the grid sets [hidden] in those states. */
.s-start-sep {
  height: 1px;
  border: 0;
  margin: 0.45rem 0.35rem 0.55rem;
  background: var(--shell-border);
  opacity: 1;
}
.s-start-pins[hidden] + .s-start-sep { display: none; }

/* ── Tiny toast (Start-full notice) ──────────────────────────────── */
.s-start-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--s-taskbar-h) + 16px);
  transform: translate(-50%, 8px);
  z-index: 1106;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--shell-bg);
  border: 1px solid var(--shell-border);
  box-shadow: var(--shell-shadow);
  font-size: 0.85rem;
  color: var(--bs-body-color);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.s-start-toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ── Window "✕" — closes the current grid/form page like an OS window.
   Floats at the page's top-right corner; sits BELOW Serenity dialogs
   (lower z-index) so modals always cover it. ─────────────────────── */
.s-window-close {
  position: fixed;
  /* Aligned to sit exactly where the detail panel's own titlebar ✕ renders
     (top:33px, right:33px), so closing/opening a record never shifts the X. */
  top: 33px;
  right: 33px;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 44px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgb(110, 110, 115);   /* matches the detail panel's titlebar ✕ */
  font-size: 1.62rem;          /* matches the panel ✕ glyph size */
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.s-window-close:hover { color: #e81123; }
@media (max-width: 767.98px) { .s-window-close { display: none !important; } }

/* ═══════════════════════════════════════════════════════════════
   DESKTOP SHELL (>=768px)
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  /* Start button + taskbar replace the topbar entirely. */
  body.s-desktop-shell .s-topbar { display: none !important; }

  /* Split view: content is a bounded scroll region that ENDS above the
     taskbar — its scrollbar never runs over the bar. */
  body.s-desktop-shell .s-main {
    padding: 0 !important;
    margin: 0 !important;
    height: calc(100dvh - var(--s-taskbar-h)) !important;
    min-height: 0 !important;
    overflow-y: auto;
    overflow-x: hidden;
  }
  body.s-desktop-shell section.content { min-height: 0 !important; }
  body.s-desktop-shell .full-height-page section.content {
    height: calc(100dvh - var(--s-taskbar-h)) !important;
  }

  /* ── #s-sidebar = Start panel ────────────────────────────────────
     CRITICAL: no transform / backdrop-filter (either creates a
     containing block that traps the position:fixed flyouts). Solid bg,
     overflow visible so flyouts + footer dropups escape. */
  body.s-desktop-shell .s-sidebar {
    top: auto !important;
    bottom: var(--s-taskbar-h) !important;
    left: 8px;
    right: auto;
    width: 320px !important;
    height: min(560px, calc(100dvh - var(--s-taskbar-h) - 14px)) !important;
    max-height: none !important;
    border-radius: var(--shell-radius) var(--shell-radius) 0 0;
    box-shadow: var(--shell-shadow);
    border: 1px solid var(--shell-border);
    border-bottom: none;
    background: var(--shell-bg) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    overflow: visible;
    transform: none !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.16s ease, visibility 0.16s ease;
  }
  [dir="rtl"] body.s-desktop-shell .s-sidebar { left: auto; right: 8px; }
  body.s-desktop-shell.s-sidebar-expanded .s-sidebar { opacity: 1; visibility: visible; }
  body.s-desktop-shell.s-sidebar-expanded:not(.s-sidebar-pinned)::before { display: none; }
  body.s-desktop-shell .s-sidebar-pane {
    border-radius: var(--shell-radius) var(--shell-radius) 0 0;
    height: 100%;
  }
  body.s-desktop-shell .s-sidebar-pin { display: none; }

  /* Panel order (top → bottom): header → nav (scrolls) → pinned → search.
     The nav is the only flexible band (flex:1 + its own overflow), so however
     long the menu gets it scrolls INSIDE its band and the pinned grid + search
     stay docked at the bottom — pinned never gets pushed off-screen. */
  body.s-desktop-shell .s-sidebar-pane > * { order: 1; }
  body.s-desktop-shell .s-start-brand { order: 0; }
  body.s-desktop-shell .s-sidebar-groups { order: 1; flex: 1 1 auto; min-height: 0; }
  /* Search results take the nav's slot so they appear where the tree was. */
  body.s-desktop-shell .s-sidebar-results { order: 1; flex: 1 1 auto; min-height: 0; }
  /* Divider sits directly above the pinned grid; auto-hides with it (the
     .s-start-pins[hidden] + .s-start-sep rule keys off DOM adjacency). */
  body.s-desktop-shell .s-start-sep { order: 2; }
  /* "Pinned" grid docks at the BOTTOM of the Start panel, just above search. */
  body.s-desktop-shell .s-start-pins { order: 3; flex: 0 0 auto; }
  body.s-desktop-shell .s-sidebar-search {
    order: 4;
    border-top: 1px solid var(--shell-border);
  }
  /* Footer is mobile-only; on the desktop Start panel the account lives in the
     header and language/theme live in the taskbar tray. */
  body.s-desktop-shell .s-sidebar-footer { display: none; }

  /* ── Windows-style flyout submenus (replace the accordion) ─────── */
  /* Never expand nested menus inline; they fly out (JS-positioned). */
  body.s-desktop-shell .s-sidebar-groups .s-sidebar-menu .s-sidebar-menu.collapse.show:not(.s-sidebar-flyout-menu) {
    display: none !important;
  }
  body.s-desktop-shell .s-sidebar-flyout-menu {
    position: fixed !important;
    min-width: 210px;
    max-width: 280px;
    max-height: 72vh;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0 !important;
    padding: 6px !important;
    background: var(--shell-bg);
    border: 1px solid var(--shell-border) !important;
    border-radius: var(--shell-radius);
    box-shadow: var(--shell-shadow);
    display: block !important;
    opacity: 0;
    transition: opacity 0.12s ease;
    z-index: 1060;
  }
  body.s-desktop-shell .s-sidebar-flyout-menu .s-sidebar-link { border-radius: 8px; }
  body.s-desktop-shell .s-sidebar-flyout-menu .s-sidebar-menu-toggle { transform: none; }

  /* Parent items open as hover flyouts here, not inline accordions — so their
     chevron must stay FIXED (pointing to where the flyout appears) instead of
     spinning 90° on the click that Bootstrap's collapse toggle still fires. */
  body.s-desktop-shell .s-sidebar [aria-expanded="true"] > .s-sidebar-menu-toggle {
    transform: none;
  }

  /* ── Start-panel header: vendor logo (left) + account (right) ──── */
  body.s-desktop-shell .s-start-brand {
    order: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.7rem 0.85rem;
    margin-bottom: 0;
    border-bottom: 1px solid var(--shell-border);
  }
  body.s-desktop-shell .s-start-brand img {
    height: 26px;
    width: auto;
    object-fit: contain;
  }
  /* Account button in the header: compact avatar + name pill, opens downward.
     Overrides the base .s-control-btn 38×38 square so the pill sizes to its
     content. */
  body.s-desktop-shell .s-start-brand .dropdown { flex: 0 0 auto; }
  body.s-desktop-shell .s-start-brand .s-user-profile-link {
    display: inline-flex;
    align-items: center;
    width: auto;
    height: auto;
    gap: 0.45rem;
    max-width: 170px;
    padding: 0.3rem 0.5rem;
    border-radius: 9px;
    color: var(--bs-body-color);
    text-decoration: none;
    transition: background 0.15s ease;
  }
  body.s-desktop-shell .s-start-brand .s-user-profile-link:hover { background: var(--shell-hover); }
  body.s-desktop-shell .s-start-brand .s-user-profile-link > .fa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--shell-accent);
    color: #fff;
    font-size: 0.78rem;
  }
  body.s-desktop-shell .s-start-brand .s-user-profile-link::after {
    content: attr(title);
    font-size: 0.85rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Dark theme: render the vendor logo as a full-white silhouette. */
  .theme-cosmos-dark body.s-desktop-shell .s-start-brand img,
  body.s-desktop-shell.theme-cosmos-dark .s-start-brand img {
    filter: brightness(0) invert(1);
  }

  /* ── Start-panel spacing: ONE rail (0.85rem) so every section's content edge
     lines up — the header logo/account, each nav icon, the PINNED label/grid
     and the search field all start at the same x. Nav rows inset their hover
     fill from the rail (groups 0.4 + link 0.45 = 0.85), so the fill is a touch
     wider than the rail while the icons stay aligned (Win11 behaviour). ──── */

  /* Nav (scrolls) — directly under the header */
  body.s-desktop-shell .s-sidebar-groups { padding: 0.4rem 0.4rem 0.3rem; }
  body.s-desktop-shell .s-sidebar-groups .s-sidebar-link {
    padding: 0.5rem 0.45rem;
    gap: 0.6rem;
    border-radius: 8px;
  }

  /* Divider between nav and the pinned band (auto-hides when pins is empty) */
  body.s-desktop-shell .s-start-sep { margin: 0.45rem 0.85rem; }

  /* Pinned band — framed by the divider above and the search border below */
  body.s-desktop-shell .s-start-pins { padding: 0.1rem 0.85rem 0.55rem; }
  body.s-desktop-shell .s-startpins-head { padding: 0 0 0.5rem; }
  body.s-desktop-shell .s-startpins-grid { gap: 0.4rem; }

  /* Search docked at the very bottom */
  body.s-desktop-shell .s-sidebar-search { padding: 0.65rem 0.85rem 0.85rem; }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE tab switcher (Chrome-style) — behind the ▣ header button
   ═══════════════════════════════════════════════════════════════ */
.s-tabswitch {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.45);
}
.s-tabswitch[hidden] { display: none; }
@media (min-width: 768px) { .s-tabswitch { display: none !important; } }

.s-tabswitch-panel {
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--shell-bg);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
  animation: s-tabswitch-up 0.25s ease;
}
@keyframes s-tabswitch-up { from { transform: translateY(30px); opacity: 0.4; } to { transform: translateY(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .s-tabswitch-panel, .s-tab-preview { animation: none; } }

.s-tabswitch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--shell-border);
  font-weight: 600;
  color: var(--bs-body-color);
}
.s-tabswitch-close {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--s-sidebar-icon);
  font-size: 1.2rem;
  cursor: pointer;
}
.s-tabswitch-close:hover { background: var(--shell-hover); }

.s-tabswitch-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
  padding: 1rem;
  overflow-y: auto;
}
.s-tabcard {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.9rem;
  min-height: 84px;
  border-radius: 12px;
  background: var(--bs-primary-bg-subtle, rgba(0, 0, 0, 0.04));
  border: none;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.s-tabcard:active { transform: scale(0.98); }
.s-tabcard.is-active { box-shadow: inset 0 0 0 2px var(--shell-accent); }
.s-tabcard-icon { font-size: 1.4rem; color: var(--shell-accent); }
.s-tabcard-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--bs-body-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.s-tabcard-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.12);
  color: var(--bs-body-color);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}
.s-tabcard-close:hover { background: rgba(0, 0, 0, 0.25); }

/* Mobile tab-switcher trigger is a <button> using .s-control-btn — kill
   the native border/background. */
.s-tabs-switch { border: none; background: transparent; cursor: pointer; }
