/* ==========================================================================
   sidebar.css — App shell (sidebar + topbar + content) using design tokens
   ========================================================================== */

.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-base);
  transition: background var(--tr-slow), color var(--tr-slow);
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: var(--z-fixed);
  transition: width var(--tr-slow);
  overflow: visible;
}

.sidebar.collapsed { width: var(--sidebar-width-collapsed); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-default);
  height: var(--topbar-height);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: var(--sp-2);
  color: var(--text-primary);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-lg);
  text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }

.sidebar-logo { max-width: 100px; height: auto; transition: filter .15s; }
.sidebar.collapsed .sidebar-logo { max-width: 28px; }
/* Dark theme: whiten the brand mark so it contrasts the dark sidebar. */
[data-theme="dark"] .sidebar-logo { filter: brightness(0) invert(1); }

/* ---------- World clock (kept for power users; quieter Stage 1) ---------- */
.world-clock {
  padding: 6px var(--sp-3);
  border-bottom: 1px solid var(--border-soft, var(--border-muted));
  font-family: var(--font-mono);
  font-size: calc(10px * var(--ui-font-scale, 1));
  color: var(--text-dim);
  line-height: 1.45;
  opacity: 0.78;
}
.world-clock .wc-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.world-clock .wc-label {
  color: var(--text-dim);
  min-width: 56px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.world-clock .wc-time {
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.sidebar.collapsed .world-clock { display: none; }

.sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: var(--fs-xl);
  cursor: pointer;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-sm);
  transition: background var(--tr-fast), color var(--tr-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.sidebar-toggle:hover {
  background: var(--bg-elevated-2);
  color: var(--text-primary);
}
/* SVG panel icon — sized like a chip; inherits stroke from color. */
.sidebar-toggle-icon {
  width: 18px;
  height: 18px;
  display: block;
}
/* When the sidebar is collapsed, flip the panel icon so the rail sits
   on the right, hinting "click to expand". Cheap visual affordance. */
.sidebar.collapsed .sidebar-toggle-icon {
  transform: scaleX(-1);
}
/* Collapsed-state header layout: hide the brand/logo and center the
   toggle button at the top of the rail (replacing where the logo was).
   Without this, space-between leaves the toggle pinned to the right
   edge, which visually looks centered on a narrow column. */
.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
.sidebar.collapsed .sidebar-brand {
  display: none;
}

/* ---------- Sidebar nav ---------- */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-3) 0;
}

.nav-section { margin-bottom: var(--sp-3); }
.nav-section-title {
  padding: var(--sp-1) var(--sp-4);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  /* Pathway C: sentence case, quieter chrome (less terminal ALL-CAPS). */
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  margin-bottom: 2px;
}
/* AI section whisper — soft violet label without dominating the rail. */
.nav-section--ai .nav-section-title {
  color: color-mix(in srgb, var(--accent-ai, #c084fc) 55%, var(--text-dim));
}
.sidebar.collapsed .nav-section-title { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--fs-md);
  transition: background var(--tr-fast), color var(--tr-fast);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
}
.nav-item:hover {
  background: var(--bg-elevated-2);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-item.active {
  background: var(--accent-muted);
  color: var(--accent);
  border-left: 3px solid var(--accent);
  padding-left: calc(var(--sp-4) - 3px);
}

.nav-item .icon {
  font-size: var(--fs-lg);
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color var(--tr-fast), transform var(--tr-fast);
}
.nav-item > svg.icon { width: 20px; height: 20px; stroke: currentColor; }
.nav-item:hover .icon { color: var(--text-primary); }
.nav-item.active .icon { color: var(--accent); }
.nav-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; transition: opacity var(--tr-fast); }
.nav-item .badge {
  background: var(--bg-elevated-2);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  padding: 2px var(--sp-2);
  border-radius: var(--r-full);
  margin-left: auto;
}
.nav-item .expand-icon {
  font-size: calc(10px * var(--ui-font-scale, 1));
  color: var(--text-dim);
  transition: transform var(--tr-fast);
}
.nav-item.expanded .expand-icon { transform: rotate(90deg); }

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: var(--sp-2) 0;
  gap: 0;
}
.sidebar.collapsed .nav-item .label,
.sidebar.collapsed .nav-item .badge,
.sidebar.collapsed .nav-item .expand-icon { display: none; }
.sidebar.collapsed .nav-item .icon { margin: 0 auto; }
.sidebar.collapsed .nav-item.active {
  border-left: none;
  padding: var(--sp-2) 0;
}

