/* ============================================================
   Trading Terminal — Professional Fintech Stylesheet
   ============================================================ */

/* ----- Custom Properties / Theming ----- */
:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #1e2130;
  --bg-hover: #252838;
  --bg-input: #252838;
  --text-primary: #e1e4ea;
  --text-secondary: #a6aabd;
  --text-muted: #8d91a5; /* WCAG AA (>=4.5:1) on --bg-card / --bg-hover */
  --border-color: #2a2d3a;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --positive: #22c55e;
  --positive-bg: rgba(34,197,94,0.1);
  --negative: #ef4444;
  --negative-text: #f87171; /* AA text on dark surfaces */
  --accent-text: #60a5fa; /* AA link/pill text on dark surfaces */
  --warning-text: #fbbf24;
  --negative-bg: rgba(239,68,68,0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245,158,11,0.1);
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-width: 240px;
  --header-height: 56px;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;
}

[data-theme="light"] {
  --negative-text: #b91c1c;
  --accent-text: #1d4ed8;
  --warning-text: #92400e;
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f0f2f5;
  --bg-input: #f0f2f5;
  --text-primary: #1a1d27;
  --text-secondary: #5a5e72;
  --text-muted: #8b8fa3;
  --border-color: #e2e5ea;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
}

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

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  width: 100%;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh; /* iOS Safari: excludes the collapsing bottom toolbar */
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

#app {
  width: 100%;
  max-width: 100%;
  min-height: 100dvh;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 8px;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

a {
  color: var(--accent-text);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

/* ----- Scrollbar (Dark Theme) ----- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ----- App Layout ----- */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--header-height) 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ----- Sidebar ----- */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  width: var(--sidebar-width);
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  height: var(--header-height);
  flex-shrink: 0;
}

.sidebar-logo .logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sidebar-user-block {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-user-label {
  display: block;
  margin-bottom: 6px;
}

.sidebar-user-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.sidebar-user-select {
  flex: 1;
  font-size: 0.82rem;
  padding: 6px 8px;
}

.sidebar-user-add {
  flex-shrink: 0;
  min-width: 34px;
  padding: 4px 8px;
}

.active-portfolio-badge {
  color: var(--accent-text);
  font-weight: 600;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portfolio-profiles-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portfolio-profile-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
}

.portfolio-profile-row.active {
  border-color: rgba(52, 211, 153, 0.45);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.15);
}

.portfolio-profile-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 180px;
}

.profile-name-input {
  max-width: 220px;
}

.portfolio-profile-actions {
  display: flex;
  gap: 6px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-section {
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 8px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 2px;
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-text);
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* ----- Header ----- */
.header {
  grid-area: header;
  min-width: 0;
  position: sticky;
  top: 0;
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 0 20px;
  z-index: 90;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin-left: 0;
  overflow: visible;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 auto;
  min-width: 180px;
  max-width: 380px;
}

.header-left #searchbar-container {
  flex: 1 1 220px;
  min-width: 160px;
  max-width: 280px;
}

.header-left #searchbar-container .search-container {
  width: 100%;
  max-width: 100%;
}

.header-search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--bg-input, #1e293b);
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.2));
  border-radius: var(--radius, 8px);
  padding: 6px 10px;
  color: var(--text-primary, #f8fafc);
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  min-height: 36px;
}

.header-search-trigger:hover,
.header-search-trigger:focus-visible {
  border-color: var(--accent, #3b82f6);
  background: rgba(30, 41, 59, 0.95);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
  outline: none;
}

.header-search-placeholder {
  flex: 1;
  color: var(--text-muted, #94a3b8);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-placeholder-short {
  display: none;
}

.search-placeholder-full {
  display: inline;
}

@media (max-width: 640px) {
  .search-placeholder-full {
    display: none !important;
  }
  .search-placeholder-short {
    display: inline !important;
  }
}

.header-search-kbd {
  font-size: 0.68rem;
  font-family: var(--font-mono, monospace);
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: var(--text-secondary, #94a3b8);
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
  flex: 1 1 auto;
  position: relative;
  z-index: 1;
  padding-left: 4px;
  background: var(--bg-secondary);
}

.header-toolbar-divider {
  flex-shrink: 0;
  width: 1px;
  height: 22px;
  margin: 0 2px;
  background: var(--border-color);
  opacity: 0.9;
}

.header-right > * {
  flex-shrink: 0;
}

.header-right .ai-cmd-trigger-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

@media (min-width: 769px) {
  #mobile-menu-btn {
    display: none !important;
  }
}

.header-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.last-updated {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.refresh-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-secondary);
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.refresh-btn:hover {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--accent);
}

.refresh-btn.spinning .refresh-icon {
  animation: spin 0.8s linear infinite;
}

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

.market-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.market-status.open {
  background: var(--positive-bg);
  color: var(--positive);
}

.market-status.open::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--positive);
  animation: pulse 2s ease-in-out infinite;
}

.market-status.closed {
  background: var(--negative-bg);
  color: var(--negative-text);
}

.market-status.closed::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--negative);
}

/* ----- Hamburger (Mobile) ----- */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: all 0.25s ease;
}

/* ----- Main Content ----- */
.main-content {
  grid-area: main;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 24px;
  overflow-y: auto;
  margin-left: 0;
  min-height: calc(100vh - var(--header-height));
  min-height: calc(100dvh - var(--header-height));
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dashboard-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1100px) {
  .dashboard-grid--3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.dash-kpi-rows {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.dash-kpi-row--4 {
  grid-template-columns: repeat(4, 1fr);
}

.dash-kpi-row--3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1024px) {
  .dash-kpi-row--4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-kpi-row--3 {
    grid-template-columns: 1fr;
  }
}

.summary-card .card-sub {
  font-size: 0.72rem;
  color: var(--text-muted, var(--text-secondary));
  margin-top: 6px;
  line-height: 1.35;
}

.dash-kpi-sep {
  color: var(--text-secondary);
  font-weight: 400;
  margin: 0 4px;
}

.dash-kpi-link {
  border: none;
  background: none;
  font: inherit;
  color: var(--accent-text);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  font-family: var(--font-mono);
}

.dash-text-link {
  border: none;
  background: none;
  color: var(--accent-text);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.dash-heat-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.dash-heat-badge--safe {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.dash-heat-badge--hot {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}

.dash-heat-badge--watch {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
}

.dash-intraday-trend {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 8px;
  vertical-align: middle;
}

.dash-intraday-trend--up {
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 8px solid #34d399;
}

.dash-intraday-trend--down {
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 8px solid #f87171;
}

/* ============================================================
   Sector Risk & Momentum Matrix
   ============================================================ */

.dash-sector-matrix-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
}

.dash-matrix-header {
  margin-bottom: 14px;
}

.dash-matrix-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.dash-matrix-title-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.dash-matrix-title-group .card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dash-matrix-meta-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-meta-pill {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.dash-meta-pill strong {
  color: var(--text-primary);
  margin-left: 2px;
}

/* Grid layout: 4 cols on desktop, 2 on tablet, 1 on mobile */
.dash-sector-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 1024px) {
  .dash-sector-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .dash-sector-grid {
    grid-template-columns: 1fr;
  }
}

/* Interactive Sector Card */
.dash-sector-card {
  min-height: 48px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 8px);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  user-select: none;
}

.dash-sector-card:hover {
  background: var(--bg-hover);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

.dash-sector-card.active {
  background: rgba(56, 189, 248, 0.07);
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px #38bdf8, 0 4px 16px rgba(56, 189, 248, 0.12);
}

.dash-sector-card--over-risked {
  border-left: 3px solid #ef4444;
}

.dash-sector-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dash-sector-card-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Momentum Pills */
.dash-sector-pill {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.matrix-mom--leading {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.matrix-mom--neutral {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.matrix-mom--lagging {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* Dual Progress Comparison */
.dash-sector-dual-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-dual-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.72rem;
}

.dash-dual-label {
  color: var(--text-secondary);
}

.dash-dual-val {
  font-weight: 600;
  font-family: var(--font-mono);
}

.dash-dual-rupee {
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 0.68rem;
}

.dash-progress-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.dash-progress-track--capital {
  height: 4px;
}

.dash-progress-track--risk {
  height: 6px;
}

.dash-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.dash-progress-fill--capital {
  background: linear-gradient(90deg, #6366f1, #38bdf8);
}

.dash-progress-fill--safe {
  background: #38bdf8;
}

.dash-progress-fill--warning {
  background: #f59e0b;
}

.dash-progress-fill--danger {
  background: #ef4444;
}

.dash-progress-fill--risk-free {
  background: #10b981;
}

/* Card Footer */
.dash-sector-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.dash-sector-stocks-badge {
  color: var(--text-secondary);
}

.dash-sector-r-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.75rem;
}

.dash-sector-chevron {
  font-size: 0.68rem;
  color: #38bdf8;
  font-weight: 600;
}

/* Inline Inspection Drawer */
.dash-sector-drawer {
  margin-top: 14px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md, 8px);
  padding: 14px 16px;
  animation: fadeInDrawer 0.2s ease-out;
}

@keyframes fadeInDrawer {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dash-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.dash-drawer-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-drawer-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-drawer-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dash-drawer-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dash-dot-sep {
  opacity: 0.4;
}

.dash-drawer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-drawer-close {
  font-size: 1.25rem;
  line-height: 1;
  padding: 4px 8px;
  color: var(--text-secondary);
  cursor: pointer;
  background: transparent;
  border: none;
}

.dash-drawer-close:hover {
  color: var(--text-primary);
}

/* Drawer Table */
.dash-drawer-table-wrapper {
  overflow-x: auto;
  margin-top: 10px;
}

.dash-drawer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.dash-drawer-table th {
  padding: 8px 10px;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-drawer-td {
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.dash-drawer-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.dash-drawer-symbol-col {
  min-width: 130px;
}

.dash-drawer-sym-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dash-sl-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
}

/* Mobile Holdings Card List (iPhone 15 393px view) */
.dash-drawer-mobile-list {
  display: none;
  margin-top: 10px;
}

.dash-drawer-mobile-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm, 6px);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.dash-drawer-mobile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.dash-drawer-mobile-body {
  margin-bottom: 8px;
}

.dash-drawer-mobile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dash-drawer-mobile-actions {
  display: flex;
  gap: 6px;
}

/* Visibility toggles for mobile vs desktop */
@media (max-width: 640px) {
  .dash-drawer-table-wrapper.hide-on-mobile {
    display: none !important;
  }
  .dash-drawer-mobile-list.show-on-mobile {
    display: block !important;
  }
  .dash-drawer-header {
    flex-direction: column;
    align-items: stretch;
  }
  .dash-drawer-actions {
    justify-content: space-between;
    width: 100%;
  }
  .dash-drawer-actions .btn {
    flex: 1;
    min-height: 44px;
  }
  .dash-sector-card {
    min-height: 52px;
  }
}

@media (min-width: 641px) {
  .dash-drawer-table-wrapper.hide-on-mobile {
    display: block !important;
  }
  .dash-drawer-mobile-list.show-on-mobile {
    display: none !important;
  }
}

/* Legacy fallback support */
.dash-sector-bar {
  display: none;
}

/* ============================================================
   Active SL & Target Guardrails Widget
   ============================================================ */

.dash-guardrails-card {
  background: linear-gradient(180deg, #131b2e 0%, #0f172a 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
}

.guardrails-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.guardrails-title-group {
  display: flex;
  flex-direction: column;
}

.guardrails-tabs-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: 100%;
  padding-bottom: 2px;
}

.guardrails-tabs-scroll::-webkit-scrollbar {
  display: none;
}

.guardrails-tab {
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  user-select: none;
}

.guardrails-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(56, 189, 248, 0.3);
}

.guardrails-tab.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.guardrails-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.guardrail-row {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 8px);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 190px 1fr 190px;
  align-items: center;
  gap: 16px;
  transition: all 0.2s ease;
}

.guardrail-row:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(56, 189, 248, 0.3);
}

.guardrail-row--near-sl {
  border-left: 3px solid #ef4444;
}

.guardrail-row--near-tgt {
  border-left: 3px solid #10b981;
}

.guardrail-item-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.guardrail-sym-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.guardrail-symbol {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.guardrail-pnl-pill {
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.guardrail-ltp-row {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.guardrail-item-center {
  width: 100%;
}

.guardrail-track-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guardrail-track-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
}

.guardrail-label-sl, .guardrail-label-tgt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.guardrail-sub-tag {
  font-size: 0.65rem;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
}

.guardrail-track-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  position: relative;
  display: flex;
  overflow: visible;
  align-items: center;
}

.guardrail-track-bar--single {
  overflow: hidden;
}

.guardrail-zone--sl {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.6), rgba(245, 158, 11, 0.5));
  height: 100%;
  border-top-left-radius: 999px;
  border-bottom-left-radius: 999px;
}

.guardrail-zone--mid {
  background: rgba(255, 255, 255, 0.08);
  height: 100%;
}

.guardrail-zone--tgt {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.5), rgba(6, 182, 212, 0.6));
  height: 100%;
  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;
}

