﻿:root {
  --radius-lg: 28px;
  --radius-md: 18px;
  --shadow: 0 20px 50px rgba(64, 34, 8, 0.12);
}

body[data-theme="light"] {
  --bg-start: #f4ede0;
  --bg-end: #f6f2e8;
  --surface: rgba(255, 252, 245, 0.78);
  --surface-strong: #fffdf8;
  --line: rgba(66, 45, 18, 0.12);
  --text: #22170d;
  --muted: #6f5c48;
  --accent: #c85c2a;
  --accent-strong: #8f3912;
  --good: #1b7f5b;
  --bad: #b63d2f;
  --sidebar: #1f1812;
  --sidebar-soft: rgba(255, 255, 255, 0.06);
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-text: #f7efe4;
  --sidebar-muted: rgba(247, 239, 228, 0.72);
}

body[data-theme="night"] {
  --bg-start: #0c1218;
  --bg-end: #121b22;
  --surface: rgba(18, 27, 34, 0.86);
  --surface-strong: #16232d;
  --line: rgba(155, 197, 217, 0.14);
  --text: #edf5fb;
  --muted: #99afbd;
  --accent: #f08a4b;
  --accent-strong: #ffc08e;
  --good: #67d8a8;
  --bad: #ff7e75;
  --sidebar: #081015;
  --sidebar-soft: rgba(255, 255, 255, 0.04);
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-text: #edf5fb;
  --sidebar-muted: rgba(237, 245, 251, 0.68);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(240, 138, 75, 0.14), transparent 26%),
    radial-gradient(circle at right center, rgba(103, 216, 168, 0.11), transparent 22%),
    linear-gradient(180deg, var(--bg-start) 0%, var(--bg-end) 100%);
}
button, input, textarea, select { font: inherit; }
small { color: var(--muted); }

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar) 0%, color-mix(in srgb, var(--sidebar) 88%, #3d2b1f 12%) 100%);
  color: var(--sidebar-text);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-right: 1px solid var(--sidebar-line);
}

.sidebar-top h1,
.saved-header h2,
.hero h2,
.panel h2,
.topbar h2,
.empty-state h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}
.sidebar-top h1 { font-size: 2rem; line-height: 1; }
.sidebar-eyebrow,
.eyebrow,
.panel-kicker {
  margin: 0 0 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 700;
}
.sidebar-eyebrow, .panel-kicker, .eyebrow { color: var(--accent-strong); }

.sidebar-section,
.saved-list,
.hero-stats,
.stack-form,
.rules-list,
.attribute-groups,
.selection-groups,
.rule-checklist,
.trade-preview,
.trades-list,
.insights,
.analysis-sections { display: grid; gap: 12px; }
.grouped-section {
  gap: 10px;
  align-content: start;
  align-items: start;
}
.compact-section {
  padding-left: 14px;
}
.compact-section[hidden] {
  display: none !important;
}

.sidebar-link,
.toggle-button,
.backtest-card-copy,
.backtest-delete,
.backtest-duplicate,
.icon-button {
  border: 1px solid var(--sidebar-line);
  border-radius: 16px;
  background: var(--sidebar-soft);
  color: var(--sidebar-text);
  cursor: pointer;
  transition: 180ms ease;
}
.sidebar-link,
.toggle-button { padding: 12px 14px; }
.sidebar-link {
  min-height: 48px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  line-height: 1.1;
}
.sidebar-link.active,
.sidebar-link:hover,
.toggle-button.active,
.toggle-button:hover,
.backtest-card-copy:hover,
.backtest-delete:hover,
.backtest-duplicate:hover,
.icon-button:hover {
  background: rgba(240, 138, 75, 0.18);
  border-color: rgba(255, 192, 142, 0.32);
}
.saved-header p { color: var(--accent-strong); }
.backtest-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--sidebar-line);
  border-radius: 18px;
  background: var(--sidebar-soft);
}
.backtest-card.active { background: rgba(240, 138, 75, 0.15); }
.backtest-card-row { display: flex; gap: 10px; align-items: start; min-width: 0; }
.backtest-card-actions {
  display: grid;
  gap: 4px;
  flex-shrink: 0;
}
.backtest-card-copy {
  flex: 1;
  min-width: 0;
  padding: 12px;
  text-align: left;
  overflow: hidden;
}
.backtest-card-title {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}
.backtest-card-meta {
  display: block;
  margin-top: 6px;
  color: var(--sidebar-muted);
  font-size: 0.84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.backtest-delete,
.backtest-duplicate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 104px;
  padding: 3px 10px;
  border-radius: 10px;
  color: #ffd9d5;
  background: linear-gradient(180deg, rgba(182, 61, 47, 0.18), rgba(182, 61, 47, 0.28));
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1;
  font-size: 0.78rem;
  font-weight: 700;
}
.backtest-duplicate {
  color: var(--sidebar-text);
  background: var(--sidebar-soft);
}
.control-group { display: grid; gap: 8px; }
.control-label, .topbar-label { color: var(--sidebar-muted); font-size: 0.84rem; }
.toggle-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.compact-row { min-width: 120px; }
.sidebar-bottom { margin-top: auto; }
.theme-group { padding-top: 10px; border-top: 1px solid var(--sidebar-line); }

.main-area { padding: 28px; overflow: auto; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  margin-bottom: 20px;
}
.topbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.topbar h2 { font-size: clamp(1.6rem, 2vw, 2.4rem); }

.tool-panel { display: none; }
.tool-panel.active { display: block; }
.hero {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface-strong) 94%, white 6%), var(--surface));
  box-shadow: var(--shadow);
}
.hero h2 { font-size: clamp(2.1rem, 2.8vw, 3.4rem); line-height: 0.98; }
.hero-title-row { display: flex; align-items: center; gap: 10px; }
.hidden { display: none !important; }
.inline-rename {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 44px;
  gap: 8px;
  align-items: center;
  flex:1 1 720px;
  width:min(720px, 100%);
  max-width: 100%;
}
.inline-rename input {
  min-width:220px;
  width:auto;
  max-width:100%;
  field-sizing:content;
}
.confirm-button {
  padding: 8px 10px;
  color: var(--sidebar-text);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border: 0;
}
.hero-copy { max-width: 66ch; margin: 18px 0 0; color: var(--muted); line-height: 1.6; }
.backtest-strategy-note {
  display: block;
  width: 100%;
  min-height: 46px;
  margin-top: 14px;
  padding: 11px 13px;
  overflow: hidden;
  resize: none;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.stat-card, .panel, .attribute-group-card, .selection-group, .trade-item, .preview-card, .insight-card, .analysis-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  padding: 16px;
}
.stat-label { display: block; color: var(--muted); font-size: 0.84rem; }
.stat-value { display: block; margin-top: 6px; font-size: 1.9rem; font-weight: 700; }

.subtabs {
  display: flex;
  gap: 12px;
  margin: 20px 0;
}
.subtab-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 18px;
  background: color-mix(in srgb, var(--surface-strong) 72%, transparent 28%);
  color: var(--muted);
  cursor: pointer;
}
.subtab-button.active { background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: #fff; }
.subpanel { display: none; }
.subpanel.active { display: block; }

.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.lower-grid, .chart-grid { margin-top: 20px; }
.chart-grid { grid-template-columns: 1.2fr 0.8fr; }
.panel { padding: 24px; box-shadow: var(--shadow); }
#backtestEditorPanel.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
}
#backtestEditorPanel > .content-grid {
  display: contents;
}
#backtestEditorPanel > .lower-grid {
  margin-top: 0;
}
.backtest-attributes-panel {
  grid-column: 1 / -1;
  order: 1;
}
.backtest-settings-panel {
  order: 2;
}
.backtest-trade-panel {
  order: 3;
}
#backtestEditorPanel > .panel {
  grid-column: 1 / -1;
  order: 4;
}
.helper-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
.ai-output .empty-state {
  text-align: left;
  white-space: pre-wrap;
}
.full-width { margin-top: 20px; }
.full-width-panel { grid-column: 1 / -1; }
.panel-header { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 22px; }
.sidebar-brand { display:flex; align-items:center; gap:0; margin:0 0 14px; }
.journal-sidebar-section { padding-top:0; padding-bottom:12px; margin-bottom:12px; border-bottom:1px solid var(--sidebar-line); }
#renameRulesButton { display:none; }
.journal-sidebar-section .backtest-card-actions { display:none; }
.daily-quote { display:grid; grid-template-columns:22px minmax(0,1fr); column-gap:7px; align-items:center; width:min(520px,48vw); margin-right:auto; padding-left:4px; }
.daily-quote-mark { grid-row:span 2; align-self:start; color:var(--accent); font:700 1.65rem/1 Georgia,serif; }
.daily-quote p { overflow:hidden; margin:0; color:var(--text); font-size:.74rem; font-style:italic; line-height:1.25; text-overflow:ellipsis; white-space:nowrap; }
.daily-quote-author { color:var(--muted); font-size:.66rem; font-weight:650; }
@media (max-width:760px) { .daily-quote { display:none; } }
.journal-sidebar-section .backtest-card { padding:0; border:1px solid var(--sidebar-line); border-radius:12px; background:linear-gradient(135deg,rgba(49,185,255,.12),rgba(255,255,255,.035)); overflow:hidden; }
.journal-sidebar-section .backtest-card-copy { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:10px; width:100%; min-height:58px; padding:12px 14px; text-align:left; color:var(--sidebar-text); cursor:pointer; }
.journal-sidebar-section .backtest-card-copy:has(.sidebar-nav-icon) { grid-template-columns:20px minmax(0,1fr); }
.journal-sidebar-section .backtest-card-title { font-size:.9rem; font-weight:720; }
.journal-sidebar-section .backtest-card-title { text-decoration:underline; text-underline-offset:2px; }
.journal-card-hint { display:inline-flex; align-items:center; gap:7px; color:var(--sidebar-muted); font-size:.7rem; font-weight:650; }
.journal-card-hint span { color:var(--accent); font-size:1rem; transition:transform 140ms ease; }
.journal-sidebar-section .backtest-card:hover,.journal-sidebar-section .backtest-card:focus-within { border-color:color-mix(in srgb,var(--accent) 65%,var(--sidebar-line)); background:linear-gradient(135deg,rgba(49,185,255,.2),rgba(255,255,255,.055)); }
.journal-sidebar-section .backtest-card:hover .journal-card-hint span,.journal-sidebar-section .backtest-card:focus-within .journal-card-hint span { transform:translateX(3px); }
.journal-sidebar-section .backtest-card.active { box-shadow:inset 3px 0 var(--accent),0 8px 18px rgba(0,0,0,.16); }

