/* ==========================================================================
   SDeeka V2.1 — Unified Floating Glass Sidebar, Auto-Collapse Reader
   & Warm Light Glass / Dark Obsidian Glass Theme (DESIGN.md)
   ========================================================================== */

:root {
  /* Warm Light Glass (Default — Reading-First) */
  --sd-canvas: #FFFAF5;
  --sd-canvas-glow: radial-gradient(640px at 8% 0%, rgba(255, 101, 0, 0.06), transparent 65%);
  --sd-surface: #FFFFFF;
  --sd-surface-subtle: #F6EFE7;
  --sd-glass-bg: rgba(255, 252, 248, 0.82);
  --sd-glass-border: rgba(180, 145, 118, 0.28);
  --sd-glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  --sd-glass-shadow: 0 14px 36px -14px rgba(34, 22, 12, 0.14);
  --sd-ink: #111213;
  --sd-ink-secondary: #4E473F;
  --sd-ink-muted: #6E655B;
  --sd-accent: #FF6500;
  --sd-accent-hover: #E05600;
  --sd-accent-ink: #B84300;
  --sd-accent-soft: #FFF1E6;
  --sd-active-pill-bg: #17181A;
  --sd-active-pill-ink: #FFFFFF;
  --sd-active-pill-glow: 0 4px 14px rgba(0, 0, 0, 0.18);
  --sd-border: #EADED2;
  --sd-hover: rgba(184, 67, 0, 0.07);
  --sd-top-bg: rgba(255, 250, 245, 0.84);
  --sd-sb-width: 256px;
  --sd-sb-collapsed: 64px;
  --sdeeka-top: 52px;
}

html[data-theme="dark"] {
  /* Dark Obsidian Glass */
  --sd-canvas: #0E1014;
  --sd-canvas-glow:
    radial-gradient(720px at 6% 4%, rgba(255, 101, 0, 0.14), transparent 58%),
    radial-gradient(640px at 92% 96%, rgba(180, 83, 9, 0.10), transparent 55%);
  --sd-surface: #161920;
  --sd-surface-subtle: #1F242E;
  --sd-glass-bg: rgba(22, 25, 32, 0.72);
  --sd-glass-border: rgba(255, 255, 255, 0.13);
  --sd-glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  --sd-glass-shadow: 0 22px 54px -18px rgba(0, 0, 0, 0.72);
  --sd-ink: #F5F2EC;
  --sd-ink-secondary: #C7C1B8;
  --sd-ink-muted: #969087;
  --sd-accent: #FF7417;
  --sd-accent-hover: #FF8736;
  --sd-accent-ink: #FF964F;
  --sd-accent-soft: rgba(255, 116, 23, 0.16);
  --sd-active-pill-bg: #FFFFFF;
  --sd-active-pill-ink: #111213;
  --sd-active-pill-glow: 0 0 18px rgba(255, 255, 255, 0.22);
  --sd-border: rgba(255, 255, 255, 0.10);
  --sd-hover: rgba(255, 255, 255, 0.08);
  --sd-top-bg: rgba(22, 25, 32, 0.76);

  /* Bridge legacy SDeeka CSS variables to Dark Obsidian Glass */
  --canvas: #0E1014;
  --card: #161920;
  --ink: #F5F2EC;
  --text: #F5F2EC;
  --text-2: #C7C1B8;
  --text-3: #A59E94;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --accent: #FF7417;
  --accent-dark: #FF964F;
  --accent-soft: rgba(255, 116, 23, 0.16);
  --accent-wash: rgba(255, 116, 23, 0.32);
  --shell: #161920;
  --on-shell: #F5F2EC;
  --on-shell-dim: #C7C1B8;
  --shell-line: rgba(255, 255, 255, 0.10);
  --ok: #34D399;
  --ok-soft: rgba(16, 185, 129, 0.16);
  --err: #F87171;
  --err-soft: rgba(239, 68, 68, 0.18);
  --warn-soft: rgba(245, 158, 11, 0.16);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.35), 0 12px 28px rgba(0, 0, 0, 0.30);
  color-scheme: dark;
}

html {
  background-color: var(--sd-canvas);
  scroll-padding-top: calc(var(--sdeeka-top, 52px) + 20px);
}

body {
  background-color: var(--sd-canvas);
  background-image: var(--sd-canvas-glow);
  background-attachment: fixed;
  color: var(--sd-ink);
  transition: background-color 180ms ease, color 180ms ease;
}

/* ==========================================================================
   UNIFIED SHELL LAYOUT (.sd-shell)
   ========================================================================== */

.sd-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  position: relative;
}