.guardrail-fill-buffer {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.guardrail-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #38bdf8;
  box-shadow: 0 0 8px #38bdf8, 0 0 2px rgba(0, 0, 0, 0.5);
  z-index: 2;
  cursor: pointer;
  transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.guardrail-dot-ping {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.35);
  animation: pulseDot 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulseDot {
  0%, 100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.guardrail-track--missing {
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px dashed rgba(245, 158, 11, 0.3);
}

.guardrail-item-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.guardrail-btn-edit {
  min-height: 44px;
  min-width: 78px;
  font-size: 0.74rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.guardrail-btn-copy {
  min-height: 44px;
  min-width: 44px;
  font-size: 0.74rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.guardrail-btn-copy.btn-copied {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #34d399 !important;
  border-color: #34d399 !important;
}

.guardrail-expand-btn {
  min-height: 40px;
  padding: 6px 16px;
  cursor: pointer;
}

/* Mobile Responsiveness for iPhone 15 (393px viewport) */
@media (max-width: 768px) {
  .guardrail-row {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .guardrail-item-left {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .guardrail-item-actions {
    display: flex;
    gap: 8px;
    width: 100%;
  }

  .guardrail-btn-edit {
    flex: 1;
    min-height: 44px;
  }

  .guardrail-btn-copy {
    flex: 1;
    min-height: 44px;
  }
}

.dash-movers-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .dash-movers-split {
    grid-template-columns: 1fr;
  }
}

.dash-movers-col h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.dash-mover-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  color: inherit;
}

.dash-mover-row:hover {
  background: var(--bg-hover);
}

.dash-mover-sym {
  font-weight: 600;
  font-size: 0.82rem;
}

.dash-mover-bar-wrap {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 999px;
  overflow: hidden;
}

.dash-mover-bar--gain {
  height: 100%;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.35), #34d399);
}

.dash-mover-bar--loss {
  height: 100%;
  background: linear-gradient(90deg, rgba(248, 113, 113, 0.35), #f87171);
}

.dash-mover-pct {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  min-width: 52px;
  text-align: right;
}

.dash-scanner-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dash-scanner-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.dash-scanner-item:last-child {
  border-bottom: none;
}

.dash-scanner-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dash-alert-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}

.dash-alert-item {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.82rem;
}

.dash-unprotected {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.dash-unprotected h4 {
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.dash-unprot-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dash-unprot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  font-size: 0.82rem;
}

.dash-panel .card-title {
  margin-bottom: 12px;
}

/* ----- Strategy Guide & Quick Help ----- */
.page-help-bar {
  margin-bottom: 16px;
}

.page-help-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.page-help-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.page-help-btn,
.page-help-header-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  color: var(--accent-text);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.page-help-btn:hover,
.page-help-header-btn:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent);
}

.stc-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.quick-help-drawer,
.quick-help-backdrop {
  /* extends scanner drawer pattern */
}

.quick-help-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1200;
}

.quick-help-backdrop.hidden {
  display: none;
}

.quick-help-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(400px, 94vw);
  height: 100vh;
  height: 100dvh;
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.45);
  z-index: 1201;
  overflow-y: auto;
  animation: slideInRight 0.25s ease;
  display: flex;
  flex-direction: column;
}

.quick-help-drawer.hidden {
  display: none;
}

.quick-help-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-color);
}

.quick-help-drawer-head h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.quick-help-lang {
  display: flex;
  gap: 8px;
  padding: 12px 18px 0;
}

.quick-help-list {
  list-style: disc;
  margin: 12px 18px;
  padding-left: 18px;
  flex: 1;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.quick-help-list li {
  margin-bottom: 8px;
}

.quick-help-footer {
  padding: 14px 18px 20px;
  border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   CapitalPilot AI Playbook & Feature Guide (Mobile-First, iPhone 15 Optimized)
   ========================================================================== */

.guide-page {
  min-width: 0;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 4px 0 32px;
}

.guide-hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px 24px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.guide-hero-badge {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.guide-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary, #94a3b8);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.guide-chip-accent {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.3);
}

.guide-hero h1 {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-primary, #f8fafc);
  margin: 0 0 6px;
  line-height: 1.25;
}

.guide-hero-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary, #94a3b8);
  max-width: 680px;
  margin: 0;
  line-height: 1.5;
}

.guide-hero-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.guide-lang-toggle,
.quick-help-lang {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.85);
  border-radius: 999px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.guide-lang-pill {
  border: none;
  background: transparent;
  color: var(--text-secondary, #94a3b8);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 18px;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.guide-lang-pill:hover {
  color: #ffffff;
}

.guide-lang-pill.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4);
}

/* Toolbar & Horizontal Scrollable Tabs */
.guide-toolbar {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-card, #1a1e2e);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg, 12px);
}

.guide-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.guide-search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-secondary, #64748b);
  font-size: 0.9rem;
  pointer-events: none;
}

.guide-search {
  width: 100%;
  padding-left: 40px !important;
  min-height: 44px;
  font-size: 0.88rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.guide-search:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  outline: none;
}

.guide-tabs-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.guide-tabs-scroll::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.guide-tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(30, 41, 59, 0.6);
  color: var(--text-secondary, #94a3b8);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  touch-action: manipulation;
}

.guide-tab-pill:hover {
  background: rgba(59, 130, 246, 0.12);
  color: #ffffff;
  border-color: rgba(59, 130, 246, 0.3);
}

.guide-tab-pill.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(37, 99, 235, 0.3) 100%);
  border-color: #3b82f6;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.25);
}

.guide-tab--match {
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.5) !important;
}

.guide-tab-icon {
  font-size: 1rem;
}

/* Module Container */
.guide-all-container,
.guide-single-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.guide-module-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-margin-top: 80px;
}

.guide-card-header {
  margin-bottom: 4px;
}

.guide-section-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
}

.guide-panel-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary, #f8fafc);
  margin: 0 0 8px;
  line-height: 1.3;
}

.guide-panel-lead {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-secondary, #94a3b8);
  margin: 0;
}

.guide-time-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

/* SVG Containers & Wrappers */
.guide-svg-container {
  padding: 16px 20px;
  background: var(--bg-card, #1a1e2e);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
}

.guide-svg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.guide-svg-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.guide-svg-scroll-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.guide-svg-blueprint,
.guide-svg-vcp,
.guide-svg-roundtrip,
.guide-svg-ladder {
  display: block;
  width: 100%;
  min-width: 600px;
  height: auto;
}

/* Checklist Grid */
.guide-checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 14px;
}

.guide-checklist-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-card, #1a1e2e);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg, 12px);
  transition: transform 0.2s, border-color 0.2s;
}

.guide-checklist-card:hover {
  border-color: rgba(59, 130, 246, 0.35);
  transform: translateY(-2px);
}

.guide-checklist-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.guide-checklist-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 3px 8px;
  border-radius: 6px;
}

.guide-checklist-time {
  font-size: 0.72rem;
  color: var(--text-secondary, #94a3b8);
  font-family: var(--font-mono, monospace);
}

.guide-checklist-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: #f8fafc;
}

.guide-check-points {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-check-points li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-secondary, #cbd5e1);
}

.guide-check-points li i {
  margin-top: 3px;
  flex-shrink: 0;
}

/* Regime Matrix Grid */
.guide-regime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.guide-regime-card {
  padding: 16px;
  border-radius: var(--radius-lg, 12px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid;
}

.guide-regime-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guide-regime-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0;
}

.guide-regime-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
}

.guide-regime-criteria {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 12px;
  border-radius: 8px;
}

.guide-regime-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
}

.guide-regime-label {
  color: var(--text-secondary, #94a3b8);
  flex-shrink: 0;
}

.guide-regime-val {
  text-align: right;
  color: #f8fafc;
}

.guide-diagram-notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.note-box {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.5;
}

.note-positive {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #cbd5e1;
}

.note-positive strong {
  color: #34d399;
}

.note-negative {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #cbd5e1;
}

.note-negative strong {
  color: #f87171;
}

/* Polycab Worked Example & Ladder */
.guide-polycab-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-polycab-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-content {
  flex: 1;
}

.step-content strong {
  font-size: 0.88rem;
  color: #f8fafc;
}

.guide-ladder-svg-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* GTT Boxes */
.guide-gtt-boxes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.gtt-box {
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid;
}

.gtt-box-sl {
  border-color: rgba(239, 68, 68, 0.35);
}

.gtt-box-target {
  border-color: rgba(16, 185, 129, 0.35);
}

.gtt-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.gtt-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 4px;
}

/* Guardrails */
.guide-guardrail-box {
  border-radius: var(--radius-lg, 12px);
}

.guardrail-amber {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.guardrail-red {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.guardrail-icon {
  font-size: 1.2rem;
}

/* Simulator Styles */
.guide-sim-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(59, 130, 246, 0.25);
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.4);
}

.guide-sim-algo-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.guide-sim-algo-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.guide-sim-algo-btn {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-secondary, #94a3b8);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 14px;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
}

.guide-sim-algo-btn:hover {
  color: #fff;
  border-color: rgba(59, 130, 246, 0.4);
}

.guide-sim-algo-btn.active {
  background: rgba(59, 130, 246, 0.25);
  border-color: #3b82f6;
  color: #60a5fa;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.guide-sim-control-box {
  background: rgba(15, 23, 42, 0.7);
  padding: 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.guide-sim-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #334155;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  margin: 12px 0 6px;
}

.guide-sim-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #3b82f6;
  border: 3px solid #ffffff;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.8);
  cursor: pointer;
  transition: transform 0.1s;
}

.guide-sim-slider::-webkit-slider-thumb:hover,
.guide-sim-slider::-webkit-slider-thumb:active {
  transform: scale(1.18);
}

.guide-sim-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.guide-sim-kpi {
  padding: 14px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary, #94a3b8);
}

.kpi-val {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: var(--font-mono, monospace);
  line-height: 1.2;
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-secondary, #94a3b8);
}

