/* ===========================
   VARIABLES & RESET
   =========================== */
:root {
  --bg: #0a0a0c;
  --bg-subtle: #111114;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.13);
  --text: #e8e8ec;
  --text-muted: #8e8e9f;
  --text-dim: #52525e;
  --accent: #eab308;
  --accent-light: #facc15;
  --accent-muted: #ca8a04;
  --accent-bg: rgba(234, 179, 8, 0.1);
  --accent-border: rgba(234, 179, 8, 0.25);
  --accent-glow: rgba(234, 179, 8, 0.25);
  --green: #22c55e;
  --red: #ef4444;
  --gradient-main: linear-gradient(135deg, #eab308, #f59e0b, #d97706);
  --gradient-text: linear-gradient(135deg, #facc15, #fbbf24, #f59e0b);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --radius-lg: 24px;
  --radius-sm: 10px;
  --radius-full: 9999px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --accent-rgb: 234, 179, 8;
  --editor-line-number-bg: #050505;
  --red-accent: #ef4444;
  --red-accent-light: #f87171;
  --red-accent-muted: #b91c1c;
  --red-accent-bg: rgba(239, 68, 68, 0.1);
  --red-accent-border: rgba(239, 68, 68, 0.25);
  --red-accent-glow: rgba(239, 68, 68, 0.25);
  --red-accent-rgb: 239, 68, 68;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

textarea {
  font-family: var(--font);
}

button {
  font-family: var(--font);
}

/* ===========================
   BACKGROUND
   =========================== */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: linear-gradient(
      rgba(255, 255, 255, 0.015) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 64px 64px;
}

.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(130px);
  z-index: -1;
  pointer-events: none;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(
    circle,
    rgba(var(--accent-rgb), 0.08),
    transparent 70%
  );
  top: -150px;
  left: -100px;
  animation: orb-float 20s ease-in-out infinite;
}

.orb-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(
    circle,
    rgba(var(--accent-rgb), 0.06),
    transparent 70%
  );
  bottom: -100px;
  right: -80px;
  animation: orb-float 25s ease-in-out infinite reverse;
}

@keyframes orb-float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(30px, -25px) scale(1.04);
  }
  50% {
    transform: translate(-15px, 30px) scale(0.96);
  }
  75% {
    transform: translate(20px, 15px) scale(1.02);
  }
}

/* ===========================
   GLASS
   =========================== */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.glass-subtle {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ===========================
   UTILITY
   =========================== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.text-gradient {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ===========================
   BUTTONS
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-main);
  color: #0a0a0c;
  font-weight: 600;
  box-shadow: 0 0 24px var(--accent-glow);
}

.btn-primary:hover {
  box-shadow: 0 0 36px rgba(var(--accent-rgb), 0.4);
  transform: translateY(-2px) scale(1.02);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.btn-lg {
  padding: 14px 32px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.btn-arrow {
  transition: transform var(--transition);
}

.btn:hover .btn-arrow {
  transform: translateX(4px);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-icon:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  transform: scale(1.05);
}

/* ===========================
   LOGO
   =========================== */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform var(--transition);
}

.logo:hover {
  transform: scale(1.02);
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--gradient-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #0a0a0c;
  flex-shrink: 0;
}

.logo-mark-sm {
  width: 28px;
  height: 28px;
  font-size: 14px;
}

.logo-mark-lg {
  width: 56px;
  height: 56px;
  font-size: 26px;
  border-radius: var(--radius);
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* ===========================
   NAVBAR
   =========================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 14px 24px;
  background: rgba(10, 10, 12, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  animation: slide-in-down 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slide-in-down {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-link {
  font-size: 14px;
  color: var(--text-muted);
  transition: all var(--transition);
  position: relative;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--accent);
  transition: width var(--transition);
}

.nav-link:hover::after {
  width: 100%;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===========================
   HERO
   =========================== */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 180px 24px 100px;
  max-width: 800px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(1.2);
  }
}

.hero-title {
  font-size: clamp(36px, 5.5vw, 64px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
  margin-bottom: 20px;
}

.hero-subtitle {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.7;
  margin-bottom: 36px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 72px;
}

/* Proof bar */
.hero-proof {
  display: flex;
  align-items: center;
  gap: 40px;
}

.proof-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.proof-num {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.proof-label {
  font-size: 13px;
  color: var(--text-dim);
}

.proof-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

/* ===========================
   SECTIONS
   =========================== */
.section {
  padding: 110px 0;
}

.section-dark {
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-header {
  text-align: center;
  margin-bottom: 56px;
}

.section-tag {
  display: inline-block;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.section-title {
  font-size: clamp(28px, 3.5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 14px;
}

.section-desc {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
}

/* ===========================
   FEATURES
   =========================== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.feature-card {
  padding: 28px;
  border-radius: var(--radius-lg);
  transition: all var(--transition);
}

.feature-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  background: var(--surface-hover);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  background: var(--accent-bg);
  color: var(--accent-light);
  transition: transform var(--transition);
}

.feature-card:hover .feature-icon {
  transform: scale(1.1) rotate(5deg);
}

.feature-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ===========================
   STEPS
   =========================== */
.steps {
  display: flex;
  align-items: stretch;
  gap: 16px;
  max-width: 900px;
  margin: 0 auto;
}

.step {
  flex: 1;
  padding: 28px;
  border-radius: var(--radius-lg);
  text-align: center;
  transition: all var(--transition);
}

.step:hover {
  transform: translateY(-4px);
  background: var(--surface-hover);
}

.step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-main);
  color: #0a0a0c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  margin: 0 auto 16px;
  transition: transform var(--transition);
}

.step:hover .step-num {
  transform: scale(1.1) rotate(10deg);
}

.step h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.step p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.step-arrow {
  display: flex;
  align-items: center;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ===========================
   PRICING
   =========================== */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}

.pricing-card {
  padding: 32px;
  border-radius: var(--radius-lg);
  text-align: center;
  position: relative;
  transition: all var(--transition);
}

.pricing-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  background: var(--surface-hover);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.pricing-featured {
  border-color: var(--accent-border);
}

.pricing-featured::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: var(--gradient-main);
  -webkit-mask: linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.pricing-badge {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gradient-main);
  padding: 3px 14px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  color: #0a0a0c;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pricing-tier {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.pricing-price {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 4px;
}

.pricing-period {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 28px;
}

.pricing-features {
  text-align: left;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pricing-features li {
  font-size: 14px;
  color: var(--text-muted);
  padding-left: 22px;
  position: relative;
  transition: color var(--transition);
}

.pricing-card:hover .pricing-features li {
  color: var(--text);
}

.pricing-features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ===========================
   FOOTER
   =========================== */
.footer {
  border-top: 1px solid var(--border);
  padding-top: 56px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 48px;
  padding-bottom: 40px;
}

.footer-brand {
  max-width: 260px;
}

.footer-brand p {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 56px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-col h4 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  margin-bottom: 4px;
}

.footer-col a {
  font-size: 14px;
  color: var(--text-muted);
  transition: color var(--transition);
}

.footer-col a:hover {
  color: var(--text);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 18px 24px;
  text-align: center;
}

.footer-bottom p {
  font-size: 12px;
  color: var(--text-dim);
}

/* ===========================
   DASHBOARD LAYOUT
   =========================== */
.page-dashboard {
  height: 100vh;
  overflow: hidden;
}

.dashboard-layout {
  --sidebar-offset: 260px;
  --sidebar-bottom-stack-height: 194px;
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
  position: relative;
  transition: grid-template-columns 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.dashboard-layout.sidebar-collapsed {
  --sidebar-offset: 0px;
  grid-template-columns: 0px 1fr;
}

/* ===========================
   CUSTOMIZATION PANEL
   =========================== */
.customization-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 322px;
  z-index: 60;
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.customization-panel.open {
  transform: translateX(0);
}

.customization-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.customization-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.customization-body {
  padding: 24px;
  overflow-y: auto;
}

/* ===========================
   SETTING GROUPS
   =========================== */
.setting-group {
  margin-bottom: 24px;
}

.setting-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.theme-toggle {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(1px, 1fr));
  gap: 4px;
  background: var(--surface);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.theme-btn, .embed-btn {
  padding: 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.theme-btn:hover, .embed-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.theme-btn.active, .embed-btn.active {
  background: var(--bg-subtle);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
}

.color-swatches {
  display: flex;
  gap: 12px;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
  position: relative;
}

.swatch:hover {
  transform: scale(1.15);
}

.swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 12px var(--accent-glow);
}

.input-field {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  transition: all var(--transition);
}

.settings-static-field {
  min-height: 40px;
  display: flex;
  align-items: center;
  cursor: default;
  user-select: text;
}
.input-field:focus {
  outline: none;
  border-color: rgba(var(--accent-rgb), 0.5);
  box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.15);
}

/* ===========================
   SIDEBAR
   =========================== */
.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  overflow: hidden;
  z-index: 50;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  width: 260px;
  min-width: 0;
}

.sidebar.collapsed {
  width: 0px;
  border-right: none;
}

.sidebar-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.sidebar-brand-header {
  padding: 24px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-brand-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.sidebar-scroll-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--sidebar-bottom-stack-height);
}

.sidebar-header {
  padding: 0 18px 12px;
  flex-shrink: 0;
}

.sidebar-apps-trigger {
  width: 100%;
  margin-bottom: 8px;
  justify-content: flex-start;
  background: rgba(var(--accent-rgb), 0.1) !important;
  color: var(--accent) !important;
  border-color: rgba(var(--accent-rgb), 0.2) !important;
}

.sidebar-apps-trigger.has-active-app {
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.18), 0 8px 22px rgba(var(--accent-rgb), 0.08);
}

.sidebar-apps-trigger .sidebar-apps-caret {
  margin-left: auto;
  transition: transform 0.22s ease;
}

.sidebar-apps-trigger.is-open .sidebar-apps-caret {
  transform: rotate(180deg);
}

.sidebar-apps-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
}

.sidebar-apps-menu[hidden] {
  display: none !important;
}

.sidebar-app-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.sidebar-app-link:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(var(--accent-rgb), 0.24);
  transform: translateY(-1px);
}

.sidebar-app-link.is-active {
  background: rgba(var(--accent-rgb), 0.08);
  border-color: rgba(var(--accent-rgb), 0.3);
}