.sd-main-col {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Chat bounded viewport */
body.page-chat {
  display: block;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.sd-shell-chat {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.sd-shell-chat .sd-main-col {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

body.page-chat .app-content {
  flex: 1 1 0%;
  min-height: 0;
  height: auto;
  overflow: hidden;
  background: transparent;
}

body.page-account .app-content,
.sd-shell-app .app-content {
  background: transparent;
}

/* ==========================================================================
   FLOATING GLASS SIDEBAR (#sdSidebar) — DESKTOP (>= 1024px)
   ========================================================================== */

.sd-sidebar {
  position: sticky;
  top: 12px;
  height: calc(100vh - 24px);
  height: calc(100dvh - 24px);
  margin: 12px 0 12px 12px;
  width: var(--sd-sb-width);
  flex: 0 0 auto;
  z-index: 120;
  border-radius: 22px;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  overflow: visible;
  transition:
    width 220ms cubic-bezier(0.22, 1, 0.36, 1),
    border-radius 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sd-sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -1;
  pointer-events: none;
  background: var(--sd-glass-bg);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--sd-glass-border);
  box-shadow: var(--sd-glass-shadow), var(--sd-glass-highlight);
  transition: background-color 180ms ease, border-color 180ms ease;
}

html[data-theme="dark"] .sd-sidebar::before {
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
}

.sd-drawer-backdrop {
  display: none;
}

/* Brand Header */
.sd-sb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 12px 10px;
  flex: 0 0 auto;
}

.sd-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--sd-ink);
  min-width: 0;
  border-radius: 10px;
}

.sd-brand-mark {
  display: block;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(255, 101, 0, 0.25);
}

.sd-brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sd-brand-mark-sm {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
}

.sd-brand-meta {
  min-width: 0;
  overflow: hidden;
  transition: opacity 140ms ease;
}

.sd-brand-word {
  display: block;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--sd-ink);
  white-space: nowrap;
}

.sd-brand-word-sm {
  font-size: 18px;
}

.sd-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--sd-ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background-color 140ms ease, color 140ms ease;
}

.sd-icon-btn:hover {
  background: var(--sd-hover);
  color: var(--sd-ink);
}

.sd-drawer-close {
  display: none;
}

.sd-ic-expand {
  display: none;
}

/* Scrollable Middle Area */
.sd-sb-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scrollbar-width: thin;
  scrollbar-color: var(--sd-glass-border) transparent;
}

/* Primary Quick Action: + บทสนทนาใหม่ */
.sd-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 8px 14px;
  margin: 2px 0 8px;
  border-radius: 999px;
  border: none;
  background: var(--sd-accent);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: 0 6px 16px -6px rgba(255, 101, 0, 0.45);
  transition: background-color 150ms ease, transform 150ms ease, width 200ms ease;
}

.sd-cta:hover {
  background: var(--sd-accent-hover);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.sd-cta .icon {
  color: #FFFFFF;
}

/* Core Navigation (6 items) */
.sd-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sd-nav-item {
  width: 100%;
  min-height: 38px;
  padding: 7px 11px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--sd-ink-secondary);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.sd-nav-item:hover {
  background: var(--sd-hover);
  color: var(--sd-ink);
}

.sd-nav-item.is-active,
.sd-nav-item[aria-current="page"] {
  background: var(--sd-active-pill-bg);
  color: var(--sd-active-pill-ink);
  font-weight: 600;
  box-shadow: var(--sd-active-pill-glow);
}

.sd-nav-item.is-active .icon,
.sd-nav-item[aria-current="page"] .icon {
  color: var(--sd-active-pill-ink);
}

.sd-label {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 140ms ease;
}

.sd-div {
  height: 1px;
  background: var(--sd-border);
  margin: 8px 6px;
  flex: 0 0 auto;
}

/* Colored-Dot Collections (Max 5) */
.sd-collections {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 0 auto;
}

.sd-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
  padding: 4px 10px 4px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--sd-ink-muted);
  line-height: 1.4;
}

.sd-sec-head > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sd-sec-link {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--sd-accent-ink);
  text-decoration: none;
  white-space: nowrap;
}

.sd-sec-link:hover {
  text-decoration: underline;
}

.sd-col-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sd-col-item {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--sd-ink-secondary);
  font-size: 13px;
  line-height: 1.4;
  transition: background-color 140ms ease, color 140ms ease;
}

.sd-col-item:hover {
  background: var(--sd-hover);
  color: var(--sd-ink);
}

.sd-col-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex: 0 0 auto;
  background-color: var(--dot-color, #F97316);
}