.guide-sim-chart-wrap {
  padding: 14px 16px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.bg-accent { background-color: #3b82f6; }
.bg-positive { background-color: #10b981; }

/* AI Cards Grid */
.guide-ai-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.guide-ai-card {
  padding: 16px;
  background: var(--bg-card, #1a1e2e);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg, 12px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-ai-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.guide-ai-icon {
  font-size: 1.8rem;
}

.guide-ai-badge {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a78bfa;
}

.guide-ai-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 2px 0 0;
  color: #f8fafc;
}

.guide-ai-dialogue {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-speech-bubble {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.5;
}

.bubble-role {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.user-bubble {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.user-bubble .bubble-role {
  color: #94a3b8;
}

.ai-bubble {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.ai-bubble .bubble-role {
  color: #818cf8;
}

.bubble-text {
  margin: 0;
  color: #e2e8f0;
}

/* ============================================================
   AI Command OS & Intelligence Guide Styling
   ============================================================ */
.guide-subsection-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin: 20px 0 10px;
}

.guide-access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.guide-access-card {
  padding: 14px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.guide-access-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
}

.guide-access-icon {
  font-size: 1.5rem;
  line-height: 1;
  padding: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
}

.guide-access-body {
  flex: 1;
  min-width: 0;
}

.guide-access-platform {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f1f5f9;
}

.guide-access-kbd {
  font-size: 0.7rem;
  padding: 2px 6px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #38bdf8;
  font-family: monospace;
}

.guide-access-desc {
  font-size: 0.76rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.4;
}

/* Architecture Pipeline */
.guide-ai-pipeline {
  padding: 16px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
}

.guide-pipeline-grid {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
}

.guide-pipeline-node {
  flex: 1;
  min-width: 140px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 12px 10px;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.guide-node-step {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #6366f1;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-node-icon {
  font-size: 1.3rem;
}

.guide-node-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #f8fafc;
}

.guide-node-desc {
  font-size: 0.7rem;
  color: #94a3b8;
  line-height: 1.35;
}

.guide-pipeline-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.25);
  font-size: 0.9rem;
  flex-shrink: 0;
  padding: 0 4px;
}

.arrow-mobile {
  display: none;
}

/* Simulated AI Command Terminal */
.guide-cmd-terminal {
  background: #090d16;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.guide-cmd-term-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.guide-term-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.term-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.guide-term-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.02em;
}

.guide-term-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: #10b981;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.1);
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.guide-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.guide-cmd-term-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.guide-term-starter-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.guide-term-chips-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
}

.guide-term-chips-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.guide-sim-chip {
  padding: 5px 10px;
  font-size: 0.75rem;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.guide-sim-chip:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #fff;
}

.guide-sim-chip.active {
  background: rgba(99, 102, 241, 0.25);
  border-color: #6366f1;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.guide-term-dialogue {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-term-msg {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
}

.guide-term-msg.user-msg {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.guide-term-msg.ai-msg {
  background: rgba(20, 24, 39, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: inset 0 0 20px rgba(99, 102, 241, 0.05);
}

.term-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.guide-term-msg.ai-msg .term-msg-avatar {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.term-msg-content {
  flex: 1;
  min-width: 0;
}

.term-msg-role {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.term-msg-text {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #e2e8f0;
  margin: 4px 0 0;
}

.guide-intent-badge {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.guide-sim-action-chips-wrap {
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 10px 12px;
}

.guide-chips-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.guide-sim-actions-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.guide-sim-action-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.guide-sim-action-chip:hover {
  transform: translateY(-1px);
}

.guide-cmd-term-footer {
  padding: 12px 16px;
  background: #0f172a;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Dashboard Blueprint Hero Mockup */
.guide-battle-plan-blueprint {
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.4), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 12px;
  padding: 16px;
}

.blueprint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.blueprint-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: #f8fafc;
}

.blueprint-regime-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  letter-spacing: 0.04em;
}

.blueprint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.blueprint-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.blueprint-card-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.blueprint-pnum {
  font-size: 0.7rem;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 4px;
  background: #6366f1;
  color: #fff;
  flex-shrink: 0;
}

.blueprint-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.3;
}

.blueprint-card-desc {
  font-size: 0.74rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.4;
}

.blueprint-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
}

/* ActionChips Matrix */
.guide-action-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.guide-matrix-card {
  padding: 14px;
  background: rgba(15, 23, 42, 0.75);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guide-matrix-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.guide-matrix-icon {
  font-size: 1.5rem;
}

.guide-matrix-badge {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.guide-matrix-title {
  font-size: 0.88rem;
  font-weight: 700;
  margin: 2px 0 0;
  color: #f8fafc;
}

.guide-matrix-example {
  background: rgba(2, 6, 23, 0.6);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
}

.guide-example-label {
  color: #64748b;
  margin-right: 4px;
}

.guide-example-code {
  color: #38bdf8;
  font-family: monospace;
}

.guide-matrix-behavior {
  font-size: 0.76rem;
  color: #94a3b8;
  line-height: 1.4;
  margin: 0 0 8px;
}

.guide-payload-box {
  background: rgba(2, 6, 23, 0.4);
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  color: #a5b4fc;
  border: 1px dashed rgba(255, 255, 255, 0.1);
}

.guide-payload-box .payload-label {
  font-weight: 700;
  color: #64748b;
  margin-right: 4px;
}

/* Privacy Guarantee Card */
.guide-privacy-card {
  padding: 16px;
  background: rgba(6, 78, 59, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 12px;
}

.guide-privacy-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.guide-privacy-icon {
  font-size: 1.8rem;
}

.guide-privacy-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #10b981;
  margin: 0;
}

.guide-privacy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.guide-privacy-point {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
}

.privacy-point-badge {
  font-size: 0.74rem;
  font-weight: 700;
  color: #34d399;
  margin-bottom: 4px;
}

.privacy-point-desc {
  font-size: 0.74rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.4;
}

/* Responsive collapse for Pipeline */
@media (max-width: 767.98px) {
  .guide-pipeline-grid {
    flex-direction: column;
  }
  .arrow-desktop {
    display: none;
  }
  .arrow-mobile {
    display: inline-block;
  }
  .guide-pipeline-arrow {
    padding: 6px 0;
  }
}

/* Live Tool Execution Pills */
.guide-tools-banner {
  background: rgba(15, 23, 42, 0.65);
  border-radius: 8px;
  padding: 12px;
}

.guide-tool-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 9999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  transition: all 0.15s ease;
}

.guide-tool-live-pill.pill-mutating {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

/* Tool Registry Grid */
.guide-tools-subgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.guide-tool-card {
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.guide-tool-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
}

.guide-tool-card.mutating-card {
  background: rgba(30, 41, 59, 0.6);
  border-left: 3px solid #f59e0b;
}

.guide-tool-icon {
  font-size: 1.1rem;
}

/* Hybrid Safety Tiers Grid */
.guide-safety-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.guide-safety-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Proactive Multi-Step Agent Workflows Grid */
.guide-workflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.guide-workflow-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-top: 3px solid #38bdf8;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.guide-workflow-card:hover {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

/* Try-It Example Prompts Grid */
.guide-prompts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.guide-prompt-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.guide-prompt-card:hover {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.guide-prompt-text {
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 3px solid #38bdf8;
  word-break: break-word;
}

.guide-prompt-run-btn,
.guide-prompt-copy-btn {
  min-height: 44px;
  touch-action: manipulation;
}

/* Automation Grid */
.guide-automation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.guide-auto-card {
  padding: 12px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.guide-auto-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

/* Sandbox Sliders */
.guide-sandbox {
  padding: 16px;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.06), transparent);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg, 12px);
}

.guide-sandbox-sliders label {
  display: grid;
  grid-template-columns: 100px 1fr 90px;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.82rem;
}

.guide-sandbox-sliders input[type="range"] {
  height: 6px;
  border-radius: 3px;
  background: #334155;
  outline: none;
  min-height: 24px;
}

.guide-sandbox-out {
  margin-top: 12px;
  padding: 14px;
  background: var(--bg-card, #1a1e2e);
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

.guide-math-steps {
  margin: 0;
  padding-left: 18px;
  font-size: 0.86rem;
  line-height: 1.6;
}

.guide-math-steps li {
  margin-bottom: 4px;
}

.guide-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.guide-dim {
  opacity: 0.35;
}

.guide-hit {
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.35);
  border-radius: 8px;
}

/* ==========================================================================
   MOBILE RESPONSIVENESS (iPhone 15: 393px viewport)
   ========================================================================== */

@media (max-width: 768px) {
  .guide-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
  }

  .guide-hero h1 {
    font-size: 1.35rem;
  }

  .guide-hero-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .guide-two-col,
  .guide-diagram-notes,
  .guide-gtt-boxes-grid {
    grid-template-columns: 1fr;
  }

  .guide-sim-kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .guide-sandbox-sliders label {
    grid-template-columns: 85px 1fr 75px;
    gap: 8px;
    font-size: 0.78rem;
  }
}

@media (max-width: 420px) {
  .guide-hero {
    padding: 14px;
  }

  .guide-hero h1 {
    font-size: 1.25rem;
  }

  .guide-toolbar {
    padding: 12px 14px;
  }

  .guide-tab-pill {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 0.8rem;
  }

  .guide-sim-algo-btn {
    min-height: 44px;
    padding: 8px 12px;
    font-size: 0.75rem;
  }

  .guide-sim-kpi-grid {
    grid-template-columns: 1fr;
  }

  .guide-sandbox-sliders label {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}


.guide-hit {
  opacity: 1;
}

/* Guide Collapsible Feature Cards (Living Reference Architecture) */
details.guide-collapsible-card {
  background: var(--bg-card, #1a1e2e);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg, 12px);
  margin-bottom: 14px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

details.guide-collapsible-card:hover {
  border-color: rgba(59, 130, 246, 0.35);
}

details.guide-collapsible-card[open] {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

summary.guide-collapsible-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  user-select: none;
  min-height: 48px;
  background: rgba(255, 255, 255, 0.015);
  transition: background 0.15s;
}

summary.guide-collapsible-summary::-webkit-details-marker {
  display: none;
}

summary.guide-collapsible-summary:hover {
  background: rgba(59, 130, 246, 0.06);
}

.guide-summary-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 220px;
}

.guide-summary-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.guide-summary-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
}

.guide-summary-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary, #94a3b8);
  margin: 2px 0 0 0;
}

.guide-summary-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.guide-chevron {
  font-size: 0.85rem;
  color: var(--text-secondary, #94a3b8);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

details[open] .guide-chevron {
  transform: rotate(180deg);
}

.guide-collapsible-body {
  padding: 16px 18px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(15, 23, 42, 0.35);
}

.guide-feature-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.guide-feature-box {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md, 8px);
  padding: 12px 14px;
  font-size: 0.84rem;
  line-height: 1.5;
}

.guide-feature-box h4 {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #38bdf8;
  margin: 0 0 6px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.guide-formula-tag {
  display: inline-block;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono, monospace);
  font-size: 0.76rem;
  color: #38bdf8;
  margin: 2px 0;
}

.guide-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

/* ----- Pages ----- */
.page {
  display: none;
  animation: fadeIn 0.25s ease;
}

.page.active {
  display: block;
}

/* ----- Summary Cards ----- */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  background-image: linear-gradient(135deg, transparent 0%, rgba(59,130,246,0.02) 100%);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}

.summary-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), #6366f1);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.summary-card:hover::after {
  opacity: 1;
}

.summary-card .card-icon {
  font-size: 1.5rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--bg-hover);
}

.summary-card .card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  font-family: var(--font-mono);
}

.summary-card .card-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

/* ----- Card ----- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  background-image: linear-gradient(180deg, transparent 0%, rgba(59,130,246,0.015) 100%);
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h2,
.card-header h3 {
  margin-bottom: 0;
}

/* ----- Data Table ----- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  white-space: nowrap;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

.data-table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border-color);
  user-select: none;
  cursor: pointer;
  transition: color 0.15s ease;
  position: relative;
}

.data-table th:hover {
  color: var(--text-primary);
}

.data-table th.sortable::after {
  content: '⇅';
  margin-left: 6px;
  font-size: 0.7rem;
  opacity: 0.4;
  transition: opacity 0.15s ease;
}

.data-table th.sort-asc::after {
  content: '↑';
  opacity: 1;
  color: var(--accent-text);
}

.data-table th.sort-desc::after {
  content: '↓';
  opacity: 1;
  color: var(--accent-text);
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  transition: background 0.1s ease;
}

.data-table tbody tr {
  transition: background 0.1s ease;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.015);
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

.data-table .mono {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* ----- Forms ----- */
.stock-form,
.alert-form,
.scanner-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 16px;
}

.input,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="date"],
.select,
select,
.textarea,
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
  width: 100%;
}

.input:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
.select:focus,
select:focus,
.textarea:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.input::placeholder,
input::placeholder,
.textarea::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

.textarea,
textarea {
  resize: vertical;
  min-height: 80px;
}

.select,
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%238b8fa3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  user-select: none;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: #2563eb; /* white text 5.2:1 (WCAG AA) */
  color: #fff;
  border-color: #2563eb;
}

.btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  box-shadow: 0 2px 8px rgba(59,130,246,0.35);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-input);
  border-color: var(--text-muted);
}

.btn-danger {
  background: #dc2626; /* white text 4.8:1 (WCAG AA) */
  color: #fff;
  border-color: #dc2626;
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  box-shadow: 0 2px 8px rgba(239,68,68,0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ----- Badges ----- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-positive {
  background: var(--positive-bg);
  color: var(--positive);
}

.badge-negative {
  background: var(--negative-bg);
  color: var(--negative-text);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-neutral {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.badge-guest {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.stale-badge {
  background: var(--warning-bg);
  color: var(--warning-text);
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stale-badge::before {
  content: '⚠';
  font-size: 0.7rem;
}

/* ----- Tabs ----- */
.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-item {
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font-family);
}

.tab-item:hover {
  color: var(--text-primary);
}

.tab-item.active {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
}

/* ----- Filter Bar ----- */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  margin-bottom: 16px;
}

.filter-bar .filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 4px;
}

.filter-btn {
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-family);
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.filter-btn.active {
  background: rgba(59,130,246,0.15);
  border-color: var(--accent);
  color: var(--accent-text);
}

/* ----- Search ----- */
.search-container {
  position: relative;
  width: 280px;
}

.search-container .search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 7px 12px 7px 34px;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, width 0.3s ease;
  font-family: var(--font-family);
}

.search-container .search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.search-container .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  max-height: 320px;
  overflow-y: auto;
  z-index: 200;
  animation: fadeIn 0.15s ease;
}

.search-results .search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.1s ease;
  border-bottom: 1px solid var(--border-color);
}