.sidebar-app-link-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.sidebar-app-link-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.sidebar-app-link-desc {
  font-size: 10px;
  line-height: 1.35;
  color: var(--text-dim);
}

.sidebar-app-link-badge {
  flex-shrink: 0;
  padding: 4px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-sort-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 2px;
  padding: 0 2px;
}

.sidebar-sort-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.sidebar-sort-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.sidebar-sort-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.1;
  cursor: pointer;
  transition: color var(--transition), opacity var(--transition);
}

.sidebar-sort-trigger:hover,
.sidebar-sort-dropdown.open .sidebar-sort-trigger {
  color: var(--text-muted);
}

.sidebar-sort-trigger:focus {
  outline: none;
}

.sidebar-sort-trigger:disabled {
  opacity: 0.6;
  cursor: wait;
}

.sidebar-sort-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transform: translateY(1px);
}

.sidebar-sort-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 136px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-subtle);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 220;
}

.sidebar-sort-dropdown.open .sidebar-sort-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.sidebar-sort-option {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
}

.sidebar-sort-option:hover,
.sidebar-sort-option.active {
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.08);
}

.sidebar-footer {
  margin-top: 0;
  padding: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, rgba(10, 10, 12, 0.82), rgba(10, 10, 12, 0.96));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.sidebar-bottom-stack {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
}

.sidebar-bottom-stack::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -36px;
  height: 36px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(10, 10, 12, 0.78));
}
.sidebar-docs-link {
  color: var(--text-dim);
  opacity: 0.78;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1;
  align-self: flex-start;
  transition: color 0.18s ease, opacity 0.18s ease;
}

.sidebar-docs-link:hover {
  color: var(--accent-light);
  opacity: 1;
}

.sidebar-docs-inline {
  position: relative;
  z-index: 1;
  padding: 0 12px 8px;
  margin: 0;
  background: rgba(10, 10, 12, 0.9);
}


.tokens-container {
  padding: 12px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--border);
}

.tokens-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tokens-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tokens-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-light);
}

.tokens-bar-bg {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.tokens-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px var(--accent-glow);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.sidebar-user:hover {
  background: rgba(255, 255, 255, 0.04);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gradient-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #0a0a0c;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
}

.user-plan {
  font-size: 11px;
  color: var(--text-dim);
}

/* Sidebar toggle */
.workspace-controls {
  position: fixed;
  top: 14px;
  left: calc(var(--sidebar-offset) + 14px);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.workspace-control-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--text-muted);
}

.workspace-control-btn:hover {
  color: var(--text);
}

.sidebar-toggle {
  position: static;
  z-index: auto;
  display: inline-flex;
}

/* ===========================
   CHAT MAIN
   =========================== */
.chat-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.code-editor-main,
.leaderboard-main,
.betting-main {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

/* ===========================
   EMPTY STATE
   =========================== */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  gap: 12px;
}

.empty-logo {
  margin-bottom: 8px;
}

.chat-empty h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.chat-empty p {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 380px;
}

.empty-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
  max-width: 560px;
}

.suggestion-chip {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}

.suggestion-chip:hover {
  color: var(--text);
  border-color: var(--accent-border);
  background: var(--accent-bg);
  transform: translateY(-2px);
}

/* ===========================
   CHAT MESSAGES
   =========================== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 24px 28px 34px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-messages::-webkit-scrollbar {
  width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
}

.message {
  display: flex;
  max-width: 814px;
  margin: 0 auto;
  width: 100%;
}
.message-assistant {
  justify-content: flex-start;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding-left: 44px;
}

.message-assistant .message-bubble {
  max-width: 85%;
  margin-right: auto;
}

.message-streaming .message-bubble {
  margin-right: auto;
}

.message-ai {
  max-width: 100%;
  margin: 0;
  transform: none;
  padding-right: 0;
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-bubble {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.7;
}

/* User message */
.message-user {
  justify-content: flex-end;
  position: relative;
}

.message-user .message-bubble {
  background: var(--accent-bg);
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  border-radius: var(--radius) var(--radius) 4px var(--radius);
  max-width: 85%;
  margin-left: auto;
  width: fit-content;
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 4;
}


.message-inline-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  width: min(560px, 100%);
}

.inline-edit-textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 12px;
  outline: none;
}

.inline-edit-textarea:focus {
  border-color: rgba(var(--accent-rgb), 0.5);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.12);
}

.inline-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.inline-edit-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}

.inline-edit-btn:hover {
  background: var(--surface-hover);
}

.inline-edit-btn.primary {
  background: var(--accent);
  color: #0a0a0c;
  border-color: transparent;
  font-weight: 600;
}

.inline-edit-btn.primary:hover {
  filter: brightness(0.96);
}

.message-user-actions {
  display: flex;
  gap: 6px;
  position: absolute;
  bottom: 0;
  right: -102px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius-sm);
  opacity: 1;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.message-action-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.message-action-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.message-action-btn.edit:hover {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
}

.message-action-btn.delete:hover {
  color: var(--red);
  background: rgba(239, 68, 68, 0.1);
}

.message-action-btn.retry:hover {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
}

/* AI answer */
.message-answer {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}

.message-answer h1,
.message-answer h2,
.message-answer h3,
.message-answer h4,
.message-answer h5,
.message-answer h6 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  margin-top: 18px;
  color: var(--text);
}

.message-answer h1:first-child,
.message-answer h2:first-child,
.message-answer h3:first-child,
.message-answer h4:first-child,
.message-answer h5:first-child,
.message-answer h6:first-child {
  margin-top: 0;
}

.message-answer p {
  color: var(--text);
  margin-bottom: 12px;
  font-size: 14px;
}

.message-answer p:last-of-type {
  margin-bottom: 0;
}

.message-answer strong {
  color: var(--text);
  font-weight: 600;
}

.message-answer em {
  color: var(--text);
  font-style: italic;
}

.message-answer ul, 
.message-answer ol {
  margin-left: 20px;
  margin-bottom: 12px;
  color: var(--text);
}

.message-answer li {
  margin-bottom: 4px;
}

.message-answer li:last-child {
  margin-bottom: 0;
}

/* Code sections + copy button */
.code-section {
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.18);
}

.code-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.code-lang {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.copy-code-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 11px;
  padding: 5px 9px;
  cursor: pointer;
  transition: all var(--transition);
}

.copy-code-btn:hover {
  color: var(--text);
  border-color: var(--border-hover);
  background: var(--surface-hover);
}

.code-section pre {
  margin: 0;
  padding: 12px 12px 0 12px;
  overflow-x: auto;
}

.code-section code {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--text);
  display: block;
  padding-bottom: 12px;
  min-width: 100%;
}

/* Code content wrapper for max height handling */
.code-content-wrapper {
  max-height: 80vh; /* Approximate screen height limit */
  overflow: hidden;
  position: relative;
  transition: max-height 0.3s ease-in-out;
}

body.code-embeds-expanded .code-content-wrapper {
  max-height: none !important;
}

/* Expand overlay */
.code-expand-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px; /* Gradient height */
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8) 80%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 16px;
  opacity: 0;
  pointer-events: none; /* Initially allow clicking through if not needed, JS will toggle */
  transition: opacity 0.2s;
}

.code-content-wrapper.overflowing .code-expand-overlay {
  opacity: 1;
  pointer-events: none;
}

body.code-embeds-expanded .code-expand-overlay {
  display: none !important;
}

/* Sources */
.answer-sources {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
}

.sources-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.source-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-chip {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ===========================
   WORKFLOW RECOMMENDATION
   =========================== */
.workflow-rec {
  border-radius: var(--radius);
  overflow: hidden;
  border-color: rgba(var(--accent-rgb), 0.15);
}

.workflow-rec-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(var(--accent-rgb), 0.06);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.1);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.workflow-rec-header svg {
  color: var(--accent);
}

.workflow-rec-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.workflow-rec-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.rec-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  width: 90px;
  flex-shrink: 0;
  padding-top: 2px;
}

.rec-value {
  font-size: 13px;
  color: var(--text);
  flex: 1;
}

.rec-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-light);
}

.rec-meta {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
}

.rec-confidence {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rec-confidence-bar {
  flex: 1;
  max-width: 120px;
  height: 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.rec-confidence-fill {
  height: 100%;
  background: var(--gradient-main);
  border-radius: var(--radius-full);
}

.rec-confidence span {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-light);
}

/* ===========================
   AGENT PROGRESS
   =========================== */
.agent-progress {
  padding: 12px 16px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-progress-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.agent-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.agent-progress-item.done .agent-dot {
  background: var(--green);
}

.agent-progress-item.working .agent-dot {
  background: var(--accent);
  animation: pulse-dot 1s ease-in-out infinite;
}

.agent-name {
  flex: 1;
  font-weight: 500;
  color: var(--text);
}

.agent-time {
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.agent-check {
  color: var(--green);
  flex-shrink: 0;
}

.agent-progress-item.working .agent-check {
  display: none;
}

/* ===========================
   MODEL PICKER
   =========================== */
.model-picker-container {
  position: relative;
  display: flex;
  z-index: 260;
  overflow: visible;
}

.model-picker-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  height: 44px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
}

.model-picker-btn:hover,
.model-picker-btn.active {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.4);
  background: rgba(var(--accent-rgb), 0.08);
  box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.1);
}

.model-name {
  display: flex;
  align-items: center;
  gap: 6px;
}

.model-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-bg);
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 600;
}

.model-dropdown {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--glass-shadow);
  z-index: 280;
  display: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  overflow-x: hidden;
}

.model-dropdown.is-open {
  display: block;
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.model-picker-btn.active svg {
  transform: rotate(180deg);
}

.model-option {
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  margin-bottom: 0;
  box-sizing: border-box;
}

.model-option:hover {
  background: var(--surface-hover);
}

.model-option.active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

.model-tab-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brain-config-panel {
  margin-top: 4px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.26);
  background: rgba(var(--accent-rgb), 0.06);
  box-sizing: border-box;
}

.brain-config-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.brain-workflow-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brain-strength-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  background: rgba(255, 255, 255, 0.04);
}

.brain-strength-btn {
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.brain-strength-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.brain-strength-btn.active {
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.16);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.2);
}

.brain-workflow-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: default;
  transition: all 0.2s ease;
}

