/* ==============================================================================
 * Ethereal Zen & High-Editorial Soothing Theme
 * Inspired by RP360 Prospective Clinical Simulation
 * Fonts: Newsreader (Editorial Serif), Plus Jakarta Sans (Clean UI), JetBrains Mono
 * Colors: Canvas (#FAF8F5), Sand (50-900), Terracotta (50-700), Sage (50-700)
 * ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;0,6..72,500;1,6..72,400;1,6..72,500&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ── Reference Palette Tokens ────────────────────────────────────────── */
  --canvas: #FAF8F5;

  /* Sand Palette (Calm, organic, tactile grays & warm neutrals) */
  --sand-50: #FDFCFB;
  --sand-100: #F6F3EE;
  --sand-200: #EDE8E0;
  --sand-300: #DFD8CC;
  --sand-400: #BCB2A1;
  --sand-500: #8E8270;
  --sand-600: #736857;
  --sand-700: #554D40;
  --sand-800: #3A352D;
  --sand-900: #23201B;

  /* Terracotta Palette (Warm Coral & Earthy Clay Accent) */
  --terracotta-50: #FDF6F4;
  --terracotta-100: #F8ECE7;
  --terracotta-200: #F1D5CC;
  --terracotta-300: #E4A695;
  --terracotta-400: #D6816B;
  --terracotta-500: #C8684D;
  --terracotta-600: #B2543B;
  --terracotta-700: #8D3F2C;
  --terracotta-800: #6E2E1E;
  --terracotta-900: #4A1E13;

  /* Sage Palette (Serene Eucalyptus & Botanical Green Accent) */
  --sage-50: #F3F6F4;
  --sage-100: #E4ECE6;
  --sage-200: #CADBD0;
  --sage-300: #9EC0AA;
  --sage-400: #739B82;
  --sage-500: #4F7560;
  --sage-600: #3D5E4C;
  --sage-700: #2D4739;
  --sage-800: #1F3328;
  --sage-900: #14221A;

  /* ── Component Semantic Variables ────────────────────────────────────── */
  --st-primary: var(--terracotta-500);
  --st-primary-hover: var(--terracotta-600);
  --st-primary-light: var(--terracotta-50);
  --st-accent-sage: var(--sage-500);
  --st-accent-dark: var(--sand-900);

  --st-bg-main: var(--canvas);
  --st-bg-sidebar: var(--sand-100);
  --st-bg-secondary: var(--sand-100);
  --st-bg-card: rgba(255, 255, 255, 0.76);
  --st-card-bg: rgba(255, 255, 255, 0.76);

  --st-text-color: var(--sand-900);
  --st-text-muted: var(--sand-500);
  --st-border-color: var(--sand-200);
  --st-border-hover: var(--sand-300);
  --st-border-input: var(--sand-200);
  --st-code-bg: var(--sand-100);

  --st-chat-assistant-bg: rgba(255, 255, 255, 0.85);
  --st-chat-user-bg: var(--sand-100);

  /* Typography */
  --st-font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --st-font-serif: "Newsreader", Georgia, serif;
  --st-font-mono: "JetBrains Mono", monospace;

  /* Corner Radii */
  --st-radius-xs: 0.35rem;
  --st-radius-sm: 0.5rem;
  --st-radius: 0.85rem;
  --st-radius-lg: 1.25rem;
  --st-radius-xl: 1.5rem;
  --st-radius-pill: 9999px;

  /* Shadows */
  --st-shadow-xs: 0 1px 2px rgba(60, 50, 40, 0.04);
  --st-shadow-sm: 0 2px 6px rgba(60, 50, 40, 0.03);
  --st-shadow: 0 10px 30px -10px rgba(60, 50, 40, 0.03);
  --st-shadow-md: 0 16px 36px -10px rgba(60, 50, 40, 0.06);
  --st-shadow-lg: 0 24px 60px -15px rgba(60, 50, 40, 0.12);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

::selection {
  background-color: var(--sand-200);
  color: var(--sand-900);
}

body {
  font-family: var(--st-font);
  background-color: var(--canvas);
  color: var(--sand-900);
  line-height: 1.65;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ── Typography & Editorial Styles ───────────────────────────────────────── */
.serif-heading {
  font-family: var(--st-font-serif);
  letter-spacing: -0.02em;
  font-weight: 300;
  color: var(--sand-900);
}

.serif-italic {
  font-family: var(--st-font-serif);
  font-style: italic;
  font-weight: 400;
}

.st-eyebrow {
  font-family: var(--st-font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--sand-400);
  display: block;
  margin-bottom: 0.35rem;
}

.st-lead-subtitle {
  font-size: 0.98rem;
  font-weight: 300;
  color: var(--sand-500);
  line-height: 1.65;
  max-width: 800px;
  margin-top: 0.35rem;
  margin-bottom: 1.25rem;
}

h1, .st-h1 {
  font-family: var(--st-font-serif);
  font-size: 2.6rem;
  font-weight: 300;
  letter-spacing: -0.025em;
  color: var(--sand-900);
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

h2, .st-h2 {
  font-family: var(--st-font-serif);
  font-size: 1.95rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--sand-900);
  margin: 1.75rem 0 0.75rem;
  line-height: 1.25;
}

h3, .st-h3 {
  font-family: var(--st-font-serif);
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--sand-900);
  margin: 1.4rem 0 0.5rem;
}

h4, .st-h4 {
  font-family: var(--st-font);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--sand-800);
  margin: 1rem 0 0.4rem;
}

p, li {
  color: var(--sand-700);
  margin-bottom: 0.5rem;
  font-size: 0.96rem;
  line-height: 1.7;
}

ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

li {
  margin-bottom: 0.45rem;
}

a {
  color: var(--terracotta-600);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--terracotta-700);
  text-decoration: underline;
}