.search-results .search-result-item:last-child {
  border-bottom: none;
}

.search-results .search-result-item:hover {
  background: var(--bg-hover);
}

.search-results .search-result-item .symbol {
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.search-results .search-result-item .name {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.search-results .no-results {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ----- Global Search Modal Palette Portal ----- */
.global-search-portal {
  position: fixed;
  inset: 0;
  z-index: 99990;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 16px 20px;
  pointer-events: auto;
}

.global-search-portal.hidden {
  display: none !important;
}

.global-search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 99991;
}

.global-search-dialog {
  position: relative;
  z-index: 99992;
  width: 100%;
  max-width: 640px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100vh - 120px);
  animation: fadeIn 0.15s ease-out;
}

.global-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 23, 42, 0.9);
}

.global-search-palette-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--text-primary, #f8fafc);
  font-family: inherit;
}

.global-search-palette-input::placeholder {
  color: var(--text-muted, #94a3b8);
  font-size: 0.9rem;
}

.global-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
  margin-bottom: 4px;
  border: 1px solid transparent;
}

.global-search-item:hover,
.global-search-item.selected {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.3);
}

.global-search-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

@media (max-width: 767px) {
  .global-search-portal {
    padding: 0;
    align-items: flex-end;
  }

  .global-search-dialog {
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  }
}

@media (max-width: 520px) {
  .global-search-item {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
  }

  .global-search-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 4px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .global-search-actions button {
    flex: 1 1 auto;
    min-height: 44px;
    font-size: 0.75rem;
  }
}

/* ----- Alert Items ----- */
.alert-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: all 0.2s ease;
}

.alert-item:hover {
  background: var(--bg-hover);
}

.alert-item .alert-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.alert-item .alert-symbol {
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-primary);
}

.alert-item .alert-condition {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.alert-item .alert-actions {
  display: flex;
  gap: 6px;
}

.alert-triggered {
  border-color: var(--warning);
  animation: alertPulse 2s ease-in-out infinite;
}

@keyframes alertPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.2); }
  50% { box-shadow: 0 0 0 6px rgba(245,158,11,0); }
}

/* ----- Chart Container ----- */
.chart-container {
  position: relative;
  width: 100%;
  min-height: 300px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.chart-container canvas {
  width: 100% !important;
  height: auto !important;
}

/* ----- Modal ----- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
  padding: 16px;
}

.modal-overlay.hidden,
.modal-overlay[style*="display: none"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  max-height: 85dvh;
  overflow-y: auto;
  animation: slideIn 0.25s ease;
}

.modal-content.modal-md {
  max-width: 480px;
}

.quick-alert-card {
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7), 0 0 24px rgba(56, 189, 248, 0.15);
}

.quick-alert-existing {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.qa-preset {
  min-height: 28px;
  padding: 3px 8px;
  font-size: 0.72rem;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
}

.qa-preset:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #38bdf8;
}

.qa-preset.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
}

.modal-content.modal-lg {
  max-width: 640px;
}

.modal-content.modal-xl {
  max-width: 820px;
}

/* ----- 52-Week Radar Centered Modal Overlay & Card ----- */
#scanner-radar-modal.modal-overlay:not(.hidden),
.radar-modal-overlay:not(.hidden) {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  z-index: 99999 !important;
  background: rgba(0, 0, 0, 0.75) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
  padding: 16px;
  box-sizing: border-box !important;
  overflow-y: auto !important;
}

#scanner-radar-modal.hidden,
#scanner-radar-modal.modal-overlay.hidden,
.radar-modal-overlay.hidden,
#scanner-radar-modal[style*="display: none"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

#scanner-radar-modal .radar-modal-card,
.radar-modal-overlay .radar-modal-card {
  margin: auto;
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  padding: 20px;
  box-sizing: border-box;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  position: relative;
}

.groww-import-steps {
  margin-bottom: 16px;
  padding: 12px 14px;
}

.groww-import-steps ol {
  margin: 8px 0 0 18px;
  padding: 0;
}

.import-preview-wrap {
  margin-top: 12px;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.import-preview-table {
  font-size: 0.85rem;
}

.import-preview-table th,
.import-preview-table td {
  padding: 8px 10px;
}

.filter-bar .groww-import-btn {
  margin-left: auto;
  flex-shrink: 0;
}

.yahoo-cmp-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px 14px;
}

.yahoo-cmp-main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.yahoo-cmp-value {
  font-size: 1.15rem;
  font-weight: 700;
}

.yahoo-cmp-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.risk-output.hidden {
  display: none;
}

.risk-hero-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 8px 0;
  color: var(--accent-text);
}

.risk-mini-table td {
  padding: 6px 10px;
  font-size: 0.88rem;
}

.risk-warnings {
  margin-bottom: 16px;
  border-left: 4px solid var(--warning);
  padding: 12px 16px;
}

.risk-warnings ul {
  margin: 8px 0 0 18px;
  padding: 0;
  font-size: 0.9rem;
}

/* ----- Swing Trade Calculator (stc) ----- */
.stc-page {
  max-width: 1100px;
  margin: 0 auto;
  padding-bottom: 24px;
}

.stc-header {
  margin-bottom: 20px;
}

.stc-header h2 {
  margin-bottom: 4px;
}

.stc-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 900px) {
  .stc-layout {
    grid-template-columns: minmax(280px, 360px) 1fr;
    align-items: start;
  }
}

.stc-section-title {
  font-size: 1rem;
  margin-bottom: 14px;
}

.stc-dir-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.stc-dir-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.stc-dir-btn.active {
  background: #2563eb;
  color: #fff;
}

.stc-dir-btn:first-child.active {
  background: #15803d;
}

.stc-dir-btn:last-child.active {
  background: #dc2626;
}

.stc-risk-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stc-risk-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.stc-risk-num {
  width: 72px;
}

.stc-risk-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 193, 7, 0.25);
  color: var(--warning-text);
}

.stc-risk-badge.hidden {
  display: none;
}

.stc-round-check {
  margin-top: 12px;
  font-size: 0.85rem;
}

.stc-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .stc-cards-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.stc-card {
  padding: 16px 18px;
}

.stc-card h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.stc-hero {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 4px 0 8px;
  color: var(--accent-text);
}

.stc-card-primary .stc-hero {
  color: var(--negative-text);
}

.stc-dl {
  margin: 0;
}

.stc-dl div {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.88rem;
}

.stc-dl div:last-child {
  border-bottom: none;
}

.stc-dl dt {
  color: var(--text-secondary);
}

.stc-dl dd {
  margin: 0;
  font-weight: 600;
}

.stc-warn-list {
  margin: 12px 0 0;
  padding-left: 18px;
  font-size: 0.82rem;
  color: var(--warning-text);
}

.stc-ladder-wrap {
  padding: 48px 8px 16px;
  overflow-x: auto;
}

.stc-ladder-track {
  position: relative;
  height: 4px;
  background: linear-gradient(90deg, var(--negative), var(--text-muted), var(--positive));
  border-radius: 2px;
  min-width: 280px;
}

.stc-ladder-marker {
  position: absolute;
  top: -44px;
  transform: translateX(-50%);
  text-align: center;
  min-width: 56px;
}

.stc-ladder-dot {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin: 0 auto 4px;
  background: var(--text-primary);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 1px var(--border-color);
}

.ladder-stop .stc-ladder-dot { background: var(--negative); }
.ladder-entry .stc-ladder-dot { background: var(--accent); }
.ladder-be .stc-ladder-dot { background: var(--warning); }
.ladder-target .stc-ladder-dot { background: var(--positive); }
.ladder-stretch .stc-ladder-dot { background: #3dd68c; }

.stc-ladder-lbl {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.stc-ladder-price {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
}

.stc-checklist {
  margin: 0;
  padding-left: 20px;
  font-size: 0.9rem;
  line-height: 1.7;
}

.stc-copy-toast {
  margin-left: 12px;
  font-size: 0.85rem;
  color: var(--positive);
}

.stc-copy-toast.hidden {
  display: none;
}

.stc-disclaimer {
  margin-top: 16px;
  text-align: center;
}

.stc-alert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  margin-top: 12px;
  margin-bottom: 8px;
}

.stc-single-alert-drop {
  position: relative;
}

.stc-single-alert-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 4px;
}

.stc-single-alert-menu.hidden {
  display: none;
}

.stc-single-alert-menu button {
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.82rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.stc-single-alert-menu button:hover {
  background: var(--bg-hover);
}

.toast-action-link {
  margin-top: 8px;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent-text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.stc-placeholder {
  padding: 32px 16px;
  text-align: center;
}

.stc-card-warn {
  border-left: 4px solid var(--warning);
}

/* ----- Swing Scanner v2 ----- */
.scanner-v2 .scanner-header {
  flex-wrap: wrap;
  gap: 12px;
}

.scanner-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.scanner-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 12px;
}

.scanner-preset-pill {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.scanner-preset-pill:hover,
.scanner-preset-pill.active {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-text);
}

.scanner-scope-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  width: fit-content;
  max-width: 100%;
}

.scanner-scope-btn {
  padding: 8px 14px;
  border: none;
  border-right: 1px solid var(--border-color);
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.scanner-scope-btn:last-child {
  border-right: none;
}

.scanner-scope-btn.active {
  background: #2563eb;
  color: #fff;
}

.scanner-filter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  grid-column: 1 / -1;
  margin-bottom: 4px;
}

.scanner-reset-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
}

.scanner-filter-grid {
  display: block;
}

.scanner-filter-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  .scanner-filter-cols {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  .scanner-filter-cols {
    grid-template-columns: repeat(4, 1fr);
  }
}

.scanner-rsi-pair {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scanner-rsi-pair .input {
  width: 72px;
  padding: 6px 8px;
}

.scanner-vol-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.scanner-vol-select,
.scanner-pct-input {
  width: 72px;
  padding: 4px 6px;
  font-size: 0.85rem;
}

.scanner-results-head {
  flex-wrap: wrap;
  gap: 12px;
}

.scanner-search-input {
  max-width: 220px;
  min-width: 140px;
}

.scanner-table {
  font-size: 0.78rem;
}

.scanner-table th {
  cursor: pointer;
  white-space: nowrap;
}

.scanner-table-wrap {
  overflow-x: auto;
}

.scanner-row {
  cursor: pointer;
}

.scanner-row:hover td {
  background: var(--bg-hover);
}

.scanner-exch-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  background: var(--bg-hover);
  color: var(--text-muted);
  vertical-align: middle;
}

.scanner-ma-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.scanner-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 140px;
}

.scanner-signal-tag {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
}

/* Enhanced Scanner Signal Micro-Badges */
.badge-signal-rs {
  background: rgba(16, 185, 129, 0.18) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  color: #34d399 !important;
  font-weight: 600;
}

.badge-signal-vcp {
  background: rgba(245, 158, 11, 0.18) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: #fbbf24 !important;
  font-weight: 600;
}

.badge-signal-delivery {
  background: rgba(59, 130, 246, 0.18) !important;
  border-color: rgba(59, 130, 246, 0.4) !important;
  color: #60a5fa !important;
  font-weight: 600;
}

.badge-signal-weekly {
  background: rgba(20, 184, 166, 0.18) !important;
  border-color: rgba(20, 184, 166, 0.4) !important;
  color: #2dd4bf !important;
  font-weight: 600;
}

.badge-signal-res-warn {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #f87171 !important;
  font-weight: 600;
}

.badge-signal-failed {
  background: rgba(245, 158, 11, 0.16) !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
  color: #fbbf24 !important;
  font-weight: 600;
}

.scanner-near-miss-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md, 8px);
  padding: 10px 16px;
  margin: 0 16px 14px;
  color: #fbbf24;
  font-size: 0.85rem;
}

