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

:root {
  --color-bg: #f5f6fb;
  --color-surface: #ffffff;
  --color-card: #ffffff;
  --color-highlight: #3f51b5;
  --color-highlight-dark: #303f9f;
  --color-highlight-secondary: #5c6bc0;
  --color-highlight-shadow: rgba(63, 81, 181, 0.28);
  --color-muted: #5f6368;
  --color-text: #202124;
  --color-text-strong: #16181b;
  --color-border: rgba(60, 64, 67, 0.16);
  --shadow-card: 0 18px 40px rgba(60, 64, 67, 0.12);
  --font-family: "Roboto", "Helvetica Neue", Arial, sans-serif;
  --font-family-mono: "Roboto Mono", "Fira Mono", monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --sidebar-width: 200px;
  --header-height: 60px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(
      circle at top,
      rgba(63, 81, 181, 0.2),
      transparent 55%
    ),
    var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font-family: var(--font-family);
}

/* ------------------------------------------------------------------ */
/* HEADER                                                               */
/* ------------------------------------------------------------------ */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--color-border);
}

.site-header__brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.brand__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-strong);
}

/* ------------------------------------------------------------------ */
/* APP SHELL — sidebar + content                                        */
/* ------------------------------------------------------------------ */

.app-shell {
  display: flex;
  min-height: calc(100vh - var(--header-height));
}

/* SIDEBAR */

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  border-right: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  gap: 2px;
}

.sidebar__item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar__item:hover {
  background: rgba(63, 81, 181, 0.08);
  color: var(--color-highlight);
}

.sidebar__item.is-active {
  background: rgba(63, 81, 181, 0.12);
  color: var(--color-highlight);
  border-left-color: var(--color-highlight);
  font-weight: 600;
}

.sidebar__divider {
  height: 1px;
  background: var(--color-border);
  margin: 8px 16px;
}

/* CONTENT AREA */

.content {
  flex: 1;
  min-width: 0;
  padding: 32px 40px 64px;
}

/* TAB PANELS */

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ------------------------------------------------------------------ */
/* CARDS                                                                */
/* ------------------------------------------------------------------ */

.card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card__header {
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card__header h1,
.card__header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text-strong);
}

.card__header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card__body {
  padding: 20px 24px;
}

.card__body--hero {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card__body--actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card__body--code pre {
  margin: 0;
  padding: 18px;
  background: rgba(63, 81, 181, 0.08);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 13px;
  font-family: var(--font-family-mono);
  overflow-x: auto;
}

/* ------------------------------------------------------------------ */
/* BUTTONS                                                              */
/* ------------------------------------------------------------------ */

.btn {
  padding: 10px 16px;
  font-size: 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(63, 81, 181, 0.2);
  background: #ffffff;
  color: var(--color-highlight);
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease,
    color 0.2s ease;
  box-shadow: 0 2px 6px rgba(63, 81, 181, 0.12);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(63, 81, 181, 0.16);
}

.btn:focus-visible {
  outline: 3px solid rgba(63, 81, 181, 0.25);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--color-highlight);
  color: #fff;
  border: none;
  box-shadow: 0 10px 22px rgba(63, 81, 181, 0.32);
}

.btn--primary:hover {
  background: var(--color-highlight-dark);
  box-shadow: 0 12px 26px rgba(63, 81, 181, 0.34);
}

.btn--ghost {
  background: rgba(63, 81, 181, 0.08);
  color: var(--color-highlight);
  border: 1px solid rgba(63, 81, 181, 0.25);
}

.btn--ghost:hover {
  background: rgba(63, 81, 181, 0.12);
}

.btn--danger {
  background: #c62828;
  color: #fff;
  border: none;
  box-shadow: 0 10px 22px rgba(198, 40, 40, 0.28);
}

.btn--danger:hover {
  background: #b71c1c;
  box-shadow: 0 12px 26px rgba(198, 40, 40, 0.32);
}

.btn--icon {
  padding: 7px 11px;
  min-width: 32px;
}