code, kbd, samp, pre {
  font-family: var(--st-font-mono);
}

hr {
  border: 0;
  border-top: 1px solid var(--sand-200);
  margin: 2rem 0;
}

/* ── Ethereal Frosted Zen Card (RP360 Core Artwork) ───────────────────────── */
.zen-card {
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(230, 225, 215, 0.65);
  border-radius: var(--st-radius-xl);
  box-shadow: 0 10px 30px -10px rgba(60, 50, 40, 0.03);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.zen-card:hover {
  box-shadow: 0 16px 36px -10px rgba(60, 50, 40, 0.06);
  border-color: rgba(200, 190, 175, 0.85);
}

.st-card {
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(230, 225, 215, 0.65);
  border-radius: var(--st-radius-lg);
  box-shadow: 0 10px 30px -10px rgba(60, 50, 40, 0.03);
  padding: 1.25rem 1.5rem;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── App Layout ───────────────────────────────────────────────────────────── */
.st-app {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background-color: var(--canvas);
}

/* ── Streamlit Sidebar ────────────────────────────────────────────────────── */
.st-sidebar {
  width: 290px;
  min-width: 290px;
  background-color: var(--sand-100);
  border-right: 1px solid var(--sand-200);
  padding: 1.25rem 1.25rem 2.25rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: margin-left, transform;
}

.st-sidebar.collapsed {
  margin-left: -290px;
  pointer-events: none;
}

.st-sidebar::-webkit-scrollbar {
  width: 5px;
}
.st-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.st-sidebar::-webkit-scrollbar-thumb {
  background: var(--sand-300);
  border-radius: 9999px;
}
.st-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--sand-400);
}

.st-sidebar-top-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 0.5rem;
}

.st-sidebar-toggle-btn {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--sand-200);
  color: var(--sand-500);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.st-sidebar-toggle-btn:hover {
  background: #FFFFFF;
  color: var(--sand-900);
  border-color: var(--sand-300);
}

/* Floating Expand Button when Sidebar is Collapsed */
.st-sidebar-expand-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 999;
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--sand-900);
  border: 1px solid var(--sand-200);
  box-shadow: 0 4px 18px rgba(60, 50, 40, 0.08);
  border-radius: 9999px;
  padding: 7px 16px 7px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.st-sidebar-expand-btn:hover {
  background: #FFFFFF;
  color: var(--sand-900);
  border-color: var(--sand-400);
  transform: translateX(2px);
  box-shadow: 0 6px 22px rgba(60, 50, 40, 0.12);
}

.st-sidebar-expand-btn.visible {
  display: inline-flex;
  animation: stSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes stSlideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

.st-sidebar-overlay {
  display: none;
}

/* Dynamic Circular Image Header */
.st-sidebar-image-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1.25rem;
}

.st-sidebar-image {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid #FFFFFF;
  box-shadow: 0 4px 18px rgba(60, 50, 40, 0.08);
  transition: transform 0.25s ease;
  background-color: #FFFFFF;
}

.st-sidebar-image:hover {
  transform: scale(1.03);
}

/* Social Icon Pills in Sidebar */
.st-sidebar-social {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.5rem;
}

.st-social-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: #FFFFFF;
  border: 1px solid var(--sand-200);
  color: var(--sand-600);
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(60, 50, 40, 0.04);
}

.st-social-icon-btn:hover {
  background-color: var(--sand-900);
  border-color: var(--sand-900);
  color: var(--canvas);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(35, 32, 27, 0.15);
}

.st-social-icon-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.st-sidebar-heading {
  font-family: var(--st-font-serif);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0.5rem 0 0.85rem 0.5rem;
  color: var(--sand-900);
}

/* Streamlit Button Navigation List */
.st-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.st-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0.6rem 1rem;
  background-color: #FFFFFF;
  border: 1px solid var(--sand-200);
  border-radius: var(--st-radius-pill);
  font-family: var(--st-font);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--sand-700);
  cursor: pointer;
  text-align: left;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(60, 50, 40, 0.02);
}

.st-nav-btn:hover {
  background-color: var(--canvas);
  border-color: var(--sand-300);
  color: var(--sand-900);
  transform: translateX(2px);
}

.st-nav-btn.active {
  background-color: var(--sand-900);
  border-color: var(--sand-900);
  color: var(--canvas);
  font-weight: 600;
  box-shadow: 0 3px 12px rgba(35, 32, 27, 0.14);
}

.st-nav-btn.active .st-nav-btn-icon {
  transform: scale(1.1);
}

.st-nav-btn-icon {
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 0.15s ease;
}

/* Sidebar Auth Buttons Row */
.st-sidebar-auth {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--sand-200);
}

.st-auth-btn {
  flex: 1;
  padding: 0.55rem 0.8rem;
  background-color: #FFFFFF;
  border: 1px solid var(--sand-200);
  border-radius: var(--st-radius-pill);
  font-family: var(--st-font);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--sand-800);
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: center;
  box-shadow: 0 1px 2px rgba(60, 50, 40, 0.03);
}

.st-auth-btn:hover {
  border-color: var(--sand-400);
  background-color: var(--canvas);
  color: var(--sand-900);
}

/* ── Main Content Area ────────────────────────────────────────────────────── */
.st-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  background-color: var(--canvas);
  min-width: 0;
  overflow-x: hidden;
}

.st-block-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.25rem 2.25rem 5rem;
  box-sizing: border-box;
}