.scanner-near-miss-strip .near-miss-message {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scanner-near-miss-strip .near-miss-icon {
  font-size: 1.1rem;
}

.scanner-near-miss-strip .btn {
  white-space: nowrap;
  font-size: 0.75rem;
  padding: 4px 10px;
  min-height: 32px;
}

@media (max-width: 640px) {
  .scanner-near-miss-strip {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin: 0 12px 12px;
    padding: 10px 12px;
  }
  .scanner-near-miss-strip .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Sector Momentum Strip */
.scanner-sector-strip-wrap {
  margin: 14px 0 16px;
  padding: 12px 14px;
  background: rgba(26, 29, 39, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.scanner-sector-strip-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.scanner-sector-strip-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sector-strip-fire {
  font-size: 1.1rem;
}

.scanner-timeframe-toggle {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

.scanner-tf-btn {
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  border: none;
  background: var(--bg-hover);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.scanner-tf-btn.active {
  background: #2563eb;
  color: #fff;
}

.scanner-sector-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.sector-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.76rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}

.sector-pill:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.sector-pill.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--accent);
  color: #93c5fd;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.25);
}

.sector-pill.top-sector {
  border-color: rgba(245, 158, 11, 0.45);
}

.sector-badge-top {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  font-size: 0.65rem;
  font-weight: 700;
}

/* Slide-Over Quality Breakdown Checklist */
.scanner-quality-breakdown {
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

.quality-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.quality-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quality-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
}

.quality-item.pass {
  border-left: 3px solid #10b981;
}

.quality-item.fail {
  border-left: 3px solid #6b7280;
  opacity: 0.82;
}

.quality-icon {
  font-size: 1rem;
  line-height: 1;
}

.quality-info {
  flex: 1;
  min-width: 0;
}

.quality-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.quality-sub {
  font-size: 0.7rem;
  color: var(--text-secondary);
  line-height: 1.3;
  margin-top: 2px;
}

.quality-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.quality-badge.badge-pass {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.quality-badge.badge-fail {
  background: rgba(107, 114, 128, 0.2);
  color: #9ca3af;
}

.pl-5 {
  padding-left: 1.25rem;
}

.block {
  display: block;
}

.scanner-score-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 88px;
}

.scanner-score-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
}

.scanner-score-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}

.scanner-score-pct {
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 32px;
}

.scanner-watch-alert-btn {
  min-height: 44px;
  white-space: nowrap;
}

.scanner-watch-alert-btn.is-watching {
  border-color: rgba(34, 197, 94, 0.45);
  color: #4ade80;
  background: rgba(34, 197, 94, 0.1);
}

.scanner-watch-alert-btn:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.scanner-watch-alert-btn--compact {
  font-size: 0.78rem;
  padding-left: 8px;
  padding-right: 8px;
}

.scanner-actions {
  white-space: nowrap;
}

.scanner-loading {
  padding: 24px;
  text-align: center;
}

.inline-spin {
  display: inline-block;
  vertical-align: middle;
}

.scanner-disclaimer {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.scanner-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1100;
}

.scanner-drawer-backdrop.hidden {
  display: none;
}

.scanner-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(380px, 94vw);
  height: 100vh;
  height: 100dvh;
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
  z-index: 1101;
  overflow-y: auto;
  animation: slideInRight 0.25s ease;
}

.scanner-drawer.hidden {
  display: none;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.scanner-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-color);
}

.scanner-drawer-body {
  padding: 18px;
}

.scanner-spark {
  width: 100%;
  height: 72px;
  display: block;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
}

.w-full {
  width: 100%;
}

/* ----- Alerts v2 ----- */
.alerts-v2 .alert-triggered-header {
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.alert-notif-toggle {
  font-size: 0.82rem;
  white-space: nowrap;
}

.alert-triggered-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
}

.alert-trigger-sl {
  border-left: 4px solid var(--negative);
}

.alert-trigger-profit {
  border-left: 4px solid var(--positive);
}

.alert-triggered-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.alert-triggered-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.alert-config-header {
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.alert-mode-toggle {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.alert-mode-btn {
  padding: 8px 14px;
  border: none;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.alert-mode-btn.active {
  background: var(--accent);
  color: #fff;
}

.alert-category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
}

.alert-cat-pill {
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.alert-cat-pill.alert-cat-sl.active { border-color: var(--negative); background: rgba(239, 68, 68, 0.15); color: #f87171; }
.alert-cat-pill.alert-cat-profit.active { border-color: var(--positive); background: rgba(34, 197, 94, 0.12); color: #4ade80; }
.alert-cat-pill.alert-cat-breakout.active { border-color: var(--accent); background: rgba(59, 130, 246, 0.15); color: var(--accent-text); }
.alert-cat-pill.alert-cat-tech.active { border-color: #a78bfa; background: rgba(167, 139, 250, 0.12); color: #c4b5fd; }

.alert-form-grid {
  padding: 0 16px 16px;
}

.alert-form-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 768px) {
  .alert-form-cols {
    grid-template-columns: 1fr 1fr;
  }
  .alert-form-cols .span-2 {
    grid-column: span 2;
  }
}

.alert-ltp-badge {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--accent-text);
  font-weight: 600;
}

.alert-threshold-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.alert-distance-badge {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

.alert-distance-badge.hidden {
  display: none;
}

.alert-action-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.alert-action-chip {
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  font-size: 0.72rem;
  cursor: pointer;
  color: var(--text-secondary);
}

.alert-action-chip:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.alert-form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.alert-table-header {
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

.alert-table-search {
  max-width: 200px;
}

.alert-table-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
}

.alert-filter-pill {
  padding: 4px 12px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  font-size: 0.75rem;
  cursor: pointer;
}

.alert-filter-pill.active {
  border-color: var(--accent);
  color: var(--accent-text);
}

.alert-cat-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.alert-cat-dot.alert-cat-sl { background: var(--negative); }
.alert-cat-dot.alert-cat-profit { background: var(--positive); }
.alert-cat-dot.alert-cat-breakout { background: var(--accent); }
.alert-cat-dot.alert-cat-tech { background: #a78bfa; }

.alert-dist-badge {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.alert-dist-badge.near {
  color: var(--warning-text);
  font-weight: 700;
}

.alert-config-table {
  font-size: 0.8rem;
}

.alert-status-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  cursor: pointer;
}

.alert-row-actions {
  white-space: nowrap;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideIn 0.25s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  margin-bottom: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s ease;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ----- Toast Notifications ----- */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  min-width: 280px;
}

.toast.toast-exiting {
  animation: slideOutRight 0.25s ease forwards;
}

.toast-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toast-message {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  font-size: 0.9rem;
  transition: color 0.15s ease;
}

.toast-close:hover {
  color: var(--text-primary);
}

.toast.toast-success {
  border-left: 3px solid var(--positive);
}

.toast.toast-error {
  border-left: 3px solid var(--negative);
}

.toast.toast-warning {
  border-left: 3px solid var(--warning);
}

.toast.toast-info {
  border-left: 3px solid var(--accent);
}

/* ----- Loading Spinner ----- */
.loading-spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loading-spinner.sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.loading-spinner.lg {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  flex-direction: column;
  gap: 12px;
}

.loading-overlay .loading-text {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ----- Empty State ----- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state .empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state .empty-description {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 360px;
  line-height: 1.6;
}

.empty-state .btn {
  margin-top: 16px;
}

/* ----- Settings Section ----- */
.settings-page-container {
  width: 100%;
  max-width: min(1120px, 100%);
  margin: 0 auto;
}

.settings-section {
  margin-bottom: 32px;
}

.settings-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(42,45,58,0.5);
}

.settings-row .settings-label {
  font-size: 0.9rem;
  color: var(--text-primary);
}

.settings-row .settings-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ----- Scanner Form ----- */
.scanner-form .criteria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* ----- Positive / Negative Utilities ----- */
.positive {
  color: var(--positive) !important;
}

.negative {
  color: var(--negative-text) !important;
}

.warning-text {
  color: var(--warning-text) !important;
}

/* ----- Animations ----- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ----- Mobile Overlay ----- */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  animation: fadeIn 0.2s ease;
}

.mobile-overlay.active {
  display: block;
}

/* ----- Flex Utilities ----- */
.flex {
  display: flex;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.gap-4 { gap: 32px; }

/* ----- Spacing Utilities ----- */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.ml-1 { margin-left: 8px; }
.ml-2 { margin-left: 16px; }
.mr-1 { margin-right: 8px; }
.mr-2 { margin-right: 16px; }

.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }

/* ----- Typography Utilities ----- */
.text-sm {
  font-size: 0.78rem;
}

.text-lg {
  font-size: 1.125rem;
}

.text-mono {
  font-family: var(--font-mono);
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----- Toggle Switch ----- */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 22px;
  transition: all 0.25s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.25s ease;
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: #fff;
}

/* ----- Divider ----- */
.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 16px 0;
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "header"
      "main";
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }

  .header {
    margin-left: 0;
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .hamburger {
    display: flex;
  }

  .summary-cards {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }

  .summary-card {
    padding: 14px;
  }

  .summary-card .card-value {
    font-size: 1.2rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .search-container {
    width: 100%;
  }

  .data-table {
    font-size: 0.78rem;
  }

  .data-table th,
  .data-table td {
    padding: 8px 10px;
  }

  .modal {
    max-width: 100%;
    margin: 8px;
  }

  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
  }

  .tabs {
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    max-width: 100%;
  }

  .header-right .last-updated {
    display: none;
  }
}

@media (max-width: 480px) {
  .summary-cards {
    grid-template-columns: 1fr 1fr;
  }

  .header {
    padding: 0 12px;
  }

  .main-content {
    padding: 12px;
  }

  .card {
    padding: 14px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ----- Print Styles ----- */
@media print {
  body {
    background: #fff;
    color: #000;
  }

  .sidebar,
  .hamburger,
  .mobile-overlay,
  .toast-container,
  .modal-overlay,
  .btn,
  .header-right,
  .filter-bar,
  .tabs {
    display: none !important;
  }

  .header {
    position: static;
    margin-left: 0;
    border-bottom: 2px solid #000;
    background: #fff;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .main-content {
    margin-left: 0;
    padding: 0;
  }

  .app-layout {
    display: block;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .summary-cards {
    grid-template-columns: repeat(4, 1fr);
  }

  .data-table th,
  .data-table td {
    border: 1px solid #ccc;
    color: #000;
  }

  .data-table th {
    background: #f0f0f0 !important;
  }

  .positive { color: #16a34a !important; }
  .negative { color: #dc2626 !important; }

  a { color: #000; text-decoration: underline; }
}

/* ============================================================
   Privacy Mode & Sensitive Values
   ============================================================ */

/* Navbar Privacy Mode Button */
.privacy-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.privacy-toggle-pill.privacy-active {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #f59e0b !important;
  border: 1px solid rgba(245, 158, 11, 0.7) !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25), inset 0 0 4px rgba(245, 158, 11, 0.1);
}

.privacy-toggle-pill.privacy-active:hover {
  background: rgba(245, 158, 11, 0.25) !important;
  border-color: #f59e0b !important;
}

/* Sensitive Value Component & Masking */
sensitive-value,
.sensitive-value {
  display: inline-flex;
  align-items: center;
  position: relative;
  vertical-align: baseline;
  transition: filter 0.2s ease, opacity 0.2s ease;
}

.sensitive-raw {
  display: inline;
}

.sensitive-mask {
  display: none;
  font-family: var(--font-mono);
  letter-spacing: 0.15em;
  font-weight: 700;
  user-select: none;
  color: inherit;
  opacity: 0.88;
}

/* When Privacy Mode is Active (data-privacy="true") */
html[data-privacy="true"] .sensitive-value .sensitive-mask,
html[data-privacy="true"] sensitive-value .sensitive-mask {
  display: inline;
  color: inherit;
  opacity: 0.88;
}

html[data-privacy="true"] .sensitive-value .sensitive-raw,
html[data-privacy="true"] sensitive-value .sensitive-raw {
  display: none !important;
}

/* Frosted Blur Mode */
html[data-privacy="true"][data-privacy-mask="blur"] .sensitive-value .sensitive-mask,
html[data-privacy="true"][data-privacy-mask="blur"] sensitive-value .sensitive-mask {
  display: none !important;
}

html[data-privacy="true"][data-privacy-mask="blur"] .sensitive-value .sensitive-raw,
html[data-privacy="true"][data-privacy-mask="blur"] sensitive-value .sensitive-raw {
  display: inline !important;
  filter: blur(6px) !important;
  user-select: none !important;
  pointer-events: none !important;
  opacity: 0.65;
}

/* Sensitive Input Wrapping (e.g. Account Capital in SL Calculator) */
.sensitive-input-wrap {
  position: relative;
  display: block;
}

.sensitive-input-mask {
  display: none;
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  pointer-events: none;
  user-select: none;
}

html[data-privacy="true"] .sensitive-input-wrap .sensitive-input-mask {
  display: block;
}

html[data-privacy="true"] .sensitive-input-wrap .sensitive-input {
  color: transparent !important;
  text-shadow: none !important;
}

html[data-privacy="true"][data-privacy-mask="blur"] .sensitive-input-wrap .sensitive-input-mask {
  display: none;
}

html[data-privacy="true"][data-privacy-mask="blur"] .sensitive-input-wrap .sensitive-input {
  color: inherit !important;
  filter: blur(5px) !important;
  user-select: none !important;
  pointer-events: none !important;
}

/* Privacy Modals & Card Styling */
.privacy-modal-card {
  max-width: 440px !important;
}

.privacy-modal-icon {
  font-size: 1.4rem;
}

.privacy-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.privacy-input-wrap input {
  padding-right: 42px !important;
}

.btn-icon-toggle {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  color: var(--text-secondary);
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.btn-icon-toggle:hover {
  opacity: 1;
}

.privacy-error-box {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--negative-text);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.privacy-duration-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-hover);
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-primary);
}

.radio-label input[type="radio"] {
  accent-color: var(--accent);
}

/* Shake Animation on Wrong Password */
@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  15%, 45%, 75% { transform: translateX(-8px); }
  30%, 60%, 90% { transform: translateX(8px); }
}

.modal-shake {
  animation: shakeError 0.4s ease-in-out;
}

/* Backtester Screen Styles */
.backtester-page {
  padding-bottom: 24px;
}

.backtester-header {
  padding: 16px 20px;
}

.backtester-config-card {
  padding: 18px 20px;
}

.backtester-config-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 14px;
}

@media (min-width: 768px) {
  .backtester-config-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  .backtester-config-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.bt-config-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bt-config-col h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

.bt-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.bt-friction-row {
  background: rgba(26, 29, 39, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.78rem;
}

.backtester-run-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  margin-top: 16px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.bt-run-btn {
  min-width: 160px;
  font-weight: 700;
}

.bt-preset-pill {
  transition: all 0.2s ease;
  border: 1px solid var(--border-color);
  font-weight: 600;
}

.bt-preset-pill.active {
  background: linear-gradient(135deg, #4f46e5 0%, #0284c7 100%) !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.45);
}

/* 2-Column Split Charts Grid */
.backtester-charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@media (min-width: 1024px) {
  .backtester-charts-grid {
    grid-template-columns: 65% calc(35% - 16px);
  }
}

.equity-chart-card,
.r-dist-card {
  display: flex;
  flex-direction: column;
  min-height: 380px;
}

.equity-chart-header,
.r-dist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 8px;
}

.equity-chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.76rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-dot.strategy {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.legend-dot.benchmark {
  background: #60a5fa;
}

.equity-chart-body {
  position: relative;
  flex: 1;
  padding: 14px 18px;
  min-height: 280px;
}

.equity-chart-svg {
  width: 100%;
  height: 100%;
  min-height: 260px;
}

.equity-tooltip {
  position: absolute;
  top: 18px;
  right: 22px;
  background: rgba(15, 17, 23, 0.92);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.74rem;
  pointer-events: none;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* R-Multiple Distribution Chart */
.r-dist-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  flex: 1;
  justify-content: space-around;
}

.r-dist-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.r-dist-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
}

.r-dist-bucket-label {
  font-weight: 600;
  color: var(--text-primary);
}

.r-dist-stats {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.r-dist-track {
  width: 100%;
  height: 10px;
  background: var(--bg-hover);
  border-radius: 5px;
  overflow: hidden;
}

.r-dist-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease;
}

/* Simulated Trade Log Table */
.trade-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 10px;
}

.trade-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.trade-filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.trade-filter-pill {
  padding: 4px 10px;
  font-size: 0.74rem;
  border-radius: 14px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.trade-filter-pill.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--accent);
  color: #93c5fd;
  font-weight: 600;
}

.btn-deploy-settings {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  font-weight: 700;
  padding: 6px 14px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
  transition: all 0.2s ease;
}

.btn-deploy-settings:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.5);
}

/* Trade Log Exit Reason Badges */
.badge-exit-target {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-exit-trail {
  background: rgba(20, 184, 166, 0.18);
  color: #2dd4bf;
  border: 1px solid rgba(20, 184, 166, 0.35);
}

.badge-exit-sl {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.badge-exit-gap {
  background: rgba(185, 28, 28, 0.25);
  color: #fca5a5;
  border: 1px solid rgba(185, 28, 28, 0.45);
}

.badge-exit-be {
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.badge-exit-time {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

/* ============================================================
   AI Trading Co-Pilot UI Components
   ============================================================ */

.ai-copilot-card {
  background: linear-gradient(135deg, rgba(26, 29, 45, 0.95), rgba(30, 27, 55, 0.92));
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-lg, 12px);
  padding: 16px 20px;
  margin-top: 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.08), 0 1px 3px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
}

.ai-copilot-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899, #6366f1);
  background-size: 200% auto;
  animation: aiGradientShift 4s linear infinite;
}

@keyframes aiGradientShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.ai-copilot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-cached-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #94a3b8;
  background: rgba(30, 41, 59, 0.55);
}

.ai-refresh-btn {
  min-height: 28px;
  font-size: 0.75rem;
}

.ai-telemetry-strip {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.ai-copilot-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.25));
  border: 1px solid rgba(139, 92, 246, 0.45);
  color: #c4b5fd;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 9999px;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.ai-copilot-badge i {
  color: #a78bfa;
}

.ai-card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #e2e8f0;
}