.brain-workflow-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(var(--accent-rgb), 0.16);
}

.brain-workflow-item.is-checked {
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.28);
}

.brain-workflow-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brain-workflow-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.brain-workflow-caption {
  font-size: 10px;
  color: var(--text-dim);
}

.brain-workflow-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  background: rgba(0, 0, 0, 0.14);
}

.brain-workflow-stepper-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.brain-workflow-stepper-btn:hover:not(:disabled) {
  background: rgba(var(--accent-rgb), 0.18);
  color: var(--accent-light);
  transform: scale(1.04);
}

.brain-workflow-stepper-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.brain-workflow-count {
  min-width: 28px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

.brain-format-input {
  margin-top: 2px;
  min-height: 72px;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
  font-size: 12px;
  line-height: 1.35;
  border-radius: 8px;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  background: rgba(0, 0, 0, 0.16);
}

.model-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.model-tab {
  flex: 1;
  padding: 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}

.model-tab:hover {
  color: var(--text);
}

.model-tab.active {
  background: var(--surface-hover);
  color: var(--text);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.model-placeholder {
  font-size: 11px;
  color: var(--text-dim);
  padding: 20px 12px;
  text-align: center;
  font-style: italic;
}

.model-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.model-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.model-benchmarks {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.benchmark {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-dim);
  font-family: "JetBrains Mono", monospace;
}

.model-option.active .benchmark {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent-light);
}

/* ===========================
   CHAT INPUT
   =========================== */
.chat-input-area {
  padding: 14px 24px 24px;
  flex-shrink: 0;
  overflow: visible;
}

.chat-input-outer {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  overflow: visible;
}

.chat-input-wrapper { 
  flex: 1;
  padding: 0 8px;
  border-radius: 22px;
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: all var(--transition);
  border: 1px solid var(--border);
  background: var(--surface);
}

.chat-input-wrapper:focus-within {
  border-color: rgba(var(--accent-rgb), 0.6);
  box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.15);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  min-height: 24px;
  max-height: 160px;
  padding: 10px 8px;
}

.chat-input::placeholder {
  color: var(--text-dim);
}

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.btn-send {
  width: auto;
  height: 34px;
  padding: 0 16px;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
  font-weight: 500;
  gap: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-send:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: translateY(-1px);
}

[data-theme="light"] .btn-send {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .btn-send:hover {
  background: rgba(0, 0, 0, 0.1);
}

.btn-attach {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-attach:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.chat-disclaimer {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
  max-width: 814px;
  margin-left: auto;
  margin-right: auto;
}

/* ===========================
   SCROLLBARS
   =========================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ===========================
   SELECTION & FOCUS
   =========================== */
::selection {
  background: rgba(var(--accent-rgb), 0.25);
  color: white;
}

:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.4);
  outline-offset: 2px;
}

/* ===========================
   ANIMATIONS
   =========================== */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Page load animations */
.hero-badge {
  animation: fade-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-title {
  animation: fade-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.hero-subtitle {
  animation: fade-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.hero-actions {
  animation: fade-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

/* Staggered entry for cards */
.feature-card:nth-child(1) { animation: fade-up 0.6s ease 0.1s both; }
.feature-card:nth-child(2) { animation: fade-up 0.6s ease 0.2s both; }
.feature-card:nth-child(3) { animation: fade-up 0.6s ease 0.3s both; }
.feature-card:nth-child(4) { animation: fade-up 0.6s ease 0.4s both; }
.feature-card:nth-child(5) { animation: fade-up 0.6s ease 0.5s both; }
.feature-card:nth-child(6) { animation: fade-up 0.6s ease 0.6s both; }

.step:nth-child(1) { animation: fade-up 0.6s ease 0.1s both; }
.step:nth-child(3) { animation: fade-up 0.6s ease 0.2s both; }
.step:nth-child(5) { animation: fade-up 0.6s ease 0.3s both; }

.pricing-card:nth-child(1) { animation: fade-up 0.6s ease 0.1s both; }
.pricing-card:nth-child(2) { animation: fade-up 0.6s ease 0.2s both; }
.pricing-card:nth-child(3) { animation: fade-up 0.6s ease 0.3s both; }

/* Message entry */
.message {
  animation: scale-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Icon float effect */
.feature-icon svg {
  animation: float 4s ease-in-out infinite;
}

.feature-card:nth-child(even) .feature-icon svg {
  animation-delay: 1s;
}

.feature-card:nth-child(3n) .feature-icon svg {
  animation-delay: 2s;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 1024px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0;
    width: 322px;
    transform: translateX(-100%);
    background: var(--bg);
    border-right: 1px solid var(--border);
  }

  .sidebar-open {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.5);
  }

  .workspace-controls {
    left: 14px;
  }

  body.in-betting-mode .betting-header {
    padding-left: 18px;
  }

  body.in-leaderboard-mode .leaderboard-header {
    padding-left: 18px;
  }

  .steps {
    flex-direction: column;
    max-width: 400px;
  }

  .step-arrow {
    transform: rotate(90deg);
    justify-content: center;
    display: flex;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 85%;
    max-width: 320px;
  }

  .customization-panel {
    width: 85%;
    max-width: 320px;
  }

  .workspace-controls {
    top: 12px;
  }

  .chat-messages {
    padding: 16px 12px 16px 16px;
  }

  .message {
    max-width: 100%;
  }

  
  .message-assistant {
    max-width: 100%;
    padding-left: 0;
  }
.message-ai {
    transform: none;
    padding-right: 0;
    flex-direction: column;
  }

  .message-ai-sidebar {
    margin-right: 0;
    margin-bottom: 8px;
    min-width: auto;
  }

  .message-ai-marker {
    align-items: flex-start;
    padding: 4px 8px;
    background: transparent;
    border: none;
  }

  .workflow-dots-container {
    max-width: none;
    margin: 3px 0 2px 0;
    gap: 4px;
  }

  .message-user .message-bubble {
    max-width: 95%;
  }

  .chat-input-area {
    padding: 10px 12px 16px;
  }

  .chat-input-outer {
    flex-direction: column;
    align-items: stretch;
  }

  .model-picker-container {
    align-self: flex-start;
    margin-top: 8px;
  }

  .chat-empty h2 {
    font-size: 20px;
  }

  .empty-suggestions {
    flex-direction: column;
    align-items: stretch;
  }

  .suggestion-chip {
    text-align: center;
  }

  .chat-input-wrapper {
    min-height: auto;
  }

  .btn-send {
    padding: 0 12px;
  }

  .btn-send span {
    display: none;
  }

  .btn-send svg {
    margin: 0;
  }

  .hero-title {
    font-size: 32px;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    gap: 32px;
  }

  .footer-links {
    flex-direction: column;
    gap: 24px;
  }
}


/* ===========================
   CODE EDITOR
   =========================== */
.code-file-item {
  transition: all var(--transition);
}

.code-file-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.code-file-item.active {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
}

.code-file-sidebar::-webkit-scrollbar {
  width: 4px;
}
.code-file-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.code-file-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.code-console-chat textarea::-webkit-scrollbar {
  width: 4px;
}
.code-console-chat textarea::-webkit-scrollbar-track {
  background: transparent;
}
.code-console-chat textarea::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
/* Code chat pane fitting */
#codeSidebarInner {
  min-height: 0;
}

#codeChatMessages {
  overflow-x: hidden !important;
}

#codeChatMessages > div {
  max-width: 100%;
}

#codeChatMessages .code-message-user,
#codeChatMessages .code-message-ai {
  max-width: calc(100% - 44px) !important;
  box-sizing: border-box;
}

#codeChatMessages .code-restore-divider {
  max-width: 100% !important;
}

.code-sidebar-toggle {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 6px 6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 60;
  transition: all var(--transition);
}

.code-sidebar-toggle:hover {
  background: var(--surface-hover);
}

.code-sidebar-toggle .dot-grid {
  display: grid;
  grid-template-columns: repeat(2, 3px);
  gap: 2px;
}

.code-sidebar-toggle .dot {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--text-muted);
}

#codeSidebarResizer,
#codePreviewResizer {
  background: transparent;
}

#codeSidebarResizer:hover,
#codePreviewResizer:hover,
#codeSidebarResizer.active,
#codePreviewResizer.active {
  background: rgba(var(--accent-rgb), 0.22) !important;
}

#codeEditorHighlight {
  user-select: none;
}

#codeEditorHighlight,
#codeEditorTextarea,
#codeEditorLineNumbers {
  font-variant-ligatures: none;
  text-rendering: optimizeSpeed;
}

#codeEditorHighlight::-webkit-scrollbar {
  width: 0;
  height: 0;
}

#codeEditorTextarea {
  -webkit-text-fill-color: var(--text);
}

#codeEditorTextarea::selection {
  background: rgba(var(--accent-rgb), 0.35);
}

#codeEditorLineNumbers {
  white-space: pre;
  overflow: hidden;
}

#codeEditorLineNumbers .code-line-number {
  display: block;
  line-height: 21px;
  padding-right: 2px;
  border-radius: 4px;
  transition: background 140ms ease, color 140ms ease;
}

#codeEditorLineNumbers .code-line-number.edited {
  color: var(--accent-light);
  background: rgba(var(--accent-rgb), 0.18);
  box-shadow: inset 2px 0 0 rgba(var(--accent-rgb), 0.88);
  padding-right: 6px;
}

.code-token-keyword {
  color: #ff8a65;
}

.code-token-function {
  color: #82b1ff;
}

.code-token-variable {
  color: #c5e1a5;
}

.code-token-number {
  color: #ffd180;
}

.code-token-string {
  color: #a5d6a7;
}

.code-token-comment {
  color: #90a4ae;
  font-style: italic;
}

.code-token-operator {
  color: #b39ddb;
}

[data-theme="light"] .code-token-keyword {
  color: #b53a1f;
}

[data-theme="light"] .code-token-function {
  color: #0b57d0;
}

[data-theme="light"] .code-token-variable {
  color: #2e7d32;
}

[data-theme="light"] .code-token-number {
  color: #b26a00;
}

[data-theme="light"] .code-token-string {
  color: #196127;
}

[data-theme="light"] .code-token-comment {
  color: #5f6b73;
}