html[data-theme="dark"] .sd-col-dot {
  box-shadow: 0 0 10px var(--dot-color, #F97316);
}

.sd-col-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sd-col-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--sd-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sd-col-sub {
  font-size: 11.5px;
  color: var(--sd-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sd-col-count {
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--sd-ink-muted);
  background: var(--sd-surface-subtle);
  padding: 1px 7px;
  border-radius: 999px;
  flex: 0 0 auto;
}

/* Recent History Zone */
.sd-history-zone {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.sd-sidebar .sb-history {
  border-top: none;
  margin-top: 0;
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
}

.sd-sidebar .sb-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
  padding: 4px 10px 4px;
}

.sd-sidebar .sb-history-title {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--sd-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sd-sidebar .sb-history-title .icon {
  flex: 0 0 auto;
}

.sd-sidebar .sb-history-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sd-sidebar .sb-history-all {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--sd-accent-ink);
}

.sd-sidebar .sb-hist-link {
  color: var(--sd-ink-secondary);
  border-radius: 10px;
  padding: 7px 32px 7px 10px;
  font-size: 13px;
}

.sd-sidebar .sb-hist-link:hover {
  background: var(--sd-hover);
  color: var(--sd-ink);
}

.sd-sidebar .sb-hist-link.current {
  background: var(--sd-accent-soft);
  color: var(--sd-accent-ink);
  font-weight: 600;
}

.sd-sidebar .sb-hist-time,
.sd-sidebar .sb-hist-empty {
  color: var(--sd-ink-muted);
}

.sd-recent-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sd-recent-link {
  display: block;
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--sd-ink-secondary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sd-recent-link:hover {
  background: var(--sd-hover);
  color: var(--sd-ink);
}

/* Bottom Utility Dock */
.sd-sb-foot {
  padding: 10px;
  border-top: 1px solid var(--sd-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
}

.sd-theme-btn {
  width: 100%;
  min-height: 38px;
  padding: 7px 11px;
  border-radius: 12px;
  border: 1px solid var(--sd-border);
  background: var(--sd-surface-subtle);
  color: var(--sd-ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.sd-theme-btn:hover {
  border-color: var(--sd-accent);
  color: var(--sd-accent-ink);
}

/* Show Moon + "โหมดมืด" in Light mode; Sun + "โหมดสว่าง" in Dark mode */
.sd-theme-ic-light,
.sd-theme-label-light {
  display: none;
}

html[data-theme="dark"] .sd-theme-ic-dark,
html[data-theme="dark"] .sd-theme-label-dark {
  display: none;
}

html[data-theme="dark"] .sd-theme-ic-light,
html[data-theme="dark"] .sd-theme-label-light {
  display: inline-flex;
}

.sd-login-cta {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--sd-border);
  background: var(--sd-surface);
  color: var(--sd-ink);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 150ms ease, color 150ms ease;
}

.sd-login-cta:hover {
  border-color: var(--sd-accent);
  color: var(--sd-accent-ink);
}

.sd-avatar-menu {
  width: 100%;
}

.sd-user-pill {
  width: 100%;
  min-height: 42px;
  padding: 5px 10px 5px 6px;
  border-radius: 12px;
  border: 1px solid var(--sd-border);
  background: var(--sd-surface);
  color: var(--sd-ink);
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  text-align: left;
}

.sd-user-pill:hover {
  border-color: var(--sd-accent);
}

.sd-user-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sd-user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--sd-ink);
  line-height: 1.3;
  max-width: none;
}

.sd-user-role {
  font-size: 11px;
  color: var(--sd-ink-muted);
  line-height: 1.3;
}

.sd-user-chev {
  color: var(--sd-ink-muted);
  flex: 0 0 auto;
}

.sd-account-dropdown {
  position: fixed;
  z-index: 270;
  background: var(--sd-surface);
  border: 1px solid var(--sd-glass-border);
  border-radius: 14px;
  box-shadow: var(--sd-glass-shadow);
  min-width: 248px;
}

.sd-foot-legal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--sd-ink-muted);
  padding-top: 2px;
}

.sd-foot-legal a {
  color: inherit;
  text-decoration: none;
}

.sd-foot-legal a:hover {
  color: var(--sd-accent-ink);
  text-decoration: underline;
}

/* ==========================================================================
   COLLAPSED 64px CAPSULE MODE (Desktop >= 1024px ONLY)
   ========================================================================== */

@media (min-width: 1024px) {
  html[data-sidebar-state="collapsed"] .sd-sidebar {
    width: var(--sd-sb-collapsed);
    border-radius: 26px;
  }

  html[data-sidebar-state="collapsed"] .sd-sb-head {
    flex-direction: column;
    align-items: center;
    padding: 12px 8px 8px;
    gap: 8px;
  }

  html[data-sidebar-state="collapsed"] .sd-ic-collapse {
    display: none;
  }

  html[data-sidebar-state="collapsed"] .sd-ic-expand {
    display: inline-flex;
  }

  html[data-sidebar-state="collapsed"] .sd-brand-meta,
  html[data-sidebar-state="collapsed"] .sd-label,
  html[data-sidebar-state="collapsed"] .sd-sec-head,
  html[data-sidebar-state="collapsed"] .sd-col-meta,
  html[data-sidebar-state="collapsed"] .sd-col-count,
  html[data-sidebar-state="collapsed"] .sd-history-zone,
  html[data-sidebar-state="collapsed"] .sd-user-meta,
  html[data-sidebar-state="collapsed"] .sd-user-chev,
  html[data-sidebar-state="collapsed"] .sd-foot-legal {
    display: none !important;
    opacity: 0;
    pointer-events: none;
  }

  html[data-sidebar-state="collapsed"] .sd-sb-scroll {
    padding: 4px 8px 10px;
    align-items: center;
  }

  html[data-sidebar-state="collapsed"] .sd-nav,
  html[data-sidebar-state="collapsed"] .sd-collections,
  html[data-sidebar-state="collapsed"] .sd-col-list {
    align-items: center;
    width: 100%;
  }

  html[data-sidebar-state="collapsed"] .sd-cta,
  html[data-sidebar-state="collapsed"] .sd-nav-item,
  html[data-sidebar-state="collapsed"] .sd-col-item,
  html[data-sidebar-state="collapsed"] .sd-theme-btn,
  html[data-sidebar-state="collapsed"] .sd-login-cta {
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 999px;
  }

  html[data-sidebar-state="collapsed"] .sd-col-dot {
    width: 10px;
    height: 10px;
  }

  html[data-sidebar-state="collapsed"] .sd-sb-foot {
    align-items: center;
    padding: 10px 8px;
  }

  html[data-sidebar-state="collapsed"] .sd-avatar-menu {
    width: auto;
    display: flex;
    justify-content: center;
  }

  html[data-sidebar-state="collapsed"] .sd-user-pill {
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 999px;
    border-color: transparent;
    background: transparent;
  }

  html[data-sidebar-state="collapsed"] .sd-div {
    width: 28px;
    margin: 8px auto;
  }
}

/* ==========================================================================
   PORTAL GLASS TOOLTIP (Fixed, never clipped by overflow-y: auto)
   ========================================================================== */

.sd-glass-tooltip {
  position: fixed;
  z-index: 260;
  pointer-events: none;
  background: rgba(17, 18, 22, 0.94);
  color: #F8FAFC;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 90ms ease, transform 90ms ease;
}

.sd-glass-tooltip.is-visible {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.sd-glass-tooltip kbd {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.14);
  color: #E2E8F0;
}

/* ==========================================================================
   SLIM CONTEXTUAL TOPBAR (Desktop 52px / Mobile 56px Frosted Glass)
   ========================================================================== */

.sd-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--sd-top-bg);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--sd-border);
  flex: 0 0 auto;
}