.ai-spinner {
  font-size: 0.8rem;
  color: #a5b4fc;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ai-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-lang-toggle-btn {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #94a3b8;
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.ai-lang-toggle-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.4);
}

.ai-headline {
  font-size: 1rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 10px;
  line-height: 1.4;
}

.ai-insights-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding-left: 0;
}

.ai-insights-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.85rem;
  color: #cbd5e1;
  line-height: 1.45;
}

.ai-insights-list li i {
  color: #818cf8;
  font-size: 0.75rem;
  margin-top: 4px;
  flex-shrink: 0;
}

.ai-risk-warning {
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid #ef4444;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.8rem;
  color: #fca5a5;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  line-height: 1.4;
}

.ai-risk-warning i {
  color: #ef4444;
  margin-top: 2px;
  flex-shrink: 0;
}

.ai-action-row {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.ai-action-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  color: #ffffff;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 6px 14px;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-action-btn:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.5);
}

/* AI Shimmer Loading State */
.ai-copilot-shimmer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0;
}

.shimmer-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.shimmer-line.line-1 { width: 65%; height: 18px; }
.shimmer-line.line-2 { width: 90%; }
.shimmer-line.line-3 { width: 75%; }

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Ask AI Filter Bar in Swing Scanner */
.ai-scanner-prompt-bar {
  background: linear-gradient(135deg, rgba(26, 29, 45, 0.8), rgba(20, 23, 38, 0.95));
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-lg, 12px);
  padding: 12px 16px;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.ai-scanner-prompt-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-scanner-prompt-input-wrapper {
  position: relative;
  flex: 1;
}

.ai-scanner-prompt-input-wrapper i.fa-sparkles {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #a78bfa;
  font-size: 0.9rem;
}