[data-theme="light"] .code-token-operator {
  color: #6a1b9a;
}
#codeEditorTextarea::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
#codeEditorTextarea::-webkit-scrollbar-track {
  background: var(--bg);
}
#codeEditorTextarea::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
#codeEditorTextarea::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ===========================
   LIGHT THEME
   =========================== */
[data-theme="light"] {
  --bg: #f4f4f6;
  --bg-subtle: #ffffff;
  --surface: rgba(0, 0, 0, 0.03);
  --surface-hover: rgba(0, 0, 0, 0.06);
  --border: rgba(0, 0, 0, 0.1);
  --border-hover: rgba(0, 0, 0, 0.2);
  --text: #0a0a0c;
  --text-muted: #52525e;
  --text-dim: #8e8e9f;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
  --editor-line-number-bg: #ebebef;
}

/* ===========================
   GREY THEME
   =========================== */
[data-theme="grey"] {
  --bg: #1e1e20;
  --bg-subtle: #242427;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.15);
  --text: #e8e8ec;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --glass-bg: rgba(30, 30, 32, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  --editor-line-number-bg: #161618;
}

/* AI Avatar styles */
.message-ai {
  flex-direction: row;
  gap: 0;
  align-items: flex-start;
  width: 100%;
}

.message-ai-marker {
  flex-shrink: 0;
  margin-top: 0;
  margin-left: 0;
}

.message-ai .message-bubble {
  padding-top: 0;
}

.bot-avatar {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: cover;
  display: block;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  padding-left: 10px;
  margin-bottom: 4px;
}

.chat-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7.5px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.01);
}

.chat-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  transform: translateX(4px);
}

.chat-item.chat-item-active {
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--text);
  border: 1px solid rgba(var(--accent-rgb), 0.1);
}

.chat-item span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-delete-btn {
  opacity: 0;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 4px;
  border-radius: 4px;
  transition: all var(--transition);
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-item:hover .chat-delete-btn {
  opacity: 1;
}

.chat-delete-btn:hover {
  color: var(--red);
  background: rgba(239, 68, 68, 0.1);
}

.btn-new-chat-sleek {
  width: 100% !important;
  justify-content: flex-start !important;
  padding: 10px 16px !important;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text) !important;
  font-weight: 500 !important;
}

.btn-new-chat-sleek:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(var(--accent-rgb), 0.3) !important;
  transform: translateY(-1px) !important;
}

.btn-new-chat-sleek svg {
  color: var(--accent);
}

.sidebar-chats {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-chats::-webkit-scrollbar {
  width: 4px;
}

.sidebar-chats::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-chats::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in 0.3s ease;
}

[data-theme="light"] .modal-overlay {
  background: rgba(0, 0, 0, 0.3);
}

.modal-content {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.credit-option-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text);
}

.credit-option-card:hover {
  border-color: var(--accent) !important;
  background: var(--surface-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.15);
}

.credit-option-card.featured {
  border-color: var(--accent-border);
  position: relative;
  overflow: hidden;
}

.credit-option-card.featured::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
}

.credit-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.credit-title {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.credit-subtitle {
  font-size: 13px;
  color: var(--text-dim);
}

.credit-option-card.featured .credit-subtitle {
  color: var(--accent-light);
  font-weight: 500;
}

.credit-price {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
  padding: 6px 12px;
  background: var(--accent-bg);
  border-radius: 8px;
  border: 1px solid var(--accent-border);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

.apps-modal {
  width: min(95vw, 1060px);
  max-width: 1060px;
  min-height: min(88vh, 760px);
}

.apps-modal-body {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  min-height: min(70vh, 560px);
}

.apps-card {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.03),
    rgba(255, 255, 255, 0.015)
  );
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.apps-card:hover {
  border-color: rgba(var(--accent-rgb), 0.6);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.apps-card-media-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.apps-card-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.apps-card-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.apps-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.apps-card-title-row h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.apps-card-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent-light);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 8px;
}

.apps-card-copy p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.apps-card-code {
  grid-column: 1;
  grid-row: 1;
}

.apps-card-sports {
  grid-column: 2;
  grid-row: 1;
}

.apps-card-markets {
  grid-column: 3;
  grid-row: 1;
}

.apps-card-static {
  cursor: default;
}

.apps-card-static:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border);
}

.apps-card-chip-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.apps-card-chip-muted {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
}

.apps-card-media-wrap-sports {
  background:
    radial-gradient(circle at 15% 12%, rgba(var(--accent-rgb), 0.24), transparent 40%),
    radial-gradient(circle at 88% 80%, rgba(31, 186, 86, 0.18), transparent 48%),
    linear-gradient(165deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
}

.apps-card-media-sports {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  color: var(--text);
}

.sports-media-grid {
  width: min(86%, 180px);
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr 1fr;
  column-gap: 10px;
  row-gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.22);
}

.sports-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  grid-row: 1 / span 2;
  align-self: center;
}

.sports-line {
  display: block;
  height: 8px;
  border-radius: 999px;
}

.sports-line-up {
  width: 92%;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.45), rgba(34, 197, 94, 0.95));
}

.sports-line-flat {
  width: 65%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.65));
}

.sports-media-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}

.apps-card-media-wrap-markets {
  background:
    radial-gradient(circle at 18% 18%, rgba(34, 197, 94, 0.16), transparent 42%),
    radial-gradient(circle at 85% 18%, rgba(var(--accent-rgb), 0.22), transparent 36%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015));
}

.apps-card-media-markets {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--text);
}

.markets-media-chart {
  width: min(86%, 188px);
  height: 60px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
    rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px;
}

.markets-media-line {
  display: block;
  width: 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.7));
}

.markets-media-line-rise {
  height: 34px;
}

.markets-media-line-flat {
  height: 18px;
  opacity: 0.55;
}

.markets-media-candle {
  position: relative;
  display: block;
  width: 10px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16);
}

.markets-media-candle::before,
.markets-media-candle::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: currentColor;
}

.markets-media-candle::before {
  top: -10px;
  height: 10px;
}

.markets-media-candle::after {
  bottom: -12px;
  height: 12px;
}

.markets-media-candle-up {
  height: 28px;
  color: #22c55e;
}

.markets-media-candle-down {
  height: 20px;
  color: #ef4444;
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.markets-media-candle-up-short {
  height: 16px;
  color: #22c55e;
}

.markets-media-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}

.markets-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  gap: 12px;
  padding: 20px 22px 14px;
}

.markets-header {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.markets-header-copy h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.markets-header-copy p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
  max-width: 720px;
}

.markets-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.markets-toolbar {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.markets-symbol-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  background: rgba(var(--accent-rgb), 0.08);
}

.markets-symbol-pill span {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}

.markets-symbol-pill strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-light);
}

.markets-toolbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.markets-toolbar-meta span {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.markets-status {
  font-size: 12px;
  color: var(--text-muted);
  min-height: 18px;
  padding: 0 2px;
}

.markets-status.is-error {
  color: #f87171;
}

.markets-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.markets-forecast-panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.markets-forecast-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.markets-forecast-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.markets-forecast-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.markets-forecast-head p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
  max-width: 720px;
}

.markets-forecast-status {
  min-height: 16px;
  font-size: 11px;
  color: var(--text-muted);
}

.markets-forecast-status.is-error {
  color: #f87171;
}

.markets-forecast-workflow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.markets-forecast-option {
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 168px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.markets-forecast-option:hover {
  border-color: rgba(var(--accent-rgb), 0.24);
  transform: translateY(-1px);
}

.markets-forecast-option.is-active {
  border-color: rgba(var(--accent-rgb), 0.4);
  background: rgba(var(--accent-rgb), 0.10);
}

.markets-forecast-option-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.markets-forecast-option-note {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}

.markets-forecast-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.markets-forecast-step.is-active {
  border-color: rgba(var(--accent-rgb), 0.42);
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent-light);
}

.markets-forecast-step.is-done {
  border-color: rgba(34, 197, 94, 0.34);
  background: rgba(34, 197, 94, 0.10);
  color: #86efac;
}

.markets-forecast-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.markets-forecast-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.018);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.markets-forecast-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.markets-forecast-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.markets-forecast-card-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.markets-forecast-card-note {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.markets-forecast-card-title {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}

.markets-forecast-card-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.markets-forecast-card-row strong {
  font-size: 15px;
  color: var(--text);
}

.markets-forecast-card-row span {
  font-size: 11px;
  color: var(--text-muted);
}

.markets-forecast-card-row .is-up {
  color: #4ade80;
}

.markets-forecast-card-row .is-down {
  color: #f87171;
}

.markets-forecast-reason {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
}

.markets-forecast-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.markets-overview-pill {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.018);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.markets-overview-label {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}

.markets-overview-value {
  font-size: 15px;
  color: var(--text);
  font-weight: 800;
}

.markets-overview-value.is-up {
  color: #4ade80;
}

.markets-overview-value.is-down {
  color: #f87171;
}

.markets-overview-detail {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.4;
}

.markets-forecast-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.markets-forecast-chip {
  min-width: 96px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.024);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.markets-forecast-chip-label {
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.11em;
  color: var(--text-dim);
  font-weight: 700;
}

.markets-forecast-chip-value {
  font-size: 12px;
  color: var(--text);
  font-weight: 700;
}

.markets-forecast-chip-time {
  font-size: 10px;
  color: var(--text-muted);
}

.markets-metric-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.035),
    rgba(255, 255, 255, 0.015)
  );
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.markets-metric-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}

.markets-metric-value {
  font-size: 17px;
  line-height: 1.05;
  font-weight: 800;
  color: var(--text);
}

.markets-metric-value.is-up {
  color: #4ade80;
}

.markets-metric-value.is-down {
  color: #f87171;
}

.markets-metric-detail {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.45;
}

.markets-grid {
  flex: 0 0 auto;
  min-height: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.markets-chart-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.markets-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.markets-chart-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.markets-chart-head p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}

.markets-chart-head-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.markets-chart-meta {
  font-size: 10px;
  line-height: 1.4;
  color: var(--text-dim);
  text-align: right;
  max-width: 210px;
}

.markets-chart-shell {
  flex: 0 0 auto;
  height: 430px;
  min-height: 320px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at top left, rgba(var(--accent-rgb), 0.08), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.012));
  overflow: hidden;
}