/* ── Tab Views ───────────────────────────────────────────────────────────── */
.st-tab-view {
  display: none;
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.st-tab-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Sublime Minimalist Switcher (RP360 Nav Component) ───────────────────── */
.st-sublime-switcher, .st-tabs-nav, #stock-subtabs {
  display: flex !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px !important;
  background: rgba(246, 243, 238, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 4px 6px;
  border-radius: 9999px;
  border: 1px solid rgba(237, 232, 224, 0.8);
  margin-bottom: 1.75rem;
  width: fit-content !important;
  max-width: 100%;
  box-shadow: 0 1px 4px rgba(60, 50, 40, 0.02);
}

.st-tab-trigger, .st-sublime-btn {
  padding: 6px 16px !important;
  border-radius: 9999px !important;
  border: none !important;
  border-bottom: none !important;
  background: transparent !important;
  font-family: var(--st-font);
  font-size: 0.84rem !important;
  font-weight: 500;
  color: var(--sand-500) !important;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap !important;
  text-align: center;
}

.st-tab-trigger:hover, .st-sublime-btn:hover {
  color: var(--sand-900) !important;
  background-color: rgba(255, 255, 255, 0.5) !important;
}

.st-tab-trigger.active, .st-sublime-btn.active {
  background: #FFFFFF !important;
  color: var(--sand-900) !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(60, 50, 40, 0.06) !important;
}

/* ── Streamlit Buttons & Controls ────────────────────────────────────────── */
.st-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.52rem 1.3rem;
  background-color: #FFFFFF;
  border: 1px solid var(--sand-200);
  border-radius: var(--st-radius-pill);
  font-family: var(--st-font);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--sand-800);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(60, 50, 40, 0.04);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.st-btn:hover {
  border-color: var(--sand-300);
  background-color: var(--canvas);
  color: var(--sand-900);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(60, 50, 40, 0.06);
}

.st-btn:active {
  transform: scale(0.98);
}

.st-btn-primary {
  background-color: var(--sand-900);
  border-color: var(--sand-900);
  color: var(--canvas);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(35, 32, 27, 0.12);
}

.st-btn-primary:hover {
  background-color: var(--sand-800);
  border-color: var(--sand-800);
  color: var(--canvas);
  box-shadow: 0 4px 14px rgba(35, 32, 27, 0.18);
  transform: translateY(-1px);
}

.st-btn-terracotta {
  background-color: var(--terracotta-500);
  border-color: var(--terracotta-500);
  color: #FFFFFF;
  font-weight: 600;
}
.st-btn-terracotta:hover {
  background-color: var(--terracotta-600);
  border-color: var(--terracotta-600);
  color: #FFFFFF;
}

.st-btn-sage {
  background-color: var(--sage-500);
  border-color: var(--sage-500);
  color: #FFFFFF;
  font-weight: 600;
}
.st-btn-sage:hover {
  background-color: var(--sage-600);
  border-color: var(--sage-600);
  color: #FFFFFF;
}

/* Radio Group */
.st-radio-group {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  margin: 0.75rem 0 1.25rem;
}

.st-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  cursor: pointer;
  color: var(--sand-800);
}

.st-radio-label input[type="radio"] {
  accent-color: var(--sand-900);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ── Tactile Custom Smooth Slider (Exact Reference Art) ───────────────────── */
.st-slider-container {
  margin: 1.25rem 0 1.75rem;
}

.st-slider-container label {
  display: flex;
  justify-content: space-between;
  font-weight: 500;
  margin-bottom: 0.6rem;
  font-size: 0.92rem;
  color: var(--sand-800);
}

input[type=range], .st-slider {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  width: 100%;
  cursor: pointer;
}

input[type=range]::-webkit-slider-runnable-track,
.st-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 9999px;
  background: #E8E2D8;
}

input[type=range]::-webkit-slider-thumb,
.st-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 22px;
  width: 22px;
  border-radius: 9999px;
  background: var(--sand-900);
  border: 3px solid var(--canvas);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-top: -9px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

input[type=range]::-webkit-slider-thumb:hover,
.st-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type=range]::-moz-range-track,
.st-slider::-moz-range-track {
  height: 4px;
  border-radius: 9999px;
  background: #E8E2D8;
}

input[type=range]::-moz-range-thumb,
.st-slider::-moz-range-thumb {
  height: 20px;
  width: 20px;
  border-radius: 9999px;
  background: var(--sand-900);
  border: 3px solid var(--canvas);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

/* ── Streamlit Metrics & Status Cards ────────────────────────────────────── */
.st-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin: 1.25rem 0;
}

.st-metric-card {
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(230, 225, 215, 0.65);
  border-radius: var(--st-radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 4px 16px -2px rgba(60, 50, 40, 0.03);
  transition: all 0.25s ease;
}

.st-metric-card:hover {
  border-color: rgba(200, 190, 175, 0.85);
  box-shadow: 0 8px 24px -4px rgba(60, 50, 40, 0.06);
}

.st-metric-label {
  font-family: var(--st-font-mono);
  font-size: 0.72rem;
  color: var(--sand-400);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.st-metric-value {
  font-family: var(--st-font-serif);
  font-size: 1.85rem;
  font-weight: 400;
  color: var(--sand-900);
}

/* Soft State Capsules & Status Badges (RP360 Pill Art) */
.st-status-badge, .st-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
}

.st-status-badge.positive, .st-status-pill-db {
  background-color: var(--sage-50);
  color: var(--sage-700);
  border: 1px solid var(--sage-200);
}

.st-status-badge.negative,
.st-status-badge.loss,
.st-status-pill-offline {
  background-color: var(--terracotta-50);
  color: var(--terracotta-700);
  border: 1px solid var(--terracotta-200);
}

.st-status-badge.neutral, .st-status-pill-auth {
  background-color: var(--sand-100);
  color: var(--sand-700);
  border: 1px solid var(--sand-200);
}

.st-status-badge.warning {
  background-color: #FDF8ED;
  color: #92400E;
  border: 1px solid #FDE68A;
}

/* ── Streamlit Expander Component ────────────────────────────────────────── */
.st-expander {
  border: 1px solid var(--sand-200);
  border-radius: var(--st-radius-lg);
  background: rgba(255, 255, 255, 0.76);
  margin: 1.25rem 0;
  overflow: hidden;
  box-shadow: 0 4px 16px -2px rgba(60, 50, 40, 0.03);
}

.st-expander-header {
  padding: 0.85rem 1.25rem;
  background: var(--sand-100);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  color: var(--sand-900);
  transition: background 0.15s ease;
}

.st-expander-header:hover {
  background: var(--sand-200);
}

.st-expander-content {
  padding: 1.25rem;
  border-top: 1px solid var(--sand-200);
  background: #FFFFFF;
}

/* ── Streamlit Table Component ───────────────────────────────────────────── */
.st-dataframe-container {
  max-height: 460px;
  overflow: auto;
  border: 1px solid var(--sand-200);
  border-radius: var(--st-radius-xl);
  background: rgba(255, 255, 255, 0.85);
  margin: 1.25rem 0;
  box-shadow: 0 4px 18px rgba(60, 50, 40, 0.03);
}

.st-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.st-table th {
  position: sticky;
  top: 0;
  background: var(--sand-100);
  color: var(--sand-600);
  font-family: var(--st-font-serif);
  font-weight: 500;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--sand-200);
  z-index: 2;
}