/* Tooltips when collapsed */
.sidebar.collapsed .nav-item:hover::after {
  content: attr(data-label);
  position: absolute;
  left: calc(var(--sidebar-width-collapsed) + 4px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-tooltip);
  color: var(--text-inverse);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-md);
  white-space: nowrap;
  z-index: var(--z-tooltip);
  font-size: var(--fs-base);
  box-shadow: var(--shadow-md);
}

.nav-submenu {
  display: none;
  background: var(--bg-base);
}
.nav-item.has-submenu.expanded + .nav-submenu { display: block; }
.nav-submenu .nav-item { padding-left: var(--sp-10); font-size: var(--fs-base); }

/* ---------- Sidebar footer (user profile) ---------- */
.sidebar-footer {
  position: relative;
  padding: var(--sp-3);
  border-top: 1px solid var(--border-default);
  flex-shrink: 0;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2);
  border-radius: var(--r-md);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: var(--accent);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-md);
  flex-shrink: 0;
  overflow: hidden;
}
.user-avatar .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.team-pill {
  display: inline-block;
  padding: 1px 6px;
  margin-left: 4px;
  border-radius: var(--r-sm);
  background: var(--bg-elevated-2, color-mix(in srgb, var(--text-primary) 6%, transparent));
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  text-transform: none;
  letter-spacing: 0.2px;
  vertical-align: baseline;
}
.user-info { flex: 1; min-width: 0; overflow: hidden; }
.user-name {
  color: var(--text-primary);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-role {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  text-transform: capitalize;
}
.sidebar.collapsed .user-info { display: none; }

.user-menu-toggle {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-sm);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--tr-fast);
}
.user-menu-toggle:hover { background: var(--bg-elevated-2); color: var(--text-primary); }
.sidebar.collapsed .user-menu-toggle { display: none; }

.user-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: var(--sp-3);
  right: var(--sp-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: var(--sp-1) 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--tr-base);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-tooltip);
}
.user-menu.show { opacity: 1; visibility: visible; transform: translateY(0); }

.user-menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--fs-base);
  transition: background var(--tr-fast);
}
.user-menu-item:hover {
  background: var(--bg-elevated-2);
  color: var(--text-primary);
  text-decoration: none;
}
.user-menu-item.logout { color: var(--danger); }
.user-menu-item.logout:hover { background: var(--danger-bg); }

.user-menu-item .menu-icon { font-size: var(--fs-lg); width: 20px; text-align: center; }

/* Hairline divider between menu groups (above legal links + above logout). */
.user-menu-divider {
  height: 1px;
  margin: 6px 8px;
  background: var(--border-muted);
}

/* ---------- Main content area ---------- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* Without min-width:0 the flex item's intrinsic min size is min-content,
     so when an oversized .content-right inside .content-wrapper widens past
     its slot, .main-content grows to fit it — which in turn widens the
     sibling .top-bar (a flex row with justify-content:space-between),
     pushing its right-side controls off-screen. Pinning min-width to 0 makes
     .main-content respect its flex allocation; .content-wrapper's existing
     overflow:hidden then clips any overlong chat panel cleanly. */
  min-width: 0;
  transition: margin-left var(--tr-slow);
}
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-width-collapsed); }

/* ---------- Top bar (Pathway C Stage 1 — app header, not utility strip) ---------- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 0 var(--sp-5);
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  max-height: var(--topbar-height);
  box-sizing: border-box;
  /* Single row via nowrap + fixed height. overflow must stay visible so
     lang-pop / other top-bar dropdowns can paint below the bar; hidden
     was clipping menus behind main content. */
  overflow: visible;
  flex-wrap: nowrap;
  /* Solid first — reliable on light theme & browsers without backdrop-filter */
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-soft, var(--border-default));
  position: sticky;
  top: 0;
  /* Above page chrome (markets sticky strip z=20, news popover z=1000, etc.)
     so dropdowns are not covered by main content stacking contexts.
     Still below modals (--z-modal 1500) and command palette (5500). */
  z-index: 1200;
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .top-bar {
    background: color-mix(in srgb, var(--bg-elevated) 92%, var(--bg-base));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}
/* Light: solid elevated surface (blur can muddy light grays) */
[data-theme="light"] .top-bar {
  background: var(--bg-elevated);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.top-bar-title-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  flex: 1 1 auto;
  gap: 1px;
}
.top-bar-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-bar-subtitle {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: var(--fw-normal);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
  flex-wrap: nowrap;
  min-width: 0;
  max-width: 100%;
  position: relative;
  z-index: 1;
}