.markets-chart-range {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.markets-range-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  min-width: 34px;
  height: 28px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.markets-range-btn.is-active {
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent-light);
}

.markets-chart-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.markets-chart-empty {
  width: 100%;
  height: 100%;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}

.betting-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  gap: 12px;
  padding: 20px 22px 14px;
}

.betting-header {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

body.in-betting-mode .betting-header {
  padding-left: 108px;
}

.betting-header-copy h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.betting-header-copy p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.betting-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.betting-v2-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.85fr);
  gap: 12px;
  min-height: 0;
  flex: 1;
}

.betting-v2-chat,
.betting-v2-games {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}

#bettingWorkflowSelect {
  min-width: 190px;
}

#bettingChatMessages {
  flex: 1;
  min-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px;
}

#bettingChatMessages::-webkit-scrollbar {
  width: 6px;
}

#bettingChatMessages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.betting-v2-empty {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.betting-v2-message {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.betting-v2-message-user {
  align-items: flex-end;
}

.betting-v2-message-assistant {
  align-items: flex-start;
}

.betting-v2-bubble {
  max-width: min(92%, 760px);
  white-space: pre-wrap;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.46;
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}

.betting-v2-message-user .betting-v2-bubble {
  background: rgba(var(--accent-rgb), 0.14);
  border-color: rgba(var(--accent-rgb), 0.45);
}

.betting-v2-meta {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.01em;
}

#bettingChatInput {
  min-height: 72px;
  resize: vertical;
}

.betting-controls {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  align-self: flex-start;
}

.betting-controls-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}

.betting-league-select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
}

.betting-status {
  min-height: 22px;
  color: var(--text-muted);
  font-size: 12px;
}

.betting-games-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  padding-right: 4px;
}

.betting-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 36px;
}

.betting-games-grid::-webkit-scrollbar {
  width: 6px;
}

.betting-games-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.betting-game-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.012));
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.betting-game-card[data-clickable="true"] {
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.betting-game-card[data-clickable="true"]:hover {
  border-color: rgba(var(--accent-rgb), 0.6);
  transform: translateY(-2px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.2);
}

.betting-game-card[data-clickable="true"]:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.9);
  outline-offset: 2px;
}

.betting-game-time {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.betting-teams {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.betting-team-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}

.betting-team-name {
  color: var(--text);
  font-weight: 600;
}

.betting-team-record {
  color: var(--text-dim);
  font-size: 12px;
  white-space: nowrap;
}

.betting-game-meta {
  color: var(--text-muted);
  font-size: 12px;
}

.betting-details-modal {
  width: min(96vw, 1120px);
  max-width: 1120px;
  max-height: 92vh;
  overflow: hidden;
}

.betting-details-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.betting-details-subtitle {
  color: var(--text-muted);
  font-size: 13px;
}

.betting-details-status {
  color: var(--text-dim);
  font-size: 12px;
  min-height: 18px;
}

.betting-details-status.is-error {
  color: var(--red);
}

.betting-details-content {
  flex: 1;
  min-height: 240px;
  max-height: calc(92vh - 190px);
  overflow-y: auto;
  padding-right: 4px;
}

.betting-details-content::-webkit-scrollbar {
  width: 8px;
}

.betting-details-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.betting-details-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
  padding: 8px 2px;
}

.betting-details-loading .agent-spinner {
  width: 14px;
  height: 14px;
}

.betting-details-teams {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.betting-team-details-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.012));
  overflow: hidden;
}

.betting-team-details-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}

.betting-team-player-table-wrap {
  overflow-x: auto;
}

.betting-team-player-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.betting-team-player-table th,
.betting-team-player-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  text-align: left;
  vertical-align: top;
}

.betting-team-player-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  position: sticky;
  top: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
}

.betting-team-player-table td {
  font-size: 12px;
  color: var(--text-muted);
}

.betting-team-player-table td:first-child {
  color: var(--text);
  font-weight: 600;
}

.betting-team-comparison {
  border-top: 1px solid var(--border);
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.betting-team-comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.betting-team-comparison-grid div {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.betting-team-comparison-grid span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.betting-team-comparison-grid strong {
  font-size: 12px;
  color: var(--text);
  font-weight: 700;
}

.betting-team-moves {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.betting-team-moves-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 5px;
}

.betting-team-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.betting-team-tags span {
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
  padding: 3px 8px;
}

.betting-details-meta {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.45;
}

.betting-prediction-panel {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.betting-prediction-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.betting-prediction-head h3 {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

.betting-prediction-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.betting-prediction-status {
  min-height: 18px;
  color: var(--text-dim);
  font-size: 12px;
}

.betting-prediction-empty {
  font-size: 12px;
  color: var(--text-muted);
}

.betting-prediction-result-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.betting-prediction-topline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.betting-prediction-pick {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.betting-prediction-prob {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-light);
}

.betting-prediction-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.betting-prediction-proof {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.betting-prediction-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.betting-prediction-list-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.betting-prediction-lists ul {
  margin: 0;
  padding-left: 16px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.betting-prediction-usage {
  font-size: 11px;
  color: var(--text-dim);
}

.betting-details-error {
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 10px;
  padding: 12px;
  color: #fca5a5;
  font-size: 13px;
  background: rgba(239, 68, 68, 0.08);
}

.code-disclaimer-modal {
  max-width: 560px;
}

.mobile-disclaimer-modal {
  max-width: 560px;
}

.code-disclaimer-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.code-disclaimer-body p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
}

.code-disclaimer-checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.code-disclaimer-checkbox-row input {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.code-disclaimer-checkbox-row input::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #0a0a0c;
  transform: scale(0);
  transition: transform 0.12s ease;
}

.code-disclaimer-checkbox-row input:checked {
  background: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.55);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.18);
}

.code-disclaimer-checkbox-row input:checked::after {
  transform: scale(1);
}

.code-disclaimer-checkbox-row input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.25);
}

.code-disclaimer-ack {
  align-self: flex-end;
  margin-top: 6px;
  background: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  color: #0a0a0c;
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.28);
}

.code-disclaimer-ack:hover {
  background: var(--accent-light);
  box-shadow: 0 0 22px rgba(var(--accent-rgb), 0.38);
}

.api-program-modal {
  max-width: 940px;
  width: min(94vw, 940px);
  max-height: 90vh;
}

.api-program-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}

.api-program-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.api-program-intro p {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 580px;
}

.api-program-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--accent-border);
  background: var(--accent-bg);
  color: var(--accent-light);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 6px 10px;
}

.api-program-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.api-program-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.api-program-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.api-program-card-full {
  grid-column: 1 / -1;
}

.api-field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.api-field-note {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.api-inline-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-inline-field .input-field {
  font-size: 12px;
  min-height: 38px;
}

.api-inline-btn {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  height: 38px;
}

.api-balance-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.api-balance-row strong {
  color: var(--accent-light);
  font-size: 20px;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: -0.02em;
}

.api-quick-amounts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.api-quick-amount-btn {
  padding: 8px 0;
  font-size: 12px;
  font-weight: 700;
}

.api-quick-amount-btn.active {
  color: var(--accent-light);
  border-color: rgba(var(--accent-rgb), 0.6);
  background: rgba(var(--accent-rgb), 0.15);
}

.api-status-text {
  min-height: 18px;
  font-size: 12px;
  font-weight: 600;
}

.api-status-text.status-info {
  color: var(--text-muted);
}

.api-status-text.status-success {
  color: #4ade80;
}

.api-status-text.status-warning {
  color: #fbbf24;
}

.api-status-text.status-error {
  color: #f87171;
}

.api-code-block {
  margin: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  padding: 12px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "JetBrains Mono", monospace;
}


.upgrade-modal {
  width: min(92vw, 645px);
  max-width: 645px;
}

.upgrade-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.upgrade-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.upgrade-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.upgrade-plan-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 250px;
}

.upgrade-plan-card.featured {
  border-color: rgba(var(--accent-rgb), 0.38);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.2) inset, 0 8px 28px rgba(0, 0, 0, 0.28);
}


.upgrade-plan-tier {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 700;
}

.upgrade-plan-price {
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.upgrade-plan-price span {
  font-size: 13px;
  color: var(--text-dim);
  margin-left: 4px;
  font-weight: 500;
}

.upgrade-plan-features {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upgrade-plan-features li {
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 16px;
  position: relative;
  line-height: 1.35;
}

.upgrade-plan-features li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
  position: absolute;
  left: 0;
  top: 6px;
}

.upgrade-plan-action {
  margin-top: auto;
  width: 100%;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  min-height: 36px;
}

.upgrade-plan-action.current,
.upgrade-plan-action:disabled {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-dim) !important;
  cursor: default;
  box-shadow: none;
}

.leaderboard-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  gap: 12px;
  padding: 20px 22px 14px;
}

.leaderboard-header {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

body.in-leaderboard-mode .leaderboard-header {
  padding-left: 108px;
}

.leaderboard-header-copy h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.leaderboard-version-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.leaderboard-header-copy p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.leaderboard-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.leaderboard-status {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface);
}

.leaderboard-status.is-error {
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--red);
  background: var(--red-accent-bg);
}

.leaderboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.leaderboard-kpi-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background:
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.12), transparent 52%),
    var(--surface);
  min-height: 102px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-kpi-label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
}

.leaderboard-kpi-value {
  font-size: clamp(20px, 2.2vw, 30px);
  line-height: 1;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
}

.leaderboard-kpi-sub {
  margin-top: auto;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.36fr) minmax(290px, 0.84fr);
  gap: 12px;
  min-height: 0;
  flex: 1;
}

.leaderboard-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.leaderboard-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.leaderboard-panel-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.leaderboard-panel-meta {
  font-size: 11px;
  color: var(--text-dim);
}

.leaderboard-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.leaderboard-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-subtle);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding: 0;
}

.leaderboard-table tbody td {
  border-bottom: 1px solid var(--border);
  padding: 10px 10px;
  font-size: 12px;
  color: var(--text);
  vertical-align: middle;
}

.leaderboard-table tbody tr:hover td {
  background: var(--surface-hover);
}

.leaderboard-empty-row {
  text-align: center;
  color: var(--text-muted) !important;
  padding: 16px !important;
}

.leaderboard-workflow-cell {
  min-width: 250px;
}