.st-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--sand-100);
  color: var(--sand-800);
}

.st-table tbody tr:hover {
  background-color: rgba(246, 243, 238, 0.6);
}

/* Stock Screener Tables */
.valuation-table, .financial-table, #multibagger-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 20px rgba(60, 50, 40, 0.03);
  border-radius: var(--st-radius-lg);
  overflow: hidden;
  border: 1px solid var(--sand-200);
}

.valuation-table th, .financial-table th, #multibagger-table th {
  background-color: var(--sand-100);
  color: var(--sand-700);
  font-family: var(--st-font-serif);
  font-weight: 500;
  text-align: left;
  padding: 11px 16px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--sand-200);
}

.valuation-table td, .financial-table td, #multibagger-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--sand-100);
  vertical-align: middle;
  color: var(--sand-800);
}

.valuation-table tr:hover, .financial-table tr:hover, #multibagger-table tr:hover {
  background-color: rgba(246, 243, 238, 0.6);
}

.value-col {
  text-align: right;
  font-weight: 600;
  color: var(--sand-900);
  font-family: var(--st-font-mono);
}

.spacer-col {
  width: 25px;
  background: transparent !important;
  border-bottom: 1px solid transparent !important;
}

.metric-col {
  color: var(--sand-800);
  font-weight: 500;
}

.verdict-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.78rem;
}

.verdict-badge.positive {
  background-color: var(--sage-50);
  color: var(--sage-700);
  border: 1px solid var(--sage-200);
}

.verdict-badge.warning {
  background-color: #FDF8ED;
  color: #92400E;
  border: 1px solid #FDE68A;
}

.verdict-badge.negative {
  background-color: var(--terracotta-50);
  color: var(--terracotta-700);
  border: 1px solid var(--terracotta-200);
}

/* Clickable Stock Scan Rows & Cards */
.stock-clickable-row, .stock-clickable-item {
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.stock-clickable-row:hover, .stock-clickable-item:hover {
  background-color: var(--sand-100) !important;
  border-color: var(--sand-300) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(60, 50, 40, 0.05);
}

.stock-clickable-row.selected-stock-row, .stock-clickable-item.selected-stock-row {
  background-color: var(--sand-200) !important;
  border-color: var(--sand-400) !important;
  font-weight: 600;
}

/* ── Streamlit File Uploader ─────────────────────────────────────────────── */
.st-file-uploader {
  border: 2px dashed var(--sand-300);
  background-color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--st-radius-xl);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  margin: 1.5rem 0;
}

.st-file-uploader:hover, .st-file-uploader.dragover {
  border-color: var(--terracotta-500);
  background-color: var(--terracotta-50);
  transform: scale(1.005);
}

.st-uploader-icon {
  font-size: 2.5rem;
  color: var(--sand-400);
  margin-bottom: 0.65rem;
}

.st-uploader-text {
  font-family: var(--st-font-serif);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--sand-900);
}

.st-uploader-subtext {
  font-family: var(--st-font-mono);
  font-size: 0.78rem;
  color: var(--sand-500);
  margin-top: 6px;
}

/* ── 4-Column Image Classification Grid ──────────────────────────────────── */
.st-preview-image-box {
  text-align: center;
  margin: 1.5rem 0 2rem;
}

.st-uploaded-img {
  max-width: 320px;
  max-height: 320px;
  border-radius: var(--st-radius-lg);
  box-shadow: 0 8px 25px rgba(60, 50, 40, 0.08);
  border: 1px solid var(--sand-200);
}

.st-caption {
  font-size: 0.82rem;
  color: var(--sand-500);
  margin-top: 0.45rem;
  font-family: var(--st-font-mono);
}

.st-columns-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-top: 1.75rem;
}

@media (max-width: 860px) {
  .st-columns-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 520px) {
  .st-columns-4 {
    grid-template-columns: 1fr;
  }
}

.st-model-card {
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(230, 225, 215, 0.65);
  border-radius: var(--st-radius-lg);
  padding: 1.25rem 1.15rem;
  box-shadow: 0 4px 18px rgba(60, 50, 40, 0.03);
  font-size: 0.9rem;
  line-height: 1.7;
  transition: all 0.25s ease;
}

.st-model-card:hover {
  border-color: rgba(200, 190, 175, 0.85);
  box-shadow: 0 10px 28px rgba(60, 50, 40, 0.06);
  transform: translateY(-2px);
}

.st-model-card strong {
  color: var(--sand-900);
}

.st-model-card-item {
  margin-bottom: 0.35rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.86rem;
  border-bottom: 1px solid var(--sand-100);
  padding-bottom: 4px;
}