/* Ask Oceanus — global AI entry (opens chat drawer) */
.ask-oceanus-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px 0 10px;
  border-radius: var(--r-full);
  border: 1px solid color-mix(in srgb, var(--accent-ai, #c084fc) 35%, var(--border-default));
  background: var(--gradient-ai-soft, var(--accent-ai-muted, rgba(192, 132, 252, 0.12)));
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast),
              background var(--tr-fast), transform var(--tr-fast);
  flex-shrink: 0;
  white-space: nowrap;
}
.ask-oceanus-btn:hover {
  border-color: color-mix(in srgb, var(--accent-ai, #c084fc) 55%, var(--accent));
  box-shadow: 0 0 0 3px var(--accent-ai-muted, rgba(192, 132, 252, 0.14));
}
.ask-oceanus-btn:active { transform: translateY(1px); }
.ask-oceanus-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px var(--accent-ai, #c084fc);
}
.ask-oceanus-btn__mark {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gradient-ai, linear-gradient(135deg, #8ab4ff, #c084fc));
  box-shadow: 0 0 8px -1px color-mix(in srgb, var(--accent-ai, #c084fc) 50%, transparent);
  flex-shrink: 0;
}
.ask-oceanus-btn__label { line-height: 1; }

/* Collapse chrome earlier so Search + Ask + lang + theme stay one row */
@media (max-width: 1280px) {
  .font-scale-ctrl { display: none; }
}
@media (max-width: 980px) {
  .ask-oceanus-btn {
    padding: 0;
    width: 34px;
    justify-content: center;
    border-radius: var(--r-full);
  }
  .ask-oceanus-btn__label { display: none; }
  .ask-oceanus-btn__mark { margin: 0; }
}
@media (max-width: 720px) {
  .ask-oceanus-btn {
    padding: 0;
    width: 34px;
    justify-content: center;
    border-radius: var(--r-full);
  }
  .ask-oceanus-btn__label { display: none; }
  .ask-oceanus-btn__mark { margin: 0; }
  .font-scale-ctrl { display: none; }
}

/* Soften sidebar chrome slightly (Stage 1) */
.sidebar {
  background: color-mix(in srgb, var(--bg-elevated) 96%, var(--bg-base));
  border-right-color: var(--border-soft, var(--border-default));
}
.sidebar-header {
  border-bottom-color: var(--border-soft, var(--border-default));
}
.sidebar-footer {
  border-top-color: var(--border-soft, var(--border-default));
}

/* ---------- Font size zoom (A− / % / A+) ---------- */
.font-scale-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 32px;
  border: 1px solid var(--border-default);
  border-radius: var(--r-full);
  background: transparent;
  overflow: hidden;
  flex-shrink: 0;
}
.font-scale-btn,
.font-scale-pct {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  line-height: 1;
  transition: background var(--tr-base), color var(--tr-base);
  font-family: var(--font-sans);
}
.font-scale-btn {
  min-width: 30px;
  gap: 1px;
  font-weight: var(--fw-semibold);
}
.font-scale-btn .font-scale-a {
  font-size: calc(11px * var(--ui-font-scale, 1));
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
}
.font-scale-btn .font-scale-a-lg {
  font-size: calc(14px * var(--ui-font-scale, 1));
}
.font-scale-btn .font-scale-sign {
  font-size: calc(12px * var(--ui-font-scale, 1));
  font-weight: var(--fw-bold);
  opacity: 0.85;
}
.font-scale-pct {
  min-width: 40px;
  padding: 0 4px;
  font-size: calc(11px * var(--ui-font-scale, 1));
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  border-left: 1px solid var(--border-muted);
  border-right: 1px solid var(--border-muted);
}
.font-scale-btn:hover:not(:disabled),
.font-scale-pct:hover {
  background: var(--bg-elevated-2);
  color: var(--accent);
}
.font-scale-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.font-scale-btn:focus-visible,
.font-scale-pct:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 1;
}

.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-md);
  transition: all var(--tr-base);
}
.theme-toggle-btn:hover {
  background: var(--bg-elevated-2);
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(180deg);
}

.theme-indicator {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--sp-1) var(--sp-2);
  background: var(--bg-elevated-2);
  border-radius: var(--r-sm);
}

.ava-status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--success);
}
.ava-status-dot.offline { background: var(--text-dim); }

/* ---------- Content wrapper (left + right split) ---------- */
.content-wrapper {
  flex: 1;
  display: flex;
  height: calc(100vh - var(--topbar-height));
  max-height: calc(100vh - var(--topbar-height));
  overflow: hidden;
  /* See .main-content note: without min-width:0 a flex item defaults to
     min-content, which can let .content-right overflow this wrapper and
     push siblings around. */
  min-width: 0;
  min-height: 0;  /* prevent flex min-content from overriding height */
}

.content-left {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-5);
  transition: margin-right var(--tr-slow);
  min-width: 0;
  min-height: 0;   /* flex overflow fix: let overflow-y actually trigger */
}
.content-left.with-chat { margin-right: 0; }