.leaderboard-sort-btn {
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  font-weight: inherit;
  text-align: left;
  padding: 10px 10px;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.leaderboard-sort-btn:hover,
.leaderboard-sort-btn.is-active {
  color: var(--text);
  background: var(--surface-hover);
}

.leaderboard-workflow-main {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.leaderboard-workflow-sub {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.leaderboard-status-chip {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 2px 7px;
  color: var(--text-dim);
}

.leaderboard-status-chip.is-active {
  border-color: rgba(34, 197, 94, 0.45);
  color: var(--green);
  background: rgba(34, 197, 94, 0.12);
}

.leaderboard-status-chip.is-paused {
  border-color: rgba(148, 163, 184, 0.35);
  color: var(--text-muted);
  background: var(--surface);
}

.leaderboard-status-chip.is-retired {
  border-color: rgba(239, 68, 68, 0.45);
  color: var(--red);
  background: var(--red-accent-bg);
}

.leaderboard-momentum {
  font-size: 11px;
  color: var(--text-dim);
}

.leaderboard-momentum.is-positive {
  color: var(--green);
}

.leaderboard-momentum.is-negative {
  color: var(--red);
}

.leaderboard-percent-cell {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text);
}

.leaderboard-percent-cell-overall {
  color: var(--accent-light);
}

.leaderboard-panel-side {
  gap: 10px;
}

.leaderboard-top-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.leaderboard-top-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 11px;
  background: var(--surface);
}

.leaderboard-top-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.leaderboard-top-rank {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.leaderboard-top-score {
  font-size: 12px;
  font-weight: 700;
}

.leaderboard-top-score.is-positive {
  color: var(--green);
}

.leaderboard-top-score.is-negative {
  color: var(--red);
}

.leaderboard-top-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
}

.leaderboard-top-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 11px;
  color: var(--text-dim);
}

.leaderboard-score-bars {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.leaderboard-metric-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leaderboard-metric-summary-title {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 700;
}

.leaderboard-metric-summary-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.leaderboard-metric-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.leaderboard-metric-chip {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.leaderboard-metric-chip span {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.leaderboard-metric-chip strong {
  font-size: 15px;
  color: var(--text);
  font-weight: 700;
}

.leaderboard-placeholder {
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  background: var(--surface);
  padding: 10px;
  font-size: 12px;
  line-height: 1.4;
}

@media (max-width: 900px) {
  .api-program-grid {
    grid-template-columns: 1fr;
  }

  .api-inline-field {
    flex-wrap: wrap;
  }

  .api-inline-btn {
    flex: 1;
  }
}

@media (max-width: 640px) {
  .api-program-modal {
    width: 100%;
    max-height: 95vh;
  }

  .api-program-body {
    padding: 16px;
  }

  .api-quick-amounts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .upgrade-modal {
    width: 100%;
  }

  .upgrade-plan-grid {
    grid-template-columns: 1fr;
  }
}
/* Agent Workflow UI Styles */
.agent-workflow {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 8px 0 16px 56px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  width: fit-content;
  max-width: 85%;
}

.agent-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  opacity: 0.4;
  transform: translateX(-10px);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.agent-step.active {
  opacity: 1;
  color: var(--accent);
  transform: translateX(0);
}

.agent-step.done {
  opacity: 0.8;
  color: var(--text);
  transform: translateX(0);
}

.agent-icon-box {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  position: relative;
}

.agent-step.active .agent-icon-box {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  box-shadow: 0 0 10px var(--accent-glow);
}

.agent-step.done .agent-icon-box {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

/* Custom glowing spinner */
.agent-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-right-color: currentColor;
  border-radius: 50%;
  animation: agent-spin 0.8s linear infinite;
}

@keyframes agent-spin {
  100% { transform: rotate(360deg); }
}

/* Workflow Pill Bars */
.workflow-dots-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  max-width: none;
  margin: 3px auto 9px;
}

.workflow-pane-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: min(100%, 315px);
  text-align: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 9px;
}

.workflow-pane-title {
  font-size: 8px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.045em;
  text-align: center;
}

.workflow-pane-status {
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
}

.workflow-pane-dots {
  margin: 0 !important;
  width: auto !important;
  max-width: none !important;
  justify-content: center !important;
}

.brain-workflow-pane-card {
  width: auto;
  max-width: 420px;
  padding: 10px 12px;
  border-radius: 16px;
  border-color: rgba(var(--accent-rgb), 0.2);
  background:
    radial-gradient(circle at 20% 20%, rgba(var(--accent-rgb), 0.14), transparent 34%),
    radial-gradient(circle at 80% 25%, rgba(255, 255, 255, 0.08), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  box-shadow:
    0 22px 44px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px rgba(var(--accent-rgb), 0.05);
  position: relative;
  overflow: hidden;
}

.brain-workflow-pane-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(var(--accent-rgb), 0.08), transparent 56%),
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
  opacity: 0.9;
  pointer-events: none;
}

.brain-workflow-pane-card > * {
  position: relative;
  z-index: 1;
}

.brain-workflow-pane-card .workflow-pane-title {
  font-size: 9px;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.88);
}

.brain-workflow-pane-dots {
  position: relative;
  width: var(--brain-network-width, 220px) !important;
  min-width: var(--brain-network-width, 220px);
  height: var(--brain-network-height, 160px);
  max-width: none !important;
  padding: 0;
  margin: 0 auto !important;
  display: block;
  overflow: visible;
}

.brain-workflow-pane-dots::after {
  content: "";
  position: absolute;
  inset: 8% 10%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.08), transparent 68%);
  filter: blur(12px);
  opacity: 0.9;
  pointer-events: none;
}

.brain-network-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.brain-network-link {
  stroke: rgba(var(--accent-rgb), 0.2);
  stroke-width: 1.35;
  stroke-linecap: round;
  opacity: 0.45;
  stroke-dasharray: 3 6;
  animation: workflow-brain-link-float 3.4s ease-in-out infinite;
  animation-delay: var(--brain-link-delay, 0s);
}

.brain-workflow-pane-card.brain-complete .brain-network-link,
.brain-workflow-pane-card.brain-synthesizing .brain-network-link {
  stroke: rgba(var(--accent-rgb), 0.28);
  opacity: 0.72;
}

.brain-workflow-pane-dots .workflow-dot {
  position: absolute;
  width: 14px;
  min-width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  border-radius: 50%;
  border: 1px solid rgba(var(--accent-rgb), 0.24);
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.8), rgba(var(--accent-rgb), 0.22) 40%, rgba(255,255,255,0.05) 72%);
  overflow: visible;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.brain-workflow-pane-dots .workflow-dot::before {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.2), transparent 72%);
  opacity: 0;
  transform: scale(0.72);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.brain-workflow-pane-dots .workflow-dot::after {
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.82);
  transition: transform 0.3s ease, opacity 0.3s ease, background 0.25s ease;
}

.brain-workflow-pane-card .workflow-pane-text {
  max-width: 300px;
  color: rgba(255, 255, 255, 0.74);
  letter-spacing: 0.01em;
}

.brain-response-board {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.brain-response-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brain-workflow-dropdown {
  border-radius: 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0.012)),
    radial-gradient(circle at top left, rgba(var(--accent-rgb), 0.05), transparent 36%);
  overflow: hidden;
}

.brain-workflow-dropdown.is-error {
  border-color: rgba(239, 68, 68, 0.24);
}

.brain-workflow-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}

.brain-workflow-summary::-webkit-details-marker {
  display: none;
}

.brain-workflow-summary-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.brain-workflow-summary-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brain-workflow-status {
  font-size: 11px;
  color: var(--text-dim);
}

.brain-workflow-caret {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--text-dim);
  border-bottom: 1.5px solid var(--text-dim);
  transform: rotate(45deg);
  transition: transform 0.18s ease, opacity 0.18s ease;
  opacity: 0.8;
}

.brain-workflow-dropdown[open] .brain-workflow-caret {
  transform: rotate(225deg);
}

.brain-workflow-dropdown .brain-result-card {
  border: none;
  border-top: 1px solid rgba(var(--accent-rgb), 0.12);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.12);
  box-shadow: none;
}

.brain-result-card,
.brain-synthesis-card {
  border-radius: 16px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015)),
    radial-gradient(circle at top left, rgba(var(--accent-rgb), 0.08), transparent 34%);
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 14px;
}

.brain-result-card.is-error {
  border-color: rgba(239, 68, 68, 0.28);
  background:
    linear-gradient(180deg, rgba(239, 68, 68, 0.06), rgba(255, 255, 255, 0.01)),
    radial-gradient(circle at top left, rgba(239, 68, 68, 0.08), transparent 34%);
}

.brain-synthesis-card {
  border-color: rgba(var(--accent-rgb), 0.28);
}

.brain-panel-header {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 10px;
}

.brain-panel-kicker {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.brain-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.brain-panel-subtitle {
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.brain-panel-body {
  color: var(--text);
}

.brain-panel-body .message-answer,
.brain-panel-body p {
  margin: 0;
}

.brain-panel-error {
  color: #ff8f8f;
  font-size: 13px;
  line-height: 1.5;
}

.workflow-pane-cost {
  align-self: center;
  text-align: center;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-dim);
  line-height: 1.2;
}

.workflow-pane-cost-label {
  color: var(--text-muted);
  margin-right: 3px;
}

.workflow-pane-cost-value {
  color: var(--accent-light);
  font-variant-numeric: tabular-nums;
}

.workflow-pane-cost-meta {
  color: var(--text-dim);
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

.workflow-dot {
  width: 32px;
  min-width: 32px;
  height: 5px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  position: relative;
}

.workflow-dot::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.35s ease, background 0.25s ease;
}

.workflow-dot.active {
  border-color: rgba(var(--accent-rgb), 0.45);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.2);
}

.workflow-dot.active::after {
  width: 72%;
  animation: workflow-pill-pulse 1.1s ease-in-out infinite;
}

.brain-workflow-pane-dots .workflow-dot.active::after {
  width: 7px;
  height: 7px;
  animation: workflow-brain-pulse 1.2s cubic-bezier(0.22, 1, 0.36, 1) infinite;
  animation-delay: var(--brain-delay, 0s);
  background: rgba(255, 255, 255, 0.98);
}