/* ── Streamlit Chat Interface & Agent Workspaces ─────────────────────────── */
.st-chat-workspace {
  display: flex;
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(230, 225, 215, 0.65);
  border-radius: var(--st-radius-xl);
  width: 100%;
  min-height: 680px;
  height: calc(100vh - 135px);
  color: var(--sand-900);
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px -10px rgba(60, 50, 40, 0.03);
}

.st-chat-history-sidebar {
  width: 270px;
  min-width: 250px;
  flex-shrink: 0;
  background: var(--sand-100);
  border-right: 1px solid var(--sand-200);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
}

.st-agent-new-chat-btn {
  background: #FFFFFF;
  border: 1px solid var(--sand-200);
  border-radius: var(--st-radius-pill);
  color: var(--sand-900);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(60, 50, 40, 0.04);
}

.st-agent-new-chat-btn:hover {
  background: var(--canvas);
  border-color: var(--sand-400);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(60, 50, 40, 0.07);
}

.st-chat-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px 10px;
}

.st-chat-history-title {
  font-family: var(--st-font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--sand-400);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.st-chat-history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex: 1;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--sand-300) transparent;
}

.st-history-empty {
  padding: 24px 8px;
  font-size: 0.84rem;
  color: var(--sand-500);
  text-align: center;
  font-style: italic;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--st-radius);
  font-size: 0.85rem;
  color: var(--sand-700);
  cursor: pointer;
  transition: all 0.15s ease;
  background: transparent;
  user-select: none;
  border: 1px solid transparent;
}

.history-item:hover {
  background: #FFFFFF;
  border-color: var(--sand-200);
  color: var(--sand-900);
}

.history-item.is-active {
  background: #FFFFFF;
  border-color: var(--sand-300);
  color: var(--sand-900);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(60, 50, 40, 0.04);
}

.history-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 6px;
}

.history-item-delete {
  opacity: 0;
  background: none;
  border: none;
  color: var(--sand-400);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.history-item:hover .history-item-delete {
  opacity: 0.75;
}

.history-item-delete:hover {
  opacity: 1;
  color: var(--terracotta-600);
  background: var(--terracotta-50);
}

.st-chat-main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.6);
  position: relative;
}

.st-agent-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--sand-300) transparent;
}

/* Hero State (Assimilated Centered Welcome View) */
.st-agent-hero-view {
  max-width: 900px;
  width: 100%;
  margin: auto;
  text-align: center;
  padding: 2.5rem 1.5rem 2rem;
}

.st-agent-hero-title {
  font-family: var(--st-font-serif);
  font-size: 2.5rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--sand-900);
  margin-bottom: 0.65rem;
  line-height: 1.25;
}

.st-agent-hero-subtitle {
  font-size: 0.98rem;
  font-weight: 300;
  color: var(--sand-500);
  margin-bottom: 2.25rem;
  line-height: 1.6;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

/* Usable Input Bar (Capsule Art) */
.st-agent-input-bar {
  background: #FFFFFF;
  border: 1px solid var(--sand-300);
  border-radius: 9999px;
  padding: 8px 10px 8px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(60, 50, 40, 0.04);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.st-agent-input-bar:focus-within {
  border-color: var(--sand-400);
  box-shadow: 0 0 0 3px rgba(200, 104, 77, 0.12), 0 4px 22px rgba(60, 50, 40, 0.06);
}

.st-agent-input-field {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--sand-900);
  font-size: 0.98rem;
  font-family: var(--st-font);
  min-width: 0;
  padding: 6px 4px;
}

.st-agent-input-field::placeholder {
  color: var(--sand-400);
}

.st-agent-send-btn {
  background: var(--sand-900);
  border: none;
  color: var(--canvas);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(35, 32, 27, 0.15);
  flex-shrink: 0;
}

.st-agent-send-btn:hover {
  background: var(--sand-800);
  transform: scale(1.06);
}

.st-agent-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Quick Action Prompts Grid */
.st-agent-prompts-grid {
  margin-top: 2.25rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  max-width: 920px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.st-agent-prompt-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--st-radius-lg);
  color: var(--sand-800);
  font-family: var(--st-font);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  border: 1px solid var(--sand-200);
  width: 100%;
  outline: none;
  box-shadow: 0 2px 8px rgba(60, 50, 40, 0.02);
}

.st-agent-prompt-item:hover,
.st-agent-prompt-item:focus-visible {
  background: #FFFFFF;
  border-color: var(--sand-300);
  color: var(--sand-900);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(60, 50, 40, 0.06);
}

.st-prompt-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.st-prompt-text {
  flex: 1;
  line-height: 1.45;
}

/* Bottom Docked Input Bar (Active Conversation) */
.st-agent-bottom-bar {
  position: sticky;
  bottom: 0;
  padding: 14px 24px;
  background: rgba(250, 248, 245, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--sand-200);
  z-index: 20;
  width: 100%;
}

.st-agent-bottom-bar .st-agent-input-bar {
  max-width: 960px;
}

/* Chat Messages */
.st-chat-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.st-chat-message {
  display: flex;
  gap: 14px;
  padding: 1.15rem 1.35rem;
  border-radius: var(--st-radius-lg);
  max-width: 100%;
  font-size: 0.94rem;
  line-height: 1.65;
}

.st-chat-message.assistant {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--sand-200);
  border-radius: 1.25rem 1.25rem 1.25rem 0.25rem;
  box-shadow: 0 2px 10px rgba(60, 50, 40, 0.02);
}

.st-chat-message.user {
  background: var(--sand-100);
  border: 1px solid var(--sand-200);
  border-radius: 1.25rem 1.25rem 0.25rem 1.25rem;
  margin-left: auto;
  max-width: 85%;
}

.st-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background-color: #FFFFFF;
  border: 1px solid var(--sand-200);
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(60, 50, 40, 0.06);
}