/* ------------------------------------------------------------------ */
/* STATUS BADGES & PANELS                                               */
/* ------------------------------------------------------------------ */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 999px;
  background: rgba(63, 81, 181, 0.12);
  color: var(--color-highlight);
  font-weight: 500;
}

.status-panel {
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
  font-size: 14px;
  color: var(--color-muted);
}

.section-status {
  margin-top: 18px;
  font-size: 14px;
  color: var(--color-muted);
}

/* tone variants applied to badge, panel, status, and session status */
.status-badge[data-tone="success"],
.status-panel[data-tone="success"],
.section-status[data-tone="success"],
.session-controls__status[data-tone="success"] {
  color: #2e7d32;
  background: rgba(76, 175, 80, 0.18);
}

.status-badge[data-tone="error"],
.status-panel[data-tone="error"],
.section-status[data-tone="error"],
.session-controls__status[data-tone="error"] {
  color: #c62828;
  background: rgba(239, 83, 80, 0.16);
}

.status-badge[data-tone="warning"],
.status-panel[data-tone="warning"],
.section-status[data-tone="warning"],
.session-controls__status[data-tone="warning"] {
  color: #b28704;
  background: rgba(255, 193, 7, 0.18);
}

.status-badge[data-tone="info"],
.status-panel[data-tone="info"],
.section-status[data-tone="info"],
.session-controls__status[data-tone="info"] {
  color: #2962ff;
  background: rgba(41, 121, 255, 0.15);
}

/* ------------------------------------------------------------------ */
/* SESSION CONTROLS (header right side)                                 */
/* ------------------------------------------------------------------ */

.session-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.session-controls__group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.session-controls__status {
  font-size: 12px;
  color: var(--color-muted);
  text-align: right;
  min-height: 16px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* ------------------------------------------------------------------ */
/* HERO STATS (home tab)                                                */
/* ------------------------------------------------------------------ */

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.hero-stat {
  padding: 16px;
  border: 1px solid rgba(63, 81, 181, 0.25);
  border-radius: var(--radius-md);
  background: rgba(63, 81, 181, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hero-stat__label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.hero-stat__value {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text-strong);
}

/* ------------------------------------------------------------------ */
/* TABLES                                                               */
/* ------------------------------------------------------------------ */

.profile-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--color-border);
}

.profile-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
  background: rgba(240, 242, 247, 0.8);
  border-bottom: 1px solid var(--color-border);
}

.profile-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(32, 33, 36, 0.05);
  color: var(--color-text);
}

.profile-table tr:last-child td {
  border-bottom: none;
}

.profile-table__label {
  width: 35%;
  font-weight: 600;
  color: var(--color-muted);
  background: rgba(240, 242, 247, 0.8);
}

.profile-table__value {
  color: var(--color-text);
}

/* ------------------------------------------------------------------ */
/* FORMS (settings tab)                                                 */
/* ------------------------------------------------------------------ */

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

.form-grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.form-grid__full {
  grid-column: 1 / -1;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field--full {
  grid-column: 1 / -1;
}

.form-field__label {
  font-weight: 500;
  font-size: 13px;
  color: var(--color-muted);
}

/* ── Generic tooltip via data-tooltip attribute ─────────────────────────── */
[data-tooltip] {
  position: relative;
  cursor: default;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: #37474f;
  color: #fff;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  white-space: normal;
  width: 200px;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 300;
  box-shadow: 0 4px 14px rgba(0,0,0,0.22);
}
[data-tooltip]:hover::after {
  opacity: 1;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(63, 81, 181, 0.25);
  background: #ffffff;
  color: var(--color-text);
  font-family: var(--font-family);
  resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus {
  outline: 2px solid rgba(63, 81, 181, 0.3);
  border-color: rgba(63, 81, 181, 0.45);
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
}

.form-status {
  font-size: 13px;
  color: var(--color-muted);
}

/* ------------------------------------------------------------------ */
/* HOLDINGS & POSITIONS SUMMARIES                                       */
/* ------------------------------------------------------------------ */

.holdings-overall {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
  color: var(--color-muted);
}

.positions-summary {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
  color: var(--color-muted);
}

.positions-summary span {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(63, 81, 181, 0.15);
  background: rgba(63, 81, 181, 0.08);
  color: var(--color-highlight-dark);
  font-weight: 500;
}

.positions-pl {
  font-weight: 600;
  color: var(--color-text);
}

.positions-pl.is-positive {
  color: #2e7d32;
}

.positions-pl.is-negative {
  color: #c62828;
}

/* ------------------------------------------------------------------ */
/* ORDERS                                                               */
/* ------------------------------------------------------------------ */

.orders-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.orders-filters__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}

.orders-filters__field span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.orders-filters__field input {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(63, 81, 181, 0.2);
  background: #ffffff;
  color: var(--color-text);
  font-family: var(--font-family);
}

.orders-filters__field input:focus {
  outline: 2px solid rgba(63, 81, 181, 0.25);
  border-color: rgba(63, 81, 181, 0.4);
}

.orders-panel {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.orders-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.orders-panel__header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-strong);
}