.brain-workflow-pane-dots .workflow-dot.active::before {
  opacity: 1;
  animation: workflow-brain-halo 1.2s cubic-bezier(0.22, 1, 0.36, 1) infinite;
  animation-delay: var(--brain-delay, 0s);
}

.brain-workflow-pane-card.brain-synthesizing .brain-workflow-pane-dots .workflow-dot.completed::after,
.brain-workflow-pane-card.brain-complete .brain-workflow-pane-dots .workflow-dot.completed::after {
  animation: workflow-brain-idle 1.4s ease-in-out infinite;
  animation-delay: var(--brain-delay, 0s);
  opacity: 0.98;
}

.brain-workflow-pane-card.brain-synthesizing .brain-workflow-pane-dots .workflow-dot.completed::before,
.brain-workflow-pane-card.brain-complete .brain-workflow-pane-dots .workflow-dot.completed::before {
  opacity: 0.9;
  animation: workflow-brain-halo 1.4s ease-in-out infinite;
  animation-delay: var(--brain-delay, 0s);
}

.workflow-dot.completed {
  border-color: rgba(34, 197, 94, 0.35);
}

.workflow-dot.completed::after {
  width: 100%;
  background: var(--green);
  animation: none;
}

.brain-workflow-pane-dots .workflow-dot.completed {
  border-color: rgba(34, 197, 94, 0.46);
  background: rgba(34, 197, 94, 0.08);
}

.brain-workflow-pane-dots .workflow-dot.completed::after {
  width: 7px;
  height: 7px;
  background: rgba(151, 255, 204, 1);
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.42);
}

.brain-workflow-pane-dots .workflow-dot.completed::before {
  opacity: 0.52;
  transform: scale(1);
}

.workflow-dot.error {
  border-color: rgba(239, 68, 68, 0.45);
}

.workflow-dot.error::after {
  width: 100%;
  background: var(--red);
  animation: none;
}

.brain-workflow-pane-dots .workflow-dot.error {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.08);
}

.brain-workflow-pane-dots .workflow-dot.error::after {
  width: 7px;
  height: 7px;
  background: rgba(255, 120, 120, 1);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.34);
}

.brain-workflow-pane-dots .workflow-dot.error::before {
  opacity: 0.55;
  transform: scale(1.06);
}

.code-patch-dots {
  flex-wrap: wrap;
  justify-content: center !important;
}

.code-patch-dots .workflow-dot {
  flex: 1 1 26px;
  min-width: 18px;
  max-width: 34px;
}

.workflow-line {
  display: none !important;
}

@keyframes workflow-pill-pulse {
  0% {
    width: 46%;
    opacity: 0.7;
  }
  50% {
    width: 82%;
    opacity: 1;
  }
  100% {
    width: 58%;
    opacity: 0.85;
  }
}

@keyframes workflow-brain-pulse {
  0% {
    transform: translate(-50%, -50%) scale(0.72);
    opacity: 0.5;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.55);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.96);
    opacity: 0.78;
  }
}

@keyframes workflow-brain-idle {
  0% {
    opacity: 0.62;
    transform: translate(-50%, -50%) scale(0.85);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.18);
  }
  100% {
    opacity: 0.76;
    transform: translate(-50%, -50%) scale(0.92);
  }
}

@keyframes workflow-brain-halo {
  0% {
    transform: scale(0.72);
    opacity: 0;
  }
  45% {
    transform: scale(1.55);
    opacity: 0.85;
  }
  100% {
    transform: scale(2.05);
    opacity: 0;
  }
}

@keyframes workflow-brain-link-float {
  0% {
    stroke-dashoffset: 0;
    opacity: 0.34;
  }
  50% {
    stroke-dashoffset: -8;
    opacity: 0.82;
  }
  100% {
    stroke-dashoffset: -16;
    opacity: 0.38;
  }
}

/* ===========================
   FILE PREVIEWS FLOATING
   =========================== */
.file-previews-floating {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 12px 12px;
  max-width: 1100px;
  margin: 0 auto;
  animation: fade-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  max-width: 260px;
}

.file-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.file-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  color: var(--accent);
  flex-shrink: 0;
}

.file-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.file-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-card-size {
  font-size: 11px;
  color: var(--text-muted);
}

.file-card-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  opacity: 0;
  margin-left: auto;
}

.file-card:hover .file-card-remove {
  opacity: 1;
}

.file-card-remove:hover {
  background: rgba(255,255,255,0.1);
  color: var(--red);
}

/* Modal specific file remove button */
.modal-remove-btn {
  opacity: 1 !important;
  background: rgba(255,255,255,0.05);
}

.modal-remove-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
}

/* File System Styles */
.fs-item {
  display: flex;
  flex-direction: column;
}

.fs-item-row {
  display: flex;
  align-items: center;
  padding: 4px 12px;
  cursor: pointer;
  transition: all var(--transition);
  border-radius: 4px;
  margin: 0 4px;
  gap: 8px;
  position: relative;
  group: true;
}

.fs-item-row:hover {
  background: var(--surface-hover);
}

.fs-item-row.active {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
}

.fs-item-icon {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  flex-shrink: 0;
}

.fs-item-row.folder .fs-item-icon {
  color: var(--accent);
}