.st-chat-content {
  flex: 1;
  overflow-wrap: break-word;
}

.st-agent-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--sand-600);
  margin-bottom: 0.75rem;
  padding: 3px 10px;
  background-color: var(--sand-100);
  border: 1px solid var(--sand-200);
  border-radius: 9999px;
  font-family: var(--st-font-mono);
}

.st-tool-call-card {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  background-color: #FFFFFF;
  border-left: 3px solid var(--terracotta-500);
  border-radius: var(--st-radius-sm);
  border-top: 1px solid var(--sand-200);
  border-right: 1px solid var(--sand-200);
  border-bottom: 1px solid var(--sand-200);
  font-size: 0.85rem;
}

.st-tool-header {
  font-weight: 600;
  color: var(--terracotta-600);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0.25rem;
  font-family: var(--st-font-mono);
}

.st-tool-body {
  font-family: var(--st-font-mono);
  font-size: 0.8rem;
  color: var(--sand-600);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── LiveKit Voice AI Agent Styles ───────────────────────────────────────── */
.st-voice-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem 3rem;
  max-width: 860px;
  margin: 0 auto;
  position: relative;
  width: 100%;
}

.st-voice-status-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(246, 243, 238, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid var(--sand-200);
  border-radius: 9999px;
  padding: 0.5rem 1.4rem;
  margin-bottom: 2rem;
  font-size: 0.84rem;
  color: var(--sand-500);
  box-shadow: 0 2px 8px rgba(60, 50, 40, 0.03);
}

.st-voice-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--sand-900);
}

.st-voice-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--sand-400);
  transition: all 0.3s ease;
}

.st-voice-status-dot.connected {
  background: var(--sage-500);
  box-shadow: 0 0 10px var(--sage-500);
  animation: voicePulse 1.8s infinite;
}

.st-voice-status-dot.connecting {
  background: var(--terracotta-500);
  box-shadow: 0 0 10px var(--terracotta-500);
  animation: voicePulse 1s infinite;
}

@keyframes voicePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

.st-voice-stage {
  position: relative;
  width: 340px;
  height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
}

canvas#voiceOrbCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 35px rgba(200, 104, 77, 0.25));
  transition: filter 0.5s ease;
}

.st-voice-center-badge {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  width: 170px;
}

.st-voice-orb-status {
  font-family: var(--st-font-serif);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--canvas);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  transition: all 0.3s ease;
}

.st-voice-orb-sub {
  font-size: 0.75rem;
  color: var(--sand-300);
  margin-top: 0.3rem;
  font-family: var(--st-font-mono);
}

.st-voice-tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(200, 104, 77, 0.2);
  border: 1px solid rgba(200, 104, 77, 0.4);
  color: var(--terracotta-100);
  padding: 0.3rem 0.8rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  margin-top: 0.5rem;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.st-voice-tool-pill.active {
  opacity: 1;
  transform: translateY(0);
}

.st-voice-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 2rem;
  max-width: 680px;
}

.st-voice-chip {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--sand-200);
  color: var(--sand-800);
  padding: 0.5rem 1.1rem;
  border-radius: 9999px;
  font-size: 0.84rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(60, 50, 40, 0.03);
}

.st-voice-chip:hover {
  background: #FFFFFF;
  transform: translateY(-2px);
  border-color: var(--sand-300);
  color: var(--sand-900);
  box-shadow: 0 4px 10px rgba(60, 50, 40, 0.06);
}

.st-voice-dock {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--sand-200);
  padding: 0.75rem 1.6rem;
  border-radius: 9999px;
  box-shadow: 0 10px 30px rgba(60, 50, 40, 0.06);
}

.st-voice-btn-call {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  outline: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sand-900);
  color: var(--canvas);
  box-shadow: 0 4px 16px rgba(35, 32, 27, 0.25);
  transition: all 0.25s ease;
}

.st-voice-btn-call:hover {
  transform: scale(1.08);
}

.st-voice-btn-call.in-call {
  background: var(--terracotta-500);
  box-shadow: 0 4px 18px rgba(200, 104, 77, 0.35);
}

.st-voice-btn-mic, .st-voice-btn-transcript {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--sand-200);
  background: #FFFFFF;
  color: var(--sand-800);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.st-voice-btn-mic:hover, .st-voice-btn-transcript:hover {
  border-color: var(--sand-400);
  transform: scale(1.06);
}

.st-voice-btn-mic.muted {
  background: var(--terracotta-50);
  border-color: var(--terracotta-200);
  color: var(--terracotta-700);
}

.st-voice-btn-transcript.active {
  background: var(--sand-900);
  border-color: var(--sand-900);
  color: var(--canvas);
}

.st-voice-transcript-drawer {
  width: 100%;
  max-width: 680px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid var(--sand-200);
  border-radius: var(--st-radius-lg);
  padding: 1.25rem 1.5rem;
  margin-top: 1.5rem;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  box-shadow: 0 4px 16px rgba(60, 50, 40, 0.04);
}

.st-voice-transcript-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.st-voice-msg-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  animation: fadeIn 0.2s ease;
}

.st-voice-msg-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.st-voice-msg-sender {
  font-family: var(--st-font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.st-voice-msg-sender.agent {
  color: var(--terracotta-600);
}

.st-voice-msg-sender.user {
  color: var(--sand-900);
}

.st-voice-msg-sender.system {
  color: var(--sand-400);
}

.st-voice-msg-time {
  font-size: 0.7rem;
  color: var(--sand-400);
  font-family: var(--st-font-mono);
}

.st-voice-msg-text {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--sand-800);
}

/* ── Tab Header Row with Architecture Trigger ────────────────────────────── */
.st-tab-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--sand-200);
}

.st-tab-header-title {
  flex: 1;
  min-width: 260px;
}