.sd-topbar-inner {
  min-height: 52px;
  padding: 6px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sd-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.sd-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.sd-mob-btn,
.sd-mob-brand,
.sd-mob-actions {
  display: none;
}

.sd-topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 400px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--sd-border);
  background: var(--sd-surface);
  color: var(--sd-ink-muted);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.sd-topbar-search:focus-within {
  border-color: var(--sd-accent);
  box-shadow: 0 0 0 2px var(--sd-accent-soft);
}

.sd-topbar-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--sd-ink);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  padding: 6px 0;
}

.sd-topbar-search input::placeholder {
  color: var(--sd-ink-muted);
}

.sd-topbar-context,
.sd-topbar-meta {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--sd-ink-muted);
  white-space: nowrap;
}

.sd-topbar-reader-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sd-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  min-width: 36px;
  padding: 4px 10px;
  border-radius: 9px;
  border: 1px solid var(--sd-border);
  background: var(--sd-surface);
  color: var(--sd-ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background-color 140ms ease;
}

.sd-tool-btn:hover {
  border-color: var(--sd-accent);
  color: var(--sd-accent-ink);
}

.sd-tool-btn-accent {
  background: var(--sd-accent);
  border-color: var(--sd-accent);
  color: #FFFFFF;
}

.sd-tool-btn-accent:hover {
  background: var(--sd-accent-hover);
  border-color: var(--sd-accent-hover);
  color: #FFFFFF;
}

/* ==========================================================================
   CONTENT & JUDGMENT READER REFINEMENTS
   ========================================================================== */

.pub-main {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 32px;
  flex: 1 0 auto;
}

.pub-footer-inner {
  max-width: 1380px;
  padding: 20px 32px;
}

/* Judgment Reader: Clean Typographic Hierarchy + 3-Col Grid */
.pub-main:has(.page-case) {
  padding-left: 24px;
  padding-right: 24px;
}

.page-case {
  max-width: 1360px !important;
  padding: 24px 0 64px;
}

.reader-layout {
  grid-template-columns: 220px minmax(0, 1fr) 280px;
  gap: 24px;
  max-width: 1360px;
}

.reader-toc,
.reader-promo {
  top: calc(var(--sdeeka-top, 52px) + 18px);
}

/* Remove decorative 5px orange left bar on judgment h2; use clean scale + hairline */
.case-article h2 {
  border-left: none;
  padding-left: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--sd-ink);
}

.case-article section {
  border-top: 1px solid var(--sd-border);
  padding-top: 22px;
}

.case-para {
  line-height: 1.9;
  max-width: 72ch;
}

@media (max-width: 1279px) {
  .reader-layout {
    grid-template-columns: 196px minmax(0, 1fr);
    gap: 20px;
  }
  .reader-promo {
    grid-column: 2;
    position: static;
  }
}