.orders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-card {
  border: 1px solid rgba(63, 81, 181, 0.15);
  border-radius: var(--radius-md);
  background: rgba(63, 81, 181, 0.05);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  color: var(--color-highlight);
}

.order-card__meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--color-muted);
}

.order-card__body {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  font-size: 14px;
  color: var(--color-text);
}

.order-card__body strong {
  font-weight: 600;
  color: var(--color-text-strong);
}

/* ------------------------------------------------------------------ */
/* STRATEGY CONTROLS                                                    */
/* ------------------------------------------------------------------ */

.strategy-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  margin-top: 20px;
}

.strategy-controls__symbols {
  flex: 1;
  min-width: 220px;
}

.strategy-controls__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

/* Symbol picker */
.strategy-symbol-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.strategy-symbol-picker__toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.strategy-symbol-search {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.strategy-symbol-search:focus {
  outline: 2px solid rgba(63, 81, 181, 0.3);
  border-color: rgba(63, 81, 181, 0.45);
}

.strategy-selected-count {
  font-size: 12px;
  color: var(--color-muted);
  white-space: nowrap;
  min-width: 70px;
  text-align: right;
}

.strategy-symbol-list {
  height: 200px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #fafafa;
}

.symbol-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 12px;
  font-family: 'Roboto Mono', monospace;
}

.symbol-item:hover {
  background: rgba(63, 81, 181, 0.06);
}

.symbol-item input[type=checkbox] {
  cursor: pointer;
  accent-color: var(--color-highlight);
  flex-shrink: 0;
}

.strategy-direction-buy {
  font-weight: 600;
  color: #2e7d32;
}

.strategy-direction-sell {
  font-weight: 600;
  color: #c62828;
}