.st-tab-header-title h1 {
  margin: 0 0 0.35rem 0;
}

.st-arch-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--sand-100);
  color: var(--sand-800);
  border: 1px solid var(--sand-200);
  border-radius: 9999px;
  padding: 0.52rem 1.25rem;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(60, 50, 40, 0.03);
  white-space: nowrap;
}

.st-arch-trigger-btn:hover {
  background: #FFFFFF;
  border-color: var(--sand-400);
  color: var(--sand-900);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(60, 50, 40, 0.06);
}

/* ── Architecture Modal Pop-up ───────────────────────────────────────────── */
.st-arch-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(35, 32, 27, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
}

.st-arch-modal.active {
  display: flex;
  animation: modalFadeIn 0.25s ease-out forwards;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.st-arch-modal-dialog {
  background: var(--canvas);
  border: 1px solid var(--sand-200);
  border-radius: var(--st-radius-xl);
  width: 100%;
  max-width: 920px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(35, 32, 27, 0.16);
  overflow: hidden;
}

.st-arch-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.6rem;
  border-bottom: 1px solid var(--sand-200);
  background: var(--sand-100);
}

.st-arch-modal-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.st-arch-modal-header-left h3 {
  margin: 0;
  font-family: var(--st-font-serif);
  font-size: 1.35rem;
  color: var(--sand-900);
  font-weight: 400;
}

.st-arch-badge {
  display: inline-block;
  font-family: var(--st-font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 9999px;
  background: var(--terracotta-50);
  color: var(--terracotta-700);
  border: 1px solid var(--terracotta-200);
}

.st-arch-close-btn {
  background: transparent;
  border: none;
  color: var(--sand-500);
  font-size: 1.5rem;
  line-height: 1;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.st-arch-close-btn:hover {
  background: var(--sand-200);
  color: var(--sand-900);
}

.st-arch-modal-body {
  padding: 1.75rem;
  overflow-y: auto;
  color: var(--sand-800);
}

.st-arch-flow-wrapper {
  background: var(--sand-100);
  border: 1px solid var(--sand-200);
  border-radius: var(--st-radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.st-arch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.st-arch-step-card {
  background: #ffffff;
  border: 1px solid var(--sand-200);
  border-radius: var(--st-radius);
  padding: 1.1rem;
  box-shadow: 0 2px 6px rgba(60, 50, 40, 0.02);
}

.st-arch-step-card h4 {
  margin: 0 0 0.35rem 0;
  font-size: 0.95rem;
  color: var(--sand-900);
  display: flex;
  align-items: center;
  gap: 6px;
}

.st-arch-step-card p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--sand-600);
  line-height: 1.5;
}

/* ── Top Header & Global Status Bar ───────────────────────────────────────── */
.st-top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.4rem;
  margin-bottom: 1.75rem;
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(230, 225, 215, 0.7);
  border-radius: var(--st-radius-xl);
  box-shadow: 0 10px 30px -10px rgba(60, 50, 40, 0.03);
  gap: 1rem;
  flex-wrap: wrap;
}

.st-top-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.st-top-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.st-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 4px 6px;
  background: var(--sand-100);
  border: 1px solid var(--sand-200);
  border-radius: 9999px;
  font-size: 0.82rem;
  color: var(--sand-900);
  font-weight: 600;
}

.st-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--sand-900);
  color: var(--canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.st-role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--st-font-mono);
}

.st-role-admin {
  background: var(--terracotta-50);
  color: var(--terracotta-700);
  border: 1px solid var(--terracotta-200);
}

.st-role-user {
  background: var(--sage-50);
  color: var(--sage-700);
  border: 1px solid var(--sage-200);
}

/* ── Session & Checkpoint Control Toolbar ─────────────────────────────────── */
.st-session-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(246, 243, 238, 0.75);
  border: 1px solid var(--sand-200);
  border-radius: var(--st-radius-lg);
  padding: 0.65rem 1.1rem;
  margin-bottom: 1.25rem;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.84rem;
}

.st-session-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.st-session-badge {
  color: var(--sand-500);
  font-family: var(--st-font-mono);
  font-size: 0.8rem;
}

.st-session-badge strong {
  color: var(--sand-900);
}

.st-session-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--sage-700);
  font-weight: 600;
  font-size: 0.76rem;
  background: var(--sage-50);
  padding: 2px 10px;
  border-radius: 9999px;
  border: 1px solid var(--sage-200);
}

.st-session-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.st-session-btn {
  background: #FFFFFF;
  border: 1px solid var(--sand-200);
  border-radius: 9999px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sand-800);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.st-session-btn:hover {
  background: var(--canvas);
  border-color: var(--sand-400);
  color: var(--sand-900);
}

.st-session-btn-danger:hover {
  background: var(--terracotta-50);
  border-color: var(--terracotta-200);
  color: var(--terracotta-700);
}

/* ── 1-Click Demo Login Banner ────────────────────────────────────────────── */
.st-demo-login-banner {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--sand-200);
  border-radius: var(--st-radius-xl);
  padding: 1.15rem 1.4rem;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: 0 4px 18px rgba(60, 50, 40, 0.03);
}

.st-demo-login-btn {
  background: var(--sand-900);
  color: var(--canvas);
  border: none;
  border-radius: 9999px;
  padding: 0.65rem 1.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(35, 32, 27, 0.15);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.st-demo-login-btn:hover {
  background: var(--sand-800);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(35, 32, 27, 0.22);
}

/* ── Sidebar Auth Card (Logged In) ───────────────────────────────────────── */
.st-sidebar-user-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.st-sidebar-user-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.st-sidebar-user-details {
  flex: 1;
  min-width: 0;
}

.st-sidebar-user-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--sand-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.st-sidebar-user-email {
  font-size: 0.74rem;
  color: var(--sand-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--st-font-mono);
}

/* ─────────────────────────────────────────────────────────────────────────────
   MODALS, CHIPS, FORMS & NOTIFICATIONS
   ───────────────────────────────────────────────────────────────────────────── */
.modal-backdrop, .st-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(35, 32, 27, 0.45);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.is-open, .st-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
  display: flex;
}