.content-right {
  width: var(--chat-width-user, var(--chat-width));
  flex-shrink: 0;
  /* Hard cap so the user-resized chat panel can never exceed the wrapper's
     own width. This is what actually prevents the rightward shift of the
     topbar items when the resizer is dragged to extreme widths. */
  max-width: 100%;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  transition: width var(--tr-slow), border-color var(--tr-slow);
  overflow: hidden;
  position: relative; /* anchor for absolutely-positioned resizer */
  min-width: 0;
}
.content-right.collapsed { width: 0; border-left: none; }

/* Extra-wide screens (>=1920px): bump the default chat width a bit more
   so it doesn't look stranded on 27" 4K monitors. Honors user override. */
@media (min-width: 1920px) {
  .content-right { width: var(--chat-width-user, clamp(440px, 32vw, 820px)); }
}

/* While dragging the resizer, suppress the width transition so the drag
   feels 1:1 with the cursor. */
body.chat-resizing .content-right { transition: none !important; }
body.chat-resizing { cursor: ew-resize !important; user-select: none; }

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--tr-slow), width var(--tr-slow);
  }
  .sidebar.collapsed {
    width: var(--sidebar-width);
    transform: translateX(0);
  }
  .main-content { margin-left: 0; }
  .sidebar.collapsed ~ .main-content { margin-left: 0; }
  .content-wrapper { flex-direction: column; }
  .content-right {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-default);
  }
}

/* -----------------------------------------------------------------------
   Global ticker quick-search (top of sidebar)
   ----------------------------------------------------------------------- */
.sidebar-search {
  padding: 8px 12px 6px;
  border-bottom: 1px solid var(--border-default);
  position: relative;
}
.sidebar-search input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-base);
  /* Tinted border + soft glow so the search box reads as a primary action
     surface even at rest. Same indigo→violet→pink palette as the chat
     composer + Send button — keeps visual vocabulary consistent. */
  border: 1.5px solid color-mix(in srgb, var(--send-c2, #8b5cf6) 32%, var(--border-default));
  color: var(--text-primary);
  padding: 7px 11px;
  border-radius: 6px;
  font-size: calc(12.5px * var(--ui-font-scale, 1));
  font-family: inherit;
  -webkit-appearance: none;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--send-c2, #8b5cf6) 10%, transparent),
    0 4px 14px -6px color-mix(in srgb, var(--send-glow, rgba(139,92,246,0.45)) 70%, transparent);
  transition: border-color 180ms ease, box-shadow 220ms ease, transform 220ms ease;
}
.sidebar-search input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}
.sidebar-search input:hover {
  border-color: color-mix(in srgb, var(--send-c2, #8b5cf6) 55%, var(--border-default));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--send-c2, #8b5cf6) 20%, transparent),
    0 6px 18px -6px color-mix(in srgb, var(--send-glow, rgba(139,92,246,0.45)) 90%, transparent);
}
.sidebar-search input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--send-c2, #8b5cf6) 85%, transparent);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--send-c2, #8b5cf6) 22%, transparent),
    0 8px 22px -4px color-mix(in srgb, var(--send-glow, rgba(139,92,246,0.45)) 110%, transparent);
}

/* Sidebar-search prefix icon + keyboard shortcut hint. Both are positioned
   inside the .sidebar-search container which is `position: relative`. */
.sidebar-search::before {
  content: "🔍";
  position: absolute;
  top: 50%; left: 22px;
  transform: translateY(-50%);
  font-size: calc(11px * var(--ui-font-scale, 1));
  opacity: 0.55;
  pointer-events: none;
  z-index: 1;
}
.sidebar-search input {
  padding-left: 30px;
}
.sidebar.collapsed .sidebar-search { display: none; }

.sb-search-results {
  position: absolute;
  top: 100%;
  left: 12px;
  right: 12px;
  z-index: 1100;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  max-height: 360px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg, 0 4px 16px rgba(0,0,0,0.18));
}
.sb-res {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  padding: 7px 10px;
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--border-soft, var(--border-muted));
  font-size: calc(12px * var(--ui-font-scale, 1));
}
.sb-res:hover,
.sb-res.active { background: var(--bg-elevated-2); }
.sb-res:last-child { border-bottom: 0; }
.sb-res-sym { font-weight: 600; font-family: var(--font-mono, ui-monospace, monospace); }
.sb-res-name {
  color: var(--text-secondary);
  font-size: calc(11px * var(--ui-font-scale, 1));
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sb-res-ex {
  color: var(--text-muted);
  font-size: calc(10px * var(--ui-font-scale, 1));
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sb-search-empty {
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: calc(11px * var(--ui-font-scale, 1));
  text-align: center;
}