/* Research checklist: a compact, legible progression instead of a split card wall. */
.onboarding-panel { display:block !important; padding:0 !important; overflow:hidden; border-color:color-mix(in srgb,var(--accent) 22%,var(--line)); background:var(--surface-strong); }
.onboarding-panel.hidden { display:none !important; }
.onboarding-panel > summary { min-height:58px; padding:0 var(--space-5); background:linear-gradient(90deg,color-mix(in srgb,var(--accent-soft) 52%,var(--surface-strong)),var(--surface-strong)); border-bottom:1px solid var(--line); font-size:.9rem; }
.onboarding-panel > summary small { display:inline-flex; align-items:center; min-height:25px; padding:0 10px; border:1px solid color-mix(in srgb,var(--accent) 30%,var(--line)); border-radius:999px; background:var(--surface-strong); color:var(--accent-strong); font-variant-numeric:tabular-nums; }
.onboarding-content { display:block !important; padding:var(--space-5) !important; }
.onboarding-intro { display:grid; grid-template-columns:minmax(0,1fr) minmax(230px,.8fr); gap:var(--space-5); align-items:end; margin-bottom:var(--space-5); }
.onboarding-intro .panel-kicker { margin:0 0 4px; }
.onboarding-panel h2 { margin:0; font-size:clamp(1.3rem,2vw,1.75rem); line-height:1.12; letter-spacing:-.035em; }
.onboarding-intro > p:last-child { max-width:44ch; margin:0; padding-left:var(--space-4); border-left:2px solid var(--accent); color:var(--muted); font-size:.82rem; line-height:1.55; }
.onboarding-checklist { display:grid !important; grid-template-columns:repeat(3,minmax(0,1fr)) !important; gap:10px !important; }
.onboarding-checklist li { grid-template-columns:34px minmax(0,1fr) !important; min-height:118px; padding:14px !important; border-radius:10px; background:var(--surface-subtle); transition:border-color 140ms ease,background 140ms ease,transform 140ms ease; }
.onboarding-checklist li:hover { border-color:color-mix(in srgb,var(--accent) 38%,var(--line)); transform:translateY(-1px); }
.onboarding-checklist li.current { background:linear-gradient(145deg,color-mix(in srgb,var(--accent-soft) 82%,var(--surface-strong)),var(--surface-strong)); border-color:var(--accent); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 20%,transparent); }
.onboarding-check { width:34px !important; height:34px !important; border-radius:9px !important; font-size:.76rem; }
.onboarding-checklist strong { font-size:.82rem; line-height:1.3; }
.onboarding-checklist p { font-size:.74rem; line-height:1.45; }
@media (max-width:900px) { .onboarding-intro { grid-template-columns:1fr; gap:var(--space-3); }.onboarding-intro > p:last-child { padding-left:var(--space-3); }.onboarding-checklist { grid-template-columns:repeat(2,minmax(0,1fr)) !important; } }
@media (max-width:560px) { .onboarding-panel > summary,.onboarding-content { padding-left:var(--space-4) !important; padding-right:var(--space-4) !important; }.onboarding-checklist { grid-template-columns:1fr !important; }.onboarding-checklist li { min-height:0; } }
.brand-logo { display:block; width:38px; height:38px; object-fit:contain; flex:0 0 auto; }
.sidebar-brand .sidebar-eyebrow { margin:0; color:#edf5fb; font-size:.72rem; letter-spacing:.1em; white-space:nowrap; background:linear-gradient(90deg,#4bdcff 0%,#22b8ff 22%,#0757ca 50%,#22b8ff 78%,#4bdcff 100%); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }

/* Journal cockpit */
.journal-command {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--surface-strong) 96%, var(--accent) 4%), var(--surface));
  box-shadow: var(--shadow);
}
.journal-command::after { content: ""; position: absolute; width: 360px; height: 360px; right: -190px; top: -210px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 13%, transparent); pointer-events: none; }
.journal-command-head { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.journal-command h2 { margin: 0; font: 700 clamp(2rem, 4vw, 3.2rem)/1 Georgia, serif; text-transform: capitalize; }
.journal-month-summary { margin: 10px 0 0; color: var(--muted); }
.calendar-nav { display: flex; align-items: center; gap: 8px; }
.calendar-nav-button, .calendar-today-button { width: auto; min-width: 44px; min-height: 44px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-strong); color: var(--text); cursor: pointer; }
.calendar-today-button { font-weight: 700; }
.journal-pulse { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 24px 0; }
.journal-pulse article { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: color-mix(in srgb, var(--surface-strong) 74%, transparent); }
.journal-pulse span, .journal-pulse small { color: var(--muted); font-size: .78rem; }
.journal-pulse strong { font-size: 1.45rem; letter-spacing: -.04em; }
.positive-text { color: var(--good) !important; }
.negative-text { color: var(--bad) !important; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calendar-weekdays { margin-bottom: 7px; }
.calendar-weekdays span { padding: 0 8px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.calendar-day { position: relative; display: flex; flex-direction: column; align-items: flex-start; min-height: 112px; padding: 11px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--surface-strong) 70%, transparent); color: var(--text); text-align: left; cursor: pointer; transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.calendar-day:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 52%, var(--line)); }
.calendar-day.outside { opacity: .34; }
.calendar-day.today .calendar-date { display: grid; place-items: center; width: 25px; height: 25px; margin: -4px 0 2px -4px; border-radius: 50%; background: var(--accent); color: white; }
.calendar-day.selected { outline: 2px solid color-mix(in srgb, var(--accent) 72%, transparent); outline-offset: 1px; }
.calendar-day.profitable { background: linear-gradient(155deg, color-mix(in srgb, var(--good) 14%, var(--surface-strong)), var(--surface)); }
.calendar-day.losing { background: linear-gradient(155deg, color-mix(in srgb, var(--bad) 14%, var(--surface-strong)), var(--surface)); }
.calendar-date { font-weight: 800; font-size: .78rem; }
.calendar-day strong { margin-top: auto; font-size: 1rem; }
.calendar-day small { color: var(--muted); font-size: .7rem; }
.calendar-day i { width: 100%; overflow: hidden; color: var(--muted); font-size: .67rem; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.calendar-note-mark { position: absolute; top: 9px; right: 10px; color: var(--accent); font-size: .85rem; }
.calendar-day.has-note:not(.profitable):not(.losing) { background: linear-gradient(155deg, color-mix(in srgb, var(--accent) 10%, var(--surface-strong)), var(--surface)); }
.note-only-label { width: 100%; overflow: hidden; color: var(--accent-strong); font-size: .78rem !important; text-overflow: ellipsis; white-space: nowrap; }
.day-empty { margin: auto; opacity: 0; font-size: 1.5rem; color: var(--accent); transition: opacity .18s; }
.calendar-day:hover .day-empty { opacity: .7; }
.journal-workspace { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .7fr); gap: 20px; margin-top: 20px; }
.journal-side-stack { display: grid; align-content: start; gap: 20px; }
.capture-status { padding: 7px 11px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent-strong); font-size: .78rem; font-weight: 700; text-transform: capitalize; }
.three-column { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.money-input { position: relative; }
.money-input > span { position: absolute; left: 14px; top: 50%; z-index: 1; transform: translateY(-50%); color: var(--muted); }
.money-input input { padding-left: 32px; }
.journal-quality-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.quality-field { grid-template-columns: 1fr auto; align-items: center; }
.quality-field span { grid-column: 1 / -1; }
.quality-field input { padding: 0; accent-color: var(--accent); }
.quality-field output { min-width: 46px; color: var(--accent-strong); font-weight: 800; }
.upload-button input { padding: 10px; }
.upload-button small { display: none; }
.journal-discipline { border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.journal-discipline summary, .rules-compact-panel summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-weight: 800; }
.journal-discipline[open] summary { margin-bottom: 18px; }
.journal-discipline .rule-checklist { gap: 14px; }
.journal-discipline .trade-check-item { padding: 17px 18px; }
.journal-discipline .trade-preview { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.journal-discipline .preview-card { padding: 18px; }
.journal-save-button { min-height: 54px; font-weight: 800; letter-spacing: .01em; }
.day-focus-total { margin-bottom: 12px; font-size: 2.5rem; font-weight: 800; letter-spacing: -.06em; }
.day-focus-list { display: grid; gap: 8px; }
.day-focus-list button { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.day-focus-list span { display: grid; min-width: 0; }
.day-focus-list small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-focus-empty { padding: 20px 4px 8px; color: var(--muted); text-align: center; }
.day-focus-empty > span { font-size: 2rem; color: var(--accent); }
.day-focus-empty h3 { margin-bottom: 4px; color: var(--text); }
.day-focus-empty p { margin: 0; line-height: 1.5; }
.journal-note-form { display: grid; gap: 12px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.journal-note-form textarea { min-height: 118px; resize: vertical; }
.journal-category-creator { display: grid; grid-template-columns: minmax(0, 1fr) minmax(108px, 132px); gap: 8px; align-items: stretch; }
.journal-category-creator .ghost-button { width: 100%; max-width: none; min-height: 48px; padding: 8px 10px; overflow: visible; white-space: normal; line-height: 1.2; text-overflow: clip; }
.journal-category-list { display: flex; flex-wrap: wrap; gap: 6px; }
.journal-category-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 7px 6px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent-strong); font-size: .75rem; font-weight: 700; }
.journal-category-chip button { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--accent) 14%, transparent); color: inherit; cursor: pointer; }
.journal-note-actions { display: flex; justify-content: flex-end; gap: 8px; }
.calendar-notes-list { display: grid; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.calendar-notes-list h3 { margin: 0 0 3px; font: 700 1rem Georgia, serif; }
.calendar-notes-list article { display: grid; grid-template-columns: minmax(0, 1fr) 34px; gap: 7px; padding: 11px; border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line)); border-radius: 14px; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.calendar-note-copy { display: grid; gap: 4px; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.journal-note-category { justify-self: start; padding: 3px 7px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent-strong); font-size: .68rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.calendar-note-copy p { margin: 4px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.calendar-note-delete { align-self: start; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.calendar-note-delete:hover { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 38%, var(--line)); }
.rules-compact-panel details > summary span:first-child { display: grid; }
.rules-compact-panel summary small { color: var(--accent-strong); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; }
.rules-compact-panel summary strong { margin-top: 4px; font: 700 1.35rem Georgia, serif; }
.compact-rule-form { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.rules-compact-panel .rules-list { margin-top: 14px; }
.journal-ledger .panel-header { align-items: center; }
.ledger-filter { width: min(360px, 100%); }
.ledger-filter input { padding-block: 11px; }
.ledger-tabs { display: flex; gap: 8px; margin: -4px 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.ledger-tab { display: inline-flex; align-items: center; gap: 8px; width: auto; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.ledger-tab span { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 10%, transparent); font-size: .72rem; }
.ledger-tab.active { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent-strong); }
.history-note-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 18px; align-items: start; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: color-mix(in srgb, var(--surface-strong) 72%, transparent); }
.history-note-date { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .78rem; }
.history-note-date b { justify-self: start; padding: 4px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent-strong); font-size: .68rem; text-transform: uppercase; }
.history-note-copy { grid-column: 1 / -1; min-width: 0; padding-top: 14px; border-top: 1px solid var(--line); }
.history-note-copy h3 { margin: 0 0 10px; font: 700 1.18rem Georgia, serif; }
.history-note-copy p { margin: 0; color: var(--text); font-size: .94rem; line-height: 1.68; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-note-actions { display: flex; gap: 7px; }
.history-note-actions .ghost-button:first-child { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent-strong); }
.pnl-positive { color: var(--good); background: color-mix(in srgb, var(--good) 11%, transparent); }
.pnl-negative { color: var(--bad); background: color-mix(in srgb, var(--bad) 11%, transparent); }
.quality-badge { color: #d69827; font-weight: 700; letter-spacing: .05em; }

label, .date-field { display: grid; gap: 8px; color: var(--muted); font-size: 0.94rem; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 15px;
  background: color-mix(in srgb, var(--surface-strong) 84%, transparent 16%);
  color: var(--text);
}
#backtestPotentialTicks::-webkit-outer-spin-button,
#backtestPotentialTicks::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
#backtestPotentialTicks {
  appearance: textfield;
  -moz-appearance: textfield;
}
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(240, 138, 75, 0.22); border-color: rgba(240, 138, 75, 0.55); }
.voice-input-wrap { position: relative; display: block; width: 100%; }
.voice-input-wrap textarea { padding-right: 112px; }
.voice-input-button { position: absolute; right: 9px; bottom: 9px; z-index: 2; display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: auto; min-height: 34px; padding: 6px 10px; border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line)); border-radius: 999px; background: color-mix(in srgb, var(--surface-strong) 94%, transparent); color: var(--accent-strong); font-size: .74rem; font-weight: 800; cursor: pointer; box-shadow: 0 5px 14px rgba(0, 0, 0, .08); }
.voice-input-button:hover { border-color: color-mix(in srgb, var(--accent) 58%, var(--line)); background: color-mix(in srgb, var(--accent) 9%, var(--surface-strong)); }
.voice-input-button.recording { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, var(--surface-strong)); color: var(--bad); animation: voice-pulse 1.25s ease-in-out infinite; }
.voice-input-button.recording span:first-child { animation: voice-blink .8s ease-in-out infinite alternate; }
@keyframes voice-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--bad) 12%, transparent); } }
@keyframes voice-blink { to { opacity: .42; } }
.backtest-strategy-note.voice-input-wrap textarea, .voice-input-wrap .backtest-strategy-note { padding-right: 112px; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.field-label {
  display: block;
  color: var(--muted);
  font-size: 0.94rem;
  margin-bottom: 8px;
}

.tp-stepper-block {
  display: block;
}

.tp-stepper {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  gap: 10px;
  align-items: center;
}

.tp-stepper input {
  text-align: center;
  font-weight: 700;
}

.dynamic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.config-subsection {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface-strong) 62%, transparent 38%);
}
.subsection-header {
  display: grid;
  gap: 4px;
}
.subsection-header h3 {
  margin: 0;
  font-size: 1.02rem;
}
.is-disabled {
  opacity: 0.48;
}
.is-disabled input,
.is-disabled select,
.is-disabled textarea {
  cursor: not-allowed;
}
.date-toggle-row.is-disabled,
.config-subsection.is-disabled {
  background: color-mix(in srgb, var(--surface) 88%, transparent 12%);
  border-color: color-mix(in srgb, var(--line) 78%, transparent 22%);
}
.date-toggle-row.is-disabled input[type="date"],
.config-subsection.is-disabled input {
  background: color-mix(in srgb, var(--surface) 92%, transparent 8%);
}