.modal, .st-modal-card {
  position: relative;
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--canvas);
  border: 1px solid var(--sand-200);
  border-radius: var(--st-radius-xl);
  padding: 30px;
  box-shadow: 0 25px 60px -15px rgba(35, 32, 27, 0.18);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.is-open .modal, .st-modal-overlay.open .st-modal-card {
  transform: translateY(0) scale(1);
}

.modal-close, .st-modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--sand-400);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
  transition: all 0.15s ease;
}

.modal-close:hover, .st-modal-close-btn:hover {
  color: var(--sand-900);
  background: var(--sand-200);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: var(--sand-100);
  border: 1px solid var(--sand-200);
  border-radius: 9999px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--sand-700);
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.chip:hover {
  border-color: var(--sand-300);
  background: #FFFFFF;
  color: var(--sand-900);
}

.chip.is-active {
  background: var(--sand-900);
  border-color: var(--sand-900);
  color: var(--canvas) !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(35, 32, 27, 0.12);
}

.field {
  margin-bottom: 1.15rem;
}

.field-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--sand-800);
}

.field-input, .st-chat-input-field, select {
  width: 100%;
  padding: 0.65rem 0.95rem;
  border: 1px solid var(--sand-200);
  border-radius: var(--st-radius);
  background: #FFFFFF;
  color: var(--sand-900);
  font-size: 0.92rem;
  font-family: var(--st-font);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.field-input:focus, .st-chat-input-field:focus, select:focus {
  outline: none;
  border-color: var(--sand-400);
  box-shadow: 0 0 0 3px rgba(200, 104, 77, 0.12);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  z-index: 10000;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 48px));
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--sand-900);
  color: var(--canvas);
  border-left: 4px solid var(--sand-400);
  border-radius: var(--st-radius);
  padding: 12px 16px;
  font-size: 0.88rem;
  box-shadow: 0 10px 25px rgba(35, 32, 27, 0.2);
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.toast-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-item.toast-success {
  border-left-color: var(--sage-500);
}

.toast-item.toast-error {
  border-left-color: var(--terracotta-500);
}

.toast-item.toast-info {
  border-left-color: var(--sand-400);
}

.toast-msg {
  flex: 1;
  line-height: 1.45;
}

.toast-close {
  background: none;
  border: 0;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 0 4px;
  font-size: 1rem;
  line-height: 1;
}

.toast-close:hover {
  opacity: 1;
}

/* ── Clustering Sandbox Layout ────────────────────────────────────────────── */
.st-cluster-container {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

#cluster-raw-plot,
#cluster-result-plot {
  width: 100%;
  max-width: 680px;
  height: 640px;
  margin: 1.5rem auto;
  border-radius: var(--st-radius-xl);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(60, 50, 40, 0.04);
  border: 1px solid var(--sand-200);
  background-color: #FFFFFF;
}

#cluster-kdist-plot {
  width: 100%;
  max-width: 680px;
  height: 440px;
  margin: 1rem auto;
  border-radius: var(--st-radius-xl);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(60, 50, 40, 0.04);
  border: 1px solid var(--sand-200);
  background-color: #FFFFFF;
}

@media (max-width: 720px) {
  #cluster-raw-plot,
  #cluster-result-plot {
    height: 92vw;
  }
}

/* ── Glowing Social Icons (Organic Serene Edition) ───────────────────────── */
@keyframes glow {
  0% { box-shadow: 0 0 10px 3px rgba(200, 104, 77, 0.35); }
  50% { box-shadow: 0 0 22px 6px rgba(200, 104, 77, 0.6); }
  100% { box-shadow: 0 0 10px 3px rgba(200, 104, 77, 0.35); }
}

.glowing-image {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  animation: glow 2.5s infinite;
  display: block;
  border: 2px solid #FFFFFF;
}

.glowing-footer {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 50px;
  padding: 20px 0;
  width: 100%;
}

.inner-container {
  display: inline-block;
}

/* Spinner */
.st-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--sand-200);
  border-top-color: var(--sand-900);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── GitHub Stats & Contribution Map ─────────────────────────────────────── */
.st-github-contrib-map {
  width: 100%;
  max-width: 100%;
  border-radius: var(--st-radius-lg);
  box-shadow: none !important;
  background: #FFFFFF;
  border: 1px solid var(--sand-200);
  display: block;
  box-sizing: border-box;
}

#tab-home img:not(.glowing-image) {
  box-shadow: none !important;
}

/* Wide layout for agent chats */
.st-block-container.st-wide-layout,
.st-main:has(#tab-tour.active) .st-block-container,
.st-main:has(#tab-harry.active) .st-block-container {
  max-width: 100% !important;
  padding: 1rem 1.75rem !important;
}

#tab-harry, #tab-tour {
  width: 100%;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .st-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1001;
    box-shadow: 6px 0 30px rgba(35, 32, 27, 0.25);
  }

  .st-sidebar.collapsed {
    margin-left: -320px;
  }

  .st-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(35, 32, 27, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .st-sidebar:not(.collapsed) ~ .st-sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .st-block-container {
    padding: 1.5rem 1rem 4rem;
  }

  .zen-card {
    padding: 1.5rem 1.25rem !important;
  }

  h1, .st-h1 {
    font-size: 2rem;
  }

  .st-chat-workspace {
    flex-direction: column;
    height: auto;
    min-height: 600px;
  }

  .st-chat-history-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--sand-200);
    max-height: 190px;
  }

  .st-agent-prompts-grid {
    grid-template-columns: 1fr;
  }
}