.ai-scanner-input {
  width: 100%;
  background: rgba(15, 17, 23, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 8px;
  padding: 9px 12px 9px 36px;
  color: #f1f5f9;
  font-size: 0.88rem;
  transition: all 0.2s ease;
}

.ai-scanner-input:focus {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.ai-scanner-btn-ask {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  color: #ffffff;
  font-weight: 600;
  font-size: 0.84rem;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.ai-scanner-btn-ask:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  transform: translateY(-1px);
}

.ai-scanner-quick-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.ai-scanner-chips-label {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.ai-quick-chip {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  font-size: 0.74rem;
  padding: 3px 9px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-quick-chip:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
  color: #e0e7ff;
}

/* AI Trade Thesis in Drawer */
.ai-thesis-wrapper {
  margin-top: 14px;
  border-top: 1px solid var(--border-color, #2a2d3a);
  padding-top: 14px;
}

.ai-btn-thesis {
  width: 100%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(139, 92, 246, 0.18));
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.ai-btn-thesis:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
  border-color: #a78bfa;
  color: #ffffff;
}

/* Pre-Trade Sanity Check in Risk Calculator */
.ai-sanity-btn {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
  font-weight: 600;
  font-size: 0.84rem;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s ease;
  margin-top: 10px;
}

.ai-sanity-btn:hover {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
}

/* AI Co-Pilot Multi-Provider Settings */
.ai-provider-segmented {
  display: flex;
  gap: 8px;
  background: var(--bg-card);
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  margin-bottom: 14px;
}

.ai-provider-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.ai-provider-tab-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.ai-provider-tab-btn.active {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(139, 92, 246, 0.5);
  color: #c4b5fd;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.ai-provider-tab-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.92rem;
}

.ai-test-ping-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.ai-test-status-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-test-status-text.success {
  color: #34d399;
}

.ai-test-status-text.error {
  color: #f87171;
}

.badge-connected {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: none;
}

.badge-missing {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: none;
}

/* ============================================================
   Trade Journal & Mistakes Analytics Styles
   ============================================================ */
.journal-page-container {
  padding-bottom: 30px;
}

.journal-header-row {
  flex-wrap: wrap;
  gap: 12px;
}

.journal-kpi-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 14px;
}

@media (min-width: 640px) {
  .journal-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .journal-kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.kpi-card .kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.kpi-card .kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1.2;
}

.kpi-card .kpi-subtext {
  font-size: 0.76rem;
  margin-top: 2px;
}

/* Mistake Breakdown Horizontal Bar Chart */
.journal-mistakes-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0;
}

.journal-mistake-row {
  display: grid;
  grid-template-columns: 230px 1fr 180px;
  align-items: center;
  gap: 16px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.journal-mistake-row:hover {
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(255, 255, 255, 0.08);
}

@media (max-width: 768px) {
  .journal-mistake-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.journal-mistake-label {
  display: flex;
  align-items: center;
  font-size: 0.86rem;
  white-space: nowrap;
}

.journal-mistake-bar-container {
  background: rgba(15, 23, 42, 0.8);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.journal-mistake-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f87171, #ef4444);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 4px;
}

.journal-mistake-metrics {
  font-family: var(--font-mono);
  font-size: 0.86rem;
}

/* Journal Filter Toolbar & Outcome Pills */
.journal-filter-toolbar {
  background: rgba(15, 23, 42, 0.4);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.journal-outcome-pills {
  display: inline-flex;
  gap: 4px;
  background: rgba(15, 23, 42, 0.6);
  padding: 2px 4px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.outcome-pill {
  border-radius: 16px;
  font-size: 0.72rem;
  padding: 3px 10px;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.outcome-pill:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.outcome-pill.active {
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Behavioral Mistake Tags & Badges */
.journal-tag-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.journal-tag-chip {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.journal-tag-chip:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.journal-tag-chip.active {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fca5a5;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.25);
}

.journal-tag-chip.positive-chip.active {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.6);
  color: #6ee7b7;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.25);
}

.journal-tag-badge {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  white-space: nowrap;
}

.journal-tag-badge.badge-positive {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.journal-tag-badge.badge-negative {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.journal-preview-bar {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.journal-table td {
  vertical-align: middle;
}

/* Modal Dialog & Backdrop for Trade Journal */
#journal-modal-backdrop,
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}

#journal-modal,
.modal-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
  width: calc(100% - 32px);
  max-width: 620px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  z-index: 1001;
  padding: 22px;
  animation: slideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#journal-modal-backdrop.hidden,
.modal-backdrop.hidden {
  display: none !important;
}

#journal-modal.hidden,
.modal-dialog.hidden {
  display: none !important;
}

/* ============================================================
   Market Regime Traffic Light & Dynamic Guardrail Styles
   ============================================================ */

/* Top Navbar Status Pill */
.market-regime-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  transition: all 0.2s ease;
  user-select: none;
}

.market-regime-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.market-regime-pill.regime-green {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
}

.market-regime-pill.regime-amber {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
}

.market-regime-pill.regime-red {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.market-regime-pill.regime-pill-loading {
  opacity: 0.6;
}

.regime-pill-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.regime-pill-sep {
  opacity: 0.4;
}

.regime-pill-vix {
  font-size: 0.74rem;
  font-family: var(--font-mono);
}

/* Market Regime Portal & Backdrop */
.market-regime-portal {
  position: fixed;
  inset: 0;
  z-index: 99990;
  pointer-events: auto;
}

.market-regime-portal.hidden {
  display: none !important;
}

.market-regime-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99991;
}

/* Navbar Popover Card */
.market-regime-popover {
  position: fixed;
  width: 360px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.85);
  padding: 16px;
  z-index: 99992;
  animation: slideIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 767px) {
  .market-regime-popover {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 85vh !important;
    border-radius: 20px 20px 0 0 !important;
    border-bottom: none !important;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 20px)) !important;
    transform: none !important;
  }
}

.market-regime-popover.hidden {
  display: none !important;
}

.regime-tag-badge {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.regime-tag-badge.tag-green {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.regime-tag-badge.tag-amber {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.regime-tag-badge.tag-red {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.regime-metric-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 8px 10px;
}

/* VIX Gauge Track */
.vix-gauge-track {
  height: 8px;
  border-radius: 999px;
  display: flex;
  background: #1e293b;
  overflow: visible;
  position: relative;
  margin-top: 4px;
}

.vix-gauge-segment {
  height: 100%;
}

.vix-gauge-segment.seg-green {
  width: 33.33%;
  background: #10b981;
  border-top-left-radius: 999px;
  border-bottom-left-radius: 999px;
}

.vix-gauge-segment.seg-amber {
  width: 33.33%;
  background: #f59e0b;
}

.vix-gauge-segment.seg-red {
  width: 33.34%;
  background: #ef4444;
  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;
}

.vix-gauge-needle {
  position: absolute;
  top: -3px;
  width: 4px;
  height: 14px;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.8), 0 0 4px #ffffff;
  transform: translateX(-50%);
  transition: left 0.4s ease;
}

/* Market Breadth Progress Bar */
.breadth-progress-track {
  height: 8px;
  background: #1e293b;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  margin-top: 4px;
}

.breadth-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.breadth-progress-fill.breadth-bullish {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.breadth-progress-fill.breadth-mixed {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.breadth-progress-fill.breadth-weak {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

/* Guidance Cards */
.regime-guidance-card {
  border-radius: 8px;
  border: 1px solid transparent;
}

.regime-guidance-card.guidance-green {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #a7f3d0;
}

.regime-guidance-card.guidance-amber {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fde68a;
}

.regime-guidance-card.guidance-red {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fecaca;
}

/* ============================================================
   Dashboard Market Regime Traffic Light Card Styles
   ============================================================ */
.dash-regime-card {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  transition: all 0.2s ease;
}

.dash-regime-card.regime-border-green {
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.08);
}

.dash-regime-card.regime-border-amber {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.08);
}

.dash-regime-card.regime-border-red {
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.08);
}

.regime-lights-strip {
  background: rgba(15, 23, 42, 0.6);
  padding: 4px 8px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.regime-light-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 0.72rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.regime-light-pill .light-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.regime-light-pill.light-green .light-dot { background: #10b981; }
.regime-light-pill.light-amber .light-dot { background: #f59e0b; }
.regime-light-pill.light-red .light-dot { background: #ef4444; }

.regime-light-pill.inactive {
  opacity: 0.35;
  filter: grayscale(0.5);
}

.regime-light-pill.active {
  opacity: 1;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

.regime-light-pill.light-green.active {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.5);
}

.regime-light-pill.light-amber.active {
  background: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.5);
}

.regime-light-pill.light-red.active {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

/* Dashboard Regime 3-Column Grid */
.dash-regime-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 768px) {
  .dash-regime-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.dash-regime-col {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px 14px;
}

.regime-col-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.regime-col-val {
  font-size: 1.25rem;
  font-family: var(--font-mono);
  line-height: 1.2;
}

/* ============================================================
   SL Calculator Dynamic Guardrail Banner Styles
   ============================================================ */
.stc-regime-banner {
  border-radius: 10px;
  border: 1px solid transparent;
  animation: slideIn 0.2s ease;
}

.stc-regime-banner.banner-amber {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.06);
}

.stc-regime-banner.banner-red {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.06);
}

.stc-regime-banner.banner-green {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.3);
}

#stc-apply-safe-risk {
  transition: all 0.2s ease;
}

#stc-apply-safe-risk.applied {
  background: rgba(16, 185, 129, 0.25) !important;
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
}

/* ============================================================
   Telegram Bot Push Notifications & EOD Digest
   ============================================================ */
.input-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-password-wrap input {
  padding-right: 42px;
}

.btn-toggle-mask {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  opacity: 0.7;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.btn-toggle-mask:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}

.telegram-setup-helper {
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed rgba(56, 189, 248, 0.25);
  border-radius: 8px;
}

.telegram-setup-helper ol li {
  margin-bottom: 4px;
}

/* ============================================================
   Broker CSV Importer (Portfolio & Trade Journal)
   ============================================================ */
.broker-import-modal {
  max-width: 820px;
}

.import-target-toggle {
  display: flex;
  gap: 8px;
}

.target-toggle-btn {
  flex: 1;
  padding: 9px 14px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.target-toggle-btn:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(56, 189, 248, 0.4);
}

.target-toggle-btn.active {
  background: rgba(37, 99, 235, 0.2);
  border-color: var(--primary);
  color: #38bdf8;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.2);
}

.supported-brokers-pill-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.broker-badge {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-color);
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.broker-dropzone {
  border: 2px dashed rgba(56, 189, 248, 0.35);
  background: rgba(15, 23, 42, 0.4);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.broker-dropzone.drag-over,
.broker-dropzone:hover {
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.08);
}

.dropzone-icon {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 6px;
}

.broker-hidden-file-input {
  display: none;
}

/* ============================================================
   Broker GTT Order Specs Card (SL Calculator)
   ============================================================ */
.gtt-order-card {
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.85) 0%, rgba(15, 23, 42, 0.98) 100%) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-lg);
}

.btn-gtt-copy {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-gtt-copy:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-1px);
}

.gtt-leg-card {
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.gtt-leg-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

.gtt-target-pills button {
  padding: 2px 7px;
  font-size: 0.72rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.gtt-target-pills button.active {
  background: rgba(16, 185, 129, 0.25) !important;
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
}

.gtt-target-pills button:hover {
  border-color: rgba(16, 185, 129, 0.4);
}

/* ============================================================
   SL Calculator: Pyramiding & Partial Exit Tabs & Planner
   ============================================================ */
.stc-tabs-bar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.stc-tab-btn {
  padding: 9px 18px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.stc-tab-btn:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(56, 189, 248, 0.4);
}

.stc-tab-btn.active {
  background: rgba(37, 99, 235, 0.2);
  border-color: var(--primary);
  color: #38bdf8;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.2);
}

.pyr-sl-preset-btn,
.pyr-risk-preset-btn,
.pyr-exit-pct-btn,
.pyr-target-r-btn {
  padding: 3px 8px;
  font-size: 0.72rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pyr-sl-preset-btn:hover,
.pyr-risk-preset-btn:hover,
.pyr-exit-pct-btn:hover,
.pyr-target-r-btn:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: var(--primary);
  color: #fff;
}

.pyr-exit-pct-btn.active,
.pyr-target-r-btn.active {
  background: rgba(16, 185, 129, 0.25) !important;
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
}

.pyr-risk-preset-btn.active {
  background: rgba(56, 189, 248, 0.2) !important;
  color: #38bdf8 !important;
  border-color: var(--primary) !important;
}

/* ============================================================
   Events & Gap-Risk Calendar Styles
   ============================================================ */

.calendar-page-container {
  padding-bottom: 40px;
}

.cal-pill-btn {
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.5);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.cal-pill-btn:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: var(--primary);
  color: #fff;
}

.cal-pill-btn.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.cal-risk-pulse-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: calPulseRed 1.8s infinite;
}

@keyframes calPulseRed {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.cal-gap-risk-box {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(15, 23, 42, 0.7));
  border: 1px solid rgba(239, 68, 68, 0.45);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.12);
  border-radius: 10px;
  padding: 16px;
}

.cal-gap-risk-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 12px;
}

.cal-gap-card {
  padding: 14px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.cal-gap-card--vulnerable {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 2px 12px rgba(239, 68, 68, 0.15);
}

.cal-gap-card--cushioned {
  border-color: rgba(34, 197, 94, 0.45);
  box-shadow: 0 2px 12px rgba(34, 197, 94, 0.1);
}

.cal-agenda-card {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
  background: rgba(30, 41, 59, 0.35);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.cal-agenda-card:hover {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(56, 189, 248, 0.4);
}

.cal-agenda-card--holding {
  border-left: 3px solid #ef4444;
  background: rgba(239, 68, 68, 0.04);
}

.cal-agenda-date-box {
  min-width: 68px;
  text-align: center;
  padding: 6px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.cal-grid-matrix {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-grid-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding-bottom: 8px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 6px;
}

.cal-grid-day {
  min-height: 98px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-col: column;
}

.cal-grid-day:hover {
  background: rgba(30, 41, 59, 0.7);
  border-color: var(--primary);
}

.cal-grid-day--today {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.06);
  box-shadow: inset 0 0 10px rgba(56, 189, 248, 0.15);
}

.cal-grid-day--gap-risk {
  border-color: rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.08);
}

.cal-grid-day--empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
}

.cal-grid-chip {
  padding: 2px 4px;
  font-size: 0.68rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(30, 41, 59, 0.8);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.cal-grid-chip:hover {
  transform: translateY(-1px);
  filter: brightness(1.2);
}

.cal-grid-chip--holding {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
  font-weight: 600;
}

.dash-gap-alert-strip {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(15, 23, 42, 0.6));
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.1);
}

.stc-gap-warning-banner {
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.1);
}

.cal-modal {
  max-width: 540px;
  width: 90%;
}

/* ============================================================
   Mutual Funds Module Styles
   ============================================================ */
.mf-page-container {
  max-width: 1400px;
  margin: 0 auto;
}

.mf-desktop-table-card {
  display: block;
}

.mf-mobile-cards-grid {
  display: none;
}

.mf-alloc-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
}

.mf-alloc-seg {
  height: 100%;
  transition: width 0.3s ease;
}

.mf-legend-pill {
  cursor: pointer;
}

.mf-legend-pill.active-pill {
  border-color: var(--accent-primary, #3b82f6) !important;
  background: rgba(59, 130, 246, 0.15) !important;
}

.mf-search-dropdown {
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.mf-filter-group::-webkit-scrollbar {
  display: none;
}

.mf-filter-group {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.mf-unified-header-card {
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  padding: 1.25rem;
}

.mf-header-actions .mf-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.5rem 0.85rem;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.mf-btn-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  opacity: 0.92;
}

.mf-btn-ai-accent {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border: 1px solid rgba(167, 139, 250, 0.45);
  color: #fff;
}

.mf-btn-ai-accent:hover {
  filter: brightness(1.06);
}

.mf-spin-wrap {
  display: inline-flex;
  animation: mf-spin 0.9s linear infinite;
}

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

.mf-no-holdings-pill {
  opacity: 0.85;
  background: rgba(148, 163, 184, 0.12);
}

.mf-alloc-seg--empty {
  background: rgba(148, 163, 184, 0.2);
}

.mf-legend-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mf-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  display: inline-block;
  flex-shrink: 0;
}

.mf-ltcg-bar-track {
  height: 6px;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.25);
  overflow: hidden;
  min-width: 72px;
}

.mf-ltcg-bar-ltcg {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 9999px;
}

.mf-ltcg-legend {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

/* Desktop table row actions */
.mf-table .mf-col-actions {
  text-align: right;
  vertical-align: middle;
  width: 1%;
  white-space: nowrap;
  padding-right: 0.75rem;
}

.mf-table thead .mf-col-actions {
  text-align: right;
}

.mf-row-action-bar {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}

.mf-action-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 32px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.mf-action-pill .mf-btn-icon {
  width: 0.85rem;
  height: 0.85rem;
  opacity: 0.95;
}

.mf-action-pill:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(148, 163, 184, 0.55);
}

.mf-action-pill:active {
  transform: scale(0.97);
}

.mf-action-pill--add {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.45);
  color: #bfdbfe;
}

.mf-action-pill--add:hover {
  background: rgba(59, 130, 246, 0.28);
  border-color: rgba(147, 197, 253, 0.55);
}

.mf-action-pill--danger {
  padding: 0 9px;
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
  background: rgba(127, 29, 29, 0.25);
}

.mf-action-pill--danger:hover {
  background: rgba(153, 27, 27, 0.4);
  border-color: rgba(252, 165, 165, 0.5);
}

/* Mobile card actions */
.mf-mobile-action-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mf-mobile-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
  cursor: pointer;
}

.mf-mobile-action--primary {
  grid-column: 1 / -1;
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(96, 165, 250, 0.45);
  color: #dbeafe;
}

.mf-mobile-action--danger {
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
  background: rgba(127, 29, 29, 0.22);
}

.mf-mobile-action .mf-btn-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.mf-onboard-card {
  border: 1px dashed rgba(148, 163, 184, 0.35);
}

.mf-onboard-btn {
  width: 100%;
  justify-content: center;
  text-align: left;
  line-height: 1.35;
}

/* MF Import Modal */
.mf-import-modal {
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.35);
  max-width: 960px;
}

.mf-import-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}

.mf-import-tab {
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  cursor: pointer;
}