.fs-item-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.fs-item-path-hint {
  font-size: 10px;
  color: var(--text-dim);
  margin-left: 6px;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fs-item-actions {
  display: none;
  gap: 4px;
}

.fs-item-row:hover .fs-item-actions {
  display: flex;
}

.fs-action-btn {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.fs-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.fs-action-btn.delete:hover {
  color: var(--red);
  background: rgba(239, 68, 68, 0.1);
}

.fs-children {
  display: none;
  padding-left: 16px;
}

.fs-item.open > .fs-children {
  display: block;
}

.fs-expander {
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  color: var(--text-dim);
}

.fs-item.open > .fs-item-row .fs-expander {
  transform: rotate(90deg);
}

.btn-icon-sm:hover {
  background: var(--surface-hover) !important;
  color: var(--text) !important;
}

/* ===========================
   LOADING SCREEN
   =========================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  transition: opacity 0.5s ease, visibility 0.5s;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-logo {
  height: 48px;
  width: auto;
  animation: logo-pulse 2s ease-in-out infinite;
}

.loading-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.loading-bar-container {
  width: 200px;
  height: 2px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 1px;
  overflow: hidden;
  position: relative;
}

.loading-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 50%;
  background: var(--accent);
  box-shadow: 0 0 15px var(--accent-glow);
  animation: loading-bar-move 1.5s infinite cubic-bezier(0.65, 0, 0.35, 1);
}

@keyframes logo-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

@keyframes loading-bar-move {
  0% { left: -50%; width: 30%; }
  50% { left: 25%; width: 50%; }
  100% { left: 100%; width: 30%; }
}



.code-chat-add-files-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.code-chat-add-files-btn.active {
  color: var(--accent-light);
  border-color: rgba(var(--accent-rgb), 0.45);
  background: rgba(var(--accent-rgb), 0.12);
}

.code-patch-apply-message {
  display: flex;
  width: 100%;
  margin-bottom: 8px;
  justify-content: flex-start;
}

.code-patch-apply-card {
  width: min(92%, 360px);
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.code-patch-apply-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.code-patch-apply-text {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  min-height: 17px;
}

.code-patch-dots {
  max-width: 100%;
}

.file-system-search .input-field {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.file-system-search .input-field:focus {
  border-color: rgba(var(--accent-rgb), 0.45);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.15);
}
.fs-item-row.in-chat {
  background: rgba(var(--accent-rgb), 0.12);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
}

.fs-in-chat-tag {
  margin-left: 8px;
  margin-right: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-light);
  text-transform: uppercase;
}

.fs-chat-select-btn {
  margin-left: auto;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border-hover);
  background: transparent;
  color: transparent;
  flex-shrink: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all var(--transition);
}

.fs-chat-select-btn.selected {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.2);
  color: var(--accent-light);
}

.fs-chat-select-btn.selected::before {
  content: "\2713";
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.fs-chat-select-btn.blocked {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  cursor: not-allowed;
  position: relative;
  overflow: visible;
}

.fs-chat-select-btn.blocked[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  min-width: 190px;
  max-width: 240px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(15, 16, 20, 0.96);
  color: #fca5a5;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  white-space: normal;
  text-align: left;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 80;
}

.fs-chat-select-btn.blocked[data-tooltip]:hover::after,
.fs-chat-select-btn.blocked[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.model-option.membership-locked,
.code-chat-strength-tab.membership-locked {
  opacity: 0.45;
  cursor: not-allowed !important;
  position: relative;
  overflow: visible;
}

.model-option.membership-locked {
  border-color: rgba(239, 68, 68, 0.38);
  background: rgba(239, 68, 68, 0.08);
}

.model-option.membership-locked:hover,
.code-chat-strength-tab.membership-locked:hover {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.12);
}

.code-chat-strength-tab.membership-locked {
  color: #fca5a5 !important;
}

.membership-locked[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  min-width: 190px;
  max-width: 240px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(15, 16, 20, 0.96);
  color: #fca5a5;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  white-space: normal;
  text-align: left;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translate(-50%, 4px);
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 80;
}

.membership-locked[data-tooltip]:hover::after,
.membership-locked[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}
.fs-chat-select-btn.blocked::before {
  content: "x";
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.fs-item-row:hover .fs-chat-select-btn.blocked {
  border-color: rgba(239, 68, 68, 0.65);
}


.fs-item-row:hover .fs-chat-select-btn {
  border-color: rgba(var(--accent-rgb), 0.35);
}



.message-user-actions-always .message-action-btn:hover {
  color: var(--accent) !important;
  background: rgba(var(--accent-rgb), 0.1) !important;
}


.code-restore-divider-label:hover {
  color: var(--accent-light) !important;
}











.message-streaming .typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  display: inline-block;
  animation: statiumTypingPulse 1.1s infinite ease-in-out;
}

.message-streaming .typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.message-streaming .typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes statiumTypingPulse {
  0%, 80%, 100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}






























.code-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.code-chat-header-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.code-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
.code-chat-model-picker {
  position: relative;
}

.code-chat-model-btn {
  height: 21px;
  min-width: 80px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 0 8px 0 10px;
  outline: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  transition: all var(--transition);
}

.code-chat-model-btn:hover {
  background-color: rgba(255, 255, 255, 0.07);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.code-chat-model-btn:focus {
  border-color: rgba(var(--accent-rgb), 0.45);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.12);
}

.code-chat-model-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 182px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 130;
}

.code-chat-model-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.code-chat-model-tab {
  flex: 1;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 7px 6px;
  cursor: pointer;
  transition: all var(--transition);
}

.code-chat-model-tab:hover {
  color: var(--text);
  border-color: var(--border);
}

.code-chat-model-tab.active {
  background: var(--surface-hover);
  border-color: rgba(var(--accent-rgb), 0.35);
  color: var(--text);
}

.code-chat-model-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.code-chat-model-option {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  padding: 7px 9px;
  cursor: pointer;
  transition: all var(--transition);
}

.code-chat-model-option:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

.code-chat-model-option.active {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.45);
  color: var(--accent-light);
}
.code-chat-header-btn {
  min-height: 21px;
  min-width: 21px;
  padding: 3px;
  font-size: 8px;
}

.code-chat-header-btn svg {
  width: 12px;
  height: 12px;
  display: block;
}

.code-chat-history-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  z-index: 120;
}

.code-chat-settings-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 322px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  background-image: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  z-index: 125;
}

.code-chat-settings-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.code-chat-settings-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.code-chat-settings-label {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.code-chat-context-slider {
  width: 100%;
  appearance: none;
  background: transparent;
  margin: 0;
}

.code-chat-context-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: var(--border);
}

.code-chat-context-slider::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(var(--accent-rgb), 0.65);
  background: var(--accent-light);
  margin-top: -4px;
  cursor: pointer;
}

.code-chat-context-slider::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  border: none;
  background: var(--border);
}

.code-chat-context-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(var(--accent-rgb), 0.65);
  background: var(--accent-light);
  cursor: pointer;
}

.code-chat-context-marks {
  position: relative;
  height: 12px;
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
}

.code-chat-context-marks span {
  position: absolute;
  top: 0;
  white-space: nowrap;
  transform: translateX(-50%);
}

.code-chat-context-marks span:nth-child(1) {
  left: 0%;
  transform: translateX(0);
}

.code-chat-context-marks span:nth-child(2) {
  left: 25%;
}

.code-chat-context-marks span:nth-child(3) {
  left: 50%;
}

.code-chat-context-marks span:nth-child(4) {
  left: 75%;
}

.code-chat-context-marks span:nth-child(5) {
  left: 100%;
  transform: translateX(-100%);
}

.code-chat-context-value {
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.code-chat-context-warning {
  margin-top: -2px;
  color: #f59e0b;
  font-size: 11px;
  font-weight: 600;
}

.code-chat-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
}

.code-chat-history-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.code-chat-history-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-subtle);
}

.code-chat-history-item.active {
  border-color: rgba(var(--accent-rgb), 0.35);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.2);
}

.code-chat-history-open {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.code-chat-history-delete {
  border: none;
  background: transparent;
  color: #f87171;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.code-chat-history-delete:hover {
  color: #f87171;
  background: rgba(248, 113, 113, 0.12);
}

.code-chat-history-empty {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 16px 8px;
}






















/* ===========================
   PORTRAIT MOBILE HARDENING
   =========================== */
@media (max-width: 900px) and (orientation: portrait) {
  .dashboard-layout {
    grid-template-columns: 1fr !important;
  }

  .sidebar {
    width: min(88vw, 340px) !important;
    max-width: 88vw !important;
  }

  .sidebar-toggle {
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    left: 10px;
    z-index: 110;
  }

  .chat-main {
    min-width: 0;
    height: 100svh;
  }

  .chat-empty {
    padding: 86px 16px 24px;
  }

  .chat-messages {
    padding: 72px 10px 14px 12px;
    gap: 14px;
  }

  .message {
    max-width: 100%;
  }

  .message-user .message-bubble,
  .message-assistant .message-bubble {
    max-width: 100%;
  }

  .chat-input-area {
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .chat-input-outer {
    max-width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .chat-input-wrapper {
    min-width: 0;
    width: 100%;
    border-radius: 18px;
  }

  .chat-input-row {
    width: 100%;
  }

  .chat-input {
    font-size: 16px;
  }

  .btn-attach {
    width: 34px;
    height: 34px;
  }

  .btn-send {
    height: 34px;
  }

  .model-picker-container {
    align-self: center;
    margin-top: 0;
  }

  .model-picker-btn {
    height: 36px;
    padding: 0 12px;
    font-size: 12px;
  }

  .model-dropdown {
    left: 50%;
    right: auto;
    bottom: calc(100% + 8px);
    width: min(92vw, 330px);
    transform: translate(-50%, 10px);
  }

  .model-dropdown[style*="display: block"] {
    transform: translate(-50%, 0);
  }

  .modal-overlay {
    padding: 12px;
  }

  .modal-content {
    width: min(96vw, 560px);
    max-height: 92svh;
    overflow: hidden;
  }

  .modal-body {
    max-height: calc(92svh - 84px);
    overflow-y: auto;
  }

  .api-program-modal,
  .upgrade-modal,
  .apps-modal {
    width: min(96vw, 760px);
  }

  .apps-modal-body {
    grid-template-columns: 1fr;
  }

  .apps-card-code {
    grid-column: 1;
    grid-row: auto;
  }

  .apps-card-sports {
    grid-column: 1;
    grid-row: auto;
  }

  .apps-card-markets {
    grid-column: 1;
    grid-row: auto;
  }

  .markets-main {
    padding: 14px 12px 10px;
    gap: 10px;
  }

  .markets-chart-shell {
    height: 320px;
  }

  .markets-header {
    padding: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .markets-header-actions {
    justify-content: flex-end;
  }

  .markets-toolbar {
    align-items: stretch;
  }

  .markets-toolbar-meta {
    width: 100%;
  }

  .markets-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .markets-forecast-head {
    flex-direction: column;
    align-items: stretch;
  }

  .markets-forecast-actions {
    width: 100%;
    justify-content: stretch;
  }

  .markets-forecast-actions .btn {
    flex: 1;
  }

  .markets-forecast-option {
    min-width: 0;
    flex: 1 1 100%;
  }

  .markets-forecast-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .markets-grid {
    grid-template-columns: 1fr;
  }

  .markets-chart-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .markets-chart-head-controls {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .markets-chart-meta {
    text-align: left;
    max-width: none;
  }

  .markets-chart-shell {
    height: 340px;
  }

  .betting-main {
    padding: 14px 12px 10px;
    gap: 10px;
  }

  .leaderboard-main {
    padding: 14px 12px 10px;
    gap: 10px;
  }

  .leaderboard-header {
    padding: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .leaderboard-header-actions {
    justify-content: flex-end;
  }

  .leaderboard-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leaderboard-grid {
    grid-template-columns: 1fr;
  }

  .leaderboard-panel {
    padding: 10px;
  }

  .leaderboard-table {
    min-width: 700px;
  }

  .betting-header {
    padding: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .betting-header-actions {
    justify-content: flex-end;
  }

  .betting-v2-layout {
    grid-template-columns: 1fr;
  }

  .betting-v2-chat,
  .betting-v2-games {
    padding: 10px;
  }

  #bettingWorkflowSelect {
    min-width: 0;
    width: 100%;
  }

  .betting-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .betting-games-grid {
    grid-template-columns: 1fr;
  }

  .betting-details-modal {
    width: min(96vw, 980px);
  }

  .betting-details-teams {
    grid-template-columns: 1fr;
  }

  .betting-team-comparison-grid {
    grid-template-columns: 1fr;
  }

  .betting-team-moves {
    grid-template-columns: 1fr;
  }

  .betting-prediction-head {
    flex-direction: column;
    align-items: stretch;
  }

  .betting-prediction-lists {
    grid-template-columns: 1fr;
  }

  .betting-team-player-table {
    min-width: 620px;
  }

  #codeEditorContainer {
    height: 100svh !important;
  }

  #codeEditorContainer .code-editor-header {
    padding: 10px 12px !important;
    gap: 8px;
    flex-wrap: wrap;
  }

  #codeEditorContainer .code-editor-header > div:first-child {
    min-width: 0;
    gap: 8px !important;
    flex-wrap: wrap;
  }

  #newFileActions {
    flex-wrap: wrap;
  }

  #codeFileList {
    width: 100%;
    max-width: 100%;
  }

  #codeEditorContainer .code-editor-body {
    flex-direction: column !important;
  }

  #codeEditorContainer .code-file-sidebar {
    width: 100% !important;
    max-height: 52svh;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
  }

  #codeSidebarResizer,
  #codePreviewResizer,
  .code-sidebar-toggle {
    display: none !important;
  }

  #codeEditorContainer .code-editor-workspace {
    min-height: 0;
    flex: 1 1 auto;
  }

  #codeEditorLineNumbers {
    width: 34px !important;
  }

  #codeEditorHighlight,
  #codeEditorTextarea {
    left: 34px !important;
    width: calc(100% - 34px) !important;
    font-size: 13px !important;
  }

  #codeChatModelMenu,
  #codeChatHistoryPanel,
  #codeChatSettingsPanel {
    width: min(92vw, 320px) !important;
    right: 0 !important;
    left: auto !important;
  }
}

@media (orientation: portrait) and (max-aspect-ratio: 9/16) {
  .chat-empty {
    padding-top: 96px;
  }

  .chat-messages {
    padding-top: 84px;
  }

  .model-picker-container {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 105;
  }

  .chat-input-area {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
}

/* ===========================
   MOBILE SCROLL STABILITY
   =========================== */
.chat-messages,
.sidebar-chats,
#codeChatMessages,
.file-system-body,
.customization-body,
.modal-body {
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 900px) and (orientation: portrait) {
  .page-dashboard,
  .dashboard-layout,
  .chat-main,
  #codeEditorContainer,
  #leaderboardContainer {
    height: 100dvh !important;
  }

  .chat-messages,
  .sidebar-chats,
  #codeChatMessages,
  .file-system-body {
    overscroll-behavior-y: contain;
    touch-action: pan-y;
  }
}

@media (orientation: portrait) and (max-aspect-ratio: 9/16) {
  .model-picker-container {
    pointer-events: none;
  }

  .model-picker-btn,
  .model-dropdown {
    pointer-events: auto;
  }
}