/* Home Welcome & Chat Composer Refinement */
.page-welcome:has(#chatEmpty) .composer,
.page-chat .composer {
  border-radius: 20px;
}

.page-welcome:has(#chatEmpty) .btn-send,
.page-chat .btn-send {
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  padding: 0;
}

/* ==========================================================================
   DARK OBSIDIAN GLASS SURFACE OVERRIDES (WCAG 2.1 AA >= 4.5:1)
   ========================================================================== */

html[data-theme="dark"] a {
  color: var(--sd-ink);
}

html[data-theme="dark"] .link-plain,
html[data-theme="dark"] .pub-main .link-plain,
html[data-theme="dark"] .sd-sec-link,
html[data-theme="dark"] .sd-sidebar .sb-history-all,
html[data-theme="dark"] .seo-hub-more,
html[data-theme="dark"] .seo-recent-title,
html[data-theme="dark"] .seo-how-card a,
html[data-theme="dark"] .pricing-login a,
html[data-theme="dark"] .law-case-link,
html[data-theme="dark"] .law-source-note a,
html[data-theme="dark"] .law-crumb a,
html[data-theme="dark"] .law-all-sections,
html[data-theme="dark"] .law-see-selection,
html[data-theme="dark"] .statute-history a,
html[data-theme="dark"] .ai-block .chat-case-link,
html[data-theme="dark"] .chat-case-result-number,
html[data-theme="dark"] .mcp-path-card > a,
html[data-theme="dark"] .mcp-tool-list code,
html[data-theme="dark"] .mcp-eyebrow,
html[data-theme="dark"] .mcp-path-label,
html[data-theme="dark"] .account-hero-accent,
html[data-theme="dark"] .pricing-kicker,
html[data-theme="dark"] .access-days,
html[data-theme="dark"] .fb-link {
  color: var(--sd-accent-ink);
}

html[data-theme="dark"] .btn-primary {
  background: var(--sd-accent);
  border-color: var(--sd-accent);
  color: #111213;
}

html[data-theme="dark"] .btn-primary:hover {
  background: var(--sd-accent-hover);
  border-color: var(--sd-accent-hover);
  color: #111213;
}

html[data-theme="dark"] .btn-outline {
  background: var(--sd-surface-subtle);
  border-color: var(--border-strong);
  color: var(--sd-ink);
}

html[data-theme="dark"] .btn-outline:hover {
  border-color: var(--sd-accent);
  color: var(--sd-accent-ink);
}

html[data-theme="dark"] .btn-ghost:hover,
html[data-theme="dark"] .icon-btn:hover {
  background: var(--sd-hover);
  color: var(--sd-ink);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .search-bar,
html[data-theme="dark"] .result-card,
html[data-theme="dark"] .seo-hub-block,
html[data-theme="dark"] .search-year-panel,
html[data-theme="dark"] .search-years,
html[data-theme="dark"] .case-article .reading-panel,
html[data-theme="dark"] .case-article > #caseLaws,
html[data-theme="dark"] .case-article > .v2-analysis,
html[data-theme="dark"] .case-article > .v2-related,
html[data-theme="dark"] .reader-toc,
html[data-theme="dark"] #casePage .reader-promo,
html[data-theme="dark"] #caseNetworkSec .related-access,
html[data-theme="dark"] .v2-related .rel-mini-card,
html[data-theme="dark"] .panel-d,
html[data-theme="dark"] #identityChannels,
html[data-theme="dark"] .account-profile-bar,
html[data-theme="dark"] .pricing-card,
html[data-theme="dark"] .mcp-capability,
html[data-theme="dark"] .mcp-path-card,
html[data-theme="dark"] .mcp-config-section,
html[data-theme="dark"] .mcp-verify-section,
html[data-theme="dark"] .mcp-download-section,
html[data-theme="dark"] .api-keys-page .card,
html[data-theme="dark"] .law-library .law-intro,
html[data-theme="dark"] .law-library .law-selection,
html[data-theme="dark"] .law-library .law-browse-tools,
html[data-theme="dark"] .law-library .law-section,
html[data-theme="dark"] .law-library .law-results article,
html[data-theme="dark"] .law-library .law-layout aside,
html[data-theme="dark"] .law-domain,
html[data-theme="dark"] .cite-panel,
html[data-theme="dark"] .preview-drawer,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .suggest-dropdown,
html[data-theme="dark"] .chat-case-results,
html[data-theme="dark"] .dev-tools,
html[data-theme="dark"] details.fineprint,
html[data-theme="dark"] dialog {
  background: var(--sd-surface);
  border-color: var(--sd-border);
  color: var(--sd-ink);
}

html[data-theme="dark"] .seo-recent-card,
html[data-theme="dark"] .seo-how-card,
html[data-theme="dark"] .seo-faq-item,
html[data-theme="dark"] .seo-topic-chip,
html[data-theme="dark"] .law-zone,
html[data-theme="dark"] .law-zone-special,
html[data-theme="dark"] .card-d,
html[data-theme="dark"] .conv-item,
html[data-theme="dark"] .conv-empty,
html[data-theme="dark"] .mcp-os-bar,
html[data-theme="dark"] .mcp-check-grid pre,
html[data-theme="dark"] .pricing-trial,
html[data-theme="dark"] .statute-box,
html[data-theme="dark"] .statute-history,
html[data-theme="dark"] .preview-drawer .pv-original,
html[data-theme="dark"] .ai-block .ai-source-quote,
html[data-theme="dark"] .ai-block .ai-court-excerpt,
html[data-theme="dark"] .fb-form,
html[data-theme="dark"] .composer,
html[data-theme="dark"] .turn-user-bubble,
html[data-theme="dark"] .result-issue-line,
html[data-theme="dark"] .court-step,
html[data-theme="dark"] .pv-summary-box,
html[data-theme="dark"] .pv-rel-item {
  background: var(--sd-surface-subtle);
  border-color: var(--sd-border);
  color: var(--sd-ink);
}

/* High-contrast text overrides inside Dark Mode */
html[data-theme="dark"] .welcome-headline,
html[data-theme="dark"] .seo-hub-heading,
html[data-theme="dark"] .seo-how-card h3,
html[data-theme="dark"] .seo-faq-item > summary,
html[data-theme="dark"] .search-filter-panel > summary,
html[data-theme="dark"] .search-year-panel > summary,
html[data-theme="dark"] .results-toolbar .muted-line strong,
html[data-theme="dark"] .pricing,
html[data-theme="dark"] .pricing-card-head h2,
html[data-theme="dark"] .pricing-price strong,
html[data-theme="dark"] .law-library,
html[data-theme="dark"] .law-directory h2,
html[data-theme="dark"] .law-domain-head h3,
html[data-theme="dark"] .statute-prose p,
html[data-theme="dark"] .law-tree a,
html[data-theme="dark"] .law-switch > summary,
html[data-theme="dark"] .law-toc > summary,
html[data-theme="dark"] .chat-case-result-link,
html[data-theme="dark"] .case-para,
html[data-theme="dark"] .case-article h1,
html[data-theme="dark"] .case-article h2,
html[data-theme="dark"] .case-article h3,
html[data-theme="dark"] .mcp-os-label,
html[data-theme="dark"] .reader-promo h2 {
  color: var(--sd-ink);
}

html[data-theme="dark"] .welcome-subline,
html[data-theme="dark"] .seo-recent-snippet,
html[data-theme="dark"] .seo-how-card p,
html[data-theme="dark"] .seo-faq-item > p,
html[data-theme="dark"] .filter-selection-count,
html[data-theme="dark"] .search-year-panel > summary span,
html[data-theme="dark"] .search-years-heading span,
html[data-theme="dark"] .search-match-scope,
html[data-theme="dark"] .pricing-heading > p:last-child,
html[data-theme="dark"] .pricing-card-head > p,
html[data-theme="dark"] .pricing-action > p,
html[data-theme="dark"] .pricing-note,
html[data-theme="dark"] .pricing-login,
html[data-theme="dark"] .pricing-price span,
html[data-theme="dark"] .law-intro p,
html[data-theme="dark"] .law-library .law-selection p,
html[data-theme="dark"] .law-library .law-source-note,
html[data-theme="dark"] .law-browse-tools p,
html[data-theme="dark"] .law-library .law-hint,
html[data-theme="dark"] .law-domain-head small,
html[data-theme="dark"] .statute-history .history-note,
html[data-theme="dark"] .statute-history .history-date,
html[data-theme="dark"] .v2-related .related-note,
html[data-theme="dark"] .preview-drawer .pv-original-empty,
html[data-theme="dark"] .chat-case-results-note,
html[data-theme="dark"] .chat-case-results-status,
html[data-theme="dark"] .mcp-page .mcp-note,
html[data-theme="dark"] .mcp-page .mcp-guide-status,
html[data-theme="dark"] .mcp-page .fineprint,
html[data-theme="dark"] .mcp-config-section .mcp-os-hint,
html[data-theme="dark"] .welcome-trust-links,
html[data-theme="dark"] .muted-line,
html[data-theme="dark"] .fineprint {
  color: var(--sd-ink-secondary);
}

html[data-theme="dark"] .welcome-trust-links a:hover {
  color: var(--sd-ink);
}

/* Inputs, Selects, Tabs & Chips in Dark Mode */
html[data-theme="dark"] .input,
html[data-theme="dark"] .select,
html[data-theme="dark"] .search-bar-input,
html[data-theme="dark"] .law-library input:not([type="checkbox"]),
html[data-theme="dark"] .law-library select,
html[data-theme="dark"] .law-section-jump select,
html[data-theme="dark"] .api-keys-page input,
html[data-theme="dark"] .fb-form select,
html[data-theme="dark"] .fb-form textarea,
html[data-theme="dark"] .dev-tools-row .input {
  background: var(--sd-surface-subtle);
  border-color: var(--border-strong);
  color: var(--sd-ink);
}

html[data-theme="dark"] #composerInput,
html[data-theme="dark"] .input-ghost {
  color: var(--sd-ink);
}

html[data-theme="dark"] #composerInput::placeholder,
html[data-theme="dark"] .input::placeholder,
html[data-theme="dark"] .input-ghost::placeholder {
  color: var(--sd-ink-muted);
}

html[data-theme="dark"] .mode-tab {
  background: var(--sd-surface-subtle);
  border-color: var(--sd-border);
  color: var(--sd-ink-secondary);
}

html[data-theme="dark"] .mode-tab.active,
html[data-theme="dark"] .view-pill.active,
html[data-theme="dark"] .welcome-entry-links [aria-current],
html[data-theme="dark"] .law-library .law-code-list .btn[aria-current="page"],
html[data-theme="dark"] .law-library .law-number-links a[aria-current="page"] {
  background: #FFFFFF;
  border-color: #FFFFFF;
  color: #111213;
}

html[data-theme="dark"] .welcome-entry-links a {
  background: var(--sd-surface);
  border-color: var(--border-strong);
  color: var(--sd-ink);
}

html[data-theme="dark"] .welcome-entry-links a:hover {
  background: var(--sd-accent-soft);
  border-color: var(--sd-accent);
  color: var(--sd-accent-ink);
}

html[data-theme="dark"] .chip,
html[data-theme="dark"] #caseLaws .chip,
html[data-theme="dark"] .search-year-links .year-hit,
html[data-theme="dark"] .law-library .law-code-list .btn,
html[data-theme="dark"] .law-library .law-number-links a,
html[data-theme="dark"] .mcp-page .mcp-apps .chip-select,
html[data-theme="dark"] .mcp-os-switch,
html[data-theme="dark"] .fb-send,
html[data-theme="dark"] .mp-chip {
  background: var(--sd-surface-subtle);
  border-color: var(--border-strong);
  color: var(--sd-ink-secondary);
}

html[data-theme="dark"] .chip-strong,
html[data-theme="dark"] .chip-law-main,
html[data-theme="dark"] .score-pill,
html[data-theme="dark"] .related-count,
html[data-theme="dark"] .law-zone-badge,
html[data-theme="dark"] .pricing-tag-paid,
html[data-theme="dark"] .mcp-version,
html[data-theme="dark"] .mcp-access-label,
html[data-theme="dark"] .chat-case-results-count,
html[data-theme="dark"] .rel-badge-accent {
  background: var(--sd-accent-soft);
  border-color: var(--accent-wash);
  color: var(--sd-accent-ink);
}

html[data-theme="dark"] .chip-law {
  background: rgba(168, 85, 247, 0.16);
  border-color: rgba(168, 85, 247, 0.34);
  color: #D8B4FE;
}

html[data-theme="dark"] .chip-ok,
html[data-theme="dark"] .api-key-badge {
  background: var(--ok-soft);
  border-color: rgba(52, 211, 153, 0.32);
  color: #6EE7B7;
}

html[data-theme="dark"] .chip-warn,
html[data-theme="dark"] .cite-badge-warn,
html[data-theme="dark"] .cite-badge-note,
html[data-theme="dark"] .notice-warn,
html[data-theme="dark"] .banner-info,
html[data-theme="dark"] .banner-warn {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.32);
  color: #FCD34D;
}

html[data-theme="dark"] .notice-error,
html[data-theme="dark"] .turn-error-box {
  background: var(--err-soft);
  border-color: rgba(248, 113, 113, 0.35);
  color: #FCA5A5;
}

html[data-theme="dark"] .notice p,
html[data-theme="dark"] .turn-error-box p {
  color: var(--sd-ink-secondary);
}

html[data-theme="dark"] .search-member-note,
html[data-theme="dark"] .pricing-offer,
html[data-theme="dark"] .v2-analysis blockquote,
html[data-theme="dark"] .law-shortcut-strip,
html[data-theme="dark"] .pending-box,
html[data-theme="dark"] .renewal-notice:not([hidden]),
html[data-theme="dark"] .api-key-revoke-confirm {
  background: var(--sd-accent-soft);
  border-color: var(--accent-wash);
  color: var(--sd-ink);
}

html[data-theme="dark"] .pricing-offer strong,
html[data-theme="dark"] .law-shortcut-strip strong,
html[data-theme="dark"] .pending-box strong,
html[data-theme="dark"] .renewal-notice a,
html[data-theme="dark"] .chat-case-results-summary,
html[data-theme="dark"] .preview-drawer .pv-original .pv-sec-label,
html[data-theme="dark"] .statute-more summary,
html[data-theme="dark"] .law-tree-articles > summary {
  color: var(--sd-accent-ink);
}

html[data-theme="dark"] .pricing-symbol,
html[data-theme="dark"] .pricing-tag,
html[data-theme="dark"] .card-d-icon,
html[data-theme="dark"] .mcp-capability-icon,
html[data-theme="dark"] .api-keys-icon {
  background: var(--sd-accent-soft);
  color: var(--sd-accent-ink);
}

html[data-theme="dark"] .reader-toc a {
  color: var(--sd-ink-secondary);
}

html[data-theme="dark"] .reader-toc a[aria-current] {
  background: var(--sd-accent-soft);
  border-left-color: var(--sd-accent);
  color: var(--sd-accent-ink);
}

html[data-theme="dark"] .related-tabs [aria-selected="true"],
html[data-theme="dark"] .search-year-links .year-hit[aria-current="true"] {
  background: var(--sd-accent-soft);
  border-color: var(--sd-accent);
  color: var(--sd-accent-ink);
}

html[data-theme="dark"] .mcp-os-btn {
  color: var(--sd-ink-secondary);
}

html[data-theme="dark"] .mcp-os-btn[aria-pressed="true"],
html[data-theme="dark"] .mcp-os-btn.active,
html[data-theme="dark"] .mcp-page .mcp-apps .chip-select[aria-selected="true"] {
  background: var(--sd-accent);
  border-color: var(--sd-accent);
  color: #111213;
}

html[data-theme="dark"] .config-box {
  background: #0B0D11;
  border: 1px solid var(--sd-border);
  color: #F5F2EC;
}

html[data-theme="dark"] .dropdown a,
html[data-theme="dark"] .dropdown button {
  color: var(--sd-ink);
}

html[data-theme="dark"] .dropdown a:hover,
html[data-theme="dark"] .dropdown button:hover {
  background: var(--sd-hover);
  color: var(--sd-accent-ink);
}

html[data-theme="dark"] .skel {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .toast,
html[data-theme="dark"] .compare-tray {
  background: #F5F2EC;
  color: #111213;
}

html[data-theme="dark"] .compare-tray-count {
  color: #B84300;
}

html[data-theme="dark"] .compare-tray-actions .btn-ghost {
  color: #4E473F;
}

html[data-theme="dark"] .compare-table thead th,
html[data-theme="dark"] .compare-row-head {
  background: var(--sd-surface-subtle);
  color: var(--sd-ink);
}

html[data-theme="dark"] .member-badge {
  color: var(--sd-accent-ink);
}

html[data-theme="dark"] .plenary-toggle {
  background: var(--sd-surface-subtle);
  border-color: var(--border-strong);
  color: var(--sd-ink);
}

/* ==========================================================================
   MOBILE & TABLET (< 1024px): Sticky 56px Frosted Topbar + Slide-Over Drawer
   ========================================================================== */

@media (max-width: 1023px) {
  :root {
    --sdeeka-top: 56px;
  }

  .sd-shell {
    flex-direction: column;
  }

  .sd-topbar-inner {
    min-height: 56px;
    padding: 6px max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left));
    gap: 8px;
  }

  .sd-topbar-search,
  .sd-topbar-context,
  .sd-topbar-meta,
  .sd-topbar-reader-tools,
  .sd-collapse-btn {
    display: none !important;
  }

  .sd-mob-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid var(--sd-border);
    background: var(--sd-surface);
    color: var(--sd-ink);
    text-decoration: none;
    cursor: pointer;
    flex: 0 0 auto;
  }

  .sd-mob-btn:hover {
    border-color: var(--sd-accent);
    color: var(--sd-accent-ink);
  }

  .sd-mob-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--sd-ink);
    min-height: 44px;
    min-width: 0;
  }

  .sd-mob-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  /* Slide-Over Frosted Glass Drawer */
  .sd-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 210;
    background: rgba(0, 0, 0, 0.45);
  }

  .sd-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    margin: 0;
    height: 100vh;
    height: 100dvh;
    width: 280px;
    border-radius: 0 22px 22px 0;
    z-index: 220;
    transform: translateX(-106%);
    visibility: hidden;
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 220ms;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .sd-sidebar.is-drawer-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0s;
  }

  .sd-drawer-close {
    display: inline-flex;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .sd-cta,
  .sd-nav-item,
  .sd-col-item,
  .sd-theme-btn,
  .sd-login-cta,
  .sd-user-pill {
    min-height: 44px;
  }

  .sd-sidebar .sd-sb-foot {
    position: relative;
  }

  .sd-sidebar .sd-avatar-menu {
    position: relative;
  }

  .sd-sidebar .sd-account-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    top: auto;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    z-index: 270;
  }

  .pub-main,
  .pub-main:has(.page-case) {
    padding-left: 16px;
    padding-right: 16px;
  }

  .page-narrow {
    padding: 20px 0 56px;
  }

  .reader-layout {
    display: block;
  }

  .reader-toc {
    position: static;
    margin-bottom: 16px;
  }

  .reader-promo {
    margin-top: 20px;
    position: static;
  }

  .page-chat .composer-zone {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 767px) {
  .sd-sidebar {
    width: min(300px, 86vw);
  }
}