.mf-import-tab.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.45);
  color: var(--text-primary);
}

.mf-import-dropzone {
  border: 2px dashed rgba(148, 163, 184, 0.45);
  border-radius: 12px;
  padding: 2rem 1rem;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
}

.mf-import-dropzone.drag-over {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
}

.mf-import-table th,
.mf-import-table td {
  vertical-align: top;
  padding: 0.5rem 0.4rem;
}

.mf-clear-all-btn {
  min-height: 36px;
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.mf-clear-all-btn .mf-btn-icon {
  width: 0.9rem;
  height: 0.9rem;
}

/* ============================================================
   AI Command OS & Action Bar (Desktop + Universal)
   ============================================================ */

.ai-cmd-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #c7d2fe;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ai-cmd-trigger-btn:hover {
  background: rgba(49, 46, 129, 0.4);
  border-color: rgba(129, 140, 248, 0.6);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

.ai-cmd-kbd {
  font-size: 0.6875rem;
  font-family: var(--font-mono, monospace);
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 4px;
  padding: 1px 5px;
  color: #94a3b8;
}

.ai-cmd-trigger-btn:hover .ai-cmd-kbd {
  color: #cbd5e1;
  border-color: rgba(129, 140, 248, 0.4);
}

/* AI Command Modal & Bottom Sheet Engine */
.ai-cmd-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 99998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-cmd-backdrop.open {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.ai-cmd-sheet {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.98);
  width: 660px;
  max-width: calc(100vw - 32px);
  max-height: 88vh;
  background: #0b1120;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 16px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 35px rgba(99, 102, 241, 0.15);
  z-index: 99999;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.ai-cmd-sheet.open {
  display: flex;
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

/* Header density — hide non-essential chips before overlap on laptop widths */
@media (max-width: 1620px) {
  .header #manual-refresh-btn .header-btn-label {
    display: none;
  }

  .header #header-add-stock-btn .header-btn-label {
    display: none;
  }
}

@media (max-width: 1480px) {
  .header .last-refreshed-badge {
    display: none;
  }
}

@media (max-width: 1400px) {
  .header .last-refreshed-badge {
    display: none;
  }
}

@media (max-width: 1280px) {
  .ai-cmd-trigger-btn .ai-cmd-kbd {
    display: none;
  }

  .header .market-status-indicator {
    display: none;
  }

  .header-toolbar-divider {
    display: none;
  }

  .header-left #searchbar-container {
    min-width: 160px;
    max-width: 240px;
  }
}

@media (max-width: 1180px) {
  .header .active-portfolio-badge {
    display: none;
  }

  .header-btn-label {
    display: none;
  }

  .header-left #searchbar-container {
    min-width: 150px;
    max-width: 220px;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .ai-cmd-trigger-btn .ai-cmd-label {
    display: none;
  }

  .header-left #searchbar-container {
    min-width: 150px;
    max-width: 260px;
  }
}

@media (max-width: 767.98px) {
  .header-left,
  .header-left #searchbar-container,
  #searchbar-container {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  .header-search-trigger {
    width: 100% !important;
    min-height: 44px !important;
    height: 44px !important;
    background: #161f33;
    border-radius: 8px;
  }

  .header-search-kbd {
    display: none !important;
  }
}

.ai-cmd-drag-handle {
  width: 44px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  margin: 10px auto 4px;
}

.ai-cmd-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(15, 23, 42, 0.6);
}

.ai-cmd-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.9375rem;
  color: #e0e7ff;
}

.ai-cmd-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-cmd-lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-cmd-lang-toggle:hover {
  background: rgba(49, 46, 129, 0.5);
  color: #ffffff;
}

.ai-cmd-close-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  font-size: 1.25rem;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.ai-cmd-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.ai-cmd-close-btn:active {
  transform: scale(0.95);
}

.ai-cmd-input-wrap {
  padding: 14px 18px 10px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.ai-cmd-textarea {
  flex: 1;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 10px 14px;
  color: #f8fafc;
  font-size: 0.875rem;
  line-height: 1.4;
  resize: none;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ai-cmd-textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.ai-cmd-submit-btn {
  padding: 9px 18px;
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ai-cmd-chips-bar {
  padding: 6px 18px 10px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.ai-cmd-chips-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ai-cmd-chips-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.ai-cmd-chips-toggle-btn {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.ai-cmd-chips-toggle-btn:hover {
  background: rgba(49, 46, 129, 0.5);
  color: #ffffff;
  border-color: rgba(99, 102, 241, 0.5);
}

.ai-cmd-chips-bar--collapsed {
  padding-bottom: 6px;
}

.ai-cmd-chips-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}

.ai-cmd-chips-scroll::-webkit-scrollbar {
  height: 4px;
}

.ai-cmd-chips-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.ai-cmd-chips-scroll::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.35);
  border-radius: 4px;
}

.ai-cmd-chip:disabled {
  opacity: 0.55;
  cursor: wait;
  pointer-events: none;
}

.ai-cmd-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  font-size: 0.75rem;
  padding: 5px 10px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-cmd-chip:hover {
  background: rgba(49, 46, 129, 0.45);
  border-color: rgba(99, 102, 241, 0.5);
  color: #ffffff;
  transform: translateY(-1px);
}

.ai-cmd-results {
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  padding: 16px 18px;
  background: rgba(15, 23, 42, 0.5);
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.4) transparent;
}

.ai-cmd-results::-webkit-scrollbar {
  width: 6px;
}

.ai-cmd-results::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}

.ai-cmd-results::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.4);
  border-radius: 4px;
}

.ai-cmd-loading-box {
  padding: 24px 0;
  text-align: center;
}

.ai-cmd-spinner-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.ai-pulse-dot {
  width: 10px;
  height: 10px;
  background: #6366f1;
  border-radius: 50%;
  animation: pulseDot 1.4s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(0.6); opacity: 0.4; }
  50% { transform: scale(1.3); opacity: 1; }
}

.ai-cmd-response-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 12px;
  padding: 14px 16px;
}

.ai-cmd-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.ai-cmd-tool-pills-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding: 6px 10px;
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 8px;
}

.ai-tool-pill-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ai-cmd-tool-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-mono, monospace);
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
  transition: all 0.15s ease;
}

.ai-tool-pill-icon {
  font-size: 0.75rem;
}

.ai-tool-pill-name {
  letter-spacing: 0.02em;
}

@media (max-width: 480px) {
  .ai-cmd-tool-pills-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 8px;
  }
  .ai-tool-pill {
    min-height: 28px;
    font-size: 0.7rem;
  }
}

.ai-intent-badge {
  font-size: 0.6875rem;
  padding: 2px 8px;
  border-radius: 4px;
}

.ai-cmd-reply-text {
  font-size: 0.875rem;
  line-height: 1.6;
  color: #e2e8f0;
  margin-bottom: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-cmd-actions-wrap {
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  padding-top: 10px;
}

.ai-cmd-actions-title {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 8px;
}

.ai-cmd-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-action-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(49, 46, 129, 0.35);
  border: 1px solid rgba(99, 102, 241, 0.45);
  color: #c7d2fe;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 14px;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.ai-action-chip-btn:hover {
  background: rgba(67, 56, 202, 0.55);
  border-color: #818cf8;
  color: #ffffff;
  transform: translateY(-1px);
}

.action-arrow {
  color: #818cf8;
  font-weight: bold;
}

/* ============================================================
   Dashboard One-Glance Daily Brief Ribbon
   ============================================================ */

.dash-daily-brief-ribbon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 16px;
  margin-bottom: 14px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  font-size: 0.8rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.daily-brief-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.daily-brief-regime {
  flex-shrink: 0;
}

.daily-brief-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.daily-brief-sep {
  color: var(--text-muted);
  opacity: 0.6;
}

.daily-brief-urgent {
  flex-shrink: 0;
}

.daily-brief-urgent-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.daily-brief-journal {
  flex: 1;
  justify-content: flex-end;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-brief-journal-icon {
  flex-shrink: 0;
}

.daily-brief-journal-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 767.98px) {
  .dash-daily-brief-ribbon {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 12px;
    margin-bottom: 12px;
  }

  .daily-brief-journal {
    justify-content: flex-start;
    width: 100%;
  }
}

/* ============================================================
   Dashboard AI Daily Battle Plan Hero Card
   ============================================================ */

.dash-battle-plan-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 27, 75, 0.85));
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 12px;
  padding: 16px 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.08);
}

.dash-battle-plan-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899, #6366f1);
  background-size: 200% auto;
  animation: aiGradientShift 4s linear infinite;
}

.dash-battle-plan-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.dash-battle-plan-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.battle-plan-sparkle {
  font-size: 1.25rem;
  line-height: 1;
  padding-top: 2px;
}

.dash-battle-plan-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f8fafc;
  flex-wrap: wrap;
}

.dash-battle-plan-stance {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.03em;
}

.stance-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.dash-battle-plan-subtitle {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 2px;
}

.dash-battle-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #c7d2fe;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dash-battle-ai-btn:hover {
  background: rgba(49, 46, 129, 0.5);
  border-color: rgba(129, 140, 248, 0.6);
  color: #ffffff;
}

.dash-battle-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.battle-plan-action-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 0.2s, background 0.2s;
}

.battle-plan-action-card:hover {
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(15, 23, 42, 0.85);
}

.battle-priority-chip {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 9999px;
  display: inline-block;
  margin-bottom: 6px;
}

.battle-priority-chip.p-lock {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.battle-priority-chip.p-audit {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.battle-priority-chip.p-catalyst {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.battle-action-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 4px;
  line-height: 1.3;
}

.battle-action-desc {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.4;
  margin-bottom: 8px;
}

.battle-plan-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.battle-plan-action-btn:hover {
  background: rgba(49, 46, 129, 0.5);
  border-color: rgba(129, 140, 248, 0.6);
  color: #ffffff;
}

.mobile-floating-ai-btn {
  display: none;
}

/* Guest sandbox reset (header + profile menu) */
.guest-reset-sandbox-btn {
  min-height: 44px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.guest-reset-sandbox-btn:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.55);
  color: #fcd34d;
}

/* Guest Access & Preset Buttons */
.preset-btn {
  padding: 4px 10px;
  font-size: 0.72rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: rgba(255, 255, 255, 0.03);
}

.preset-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.preset-btn.active {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
  border-color: #10b981 !important;
  font-weight: 600;
}

/* ============================================================
   Bilingual CapitalPilot AI User Training Guide Styles
   ============================================================ */
.training-guide-container.lang-en .hi-block {
  display: none !important;
}

.training-guide-container.lang-hi .en-block {
  display: none !important;
}

.training-guide-container .hidden-item {
  display: none !important;
}

.training-guide-container .training-module-card {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.training-guide-container .training-module-card:hover {
  border-color: rgba(56, 189, 248, 0.45) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.training-guide-container .training-prompt-card {
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.training-guide-container .training-prompt-card:hover {
  border-color: rgba(167, 139, 250, 0.45) !important;
  transform: translateY(-2px);
}

.training-guide-container .training-copy-btn {
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.training-guide-container .training-copy-btn:hover {
  background: rgba(56, 189, 248, 0.24);
  border-color: #38bdf8;
  color: #ffffff;
}

/* 3-Step Welcome Onboarding Card (Dashboard) */
.dash-welcome-card {
  background: radial-gradient(circle at 10% 10%, rgba(56, 189, 248, 0.12), transparent 40%),
              radial-gradient(circle at 90% 15%, rgba(167, 139, 250, 0.12), transparent 40%),
              #161f33;
  border: 1px solid #26324d;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.dash-welcome-card .steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.dash-welcome-card .step-box {
  background: #101727;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 640px) {
  .dash-welcome-card {
    padding: 16px 14px;
  }
  .dash-welcome-card .steps-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Swing & Momentum Discovery Engine — Settings & Controls
   ============================================================ */
.discovery-method-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.discovery-method-pill {
  min-height: 44px;
  padding: 8px 14px;
  background: #161f33;
  border: 1px solid #26324d;
  color: #94a3b8;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  user-select: none;
  touch-action: manipulation;
}

.discovery-method-pill:hover {
  background: #1e293b;
  border-color: #38bdf8;
  color: #f8fafc;
}

.discovery-method-pill.active {
  background: rgba(99, 102, 241, 0.25);
  border-color: #818cf8;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

.discovery-method-pill .pill-icon {
  font-size: 15px;
  line-height: 1;
}

.discovery-method-pill .pill-title {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .discovery-method-pill {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
    padding: 8px 10px;
  }
  .discovery-method-pill .pill-title {
    font-size: 12px;
  }
}