.strategy-order-placed  { color: #2e7d32; font-weight: 600; }
.strategy-order-dryrun  { color: #1565c0; font-weight: 600; }
.strategy-order-failed  { color: #c62828; }

/* ------------------------------------------------------------------ */
/* DRY-RUN TOGGLE SWITCH                                               */
/* ------------------------------------------------------------------ */

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-switch__track {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 22px;
  transition: background 0.2s;
}

.toggle-switch__track::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-switch__track {
  background: var(--color-highlight);
}

.toggle-switch input:checked + .toggle-switch__track::after {
  transform: translateX(18px);
}

.toggle-switch input:disabled + .toggle-switch__track {
  opacity: 0.5;
  cursor: not-allowed;
}

.toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}

.toggle-label__hint {
  font-size: 12px;
  color: var(--color-muted);
  font-weight: 400;
}

/* ------------------------------------------------------------------ */
/* CAMARILLA SCANNER                                                    */
/* ------------------------------------------------------------------ */

.scanner-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.auto-refresh-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.auto-refresh-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.auto-refresh-minutes-input {
  width: 60px;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-align: center;
}

.auto-refresh-unit {
  color: var(--color-muted);
  font-size: 13px;
}

.auto-refresh-countdown {
  margin-left: auto;
  font-size: 12px;
  font-family: 'Roboto Mono', monospace;
  color: var(--color-muted);
  min-width: 120px;
  text-align: right;
}

.scanner-zone-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scanner-filter {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--color-muted);
  font-family: var(--font-family);
  transition: background 0.15s, color 0.15s;
}

.scanner-filter:hover {
  background: rgba(63, 81, 181, 0.08);
  color: var(--color-highlight);
}

.scanner-filter.is-active {
  background: var(--color-highlight);
  color: #fff;
  border-color: var(--color-highlight);
}

/* Zone row colors */
.scanner-zone-above-r4 { background: rgba(46, 125, 50, 0.10); }
.scanner-zone-above-r4 td:nth-child(2) { color: #1b5e20; font-weight: 700; }

.scanner-zone-r3-r4 { background: rgba(46, 125, 50, 0.05); }
.scanner-zone-r3-r4 td:nth-child(2) { color: #2e7d32; font-weight: 600; }

.scanner-zone-s3-r3 { background: transparent; }
.scanner-zone-s3-r3 td:nth-child(2) { color: var(--color-muted); }

.scanner-zone-s3-s4 { background: rgba(198, 40, 40, 0.05); }
.scanner-zone-s3-s4 td:nth-child(2) { color: #c62828; font-weight: 600; }

.scanner-zone-below-s4 { background: rgba(198, 40, 40, 0.10); }
.scanner-zone-below-s4 td:nth-child(2) { color: #7f0000; font-weight: 700; }

/* ------------------------------------------------------------------ */
/* SCANNER PAGE (standalone /scanner route)                            */
/* ------------------------------------------------------------------ */

.scanner-page-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.scanner-back-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-highlight);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(63, 81, 181, 0.25);
  background: rgba(63, 81, 181, 0.06);
  transition: background 0.15s;
}

.scanner-back-link:hover {
  background: rgba(63, 81, 181, 0.14);
}

/* Zone-colored cells in transitions table (class applied to td directly) */
td.scanner-zone-above-r4 { background: rgba(46, 125, 50, 0.12); color: #1b5e20; font-weight: 700; }
td.scanner-zone-r3-r4    { background: rgba(46, 125, 50, 0.06); color: #2e7d32; font-weight: 600; }
td.scanner-zone-s3-r3    { background: transparent; color: var(--color-muted); }
td.scanner-zone-s3-s4    { background: rgba(198, 40, 40, 0.06); color: #c62828; font-weight: 600; }
td.scanner-zone-below-s4 { background: rgba(198, 40, 40, 0.12); color: #7f0000; font-weight: 700; }

/* Direction column in transitions table */
.transition-dir-bullish { color: #2e7d32; font-weight: 700; }
.transition-dir-bearish { color: #c62828; font-weight: 700; }
.transition-dir-neutral { color: var(--color-muted); }

.scanner-open-link {
  display: inline-block;
  margin-top: 8px;
  text-decoration: none;
}

/* ------------------------------------------------------------------ */
/* LOGOUT PAGE                                                          */
/* ------------------------------------------------------------------ */

.logout-screen {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
      circle at 20% 20%,
      rgba(63, 81, 181, 0.28),
      transparent 60%
    ),
    var(--color-bg);
  font-family: var(--font-family);
}

.logout-panel {
  position: relative;
  padding: 48px 64px;
  border-radius: var(--radius-lg);
  background: #ffffff;
  border: 1px solid var(--color-border);
  box-shadow: 0 32px 70px rgba(60, 64, 67, 0.18);
  text-align: center;
}

.logout-panel__glow {
  position: absolute;
  inset: -20px;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(63, 81, 181, 0.5),
    rgba(41, 121, 255, 0.4)
  );
  opacity: 0.3;
  filter: blur(40px);
  z-index: -1;
}

.logout-panel h1 {
  margin: 0 0 12px;
  font-size: 36px;
  color: var(--color-text-strong);
}

.logout-panel p {
  margin: 0 0 24px;
  color: var(--color-muted);
  font-size: 16px;
}

.logout-panel__actions .btn {
  min-width: 200px;
}

/* ------------------------------------------------------------------ */
/* UTILITIES                                                            */
/* ------------------------------------------------------------------ */

.hidden {
  display: none !important;
}

.muted {
  color: var(--color-muted);
  font-size: 14px;
  margin: 0;
}

/* ------------------------------------------------------------------ */
/* RESPONSIVE                                                           */
/* ------------------------------------------------------------------ */

/* Tablet: sidebar becomes horizontal scroll strip */
@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    padding: 0;
    gap: 0;
    white-space: nowrap;
    /* hide scrollbar but keep functionality */
    scrollbar-width: none;
  }

  .sidebar::-webkit-scrollbar {
    display: none;
  }

  .sidebar__item {
    display: inline-block;
    border-left: none;
    border-bottom: 3px solid transparent;
    padding: 14px 18px;
    white-space: nowrap;
  }

  .sidebar__item.is-active {
    border-left-color: transparent;
    border-bottom-color: var(--color-highlight);
  }

  .sidebar__divider {
    display: none;
  }

  .content {
    padding: 20px 20px 48px;
  }
}

/* Mobile: compact header */
@media (max-width: 640px) {
  .site-header {
    padding: 0 16px;
    flex-wrap: wrap;
    height: auto;
    min-height: var(--header-height);
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 10px;
  }

  .session-controls__group {
    gap: 8px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  .content {
    padding: 16px 12px 40px;
  }
}

/* =========================================================================
   OPTIONS TAB
   ========================================================================= */

/* Setup row */
.options-setup-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.options-setup-row .form-field {
  min-width: 160px;
}

.options-dte-badge {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: rgba(63, 81, 181, 0.1);
  color: var(--color-highlight);
  border: 1px solid rgba(63, 81, 181, 0.25);
}
.options-dte-badge[data-urgent="true"] {
  background: rgba(198, 40, 40, 0.1);
  color: #c62828;
  border-color: rgba(198, 40, 40, 0.3);
}

/* Camarilla levels display */
.options-levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
}
.options-level-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}
.options-level-stat__label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-muted);
  letter-spacing: 0.5px;
}
.options-level-stat__value {
  font-size: 15px;
  font-weight: 700;
  font-family: 'Roboto Mono', monospace;
  margin-top: 2px;
}
.options-level-stat--r4  { border-color: #2e7d32; }
.options-level-stat--r3  { border-color: #66bb6a; }
.options-level-stat--pivot { border-color: var(--color-highlight); }
.options-level-stat--s3  { border-color: #ef9a9a; }
.options-level-stat--s4  { border-color: #c62828; }

/* Options chain table */
.options-chain-table {
  font-size: 12px;
  font-family: 'Roboto Mono', monospace;
}
.options-chain-table th {
  font-size: 11px;
}
.options-chain__strike {
  background: rgba(63, 81, 181, 0.08);
  font-weight: 600;
  text-align: center;
  min-width: 80px;
}
.options-chain-tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}
.options-chain-tbody tr:hover {
  background: rgba(63, 81, 181, 0.05);
}
.options-chain-row--atm {
  background: rgba(63, 81, 181, 0.12) !important;
  font-weight: 600;
}
.options-chain-row--itm-call { background: rgba(46, 125, 50, 0.06); }
.options-chain-row--itm-put  { background: rgba(198, 40, 40, 0.06); }
.options-chain-row--selected-call {
  background: rgba(46, 125, 50, 0.22) !important;
  outline: 2px solid #2e7d32;
  outline-offset: -2px;
}
.options-chain-row--selected-put {
  background: rgba(198, 40, 40, 0.22) !important;
  outline: 2px solid #c62828;
  outline-offset: -2px;
}
.options-chain-delta--high { color: #2e7d32; font-weight: 600; }
.options-chain-delta--low  { color: var(--color-muted); }

/* Selected strikes row */
.options-selected-strikes {
  display: flex;
  gap: 16px;
  margin: 12px 0;
  flex-wrap: wrap;
}
.options-selected-strike {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(63, 81, 181, 0.05);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.options-selected-strike__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-muted);
  letter-spacing: 0.4px;
}
.options-selected-strike__value {
  font-weight: 600;
  font-family: 'Roboto Mono', monospace;
}

/* Strategy tag pills */
.options-strategy-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.options-strategy-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 0;
}
.options-strategy-name {
  font-size: 14px;
  font-weight: 500;
}
.options-strategy-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}
.tag--intraday   { background: rgba(63, 81, 181, 0.15);  color: #3f51b5; }
.tag--swing      { background: rgba(255, 152, 0, 0.15);  color: #e65100; }
.tag--positional { background: rgba(76, 175, 80, 0.15);  color: #2e7d32; }

/* Signal log direction */
.options-direction-call { color: #2e7d32; font-weight: 600; }
.options-direction-put  { color: #c62828; font-weight: 600; }

/* Live Engine State card */
.options-live-state-card {
  border-left: 3px solid var(--color-highlight);
}

.options-live-state-meta {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

.options-live-state__row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
}

.options-live-state__key {
  flex: 0 0 90px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-muted);
}

.options-live-state__val {
  flex: 1;
  font-weight: 500;
  font-family: 'Roboto Mono', monospace;
  font-size: 13px;
}

.options-live-params-grid {
  margin-top: 0;
}

/* ============================================================ */
/* BACKTEST TAB                                                  */
/* ============================================================ */

.bt-setup-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

/* Progress bar */
.bt-progress-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0;
}

.bt-progress-fill {
  height: 100%;
  background: var(--color-highlight);
  transition: width 0.3s ease;
}

/* Metrics grid */
.bt-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.bt-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface, #fff);
}

.bt-metric__label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-muted);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  position: relative;
  cursor: default;
}

.bt-metric__label[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: #37474f;
  color: #fff;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  white-space: normal;
  width: 190px;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 200;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.bt-metric__label[data-tooltip]:hover::after {
  opacity: 1;
}

.bt-metric__value {
  font-size: 16px;
  font-weight: 700;
  font-family: 'Roboto Mono', monospace;
}

.bt-metric--pos { color: #2e7d32; }
.bt-metric--neg { color: #c62828; }

/* Dynamic strategy params */
.bt-params-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

/* Trades table */
.bt-trades-table {
  font-size: 12px;
  width: 100%;
}

.bt-trade--win { background: rgba(46, 125, 50, 0.05); }
.bt-trade--loss { background: rgba(198, 40, 40, 0.05); }

.bt-trade--win td:last-child { color: #2e7d32; font-weight: 600; }
.bt-trade--loss td:last-child { color: #c62828; font-weight: 600; }

/* Backtest option toggles row */
.bt-option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 10px 0 4px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

/* ------------------------------------------------------------------ */
/* STRATEGY LIBRARY + JOB MANAGER                                      */
/* ------------------------------------------------------------------ */

.st-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.st-strategy-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow 0.15s;
}

.st-strategy-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

.st-strategy-card__name {
  font-weight: 600;
  font-size: 14px;
}

.st-strategy-card__desc {
  font-size: 12px;
  color: var(--color-muted);
  flex: 1;
  line-height: 1.4;
}

.st-strategy-card__tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--color-highlight);
  color: #fff;
  align-self: flex-start;
}

.st-strategy-card--custom .st-strategy-card__tag {
  background: #6a1b9a;
}

/* Launch panel */
.st-launch-panel {
  border: 2px solid var(--color-highlight);
  border-radius: var(--radius-md);
}

/* Jobs table */
.st-jobs-symbols {
  font-size: 11px;
  color: var(--color-muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.st-job-status--running  { color: #2e7d32; font-weight: 600; }
.st-job-status--stopped  { color: var(--color-muted); }
.st-job-status--error    { color: #c62828; font-weight: 600; }

/* Custom condition builder — new v2 rows */
.st-condition-row-v2 {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface, #fafafa);
}

.st-cond-type   { min-width: 140px; }

.st-cond-section {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.st-cond-params {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.st-cond-params input { width: 68px; }

.st-conditions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
}

/* Section labels in the custom builder */
.st-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-highlight);
  margin: 12px 0 4px;
}
.st-section-label--exit { color: #c62828; }

@media (max-width: 600px) {
  .st-library-grid {
    grid-template-columns: 1fr;
  }
  .st-condition-row-v2 {
    flex-direction: column;
    align-items: flex-start;
  }
}