.primary-button, .ghost-button {
  border: 0;
  border-radius: 16px;
  padding: 13px 16px;
  cursor: pointer;
  transition: 180ms ease;
}
.secondary-button {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 16px;
  cursor: pointer;
  transition: 180ms ease;
  background: color-mix(in srgb, var(--surface-strong) 72%, transparent 28%);
  color: var(--text);
}
.primary-button { background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: #fff; font-weight: 700; }
.ghost-button { background: rgba(182, 61, 47, 0.12); color: var(--bad); }
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  min-width: 44px;
  max-width: 124px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1;
}
.date-toggle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
.date-step-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.date-step-button {
  width: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 1.25rem;
}
.compact-toggle {
  min-height: 42px;
  padding: 0 12px;
}
.compact-toggle span {
  font-size: 0.86rem;
}
.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-strong) 78%, transparent 22%);
  color: var(--text);
  white-space: nowrap;
  justify-self: end;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.inline-toggle:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--surface-strong) 68%, var(--accent) 8%);
}
.inline-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}
.inline-toggle span {
  font-weight: 600;
  color: var(--muted);
}
.toggle-field {
  align-content: start;
}
.toggle-field > .inline-toggle {
  justify-self: start;
}
.lot-rounding-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.lot-rounding-field legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}
.lot-rounding-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.lot-rounding-options label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}
.lot-rounding-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.lot-rounding-options span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-strong) 78%, transparent 22%);
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}
.lot-rounding-options input:checked + span {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-strong));
  color: var(--accent-strong);
}
.lot-rounding-options input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.is-disabled .lot-rounding-options label {
  pointer-events: none;
}
.outcome-field {
  display: grid;
  align-content: start;
}
.outcome-checkbox-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.outcome-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-strong) 78%, transparent 22%);
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.outcome-checkbox:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--surface-strong) 68%, var(--accent) 8%);
}
.outcome-checkbox input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
}
.outcome-checkbox span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}
.outcome-checkbox:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-strong) 82%);
  color: var(--text);
}
.outcome-checkbox.is-selected {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-strong) 82%);
  color: var(--text);
}
.research-workflow-panel .setup-section:nth-of-type(3) { display:none; }
.config-subsection .toggle-field { align-items:center; }
.config-subsection .helper-text { margin:0; }
.category-add-button { white-space:nowrap; box-shadow:0 6px 18px color-mix(in srgb, var(--accent) 22%, transparent); }
.icon-button { padding: 8px 10px; font-size: 0.9rem; }
.primary-button:hover, .ghost-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.danger-button { background: linear-gradient(135deg, var(--bad), color-mix(in srgb, var(--bad) 76%, #ffd0ca 24%)); }

.rule-item, .trade-item-header, .trade-check-item, .preview-row, .attribute-group-header, .selection-group-header, .analysis-header, .analysis-row, .rule-actions, .trade-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.rule-meta h3, .trade-title, .insight-card h3, .analysis-card h3 { margin: 0; font-size: 1rem; }
.rule-meta p, .trade-item p, .insight-card p, .analysis-card p, .empty-state p, .selection-group p, .attribute-group-card p { margin: 6px 0 0; color: var(--muted); }
.rule-actions, .trade-meta { flex-wrap: wrap; }
.draggable-group {
  transition: border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}
.draggable-group.dragging {
  opacity: 0.58;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 18px 38px rgba(31, 24, 19, 0.16);
}
.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-strong);
  cursor: grab;
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
}
.rule-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
}
.rule-meta {
  min-width: 0;
}
.rule-meta h3 {
  display: -webkit-box;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-clamp: 3;
  max-height: calc(1.35em * 3);
  line-height: 1.35;
  word-break: break-word;
}
.rule-actions {
  display: grid;
  grid-template-columns: max-content 42px max-content;
  align-items: center;
  justify-content: end;
  gap: 10px;
  flex-wrap: nowrap;
}
.rule-actions .ghost-button {
  min-width: 42px;
  padding-inline: 12px;
}
.points-pill {
  max-width: 100%;
  white-space: nowrap;
}
.points-pill, .status-pill, .metric-chip {
  border-radius: 999px;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 0.86rem;
}
.points-pill, .metric-chip { background: color-mix(in srgb, var(--surface-strong) 60%, transparent 40%); color: var(--accent-strong); }
.status-pill.positive { background: rgba(27, 127, 91, 0.16); color: var(--good); }
.status-pill.negative { background: rgba(182, 61, 47, 0.16); color: var(--bad); }
.attribute-items, .selection-items, .analysis-rows, .trade-rules, .trade-attributes { display: flex; flex-wrap: wrap; gap: 10px; }
.attribute-chip, .selection-chip, .attribute-badge, .trade-rule-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 60%, transparent 40%);
  color: var(--text);
  font-size: 0.84rem;
}
.selection-chip {
  cursor: pointer;
  border: 1px solid var(--line);
  appearance: none;
  font: inherit;
}
.selection-chip.is-selected,
.selection-chip[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-strong));
  color: var(--accent-strong);
}
.selection-box {
  width: 18px;
  height: 18px;
  border: 1px solid color-mix(in srgb, var(--muted) 58%, var(--line));
  border-radius: 5px;
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--surface);
}
.selection-chip.is-selected .selection-box,
.selection-chip[aria-pressed="true"] .selection-box {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  box-shadow: inset 0 0 0 4px var(--surface);
}
.selection-label {
  line-height: 1.2;
}
.selection-chip input, .checkbox-wrap input { width: 18px; height: 18px; margin: 0; }
.selection-chip span { pointer-events: none; }
.attribute-badge strong { color: var(--accent-strong); }
.editable-attribute-badge {
  padding-right: 8px;
}
.editable-attribute-badge select {
  min-width: 96px;
  max-width: 190px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 2px 22px 2px 2px;
}
.editable-attribute-badge select option {
  background: #ffffff;
  color: #111111;
}
.editable-attribute-badge select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 62%, transparent);
  outline-offset: 2px;
}
.editable-number-badge input {
  width: 82px;
  min-height: 28px;
  padding: 3px 7px;
  border: 0;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 86%, transparent 14%);
  color: var(--text);
  font: inherit;
  font-weight: 700;
}
.editable-number-badge input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 62%, transparent);
  outline-offset: 2px;
}
.trade-date-input,
.trade-outcome-select {
  display: inline-block;
  width: auto;
  padding: 3px 7px;
  border-radius: 10px;
  font-size: 0.9rem;
  color-scheme: dark;
}
.trade-date-input {
  min-width: 138px;
}
.trade-outcome-select {
  min-width: 94px;
}
.trade-outcome-select option {
  background: #ffffff;
  color: #111111;
}
.trade-rule-chip.missed { background: rgba(182, 61, 47, 0.12); color: var(--bad); }
.trade-rule-chip.hit { background: rgba(27, 127, 91, 0.14); color: var(--good); }
.trade-check-item { padding: 14px 16px; border-radius: 18px; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface-strong) 72%, transparent 28%); }
.checkbox-wrap { display: flex; gap: 12px; align-items: center; }
.preview-card { background: linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 88%, transparent 12%), var(--surface)); }
.preview-total { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; font-weight: 700; }
.trade-item { display: grid; gap: 12px; }
.trade-item[data-toggle-rules-trade] { cursor: pointer; }
.backtest-trade-item,
.backtest-trade-item .editable-attribute-badge {
  cursor: default;
}
.backtest-trade-item select {
  cursor: default;
}
.backtest-trade-item button {
  cursor: pointer;
}
.trade-item.expanded {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 78%, transparent 22%), var(--surface));
}
.trade-main {
  display: grid;
  gap: 12px;
}
.trade-headline {
  display: flex;
  align-items: center;
  gap: 12px;
}
.trade-headline-copy {
  min-width: 0;
}
.trade-headline-copy p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trade-expand-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 60%, transparent 40%);
  color: var(--accent-strong);
  font-size: 1rem;
  flex-shrink: 0;
}
.trade-details {
  display: grid;
  gap: 14px;
  padding-top: 4px;
}
.trade-gallery {
  display: grid;
  gap: 12px;
}
.trade-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.trade-thumb {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface-strong) 78%, transparent 22%);
  cursor: pointer;
  padding: 0;
}
.trade-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.trade-thumb-caption {
  display: block;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
}
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 14, 0.76);
  backdrop-filter: blur(10px);
}
.lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 18px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 88%, #000 12%);
  box-shadow: 0 32px 70px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 14px;
}
.lightbox-toolbar,
.lightbox-actions,
.lightbox-content {
  display: flex;
  align-items: center;
  gap: 12px;
}
.lightbox-toolbar {
  justify-content: space-between;
}
.lightbox-counter {
  margin: 0;
  color: var(--text);
  font-weight: 700;
}
.lightbox-button,
.lightbox-nav {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 70%, transparent 30%);
  color: var(--text);
}
.lightbox-content {
  min-height: 0;
}
.lightbox-stage {
  flex: 1;
  min-height: min(70vh, 720px);
  display: grid;
  place-items: center;
  overflow: auto;
  border-radius: 22px;
  background:
    radial-gradient(circle at top, rgba(240, 138, 75, 0.15), transparent 28%),
    color-mix(in srgb, var(--surface) 78%, #000 22%);
}
.lightbox-stage img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 140ms ease;
}
.lightbox-nav {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  font-size: 1.6rem;
  cursor: pointer;
  flex-shrink: 0;
}
.lightbox-nav:disabled {
  opacity: 0.4;
  cursor: default;
}
.chart-stage { position: relative; width: 100%; min-height: 360px; border-radius: 20px; overflow: hidden; background: linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 86%, transparent 14%), var(--surface)); }
.optimizer-chart-stage { margin-top: 16px; }
.chart-subheader { display: grid; gap: 4px; padding: 16px 18px 0; }
.chart-subheader h3,
.chart-subheader p { margin: 0; }
.chart-subheader p { color: var(--muted); font-size: 0.92rem; }
.chart-tooltip {
  position: absolute;
  z-index: 8;
  min-width: 190px;
  max-width: 240px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 94%, #000000 6%);
  box-shadow: var(--shadow);
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.chart-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}
.chart-tooltip strong,
.chart-tooltip span,
.chart-tooltip small {
  display: block;
}
.chart-tooltip strong {
  color: var(--accent-strong);
  font-size: 1rem;
}
.chart-tooltip span {
  margin-top: 4px;
  font-weight: 700;
}
.chart-tooltip small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}
canvas { width: 100%; height: auto; display: block; }
.empty-state { padding: 22px; border-radius: 20px; border: 1px dashed var(--line); background: color-mix(in srgb, var(--surface-strong) 68%, transparent 32%); text-align: center; }
.analysis-table { display: grid; gap: 10px; }
.analysis-row { padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--surface-strong) 72%, transparent 28%); }
.analysis-row-title { font-weight: 700; }
.analysis-row-meta { color: var(--muted); font-size: 0.9rem; }
.chart-filter-summary,
.attribute-subcharts {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}
.attribute-chart-panel {
  padding: 20px;
}
.attribute-bars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.attribute-bar-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-strong) 74%, transparent 26%);
}
.attribute-bar-card.muted {
  opacity: 0.68;
}
.attribute-bar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}
.attribute-bar-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}
.attribute-bar-stage {
  display: flex;
  align-items: end;
  min-height: 150px;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 82%, transparent 18%), color-mix(in srgb, var(--surface) 80%, transparent 20%));
  border: 1px dashed var(--line);
}
.attribute-bar {
  width: 100%;
  min-height: 16px;
  border-radius: 14px 14px 8px 8px;
  background: linear-gradient(180deg, var(--good), color-mix(in srgb, var(--good) 68%, #ffffff 32%));
  box-shadow: inset 0 -8px 18px rgba(0, 0, 0, 0.12);
}
.attribute-bar.negative {
  background: linear-gradient(180deg, var(--bad), color-mix(in srgb, var(--bad) 70%, #ffffff 30%));
}
.attribute-bar.muted {
  background: linear-gradient(180deg, color-mix(in srgb, var(--muted) 86%, #9aa8b2 14%), color-mix(in srgb, var(--muted) 62%, #d7dde2 38%));
}
.attribute-bar-label {
  font-weight: 700;
  font-size: 1rem;
}
.attribute-bar-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
}
.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 12, 16, 0.46);
  backdrop-filter: blur(6px);
}
.confirm-dialog {
  position: relative;
  z-index: 1;
  width: min(92vw, 460px);
  margin: 16vh auto 0;
  padding: 24px;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 92%, transparent 8%), var(--surface));
  box-shadow: var(--shadow);
}
.confirm-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
.confirm-actions {
  display: flex;
  justify-content: end;
  gap: 12px;
  margin-top: 22px;
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .hero, .content-grid, .chart-grid { grid-template-columns: 1fr; }
  .journal-workspace { grid-template-columns: 1fr; }
  .journal-pulse { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #backtestEditorPanel.active { grid-template-columns: 1fr; }
  .backtest-attributes-panel,
  .backtest-settings-panel,
  .backtest-trade-panel,
  #backtestEditorPanel > .panel {
    grid-column: 1 / -1;
  }
}
@media (max-width: 720px) {
  .main-area { padding: 16px; }
  .topbar, .hero, .panel { padding: 18px; border-radius: 22px; }
  .two-column { grid-template-columns: 1fr; }
  .voice-input-label { display: none; }
  .voice-input-wrap textarea { padding-right: 54px; }
  .three-column, .journal-quality-row { grid-template-columns: 1fr; }
  .journal-command { padding: 18px; border-radius: 22px; }
  .journal-command-head { align-items: stretch; flex-direction: column; }
  .calendar-nav { justify-content: space-between; }
  .calendar-day { min-height: 74px; padding: 7px; border-radius: 11px; }
  .calendar-day i, .calendar-day small { display: none; }
  .calendar-day strong { font-size: .72rem; }
  .journal-pulse { grid-template-columns: 1fr 1fr; }
  .journal-pulse article { padding: 12px; }
  .journal-ledger .panel-header { align-items: stretch; flex-direction: column; }
  .journal-category-creator { grid-template-columns: 1fr; }
  .history-note-card { grid-template-columns: 1fr; gap: 10px; }
  .history-note-actions { width: 100%; }
  .ledger-filter { width: 100%; }
  .dynamic-grid,
  .topbar, .topbar-actions, .rule-item, .trade-check-item, .preview-row, .attribute-group-header, .selection-group-header, .analysis-header, .analysis-row, .trade-item-header, .backtest-card-row {
    flex-direction: column;
    align-items: start;
  }
  .rule-item {
    grid-template-columns: 1fr;
  }
  .rule-actions {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) 42px max-content;
    justify-content: start;
  }
  .trade-headline,
  .lightbox-toolbar,
  .lightbox-content {
    align-items: stretch;
  }
  .lightbox-content {
    flex-direction: column;
  }
  .lightbox-nav {
    width: 100%;
  }
}
.auth-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--background, #f4f6f8); }
.auth-gate.hidden { display: none; }
.auth-card { width: min(440px, 100%); display: grid; gap: 16px; padding: 32px; border-radius: 20px; background: var(--panel, #fff); box-shadow: 0 18px 55px rgba(25, 36, 50, .14); }
.auth-card label { display: grid; gap: 7px; font-weight: 650; }
.auth-card input { width: 100%; }
.auth-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.auth-status { min-height: 1.4em; margin: 0; color: var(--muted, #657080); }
.auth-status.error { color: #b42318; }
.cloud-status { font-size: .82rem; color: var(--muted, #657080); }
.cloud-status[data-state="saving"] { color: #8a5b00; }
.cloud-status[data-state="failed"] { color: #b42318; font-weight: 700; }
.cloud-status[data-state="saved"] { color: #18794e; }
.history-limit-notice { padding: 10px 14px; border-radius: 10px; background: rgba(99, 112, 128, .09); color: var(--muted, #657080); font-size: .85rem; }
.cloud-status[data-state="failed"] { color: #b42318; font-weight: 700; }
.cloud-status[data-state="saving"] { color: #8a5a00; }
.oauth-actions { display: grid; gap: .65rem; }
.oauth-divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .8rem; }
.oauth-divider::before, .oauth-divider::after { content: ""; height: 1px; background: var(--border); flex: 1; }
.oauth-button { width: 100%; }
.research-workflow-panel { margin-bottom: 1rem; }
.research-flow { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.research-flow span { border: 1px solid var(--border); border-radius: 999px; padding: .35rem .65rem; font-size: .78rem; }
.research-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(210px,1fr)); gap: .8rem; }
.research-grid textarea { min-height: 5rem; }
.research-actions { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; margin-top: .8rem; }
.research-list { margin: .75rem 0 0; padding-left: 1.2rem; }
.research-progress { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: .75rem; color: var(--muted); }
.phase6-report { display: grid; gap: 1rem; margin-top: 1rem; }
.report-nav { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; gap: .5rem; padding: .75rem; border: 1px solid var(--border); border-radius: 16px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); }
.report-nav a { padding: .4rem .7rem; border-radius: 999px; color: inherit; text-decoration: none; font-size: .82rem; font-weight: 700; }
.report-nav a:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.report-section { scroll-margin-top: 5rem; }
.report-metrics { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: .7rem; margin: .75rem 0; }
.report-metrics article { display: grid; gap: .3rem; padding: .85rem; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface) 88%, transparent); }
.report-metrics span { color: var(--muted); font-size: .78rem; }
.report-metrics strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
.report-note { margin: .8rem 0; color: var(--muted); }
.report-table-wrap { max-height: 440px; overflow: auto; border: 1px solid var(--border); border-radius: 14px; }
.report-table { width: 100%; border-collapse: collapse; font-size: .84rem; font-variant-numeric: tabular-nums; }
.report-table th,.report-table td { padding: .65rem .7rem; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.report-table th:first-child,.report-table td:first-child { text-align: left; }
.report-table thead { position: sticky; top: 0; background: var(--surface); }
.report-table small { color: #c47d00; }
.report-section h3 { margin: 1.2rem 0 .55rem; }
.scenario-actions { display:flex; flex-wrap:wrap; gap:.55rem; margin-top:.7rem; }
.scenario-save { display:flex; align-items:end; flex-wrap:wrap; gap:.65rem; margin-top:.8rem; }
.scenario-save label { display:grid; gap:.35rem; min-width:min(100%,260px); }
@media (max-width:720px) { .report-table-wrap { max-width: calc(100vw - 68px); } }
.research-context { display:flex; flex-wrap:wrap; gap:.45rem; align-items:center; margin-bottom:.8rem; }
.research-context span, .research-context strong { border:1px solid var(--border); border-radius:999px; padding:.35rem .65rem; font-size:.82rem; }
.research-context strong { background:var(--accent); color:#fff; border-color:transparent; }
.research-workflow-panel { margin-top:1rem; }
.backtest-workflow-overview { margin:1.25rem 0; }
.workflow-overview-header { display:grid; grid-template-columns:minmax(220px,.8fr) minmax(280px,1.2fr); gap:1.5rem; align-items:end; margin-bottom:1rem; }
.workflow-overview-header h3 { margin:0; font-size:1.15rem; }
.workflow-overview-header p { margin:0; color:var(--muted); font-size:.8rem; }
.workflow-step-list { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.75rem; margin:0; padding:0; list-style:none; }
.workflow-step-list li { display:grid; grid-template-columns:30px minmax(0,1fr); gap:10px; padding:.75rem; border:1px solid var(--line,var(--border)); border-radius:12px; background:var(--surface-subtle,var(--surface)); }
.workflow-step-list li.current { border-color:var(--accent); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 18%,transparent); }
.workflow-step-list li.done { background:var(--accent-soft); }
.workflow-step-marker { display:grid; place-items:center; width:30px; height:30px; border-radius:50%; background:var(--surface-strong,var(--surface)); color:var(--muted); font-size:.76rem; font-weight:750; }
.workflow-step-list li.done .workflow-step-marker { background:var(--accent); color:#fff; }
.workflow-step-list strong { display:block; font-size:.82rem; }
.workflow-step-list p { margin:3px 0 0; color:var(--muted); font-size:.74rem; line-height:1.4; }
.research-context-heading { flex:1 0 100%; display:flex; align-items:baseline; gap:8px; padding:0 4px 4px; }
.research-context-heading small { color:var(--accent); font-size:.67rem; font-weight:750; letter-spacing:.1em; text-transform:uppercase; }
.research-context-heading b { font-size:.86rem; }
@media (max-width:900px) {
  .workflow-overview-header { grid-template-columns:1fr; gap:.5rem; }
  .workflow-step-list { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:520px) { .workflow-step-list { grid-template-columns:1fr; } }
.setup-section { border-top:1px solid var(--border); padding:.55rem 0; }
.setup-section > summary, .report-section > summary { cursor:pointer; list-style:none; font-weight:700; padding:.5rem 0; }
.setup-section > summary::-webkit-details-marker, .report-section > summary::-webkit-details-marker { display:none; }
.setup-section > summary::after, .report-section > summary::after { content:"＋"; float:right; }
.setup-section[open] > summary::after, .report-section[open] > summary::after { content:"−"; }
.report-section > summary span { display:grid; gap:.15rem; }
.report-section > summary small { color:var(--accent); letter-spacing:.08em; }
.report-section > summary em { font-weight:400; color:var(--muted); font-style:normal; }
.report-section-body { padding-top:1rem; }
.trade-context-fields { border:1px solid var(--border); border-radius:12px; padding:1rem; }
.three-column { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.8rem; }
.form-actions { display:flex; flex-wrap:wrap; gap:.65rem; }
.field-error { display:block; color:#b42318; font-size:.78rem; margin-top:.3rem; }
.field-error.hidden { display:none; }
[aria-invalid="true"] { border-color:#b42318 !important; box-shadow:0 0 0 2px rgba(180,35,24,.12); }

/* Validation messages use reserved space, so showing one never shifts adjacent fields. */
#backtestResearchPanel .research-grid > label,
.trade-context-fields .three-column > label {
  position:relative;
  align-self:start;
  padding-bottom:2.35em;
}
#backtestResearchPanel .research-grid > label > .field-error,
.trade-context-fields .three-column > label > .field-error {
  position:absolute;
  inset:auto 0 0;
  min-height:2.35em;
  margin:0;
  line-height:1.25;
  overflow:hidden;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
}
#backtestResearchPanel .research-grid > label > .field-error.hidden,
.trade-context-fields .three-column > label > .field-error.hidden { display:none; }

/* Stable cross-screen alignment for fields with current or future helper text. */
:where(.research-grid,.two-column,.three-column) > label:has(> input:not([type="checkbox"]):not([type="radio"]),> select,> textarea) {
  position:relative;
  align-self:start;
  min-width:0;
  padding-bottom:2.5em;
}
:where(.research-grid,.two-column,.three-column) > label:has(> input:not([type="checkbox"]):not([type="radio"]),> select,> textarea) > small:not(.optional-label) {
  position:absolute;
  inset:auto 0 0;
  min-height:2.35em;
  margin:0;
  color:var(--muted);
  line-height:1.25;
  overflow:hidden;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
}
:where(.research-grid,.two-column,.three-column) { align-items:start; }
:where(.research-grid,.two-column,.three-column) > * { min-width:0; }

/* Repeated cards keep values and optional descriptions on common baselines. */
.hero-stats > article,.report-metrics > article,.journal-pulse > article { align-content:start; min-width:0; }
.hero-stats .stat-label { min-height:1.4em; }
.report-metrics > article > span:first-child { min-height:2.5em; display:flex; align-items:flex-start; }
.journal-pulse > article > small:last-child { min-height:1.4em; }
.panel-header > *,.workflow-step-list li > div,.research-context > * { min-width:0; }
.workflow-step-list li { align-content:start; }
.optional-label { color:var(--muted); font-weight:400; font-size:.75rem; }
.category-config-list { display:grid; gap:.7rem; }
.category-config-list article { border:1px solid var(--border); border-radius:12px; padding:.8rem; }
.metric-help { width:.84rem; height:.84rem; margin-inline-start:.5rem; border-radius:50%; border:1px solid currentColor; background:transparent; color:inherit; font-size:.62rem; line-height:1; padding:0; cursor:help; vertical-align:middle; }
.scenario-actions { display:grid; gap:.6rem; }
.scenario-actions > span { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; border-bottom:1px solid var(--border); padding:.5rem 0; }
.scenario-actions small { flex:1 1 260px; }
.insight-editor { margin-top:1rem; display:grid; gap:.75rem; border:1px solid var(--border); border-radius:12px; padding:1rem; }
.report-table thead th { position:sticky; top:0; z-index:1; background:var(--surface); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline:3px solid color-mix(in srgb,var(--accent) 45%,transparent); outline-offset:2px; }

@media (max-width: 900px) { .three-column { grid-template-columns:1fr 1fr; } .research-context { position:sticky; top:0; z-index:5; background:var(--surface); padding:.5rem; } }
@media (max-width: 600px) { .three-column, .research-grid { grid-template-columns:1fr; } .report-nav { overflow-x:auto; flex-wrap:nowrap; } .report-metrics { grid-template-columns:1fr 1fr; } .form-actions > button { flex:1 1 100%; } }
.onboarding-panel { display:grid; grid-template-columns:minmax(240px,1.5fr) minmax(280px,1fr); gap:1rem; align-items:center; }

/* Phase 7.6 responsive rules stay last so premium overrides cannot undo them. */
@media (max-width:760px) {
  .sidebar {
    display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    align-items:start; gap:var(--space-3); padding:var(--space-3);
  }
  .sidebar-top { grid-column:1/-1; padding:0; }
  .sidebar-section { min-width:0; }
  .saved-list { display:flex; gap:6px; overflow-x:auto; padding-bottom:4px; }
  .backtest-card { flex:0 0 100%; min-width:0; }
  .backtest-card-actions { opacity:1; }
  .sidebar-bottom { grid-column:1/-1; }
  .theme-group { display:flex; align-items:center; justify-content:space-between; gap:var(--space-3); }
  .onboarding-panel { grid-template-columns:1fr; }
  .onboarding-panel > * { min-width:0; }
  .onboarding-panel ol { grid-template-columns:repeat(5,minmax(110px,1fr)); max-width:100%; overflow-x:auto; padding-bottom:4px; }
}
@media (max-width:460px) {
  .sidebar { overflow:hidden; }
  .saved-list { display:grid; overflow:visible; }
  .backtest-card-actions { flex-wrap:wrap; }
  .onboarding-panel ol { grid-template-columns:1fr; overflow:visible; }
  .topbar-actions { display:flex; flex-wrap:wrap; }
  .topbar-actions .cloud-status { flex:1 0 100%; }
  .topbar-actions > button,.topbar-actions > .account-menu { flex:1 1 calc(50% - 4px); }
  .account-menu > summary { width:42px; justify-content:center; padding:0; }
  .account-menu-panel { position:fixed; top:auto; right:12px; left:12px; width:auto; }
  .trade-save-actions { display:grid; grid-template-columns:1fr; }
  .trade-save-actions button { width:100%; }
}
.account-menu > summary { width:42px; justify-content:center; padding:0; }
.account-menu > summary::after { display:none; }
.account-menu-icon { width:19px; height:19px; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

.visually-hidden {
  position:absolute !important; width:1px !important; height:1px !important;
  padding:0 !important; margin:-1px !important; overflow:hidden !important;
  clip:rect(0,0,0,0) !important; white-space:nowrap !important; border:0 !important;
}
.account-menu > summary { width:42px; justify-content:center; padding:0; }
.account-menu > summary::after { display:none; }
.account-menu-icon { width:19px; height:19px; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.cloud-status { position:relative; cursor:help; outline:none; }
.cloud-status::after {
  content:attr(data-tooltip); position:absolute; z-index:60; top:calc(100% + 10px); right:0;
  width:min(320px,calc(100vw - 32px)); padding:10px 12px;
  border:1px solid var(--line); border-radius:var(--radius-sm);
  background:var(--surface-strong); color:var(--text); box-shadow:var(--shadow-float);
  font-size:.76rem; font-weight:500; line-height:1.45; text-align:left;
  opacity:0; visibility:hidden; transform:translateY(-3px); pointer-events:none;
  transition:opacity 140ms ease,transform 140ms ease,visibility 140ms ease;
}
.cloud-status:hover::after,.cloud-status:focus-visible::after {
  opacity:1; visibility:visible; transform:translateY(0);
}

/* Phase 7.6: task-first layout and compact utility navigation */
.account-menu { position:relative; }
.account-menu > summary {
  display:flex; align-items:center; justify-content:center; width:42px; min-height:40px; padding:0;
  border:1px solid var(--line); border-radius:var(--radius-sm);
  background:var(--surface-strong); color:var(--text); cursor:pointer;
  font-size:.82rem; font-weight:680; list-style:none;
}
.account-menu > summary::-webkit-details-marker { display:none; }
.account-menu > summary::after { display:none; }
.account-menu[open] > summary { border-color:color-mix(in srgb,var(--accent) 38%,var(--line)); background:var(--accent-soft); }
.account-menu-panel {
  position:absolute; z-index:40; top:calc(100% + 8px); right:0;
  display:grid; grid-template-columns:1fr 1fr; gap:8px; width:240px; padding:12px;
  border:1px solid var(--line); border-radius:var(--radius-md);
  background:var(--surface-strong); box-shadow:var(--shadow-float);
}
.account-menu-panel > .secondary-button,.account-menu-panel > .danger-button { grid-column:1/-1; width:100%; }
.account-menu-panel .topbar-label { align-self:center; color:var(--muted); font-size:.76rem; font-weight:650; }
.account-menu-panel .toggle-row { justify-content:flex-end; }
.account-menu-panel .toggle-button { color:var(--text); background:var(--surface-subtle); border-color:var(--line); }
.trade-save-actions { justify-content:flex-start; padding-top:var(--space-3); border-top:1px solid var(--line); }
.backtest-sidebar-tabs { display:grid; grid-template-columns:1.3fr 1.3fr .7fr; gap:4px; margin-top:8px; }
.backtest-sidebar-tabs button { min-height:28px; border:1px solid var(--line); border-radius:8px; background:var(--surface-subtle); color:var(--muted); font:inherit; font-size:.68rem; font-weight:700; cursor:pointer; }
.backtest-sidebar-tabs button:hover,.backtest-sidebar-tabs button.active { border-color:color-mix(in srgb,var(--accent) 64%,var(--line)); background:var(--accent-soft); color:var(--accent-strong); }
.equity-breakdown-chart { margin:1.25rem 0 1.75rem; padding:1rem; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-subtle); overflow-x:auto; }
.equity-breakdown-chart h3 { margin:0 0 .8rem; font-size:.92rem; }
.equity-breakdown-bars { display:flex; align-items:end; gap:.45rem; min-width:max-content; }
.equity-breakdown-bars article { display:grid; grid-template-rows:112px auto auto; gap:.35rem; width:70px; text-align:center; }
.equity-breakdown-stage { display:flex; align-items:end; justify-content:center; border-bottom:1px solid var(--line); }
.equity-breakdown-stage span { width:24px; border-radius:6px 6px 0 0; background:var(--good); }
.equity-breakdown-stage span.negative { background:var(--bad); }
.equity-breakdown-bars b { font-size:.7rem; color:var(--text); }
.equity-breakdown-bars small { font-size:.68rem; color:var(--muted); white-space:nowrap; }

@media (max-width:760px) {
  .sidebar {
    display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    align-items:start; gap:var(--space-3); padding:var(--space-3);
  }
  .sidebar-top { grid-column:1/-1; padding:0; }
  .sidebar-top h1 { margin-bottom:var(--space-2); }
  .sidebar-section { min-width:0; }
  .saved-list { display:flex; gap:6px; overflow-x:auto; padding-bottom:4px; }
  .backtest-card { flex:0 0 100%; min-width:0; }
  .backtest-card-actions { opacity:1; }
  .sidebar-bottom { grid-column:1/-1; }
  .theme-group { display:flex; align-items:center; justify-content:space-between; gap:var(--space-3); }
  .onboarding-panel { grid-template-columns:1fr; }
  .onboarding-panel > * { min-width:0; }
  .onboarding-panel ol { grid-template-columns:repeat(5,minmax(110px,1fr)); max-width:100%; overflow-x:auto; padding-bottom:4px; }
  .topbar-actions { align-items:center; }
  .account-menu-panel { right:0; }
}

@media (max-width:460px) {
  .sidebar { grid-template-columns:minmax(0,1fr) minmax(0,1fr); overflow:hidden; }
  .saved-list { display:grid; overflow:visible; }
  .backtest-card-actions { flex-wrap:wrap; }
  .onboarding-panel ol { grid-template-columns:1fr; overflow:visible; }
  .topbar-actions { display:flex; flex-wrap:wrap; }
  .topbar-actions .cloud-status { flex:1 0 100%; }
  .topbar-actions > button,.topbar-actions > .account-menu { flex:1 1 calc(50% - 4px); }
  .account-menu > summary { width:42px; justify-content:center; padding:0; }
  .account-menu-panel { position:fixed; top:auto; right:12px; left:12px; width:auto; }
  .trade-save-actions { display:grid; grid-template-columns:1fr; }
  .trade-save-actions button { width:100%; }
}

/* Phase 7.5 premium visual system */
:root {
  --bg: #111316;
  --bg-deep: #090a0c;
  --bg-elevated: #171a1f;
  --bg-subtle: #1e2229;
  --surface-hover: #232831;
  --surface-active: #2a313c;
  --border: #303742;
  --border-strong: #4c596b;
  --text-secondary: #c2cad5;
  --text-muted: #94a0b0;
  --text-subtle: #6f7a89;
  --primary: #86b8ff;
  --primary-hover: #a9ccff;
  --primary-active: #659ee9;
  --secondary: #b7c3d6;
  --highlight: #b9d8ff;
  --warning: #efbc69;
  --danger: #ec8790;
  --info: #79c6ed;
  --focus-ring: #d3e5ff;
  --shadow-sm: 0 4px 12px rgba(0,0,0,.18);
  --shadow-md: 0 16px 34px rgba(0,0,0,.24);
  --shadow-lg: 0 28px 68px rgba(0,0,0,.34);
  --chart-1: #89b8ff; --chart-2: #79d0c1; --chart-3: #e6b77b; --chart-4: #c5a7f5; --chart-5: #91a0b8;
  --motion-fast: 120ms; --motion-normal: 180ms; --motion-slow: 360ms; --ease-standard: cubic-bezier(.2,.7,.2,1);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px;
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 18px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.05);
  --shadow-float: 0 20px 50px rgba(15,23,42,.14);
}

body[data-theme="obsidian"]{--bg-start:#111316;--bg-end:#1a1e24;--surface:rgba(24,28,34,.9);--surface-strong:#1a1f26;--surface-subtle:#14171c;--line:#303742;--text:#edf0f5;--muted:#a7b0bc;--accent:#86b8ff;--accent-strong:#bad6ff;--accent-soft:rgba(134,184,255,.13);--good:#75cbb9;--bad:#ec8790;--sidebar:#0c0e11;--sidebar-muted:#a7b0bc;--shadow:var(--shadow-lg)}
body[data-theme="midnight"]{--bg-start:#0c1223;--bg-end:#16213a;--surface:rgba(21,31,54,.9);--surface-strong:#172441;--surface-subtle:#101a30;--line:#34486d;--text:#edf2ff;--muted:#aebddd;--accent:#7d9dff;--accent-strong:#b7c7ff;--accent-soft:rgba(125,157,255,.15);--good:#73c9c2;--bad:#ef899f;--sidebar:#080d1a;--sidebar-muted:#aebddd;--shadow:0 24px 64px rgba(2,8,25,.48)}
body[data-theme="arctic"]{--bg-start:#f4f7fa;--bg-end:#e7edf3;--surface:rgba(255,255,255,.9);--surface-strong:#fff;--surface-subtle:#f0f4f8;--line:#d3dde8;--text:#182433;--muted:#607186;--accent:#286fae;--accent-strong:#194e7d;--accent-soft:#dcecf8;--good:#277d6d;--bad:#b84f5d;--sidebar:#1d2a39;--sidebar-muted:#c5d0dc;--shadow:0 16px 36px rgba(30,55,78,.14)}
body[data-theme="emerald"]{--bg-start:#0d201f;--bg-end:#17312e;--surface:rgba(20,47,44,.9);--surface-strong:#173c38;--surface-subtle:#112b29;--line:#355a55;--text:#e7f1ed;--muted:#a9c3bb;--accent:#66c6ad;--accent-strong:#9ee0ce;--accent-soft:rgba(102,198,173,.14);--good:#7ccc9c;--bad:#ea8b91;--sidebar:#091614;--sidebar-muted:#a9c3bb;--shadow:0 24px 60px rgba(2,20,17,.42)}
body[data-theme="copper"]{--bg-start:#1b1a1a;--bg-end:#292522;--surface:rgba(38,35,33,.92);--surface-strong:#322c28;--surface-subtle:#24201e;--line:#5a4d43;--text:#f1ebe5;--muted:#c2afa2;--accent:#d99a62;--accent-strong:#f0c391;--accent-soft:rgba(217,154,98,.15);--good:#8dc5a4;--bad:#e58683;--sidebar:#151313;--sidebar-muted:#c2afa2;--shadow:0 24px 62px rgba(22,13,9,.42)}
body[data-theme="aurora"]{--bg-start:#101426;--bg-end:#201b36;--surface:rgba(28,29,52,.9);--surface-strong:#282546;--surface-subtle:#191a30;--line:#4a4a76;--text:#f1efff;--muted:#beb9dc;--accent:#78d5db;--accent-strong:#c0b3ff;--accent-soft:rgba(139,123,230,.15);--good:#7acbb4;--bad:#ed88aa;--sidebar:#0e1020;--sidebar-muted:#beb9dc;--shadow:0 25px 68px rgba(11,7,28,.5)}

body[data-theme="obsidian"],body[data-theme="midnight"],body[data-theme="emerald"],body[data-theme="copper"],body[data-theme="aurora"]{--bg:var(--bg-start);--bg-elevated:var(--surface-strong);--bg-subtle:var(--surface-subtle);--border:var(--line);--border-strong:color-mix(in srgb,var(--line) 72%,var(--accent));--text-secondary:var(--muted);--text-muted:var(--muted);--primary:var(--accent);--primary-hover:var(--accent-strong);--secondary:var(--sidebar-muted);--highlight:var(--accent-strong);--success:var(--good);--danger:var(--bad);--focus-ring:var(--accent-strong)}

.theme-card-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}.theme-card{display:grid;grid-template-columns:22px 1fr;gap:1px 7px;text-align:left;padding:7px;border:1px solid var(--line);border-radius:10px;background:var(--surface-subtle);color:var(--text);cursor:pointer}.theme-card .theme-preview{grid-row:span 2;width:22px;border-radius:6px;background:linear-gradient(135deg,var(--bg-start),var(--accent));box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--text) 16%,transparent)}.theme-card b{font-size:.72rem}.theme-card small{font-size:.62rem}.theme-card.active,.theme-card:hover{border-color:var(--accent);background:var(--accent-soft)}
button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,summary:focus-visible{outline:3px solid var(--focus-ring);outline-offset:3px}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition-duration:0.01ms!important;animation-duration:0.01ms!important;animation-iteration-count:1!important}}
/* Phase 7.7 — StrategyDecoding research canvas. The brand blue is reserved
   for focus, selection and progress; data states stay semantically separate. */
body[data-theme="light"] { --bg-start:#f3f7fc; --bg-end:#e7edf7; --surface:rgba(255,255,255,.78); --surface-strong:#fff; --surface-subtle:#f5f8fc; --line:#dbe4f0; --border:#dbe4f0; --text:#142238; --muted:#63738a; --accent:#087bf5; --accent-strong:#075bc1; --accent-soft:#e6f2ff; --sidebar:#0a1322; --sidebar-muted:#9aabc1; }
body[data-theme="night"] { --bg-start:#070d17; --bg-end:#0d1727; --surface:rgba(16,28,46,.88); --surface-strong:#111e31; --surface-subtle:#0d1828; --line:#233653; --border:#233653; --text:#edf6ff; --muted:#b9c7d9; --accent:#31b9ff; --accent-strong:#1194e8; --accent-soft:rgba(49,185,255,.12); --sidebar:#050b14; --sidebar-muted:#b9c7d9; }
body { background:radial-gradient(900px 540px at 88% -18%,color-mix(in srgb,var(--accent) 13%,transparent),transparent 62%),linear-gradient(180deg,var(--bg-start),var(--bg-end)); }
.sidebar { background:linear-gradient(180deg,#08111f 0%,#07101b 65%,#050b14 100%); border-right-color:rgba(130,164,204,.14); }
.sidebar-brand { padding-bottom:14px; border-bottom:1px solid var(--sidebar-line); }
.brand-logo { width:42px; height:42px; }
.backtest-card.active { background:linear-gradient(90deg,rgba(49,185,255,.16),rgba(49,185,255,.055)); box-shadow:inset 2px 0 var(--accent); }
.topbar { left:272px; background:color-mix(in srgb,var(--bg-start) 88%,transparent); border-bottom-color:color-mix(in srgb,var(--line) 78%,transparent); }
.cloud-status { border:1px solid var(--line); background:color-mix(in srgb,var(--surface-strong) 72%,transparent); }
.hero { position:relative; overflow:hidden; border-color:color-mix(in srgb,var(--accent) 18%,var(--line)); background:linear-gradient(135deg,var(--surface-strong),color-mix(in srgb,var(--accent-soft) 44%,var(--surface-strong))); }
.hero::after { content:""; position:absolute; right:-70px; top:-95px; width:280px; height:280px; border:1px solid color-mix(in srgb,var(--accent) 23%,transparent); border-radius:50%; box-shadow:0 0 0 34px color-mix(in srgb,var(--accent) 5%,transparent),0 0 0 70px color-mix(in srgb,var(--accent) 3%,transparent); pointer-events:none; }
.hero > * { position:relative; z-index:1; }
.panel { border-color:color-mix(in srgb,var(--line) 88%,transparent); }
.panel:hover { border-color:color-mix(in srgb,var(--accent) 27%,var(--line)); }
.report-metrics article:nth-child(-n+4) { background:linear-gradient(145deg,color-mix(in srgb,var(--accent-soft) 55%,var(--surface-strong)),var(--surface-strong)); }
.stat-value,.report-metrics strong,.analysis-value { font-variant-numeric:tabular-nums; }
.research-context { display:flex; align-items:center; flex-wrap:wrap; gap:6px; padding:10px 12px; border-left:2px solid var(--accent); background:color-mix(in srgb,var(--accent-soft) 55%,var(--surface-subtle)); }
.research-context-heading { margin-right:8px; padding-right:12px; border-right:1px solid var(--line); }
.setup-section { border-top-color:color-mix(in srgb,var(--line) 78%,transparent); }
.setup-section > summary { font-size:.82rem; font-weight:760; letter-spacing:.055em; text-transform:uppercase; }
.report-table tbody tr { transition:background 120ms ease; }
.primary-button { background:linear-gradient(135deg,#0584fb,#0963d5); border-color:#0877e8; }
.primary-button:hover { background:linear-gradient(135deg,#159bff,#0870e8); border-color:#159bff; }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto!important; transition-duration:.01ms!important; animation-duration:.01ms!important; } }
body[data-theme="light"] {
  --bg-start:#f7f8fb; --bg-end:#eef1f6; --surface:rgba(255,255,255,.88);
  --surface-strong:#ffffff; --surface-subtle:#f6f7fa; --line:#e2e6ed;
  --border:#e2e6ed; --text:#182033; --muted:#697386; --accent:#4f46e5;
  --accent-strong:#3730a3; --accent-soft:#eeedff; --good:#087a55; --bad:#b4233a;
  --sidebar:#101523; --sidebar-soft:rgba(255,255,255,.055); --sidebar-line:rgba(255,255,255,.09);
  --sidebar-text:#f5f7fb; --sidebar-muted:#98a2b5;
}
body[data-theme="night"] {
  --bg-start:#0b0f18; --bg-end:#111827; --surface:rgba(21,28,43,.9);
  --surface-strong:#171f30; --surface-subtle:#111827; --line:#2a3448; --border:#2a3448;
  --text:#f3f5f9; --muted:#9aa6ba; --accent:#8b83ff; --accent-strong:#b6b1ff;
  --accent-soft:rgba(99,91,255,.14); --good:#49c99a; --bad:#ff7c8d;
  --sidebar:#080c14; --sidebar-soft:rgba(255,255,255,.05); --sidebar-line:rgba(255,255,255,.08);
  --sidebar-text:#f5f7fb; --sidebar-muted:#8995a9; --shadow:0 1px 2px rgba(0,0,0,.2),0 12px 30px rgba(0,0,0,.18);
}
html { scroll-behavior:smooth; }
body { font-family:Inter, ui-sans-serif, "Segoe UI", system-ui, -apple-system, sans-serif; line-height:1.55; letter-spacing:-.008em; background:linear-gradient(180deg,var(--bg-start),var(--bg-end)); }
body::before { content:""; position:fixed; inset:0; pointer-events:none; background:radial-gradient(circle at 72% -10%,color-mix(in srgb,var(--accent) 7%,transparent),transparent 32%); }
.sidebar-top h1,.saved-header h2,.hero h2,.panel h2,.topbar h2,.empty-state h3,.auth-card h1 { font-family:inherit; letter-spacing:-.035em; }
.app-shell { grid-template-columns:272px minmax(0,1fr); }
.sidebar { position:sticky; top:0; height:100vh; padding:var(--space-5) var(--space-4); gap:var(--space-5); background:var(--sidebar); box-shadow:none; }
.sidebar-top { padding:0 var(--space-2) var(--space-3); }
.sidebar-top h1 { font-size:1.35rem; font-weight:680; line-height:1.2; }
.sidebar-eyebrow,.eyebrow,.panel-kicker { margin-bottom:var(--space-2); font-size:.68rem; font-weight:750; letter-spacing:.14em; color:var(--accent); }
.sidebar-eyebrow { color:#a9a4ff; }
.sidebar-link { min-height:42px; padding:0 var(--space-3); border-radius:var(--radius-md); border-color:transparent; font-size:.87rem; font-weight:650; }
.sidebar-link { gap:11px; }
.sidebar-nav-icon { display:grid; flex:0 0 20px; width:20px; height:20px; place-items:center; color:var(--accent); }
.sidebar-nav-icon svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.sidebar-link.active .sidebar-nav-icon { color:var(--accent-strong); }
.sidebar-link:hover { transform:none; background:rgba(255,255,255,.085); border-color:transparent; }
.compact-section { padding-left:0; }
.backtest-card { padding:var(--space-2); gap:var(--space-2); border:0; border-radius:var(--radius-md); background:transparent; }
.backtest-card.active { background:rgba(117,109,255,.13); box-shadow:inset 3px 0 #8b83ff; }
.backtest-card-copy { padding:var(--space-2); border:0; border-radius:var(--radius-sm); background:transparent; }
.backtest-card-title { font-size:.88rem; }
.backtest-card-meta { margin-top:2px; font-size:.75rem; }
.backtest-card-row { position:relative; }
.backtest-card-actions { position:absolute; z-index:40; top:4px; right:4px; display:flex; gap:4px; overflow:visible; opacity:0; visibility:hidden; pointer-events:none; transform:translateX(4px); transition:opacity 140ms ease,transform 140ms ease,visibility 140ms ease; }
.backtest-card:hover .backtest-card-actions,.backtest-card:focus-within .backtest-card-actions { opacity:1; visibility:visible; pointer-events:auto; transform:translateX(0); }
.backtest-delete,.backtest-duplicate { min-width:auto; min-height:28px; padding:4px 8px; border:0; background:transparent; color:var(--sidebar-muted); font-size:.7rem; }
.sidebar-action-icon { position:relative; width:28px; height:28px; padding:5px; border-radius:8px; background:color-mix(in srgb,var(--sidebar) 88%,transparent); }
.sidebar-action-svg { width:16px; height:16px; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.sidebar-action-icon::after { content:attr(data-tooltip); position:absolute; z-index:50; right:0; bottom:calc(100% + 8px); padding:6px 8px; border:1px solid var(--sidebar-line); border-radius:7px; background:#070b13; color:#fff; box-shadow:0 8px 20px rgba(0,0,0,.28); font-size:.7rem; font-weight:650; white-space:nowrap; opacity:0; visibility:hidden; transform:translateY(3px); pointer-events:none; transition:opacity 120ms ease,transform 120ms ease,visibility 120ms ease; }
.sidebar-action-icon::before { content:""; position:absolute; z-index:51; right:9px; bottom:calc(100% + 4px); width:7px; height:7px; border-right:1px solid var(--sidebar-line); border-bottom:1px solid var(--sidebar-line); background:#070b13; opacity:0; visibility:hidden; pointer-events:none; transform:translateY(2px) rotate(45deg); transition:opacity 120ms ease,transform 120ms ease,visibility 120ms ease; }
.sidebar-action-icon:hover::after,.sidebar-action-icon:focus-visible::after { opacity:1; visibility:visible; transform:translateY(0); }
.sidebar-action-icon:hover::before,.sidebar-action-icon:focus-visible::before { opacity:1; visibility:visible; transform:translateY(0) rotate(45deg); }
.backtest-delete:hover { color:#ff9ba8; background:rgba(255,124,141,.1); }
@media (hover:none),(max-width:760px) {
  .backtest-card-actions { position:static; opacity:1; visibility:visible; pointer-events:auto; transform:none; }
}
.sidebar .toggle-button.active { border-color:rgba(139,131,255,.38); background:rgba(139,131,255,.16); color:#fff; }
.sidebar .toggle-button:hover { border-color:rgba(139,131,255,.28); background:rgba(139,131,255,.1); }
.main-area { position:relative; padding:calc(var(--space-6) + 68px) clamp(24px,3vw,52px) var(--space-7); }
.topbar { position:fixed; z-index:40; top:0; left:320px; right:0; display:flex; align-items:center; justify-content:flex-end; min-height:68px; margin:0; padding:var(--space-3) clamp(24px,3vw,52px); background:color-mix(in srgb,var(--bg-start) 92%,transparent); border-bottom:1px solid var(--line); backdrop-filter:blur(14px); }
.topbar h2 { font-size:clamp(1.4rem,2vw,1.85rem); font-weight:680; }
.topbar-actions { gap:var(--space-2); }
.cloud-status { padding:6px 10px; border-radius:999px; background:var(--surface-subtle); font-size:.73rem; font-weight:650; }.tool-panel, .onboarding-panel { max-width:1480px; margin-left:auto; margin-right:auto; }
.panel,.hero,.journal-command,.journal-day-panel { border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface); box-shadow:none; backdrop-filter:blur(12px); }
.panel { padding:var(--space-5); }
.hero { gap:var(--space-6); padding:var(--space-6); background:var(--surface-strong); box-shadow:var(--shadow); }
.hero h2 { font-size:clamp(1.9rem,3vw,2.75rem); line-height:1.08; font-weight:720; }
.hero-copy { max-width:66ch; color:var(--muted); }
.hero-context { display:flex; flex-wrap:wrap; gap:6px; margin-top:var(--space-3); }
.hero-context span { padding:5px 9px; border-radius:999px; background:var(--surface-subtle); color:var(--muted); font-size:.73rem; font-weight:650; }

/* Strategy Builder */
.strategy-sidebar-section { padding-top:0; }
.strategy-library-head,.strategy-builder-head { display:flex; align-items:flex-start; justify-content:space-between; gap:var(--space-5); padding:var(--space-6); border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface-strong); box-shadow:var(--shadow); }
.strategy-library-head h2,.strategy-builder-head h2 { margin:0; font-size:clamp(1.6rem,2.6vw,2.35rem); }
.strategy-library-head p,.strategy-builder-head p { color:var(--muted); }
.strategy-library-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:var(--space-3); margin-top:var(--space-4); }
.strategy-library-card,.strategy-starter { min-height:190px; padding:var(--space-5); text-align:left; border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface); color:var(--text); }
.strategy-library-card { cursor:pointer; transition:border-color .16s ease,transform .16s ease; }
.strategy-library-card:hover { transform:translateY(-2px); border-color:var(--accent); }
.strategy-library-card strong { display:block; font-size:1.08rem; }
.strategy-library-card p { color:var(--muted); line-height:1.5; }
.strategy-library-card small { color:var(--accent); font-weight:700; }
.strategy-starter { grid-column:1/-1; max-width:720px; display:grid; gap:var(--space-3); }
.strategy-builder-actions { display:flex; flex-wrap:wrap; gap:var(--space-2); }
.strategy-builder-layout { display:grid; grid-template-columns:220px minmax(0,1fr) minmax(240px,300px); gap:var(--space-4); margin-top:var(--space-4); }
.strategy-builder-nav,.strategy-builder-editor,.strategy-builder-summary { padding:var(--space-4); border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface); }
.strategy-builder-nav { display:grid; align-content:start; gap:3px; }
.strategy-builder-nav button { display:flex; align-items:center; gap:7px; width:100%; padding:9px 8px; border:0; border-radius:var(--radius-sm); background:transparent; color:var(--muted); text-align:left; }
.strategy-builder-nav button.active { background:var(--accent-soft); color:var(--text); font-weight:750; }
.strategy-builder-nav button span { width:14px; color:var(--accent); }
.strategy-builder-nav small { margin-left:auto; font-size:.62rem; }
.strategy-builder-editor h2 { margin:.2rem 0 .5rem; }
.strategy-builder-editor textarea { min-height:220px; }
.strategy-builder-summary { align-self:start; display:grid; gap:var(--space-3); }
.strategy-builder-summary details { border-top:1px solid var(--line); padding-top:var(--space-3); }
.strategy-builder-summary summary { cursor:pointer; font-weight:750; }
.strategy-specification section { padding:.55rem 0; border-bottom:1px solid var(--line); }
.strategy-specification small { color:var(--accent); font-weight:750; text-transform:uppercase; letter-spacing:.08em; }
.strategy-specification p { margin:.25rem 0 0; color:var(--muted); line-height:1.45; white-space:pre-wrap; }
.strategy-checklist-preview { display:grid; gap:8px; padding:var(--space-3); background:var(--surface-subtle); border-radius:var(--radius-md); }
@media (max-width:1050px) { .strategy-builder-layout { grid-template-columns:190px minmax(0,1fr); }.strategy-builder-summary { grid-column:1/-1; } }
@media (max-width:700px) { .strategy-library-head,.strategy-builder-head { display:grid; padding:var(--space-4); }.strategy-builder-layout { grid-template-columns:1fr; }.strategy-builder-nav { grid-template-columns:repeat(2,minmax(0,1fr)); }.strategy-builder-summary { grid-column:auto; } }

/* Phase 7.7A – the strategy workspace shares the primary research canvas. */
.sidebar-section + .strategy-sidebar-section { margin-top:-.4rem; }
.strategy-sidebar-section .sidebar-link { position:relative; border:1px solid transparent; background:linear-gradient(90deg,transparent,rgba(49,185,255,.035)); }
.strategy-sidebar-section .sidebar-link::before { content:""; width:6px; height:6px; border-radius:50%; background:var(--accent); box-shadow:0 0 0 4px color-mix(in srgb,var(--accent) 13%,transparent); }
.strategy-sidebar-section .sidebar-link.active { border-color:color-mix(in srgb,var(--accent) 26%,transparent); background:linear-gradient(90deg,rgba(49,185,255,.16),rgba(49,185,255,.03)); color:#f5fbff; }
.tool-panel { animation:workspace-enter .22s cubic-bezier(.2,.8,.2,1); }
@keyframes workspace-enter { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }
.primary-button,.secondary-button,.ghost-button { transition:transform .16s ease,background .16s ease,border-color .16s ease,box-shadow .16s ease; }
.primary-button:hover { transform:translateY(-1px); box-shadow:0 8px 18px color-mix(in srgb,var(--accent) 18%,transparent); }
.primary-button:active,.secondary-button:active,.ghost-button:active { transform:translateY(0); }
:where(input,select,textarea):focus-visible { outline:2px solid color-mix(in srgb,var(--accent) 68%,white); outline-offset:2px; border-color:var(--accent); }
.subtabs { gap:4px; width:max-content; max-width:100%; padding:4px; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-subtle); }
.subtab-button { border-radius:calc(var(--radius-md) - 4px); }
.subtab-button.active { box-shadow:0 1px 0 rgba(255,255,255,.08),0 5px 14px rgba(2,12,28,.12); }
.hero-stats > article { position:relative; overflow:hidden; border-color:color-mix(in srgb,var(--line) 84%,var(--accent)); }
.hero-stats > article:first-child::after { content:""; position:absolute; inset:0 auto 0 0; width:2px; background:var(--accent); }
.report-metrics > article:nth-child(1),.report-metrics > article:nth-child(2) { background:linear-gradient(145deg,color-mix(in srgb,var(--accent-soft) 72%,var(--surface)),var(--surface)); }
.analysis-row,.trade-item,.insight-card { border-color:color-mix(in srgb,var(--line) 88%,transparent); }
.analysis-row:hover,.trade-item:hover,.insight-card:hover { border-color:color-mix(in srgb,var(--accent) 28%,var(--line)); }
.report-table thead { background:var(--surface-strong); box-shadow:0 1px 0 var(--line); }
.report-table tbody tr { transition:background .14s ease; }
.report-table tbody tr:hover { background:color-mix(in srgb,var(--accent-soft) 45%,transparent); }
.auth-gate { position:relative; overflow:hidden; background:radial-gradient(800px 500px at 10% 5%,color-mix(in srgb,var(--accent) 16%,transparent),transparent 62%),radial-gradient(600px 420px at 95% 100%,rgba(59,81,173,.14),transparent 68%),var(--bg-start); }
.auth-gate::before,.auth-gate::after { content:""; position:absolute; border:1px solid color-mix(in srgb,var(--accent) 19%,transparent); border-radius:50%; pointer-events:none; }
.auth-gate::before { width:480px; height:480px; left:-210px; top:-260px; }
.auth-gate::after { width:360px; height:360px; right:-170px; bottom:-190px; }
.auth-card { position:relative; z-index:1; border:1px solid color-mix(in srgb,var(--line) 84%,var(--accent)); background:color-mix(in srgb,var(--surface-strong) 94%,#091727); box-shadow:0 26px 70px rgba(0,6,18,.25); }
.auth-card .panel-kicker::before { content:""; display:inline-block; width:7px; height:7px; margin-right:8px; border-radius:50%; background:var(--accent); }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation-duration:.01ms !important; animation-iteration-count:1 !important; scroll-behavior:auto !important; transition-duration:.01ms !important; } }

/* Match the single journal card exactly: strategies is a peer workspace, not a plain nav link. */
.strategy-sidebar-section { padding-top:0; }
.strategy-sidebar-section .sidebar-link { min-height:58px; width:100%; padding:12px 14px; border:1px solid var(--sidebar-line); border-radius:12px; background:linear-gradient(135deg,rgba(49,185,255,.12),rgba(255,255,255,.035)); color:var(--sidebar-text); font-size:.9rem; font-weight:720; }
.strategy-sidebar-section .sidebar-link::before { content:none; display:none; }
.strategy-sidebar-section .sidebar-link:hover,.strategy-sidebar-section .sidebar-link:focus-visible { border-color:color-mix(in srgb,var(--accent) 65%,var(--sidebar-line)); background:linear-gradient(135deg,rgba(49,185,255,.2),rgba(255,255,255,.055)); }
.strategy-sidebar-section .sidebar-link.active { border-color:color-mix(in srgb,var(--accent) 65%,var(--sidebar-line)); background:linear-gradient(135deg,rgba(49,185,255,.2),rgba(255,255,255,.055)); box-shadow:inset 3px 0 var(--accent),0 8px 18px rgba(0,0,0,.16); }
.pulse-sidebar-section { padding-top:0; }
.pulse-sidebar-section .sidebar-link { text-decoration:none; }

.account-menu-language,.account-menu-theme { display:grid; gap:7px; padding-top:var(--space-2); border-top:1px solid var(--line); }
.theme-icon-button { min-width:42px; font-size:1.05rem; line-height:1; }
.account-menu-signout { display:flex; justify-content:center; width:100%; margin-top:var(--space-2); border:1px solid color-mix(in srgb,var(--bad) 62%,transparent); border-radius:var(--radius-sm); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--bad) 18%,transparent); background:color-mix(in srgb,var(--bad) 11%,transparent); color:#f29a95; }
.account-menu-signout:hover { border-color:color-mix(in srgb,var(--bad) 68%,transparent); background:color-mix(in srgb,var(--bad) 18%,transparent); color:#ffd3d0; }

/* Compact account menu: utilities stay secondary to the workspace. */
.account-menu-panel {
  width:228px;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
  padding:10px;
  border-radius:12px;
}
.account-menu-panel > .secondary-button,
.account-menu-panel > .danger-button { min-height:34px; padding:0 9px; font-size:.75rem; }
.account-menu-panel > #importDataButton,
.account-menu-panel > #exportDataButton { grid-column:auto; }
.account-menu-panel > #settingsButton { grid-column:1 / -1; }
.account-menu-language,
.account-menu-theme { grid-column:auto; gap:6px; padding-top:8px; justify-items:center; }
.account-menu-panel .topbar-label { width:100%; text-align:center; font-size:.7rem; line-height:1; }
.account-menu-panel .toggle-row { min-width:0; width:100%; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; justify-self:stretch; }
.account-menu-panel .compact-row { min-width:0; }
.account-menu-panel .toggle-button { min-width:0; width:100%; min-height:30px; padding:0; border-radius:9px; font-size:.7rem; }
.account-menu-panel .theme-icon-button { min-width:0; font-size:.95rem; }
.account-menu-signout {
  grid-column:1 / -1;
  justify-self:center;
  width:124px !important;
  min-height:34px !important;
  margin-top:2px;
  font-size:.75rem !important;
}
.hero-stats { grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--space-2); }
.stat-card { padding:var(--space-4); border:0; border-left:1px solid var(--line); border-radius:0; background:transparent; }
.stat-value { font-size:1.45rem; font-weight:700; font-variant-numeric:tabular-nums; letter-spacing:-.035em; }
.stat-label { color:var(--muted); font-size:.72rem; font-weight:650; }
.onboarding-panel { display:block; margin-bottom:var(--space-4); padding:var(--space-4) var(--space-5); background:var(--surface); }
.onboarding-panel > summary { display:flex; align-items:center; justify-content:space-between; gap:var(--space-3); cursor:pointer; color:var(--text); font-size:.94rem; font-weight:680; }
.onboarding-panel > summary small { color:var(--muted); font-size:.74rem; font-weight:600; }
.onboarding-content { display:grid; grid-template-columns:1.1fr 1fr; gap:var(--space-5); align-items:start; padding-top:var(--space-5); }
.onboarding-panel h2 { font-size:1.15rem; }
.onboarding-panel ol { grid-template-columns:repeat(5,auto); gap:var(--space-3); padding:0; list-style-position:inside; font-size:.76rem; }
.onboarding-intro { align-self:start; }
.onboarding-checklist { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:var(--space-2) !important; margin:0; padding:0 !important; list-style:none; }
.onboarding-checklist li { display:grid; grid-template-columns:30px minmax(0,1fr); gap:10px; align-content:start; min-width:0; padding:var(--space-3); border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-strong); }
.onboarding-checklist li.current { border-color:color-mix(in srgb,var(--accent) 55%,var(--line)); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 16%,transparent); }
.onboarding-checklist li.done { background:var(--accent-soft); }
.onboarding-check { display:grid; place-items:center; width:30px; height:30px; padding:0; border:1px solid var(--line); border-radius:50%; background:var(--surface-subtle); color:var(--muted); font:inherit; font-weight:750; cursor:pointer; }
.onboarding-check:hover,.onboarding-check:focus-visible { border-color:var(--accent); color:var(--accent-strong); }
.onboarding-checklist li.done .onboarding-check { background:var(--accent); color:#fff; }
.onboarding-checklist strong { display:block; color:var(--text); font-size:.78rem; }
.onboarding-checklist p { margin:3px 0 0; color:var(--muted); font-size:.72rem; line-height:1.42; }
@media (max-width:760px) { .onboarding-content { grid-template-columns:1fr; } }
.primary-button,.secondary-button,.ghost-button,.danger-button,.icon-button,.subtab-button,.calendar-nav-button,.calendar-today-button { min-height:40px; border-radius:var(--radius-sm); padding:0 var(--space-4); font-size:.82rem; font-weight:680; letter-spacing:-.005em; transition:background 140ms ease,border-color 140ms ease,color 140ms ease,box-shadow 140ms ease,transform 100ms ease; }
.primary-button { border:1px solid var(--accent); background:var(--accent); color:white; box-shadow:0 1px 2px color-mix(in srgb,var(--accent) 30%,transparent); }
.primary-button:hover { background:var(--accent-strong); border-color:var(--accent-strong); transform:translateY(-1px); }
.secondary-button { border:1px solid var(--line); background:var(--surface-strong); color:var(--text); box-shadow:0 1px 2px rgba(15,23,42,.03); }
.secondary-button:hover { border-color:color-mix(in srgb,var(--accent) 38%,var(--line)); background:var(--accent-soft); }
.ghost-button { border-color:transparent; background:transparent; color:var(--muted); }
.danger-button { color:var(--bad); }
button:active { transform:translateY(0) scale(.985); }
button:disabled { opacity:.45; cursor:not-allowed; box-shadow:none; transform:none; }
input,select,textarea { min-height:42px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface-strong); color:var(--text); padding:9px 11px; box-shadow:0 1px 1px rgba(15,23,42,.025); }
textarea { min-height:92px; line-height:1.55; resize:vertical; }
input::placeholder,textarea::placeholder { color:color-mix(in srgb,var(--muted) 68%,transparent); }
input:hover,select:hover,textarea:hover { border-color:color-mix(in srgb,var(--muted) 55%,var(--line)); }
input:focus,select:focus,textarea:focus { border-color:var(--accent); box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 12%,transparent); outline:0; }
label,.field-label,legend { color:var(--text); font-size:.8rem; font-weight:650; }
.helper-text,small { color:var(--muted); font-size:.76rem; font-weight:450; }
.subtabs { gap:var(--space-1); padding:4px; width:max-content; max-width:100%; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-subtle); }
.subtab-button { min-height:36px; border:0; background:transparent; color:var(--muted); }
.subtab-button.active { background:var(--surface-strong); color:var(--text); box-shadow:0 1px 3px rgba(15,23,42,.1); }
.research-flow { gap:var(--space-2); }
.research-flow span { border:0; background:var(--surface-subtle); color:var(--muted); font-size:.7rem; font-weight:650; }
.research-flow span.done { background:var(--accent-soft); color:var(--accent-strong); }
.research-context { padding:var(--space-2); border-radius:var(--radius-md); background:var(--surface-subtle); }
.research-context span,.research-context strong { border:0; padding:5px 9px; font-size:.73rem; }
.research-context strong { background:var(--text); color:var(--surface-strong); }
.setup-section { border-top:1px solid var(--line); padding:var(--space-3) 0; }
.report-section > summary { padding:var(--space-3) 0; }
.setup-section > summary { padding:var(--space-3) 0; }
.category-config-list article,.trade-context-fields,.insight-editor { border-color:var(--line); border-radius:var(--radius-md); background:var(--surface-subtle); }
.trade-item,.history-note-card,.analysis-card { border:1px solid var(--line); border-radius:var(--radius-md); background:var(--surface-strong); box-shadow:none; }
.trade-item:hover,.history-note-card:hover { border-color:color-mix(in srgb,var(--accent) 25%,var(--line)); }
.metric-chip,.attribute-badge,.journal-note-category { border:0; border-radius:999px; background:var(--surface-subtle); color:var(--muted); font-size:.72rem; }
.report-nav { top:var(--space-2); padding:5px; border-radius:var(--radius-md); box-shadow:var(--shadow); background:color-mix(in srgb,var(--surface-strong) 92%,transparent); }
.report-nav a { border-radius:var(--radius-sm); color:var(--muted); }
.report-nav a:hover { background:var(--accent-soft); color:var(--accent-strong); }
.report-metrics { grid-template-columns:repeat(4,minmax(145px,1fr)); gap:var(--space-2); }
.report-metrics article { padding:var(--space-4); border:0; border-radius:var(--radius-md); background:var(--surface-subtle); }
.report-metrics article:nth-child(-n+4) { background:linear-gradient(145deg,var(--surface-subtle),var(--surface-strong)); box-shadow:inset 0 0 0 1px var(--line); }
.report-metrics strong { font-size:1.15rem; font-weight:720; letter-spacing:-.025em; }
.report-table-wrap { border-color:var(--line); border-radius:var(--radius-md); background:var(--surface-strong); }
.report-table { font-size:.79rem; }
.report-table th { height:42px; padding:0 var(--space-3); border-bottom:1px solid var(--line); background:var(--surface-subtle); color:var(--muted); font-size:.68rem; letter-spacing:.05em; text-transform:uppercase; }
.report-table td { height:46px; padding:0 var(--space-3); border-bottom:1px solid color-mix(in srgb,var(--line) 70%,transparent); }
.report-table tbody tr:hover { background:var(--accent-soft); }
.chart-stage { border:1px solid var(--line); border-radius:var(--radius-md); background:linear-gradient(180deg,var(--app-surface-raised,var(--surface-strong)),var(--app-bg-secondary,var(--surface-subtle))); padding:var(--space-3); }
.empty-state { min-height:140px; display:grid; place-content:center; text-align:center; padding:var(--space-6); border:1px dashed color-mix(in srgb,var(--muted) 35%,transparent); border-radius:var(--radius-md); background:var(--surface-subtle); }
.empty-state h3 { font-size:1rem; }
.confirm-modal-card,.lightbox-card { border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface-strong); box-shadow:var(--shadow-float); }
.confirm-modal { backdrop-filter:blur(5px); }
.positive-text { color:var(--good); }
.negative-text { color:var(--bad); }
.auth-gate { background:linear-gradient(145deg,#0c1120,#181d32); }
.app-boot { position:fixed; inset:0; z-index:10000; display:grid; place-content:center; justify-items:center; gap:8px; background:#0b0f18; color:#f5f7fb; }
.app-boot-mark { display:grid; place-items:center; width:48px; height:48px; margin-bottom:8px; border:1px solid rgba(182,177,255,.38); border-radius:14px; background:rgba(99,91,255,.16); color:#b6b1ff; font-size:.82rem; font-weight:800; letter-spacing:.12em; }
.app-boot strong { font-size:1.05rem; letter-spacing:-.02em; }
.app-boot small { color:#8995a9; font-size:.72rem; }
.app-boot.hidden { display:none; }
.auth-card { width:min(440px,calc(100vw - 32px)); padding:var(--space-7); border:1px solid rgba(255,255,255,.1); border-radius:22px; background:rgba(255,255,255,.96); box-shadow:0 30px 80px rgba(0,0,0,.35); }
.auth-card h1 { font-size:2rem; font-weight:750; }
.auth-card .panel-kicker { color:var(--accent); }
.settings-modal { position:fixed; inset:0; z-index:9000; display:grid; place-items:center; padding:var(--space-4); }
.settings-dialog { position:relative; z-index:1; width:min(900px,100%); max-height:min(780px,calc(100vh - 32px)); overflow:auto; padding:var(--space-5); border:1px solid var(--line); border-radius:var(--radius-lg); background:var(--surface-strong); box-shadow:var(--shadow-float); }
.settings-header { display:flex; align-items:flex-start; justify-content:space-between; gap:var(--space-3); margin-bottom:var(--space-4); }
.settings-header h2 { margin:0; }
.settings-nav { display:flex; gap:6px; overflow-x:auto; padding-bottom:var(--space-3); border-bottom:1px solid var(--line); }
.settings-nav button { flex:0 0 auto; border:0; border-radius:var(--radius-sm); background:transparent; color:var(--muted); padding:8px 10px; font:inherit; cursor:pointer; }
.settings-nav button.active { background:var(--accent-soft); color:var(--accent-strong); }
.settings-content { padding-top:var(--space-4); }
.settings-card { display:grid; gap:var(--space-3); max-width:620px; }
.settings-card h3,.settings-card p { margin:0; }
.settings-choice-section { display:grid; gap:var(--space-2); padding-top:var(--space-3); border-top:1px solid var(--line); }
.settings-choice-section h4 { margin:0; font-size:.95rem; }
.settings-choice-row { display:flex; flex-wrap:wrap; gap:var(--space-2); }
.settings-choice-row .secondary-button.active { border-color:var(--accent-strong); background:var(--accent-soft); color:var(--accent-strong); }
.settings-card label { display:grid; gap:6px; color:var(--muted); font-size:.85rem; }
.settings-card input,.settings-card select { width:100%; }
.settings-card dl { display:grid; grid-template-columns:minmax(130px,.7fr) 1.5fr; gap:10px var(--space-4); margin:0; }
.settings-card dt { color:var(--muted); }.settings-card dd { margin:0; overflow-wrap:anywhere; }
.settings-feedback { min-height:1.3em; color:var(--good); }.settings-feedback.error { color:var(--bad); }
.export-warning { padding:var(--space-3); border:1px solid color-mix(in srgb,var(--bad) 45%,var(--line)); border-radius:var(--radius-sm); background:color-mix(in srgb,var(--bad) 9%,var(--surface-subtle)); color:var(--bad); font-size:.86rem; line-height:1.45; }
.session-action { display:grid; gap:var(--space-2); margin-top:var(--space-2); padding-top:var(--space-4); border-top:1px solid var(--line); }.session-action h4,.session-action p { margin:0; }.session-action h4 { font-size:.95rem; }.session-signout-button { justify-self:start; border-color:color-mix(in srgb,var(--bad) 45%,var(--line)); color:var(--bad); font-weight:720; }
.inline-form { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:var(--space-2); align-items:end; }.danger-zone { padding:var(--space-4); border:1px solid color-mix(in srgb,var(--bad) 35%,var(--line)); border-radius:var(--radius-md); }
@media (max-width:600px) { .settings-dialog { padding:var(--space-4); }.settings-card dl,.inline-form { grid-template-columns:1fr; }.settings-nav { margin:0 calc(var(--space-4) * -1); padding-inline:var(--space-4); } }
* { scrollbar-width:thin; scrollbar-color:color-mix(in srgb,var(--muted) 35%,transparent) transparent; }

@media (max-width:1100px) {
  .app-shell { grid-template-columns:232px minmax(0,1fr); }
  .main-area { padding:calc(var(--space-5) + 68px) var(--space-5) var(--space-5); }
  .topbar { left:232px; }
  .onboarding-panel { grid-template-columns:1fr; }
  .onboarding-panel ol { grid-template-columns:repeat(5,minmax(0,1fr)); }
  .report-metrics { grid-template-columns:repeat(2,minmax(140px,1fr)); }
}
@media (max-width:760px) {
  .app-shell { display:block; padding-top:68px; }
  .sidebar { position:relative; width:100%; height:auto; padding:var(--space-4); }
  .sidebar-top h1 { font-size:1.15rem; }
  .sidebar-section { gap:var(--space-2); }
  .sidebar-bottom { margin-top:0; }
  .main-area { padding:var(--space-4); }
  .topbar { left:0; align-items:flex-start; }
  .topbar-actions { justify-content:flex-start; }
  .hero { grid-template-columns:1fr; padding:var(--space-5); }
  .hero-stats { grid-template-columns:repeat(2,1fr); }
  .panel { padding:var(--space-4); }
  .onboarding-panel ol { grid-template-columns:1fr; }
  .report-table-wrap { max-width:calc(100vw - 64px); }
}
@media (max-width:460px) {
  .main-area { padding:var(--space-3); }
  .topbar { display:grid; }
  .topbar-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); width:100%; }
  .topbar-actions .cloud-status { grid-column:1/-1; }
  .topbar-actions button { width:100%; }
  .hero { padding:var(--space-4); border-radius:var(--radius-md); }
  .hero h2 { font-size:1.65rem; }
  .panel { padding:var(--space-3); border-radius:var(--radius-md); }
  .report-metrics { grid-template-columns:1fr 1fr; }
}
.onboarding-panel ol { margin:0; display:grid; gap:.35rem; color:var(--muted); }
@media (max-width: 900px) { .onboarding-panel { grid-template-columns:1fr; } }
.onboarding-panel { display:grid; grid-template-columns:minmax(240px,1.5fr) minmax(280px,1fr); gap:1rem; align-items:center; }
@media (max-width:760px) {
  .sidebar { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); align-items:start; gap:var(--space-3); padding:var(--space-3); }
  .sidebar-top { grid-column:1/-1; padding:0; }
  .sidebar-section { min-width:0; }
  .saved-list { display:flex; gap:6px; overflow-x:auto; padding-bottom:4px; }
  .backtest-card { flex:0 0 100%; min-width:0; }
  .backtest-card-actions { opacity:1; }
  .sidebar-bottom { grid-column:1/-1; }
  .theme-group { display:flex; align-items:center; justify-content:space-between; gap:var(--space-3); }
  .onboarding-panel { grid-template-columns:1fr; }
  .onboarding-panel > * { min-width:0; }
  .onboarding-panel ol { grid-template-columns:repeat(5,minmax(110px,1fr)); max-width:100%; overflow-x:auto; padding-bottom:4px; }
  .onboarding-checklist { grid-template-columns:1fr !important; overflow:visible !important; }
}
@media (max-width:460px) {
  .sidebar { overflow:hidden; }
  .saved-list { display:grid; overflow:visible; }
  .backtest-card-actions { flex-wrap:wrap; }
  .onboarding-panel ol { grid-template-columns:1fr; overflow:visible; }
  .topbar-actions { display:flex; flex-wrap:wrap; }
  .topbar-actions .cloud-status { flex:1 0 100%; }
  .topbar-actions > button,.topbar-actions > .account-menu { flex:1 1 calc(50% - 4px); }
  .account-menu > summary { justify-content:center; }
  .account-menu-panel { position:fixed; top:auto; right:12px; left:12px; width:auto; }
  .trade-save-actions { display:grid; grid-template-columns:1fr; }
  .trade-save-actions button { width:100%; }
}