/* ==========================================================================
   REDUCED MOTION GUARDRAIL
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  body,
  .sd-sidebar,
  .sd-brand-meta,
  .sd-label,
  .sd-cta,
  .sd-nav-item,
  .sd-col-item,
  .sd-theme-btn,
  .sd-glass-tooltip {
    transition: none !important;
    animation: none !important;
  }
}

/* ==========================================================================
   FORCED-LIGHT PRINT & PDF GUARDRAIL (NEVER BLEEDS DARK MODE)
   ========================================================================== */

html[data-force-light="true"],
html[data-force-light="true"] body,
html[data-force-light="true"] .print-document {
  --sd-canvas: #FFFFFF;
  --sd-surface: #FFFFFF;
  --sd-ink: #000000;
  --canvas: #FFFFFF;
  --card: #FFFFFF;
  --ink: #000000;
  --text: #000000;
  background: #FFFFFF !important;
  background-image: none !important;
  color: #000000 !important;
  color-scheme: light !important;
}

.print-mobile-navigation #sdMobileMenuBtn,
.print-mobile-navigation [data-sd-theme-toggle] {
  display: none !important;
}

@media print {
  html,
  html[data-theme="dark"],
  body,
  .sd-main-col,
  .pub-main,
  .case-article,
  .case-article .reading-panel,
  .case-article > #caseLaws,
  .case-article > .v2-analysis,
  .case-article > .v2-related,
  .print-document {
    background: #FFFFFF !important;
    background-image: none !important;
    color: #000000 !important;
    box-shadow: none !important;
  }

  .case-article *,
  .print-document * {
    color: #000000 !important;
    background-color: transparent !important;
  }

  .sd-sidebar,
  .sd-topbar,
  .sd-drawer-backdrop,
  .sd-glass-tooltip,
  .print-toolbar,
  .print-mobile-navigation {
    display: none !important;
  }
}
