:root,
[data-theme="dark"] {
  --bg: #0b0f14;
  --bg-elevated: #121820;
  --surface: #121820;
  --bg-hover: #1a2230;
  --border: #243044;
  --text: #e8edf4;
  --text-muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --positive: #22c55e;
  --positive-bg: rgba(34, 197, 94, 0.12);
  --negative: #ef4444;
  --negative-bg: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --num: "DM Sans", system-ui, sans-serif;
  --panel-alpha: 1;
  --blur: 0;
}

[data-theme="glass"] {
  --bg: rgba(8, 10, 16, 0.45);
  --bg-elevated: rgba(14, 18, 28, 0.55);
  --surface: rgba(18, 24, 36, 0.94);
  --bg-hover: rgba(22, 28, 42, 0.65);
  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --panel-alpha: 0.72;
  --blur: 18px;
}

/* TradingView-style light transparent */
[data-theme="light"] {
  --bg: rgba(255, 255, 255, 0.65);
  --bg-elevated: rgba(255, 255, 255, 0.82);
  --surface: rgba(255, 255, 255, 0.96);
  --bg-hover: rgba(240, 243, 250, 0.92);
  --border: rgba(19, 23, 34, 0.08);
  --text: #131722;
  --text-muted: #787b86;
  --accent: #2962ff;
  --accent-hover: #1e53e5;
  --positive: #089981;
  --positive-bg: rgba(8, 153, 129, 0.1);
  --negative: #f23645;
  --negative-bg: rgba(242, 54, 69, 0.08);
  --warning: #f7931a;
  --shadow: 0 4px 24px rgba(19, 23, 34, 0.06);
  --panel-alpha: 0.85;
  --blur: 20px;
}

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

/* Clear numerals — DM Sans tabular figures (0 distinct from 8); slashed zero on mono leftovers */
:is(
  .kpi-value,
  .journal-metric-value,
  .journal-list-count,
  .trade-pnl,
  .stat-value,
  .cal-kpi-value,
  .cal-pnl,
  .cal-wr,
  .cal-count,
  .cal-day-detail-pnl,
  .cal-day-stat strong,
  .analysis-kpi-value,
  .tiltmeter-cell-band,
  .exec-traffic-value,
  .journal-cell-r,
  .oi-value,
  .journal-metrics-range,
  .journal-metrics-count,
  .chart-lab-foot-stat strong,
  .analysis-mini-stat strong,
  .stat-chip span:last-child,
  .chart-limit,
  .month-mini-meta,
  .live-chart-btn
) {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  transition: background 0.3s ease;
}

[data-theme="glass"] body {
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(59, 130, 246, 0.12), transparent 50%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(34, 197, 94, 0.08), transparent 50%),
    linear-gradient(160deg, #050508 0%, #0a0e18 40%, #080810 100%);
  background-attachment: fixed;
}

[data-theme="light"] body {
  background:
    radial-gradient(ellipse 100% 80% at 50% -20%, rgba(41, 98, 255, 0.06), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(8, 153, 129, 0.04), transparent 50%),
    linear-gradient(180deg, #eef1f7 0%, #f8f9fd 40%, #eceef4 100%);
  background-attachment: fixed;
}

[data-theme="glass"] .sidebar,
[data-theme="glass"] .panel,
[data-theme="glass"] .stat-card,
[data-theme="glass"] .journal-editor,
[data-theme="glass"] .trade-workspace-shell,
[data-theme="glass"] .account-kpi-strip,
[data-theme="glass"] .trade-row,
[data-theme="glass"] .modal-content,
[data-theme="light"] .sidebar,
[data-theme="light"] .panel,
[data-theme="light"] .stat-card,
[data-theme="light"] .journal-editor,
[data-theme="light"] .trade-workspace-shell,
[data-theme="light"] .trade-workspace,
[data-theme="light"] .account-kpi-strip,
[data-theme="light"] .trade-row,
[data-theme="light"] .open-position-card,
[data-theme="light"] .modal-content {
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
}

[data-theme="light"] .sidebar {
  box-shadow: 1px 0 0 var(--border), 4px 0 24px rgba(19, 23, 34, 0.04);
}

[data-theme="light"] .panel,
[data-theme="light"] .stat-card {
  box-shadow: var(--shadow);
}

[data-theme="light"] .nav-btn.active {
  background: rgba(41, 98, 255, 0.1);
  color: var(--accent);
}

[data-theme="light"] .journal-table tbody tr:hover {
  background: rgba(41, 98, 255, 0.04);
}

[data-theme="light"] .journal-table tbody tr.row-selected {
  background: rgba(41, 98, 255, 0.08);
  outline-color: rgba(41, 98, 255, 0.25);
}

.app {
  display: flex;
  min-height: 100vh;
  --sidebar-width: 260px;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
  transition: transform 0.22s ease;
}

.sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.sidebar-top .brand {
  margin-bottom: 0;
  min-width: 0;
}

.sidebar-close-btn,
.sidebar-open-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-close-btn:hover,
.sidebar-open-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--accent);
}

.sidebar-open-btn {
  position: fixed;
  left: 0.75rem;
  top: 0.75rem;
  z-index: 25;
  box-shadow: var(--shadow);
}

.sidebar-open-btn[hidden] {
  display: none !important;
}

.app.sidebar-collapsed .sidebar {
  transform: translateX(calc(-1 * var(--sidebar-width) - 1px));
}

.app.sidebar-collapsed .main {
  margin-left: 0;
  max-width: none;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 2rem;
}

.brand-icon {
  font-size: 1.75rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border-radius: var(--radius);
}

.brand h1 {
  font-size: 1.1rem;
  font-weight: 700;
}

.brand p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

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

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

.nav-icon {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* Chart Lab sidebar group */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.nav-group-toggle {
  width: 100%;
  justify-content: flex-start;
}

.nav-group-toggle .nav-chevron {
  margin-left: auto;
  font-size: 0.65rem;
  opacity: 0.6;
  transition: transform 0.2s;
}

.nav-group.collapsed .nav-chevron {
  transform: rotate(-90deg);
}

.nav-group.collapsed .nav-sub {
  display: none;
}

.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding-left: 0.35rem;
  margin-left: 0.65rem;
  border-left: 1px solid var(--border);
}

.nav-sub-btn {
  display: block;
  width: 100%;
  padding: 0.42rem 0.55rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-sub-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

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

.sidebar-footer {
  display: flex;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Main */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  max-width: 1400px;
  transition: margin-left 0.22s ease, max-width 0.22s ease;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.75rem;
  gap: 1rem;
}

.page-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

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

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

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

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  flex: 1;
}

.btn-danger {
  background: transparent;
  color: var(--negative);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn-danger:hover {
  background: var(--negative-bg);
}

.btn-edit {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

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

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 500;
}

.stat-value.positive { color: var(--positive); }
.stat-value.negative { color: var(--negative); }

.stat-card-pnl.stat-card-positive {
  border-color: rgba(34, 197, 94, 0.45);
  background: var(--positive-bg);
}

.stat-card-pnl.stat-card-negative {
  border-color: rgba(239, 68, 68, 0.45);
  background: var(--negative-bg);
}

.stat-card-pnl .stat-value.positive { color: var(--positive); font-weight: 600; }
.stat-card-pnl .stat-value.negative { color: var(--negative); font-weight: 600; }

/* Panels */
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.panel h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.25rem;
}

/* Trade list */
.trade-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.trade-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(155deg, rgba(148, 163, 184, 0.05) 0%, transparent 55%), var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s ease;
}

.trade-row:hover {
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.trade-list.compact .trade-row {
  grid-template-columns: 1fr auto;
}

.trade-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.trade-symbol {
  font-weight: 600;
  font-size: 0.95rem;
}

.trade-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trade-direction {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.trade-direction.long {
  background: var(--positive-bg);
  color: var(--positive);
}

.trade-direction.short {
  background: var(--negative-bg);
  color: var(--negative);
}

.trade-pnl {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.95rem;
  text-align: right;
}

.trade-pnl.positive { color: var(--positive); }
.trade-pnl.negative { color: var(--negative); }
.trade-pnl.neutral { color: var(--text-muted); }

.trade-actions {
  display: flex;
  gap: 0.35rem;
}

.trade-list:not(.compact) .trade-row {
  grid-template-columns: 1.2fr 0.6fr 0.8fr 0.8fr auto;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.empty-state p {
  margin-bottom: 1rem;
}

/* Breakdown */
.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.75rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.breakdown-symbol {
  font-weight: 600;
}

.breakdown-count {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Filters */
.filters {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.filters input,
.filters select {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}

.filters input {
  flex: 1;
  min-width: 200px;
}

.filters input:focus,
.filters select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Form */
.trade-form {
  max-width: 720px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.field textarea {
  resize: vertical;
  min-height: 100px;
}

.pnl-preview {
  justify-content: flex-end;
}

.pnl-display {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 500;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.pnl-display.positive { color: var(--positive); }
.pnl-display.negative { color: var(--negative); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  z-index: 100;
  animation: slideUp 0.25s ease;
}

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

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    width: 100%;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 1rem;
  }

  .brand {
    margin-bottom: 0;
  }

  .nav {
    flex-direction: row;
    flex: none;
    width: 100%;
    order: 3;
    margin-top: 0.75rem;
  }

  .sidebar-footer {
    margin-left: auto;
    border-top: none;
    padding-top: 0;
  }

  .main {
    margin-left: 0;
    padding: 1.25rem;
  }

  .app {
    flex-direction: column;
  }

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

  .form-row {
    grid-template-columns: 1fr;
  }

  .trade-list:not(.compact) .trade-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .trade-actions {
    justify-content: flex-end;
  }
}

/* Sync */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-offline {
  background: rgba(239, 68, 68, 0.15);
  color: var(--negative);
}

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

.badge-mt {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
}

.badge-ct {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.badge-source {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  margin-left: 0.35rem;
  vertical-align: middle;
  background: var(--bg-hover);
  color: var(--text-muted);
}

.badge-open {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  margin-left: 0.35rem;
  vertical-align: middle;
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
}

.badge-partial {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  margin-left: 0.35rem;
  vertical-align: middle;
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}

.trade-open-label {
  color: #60a5fa;
  font-weight: 600;
  font-size: 0.85rem;
}

.journal-table tr.row-open {
  background: rgba(59, 130, 246, 0.04);
}

.sync-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.sync-card h3 {
  margin: 0;
  color: var(--text);
}

.sync-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.sync-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.setup-steps {
  margin: 0 0 1rem 1.1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.setup-steps code,
.sync-note code {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.sync-details {
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.sync-details summary {
  cursor: pointer;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.sync-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
}

.sync-note {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.sync-note a {
  color: var(--accent);
}

.remote-access-panel {
  margin-top: 0.85rem;
}

.remote-access-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.remote-access-head h3 {
  margin: 0;
  font-size: 1rem;
}

.remote-access-url-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 0.75rem 0;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid hsl(210 60% 50% / 0.28);
  background: hsl(210 70% 50% / 0.06);
}

.remote-access-url {
  flex: 1;
  min-width: min(100%, 16rem);
  font-size: 0.92rem;
  font-weight: 600;
  word-break: break-all;
}

.remote-access-steps {
  margin-top: 0.65rem;
}

.sync-callout {
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.sync-callout-primary {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: var(--text);
}

.btn-file {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.btn-file input[type="file"] {
  display: none;
}

.sync-desc-tight {
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.sync-accounts-header {
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.sync-accounts-header h3 {
  margin: 0 0 0.35rem;
}

.account-layout {
  min-height: 420px;
}

.accounts-view-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 0.2rem;
  background: var(--surface-2, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: fit-content;
}

.accounts-view-tab {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.accounts-view-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.accounts-view-tab.active {
  color: var(--text);
  background: var(--panel, var(--surface));
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.12));
}

.accounts-tab-panel[hidden] {
  display: none !important;
}

.pretrade-library-panel {
  padding: 1.1rem 1.25rem 1.35rem;
  max-width: 42rem;
}

.pretrade-library-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pretrade-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.pretrade-option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.5rem auto;
  gap: 0.45rem;
  align-items: center;
}

.pretrade-option-row.pattern-option-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.pretrade-option-label,
.pretrade-add-row input,
.pretrade-option-tone,
.pretrade-add-row select {
  width: 100%;
  min-height: 2rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
}

.pretrade-option-actions {
  display: inline-flex;
  gap: 0.15rem;
}

.pretrade-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.5rem auto;
  gap: 0.45rem;
  align-items: center;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.pretrade-add-row.pattern-add-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

@media (max-width: 640px) {
  .pretrade-option-row,
  .pretrade-add-row {
    grid-template-columns: 1fr;
  }
}

.custom-stats-layout {
  min-height: 420px;
}

.custom-stats-sidebar-hint {
  margin: 0 0 0.75rem;
  padding: 0 0.15rem;
}

.custom-stat-journal-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.custom-stat-journal-toggle input {
  accent-color: var(--accent);
}

.inline-custom-stat {
  min-width: 7.5rem;
  max-width: 11rem;
}

.account-manage-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.account-manage-item {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.account-manage-item.active .account-manage-btn {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}

.account-manage-item.account-manage-hidden {
  opacity: 0.55;
}

.account-manage-btn {
  flex: 1;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.account-manage-btn:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.account-manage-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.account-manage-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.account-manage-pnl {
  font-size: 0.72rem;
  font-family: var(--mono);
}

.account-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.account-editor-header h3 {
  margin: 0;
  font-size: 1rem;
}

.account-show-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  flex-shrink: 0;
}

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

.account-show-slider {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  transition: background 0.2s;
}

.account-show-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.account-show-toggle input:checked + .account-show-slider {
  background: var(--accent);
}

.account-show-toggle input:checked + .account-show-slider::after {
  transform: translateX(16px);
}

.account-show-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.account-show-toggle-lg .account-show-slider {
  width: 42px;
  height: 22px;
}

.account-show-toggle-lg .account-show-slider::after {
  width: 18px;
  height: 18px;
}

.account-show-toggle-lg input:checked + .account-show-slider::after {
  transform: translateX(20px);
}

.account-pill-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.account-pill-wrap .account-pill {
  flex: 1;
}

.account-pill-wrap-hidden {
  opacity: 0.55;
}

.account-pill:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.account-show-toggle-sidebar {
  padding: 0.25rem;
}

.account-row-hidden {
  opacity: 0.6;
}

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

.sync-accounts-header h3 {
  margin: 0 0 0.35rem;
}

.accounts-count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.accounts-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.account-row.active {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.08);
}

.account-row-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-width: 0;
}

.account-row-id {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.account-row-ccy {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.account-row-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.account-form h4 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.sync-empty-mt4 {
  text-align: left;
  max-width: 640px;
}

.sync-empty-mt4 h4 {
  margin: 0 0 0.5rem;
}

.badge-default {
  background: var(--bg-hover);
  color: var(--text-muted);
}

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

/* Journal table */
.panel-table {
  overflow-x: auto;
}

.journal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.journal-table.journal-table-sized {
  table-layout: fixed;
}

.journal-table th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: relative;
}

.journal-table th.journal-th-labeled {
  vertical-align: bottom;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
  white-space: normal;
}

.journal-col-resize {
  position: absolute;
  top: 0;
  right: -2px;
  z-index: 2;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.journal-col-resize::after {
  content: '';
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 3px;
  width: 2px;
  border-radius: 1px;
  background: transparent;
}

.journal-table th:hover .journal-col-resize::after,
.journal-col-resize:hover::after,
body.journal-col-resizing .journal-col-resize:hover::after {
  background: var(--accent, #3b82f6);
  opacity: 0.7;
}

body.journal-col-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}

body.journal-col-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.journal-th-label {
  display: block;
  margin-bottom: 0.32rem;
  line-height: 1.1;
}

.journal-th-filter-select {
  display: block;
  width: 100%;
  min-width: 4.25rem;
  max-width: 10rem;
  padding: 0.28rem 1.35rem 0.28rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.journal-th-filter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
}

.journal-th-filter-select.is-active {
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent);
}

.journal-table th.has-col-filter {
  min-width: 5.5rem;
}

.journal-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.journal-table tbody tr.row-journal-open {
  cursor: pointer;
  transition:
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.journal-table tbody tr.row-journal-open td[data-col-id="symbol"],
.journal-table tbody tr.row-journal-open td.col-plan-symbol {
  position: relative;
  padding-left: 0.95rem;
}

.journal-table tbody tr.row-journal-open td[data-col-id="symbol"]::before,
.journal-table tbody tr.row-journal-open td.col-plan-symbol::before {
  content: '';
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: rgba(148, 163, 184, 0.45);
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.journal-symbol-cell {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}

.journal-symbol-name {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}

.journal-table tbody tr.row-journal-open:hover {
  background: rgba(148, 163, 184, 0.06);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08);
}

.journal-table tbody tr.row-selected {
  background: rgba(59, 130, 246, 0.08);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.18);
}

.journal-table tbody tr.row-selected td[data-col-id="symbol"]::before,
.journal-table tbody tr.row-selected td.col-plan-symbol::before {
  background: var(--accent, #3b82f6);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.45);
}

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

.journal-table .col-pnl {
  font-family: var(--mono);
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}

.journal-table .col-actions {
  text-align: right;
  white-space: nowrap;
}

.journal-table .col-time {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.setup-tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--bg-hover);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.setup-tag.empty {
  opacity: 0.5;
}

.session-tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--bg-hover);
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.inline-setup,
.inline-journal-field {
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.inline-setup {
  max-width: 140px;
}

.inline-journal-field.inline-chartTimeframe,
.inline-journal-field.inline-session {
  max-width: 100px;
}

.inline-journal-field.inline-tags,
.inline-journal-field.inline-notes {
  max-width: 160px;
}

.inline-journal-field.inline-entry-reason,
.inline-journal-field.inline-exit-reason,
.inline-journal-field.inline-improvements {
  resize: none;
  line-height: 1.35;
  background: var(--surface);
}

.inline-journal-expand {
  position: relative;
  width: 100%;
  min-width: 220px;
  max-width: 320px;
}

.inline-journal-expand textarea {
  display: block;
  overflow: hidden;
  background: var(--surface);
  transition: height 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.inline-journal-expand:not(.is-expanded):not(:focus-within) textarea {
  cursor: text;
}

.inline-journal-expand.has-content:not(.is-expanded):not(:focus-within) textarea {
  color: var(--text);
}

.inline-journal-expand.is-expanded,
.inline-journal-expand:focus-within {
  z-index: 25;
}

.inline-journal-expand.is-expanded textarea,
.inline-journal-expand:focus-within textarea {
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  border-color: rgba(99, 102, 241, 0.45);
  background: var(--surface);
}

.journal-table .col-inline:has(.inline-journal-expand) {
  min-width: 220px;
  vertical-align: top;
}

.journal-table .col-inline:has(.inline-journal-expand.is-expanded),
.journal-table .col-inline:has(.inline-journal-expand:focus-within) {
  overflow: visible;
  z-index: 20;
}

.journal-table .col-inline:has(.inline-entry-reason) {
  min-width: 220px;
}

.journal-table .col-inline:has(.inline-exit-reason),
.journal-table .col-inline:has(.inline-improvements) {
  min-width: 220px;
}

.inline-tiltmeter {
  position: relative;
  min-width: 5.5rem;
}

.inline-tiltmeter-empty {
  font-size: 0.78rem;
}

.tiltmeter-cell-btn {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.12rem;
  width: 100%;
  min-width: 4.75rem;
  padding: 0.22rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  cursor: pointer;
  color: var(--text-muted);
}

.tiltmeter-cell-btn:hover {
  border-color: var(--accent);
}

.tiltmeter-cell-track {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 0.55rem;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tiltmeter-cell-half {
  flex: 1 1 50%;
  display: flex;
  min-width: 0;
}

.tiltmeter-cell-half-left {
  justify-content: flex-end;
}

.tiltmeter-cell-half-right {
  justify-content: flex-start;
}

.tiltmeter-cell-mid {
  flex: 0 0 2px;
  background: var(--text-muted);
  opacity: 0.35;
}

.tiltmeter-cell-fill {
  height: 100%;
  min-width: 0;
  transition: width 0.2s ease;
}

.tiltmeter-cell-fill-neg {
  background: linear-gradient(270deg, rgba(239, 68, 68, 0.55), var(--negative));
}

.tiltmeter-cell-fill-pos {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.55), var(--positive));
}

.tiltmeter-cell-band {
  font-size: 0.62rem;
  font-weight: 600;
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
  color: var(--text-muted);
}

.inline-tiltmeter-menu {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  z-index: 30;
  min-width: 14rem;
  max-width: 20rem;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.inline-confluence {
  position: relative;
  min-width: 3.5rem;
}

.inline-confluence-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.35rem;
  padding: 0.24rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
}

.inline-confluence-btn:hover {
  border-color: var(--accent);
}

.inline-confluence-score {
  display: inline-flex;
  align-items: baseline;
  gap: 0.05rem;
  font-variant-numeric: slashed-zero tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.inline-confluence-met {
  font-size: 0.88rem;
  font-weight: 800;
  font-family: var(--font, system-ui, -apple-system, sans-serif);
  min-width: 0.62rem;
  text-align: right;
  line-height: 1;
}

.inline-confluence-sep {
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.42;
  padding: 0 0.04rem;
  transform: translateY(-0.02em);
}

.inline-confluence-total {
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font, system-ui, -apple-system, sans-serif);
  opacity: 0.68;
  min-width: 0.62rem;
  line-height: 1;
}

.inline-confluence-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.inline-confluence-btn.conf-zero .inline-confluence-met {
  color: var(--text-muted);
  font-weight: 700;
}

.inline-confluence-btn.conf-zero .inline-confluence-total {
  opacity: 0.55;
}

.inline-confluence-btn.conf-empty {
  color: var(--text-muted);
}

.inline-confluence-btn.conf-unset {
  color: var(--accent);
  border-color: hsl(210 60% 50% / 0.35);
  background: hsl(210 70% 50% / 0.08);
}

.inline-confluence-btn.conf-full {
  color: #15803d;
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.35);
}

.inline-confluence-btn.conf-high {
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.35);
}

.inline-confluence-btn.conf-mid {
  color: #b45309;
  background: rgba(251, 191, 36, 0.16);
  border-color: rgba(251, 191, 36, 0.35);
}

.inline-confluence-btn.conf-low {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
}

.inline-confluence-menu {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  z-index: 30;
  min-width: 16rem;
  max-width: 22rem;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.inline-confluence-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.inline-confluence-menu .checklist-grid-compact {
  max-height: min(42vh, 320px);
  overflow: auto;
}

.journal-table .col-inline:has(.inline-confluence) {
  min-width: 4.5rem;
}

.tiltmeter-inline-grid {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.tiltmeter-inline-heading {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tiltmeter-inline-pretrade .tiltmeter-inline-heading {
  color: var(--text-muted);
}

.tiltmeter-inline-good .tiltmeter-inline-heading {
  color: var(--positive);
}

.tiltmeter-inline-mistakes .tiltmeter-inline-heading {
  color: var(--negative);
}

.pretrade-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.pretrade-chip {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0.28rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  background: var(--bg-hover);
  font-size: 0.72rem;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  color: var(--text);
}

.pretrade-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pretrade-chip-good:has(input:checked) {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.12);
  color: var(--positive);
  font-weight: 600;
}

.pretrade-chip-bad:has(input:checked) {
  border-color: rgba(242, 54, 69, 0.4);
  background: rgba(242, 54, 69, 0.1);
  color: var(--negative);
  font-weight: 600;
}

.pretrade-chip-neutral:has(input:checked),
.pretrade-chip-clear:has(input:checked) {
  border-color: var(--border-strong, var(--border));
  background: var(--surface);
  font-weight: 600;
}

.pretrade-chip-clear {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.pretrade-editor-host {
  margin-top: 0.35rem;
}

.journal-check-section-pretrade {
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.1rem;
}

.journal-check-icon-pre {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
}

.inline-tiltmeter-menu .checklist-grid-compact {
  grid-template-columns: 1fr;
}

.journal-table .col-inline:has(.inline-tiltmeter) {
  min-width: 6.25rem;
  overflow: visible;
}

.journal-table .col-inline:has(.exec-traffic) {
  min-width: 3.25rem;
  text-align: center;
}

.exec-traffic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 2.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.exec-traffic-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.exec-traffic-good {
  border-color: rgba(34, 197, 94, 0.35);
  color: var(--positive);
}

.exec-traffic-good .exec-traffic-dot {
  background: var(--positive);
}

.exec-traffic-warn {
  border-color: rgba(212, 160, 23, 0.35);
  color: #d4a017;
}

.exec-traffic-warn .exec-traffic-dot {
  background: #d4a017;
}

.exec-traffic-bad {
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--negative);
}

.exec-traffic-bad .exec-traffic-dot {
  background: var(--negative);
}

.exec-traffic-na {
  opacity: 0.55;
}

.exec-quality-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.65rem;
}

.exec-quality-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

.exec-quality-card.exec-traffic-good {
  border-color: rgba(34, 197, 94, 0.28);
}

.exec-quality-card.exec-traffic-warn {
  border-color: rgba(212, 160, 23, 0.28);
}

.exec-quality-card.exec-traffic-bad {
  border-color: rgba(239, 68, 68, 0.28);
}

.exec-quality-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.exec-quality-value {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 1.35rem;
  font-weight: 700;
}

.exec-quality-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.exec-quality-warn {
  margin-top: 0.55rem;
  color: var(--negative);
}

.editor-execution-panel {
  margin: 0.55rem 0 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.editor-execution-panel-inner {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.editor-exec-card {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.editor-exec-card-tilt .tiltmeter-cell-btn {
  width: 100%;
  cursor: default;
}

.tiltmeter-cell-btn-static {
  cursor: default;
}

.tiltmeter-cell-btn-static:hover {
  border-color: var(--border);
}

.editor-exec-card-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.editor-exec-card-score {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
}

.editor-exec-card-detail {
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--text);
}

.editor-exec-card-hint {
  font-size: 0.62rem;
  line-height: 1.3;
  color: var(--text-muted);
}

.editor-exec-card.exec-traffic-good {
  border-color: rgba(34, 197, 94, 0.28);
}

.editor-exec-card.exec-traffic-warn {
  border-color: rgba(212, 160, 23, 0.28);
}

.editor-exec-card.exec-traffic-bad {
  border-color: rgba(239, 68, 68, 0.28);
}

.editor-exec-card-empty {
  opacity: 0.92;
}

.exec-traffic-lg {
  align-self: flex-start;
  padding: 0.22rem 0.55rem;
  font-size: 0.82rem;
}

@media (max-width: 900px) {
  .editor-execution-panel-inner {
    grid-template-columns: 1fr;
  }
}

.inline-tags {
  position: relative;
  min-width: 4.5rem;
}

.inline-tags-btn {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  width: 100%;
  max-width: 12rem;
  min-width: 8.5rem;
  min-height: 2rem;
  padding: 0.15rem 0.2rem 0.15rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text);
  text-align: left;
  overflow: hidden;
}

.inline-tags-btn .tag-combo-chips {
  flex-wrap: nowrap;
  overflow: hidden;
}

.inline-tags-btn .tag-combo-placeholder {
  font-size: 0.8rem;
  white-space: nowrap;
}

.inline-tags-btn .tag-combo-caret {
  padding: 0.15rem 0.3rem;
}

.inline-tags-btn[aria-expanded="true"] {
  border-color: var(--accent, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.tag-combo-chip-sm {
  padding: 0.08rem 0.45rem;
  font-size: 0.72rem;
  white-space: nowrap;
  max-width: 7rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
}

.tag-combo-more {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  align-self: center;
}

.inline-tags-menu {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  z-index: 80;
  width: min(17.5rem, 78vw);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

/* display:flex must not override the HTML hidden attribute */
.inline-tags-menu[hidden],
.inline-tiltmeter-menu[hidden],
.inline-confluence-menu[hidden],
.inline-chart-menu[hidden] {
  display: none !important;
}

.inline-tags-menu:not([hidden]) {
  display: block;
}

.tags-picker-shell {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.tags-add-row {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.55rem 0.55rem 0.4rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-hover);
}

.tags-add-input {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.78rem;
}

.tags-add-input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.tags-add-btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
}

.tags-reorder-hint {
  display: none;
}

.tags-picker-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 12.5rem;
  overflow-y: auto;
  padding: 0.4rem;
}

.tags-picker-panel .tags-picker-list {
  max-height: 11rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.3rem;
}

.inline-tag-check {
  font-size: 0.78rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.45rem;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}

.inline-tag-check:hover {
  background: var(--bg-hover);
}

.inline-tag-check:has(input:checked) {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.22);
}

.inline-tag-check.is-dragging {
  opacity: 0.45;
}

.inline-tag-check.drag-over {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.tag-drag-handle {
  flex-shrink: 0;
  cursor: grab;
  color: var(--text-muted);
  user-select: none;
  line-height: 1;
  padding: 0.15rem;
  opacity: 0.55;
}

.tag-drag-handle:hover {
  opacity: 1;
}

.tag-drag-handle:active {
  cursor: grabbing;
}

.tag-check-label {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.inline-tag-check input {
  margin: 0;
  flex-shrink: 0;
}

.inline-chart-gallery .chart-preview-btn {
  cursor: zoom-in;
}

.inline-chart-gallery .chart-preview-btn img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.journal-table .col-inline:has(.inline-tags) {
  min-width: 5rem;
  overflow: visible;
}

.tags-picker-panel {
  margin-top: 0.25rem;
}

.inline-tag-check[hidden],
.tag-combo-create[hidden],
.tag-combo-empty[hidden],
.tag-combo-menu[hidden] {
  display: none !important;
}

/* Editor tag picker — multi-select combobox matching the Pattern dropdown */
.tag-combo {
  position: relative;
  width: 100%;
  max-width: 28rem;
}

.tag-combo-control {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0.25rem 0.3rem 0.25rem 0.45rem;
  cursor: pointer;
}

.tag-combo-control:focus-visible,
.tag-combo.is-open .tag-combo-control {
  outline: none;
  border-color: var(--accent, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.tag-combo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  flex: 1 1 auto;
  min-width: 0;
}

.tag-combo-placeholder {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 0.2rem 0.1rem;
}

.tag-combo-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.12rem 0.2rem 0.12rem 0.5rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
}

.tag-combo-chip-remove {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0 0.2rem;
  border-radius: 999px;
}

.tag-combo-chip-remove:hover {
  color: var(--text);
  background: rgba(99, 102, 241, 0.2);
}

.tag-combo-caret {
  flex: 0 0 auto;
  color: var(--text-muted);
  padding: 0.25rem 0.35rem;
  border-radius: var(--radius-sm);
  transition: transform 0.15s ease;
}

.tag-combo.is-open .tag-combo-caret {
  transform: rotate(180deg);
}

.tag-combo-menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.18));
  overflow: hidden;
}

.tag-combo-menu .tags-add-row {
  background: transparent;
  padding: 0.4rem 0.4rem 0.35rem;
}

.tags-picker-panel .tag-combo-menu .tags-picker-list {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  max-height: 14rem;
  padding: 0.3rem;
}

.tag-combo-create {
  display: block;
  width: calc(100% - 0.6rem);
  margin: 0 0.3rem 0.3rem;
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.42rem 0.55rem;
  border-radius: var(--radius-sm);
  color: var(--accent, #3b82f6);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.tag-combo-create:hover {
  background: rgba(59, 130, 246, 0.12);
}

.tag-combo-empty {
  padding: 0.5rem 0.7rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.tags-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.35rem;
  max-height: 12rem;
  overflow-y: auto;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-hover);
}

.pattern-field {
  margin-top: 0.15rem;
}

.setup-pretrade-pattern-row {
  grid-template-columns: minmax(0, 1.55fr) minmax(12rem, 1fr);
  align-items: start;
}

.setup-pretrade-pattern-row .setup-pretrade-field,
.setup-pretrade-pattern-row .setup-pattern-field {
  margin-top: 0;
  min-width: 0;
}

.setup-pretrade-pattern-row .pattern-combobox {
  max-width: none;
}

.setup-pretrade-pattern-row .workspace-hint {
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .setup-pretrade-pattern-row {
    grid-template-columns: 1fr;
  }
}

.pattern-picker {
  margin-top: 0.35rem;
}

.pattern-combobox {
  position: relative;
  width: 100%;
  max-width: 28rem;
}

.pattern-combobox-inline {
  max-width: 12rem;
  min-width: 8.5rem;
}

.pattern-combobox-control {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0.1rem 0.25rem 0.1rem 0.45rem;
}

.pattern-combobox.is-open .pattern-combobox-control {
  border-color: var(--accent, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.pattern-combobox-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  padding: 0.45rem 0.2rem;
  outline: none;
}

.pattern-combobox-inline .pattern-combobox-input {
  font-size: 0.8rem;
  padding: 0.28rem 0.15rem;
}

.pattern-combobox-clear,
.pattern-combobox-caret {
  flex: 0 0 auto;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0.25rem 0.35rem;
  border-radius: var(--radius-sm);
}

.pattern-combobox-clear:hover,
.pattern-combobox-caret:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.pattern-combobox-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  max-height: 14rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.18));
}

.pattern-combobox-option {
  padding: 0.42rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--text);
  cursor: pointer;
}

.pattern-combobox-option:hover,
.pattern-combobox-option.is-active {
  background: rgba(59, 130, 246, 0.12);
  color: var(--text);
}

.pattern-combobox-create {
  color: var(--accent, #3b82f6);
  font-weight: 600;
}

.pattern-combobox-empty {
  padding: 0.5rem 0.55rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.journal-table .inline-pattern,
.journal-table .pattern-combobox-inline {
  min-width: 8.5rem;
  max-width: 12rem;
}

.journal-table .pattern-combobox-inline .pattern-combobox-control {
  background: var(--surface);
}

.tags-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.35rem;
  max-height: 12rem;
  overflow-y: auto;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-hover);
}

.inline-chart {
  position: relative;
  display: flex;
  justify-content: center;
}

.live-chart-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: pointer;
}

.live-chart-btn.has-chart {
  color: var(--accent);
  border-color: rgba(99, 102, 241, 0.35);
}

.live-chart-btn.no-chart {
  border-style: dashed;
  opacity: 0.85;
}

.live-chart-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
}

.live-chart-icon {
  width: 1.05rem;
  height: 1.05rem;
}

.live-chart-btn.has-thumb {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.live-chart-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.journal-table-live .col-chart-action,
.journal-table-live .col-chart-head {
  width: 3rem;
  min-width: 3rem;
  text-align: center;
  overflow: visible;
}

.journal-table-all .col-chart-action,
.journal-table-all .col-chart-head {
  width: 3rem;
  min-width: 3rem;
  text-align: center;
  overflow: visible;
}

.journal-table-with-pnl .col-pnl {
  font-size: 0.82rem;
  min-width: 5.5rem;
}

.inline-chart-menu {
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  z-index: 35;
  width: min(18rem, 72vw);
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.inline-chart-gallery {
  display: grid;
  gap: 0.45rem;
  max-height: 16rem;
  overflow: auto;
}

.inline-chart-item {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
}

.inline-chart-thumb-wrap {
  position: relative;
}

.inline-chart-delete {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 3;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.92;
  transition: background 0.12s ease, transform 0.12s ease;
}

.inline-chart-delete:hover {
  background: var(--negative);
  transform: scale(1.05);
}

.inline-chart-item img {
  width: 100%;
  max-height: 10rem;
  object-fit: contain;
  display: block;
  background: #0b0f14;
}

.inline-chart-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0.45rem;
}

.inline-chart-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.35rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
}

.journal-table-live tbody tr.row-journal-open {
  cursor: pointer;
}

.journal-table-live tbody tr.row-journal-open:hover {
  background: rgba(59, 130, 246, 0.05);
}

.journal-table-live tbody tr.row-open td[data-col-id="symbol"]::before {
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.journal-table-all tbody tr.row-win {
  background: rgba(34, 197, 94, 0.06);
}

.journal-table-all tbody tr.row-win td[data-col-id="symbol"]::before {
  background: linear-gradient(180deg, #4ade80, #16a34a);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.38);
}

.journal-table-all tbody tr.row-win:hover {
  background: rgba(34, 197, 94, 0.1);
}

.journal-table-all tbody tr.row-loss {
  background: rgba(239, 68, 68, 0.06);
}

.journal-table-all tbody tr.row-loss td[data-col-id="symbol"]::before {
  background: linear-gradient(180deg, #f87171, #dc2626);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
}

.journal-table-all tbody tr.row-loss:hover {
  background: rgba(239, 68, 68, 0.1);
}

.journal-table-all tbody tr.row-selected.row-win {
  background: rgba(34, 197, 94, 0.16);
  outline-color: rgba(34, 197, 94, 0.38);
}

.journal-table-all tbody tr.row-selected.row-loss {
  background: rgba(239, 68, 68, 0.16);
  outline-color: rgba(239, 68, 68, 0.38);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.inline-setup:focus,
.inline-journal-field:focus {
  outline: none;
  border-color: var(--accent);
}

.journal-table .col-inline {
  min-width: 90px;
  max-width: 170px;
  vertical-align: middle;
}

.sync-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  line-height: 1.4;
}

/* Analysis */
.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.analysis-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.analysis-table th,
.analysis-table td {
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.analysis-table th {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.analysis-table td:last-child,
.analysis-table th:last-child {
  text-align: right;
  font-family: var(--mono);
}

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

  .journal-table {
    font-size: 0.8rem;
  }
}

/* Chart Lab / Analysis */
.analysis-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.analysis-kpi-card {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.analysis-kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.analysis-kpi-value {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--mono);
}

.analysis-kpi-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.analysis-instrument-focus {
  margin-bottom: 0.75rem;
}

.analysis-instrument-focus-inner {
  padding: 0.85rem 1rem;
}

.analysis-instrument-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.analysis-instrument-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.analysis-instrument-meta {
  margin: 0.2rem 0 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.analysis-instrument-badge {
  flex-shrink: 0;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.analysis-instrument-kpis {
  margin-bottom: 0;
}

.analysis-instrument-setups {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.analysis-instrument-setups h4 {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

/* —— Performance by Instrument —— */
.ipi-panel {
  padding: 1.1rem 1.15rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--surface) 88%, var(--bg-hover)) 0%, var(--surface) 58%),
    var(--surface);
}

.ipi-header { margin-bottom: 0.95rem; }

.ipi-eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ipi-title,
.ipi-focus-title {
  margin: 0 0 0.3rem;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.ipi-lede {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-muted);
  max-width: 42rem;
}

.ipi-muted {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ipi-insights {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.95rem;
}

.ipi-insight {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-align: left;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ipi-insight:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, var(--bg));
}

.ipi-insight-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ipi-insight-name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ipi-insight-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.ipi-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.9rem;
}

.ipi-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
}

.ipi-toolbar-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 0.15rem;
}

.ipi-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.ipi-chip {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.ipi-chip:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--text-muted) 50%, var(--border));
}

.ipi-chip.is-active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
}

.ipi-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.ipi-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  text-align: left;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.ipi-card:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  transform: translateY(-1px);
}

.ipi-card.is-up { border-color: color-mix(in srgb, var(--positive) 28%, var(--border)); }
.ipi-card.is-down { border-color: color-mix(in srgb, var(--negative) 28%, var(--border)); }

.ipi-card-rank {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-hover);
}

.ipi-card-main { min-width: 0; }

.ipi-card-top {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.ipi-card-symbol {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.ipi-card-asset {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.ipi-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font-size: 0.72rem;
  margin-bottom: 0.35rem;
}

.ipi-card-metrics em {
  font-style: normal;
  color: var(--text-muted);
  margin-right: 0.15rem;
}

.ipi-card-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--bg-hover);
  overflow: hidden;
}

.ipi-card-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.ipi-card-fill.positive { background: var(--positive); }
.ipi-card-fill.negative { background: var(--negative); }
.ipi-card-fill.neutral { background: var(--text-muted); }

.ipi-card-pnl {
  font-family: var(--num, var(--mono));
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ipi-section {
  margin-top: 0.35rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--border);
}

.ipi-section-head { margin-bottom: 0.55rem; }

.ipi-section-title {
  margin: 0 0 0.2rem;
  font-size: 0.88rem;
  font-weight: 650;
}

.ipi-section-hint {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

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

.ipi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.ipi-table th {
  text-align: left;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.4rem 0.45rem;
  border-bottom: 1px solid var(--border);
}

.ipi-table td {
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  vertical-align: middle;
}

.ipi-row { cursor: pointer; }

.ipi-row:hover td {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.ipi-sym-cell {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.ipi-sym-cell span {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.ipi-ls {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.ipi-impact-cell {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-width: 5rem;
}

.ipi-impact-track {
  height: 4px;
  border-radius: 999px;
  background: var(--bg-hover);
  overflow: hidden;
}

.ipi-impact-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.ipi-impact-fill.positive { background: var(--positive); }
.ipi-impact-fill.negative { background: var(--negative); }

.ipi-focus-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.ipi-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.ipi-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.ipi-kpi span {
  font-size: 0.66rem;
  color: var(--text-muted);
}

.ipi-kpi strong {
  font-family: var(--num, var(--mono));
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.ipi-kpi em {
  font-style: normal;
  font-size: 0.65rem;
  color: var(--text-muted);
}

.ipi-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 0.35rem;
}

.ipi-side {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.ipi-side-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ipi-side strong {
  font-family: var(--num, var(--mono));
}

@media (max-width: 720px) {
  .ipi-focus-head { flex-direction: column; }
  .ipi-sides { grid-template-columns: 1fr; }
}

.analysis-lab-panel {
  padding: 0 !important;
  overflow: hidden;
}

.analysis-lab-layout {
  display: flex;
  min-height: 360px;
}

.analysis-lab-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 168px;
  flex-shrink: 0;
  padding: 0.85rem 0.65rem;
  border-right: 1px solid var(--border);
  background: var(--bg-hover);
}

.analysis-lab-sidebar-label {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 0.45rem 0.5rem;
}

.analysis-lab-tab {
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.analysis-lab-tab:hover {
  color: var(--text);
  background: var(--bg);
}

.analysis-lab-tab.active {
  background: var(--bg-elevated);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--border);
}

.analysis-lab-main {
  flex: 1;
  min-width: 0;
  padding: 1rem 1.25rem 1.25rem;
}

.analysis-lab-panel[hidden] {
  display: none;
}

.analysis-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.analysis-block h4 {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
}

.analysis-feature-block h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.analysis-feature-block-spaced {
  margin-top: 1.5rem;
}

.analysis-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 0.85rem;
}

.analysis-compare {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.analysis-compare-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 0.65rem;
}

.analysis-compare-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.analysis-compare-track {
  height: 10px;
  border-radius: 999px;
  background: var(--bg-hover);
  overflow: hidden;
}

.analysis-compare-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 4px;
}

.analysis-compare-fill.actual.positive { background: var(--positive); }
.analysis-compare-fill.actual.negative { background: var(--negative); }
.analysis-compare-fill.potential { background: var(--accent); opacity: 0.75; }

.analysis-compare-val {
  font-family: var(--mono);
  font-size: 0.85rem;
  min-width: 72px;
  text-align: right;
}

.analysis-mini-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
}

.analysis-mini-stat {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.analysis-mini-stat span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.analysis-mini-stat strong {
  font-family: var(--mono);
  font-size: 0.95rem;
}

.analysis-psych-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.25rem;
  align-items: start;
}

/* —— Pre-trade Impact panel —— */
.pti-panel {
  padding: 1.1rem 1.15rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--surface) 88%, var(--bg-hover)) 0%, var(--surface) 55%),
    var(--surface);
}

.pti-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.pti-eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pti-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.pti-lede {
  margin: 0;
  max-width: 36rem;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.pti-coverage-inline {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.pti-coverage-ring {
  --pti-cover: 0;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(
    var(--accent) calc(var(--pti-cover) * 1%),
    var(--bg-hover) 0
  );
  position: relative;
}

.pti-coverage-ring::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--surface);
}

.pti-coverage-ring span {
  position: relative;
  z-index: 1;
  font-family: var(--num, var(--mono));
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pti-coverage-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.pti-coverage-copy strong {
  font-family: var(--num, var(--mono));
  font-size: 0.95rem;
}

.pti-coverage-copy span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.pti-coverage-track {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-hover);
  overflow: hidden;
  margin-bottom: 0.45rem;
}

.pti-coverage-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.pti-coverage-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pti-empty {
  padding: 1.25rem 0.25rem 0.35rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.pti-empty p {
  margin: 0.75rem 0 0;
}

.pti-hero {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem;
  align-items: stretch;
  margin-bottom: 0.9rem;
}

.pti-tone-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.85rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}

.pti-tone-good {
  border-color: color-mix(in srgb, var(--positive) 32%, var(--border));
  background: linear-gradient(160deg, color-mix(in srgb, var(--positive) 10%, transparent), var(--bg));
}

.pti-tone-bad {
  border-color: color-mix(in srgb, var(--negative) 32%, var(--border));
  background: linear-gradient(160deg, color-mix(in srgb, var(--negative) 10%, transparent), var(--bg));
}

.pti-tone-card.is-empty {
  opacity: 0.72;
}

.pti-tone-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.pti-tone-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pti-tone-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.pti-tone-value {
  font-family: var(--num, var(--mono));
  font-size: 1.45rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.pti-tone-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--text);
}

.pti-tone-metrics em {
  font-style: normal;
  color: var(--text-muted);
  margin-right: 0.2rem;
}

.pti-tone-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pti-hero-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-width: 5.5rem;
  padding: 0.25rem 0.15rem;
}

.pti-vs {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--bg-hover);
}

.pti-gap {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.pti-gap-label,
.pti-gap-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.pti-gap strong {
  font-family: var(--num, var(--mono));
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.pti-gap-empty {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 5.5rem;
  line-height: 1.3;
}

.pti-compare {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.95rem;
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

.pti-compare-row {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  align-items: center;
  gap: 0.55rem;
}

.pti-compare-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pti-compare-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-hover);
  overflow: hidden;
}

.pti-compare-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 3px;
}

.pti-compare-fill.positive { background: var(--positive); }
.pti-compare-fill.negative { background: var(--negative); }

.pti-compare-val {
  font-family: var(--num, var(--mono));
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  min-width: 4.5rem;
  text-align: right;
}

.pti-stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 1.15rem;
}

.pti-stat {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.pti-stat span {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.pti-stat strong {
  font-family: var(--num, var(--mono));
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.pti-section {
  margin-top: 0.35rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.pti-section + .pti-section {
  margin-top: 0.85rem;
}

.pti-section-head {
  margin-bottom: 0.65rem;
}

.pti-section-title {
  margin: 0 0 0.25rem;
  font-size: 0.88rem;
  font-weight: 650;
}

.pti-section-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

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

.pti-state-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.pti-state-table th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.pti-state-table td {
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  vertical-align: middle;
}

.pti-state-table tbody tr:last-child td {
  border-bottom: none;
}

.pti-state-cell {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.pti-state-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}

.pti-dot-good { background: var(--positive); }
.pti-dot-bad { background: var(--negative); }
.pti-dot-neutral { background: var(--warning, #d4a017); }

.pti-impact-cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 5.5rem;
}

.pti-impact-track {
  height: 4px;
  border-radius: 999px;
  background: var(--bg-hover);
  overflow: hidden;
}

.pti-impact-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.pti-impact-fill.positive { background: var(--positive); }
.pti-impact-fill.negative { background: var(--negative); }
.pti-impact-fill.neutral { background: var(--text-muted); }

@media (max-width: 820px) {
  .pti-hero {
    grid-template-columns: 1fr;
  }

  .pti-hero-mid {
    flex-direction: row;
    min-width: 0;
    justify-content: space-between;
    padding: 0.15rem 0.35rem;
  }

  .pti-stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pti-header {
    flex-direction: column;
  }
}

.tiltmeter {
  text-align: center;
}

.tiltmeter-ring {
  width: 140px;
  height: 140px;
  margin: 0 auto 0.5rem;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: conic-gradient(var(--accent) calc(var(--tilt) * 1%), var(--bg-hover) 0);
  position: relative;
}

.tiltmeter-ring::before {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--bg-elevated);
}

.tiltmeter-value,
.tiltmeter-caption {
  position: relative;
  z-index: 1;
}

.tiltmeter-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--mono);
}

.tiltmeter-caption {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.tiltmeter.tilt-good .tiltmeter-ring { background: conic-gradient(var(--positive) calc(var(--tilt) * 1%), var(--bg-hover) 0); }
.tiltmeter.tilt-warn .tiltmeter-ring { background: conic-gradient(#d4a017 calc(var(--tilt) * 1%), var(--bg-hover) 0); }
.tiltmeter.tilt-bad .tiltmeter-ring { background: conic-gradient(var(--negative) calc(var(--tilt) * 1%), var(--bg-hover) 0); }

.analysis-r-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.analysis-r-bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 32px;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.82rem;
}

.analysis-r-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-hover);
  overflow: hidden;
}

.analysis-r-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  min-width: 2px;
}

@media (max-width: 900px) {
  .analysis-lab-layout {
    flex-direction: column;
  }

  .analysis-lab-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .analysis-lab-sidebar-label {
    width: 100%;
  }

  .analysis-section-grid {
    grid-template-columns: 1fr;
  }

  .analysis-psych-layout {
    grid-template-columns: 1fr;
  }
}

/* Performance / Analysis */
.analysis-page-header {
  align-items: flex-start;
}

.analysis-trade-badge {
  flex-shrink: 0;
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-hover);
}

.analysis-subtitle {
  margin-top: 0.15rem;
}

.analysis-toolbar {
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.85rem !important;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.analysis-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.analysis-toolbar-field select {
  min-width: 7.5rem;
  max-width: 10rem;
  font-size: 0.8rem;
  padding: 0.32rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface, var(--bg-hover));
  color: var(--text);
}

.analysis-toolbar-field-month select {
  min-width: 6.5rem;
}

.analysis-toolbar-segments {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.analysis-segment {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.analysis-segment .journal-period-btn {
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
}

.analysis-clear-btn {
  flex-shrink: 0;
}

.analysis-more-filters {
  border-top: 1px solid var(--border);
  padding-top: 0.45rem;
}

.analysis-more-filters summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  list-style: none;
  user-select: none;
}

.analysis-more-filters summary::-webkit-details-marker {
  display: none;
}

.analysis-more-grid {
  margin-top: 0.65rem;
}

.analysis-active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 0;
}

.analysis-active-chips:empty {
  display: none;
}

.analysis-active-chips .ew-filter-chip {
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
}

@media (max-width: 900px) {
  .analysis-toolbar-segments {
    margin-left: 0;
    width: 100%;
  }
}

.analysis-section-panel[hidden] {
  display: none !important;
}

.analysis-equity-stage {
  padding: 1rem 1.25rem 1.25rem !important;
}

.analysis-equity-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.analysis-equity-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 36rem;
}

.equity-display-toggle select {
  min-width: 10.5rem;
}

.equity-chart-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.equity-chart-meta {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0 0.15rem;
}

.equity-chart-kicker {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.equity-chart-headline {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}

.equity-chart-headline.is-up { color: var(--positive); }
.equity-chart-headline.is-down { color: var(--negative); }

.equity-chart-meta-side {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.equity-chart-dot { opacity: 0.55; }

.equity-chart-wrap {
  position: relative;
  cursor: crosshair;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 80% at 10% 0%, rgba(34, 197, 94, 0.06), transparent 45%),
    radial-gradient(90% 70% at 90% 100%, rgba(59, 130, 246, 0.05), transparent 50%),
    var(--bg-hover);
  overflow: hidden;
}

.equity-plot-bg {
  fill: rgba(15, 23, 42, 0.22);
}

.equity-grid-line {
  stroke: #2a3a52;
  stroke-opacity: 0.45;
  stroke-width: 1;
}

.equity-zero-line {
  stroke: #64748b;
  stroke-dasharray: 4 4;
  stroke-opacity: 0.75;
  stroke-width: 1.1;
}

.equity-tick-mark {
  stroke: #64748b;
  stroke-opacity: 0.7;
}

.equity-axis-tick {
  fill: #8b9cb3;
  font-size: 10px;
}

.equity-axis-title {
  fill: #8b9cb3;
  font-size: 10px;
  font-weight: 600;
}

.equity-line {
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.25));
}

.equity-peak-halo {
  fill: none;
  stroke: currentColor;
  stroke: #94a3b8;
  stroke-opacity: 0.55;
  stroke-width: 1.25;
}

.equity-peak-label {
  fill: #94a3b8;
  font-size: 9px;
  font-weight: 600;
}

.equity-crosshair {
  stroke: #94a3b8;
  stroke-opacity: 0.55;
  stroke-dasharray: 3 4;
  stroke-width: 1;
  pointer-events: none;
}

.equity-active-dot {
  stroke: #0f172a;
  stroke-width: 1.5;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.15));
}

.equity-chart-interactive .equity-point {
  stroke: var(--bg, #0f172a);
  stroke-width: 1.5;
  cursor: pointer;
  transition: r 0.12s ease;
}

.equity-chart-interactive .equity-point-win { fill: #22c55e; }
.equity-chart-interactive .equity-point-loss { fill: #ef4444; }
.equity-chart-interactive .equity-point-be { fill: #94a3b8; }

.equity-point-group.is-active .equity-point {
  r: 6;
  stroke-width: 2;
}

.equity-chart-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 11rem;
  max-width: 15rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(10, 16, 28, 0.94);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  font-size: 0.72rem;
  line-height: 1.45;
  pointer-events: none;
}

.equity-tip-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
}

.equity-tip-top strong {
  display: block;
  font-size: 0.88rem;
  margin: 0;
}

.equity-tip-trade-no {
  font-family: var(--num);
  color: var(--text-muted);
  font-size: 0.7rem;
}

.equity-tip-meta {
  display: block;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.equity-tip-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.equity-tip-hint {
  display: block;
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-size: 0.65rem;
}

.equity-trades-panel {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}

.equity-trades-title {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.equity-trades-count {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-hover);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

.equity-trades-scroll {
  max-height: 16rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.equity-trades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
}

.equity-trades-table th,
.equity-trades-table td {
  padding: 0.45rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.equity-trades-table th {
  position: sticky;
  top: 0;
  background: var(--bg-hover);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.equity-trade-row {
  cursor: pointer;
}

.equity-trade-row:hover,
.equity-trade-row.is-active {
  background: rgba(59, 130, 246, 0.08);
}

.analysis-equity-chart svg,
.analysis-equity-drawdown svg {
  width: 100%;
  height: auto;
  display: block;
}

.analysis-equity-stats {
  margin: 0.85rem 0 0.35rem;
}

.equity-curve-stats {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.85rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.05), transparent 55%),
    var(--bg-hover);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.equity-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 0 0 auto;
  min-width: max-content;
  padding-right: 0.85rem;
  border-right: 1px solid var(--border);
}

.equity-stat:last-child {
  border-right: none;
  padding-right: 0;
}

.equity-stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.equity-stat-value {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--text);
}

.equity-stat-value.positive { color: var(--positive); }
.equity-stat-value.negative { color: var(--negative); }

.equity-stat-hero .equity-stat-value {
  font-size: 1.15rem;
}
.equity-stat-pl-value {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.2rem;
  font-size: 0.88rem;
}

.equity-stat-pl-value .positive { color: var(--positive); }
.equity-stat-pl-value .negative { color: var(--negative); }

.equity-stat-pl-sep {
  color: var(--text-muted);
  font-weight: 500;
  margin: 0 0.05rem;
}



.analysis-equity-drawdown {
  margin-top: 0.5rem;
}

.chart-lab-stage {
  padding: 0.85rem 1rem 1rem !important;
}

.chart-lab-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.chart-lab-view-nav-wrap {
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.chart-lab-view-nav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 0.15rem;
}

.chart-lab-view-group--inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.chart-lab-nav-divider {
  width: 1px;
  height: 1.25rem;
  background: var(--border);
  flex: 0 0 auto;
  margin: 0 0.15rem;
}

.chart-lab-view-group-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0.75;
}

.chart-lab-view-group-tabs {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.3rem;
}

.chart-lab-view-tab {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 500;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.chart-lab-view-tab:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.chart-lab-view-tab.active {
  color: var(--accent, #3b82f6);
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.08);
}

.analysis-equity-view svg {
  width: 100%;
  height: auto;
  display: block;
}

.analysis-equity-view svg + svg {
  margin-top: 0.5rem;
}

.chart-lab-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
}

.chart-lab-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.chart-lab-display select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
}

#chart-lab-view-select {
  min-width: 11.5rem;
  max-width: 100%;
}

.chart-lab-canvas {
  min-height: 280px;
}

.chart-lab-canvas svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-lab-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.25rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.chart-lab-foot-stat {
  text-align: center;
  min-width: 4.5rem;
}

.chart-lab-foot-stat span {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chart-lab-foot-stat strong {
  font-family: var(--mono);
  font-size: 1rem;
}

.chart-lab-table-wrap {
  overflow-x: auto;
}

@media (max-width: 900px) {
  .chart-lab-nav-head {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ─── Analytical Panel (Edgewonk-style hub) ─── */
.ew-analytical-panel-root {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ew-analytical-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ew-ap-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  gap: 0.5rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.08), transparent 55%),
    var(--surface);
}

.ew-ap-empty-icon {
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 1.35rem;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.22);
  margin-bottom: 0.35rem;
}

.ew-ap-empty h3 {
  margin: 0;
  font-size: 1.1rem;
}

.ew-ap-empty p {
  margin: 0;
  max-width: 28rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Hero strip */
.ew-ap-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.25rem;
  align-items: center;
  padding: 1.15rem 1.35rem 1.15rem 1.5rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background:
    linear-gradient(120deg, rgba(59, 130, 246, 0.1) 0%, transparent 42%),
    linear-gradient(300deg, rgba(139, 92, 246, 0.08) 0%, transparent 38%),
    var(--surface);
}

.ew-ap-hero::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #3b82f6, #8b5cf6);
  border-radius: 4px 0 0 4px;
}

.ew-ap-hero-title {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.ew-ap-hero-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.ew-ap-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 6.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(6px);
}

[data-theme="light"] .ew-ap-kpi,
[data-theme="glass"] .ew-ap-kpi {
  background: rgba(255, 255, 255, 0.85);
}

.ew-ap-kpi--up { border-color: rgba(34, 197, 94, 0.28); background: rgba(34, 197, 94, 0.06); }
.ew-ap-kpi--down { border-color: rgba(239, 68, 68, 0.28); background: rgba(239, 68, 68, 0.06); }
.ew-ap-kpi--accent { border-color: rgba(139, 92, 246, 0.32); background: rgba(139, 92, 246, 0.08); }

.ew-ap-kpi-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.ew-ap-kpi-value {
  font-family: var(--num);
  font-size: 1.05rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.ew-ap-kpi-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.ew-ap-eff-ring {
  --ew-eff: 0;
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(#8b5cf6 calc(var(--ew-eff) * 1%), var(--bg-hover) 0);
  opacity: 0.35;
  pointer-events: none;
}

.ew-ap-eff-ring span {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  font-family: var(--num);
  font-size: 0.95rem;
  font-weight: 700;
  color: #a78bfa;
}

/* Section blocks */
.ew-ap-block {
  position: relative;
  padding: 1.2rem 1.35rem 1.35rem;
  border: 1px solid var(--border);
  overflow: hidden;
}

.ew-ap-block::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  opacity: 0.85;
}

.ew-ap-block--equity::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.ew-ap-block--efficiency::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.ew-ap-block--exit::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.ew-ap-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.ew-ap-block-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.ew-ap-block-badge {
  width: 2.35rem;
  height: 2.35rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 1rem;
  border: 1px solid var(--border);
}

.ew-ap-block-badge--equity {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.25);
}

.ew-ap-block-badge--efficiency {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.25);
}

.ew-ap-block-badge--exit {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.25);
}

.ew-ap-eyebrow {
  margin: 0 0 0.15rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.ew-ap-block-head h3 {
  margin: 0 0 0.25rem;
  font-size: 1.12rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.ew-ap-lede {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 40rem;
}

.ew-ap-display-toggle select {
  min-width: 8.5rem;
}

/* Equity layout */
.ew-ap-equity-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(250px, 0.85fr);
  gap: 1rem;
  align-items: stretch;
}

.ew-ap-chart-shell {
  padding: 0.65rem 0.75rem 0.5rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.04), transparent 45%),
    var(--bg-hover);
}

.ew-ap-equity-chart {
  min-width: 0;
}

.ew-ap-equity-chart .equity-chart-wrap {
  border-radius: 10px;
}

.ew-ap-equity-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ew-ap-sidebar-section {
  padding: 0.75rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.18);
}

[data-theme="light"] .ew-ap-sidebar-section,
[data-theme="glass"] .ew-ap-sidebar-section {
  background: rgba(255, 255, 255, 0.6);
}

.ew-ap-sidebar-section h4 {
  margin: 0 0 0.55rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.ew-ap-stat-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ew-ap-stat {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
  transition: background 0.15s ease, transform 0.15s ease;
}

[data-theme="light"] .ew-ap-stat,
[data-theme="glass"] .ew-ap-stat {
  background: rgba(19, 23, 34, 0.03);
}

.ew-ap-stat:hover {
  background: rgba(59, 130, 246, 0.08);
  transform: translateX(2px);
}

.ew-ap-stat-body {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
  flex: 1;
}

.ew-ap-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.ew-ap-stat-value {
  font-family: var(--num);
  font-size: 0.9rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.ew-ap-stat-value.positive { color: var(--positive); }
.ew-ap-stat-value.negative { color: var(--negative); }

.ew-ap-stat-sep {
  margin: 0 0.15rem;
  color: var(--text-muted);
  font-weight: 500;
}

.ew-ap-stat-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.ew-ap-period-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.ew-ap-period-chip {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-align: center;
  background: rgba(0, 0, 0, 0.1);
}

.ew-ap-period-chip.is-good {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.07);
}

.ew-ap-period-chip.is-mid {
  border-color: rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.06);
}

.ew-ap-period-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.ew-ap-period-chip strong {
  font-family: var(--num);
  font-size: 0.88rem;
}

.ew-ap-period-chip em {
  font-style: normal;
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Rolling windows */
.ew-ap-window-strip {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.ew-ap-window-strip h4,
.ew-ap-quadrant-board h4,
.ew-ap-bars-panel h4 {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.ew-ap-window-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.ew-ap-window-card {
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background:
    linear-gradient(160deg, rgba(59, 130, 246, 0.06), transparent 55%),
    var(--bg-hover);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

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

.ew-ap-window-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.ew-ap-window-days {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.ew-ap-window-trades {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.ew-ap-window-return {
  display: block;
  font-family: var(--num);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.ew-ap-window-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Efficiency section */
.ew-ap-eff-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.ew-ap-eff-score-card {
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid rgba(139, 92, 246, 0.28);
  background:
    linear-gradient(145deg, rgba(139, 92, 246, 0.12), transparent 60%),
    rgba(15, 23, 42, 0.2);
  margin-bottom: 0.65rem;
}

[data-theme="light"] .ew-ap-eff-score-card,
[data-theme="glass"] .ew-ap-eff-score-card {
  background: linear-gradient(145deg, rgba(139, 92, 246, 0.07), #fff 60%);
}

.ew-ap-eff-score-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.ew-ap-eff-score-value {
  display: block;
  font-family: var(--num);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: #a78bfa;
  margin-bottom: 0.55rem;
}

.ew-ap-eff-score-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.ew-ap-eff-score-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
}

.ew-ap-eff-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.ew-ap-quadrant-board {
  padding: 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
}

.ew-ap-quadrant-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.ew-ap-quadrant {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 0.8rem;
  border-radius: 11px;
  border: 1px solid var(--border);
  min-height: 6.5rem;
  transition: transform 0.15s ease;
}

.ew-ap-quadrant:hover {
  transform: scale(1.02);
}

.ew-ap-quadrant--goodWinner {
  background: linear-gradient(145deg, rgba(34, 197, 94, 0.12), transparent 65%);
  border-color: rgba(34, 197, 94, 0.28);
}

.ew-ap-quadrant--badWinner {
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.12), transparent 65%);
  border-color: rgba(245, 158, 11, 0.28);
}

.ew-ap-quadrant--goodLoss {
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.12), transparent 65%);
  border-color: rgba(99, 102, 241, 0.28);
}

.ew-ap-quadrant--badLoss {
  background: linear-gradient(145deg, rgba(239, 68, 68, 0.1), transparent 65%);
  border-color: rgba(239, 68, 68, 0.25);
}

.ew-ap-quadrant-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
}

.ew-ap-quadrant-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
}

.ew-ap-quadrant-share {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--num);
}

.ew-ap-quadrant-count {
  font-family: var(--num);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
}

.ew-ap-quadrant-pnl {
  font-family: var(--num);
  font-size: 0.82rem;
  font-weight: 600;
}

.ew-ap-quadrant-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: auto;
}

/* Bar charts */
.ew-ap-bars-panel {
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .ew-ap-bars-panel,
[data-theme="glass"] .ew-ap-bars-panel {
  background: rgba(255, 255, 255, 0.5);
}

.ew-ap-bars {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.ew-ap-bar-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ew-ap-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
}

.ew-ap-bar-label strong {
  font-family: var(--num);
  font-size: 0.82rem;
}

.ew-ap-bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.ew-ap-bar-track--thin {
  height: 5px;
  margin-top: 0.35rem;
}

.ew-ap-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #818cf8);
  transition: width 0.4s ease;
}

.ew-ap-bar-fill--entry { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.ew-ap-bar-fill--exit { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.ew-ap-bar-fill--mgmt { background: linear-gradient(90deg, #ef4444, #f87171); }
.ew-ap-bar-fill--pre { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.ew-ap-bar-fill--take-profit { background: linear-gradient(90deg, #22c55e, #4ade80); }
.ew-ap-bar-fill--stop-loss { background: linear-gradient(90deg, #ef4444, #f87171); }
.ew-ap-bar-fill--manual { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

/* Exit section — Edgewonk split layout */
.ew-exit-edgewonk-stage {
  padding: 0 !important;
  overflow: hidden;
}

.ew-exit-edgewonk-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  min-height: 420px;
}

.ew-exit-chart-col {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.03), transparent 35%),
    var(--surface);
}

.ew-exit-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.ew-exit-chart-area {
  flex: 1;
  padding: 0.75rem 0.85rem 1rem;
  min-height: 360px;
}

/* Updraw / Drawdown chart */
.ew-ud-chart-wrap {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.ew-ud-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
  padding: 0 0.15rem;
}

.ew-ud-y-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ew-ud-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.ew-ud-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

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

.ew-ud-dot-up { background: #22c55e; }
.ew-ud-dot-down { background: #ef4444; }

.ew-ud-diamond {
  width: 8px;
  height: 8px;
  background: var(--text);
  transform: rotate(45deg);
  display: inline-block;
  border-radius: 1px;
}

.ew-ud-chart {
  width: 100%;
  height: auto;
  flex: 1;
  display: block;
}

.ew-ud-plot-bg {
  fill: rgba(15, 23, 42, 0.15);
  stroke: var(--border);
  stroke-width: 1;
}

[data-theme="light"] .ew-ud-plot-bg,
[data-theme="glass"] .ew-ud-plot-bg {
  fill: #f8fafc;
}

.ew-ud-grid {
  stroke: rgba(148, 163, 184, 0.12);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.ew-ud-grid-target {
  stroke: rgba(148, 163, 184, 0.35);
  stroke-dasharray: none;
  stroke-width: 1.25;
}

.ew-ud-zero {
  stroke: rgba(148, 163, 184, 0.45);
  stroke-width: 1.5;
}

.ew-ud-bar-up {
  fill: rgba(34, 197, 94, 0.75);
}

.ew-ud-bar-down {
  fill: rgba(239, 68, 68, 0.72);
}

.ew-ud-exit-marker {
  fill: var(--text);
}

.ew-ud-axis-tick {
  fill: var(--text-muted);
  font-size: 10px;
  font-family: var(--num);
}

.ew-ud-axis-y {
  font-size: 9px;
}

.ew-ud-trade {
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.ew-ud-trade:hover {
  opacity: 0.85;
}

.ew-ud-empty {
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
}

/* Right exit analysis panel */
.ew-exit-analysis-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-hover);
  overflow-y: auto;
  max-height: 720px;
}

.ew-exit-panel-head {
  display: flex;
  gap: 0.65rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 2;
}

.ew-exit-panel-icon {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 1rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.22);
  color: #f59e0b;
}

.ew-exit-panel-head h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 650;
}

.ew-exit-panel-head p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.ew-exit-subsection {
  padding: 0.95rem 1.1rem 1.05rem;
  border-bottom: 1px solid var(--border);
}

.ew-exit-subsection:last-child {
  border-bottom: none;
}

.ew-exit-subhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.ew-exit-subhead h4 {
  margin: 0 0 0.15rem;
  font-size: 0.88rem;
  font-weight: 650;
}

.ew-exit-subhead p {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.ew-exit-subnote {
  margin: 0 0 0.65rem;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.ew-exit-badge {
  flex-shrink: 0;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  white-space: nowrap;
}

.ew-exit-badge--good {
  color: #15803d;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.28);
}

.ew-exit-badge--mid {
  color: #b45309;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.28);
}

.ew-exit-badge--bad {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.ew-exit-badge--neutral {
  color: var(--text-muted);
  background: var(--bg-hover);
  border: 1px solid var(--border);
}

.ew-exit-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.ew-exit-card {
  padding: 0.65rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ew-exit-card:hover {
  border-color: rgba(59, 130, 246, 0.25);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.ew-exit-card--highlight {
  grid-column: span 2;
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.06), transparent 55%),
    var(--surface);
}

.ew-exit-card h5 {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.ew-exit-card-nums {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin-bottom: 0.3rem;
}

.ew-exit-card-nums strong {
  font-family: var(--num);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ew-exit-card--highlight .ew-exit-card-nums strong {
  font-size: 1.65rem;
}

.ew-exit-card-nums em {
  font-style: normal;
  font-family: var(--num);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ew-exit-card p {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.ew-exit-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.ew-exit-mini {
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.ew-exit-mini span {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.ew-exit-mini strong {
  font-family: var(--num);
  font-size: 0.95rem;
  font-weight: 650;
}

@media (max-width: 1080px) {
  .ew-exit-edgewonk-layout {
    grid-template-columns: 1fr;
  }
  .ew-exit-chart-col {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .ew-exit-analysis-panel {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .ew-exit-card-grid {
    grid-template-columns: 1fr;
  }
  .ew-exit-card--highlight {
    grid-column: span 1;
  }
}

@media (max-width: 1080px) {
  .ew-ap-hero {
    grid-template-columns: 1fr;
  }
  .ew-ap-eff-ring {
    display: none;
  }
  .ew-ap-equity-layout,
  .ew-ap-eff-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .ew-ap-window-cards {
    grid-template-columns: 1fr;
  }
  .ew-ap-period-row {
    grid-template-columns: 1fr;
  }
  .ew-ap-quadrant-grid {
    grid-template-columns: 1fr;
  }
  .ew-ap-hero-kpis {
    justify-content: flex-start;
  }
}

/* EdgeWonk-style extensions */
.stats-grid-lg {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.dashboard-grid-wide {
  grid-template-columns: 2fr 1fr;
}

.dashboard-grid-wide .panel-chart {
  grid-column: 1 / -1;
}

.panel-chart h3 {
  margin-bottom: 0.75rem;
}

.equity-chart,
.drawdown-chart {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 0.5rem;
}

.insights-grid,
.insights-compact {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.insight-card {
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-hover);
}

.insight-card h4 {
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.insight-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.insight-positive { border-left: 3px solid var(--positive); }
.insight-negative { border-left: 3px solid var(--negative); }
.insight-warning { border-left: 3px solid var(--warning); }

.badge-grade {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  margin-left: 0.25rem;
}

.grade-good { background: rgba(34, 197, 94, 0.15); color: var(--positive); }
.grade-mid { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.grade-bad { background: rgba(239, 68, 68, 0.15); color: var(--negative); }

.process-grade-field {
  margin-top: 0.35rem;
}

.process-grade-display {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  min-height: 2rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated, var(--surface));
}

.process-grade-letter {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

.process-grade-score {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.process-grade-parts {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.process-grade-empty {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.r-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-family: var(--mono);
  color: var(--text-muted);
  margin-left: 0.35rem;
}

.tag-chip {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  margin: 0.15rem 0.25rem 0 0;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.tag-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.tag-preset-btn {
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: pointer;
}

.tag-preset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.good-things-grid,
.mistake-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.35rem;
}

.mistake-check {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.good-check {
  color: var(--text);
}

.good-check:has(input:checked) {
  color: var(--positive);
  font-weight: 500;
}

.mistake-check-bad:has(input:checked) {
  color: var(--negative);
  font-weight: 500;
}

.journal-check-section {
  margin-bottom: 1.1rem;
}

.journal-check-heading {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}

.journal-check-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
}

.journal-check-icon-good {
  background: rgba(34, 197, 94, 0.15);
  color: var(--positive);
}

.journal-check-icon-bad {
  background: rgba(242, 54, 69, 0.12);
  color: var(--negative);
}

.journal-check-section-good {
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.checklist-panel {
  margin-bottom: 0.5rem;
}

.checklist-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.checklist-score {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
}

.checklist-score-inline {
  font-style: normal;
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 600;
}

.checklist-setup-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.4rem;
}

.checklist-grid-compact {
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
}

.checklist-check {
  font-size: 0.82rem;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  cursor: pointer;
}

.checklist-check-compact {
  font-size: 0.76rem;
  padding: 0.35rem 0.45rem;
}

.checklist-check input {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.form-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: -0.35rem 0 0.75rem;
  line-height: 1.45;
}

.form-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 1.25rem 0 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.form-section-title:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.field-check {
  display: flex;
  align-items: flex-end;
}

.field-check label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

/* Calendar */
.cal-panel {
  padding: 0;
  overflow: hidden;
}

.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-hover) 0%, var(--bg-elevated) 100%);
}

.cal-view-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  gap: 2px;
}

.cal-view-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.38rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.cal-view-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.cal-view-btn.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.35);
}

.cal-toolbar-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cal-toolbar-period {
  font-size: 0.92rem;
  font-weight: 650;
  min-width: 8rem;
  text-align: center;
}

.cal-view-subtitle {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.cal-calendar-subhead {
  margin-bottom: 0.65rem;
}

.cal-calendar-subhead .calendar-title h3 {
  margin: 0;
  font-size: 1rem;
}

.cal-summary-strip-year {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.cal-layout-yearly .cal-widget-year {
  padding: 0;
}

.cal-year-standalone {
  border-bottom: none;
  padding: 1rem 1.15rem 0.85rem;
}

.cal-year-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.5rem 0 1rem;
  gap: 0.15rem;
}

.cal-year-hero-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-weight: 600;
}

.cal-year-hero-total {
  font-family: var(--num);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.cal-year-hero-total.positive { color: var(--positive); }
.cal-year-hero-total.negative { color: var(--negative); }

.cal-year-hero-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.cal-year-standalone .cal-year-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (min-width: 1100px) {
  .cal-year-standalone .cal-year-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.cal-year-side-hint {
  margin: 0.75rem 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Weekly calendar */
.cal-widget-weekly {
  padding: 1rem 1.15rem 1.25rem;
}

.cal-weekly-head {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr)) 88px;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
  padding: 0 0.15rem;
}

.cal-weekly-head span {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-align: center;
}

.cal-weekly-head-total {
  text-align: right !important;
  padding-right: 0.35rem;
}

.cal-weekly-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cal-week-row {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 0.35rem;
  align-items: stretch;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}

.cal-week-row:hover,
.cal-week-row.cal-week-selected {
  border-color: rgba(59, 130, 246, 0.28);
  background: rgba(59, 130, 246, 0.05);
}

.cal-week-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.cal-week-cell {
  min-height: 3.4rem;
  padding: 0.35rem 0.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  text-align: center;
}

.cal-week-cell.cal-week-outside {
  opacity: 0.35;
  pointer-events: none;
}

.cal-week-cell.cal-win {
  background: rgba(34, 197, 94, calc(var(--cal-heat, 0.2)));
  border-color: rgba(34, 197, 94, 0.28);
}

.cal-week-cell.cal-loss {
  background: rgba(239, 68, 68, calc(var(--cal-heat, 0.2)));
  border-color: rgba(239, 68, 68, 0.25);
}

.cal-week-cell[data-cal-date] {
  cursor: pointer;
}

.cal-week-cell[data-cal-date]:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.cal-week-day-num {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.cal-week-pnl {
  font-family: var(--num);
  font-size: 0.62rem;
  font-weight: 650;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-week-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.cal-week-total-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.cal-week-total-value {
  font-family: var(--num);
  font-size: 0.82rem;
  font-weight: 700;
}

.cal-week-total-meta {
  font-size: 0.62rem;
  color: var(--text-muted);
}

.cal-week-detail .cal-week-day-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

.cal-week-day-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.45rem;
  align-items: center;
  padding: 0.4rem 0.45rem;
  border-radius: 8px;
  background: var(--bg-hover);
  font-size: 0.76rem;
}

.cal-week-day-row strong {
  font-family: var(--num);
  font-size: 0.78rem;
}

@media (max-width: 900px) {
  .cal-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .cal-toolbar-nav {
    justify-content: center;
  }
  .cal-weekly-head,
  .cal-week-days {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
  .cal-weekly-head-total,
  .cal-week-total {
    display: none;
  }
  .cal-week-row {
    grid-template-columns: 1fr;
  }
  .cal-year-standalone .cal-year-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.cal-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.65rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-hover) 0%, var(--bg-elevated) 100%);
}

.cal-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  min-height: 4.5rem;
}

.cal-kpi-hero { grid-column: span 1; }

@media (min-width: 900px) {
  .cal-kpi-hero { grid-column: span 2; }
}

.cal-kpi-hero.cal-kpi-positive {
  border-color: rgba(34, 197, 94, 0.35);
  background: var(--positive-bg);
}

.cal-kpi-hero.cal-kpi-negative {
  border-color: rgba(239, 68, 68, 0.35);
  background: var(--negative-bg);
}

.cal-kpi-positive .cal-kpi-value { color: var(--positive); }
.cal-kpi-negative .cal-kpi-value { color: var(--negative); }

.cal-kpi-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.cal-kpi-value {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
}

.cal-kpi-hero .cal-kpi-value { font-size: 1.35rem; }

.cal-kpi-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.cal-kpi-viz {
  min-height: 5.25rem;
}

.cal-kpi-viz .kpi-viz {
  margin-top: 0.3rem;
}

.cal-kpi-viz .dash-pf-chart-compact {
  height: 2rem;
}

.cal-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  min-height: 420px;
}

.cal-year-toggle.active {
  border-color: var(--accent);
  color: var(--accent);
  background: hsl(210 70% 50% / 0.1);
}

.cal-year-strip {
  padding: 1rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.cal-year-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.cal-year-title {
  flex: 1;
  text-align: center;
}

.cal-year-title h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.cal-year-total {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.cal-year-total.positive { color: var(--positive); }
.cal-year-total.negative { color: var(--negative); }

.cal-year-head-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.cal-year-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.55rem;
}

@media (max-width: 900px) {
  .cal-year-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .cal-year-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.cal-year-month {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  padding: 0.65rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}

.cal-year-month:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.cal-year-month.cal-win {
  background: rgba(34, 197, 94, calc(var(--cal-heat, 0.12)));
  border-color: rgba(34, 197, 94, 0.28);
}

.cal-year-month.cal-loss {
  background: rgba(239, 68, 68, calc(var(--cal-heat, 0.12)));
  border-color: rgba(239, 68, 68, 0.28);
}

.cal-year-month.cal-year-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px hsl(210 70% 50% / 0.18);
}

.cal-year-month.cal-year-current .cal-year-month-name::after {
  content: ' · now';
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cal-year-month-name {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.cal-year-month-pnl {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.cal-year-month-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.cal-year-month-meta.cal-year-empty {
  opacity: 0.65;
}

.cal-year-hint {
  margin: 0.75rem 0 0;
  font-size: 0.76rem;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 960px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-side {
    border-top: 1px solid var(--border);
    border-left: none !important;
  }
}

.cal-widget { padding: 1.25rem; }

.cal-side {
  border-left: 1px solid var(--border);
  border-radius: 0;
  padding: 0;
  background: var(--bg-hover);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cal-side-metrics {
  padding: 1rem 1.1rem 0.85rem;
  flex-shrink: 0;
}

.cal-side-metrics-title {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.cal-side-metrics-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.cal-side-metric {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.cal-side-metric-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.25;
}

.cal-side-metric-value {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
}

.cal-side-metric-value.cal-side-metric-positive {
  color: var(--positive);
}

.cal-side-metric-value.cal-side-metric-negative {
  color: var(--negative);
}

.cal-side-metric-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.cal-side-metric-streak {
  font-weight: 400;
}

.cal-streak-seq {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.cal-streak-leg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.25rem;
  border-radius: 4px;
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  border: 1px solid transparent;
}

.cal-streak-w {
  color: var(--positive);
  background: var(--positive-bg);
}

.cal-streak-l {
  color: var(--negative);
  background: var(--negative-bg);
}

.cal-streak-be {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.12);
}

.cal-streak-leg.cal-streak-active {
  border-color: currentColor;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.cal-side-split {
  height: 1px;
  background: var(--border);
  margin: 0 1rem;
  flex-shrink: 0;
}

.cal-side-day {
  padding: 1rem 1.1rem 1.25rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.cal-side-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 180px;
  color: var(--text-muted);
  gap: 0.35rem;
}

.cal-side-icon {
  font-size: 1.75rem;
  opacity: 0.35;
  margin-bottom: 0.35rem;
}

.cal-side-empty h4 {
  font-size: 0.95rem;
  color: var(--text);
  margin: 0;
}

.cal-side-empty p {
  font-size: 0.8rem;
  max-width: 220px;
  margin: 0;
  line-height: 1.45;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.75rem;
}

.calendar-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.calendar-title h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.cal-current-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(59, 130, 246, 0.12);
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
}

.calendar-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cal-display-toggle {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
}

.cal-display-btn {
  padding: 0.35rem 0.55rem;
  border: none;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.cal-display-btn:last-child {
  border-right: none;
}

.cal-display-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.cal-display-btn.active {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
}

.cal-nav-btn {
  min-width: 2.25rem;
  font-size: 1rem;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-cell {
  min-height: 88px;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-hover);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}

.cal-cell.cal-empty {
  background: transparent;
  border-color: transparent;
  min-height: 0;
}

.cal-cell[data-cal-date] { cursor: pointer; }

.cal-cell.cal-has-trades:hover,
.cal-cell[data-cal-date]:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.cal-cell.cal-today .cal-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
}

.cal-day-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.cal-pnl {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  margin-top: auto;
}

.cal-pnl.positive { color: var(--positive); }
.cal-pnl.negative { color: var(--negative); }

.cal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  font-size: 0.62rem;
  color: var(--text-muted);
}

.cal-wr {
  font-weight: 600;
  color: var(--text);
  opacity: 0.75;
}

.cal-count { opacity: 0.7; }

.cal-win {
  background: rgba(34, 197, 94, calc(var(--cal-heat, 0.18)));
  border-color: rgba(34, 197, 94, calc(var(--cal-heat, 0.18) + 0.12));
}

.cal-loss {
  background: rgba(239, 68, 68, calc(var(--cal-heat, 0.18)));
  border-color: rgba(239, 68, 68, calc(var(--cal-heat, 0.18) + 0.12));
}

.cal-neutral { background: var(--bg-hover); }

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.25rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.cal-legend-swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 3px;
  margin-right: 0.3rem;
  vertical-align: middle;
}

.cal-legend-loss { background: rgba(239, 68, 68, 0.45); }
.cal-legend-flat { background: var(--bg-hover); border: 1px solid var(--border); }
.cal-legend-win { background: rgba(34, 197, 94, 0.45); }

.cal-legend-note {
  margin-left: auto;
  font-style: italic;
  opacity: 0.8;
}

.cal-day-detail-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.cal-day-detail-date {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cal-day-detail-pnl {
  font-size: 1.5rem;
  font-weight: 700;
}

.cal-day-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.cal-day-stat {
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.cal-day-stat span {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.cal-day-stat strong {
  font-size: 0.95rem;
}

.cal-day-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0 0 0.65rem;
}

.cal-day-trades {
  max-height: 320px;
  overflow-y: auto;
}

.cal-day-detail h4 {
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

.cal-cell.cal-selected,
.cal-week-cell.cal-selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  z-index: 1;
}

.trade-row-clickable {
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.trade-row-clickable:hover {
  background: var(--bg-hover);
  transform: translateX(2px);
}

.trade-row-clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Review session */
.review-due-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.08);
  font-size: 0.9rem;
}

.review-due-banner[hidden] {
  display: none;
}

.review-due {
  color: var(--accent);
}

.review-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.review-entries-table tbody tr.review-entry-row {
  cursor: pointer;
}

.review-entries-table tbody tr.review-entry-row:hover {
  background: var(--bg-hover);
}

.review-draft-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.15);
}

.review-editor-trades {
  margin-top: 0.5rem;
  padding: 0.85rem 1rem;
}

.review-editor-trades h4 {
  margin-bottom: 0.25rem;
}

.review-editor-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.review-editor-layout {
  display: flex;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.review-editor-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 1rem 1.1rem 1.1rem;
}

.review-editor-trades-rail {
  flex: 0 0 min(300px, 36%);
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
  border-radius: 0;
  border-top: none;
  border-right: none;
  border-bottom: none;
  border-left: 1px solid var(--border);
  background: var(--bg-hover);
}

.review-trades-rail-head {
  flex-shrink: 0;
  padding: 0.85rem 0.85rem 0.45rem;
  border-bottom: 1px solid var(--border);
}

.review-trades-rail-head h4 {
  margin: 0 0 0.2rem;
  font-size: 0.88rem;
}

.review-trades-rail-head .review-hint {
  margin: 0;
  font-size: 0.72rem;
}

.review-trades-rail-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.35rem 0.25rem 0.85rem 0.65rem;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 130, 246, 0.55) rgba(148, 163, 184, 0.12);
}

.review-trades-rail-scroll::-webkit-scrollbar {
  width: 10px;
}

.review-trades-rail-scroll::-webkit-scrollbar-track {
  margin: 0.35rem 0;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 999px;
}

.review-trades-rail-scroll::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.45);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.review-trades-rail-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.65);
  background-clip: padding-box;
}

.review-workspace {
  width: min(920px, 100%);
  max-width: min(920px, 100%);
}

.review-workspace.trade-workspace-shell {
  max-height: calc(100vh - 2rem);
}

.review-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.review-toolbar-left {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.review-interval-label {
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.review-interval-label select {
  padding: 0.35rem 1.65rem 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.22);
  background-color: rgba(59, 130, 246, 0.06);
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
  cursor: pointer;
}

.review-period-row {
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.review-date-field,
.review-title-field {
  min-width: 140px;
}

.review-title-field input[type="text"] {
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.22);
  background-color: rgba(59, 130, 246, 0.06);
  font-family: inherit;
  font-size: 0.82rem;
  width: 100%;
}

.review-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.review-saved-panel {
  margin-top: 1.25rem;
}

.review-saved-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.review-saved-card {
  padding: 0.85rem 1rem;
}

.review-saved-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.review-saved-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.review-saved-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.review-saved-notes {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
}

.review-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.review-panel-good {
  border-left: 3px solid var(--positive);
}

.review-panel-bad {
  border-left: 3px solid var(--negative);
}

.review-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: -0.5rem 0 0.75rem;
}

.review-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0.5rem 0;
}

.review-mistakes ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.review-mini-table {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.review-mini-table strong {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.review-all-trades h3,
.review-notes-panel h3 {
  margin-bottom: 0.5rem;
}

.review-period-label {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.review-all-trades {
  margin-bottom: 1.25rem;
}

.review-trade-list .trade-row-clickable:last-child {
  border-bottom: none;
}

.review-trades-count {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.review-trades-empty {
  padding: 0.5rem 0.25rem;
}

.review-trades-empty p {
  margin: 0;
  font-size: 0.78rem;
}

.review-trade-list .trade-row-clickable {
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.35rem 0.55rem 0;
}

.review-trades-table-wrap {
  border: none;
  border-radius: 0;
  overflow: visible;
  max-height: none;
  background: transparent;
}

.review-trades-table-wrap.review-trade-list {
  padding: 0;
}

@media (max-width: 760px) {
  .review-editor-layout {
    flex-direction: column;
  }

  .review-editor-trades-rail {
    flex: 0 0 auto;
    max-height: min(42vh, 20rem);
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .review-trades-rail-scroll {
    max-height: min(36vh, 16rem);
  }
}

#review-session-notes {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
}

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

/* Goals */
.goals-form-panel .form-row {
  margin-bottom: 1rem;
}

.goals-grid {
  display: grid;
  gap: 1rem;
}

.goal-card {
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.goal-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.goal-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.goal-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s;
}

.goal-met .goal-fill { background: var(--positive); }
.goal-behind .goal-fill { background: var(--negative); }

#notebook-content,
.notebook-content-editable {
  width: 100%;
  min-height: 28rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.7;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 1rem 1.15rem;
  overflow: auto;
  outline: none;
  background:
    linear-gradient(transparent 0, transparent calc(1.7em - 1px), rgba(139, 156, 179, 0.12) calc(1.7em - 1px), rgba(139, 156, 179, 0.12) 1.7em) 0 0.85rem / 100% 1.7em,
    var(--bg);
  tab-size: 2;
}

[data-theme="light"] #notebook-content,
[data-theme="light"] .notebook-content-editable {
  background:
    linear-gradient(transparent 0, transparent calc(1.7em - 1px), rgba(19, 23, 34, 0.06) calc(1.7em - 1px), rgba(19, 23, 34, 0.06) 1.7em) 0 0.85rem / 100% 1.7em,
    var(--bg);
}

.notebook-content-editable:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

#notebook-content h1 {
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0 0 0.65rem;
  line-height: 1.25;
}

#notebook-content h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.1rem 0 0.45rem;
  line-height: 1.3;
}

#notebook-content h3 {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 0.85rem 0 0.35rem;
  line-height: 1.35;
  color: var(--text-muted);
}

#notebook-content p {
  margin: 0 0 0.55rem;
}

#notebook-content strong {
  font-weight: 700;
}

#notebook-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.85rem 0;
}

#notebook-content ul.notebook-checks {
  list-style: none;
  margin: 0 0 0.65rem;
  padding: 0;
}

#notebook-content ul.notebook-checks li {
  margin: 0.25rem 0;
}

#notebook-content ul.notebook-checks label {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.notebook-layout {
  display: grid;
  grid-template-columns: minmax(240px, 280px) 1fr;
  gap: 1.25rem;
  align-items: start;
  transition: opacity 0.2s ease;
}

.notebook-layout.is-dimmed {
  opacity: 0.45;
  pointer-events: none;
}

.notebook-sidebar {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 6rem);
  overflow: auto;
}

.notebook-sidebar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.notebook-sidebar-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0;
}

.notebook-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.notebook-search-wrap {
  display: block;
  margin-bottom: 0.75rem;
}

.notebook-search-wrap input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
}

.notebook-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.notebook-list-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.75rem 0.25rem;
}

.notebook-item {
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

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

.notebook-item.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}

[data-theme="light"] .notebook-item.active {
  background: rgba(41, 98, 255, 0.08);
  border-color: rgba(41, 98, 255, 0.28);
}

.notebook-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.4rem;
}

.notebook-item-title {
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.3;
}

.notebook-pin-mark {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--warning);
  margin-right: 0.2rem;
  vertical-align: middle;
}

.notebook-item-preview {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notebook-item-date {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.notebook-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  white-space: nowrap;
}

.notebook-badge-sm {
  font-size: 0.6rem;
  padding: 0.1rem 0.35rem;
  flex-shrink: 0;
}

.notebook-editor-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem 0.75rem;
  align-items: start;
  margin-bottom: 0.65rem;
}

.notebook-editor-title-row {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  min-width: 12rem;
  grid-column: 1;
  grid-row: 1;
}

.notebook-symbols-row {
  grid-column: 1 / -1;
  grid-row: 2;
}

.notebook-symbols-row label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

#notebook-symbols {
  display: none;
}

.notebook-symbols-picker {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  min-height: 2.35rem;
}

.notebook-symbols-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  flex: 1 1 auto;
  min-width: 0;
}

.notebook-symbols-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.notebook-symbols-at-btn,
.notebook-at-toolbar-btn {
  flex: 0 0 auto;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--accent, #3b82f6);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1;
}

.notebook-symbols-at-btn:hover,
.notebook-at-toolbar-btn:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}

.notebook-symbols-menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface, var(--bg));
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.18));
}

#notebook-symbols-search {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  margin-bottom: 0.4rem;
}

.notebook-symbols-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 14rem;
  overflow: auto;
}

.notebook-symbols-menu-label,
.notebook-symbols-menu-empty {
  margin: 0.15rem 0.25rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.notebook-symbols-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.notebook-symbols-option:hover {
  background: rgba(59, 130, 246, 0.12);
}

.notebook-symbols-option-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.notebook-symbols-create {
  color: var(--accent, #3b82f6);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.notebook-symbol-chip-removable {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding-right: 0.15rem;
}

.notebook-symbol-chip-remove {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.65;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0 0.15rem;
}

.notebook-symbol-chip-remove:hover {
  opacity: 1;
}

.notebook-symbols-hint {
  margin: 0.25rem 0 0;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.notebook-editor-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.notebook-editor-body {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.notebook-toc {
  flex: 0 0 11rem;
  position: sticky;
  top: 0.5rem;
  max-height: 28rem;
  overflow: auto;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  font-size: 0.72rem;
}

.notebook-toc-label {
  display: block;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.notebook-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notebook-toc li + li {
  margin-top: 0.15rem;
}

.notebook-toc button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.72rem;
  padding: 0.2rem 0;
  cursor: pointer;
}

.notebook-toc button:hover {
  color: var(--accent, #3b82f6);
}

.notebook-toc-flash {
  animation: notebook-toc-flash 1.2s ease;
}

@keyframes notebook-toc-flash {
  0%, 100% { background: transparent; }
  20% { background: rgba(59, 130, 246, 0.12); }
}

.notebook-sidebar-filters {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.notebook-folder-filter,
.notebook-folder-select {
  font: inherit;
  font-size: 0.75rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
}

.notebook-folder-select-wrap {
  flex-shrink: 0;
}

.notebook-tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.notebook-tag-filter-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  cursor: pointer;
}

.notebook-tag-filter-btn.is-active {
  background: rgba(168, 85, 247, 0.14);
  border-color: rgba(168, 85, 247, 0.35);
  color: #a855f7;
}

.notebook-smart-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.55rem;
}

.notebook-item-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: flex-end;
}

.notebook-folder-badge {
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-muted);
}

.notebook-hashtag {
  display: inline;
  font-weight: 600;
  color: #a855f7;
  background: rgba(168, 85, 247, 0.12);
  border-radius: 4px;
  padding: 0 0.15em;
  cursor: default;
}

.notebook-hashtag-option {
  font-weight: 600;
  color: #a855f7;
}

.notebook-hash-toolbar-btn {
  color: #a855f7;
}

.notebook-embed {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  margin: 0.65rem 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  font-size: 0.82rem;
}

.notebook-embed-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.notebook-embed-meta,
.notebook-embed-stats {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.notebook-embed-open {
  margin-left: auto;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--accent, #3b82f6);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.notebook-embed-missing {
  color: var(--text-muted);
  font-style: italic;
}

.notebook-link-menu {
  position: fixed;
  z-index: 10000;
  min-width: 260px;
  max-width: 320px;
  max-height: 16rem;
  overflow: auto;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface, var(--bg));
  box-shadow: var(--shadow-md, 0 12px 32px rgba(0, 0, 0, 0.22));
}

.notebook-link-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.notebook-link-option:hover {
  background: rgba(59, 130, 246, 0.12);
}

.notebook-link-option span {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.notebook-chart-caption-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

@media (max-width: 900px) {
  .notebook-editor-body {
    flex-direction: column;
  }

  .notebook-toc {
    position: static;
    width: 100%;
    max-height: none;
  }
}

.notebook-mention {
  display: inline;
  font-weight: 600;
  color: var(--accent, #3b82f6);
  background: rgba(59, 130, 246, 0.12);
  border-radius: 4px;
  padding: 0 0.15em;
  cursor: default;
}

.notebook-mention-menu {
  position: fixed;
  z-index: 10000;
  min-width: 240px;
  max-width: 280px;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  background: var(--surface, var(--bg));
  box-shadow: var(--shadow-md, 0 12px 32px rgba(0, 0, 0, 0.22));
  animation: notebook-mention-in 0.14s ease-out;
}

.notebook-mention-menu::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 16px;
  width: 9px;
  height: 9px;
  background: inherit;
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}

.notebook-mention-menu.is-above::before {
  top: auto;
  bottom: -5px;
  border-left: none;
  border-top: none;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

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

.notebook-mention-menu[hidden] {
  display: none !important;
}

.notebook-mention-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  max-height: 13rem;
  overflow-y: auto;
}

.notebook-mention-menu-label {
  margin: 0.15rem 0.35rem 0.25rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.notebook-mention-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  width: 100%;
  padding: 0.42rem 0.5rem;
  border: none;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
}

.notebook-mention-option-symbol {
  font-weight: 600;
  color: var(--accent, #3b82f6);
  letter-spacing: 0.02em;
}

.notebook-mention-option:hover,
.notebook-mention-option.is-active {
  background: rgba(59, 130, 246, 0.12);
}

.notebook-mention-option-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.notebook-mention-create .notebook-mention-option-symbol {
  color: var(--text);
}

.notebook-mention-menu-empty {
  margin: 0.15rem 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.notebook-item-symbols {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0.2rem 0 0.15rem;
}

.notebook-symbol-chip {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent, #3b82f6);
  letter-spacing: 0.02em;
}

#notebook-title {
  flex: 1;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
}

.notebook-charts-panel {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.notebook-charts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.notebook-charts-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

.notebook-charts-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.notebook-charts-hint {
  margin: 0 0 0.65rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.threads-setup-form {
  display: grid;
  gap: 0.55rem;
  margin: 0.65rem 0 0.75rem;
}

.threads-setup-form .field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.threads-setup-form input {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
}

.threads-setup-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.threads-setup-hint code {
  font-size: 0.68rem;
  word-break: break-all;
}

.notebook-chart-gallery .chart-item img,
.notebook-chart-gallery .chart-preview-btn img {
  height: 120px;
}

.notebook-editor-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
}

#pin-notebook-btn.is-active,
#pin-notebook-btn[aria-pressed="true"] {
  color: var(--warning);
}

.notebook-toolbar {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-bottom: 0.55rem;
  padding: 0.35rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.notebook-toolbar-spacer {
  flex: 1;
  min-width: 0.5rem;
}

.notebook-toolbar-divider {
  width: 1px;
  height: 1.25rem;
  background: var(--border);
  margin: 0 0.15rem;
}

.notebook-color-group {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.notebook-color-swatch {
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--swatch, var(--bg-hover));
  cursor: pointer;
  flex-shrink: 0;
}

.notebook-color-swatch:hover {
  transform: scale(1.08);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.notebook-color-default {
  --swatch: transparent;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font);
  line-height: 1;
}

.notebook-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0 0.35rem;
  font-variant-numeric: tabular-nums;
}

.notebook-save-status[data-state="saving"] {
  color: var(--warning);
}

.notebook-save-status[data-state="dirty"] {
  color: var(--warning);
}

.notebook-save-status[data-state="saved"] {
  color: var(--positive);
}

.notebook-form-actions {
  margin-top: 0.85rem;
}

.notebook-template-picker {
  margin-bottom: 1.25rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid rgba(59, 130, 246, 0.35);
  box-shadow: var(--shadow);
}

.notebook-template-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.notebook-template-picker-head h3 {
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
}

.notebook-template-picker-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.notebook-template-title-field {
  margin-bottom: 0.85rem;
  max-width: 28rem;
}

.notebook-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem;
}

.notebook-template-card {
  text-align: left;
  padding: 0.85rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.notebook-template-card:hover {
  background: var(--bg-hover);
  border-color: rgba(59, 130, 246, 0.4);
}

.notebook-template-card.is-selected {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.12);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.notebook-template-card-label {
  font-weight: 650;
  font-size: 0.92rem;
}

.notebook-template-card-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.btn-danger-text {
  color: var(--negative);
}

/* Setup Library */
.setup-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.25rem;
  align-items: start;
}

.setup-sidebar-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.setup-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.setup-item {
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

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

.setup-item.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}

.setup-item-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.setup-item-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.setup-editor-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

#setup-name {
  flex: 1;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
}

.setup-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
}

.setup-field > span,
.setup-field-head > span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.setup-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.setup-field textarea,
.setup-field input[type="text"] {
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.setup-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.setup-criteria-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.setup-criterion-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.setup-criterion-input {
  flex: 1;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.setup-comment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 1.5rem;
}

.setup-comment-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  font-size: 0.78rem;
  color: var(--text);
}

.setup-comment-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.15rem;
  line-height: 1;
  font-size: 1rem;
}

.setup-comment-remove:hover {
  color: var(--negative);
}

.setup-comment-add {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.setup-comment-add input {
  flex: 1;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.setup-empty,
.setup-empty-inline {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.comment-presets-host {
  margin-top: 0.4rem;
}

.comment-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.comment-preset-chip {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}

.comment-preset-chip:hover {
  border-color: rgba(59, 130, 246, 0.45);
  color: var(--text);
}

.charts-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.charts-toolbar-hint {
  flex: 1 1 100%;
  font-size: 0.75rem;
  color: var(--chart-lib-muted, var(--text-muted));
}

#view-charts {
  --chart-lib-muted: #c5d4e8;
  --chart-lib-body: #e8eef6;
  --chart-lib-link: #7ec8ff;
  --chart-lib-symbol: #f1f5f9;
}

#journal-section-macro,
.macro-news-host {
  --news-read-bg: rgba(15, 23, 42, 0.35);
  --news-read-surface: rgba(255, 255, 255, 0.03);
  --news-read-title: #f3f6fb;
  --news-read-meta: #b8c8dc;
}

[data-theme="light"] #journal-section-macro,
[data-theme="light"] .macro-news-host {
  --news-read-bg: rgba(255, 255, 255, 0.92);
  --news-read-surface: #ffffff;
  --news-read-title: #131722;
  --news-read-meta: #5b6474;
}

[data-theme="light"] #view-charts {
  --chart-lib-muted: #4b5563;
  --chart-lib-body: #1f2937;
  --chart-lib-link: #2563eb;
  --chart-lib-symbol: #111827;
}

.charts-toolbar input,
.charts-toolbar select {
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.charts-filters-host {
  margin-bottom: 0.75rem;
}

.charts-filters-host .journal-filters {
  margin-bottom: 0;
}

.charts-context-filters .jf-title::after {
  content: ' · same as Journal';
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}

.equity-filters-host {
  margin-bottom: 0.75rem;
}

.equity-filters-host .journal-filters {
  margin-bottom: 0;
}

.equity-context-filters .jf-title::after {
  content: ' · same as Journal';
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}

.charts-toolbar input {
  flex: 1;
  min-width: 200px;
}

.charts-library-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
  gap: 0.85rem;
  padding: 0.25rem 0.25rem 0.75rem;
  align-items: start;
}

.chart-library-group {
  padding: 0 !important;
  overflow: hidden;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.35);
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.18);
}

.chart-library-group-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 0.65rem 0.75rem 0.6rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.12), rgba(15, 23, 42, 0.08));
}

.chart-library-group-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.15;
  color: var(--chart-lib-symbol, #e2e8f0);
}

.chart-library-group-meta {
  font-size: 0.72rem;
  color: var(--chart-lib-muted, var(--text-muted));
  white-space: nowrap;
}

.charts-library-grid {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.65rem;
  padding: 0.65rem 0.65rem 0.75rem;
}

.chart-library-card {
  padding: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  border-radius: calc(var(--radius-sm) - 2px);
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.chart-library-card:hover {
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.22);
  transform: translateY(-1px);
}

.chart-library-image {
  display: block;
  position: relative;
  height: 190px;
  overflow: hidden;
  background: #0b0f14;
}

.chart-library-image .chart-preview-btn,
.chart-library-image .chart-preview-link {
  display: block;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
}

.chart-library-image .chart-preview-btn img,
.chart-library-image .chart-preview-link img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: transform 0.22s ease;
}

.chart-library-card:hover .chart-library-image .chart-preview-btn img,
.chart-library-card:hover .chart-library-image .chart-preview-link img,
.chart-library-image:focus-within .chart-preview-btn img,
.chart-library-image:focus-within .chart-preview-link img {
  transform: scale(1.02);
}

.chart-library-open-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.58);
  color: #f8fafc;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}

.chart-library-card:hover .chart-library-open-hint,
.chart-library-image:focus-within .chart-library-open-hint {
  opacity: 1;
}

.chart-library-meta {
  padding: 0.55rem 0.6rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.chart-library-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  min-width: 0;
}

.chart-library-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  min-width: 0;
}

.chart-library-foot-date {
  font-size: 0.74rem;
  color: var(--chart-lib-muted, var(--text-muted));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-library-caption {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--chart-lib-body, var(--text));
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chart-library-card .trade-direction {
  font-size: 0.66rem;
  padding: 0.12rem 0.38rem;
  line-height: 1.2;
}

.chart-library-card .trade-pnl {
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.chart-library-card .badge-open {
  font-size: 0.66rem;
  padding: 0.12rem 0.38rem;
}

.chart-library-trade-link {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--chart-lib-link, var(--accent));
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.18rem 0.28rem;
  cursor: pointer;
  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease;
}

.chart-library-trade-link:hover {
  color: #dbeafe;
  background: rgba(59, 130, 246, 0.14);
}

[data-theme="light"] .chart-library-trade-link:hover {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.1);
}

.chart-library-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

body.workspace-open {
  overflow: hidden;
}

.trade-workspace-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
#session-workspace-overlay {
  z-index: 240;
}

#trade-workspace-overlay {
  z-index: 260;
}


.trade-workspace-overlay[hidden] {
  display: none;
}

.trade-workspace-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.trade-workspace-shell {
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  max-height: calc(100vh - 2.5rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.modal-content {
  position: relative;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}

.modal-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.modal-section {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.modal-section p,
.modal-list {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.modal-list { padding-left: 1.1rem; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.modal-content {
  width: min(720px, 100%);
}

.platform-section {
  background: rgba(59, 130, 246, 0.05);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
}

.chart-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0;
}

.chart-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
}

.chart-item img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}

.chart-preview-btn,
.chart-preview-link {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  text-decoration: none;
}

.chart-preview-btn img,
.chart-preview-link img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}

.chart-lightbox {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.chart-lightbox[hidden] {
  display: none !important;
}

.chart-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
}

.chart-lightbox-stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  max-width: min(98vw, 1280px);
  width: 100%;
}

.chart-lightbox-panel {
  position: relative;
  flex: 1;
  min-width: 0;
  max-height: 92vh;
  padding: 0.75rem 0.85rem 1rem;
  overflow: auto;
}

.chart-lightbox-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  padding-right: 2rem;
  flex-wrap: wrap;
}

.chart-lightbox-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.chart-lightbox-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.chart-lightbox-zoom-label {
  min-width: 2.75rem;
  text-align: center;
  font-size: 0.75rem;
  font-family: var(--num);
  color: var(--text-muted);
}

.chart-lightbox-viewport {
  overflow: hidden;
  max-height: calc(92vh - 5.5rem);
  min-height: 12rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.chart-lightbox-viewport.is-dragging {
  cursor: grabbing;
}

.chart-lightbox-transform {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 12rem;
  transform-origin: center center;
  will-change: transform;
}

.chart-lightbox-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-lightbox-count {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-family: var(--num);
  color: var(--text-muted);
}

.chart-lightbox-nav {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.chart-lightbox-nav:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.75);
}

.chart-lightbox-nav:disabled {
  opacity: 0.25;
  cursor: default;
}

.chart-lightbox-panel img,
.chart-lightbox-transform img {
  display: block;
  max-width: min(100%, 1200px);
  max-height: calc(92vh - 5.5rem);
  margin: 0 auto;
  border-radius: var(--radius-sm);
  pointer-events: none;
}

.chart-lightbox-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
}

body.chart-lightbox-open {
  overflow: hidden;
}

.news-reader {
  position: fixed;
  inset: 0;
  z-index: 12100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.news-reader[hidden] {
  display: none !important;
}

.news-reader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
}

.news-reader-stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  gap: 0.65rem;
  width: min(1100px, 98vw);
  max-height: 94vh;
  transition: width 0.2s ease, max-height 0.2s ease;
}

.news-reader--web {
  padding: 0.35rem;
}

/* Text reading mode — colorful trading palette, symbol hue, red/green accents */
.news-reader--text {
  --reader-hue: var(--news-hue, 210);
  --reader-accent: hsl(var(--reader-hue) 72% 58%);
  --reader-accent-soft: hsl(var(--reader-hue) 68% 62% / 0.22);
  --reader-green: hsl(142 76% 48%);
  --reader-green-soft: hsl(142 70% 50% / 0.2);
  --reader-red: hsl(4 84% 58%);
  --reader-red-soft: hsl(4 80% 55% / 0.2);
  --reader-gold: hsl(43 92% 58%);
  padding: 1.25rem clamp(0.75rem, 2vw, 1.75rem);
}

.news-reader--text .news-reader-stage {
  width: min(820px, 96vw);
  max-height: 92vh;
}

.news-reader--text .news-reader-panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg,
      hsl(var(--reader-hue) 48% 14% / 0.92) 0%,
      rgba(15, 23, 42, 0.97) 38%,
      hsl(142 35% 11% / 0.55) 100%);
  border: 1px solid hsl(var(--reader-hue) 55% 52% / 0.28);
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.48),
    0 0 0 1px hsl(var(--reader-hue) 60% 50% / 0.08) inset,
    0 0 48px hsl(var(--reader-hue) 70% 45% / 0.12);
}

.news-reader--text .news-reader-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--reader-red), var(--reader-gold), var(--reader-accent), var(--reader-green));
  z-index: 2;
}

.news-reader--text .news-reader-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 0% 0%, var(--reader-red-soft), transparent 38%),
    radial-gradient(circle at 100% 0%, var(--reader-green-soft), transparent 36%),
    radial-gradient(circle at 50% 100%, var(--reader-accent-soft), transparent 42%);
  z-index: 0;
}

.news-reader--text .news-reader-head,
.news-reader--text .news-reader-title,
.news-reader--text .news-reader-view,
.news-reader--text .news-reader-foot {
  position: relative;
  z-index: 1;
}

.news-reader--text .news-reader-head {
  padding: 1.15rem 1.75rem 0.55rem;
  padding-right: 3rem;
  border-bottom: none;
  background: transparent;
}

.news-reader--text .news-reader-symbol {
  background: hsl(var(--reader-hue) 70% 48% / 0.22);
  color: hsl(var(--reader-hue) 88% 80%);
  border: 1px solid hsl(var(--reader-hue) 65% 55% / 0.42);
  box-shadow: 0 0 14px hsl(var(--reader-hue) 70% 50% / 0.15);
}

.news-reader--text .news-reader-source {
  color: hsl(var(--reader-hue) 75% 76%);
  font-weight: 600;
}

.news-reader--text .news-reader-time {
  color: #94a3b8;
}

.news-reader--text .news-reader-count {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--reader-red-soft), var(--reader-accent-soft), var(--reader-green-soft));
  border: 1px solid hsl(var(--reader-hue) 50% 50% / 0.25);
  color: hsl(var(--reader-hue) 90% 84%);
}

.news-reader--text .news-reader-title {
  margin: 0;
  padding: 0 1.75rem 0.9rem;
  font-size: clamp(1.4rem, 2.8vw, 1.75rem);
  line-height: 1.32;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #f8fafc;
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--reader-red), var(--reader-accent), var(--reader-green)) 1;
  text-shadow: 0 1px 18px hsl(var(--reader-hue) 70% 40% / 0.35);
}

.news-reader--text .news-reader-view {
  background:
    radial-gradient(circle at 6% 8%, hsl(4 80% 55% / 0.11), transparent 40%),
    radial-gradient(circle at 94% 10%, hsl(142 72% 48% / 0.13), transparent 38%),
    radial-gradient(circle at 50% 0%, hsl(var(--reader-hue) 70% 55% / 0.16), transparent 58%);
}

.news-reader--text .news-reader-body {
  overflow: hidden;
}

.news-reader--text .news-reader-body .news-reader-article {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--reader-hue) 55% 50% / 0.45) transparent;
}

.news-reader--text .news-reader-body .news-reader-article::-webkit-scrollbar {
  width: 8px;
}

.news-reader--text .news-reader-body .news-reader-article::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--reader-red), var(--reader-accent), var(--reader-green));
  border-radius: 999px;
}

.news-reader-prose-meta {
  max-width: 38rem;
  margin: 0 auto;
  padding: 1.15rem 1.75rem 0.35rem;
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.news-reader-prose-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.72rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--reader-green-soft), var(--reader-accent-soft), var(--reader-red-soft));
  border: 1px solid hsl(var(--reader-hue) 58% 52% / 0.35);
  color: hsl(var(--reader-hue) 92% 84%);
  box-shadow: 0 0 20px hsl(var(--reader-hue) 65% 45% / 0.12);
}

.news-reader-prose-meta span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--reader-green), var(--reader-accent));
  box-shadow: 0 0 8px var(--reader-green);
}

.news-reader-prose {
  max-width: 38rem;
  margin: 0 auto;
  padding: 0.35rem 1.75rem 3rem;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  font-size: 1.125rem;
  line-height: 1.88;
  color: #dce6f2;
  letter-spacing: 0.012em;
  font-variant-ligatures: common-ligatures;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.news-reader-prose > p {
  margin: 0 0 1.4rem;
  orphans: 3;
  widows: 3;
}

.news-reader-prose > p:first-child em,
.news-reader-prose > p:first-child:has(em) {
  display: block;
  font-family: var(--font);
  font-size: 1.04rem;
  line-height: 1.68;
  font-style: normal;
  font-weight: 500;
  color: hsl(var(--reader-hue) 78% 78%);
  margin-bottom: 1.65rem;
  padding: 0 0 1.25rem 0.85rem;
  border-left: 3px solid transparent;
  border-image: linear-gradient(180deg, var(--reader-red), var(--reader-accent), var(--reader-green)) 1;
  border-bottom: 1px solid hsl(var(--reader-hue) 50% 50% / 0.18);
}

.news-reader-prose > p:first-child em {
  font-style: normal;
}

.news-reader-prose > h3 {
  font-family: var(--font);
  margin: 2.15rem 0 0.9rem;
  font-size: 1.08rem;
  line-height: 1.45;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #f1f5f9;
  padding-left: 0.85rem;
  border-left: 3px solid var(--reader-accent);
}

.news-reader-prose > h3:nth-of-type(3n+1) {
  border-left-color: var(--reader-red);
  color: #fecaca;
}

.news-reader-prose > h3:nth-of-type(3n+2) {
  border-left-color: var(--reader-accent);
  color: hsl(var(--reader-hue) 90% 88%);
}

.news-reader-prose > h3:nth-of-type(3n) {
  border-left-color: var(--reader-green);
  color: #bbf7d0;
}

.news-reader-prose > h3 + p {
  margin-top: 0;
}

.news-reader-prose > li {
  margin: 0 0 1rem;
  padding-left: 0.15rem;
  list-style: disc;
  margin-left: 1.35rem;
}

.news-reader-prose > ul {
  margin: 0 0 1.45rem;
  padding: 0.65rem 0 0.65rem 1.15rem;
  list-style: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--reader-red-soft), transparent 40%, var(--reader-green-soft));
  border: 1px solid hsl(var(--reader-hue) 45% 45% / 0.18);
}

.news-reader-prose > ul > li {
  position: relative;
  margin: 0 0 0.85rem;
  padding-left: 1.1rem;
  list-style: none;
}

.news-reader-prose > ul > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--reader-green);
  box-shadow: 0 0 6px var(--reader-green);
}

.news-reader-prose > ul > li:nth-child(even)::before {
  background: var(--reader-accent);
  box-shadow: 0 0 6px var(--reader-accent);
}

.news-reader-prose > p strong {
  color: #fff;
  font-weight: 650;
  background: linear-gradient(120deg, #fff 0%, hsl(var(--reader-hue) 85% 82%) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.news-reader--text .news-reader-foot {
  padding: 0.7rem 1.25rem;
  border-top: 1px solid hsl(var(--reader-hue) 45% 45% / 0.22);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.35), rgba(15, 23, 42, 0.72));
}

.news-reader--text .news-reader-nav {
  opacity: 0.92;
  border-color: hsl(var(--reader-hue) 45% 45% / 0.35);
  background: hsl(var(--reader-hue) 40% 16% / 0.65);
}

.news-reader--text .news-reader-prev:hover:not(:disabled) {
  border-color: var(--reader-red);
  color: #fca5a5;
  box-shadow: 0 0 16px hsl(4 80% 55% / 0.25);
}

.news-reader--text .news-reader-next:hover:not(:disabled) {
  border-color: var(--reader-green);
  color: #86efac;
  box-shadow: 0 0 16px hsl(142 70% 45% / 0.25);
}

.news-reader--text .news-reader-foot .btn-primary {
  background: linear-gradient(135deg, hsl(142 65% 38%), hsl(var(--reader-hue) 60% 42%));
  border-color: hsl(142 55% 42% / 0.5);
}

.news-reader--text .news-reader-foot .btn-primary:hover {
  background: linear-gradient(135deg, hsl(142 68% 44%), hsl(var(--reader-hue) 62% 48%));
}

.news-reader--text .news-reader-loading {
  max-width: 38rem;
  margin: 2.5rem auto;
  padding: 0 1.75rem;
  font-family: var(--font);
  font-size: 0.95rem;
  color: hsl(var(--reader-hue) 78% 78%);
}

.news-reader--web .news-reader-stage {
  width: 100%;
  max-width: none;
  height: calc(100vh - 0.7rem);
  max-height: calc(100vh - 0.7rem);
  gap: 0.35rem;
}

.news-reader--web .news-reader-panel {
  max-height: none;
  height: 100%;
}

.news-reader--web .news-reader-head {
  padding: 0.65rem 1rem 0.55rem;
  padding-right: 3rem;
}

.news-reader--web .news-reader-title {
  font-size: 1rem;
  padding: 0 1rem;
  margin-bottom: 0.35rem;
}

.news-reader--web .news-reader-foot {
  padding: 0.55rem 0.85rem;
}

.news-reader--web .news-reader-nav {
  align-self: center;
  font-size: 2rem;
  width: 2.25rem;
}

.news-reader-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  max-height: 94vh;
  padding: 0 !important;
  overflow: hidden;
}

.news-reader-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.news-reader-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.news-reader-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  height: 100%;
  border: none;
  background: #fff;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.news-reader-body .news-reader-article {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 1.15rem 1rem;
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--news-read-title, var(--text));
}

.news-reader-body .news-reader-cal {
  max-width: 38rem;
  margin: 0 auto;
  padding: 1.25rem 1.75rem 2rem;
  font-size: 1.02rem;
  line-height: 1.7;
}

.macro-news-title {
  margin: 0 0 0.65rem;
  font-size: 1.08rem;
  line-height: 1.55;
  font-weight: 600;
  color: var(--news-read-title, var(--text));
  letter-spacing: -0.01em;
  cursor: pointer;
}

.macro-news-item:hover .macro-news-title {
  color: var(--accent, #3b82f6);
}
.macro-news-open-hint {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent, #3b82f6);
}

.news-reader-close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 2;
}

.news-reader-head {
  padding: 1rem 1.15rem 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-right: 3rem;
}

.news-reader-head-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.35rem;
}

.news-reader-symbol {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.14rem 0.48rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.14);
  color: var(--accent, #3b82f6);
}

.news-reader-source,
.news-reader-time {
  font-size: 0.78rem;
  color: var(--news-read-meta, var(--text-muted));
}

.news-reader-head-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.news-reader-count {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text);
}

.news-reader-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.news-reader-title {
  margin: 0;
  padding: 0.85rem 1.15rem 0.65rem;
  font-size: 1.35rem;
  line-height: 1.45;
  font-weight: 700;
  color: var(--news-read-title, var(--text));
  letter-spacing: -0.015em;
}

.news-reader-loading,
.news-reader-fallback,
.news-reader-cal {
  padding: 1rem 1.15rem;
  color: var(--news-read-meta, var(--text-muted));
}

.news-reader-article p {
  margin: 0 0 1rem;
}

/* Legacy flat article blocks (non-prose wrapper) */
.news-reader-article:not(:has(.news-reader-prose)) p {
  margin: 0 0 1rem;
}

.news-reader-article:not(:has(.news-reader-prose)) h3 {
  margin: 1.25rem 0 0.65rem;
  font-size: 1.05rem;
  line-height: 1.4;
}

.news-reader-article:not(:has(.news-reader-prose)) em {
  color: var(--news-read-meta, var(--text-muted));
}

.news-reader-loading,
.news-reader-fallback {
  color: var(--news-read-meta, var(--text-muted));
}

.news-reader-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.75rem 1.15rem;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.news-reader-nav {
  flex: 0 0 auto;
  align-self: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.news-reader-nav:hover:not(:disabled) {
  border-color: rgba(59, 130, 246, 0.45);
  color: var(--accent, #3b82f6);
}

.news-reader-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

body.news-reader-open {
  overflow: hidden;
}

.macro-news-item[data-open-news-reader] {
  cursor: pointer;
}

.macro-news-item[data-open-news-reader]:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.45);
  outline-offset: 2px;
}

.macro-news-read {
  border: none;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.chart-caption {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0.35rem 0.5rem;
}

.chart-desc-edit {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.35rem 0.5rem 0.5rem;
}

.chart-desc-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.chart-desc-field,
.chart-desc-input {
  width: 100%;
  min-height: 2.4rem;
  resize: vertical;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.35;
}

.chart-desc-field:focus,
.chart-desc-input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.plan-chart-upload-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.5rem;
  align-items: start;
  margin-top: 0.65rem;
}

.plan-chart-upload-meta .chart-desc-label {
  grid-column: 1 / -1;
}

.plan-chart-upload-meta .chart-desc-input {
  grid-column: 1 / 2;
}

.plan-chart-upload-meta .chart-limit {
  align-self: end;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.plan-chart-upload-meta-compact {
  margin-top: 0.45rem;
}

.plan-chart-upload-meta input[type="text"] {
  flex: 1;
  min-width: 140px;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.chart-library-desc {
  margin: 0.35rem 0 0.55rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--text);
}

.entry-updates-panel {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.entry-updates-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.75rem;
  margin-bottom: 0.55rem;
}

.entry-updates-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.entry-updates-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.entry-updates-empty {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.entry-updates-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.entry-update-item {
  padding: 0.55rem 0.65rem;
  border-left: 2px solid rgba(59, 130, 246, 0.45);
  background: var(--bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.entry-update-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.entry-update-head time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.entry-update-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.entry-updates-compose {
  display: grid;
  gap: 0.45rem;
}

.entry-updates-compose .entry-update-input {
  width: 100%;
  resize: vertical;
  min-height: 2.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
}

.entry-updates-compose .entry-update-add {
  justify-self: start;
}

.modal-section .entry-updates-list {
  margin-bottom: 0;
}

.inline-chart-item .chart-desc-edit {
  padding: 0.3rem 0 0;
}

.inline-chart-menu {
  min-width: min(22rem, 85vw);
}

.chart-delete {
  width: 100%;
  border-radius: 0;
}

.chart-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.chart-paste-zone {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  margin: 0.65rem 0;
  padding: 0.65rem;
  border: 2px dashed rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.04);
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.chart-paste-target {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 3.5rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: text;
  outline: none;
}

.chart-paste-target:focus {
  background: rgba(59, 130, 246, 0.06);
}

.chart-paste-zone:hover,
.chart-paste-zone.drag-over {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
}

.chart-paste-zone.drag-over {
  background: rgba(59, 130, 246, 0.12);
}

.chart-paste-zone[contenteditable="true"],
.chart-paste-target[contenteditable="true"] {
  user-select: none;
}

.chart-paste-zone-compact {
  margin: 0 0 0.45rem;
  padding: 0.45rem;
  width: 100%;
}

.chart-paste-zone-compact .chart-paste-target {
  min-height: 2.25rem;
  padding: 0.45rem 0.55rem;
}

.chart-paste-zone .btn {
  align-self: center;
}

.chart-paste-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}

.chart-paste-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.chart-upload {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.chart-upload input[type="text"] {
  flex: 1;
  min-width: 140px;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.chart-limit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.plan-chart-upload-wrap {
  margin: 0.75rem 0 0;
}

.plan-chart-upload-wrap-compact {
  margin: 0;
  width: 100%;
}

.plan-chart-upload-zone-compact {
  min-height: 4.25rem;
  padding: 0.75rem 0.5rem;
}

.plan-chart-upload-zone-compact .plan-chart-upload-icon {
  width: 2rem;
  height: 2rem;
  font-size: 1.1rem;
}

.plan-chart-upload-zone-compact .plan-chart-upload-hint {
  font-size: 0.68rem;
  line-height: 1.25;
  opacity: 0.9;
}

.plan-chart-upload-zone:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

.plan-chart-upload-wrap-compact .chart-limit {
  display: block;
  margin-top: 0.35rem;
}

.inline-chart-item .chart-preview-btn,
.inline-chart-item .chart-preview-link {
  display: block;
  width: 100%;
}

.inline-chart-item .chart-preview-btn img,
.inline-chart-item .chart-preview-link img {
  width: 100%;
  max-height: 10rem;
  object-fit: contain;
  background: #0b0f14;
}

.plan-chart-upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  min-height: 7.5rem;
  padding: 1.25rem 1rem;
  border: 2px dashed rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.04);
  color: var(--text-muted);
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.plan-chart-file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.plan-chart-upload-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  pointer-events: none;
}

.plan-chart-upload-zone:hover,
.plan-chart-upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
  color: var(--text);
}

.plan-chart-upload-zone.drag-over {
  background: rgba(59, 130, 246, 0.12);
}

.plan-chart-upload-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
  font-size: 1.35rem;
  line-height: 1;
}

.plan-chart-upload-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.plan-chart-upload-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  max-width: 22rem;
}

.nav-sub-btn.active .journal-list-count {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.15);
}

.journal-subnav,
.charts-subnav {
  display: flex;
  gap: 0.35rem;
  padding: 0.45rem;
  margin-bottom: 1rem;
}

.journal-subnav-btn,
.charts-subnav-btn {
  flex: 1;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.journal-subnav-btn:hover,
.charts-subnav-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.journal-subnav-btn.active,
.charts-subnav-btn.active {
  color: var(--accent);
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.08);
}

.journal-section-panel { display: block; }
.journal-section-panel[hidden] { display: none !important; }

.charts-tab-panel { display: block; }
.charts-tab-panel[hidden] { display: none !important; }

.plans-list-tabs-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem 0.35rem;
  border-bottom: 1px solid var(--border);
}

.orders-filters-host {
  margin-bottom: 0.45rem;
}

.orders-filters-host .journal-filters {
  margin-bottom: 0;
}

.orders-filters-host .jf-top {
  padding: 0.45rem 0.65rem;
}

.orders-filters-host .jf-section {
  padding: 0.4rem 0.65rem;
}

.orders-context-filters .jf-title::after {
  content: ' · same as Journal';
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}

.orders-status-bar {
  margin-bottom: 0.75rem;
  padding: 0.55rem 0.75rem;
}

.orders-status-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
}

.orders-status-bar .orders-filter-chips {
  flex: 1 1 auto;
  min-width: 0;
}

.orders-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.orders-table-toolbar #new-plan-btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 45%, #2563eb 100%);
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  font-weight: 700;
}

.orders-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.orders-filter-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  overflow: hidden;
  padding: 0.42rem 0.72rem 0.42rem 0.55rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(155deg, rgba(148, 163, 184, 0.08) 0%, transparent 52%), var(--bg);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

.orders-filter-chip::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.09) 50%, transparent 62%);
  transform: translateX(-120%);
  transition: transform 0.55s ease;
  pointer-events: none;
}

.orders-filter-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.38);
  color: var(--text);
  box-shadow:
    0 6px 16px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.orders-filter-chip:hover::after {
  transform: translateX(120%);
}

.orders-filter-chip:focus-visible {
  outline: none;
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.18),
    0 4px 12px rgba(15, 23, 42, 0.1);
}

.orders-filter-chip.is-active {
  transform: translateY(-1px);
}

.orders-filter-chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  flex-shrink: 0;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.orders-filter-chip-all .orders-filter-chip-icon {
  background: linear-gradient(145deg, #94a3b8, #64748b);
  box-shadow: 0 0 10px rgba(148, 163, 184, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.orders-filter-chip-all .orders-filter-chip-icon::before { content: '◈'; }

.orders-filter-chip-pending .orders-filter-chip-icon {
  background: linear-gradient(145deg, #60a5fa, #2563eb);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.orders-filter-chip-pending .orders-filter-chip-icon::before { content: '●'; font-size: 0.48rem; }

.orders-filter-chip-filled .orders-filter-chip-icon {
  background: linear-gradient(145deg, #4ade80, #16a34a);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.orders-filter-chip-filled .orders-filter-chip-icon::before { content: '✓'; }

.orders-filter-chip-missed .orders-filter-chip-icon {
  background: linear-gradient(145deg, #fb923c, #ea580c);
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.orders-filter-chip-missed .orders-filter-chip-icon::before { content: '!'; }

.orders-filter-chip-passed .orders-filter-chip-icon {
  background: linear-gradient(145deg, #cbd5e1, #94a3b8);
  box-shadow: 0 0 8px rgba(148, 163, 184, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  color: #334155;
}

.orders-filter-chip-passed .orders-filter-chip-icon::before { content: '→'; }

.orders-filter-chip-idea .orders-filter-chip-icon {
  background: linear-gradient(145deg, #c084fc, #9333ea);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.orders-filter-chip-idea .orders-filter-chip-icon::before { content: '✦'; }

.orders-filter-chip-cancelled .orders-filter-chip-icon {
  background: linear-gradient(145deg, #cbd5e1, #64748b);
  box-shadow: 0 0 8px rgba(100, 116, 139, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  color: #1e293b;
}

.orders-filter-chip-cancelled .orders-filter-chip-icon::before { content: '×'; font-size: 0.72rem; }

.orders-filter-chip-pending.is-active .orders-filter-chip-icon {
  animation: orders-chip-pulse 2.2s ease-in-out infinite;
}

@keyframes orders-chip-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(59, 130, 246, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.22); }
  50% { box-shadow: 0 0 16px rgba(59, 130, 246, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.22); }
}

.orders-filter-chip-all.is-active {
  background: linear-gradient(155deg, rgba(148, 163, 184, 0.22) 0%, rgba(148, 163, 184, 0.06) 100%);
  border-color: rgba(148, 163, 184, 0.42);
  color: var(--text);
  box-shadow:
    0 4px 14px rgba(148, 163, 184, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.orders-filter-chip-pending.is-active {
  background: linear-gradient(155deg, rgba(59, 130, 246, 0.22) 0%, rgba(59, 130, 246, 0.06) 100%);
  border-color: rgba(59, 130, 246, 0.52);
  color: var(--accent, #3b82f6);
  box-shadow:
    0 4px 16px rgba(59, 130, 246, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.orders-filter-chip-filled.is-active {
  background: linear-gradient(155deg, rgba(34, 197, 94, 0.2) 0%, rgba(34, 197, 94, 0.06) 100%);
  border-color: rgba(34, 197, 94, 0.48);
  color: var(--positive, #22c55e);
  box-shadow:
    0 4px 16px rgba(34, 197, 94, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.orders-filter-chip-missed.is-active {
  background: linear-gradient(155deg, rgba(249, 115, 22, 0.22) 0%, rgba(249, 115, 22, 0.06) 100%);
  border-color: rgba(249, 115, 22, 0.5);
  color: #ea580c;
  box-shadow:
    0 4px 16px rgba(249, 115, 22, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.orders-filter-chip-passed.is-active {
  background: linear-gradient(155deg, rgba(148, 163, 184, 0.2) 0%, rgba(148, 163, 184, 0.05) 100%);
  border-color: rgba(148, 163, 184, 0.42);
  color: var(--text-muted);
  box-shadow:
    0 4px 14px rgba(148, 163, 184, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.orders-filter-chip-idea.is-active {
  background: linear-gradient(155deg, rgba(168, 85, 247, 0.22) 0%, rgba(168, 85, 247, 0.06) 100%);
  border-color: rgba(168, 85, 247, 0.48);
  color: #9333ea;
  box-shadow:
    0 4px 16px rgba(168, 85, 247, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.orders-filter-chip-cancelled.is-active {
  background: linear-gradient(155deg, rgba(100, 116, 139, 0.18) 0%, rgba(100, 116, 139, 0.05) 100%);
  border-color: rgba(100, 116, 139, 0.38);
  color: var(--text-muted);
  box-shadow:
    0 4px 14px rgba(100, 116, 139, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.orders-filter-chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  padding: 0.08rem 0.38rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  border: 1px solid rgba(148, 163, 184, 0.14);
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.orders-filter-chip.is-active .orders-filter-chip-count {
  background: rgba(0, 0, 0, 0.14);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .orders-filter-chip.is-active .orders-filter-chip-count {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(255, 255, 255, 0.45);
}

@media (max-width: 720px) {
  .orders-status-bar-inner {
    align-items: stretch;
  }

  .orders-table-toolbar {
    width: 100%;
    justify-content: flex-end;
  }
}

.plans-list-tabs-row .plans-toolbar-filters {
  flex: 1 1 auto;
  min-width: 200px;
  margin: 0;
}

.plans-list-tabs-row .journal-cols-wrap {
  padding: 0;
}

.plans-list-tabs-row #new-plan-btn {
  flex-shrink: 0;
}

.plans-table-panel {
  padding: 0;
  overflow: hidden;
}

.plans-table-panel .plans-kpi-row {
  margin: 0.65rem 0.75rem 0.5rem;
}

.plans-table-panel #plans-table-wrap {
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.plans-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.plans-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.plans-toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1;
  min-width: 200px;
}

.plans-toolbar-filters input,
.plans-toolbar-filters select {
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.plans-toolbar-filters input { flex: 1; min-width: 160px; }

.plans-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.plan-kpi {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.plan-kpi-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.plan-kpi-value {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.plans-sync-hint {
  margin-top: 0.85rem;
  max-width: 640px;
}

.badge-plan-pending { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.badge-plan-filled { background: var(--positive-bg); color: var(--positive); }
.badge-plan-missed { background: rgba(249, 115, 22, 0.15); color: #ea580c; }
.badge-plan-passed { background: var(--bg-hover); color: var(--text-muted); }
.badge-plan-idea { background: rgba(168, 85, 247, 0.12); color: #9333ea; }
.badge-plan-cancelled { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

.plan-row-clickable { cursor: pointer; }
.plan-row-clickable:hover { background: var(--bg-hover); }

.journal-table-orders tbody tr.plan-row td.col-plan-symbol::before {
  width: 3px;
}

.journal-table-orders tbody tr.plan-row-pending td.col-plan-symbol::before {
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.journal-table-orders tbody tr.plan-row-filled td.col-plan-symbol::before {
  background: linear-gradient(180deg, #4ade80, #16a34a);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.38);
}

.journal-table-orders tbody tr.plan-row-missed td.col-plan-symbol::before {
  background: linear-gradient(180deg, #fb923c, #ea580c);
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.38);
}

.journal-table-orders tbody tr.plan-row-passed td.col-plan-symbol::before {
  background: linear-gradient(180deg, #cbd5e1, #94a3b8);
}

.journal-table-orders tbody tr.plan-row-idea td.col-plan-symbol::before {
  background: linear-gradient(180deg, #c084fc, #9333ea);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.35);
}

.journal-table-orders tbody tr.plan-row-cancelled td.col-plan-symbol::before {
  background: linear-gradient(180deg, #cbd5e1, #64748b);
}

.journal-table-orders tbody tr.plan-row:hover {
  background: rgba(148, 163, 184, 0.06);
}

.journal-table-orders .col-plan-symbol {
  min-width: 7.5rem;
}

.journal-table-orders .plan-row-sub {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.plan-workspace {
  width: min(820px, 100%);
}

.plan-workspace .trade-workspace-header {
  flex-shrink: 0;
}

.journal-table-orders .col-plan-status { width: 8.5rem; }
.journal-table-orders .inline-plan-status { min-width: 7.5rem; }

.plan-editor-section {
  margin-top: 0.5rem;
  padding: 1rem;
}

.plan-editor-checklist-field { margin-top: 0.25rem; }

.plan-editor-checklist-grid .checklist-grid { margin-top: 0.35rem; }

.field-wide { flex: 2; min-width: 12rem; }

.plan-editor-linked {
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.macro-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}

.macro-toolbar-left {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.macro-tabs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.2rem;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border);
}

.macro-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
}

.macro-tab.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.macro-news-host {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.macro-news-warnings {
  margin: 0;
}

.macro-news-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.macro-news-mode-tab {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.macro-news-mode-tab:hover {
  color: var(--text);
  border-color: hsl(210 50% 50% / 0.4);
  background: var(--bg-hover);
}

.macro-news-mode-tab.active {
  color: hsl(32 85% 35%);
  border-color: hsl(38 55% 50% / 0.45);
  background: linear-gradient(135deg, hsl(38 65% 50% / 0.12), var(--bg));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.macro-news-mode-tab[data-macro-news-mode="calendar"].active {
  --news-hue: 38;
  border-color: hsl(38 70% 50% / 0.45);
  background: linear-gradient(135deg, hsl(38 75% 50% / 0.16), var(--bg));
  color: hsl(32 85% 35%);
}

.macro-news-feed--calendar {
  --news-hue: 38;
}

.macro-news-feed--table {
  --news-hue: 38;
}

.macro-news-feed-list--calendar {
  padding: 0;
}

.macro-news-feed-list--table {
  padding: 0;
}

.eco-cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.02), transparent);
}

.eco-cal-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.eco-cal-toolbar-group--grow {
  flex: 1;
  min-width: min(100%, 280px);
}

.eco-cal-toolbar-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

.eco-cal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.eco-cal-chips--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 0.15rem;
}

.eco-cal-chip {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.eco-cal-chip:hover {
  border-color: hsl(38 60% 50% / 0.45);
  color: var(--text);
}

.eco-cal-chip.active {
  border-color: hsl(38 70% 48% / 0.55);
  background: hsl(38 75% 50% / 0.12);
  color: hsl(32 80% 32%);
}

.eco-cal-chip--cur {
  padding: 0.22rem 0.55rem;
}

.eco-cal-table-wrap {
  overflow: auto;
  max-width: 100%;
  max-height: min(68vh, 760px);
  scroll-behavior: smooth;
}

.eco-cal-scroll-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.eco-cal-toolbar-group--hint {
  flex: 1;
  min-width: min(100%, 220px);
}

.eco-cal-now-row td {
  padding: 0.5rem 0.75rem;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: hsl(210 75% 42%);
  background: linear-gradient(90deg, transparent, hsl(210 70% 50% / 0.1), transparent);
  border-top: 1px solid hsl(210 60% 50% / 0.2);
  border-bottom: 1px solid hsl(210 60% 50% / 0.2);
}

.eco-cal-now-row td span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.eco-cal-now-row td span::before,
.eco-cal-now-row td span::after {
  content: '';
  width: 2rem;
  height: 1px;
  background: hsl(210 60% 50% / 0.35);
}

.eco-cal-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.eco-cal-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.eco-cal-table thead th:nth-child(5),
.eco-cal-table thead th:nth-child(6),
.eco-cal-table thead th:nth-child(7) {
  text-align: right;
}

.eco-cal-day-row th {
  padding: 0.55rem 0.75rem;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  color: hsl(32 70% 35%);
  background: hsl(38 70% 50% / 0.08);
  border-top: 1px solid hsl(38 60% 50% / 0.18);
  border-bottom: 1px solid hsl(38 60% 50% / 0.18);
}

.eco-cal-row {
  cursor: pointer;
  transition: background 0.12s;
}

.eco-cal-row:hover {
  background: rgba(59, 130, 246, 0.05);
}

.eco-cal-row--past {
  opacity: 0.82;
}

.eco-cal-row--live .eco-cal-time {
  font-weight: 700;
  color: hsl(210 80% 42%);
}

.eco-cal-row td {
  padding: 0.62rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.eco-cal-time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text);
}

.eco-cal-cur-cell {
  white-space: nowrap;
}

.eco-cal-cur {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.eco-cal-cur-flag {
  font-size: 0.95rem;
  line-height: 1;
}

.eco-cal-imp {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.eco-cal-imp-icon {
  width: 4px;
  border-radius: 1px 1px 0 0;
  background: rgba(148, 163, 184, 0.25);
  height: 6px;
}

.eco-cal-imp-icon:nth-child(2) { height: 9px; }
.eco-cal-imp-icon:nth-child(3) { height: 12px; }

.eco-cal-imp-icon.is-on { background: currentColor; }

.eco-cal-imp--high { color: #dc2626; }
.eco-cal-imp--med { color: #ea580c; }
.eco-cal-imp--low { color: #ca8a04; }

.eco-cal-event {
  font-weight: 600;
  color: var(--text);
  min-width: 180px;
}

.eco-cal-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-muted);
}

.eco-cal-val--actual {
  font-weight: 700;
  color: var(--text);
  min-width: 4.5rem;
}

.eco-cal-val--beat {
  background: rgba(34, 197, 94, 0.18);
  color: #15803d;
}

.eco-cal-val--miss {
  background: rgba(239, 68, 68, 0.16);
  color: #b91c1c;
}

.eco-cal-val--inline {
  background: rgba(148, 163, 184, 0.12);
}

.eco-cal-val--hint-up {
  color: #15803d;
}

.eco-cal-val--hint-down {
  color: #b91c1c;
}

.eco-cal-dash {
  color: var(--text-muted);
  opacity: 0.55;
}

.eco-cal-empty {
  padding: 1.25rem 1rem;
  margin: 0;
}

.eco-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.eco-cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.eco-cal-legend-swatch {
  display: inline-block;
  width: 1rem;
  height: 0.85rem;
  border-radius: 2px;
}

.eco-cal-legend-swatch.eco-cal-val--beat {
  background: rgba(34, 197, 94, 0.35);
}

.eco-cal-legend-swatch.eco-cal-val--miss {
  background: rgba(239, 68, 68, 0.3);
}

.eco-cal-row:focus-visible {
  outline: 2px solid hsl(38 70% 50% / 0.45);
  outline-offset: -2px;
}

.macro-news-filter-toolbar {
  border-bottom: 1px solid var(--border);
}

.macro-news-filter-toolbar .macro-news-filter-search {
  flex: 1;
  min-width: min(100%, 280px);
  max-width: 520px;
}

.macro-news-filter-toolbar .filter-search-input {
  border-color: hsl(38 60% 50% / 0.35);
  background: linear-gradient(135deg, hsl(38 75% 50% / 0.08), var(--bg));
}

.macro-news-filter-toolbar .filter-search-input:focus,
.macro-news-filter-toolbar .macro-news-filter-search.is-open .filter-search-input {
  border-color: hsl(38 70% 48% / 0.55);
  box-shadow: 0 0 0 3px hsl(38 75% 50% / 0.1);
}

.eco-news-table {
  min-width: 640px;
}

.eco-news-table thead th:nth-child(5) {
  text-align: right;
}

.eco-news-row .eco-cal-event {
  font-weight: 600;
  line-height: 1.35;
}

.eco-news-row:hover .eco-cal-event {
  color: hsl(210 80% 42%);
}

.eco-news-tag {
  max-width: 7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eco-news-market {
  display: inline-block;
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.eco-cal-val--source {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eco-news-source {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.macro-news-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border);
}

.macro-news-filter-cal-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid hsl(38 70% 50% / 0.35);
  background: linear-gradient(135deg, hsl(38 75% 50% / 0.12), var(--bg));
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.macro-news-filter-cal-btn:hover {
  border-color: hsl(38 75% 55% / 0.55);
  background: linear-gradient(135deg, hsl(38 75% 50% / 0.18), var(--bg));
}

.macro-news-filter-cal-btn.active {
  border-color: hsl(38 80% 50% / 0.65);
  background: linear-gradient(135deg, hsl(38 80% 48% / 0.22), hsl(38 70% 50% / 0.08));
  box-shadow: 0 0 0 3px hsl(38 75% 50% / 0.12);
  color: hsl(32 85% 38%);
}

.macro-news-filter-cal-icon {
  font-size: 1rem;
  line-height: 1;
}

.macro-cal-dir {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  margin-right: 0.35rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
  vertical-align: middle;
}

.macro-cal-dir--up {
  color: #15803d;
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.macro-cal-dir--down {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.macro-cal-dir--flat {
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.3);
  font-size: 0.55rem;
}

.macro-news-feed-cal {
  display: flex;
  align-items: flex-start;
  gap: 0.15rem;
}

.macro-news-cal-values strong {
  color: var(--text);
  font-weight: 600;
}

.macro-news-cal-dir-note {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.news-reader-cal-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.macro-news-filter-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--news-read-meta, var(--text-muted));
  flex-shrink: 0;
}

.macro-news-filter-select {
  flex: 1;
  min-width: min(100%, 280px);
  max-width: 420px;
  padding: 0.55rem 2.2rem 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid hsl(var(--news-hue, 210) 50% 50% / 0.35);
  background:
    linear-gradient(135deg, hsl(var(--news-hue, 210) 65% 50% / 0.1), var(--news-read-surface, var(--bg))),
    var(--news-read-surface, var(--bg));
  color: var(--news-read-title, var(--text));
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(135deg, hsl(var(--news-hue, 210) 65% 50% / 0.08), transparent),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 0.75rem center;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.macro-news-filter-select:hover {
  border-color: hsl(var(--news-hue, 210) 60% 55% / 0.5);
}

.macro-news-filter-select:focus-visible {
  outline: 2px solid hsl(var(--news-hue, 210) 65% 55% / 0.45);
  outline-offset: 2px;
}

.macro-news-filter-search {
  position: relative;
  flex: 1;
  min-width: min(100%, 240px);
  max-width: 480px;
  --news-hue: 210;
}

.macro-news-filter-search .filter-search-input {
  width: 100%;
  padding-right: 2.1rem;
  border-color: hsl(var(--news-hue, 210) 50% 50% / 0.35);
  background:
    linear-gradient(135deg, hsl(var(--news-hue, 210) 65% 50% / 0.1), var(--news-read-surface, var(--bg))),
    var(--news-read-surface, var(--bg));
  font-weight: 600;
  font-size: 0.92rem;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  cursor: pointer;
}

.macro-news-filter-search.is-open .filter-search-input,
.macro-news-filter-search .filter-search-input:focus {
  border-color: hsl(var(--news-hue, 210) 60% 55% / 0.55);
  box-shadow: 0 0 0 3px hsl(var(--news-hue, 210) 65% 55% / 0.12);
  cursor: text;
}

.macro-news-filter-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.macro-news-filter-toggle:hover {
  color: hsl(var(--news-hue, 210) 70% 55%);
  background: hsl(var(--news-hue, 210) 60% 50% / 0.1);
}

.macro-news-filter-search.is-open .macro-news-filter-toggle {
  color: hsl(var(--news-hue, 210) 70% 55%);
  transform: translateY(-50%) rotate(180deg);
}

.macro-news-filter-search .filter-search-menu {
  max-height: min(360px, 55vh);
  z-index: 50;
  border: 1px solid hsl(var(--news-hue, 210) 45% 45% / 0.25);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}

.filter-search-group-label {
  padding: 0.45rem 0.65rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.macro-news-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border);
}

.macro-news-filter {
  border: 1px solid var(--border);
  background: var(--news-read-surface, var(--bg));
  color: var(--news-read-meta, var(--text-muted));
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.38rem 0.78rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.macro-news-filter:hover {
  color: var(--text);
  border-color: rgba(59, 130, 246, 0.35);
}

.macro-news-filter-recent.active {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.45);
  color: var(--accent, #3b82f6);
}

.macro-news-filter-sym.active {
  background: hsl(var(--news-hue, 210) 70% 50% / 0.14);
  border-color: hsl(var(--news-hue, 210) 65% 55% / 0.4);
  color: hsl(var(--news-hue, 210) 55% 42%);
}

[data-theme="dark"] .macro-news-filter-sym.active,
:root .macro-news-filter-sym.active {
  color: hsl(var(--news-hue, 210) 80% 78%);
}

.macro-news-markets {
  margin: 0;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.macro-news-calendar {
  padding: 0 !important;
  overflow: hidden;
}

.macro-news-cal-list {
  display: flex;
  flex-direction: column;
  max-height: 220px;
  overflow-y: auto;
}

.macro-news-cal-item {
  display: grid;
  grid-template-columns: minmax(120px, 150px) auto 1fr;
  gap: 0.55rem 0.75rem;
  align-items: start;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
}

.macro-news-cal-item:last-child {
  border-bottom: none;
}

.macro-news-cal-when {
  color: var(--text-muted);
  white-space: nowrap;
}

.macro-news-cal-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.macro-news-cal-body strong {
  font-size: 0.82rem;
  line-height: 1.35;
}

.macro-news-cal-forecast {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.macro-news-feed {
  padding: 0 !important;
  overflow: hidden;
  background: var(--news-read-bg, var(--bg-elevated));
  border: 1px solid var(--border);
  max-width: 920px;
}

.macro-news-feed .macro-section-head {
  margin: 0;
  padding: 1rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: transparent;
}

.macro-news-feed .macro-section-head h3 {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.macro-news-feed .macro-section-head span {
  color: var(--news-read-meta, var(--text-muted));
  font-size: 0.78rem;
}

.macro-news-feed-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.25rem 0 0.5rem;
}

.macro-news-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.macro-news-feed-symbol {
  font-weight: 700;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  background: hsl(var(--news-hue, 210) 70% 50% / 0.16);
  color: hsl(var(--news-hue, 210) 70% 72%);
}

.macro-news-feed-kind {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--news-read-meta, var(--text-muted));
}

.macro-news-time {
  font-size: 0.78rem;
  color: var(--news-read-meta, var(--text-muted));
  line-height: 1.4;
}

.macro-news-feed-extra {
  margin: 0 0 0.75rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--news-read-meta, var(--text-muted));
}

.macro-news-feed-extra strong {
  color: var(--text);
  font-weight: 600;
}

.macro-news-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.macro-news-source {
  font-size: 0.8rem;
  color: var(--news-read-meta, var(--text-muted));
}

.macro-news-read {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent, #3b82f6);
  text-decoration: none;
  white-space: nowrap;
}

.macro-news-read:hover {
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.macro-news-item {
  --news-hue: 210;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--news-read-surface, transparent);
  border-left: 3px solid hsl(var(--news-hue) 65% 55% / 0.55);
}

.macro-news-item:last-child {
  border-bottom: none;
}

.macro-news-item:hover {
  background: rgba(59, 130, 246, 0.04);
}

.macro-news-item-cal {
  --news-hue: 32;
  border-left-color: hsl(32 80% 55% / 0.65);
  background: rgba(251, 191, 36, 0.04);
}

.macro-news-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.macro-news-chip {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.22rem 0.45rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent, #3b82f6);
}

.macro-news-chip-meta {
  opacity: 0.75;
  font-weight: 500;
}

.macro-news-markets {
  margin: 0.55rem 0 0;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.macro-news-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.macro-news-row {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.macro-news-row:last-child { border-bottom: none; }

.macro-news-row-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.25rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.macro-news-symbol {
  font-weight: 700;
  color: var(--accent, #3b82f6);
}

.macro-news-kind {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.64rem;
}

.macro-news-row h4 {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  font-weight: 600;
}

.macro-news-row h4 a {
  color: inherit;
  text-decoration: none;
}

.macro-news-row h4 a:hover {
  color: var(--accent, #3b82f6);
  text-decoration: underline;
}

.macro-news-meta {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.macro-news-row-cal h4 {
  font-weight: 500;
}

.macro-toolbar-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
}

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

.macro-risk-tone {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
}

.macro-disclaimer {
  margin: 0 0 0.75rem;
  max-width: 720px;
}

.macro-bias-host {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.macro-section {
  padding: 1rem 1.1rem;
}

.macro-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.macro-section-head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.macro-section-head span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.macro-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

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

.macro-bias-col h4 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.macro-bias-col.bull h4 { color: var(--positive); }
.macro-bias-col.bear h4 { color: var(--negative); }

.macro-pair-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.macro-pair-list li {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.82rem;
}

.macro-pair-list li span.pair-drivers {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.macro-rank-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.macro-rank-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.82rem;
}

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

.macro-rank-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--negative), var(--accent), var(--positive));
}

.macro-commodity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem;
}

.macro-commodity-card {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.macro-commodity-card strong {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.15rem;
}

.macro-commodity-card span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.macro-cal-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.macro-cal-row {
  display: grid;
  grid-template-columns: 5.5rem 3rem 1fr;
  gap: 0.5rem;
  align-items: start;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}

.macro-cal-row:last-child { border-bottom: none; }

.badge-macro-bull { background: var(--positive-bg); color: var(--positive); }
.badge-macro-bear { background: var(--negative-bg); color: var(--negative); }
.badge-macro-neutral { background: var(--bg-hover); color: var(--text-muted); }

.eco-cal-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.eco-cal-detail-time {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.eco-cal-detail-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.75rem;
}

.eco-cal-detail-table th,
.eco-cal-detail-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.eco-cal-detail-table th {
  width: 34%;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.news-reader-cal-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.badge-cal-upcoming { background: rgba(59, 130, 246, 0.16); color: #2563eb; border: 1px solid rgba(59, 130, 246, 0.35); }
.badge-cal-past { background: rgba(100, 116, 139, 0.16); color: #475569; border: 1px solid rgba(100, 116, 139, 0.35); }

.badge-impact-high { background: rgba(239, 68, 68, 0.18); color: #fca5a5; border: 1px solid rgba(248, 113, 113, 0.35); }
.badge-impact-med { background: rgba(249, 115, 22, 0.18); color: #fdba74; border: 1px solid rgba(251, 146, 60, 0.35); }

.badge-est {
  font-size: 0.6rem;
  padding: 0.1rem 0.35rem;
  margin-left: 0.2rem;
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
  vertical-align: middle;
}

.pnl-warning,
.orders-sync-banner {
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.1);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
}

.pnl-warning strong,
.orders-sync-banner strong { color: var(--warning); }

.journal-duplicates-banner {
  margin-bottom: 1.25rem;
}

.dup-banner-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.85rem;
}

.dup-banner-head span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.dup-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.dup-groups {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dup-group {
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
}

.dup-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.65rem;
}

.dup-group-when,
.dup-group-count {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.dup-group-trades {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.dup-trade-chip {
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

.dup-trade-chip.dup-trade-keep {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.06);
}

.dup-trade-chip-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

.dup-trade-chip-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 0.35rem;
}

.dup-trade-chip-meta .muted {
  opacity: 0.75;
}

.dup-group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge-keep {
  font-size: 0.62rem;
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

[data-theme="light"] .badge-keep { color: #15803d; }

.journal-table tr.row-duplicate td {
  background: rgba(245, 158, 11, 0.08);
}

.journal-table tr.row-duplicate:hover td {
  background: rgba(245, 158, 11, 0.14);
}

/* Trade Analytics — Edgewonk-style pivot */
.main:has(#view-trade-analytics.active) {
  max-width: none;
  padding: 0.65rem 0.85rem 0.85rem;
  min-height: 100vh;
  box-sizing: border-box;
}

#view-trade-analytics {
  --ew-ta-accent: #2563eb;
  --ew-ta-rail-bg: var(--bg-elevated);
}

#view-trade-analytics.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 1.5rem);
  min-height: 0;
  overflow: hidden;
}

.ew-ta-page-header {
  margin-bottom: 0.45rem;
  flex-shrink: 0;
  align-items: center;
}

.ew-ta-page-header h2 {
  font-size: 1.25rem;
  line-height: 1.2;
}

.ew-ta-page-header .subtitle {
  font-size: 0.76rem;
  margin-top: 0.1rem;
}

.ta-filters-host {
  margin-bottom: 0.45rem;
  flex-shrink: 0;
}

.ta-filters-host .journal-filters {
  margin-bottom: 0;
}

.ta-filters-host .jf-top {
  padding: 0.45rem 0.65rem;
}

.ta-filters-host .jf-section {
  padding: 0.4rem 0.65rem;
}

.ta-context-filters .jf-title::after {
  content: ' · same as Journal';
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}

.ew-ta-meta {
  font-size: 0.72rem;
  padding: 0.25rem 0.5rem;
}

.ew-ta-layout {
  display: grid;
  grid-template-columns: 14.5rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.ew-ta-main {
  order: 1;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.ew-ta-main.panel-table {
  padding: 0;
}

.ew-ta-pivot-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ew-ta-pivot-section .ew-ta-table-wrap {
  flex: 1;
  min-height: 0;
}

.ew-ta-section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.42rem 0.65rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.ew-ta-section-toolbar-start {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex-wrap: wrap;
}

.ew-ta-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.ew-ta-toolbar-popover-wrap {
  position: relative;
}

.ew-ta-toolbar-btn {
  font-size: 0.72rem !important;
  padding: 0.28rem 0.55rem !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 0;
  white-space: nowrap;
}

.ew-ta-toolbar-btn[aria-expanded="true"] {
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.08);
  color: var(--accent);
}

.ew-ta-toolbar-popover {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 40;
  width: min(14rem, calc(100vw - 1.5rem));
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.ew-ta-toolbar-popover-hint {
  margin: 0 0 0.55rem;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--text-muted);
}

.ew-ta-toolbar-popover-hint kbd {
  display: inline-block;
  padding: 0.05rem 0.28rem;
  border-radius: 3px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.12);
  font-family: inherit;
  font-size: 0.62rem;
  font-weight: 700;
}

.ew-ta-sort-popover {
  width: min(19rem, calc(100vw - 1.5rem));
}

.ew-ta-sort-levels {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  margin-bottom: 0.5rem;
}

.ew-ta-sort-level {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(5.5rem, auto) auto;
  gap: 0.32rem;
  align-items: center;
}

.ew-ta-sort-level-tag {
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.14rem 0.34rem;
  border-radius: 999px;
  white-space: nowrap;
}

.ew-ta-sort-level:nth-child(1) .ew-ta-sort-level-tag {
  background: rgba(59, 130, 246, 0.14);
  color: #2563eb;
}

.ew-ta-sort-level:nth-child(2) .ew-ta-sort-level-tag {
  background: rgba(139, 92, 246, 0.14);
  color: #7c3aed;
}

.ew-ta-sort-level:nth-child(3) .ew-ta-sort-level-tag {
  background: rgba(249, 115, 22, 0.14);
  color: #ea580c;
}

.ew-ta-sort-level:nth-child(4) .ew-ta-sort-level-tag {
  background: rgba(236, 72, 153, 0.14);
  color: #db2777;
}

.ew-ta-sort-level-field,
.ew-ta-sort-level-dir {
  width: 100%;
  font-size: 0.72rem;
  padding: 0.28rem 0.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.ew-ta-sort-level-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0.15rem 0.25rem;
  border-radius: var(--radius-sm);
}

.ew-ta-sort-level-remove:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.ew-ta-sort-add-btn {
  width: 100%;
  font-size: 0.72rem !important;
}

.ew-ta-field-compact {
  margin-bottom: 0.45rem;
}

.ew-ta-field-compact:last-child {
  margin-bottom: 0;
}

.ew-ta-section-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.ew-ta-table.ew-ta-table-sized {
  table-layout: fixed;
}

.ew-ta-table th.ew-ta-th-labeled {
  position: relative;
  padding: 0;
}

.ew-ta-table th.ew-ta-th-sortable {
  cursor: pointer;
}

.ew-ta-th-sort {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.28rem;
  width: 100%;
  min-height: 100%;
  padding: 0.38rem 0.5rem;
  padding-right: 0.58rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s ease;
}

.ew-ta-table th[data-ta-pivot-col="ta-amount"] .ew-ta-th-sort {
  justify-content: center;
  text-align: center;
}

.ew-ta-th-sort:hover {
  color: var(--text);
}

.ew-ta-th-sort:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.22);
  border-radius: var(--radius-sm);
}

.ew-ta-th-sort-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
}

.ew-ta-th-sort-icon svg {
  display: block;
}

.ew-ta-th-sort-icon--desc {
  color: #3b82f6;
  filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.45));
}

.ew-ta-th-sort-icon--asc {
  color: #10b981;
  filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.45));
}

.ew-ta-th-sort.is-sorted-desc .ew-ta-th-label {
  color: #2563eb;
}

.ew-ta-th-sort.is-sorted-asc .ew-ta-th-label {
  color: #059669;
}

.ew-ta-th-sort-priority {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0.78rem;
  height: 0.78rem;
  padding: 0 0.14rem;
  border-radius: 999px;
  font-size: 0.5rem;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
}

.ew-ta-th-sort-priority--1 {
  background: #3b82f6;
  color: #fff;
}

.ew-ta-th-sort-priority--2 {
  background: #8b5cf6;
  color: #fff;
}

.ew-ta-th-sort-priority--3 {
  background: #f97316;
  color: #fff;
}

.ew-ta-th-sort-priority--4 {
  background: #ec4899;
  color: #fff;
}

.ew-ta-table .ew-ta-th-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 0;
  min-width: 0;
}

.ew-ta-th-sort .ew-ta-th-label {
  min-width: 0;
  padding-right: 0;
}

.ew-ta-table .ew-ta-col-resize {
  position: absolute;
  top: 0;
  right: 0;
  width: 0.45rem;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.ew-ta-table .ew-ta-col-resize:hover {
  background: rgba(37, 99, 235, 0.18);
}

body.ew-ta-col-resizing {
  cursor: col-resize !important;
  user-select: none;
}

.ta-trades-drawer-panel {
  width: 32.5rem;
  max-width: 98vw;
  position: relative;
}

.ta-trades-drawer-resize {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0.45rem;
  cursor: ew-resize;
  z-index: 3;
  touch-action: none;
}

.ta-trades-drawer-resize:hover,
body.ta-trades-drawer-resizing .ta-trades-drawer-resize {
  background: rgba(37, 99, 235, 0.22);
}

body.ta-trades-drawer-resizing {
  cursor: ew-resize !important;
  user-select: none;
}

.ta-trades-drawer-head {
  align-items: center;
  padding: 0.85rem 1rem 0.85rem 1.15rem;
}

.ta-trades-drawer-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.ta-trades-drawer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.65rem 1rem 1rem;
}

body.ta-trades-drawer-open {
  overflow: hidden;
}

.ta-trade-cards {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.ta-trade-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ta-trade-card.is-win {
  border-left: 3px solid rgba(34, 197, 94, 0.55);
}

.ta-trade-card.is-loss {
  border-left: 3px solid rgba(239, 68, 68, 0.55);
}

.ta-trade-card:hover {
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.ta-trade-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.55rem;
}

.ta-trade-card-ident {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.ta-trade-card-ident strong {
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.ta-trade-dir {
  font-size: 0.62rem;
  padding: 0.12rem 0.35rem;
}

.ta-trade-card-head-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.ta-trade-open-btn {
  padding: 0.2rem 0.45rem !important;
  font-size: 0.68rem !important;
  min-height: 0;
}

.ta-trade-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.ta-trade-stat-r {
  font-weight: 700;
  color: var(--text);
}

.ta-trade-card-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(4.5rem, 0.65fr) auto;
  gap: 0.4rem 0.45rem;
  align-items: end;
  padding-top: 0.15rem;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.ta-trade-field {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}

.ta-trade-field-chart {
  align-items: flex-start;
}

.ta-trade-field-label {
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.ta-drawer-field {
  width: 100%;
  font-size: 0.72rem !important;
  padding: 0.28rem 0.38rem !important;
  min-height: 0;
}

.ta-drawer-chart {
  justify-content: flex-start;
}

.ta-drawer-chart .live-chart-btn.is-compact {
  width: 1.55rem;
  height: 1.55rem;
  position: relative;
}

.ta-drawer-chart .live-chart-btn.is-compact .live-chart-icon {
  width: 0.82rem;
  height: 0.82rem;
}

.ta-drawer-chart-count {
  position: absolute;
  top: -0.28rem;
  right: -0.28rem;
  min-width: 0.82rem;
  height: 0.82rem;
  padding: 0 0.15rem;
  border-radius: 999px;
  background: var(--ew-ta-accent);
  color: #fff;
  font-size: 0.52rem;
  font-weight: 800;
  line-height: 0.82rem;
  text-align: center;
}

.ta-drawer-chart .inline-chart-menu {
  right: 0;
  left: auto;
  width: min(16rem, 78vw);
  z-index: 20;
}

#ta-trades-drawer-host .inline-chart-gallery .chart-preview-btn img {
  max-height: 4.5rem;
  object-fit: cover;
}

.ta-trade-card-fields-row2 {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto auto;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  padding-top: 0.35rem;
}

.ta-trade-card-fields-custom {
  grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  padding-top: 0.35rem;
}

.ta-trade-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  padding-top: 0.15rem;
}

.ta-trade-meta-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 0.14rem 0.38rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.ta-trade-meta-chip .journal-cell-hold,
.ta-trade-meta-chip .journal-cell-rr,
.ta-trade-meta-chip .journal-cell-risk {
  font-size: inherit;
}

.ta-trade-journal {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  position: relative;
}

.ta-trade-notes {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.ta-trade-notes .inline-notes {
  width: 100%;
  font-size: 0.72rem;
  padding: 0.35rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}

#ta-trades-drawer-host .ta-trade-field-pattern .pattern-combobox {
  width: 100%;
}

#ta-trades-drawer-host .ta-trade-field-pattern .pattern-combobox-input {
  width: 100%;
  font-size: 0.72rem !important;
  padding: 0.28rem 0.38rem !important;
  min-height: 0;
}

#ta-trades-drawer-host .inline-tags-menu,
#ta-trades-drawer-host .inline-tiltmeter-menu,
#ta-trades-drawer-host .inline-confluence-menu,
#ta-trades-drawer-host .pattern-combobox-menu {
  z-index: 40;
}

#ta-trades-drawer-host .inline-confluence-menu {
  width: min(15rem, 78vw);
}

.ta-trade-journal-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  position: relative;
  transition: min-height 0.22s ease;
}

.ta-trade-journal-row.has-expanded {
  min-height: 19rem;
}

.ta-trade-card.is-journal-open {
  position: relative;
  z-index: 2;
}

.ta-journal-pop {
  position: relative;
  min-width: 0;
  align-self: start;
}

.ta-journal-pop-box {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.38rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  gap: 0.2rem;
  overflow: hidden;
  transition: min-height 0.22s ease, border-color 0.15s ease, box-shadow 0.22s ease, background 0.15s ease;
}

.ta-journal-pop-collapsed {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.ta-journal-pop-expanded-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.ta-journal-pop-close {
  border: none;
  background: rgba(37, 99, 235, 0.1);
  color: var(--ew-ta-accent);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
}

.ta-journal-pop-close:hover {
  background: rgba(37, 99, 235, 0.18);
}

.ta-journal-pop-box:hover {
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(37, 99, 235, 0.04);
}

.ta-journal-pop-box.has-content {
  border-color: rgba(37, 99, 235, 0.22);
}

.ta-journal-pop.is-expanded {
  position: absolute;
  left: calc(-1rem - 0.6rem);
  right: calc(-1rem - 0.6rem);
  top: 0;
  z-index: 12;
}

.ta-journal-pop.is-expanded .ta-journal-pop-box {
  min-height: 18rem;
  height: 100%;
  cursor: default;
  border-color: var(--ew-ta-accent);
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.16), 0 0 0 2px rgba(37, 99, 235, 0.14);
  background: var(--bg-elevated);
  padding: 0.6rem 0.75rem 0.75rem;
}

.ta-journal-pop.is-expanded .ta-journal-pop-collapsed {
  display: none;
}

.ta-journal-pop.is-expanded .ta-journal-pop-expanded-head {
  display: flex;
}

.ta-trade-journal-row.has-expanded .ta-journal-pop:not(.is-expanded) {
  opacity: 0.28;
  pointer-events: none;
}

.ta-journal-pop-label {
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.ta-journal-pop-preview {
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.ta-journal-pop-box.has-content .ta-journal-pop-preview {
  color: var(--text);
}

.ta-journal-pop-input {
  display: none;
  width: 100%;
  flex: 1;
  min-height: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  padding: 0.45rem 0.52rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: var(--surface);
  resize: vertical;
  cursor: text;
}

.ta-journal-pop.is-expanded .ta-journal-pop-input {
  display: block;
  min-height: 14.5rem;
}

.ta-journal-pop-input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

@media (max-width: 560px) {
  .ta-trade-card-fields,
  .ta-trade-card-fields-row2 {
    grid-template-columns: 1fr 1fr;
  }

  .ta-trade-field-chart,
  .ta-trade-field-pattern {
    grid-column: 1 / -1;
  }

  .ta-trade-journal-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .ta-trades-drawer-panel {
    width: 100vw !important;
    max-width: 100vw;
  }

  .ta-trades-drawer-resize {
    display: none;
  }
}

.ew-ta-row[data-ta-row] {
  cursor: pointer;
}

.ew-ta-row-label {
  color: inherit;
}

.ew-ta-row .ew-ta-row-label:hover,
.ew-ta-row:hover .ew-ta-row-label {
  color: var(--ew-ta-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ew-ta-ordering-active {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0;
}

.ew-ta-ordering-add {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.ew-ta-rail-subtitle {
  margin: 0 0 0.35rem;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.ew-ta-ordering-chips {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.ew-ta-rail-left .ew-ta-order-chip {
  width: 100%;
  justify-content: space-between;
  border-radius: var(--radius-sm);
  gap: 0.35rem;
}

.ew-ta-order-chip[draggable="true"] {
  cursor: grab;
}

.ew-ta-order-chip.is-dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.ew-ta-order-drag {
  flex-shrink: 0;
  width: 0.85rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: -0.14em;
  user-select: none;
  line-height: 1;
}

.ew-ta-order-label {
  flex: 1;
  min-width: 0;
}

.ew-ta-ordering-overall {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text);
  padding: 0.32rem 0.45rem;
  border-radius: var(--radius-sm);
  background: rgba(37, 99, 235, 0.1);
  text-align: center;
}

.ew-ta-order-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.3rem 0.18rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.08);
  font-size: 0.72rem;
  font-weight: 600;
}

.ew-ta-order-chip-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.2rem;
}

.ew-ta-order-chip-remove:hover {
  color: var(--negative);
}

.ew-ta-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

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

.ew-ta-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-elevated);
  padding: 0.38rem 0.5rem;
  border-bottom: 2px solid var(--border);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
}

.ew-ta-table tbody td {
  padding: 0.34rem 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  vertical-align: middle;
}

.ew-ta-row.is-overall td {
  background: rgba(37, 99, 235, 0.06);
  font-weight: 600;
}

.ew-ta-row.row-win td {
  background: rgba(34, 197, 94, 0.04);
}

.ew-ta-row.row-loss td {
  background: rgba(239, 68, 68, 0.04);
}

.ew-ta-row:hover td {
  background: rgba(59, 130, 246, 0.07);
}

.ew-ta-col-name {
  min-width: 9rem;
  display: flex;
  align-items: center;
  gap: 0.28rem;
}

.ew-ta-col-amount {
  min-width: 8rem;
  width: 18%;
  text-align: center;
  vertical-align: middle;
}

.ew-ta-table th[data-ta-pivot-col="ta-amount"] {
  text-align: center;
}

.ew-ta-table th[data-ta-pivot-col="ta-amount"] .ew-ta-th-label {
  padding-right: 0;
}

.ew-ta-expand,
.ew-ta-expand-spacer {
  display: inline-flex;
  width: 1.15rem;
  justify-content: center;
  flex-shrink: 0;
}

.ew-ta-expand {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
}

.ew-ta-expand.is-open {
  color: var(--ew-ta-accent);
}

.ew-ta-row-label {
  font-weight: 600;
}

.ew-ta-row-tag {
  margin-left: 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ew-ta-accent);
}

.ew-ta-amount-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.22rem;
  width: min(100%, 5.75rem);
  margin: 0 auto;
}

.ew-ta-amount-track {
  width: 100%;
  height: 0.62rem;
  border-radius: 2px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.ew-ta-amount-fill {
  height: 100%;
  min-width: 2px;
}

.ew-ta-amount-fill.positive { background: #22c55e; }
.ew-ta-amount-fill.negative { background: #ef4444; }
.ew-ta-amount-fill.neutral { background: #94a3b8; }

.ew-ta-amount-val {
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  text-align: center;
  color: var(--text-muted);
}

.ew-ta-rail {
  padding: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ew-ta-rail-left {
  order: 0;
  max-height: 100%;
  overflow-y: auto;
}

.ew-ta-rail-right {
  order: 2;
}

.ew-ta-rail-section {
  padding: 0.55rem 0.65rem;
  flex-shrink: 0;
}

.ew-ta-rail-section-divider {
  border-top: 1px solid var(--border);
  background: var(--ew-ta-rail-bg);
}

.ew-ta-rail-section--scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.ew-ta-rail-title {
  margin: 0 0 0.15rem;
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.ew-ta-rail-hint,
.ew-ta-rail-empty {
  margin: 0 0 0.4rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.ew-ta-rail-hint strong {
  font-weight: 700;
  color: var(--text);
}

.ew-ta-criteria-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.28rem;
  max-height: 9.5rem;
  overflow-y: auto;
  padding-right: 0.15rem;
}

.ew-ta-criteria-btn {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.32rem 0.42rem;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.04);
  color: var(--text);
  cursor: pointer;
  line-height: 1.25;
}

.ew-ta-criteria-btn:hover {
  border-style: solid;
  background: rgba(37, 99, 235, 0.1);
  color: var(--ew-ta-accent);
}

.ew-ta-field {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  margin-bottom: 0.45rem;
}

.ew-ta-field:last-child {
  margin-bottom: 0;
}

.ew-ta-field-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.ew-ta-field select {
  width: 100%;
  font: inherit;
  font-size: 0.74rem;
  padding: 0.32rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

@media (max-width: 1100px) {
  .main:has(#view-trade-analytics.active) {
    min-height: auto;
    padding: 1rem;
  }

  #view-trade-analytics.active {
    height: auto;
    overflow: visible;
  }

  .ew-ta-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .ew-ta-rail-left {
    max-height: none;
  }

  .ew-ta-main {
    min-height: 16rem;
  }

  .ew-ta-pivot-section {
    min-height: 12rem;
  }

  .ew-ta-table-wrap {
    max-height: 65vh;
  }

  .ew-ta-ordering-chips {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .ew-ta-rail-left .ew-ta-order-chip {
    width: auto;
  }

  .ew-ta-criteria-list {
    grid-template-columns: 1fr;
    max-height: none;
  }
}

.badge-chart {
  font-size: 0.65rem;
  margin-left: 0.25rem;
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

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

/* Account switcher & journal tabs */
.account-switcher-hidden {
  display: none !important;
}

.account-switcher {
  margin: 1.25rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.account-switcher-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.account-switcher-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.account-pill {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.account-pill-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  flex: 1;
  min-width: 0;
}

.account-pill-check {
  flex-shrink: 0;
  width: 1.1rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}

.account-pill:not(.active) .account-pill-check {
  visibility: hidden;
}

.account-pill:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.account-pill.active {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.12);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.account-pill-name {
  font-size: 0.78rem;
  font-weight: 600;
}

.account-pill-id {
  font-size: 0.68rem;
  font-family: var(--mono);
  color: var(--text-muted);
}

.account-pill-pnl {
  font-size: 0.72rem;
  font-family: var(--mono);
  margin-top: 0.15rem;
}

.journal-account-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.journal-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.journal-tab.active {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.15);
}

.journal-tab-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  text-transform: uppercase;
}

.badge-live { background: rgba(34, 197, 94, 0.2); color: var(--positive); }
.badge-demo { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-default { background: var(--bg-hover); color: var(--text-muted); }

.journal-tab-label {
  font-size: 0.88rem;
  font-weight: 500;
}

.journal-tab-count {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

.journal-page-header {
  align-items: stretch;
}

.journal-page-header .journal-header-block {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.journal-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.journal-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
}

.journal-title-row h2 {
  margin: 0;
}

.journal-header-actions .journal-edgefinder-btn {
  flex-shrink: 0;
}

.journal-edgefinder-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.65rem;
  padding: 0.45rem 0.85rem 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(99, 102, 241, 0.45);
  background:
    linear-gradient(165deg, rgba(99, 102, 241, 0.22) 0%, rgba(59, 130, 246, 0.12) 48%, rgba(14, 165, 233, 0.08) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 1px 2px rgba(15, 23, 42, 0.12);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.journal-edgefinder-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(129, 140, 248, 0.75);
  background:
    linear-gradient(165deg, rgba(99, 102, 241, 0.32) 0%, rgba(59, 130, 246, 0.18) 48%, rgba(14, 165, 233, 0.12) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 6px 18px rgba(59, 130, 246, 0.18);
}

.journal-edgefinder-btn:active {
  transform: translateY(0);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 1px 3px rgba(15, 23, 42, 0.16);
}

.journal-edgefinder-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  flex-shrink: 0;
}

.journal-edgefinder-btn-icon svg {
  width: 1.05rem;
  height: 1.05rem;
}

.journal-edgefinder-btn-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  line-height: 1.15;
}

.journal-edgefinder-btn-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.journal-edgefinder-btn-hint {
  font-size: 0.64rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.journal-edgefinder-btn-arrow {
  font-size: 0.95rem;
  font-weight: 600;
  color: #93c5fd;
  margin-left: 0.1rem;
  transition: transform 0.16s ease;
}

.journal-edgefinder-btn:hover .journal-edgefinder-btn-arrow {
  transform: translate(2px, -2px);
}

[data-theme="light"] .journal-edgefinder-btn {
  border-color: rgba(79, 70, 229, 0.35);
  background:
    linear-gradient(165deg, rgba(238, 242, 255, 0.95) 0%, rgba(219, 234, 254, 0.85) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 1px 3px rgba(79, 70, 229, 0.1);
}

[data-theme="light"] .journal-edgefinder-btn:hover {
  border-color: rgba(79, 70, 229, 0.55);
  background:
    linear-gradient(165deg, #eef2ff 0%, #dbeafe 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 1) inset,
    0 8px 20px rgba(79, 70, 229, 0.14);
}

[data-theme="light"] .journal-edgefinder-btn-icon {
  background: rgba(79, 70, 229, 0.12);
  color: #4f46e5;
}

[data-theme="light"] .journal-edgefinder-btn-arrow {
  color: #2563eb;
}

.journal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.journal-account-picker {
  position: relative;
}

.journal-account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  min-width: 11rem;
  max-width: 17rem;
  text-align: left;
  font-family: inherit;
}

.journal-account-trigger:hover,
.journal-account-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.journal-account-trigger-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.journal-account-trigger-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.journal-account-trigger-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.1;
}

.journal-account-trigger-value {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.journal-account-trigger-chevron {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.journal-account-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 60;
  width: min(19rem, 88vw);
  padding: 0.35rem;
  max-height: min(20rem, 60vh);
  overflow: auto;
}

.journal-account-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.journal-account-option:hover {
  background: var(--bg-hover);
}

.journal-account-option.active {
  background: rgba(59, 130, 246, 0.08);
}

.journal-account-option-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 0.1rem;
}

.journal-account-option-label {
  font-size: 0.85rem;
  font-weight: 500;
}

.journal-account-option-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--num);
}

.journal-account-option-check {
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}

.journal-tab-metrics {
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: none;
  animation: kpiFadeIn 0.35s ease;
}

.journal-metrics-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  margin-bottom: 0.45rem;
}

.journal-metrics-kicker {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.journal-metrics-range {
  font-size: 0.65rem;
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.1);
}

.journal-metrics-count {
  font-size: 0.65rem;
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  margin-left: auto;
}

.journal-metrics-dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.4rem;
  align-items: stretch;
}

.jm-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  min-height: 0;
}

.jm-card-label {
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  line-height: 1.2;
}

.jm-card-value {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.jm-card-foot {
  font-size: 0.58rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
  line-height: 1.2;
}

.jm-tone-positive .jm-card-value,
.jm-card-value.jm-tone-positive,
.jm-eval-item.jm-tone-positive .jm-eval-value {
  color: var(--positive);
}

.jm-tone-negative .jm-card-value,
.jm-card-value.jm-tone-negative,
.jm-eval-item.jm-tone-negative .jm-eval-value {
  color: var(--negative);
}

.jm-tone-neutral .jm-card-value {
  color: var(--text-muted);
}

.jm-eval-item.jm-tone-warn .jm-eval-value {
  color: var(--warning);
}

.jm-card-hero.jm-tone-positive {
  border-color: rgba(34, 197, 94, 0.28);
  background: linear-gradient(145deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.02));
}

.jm-card-hero.jm-tone-negative {
  border-color: rgba(239, 68, 68, 0.28);
  background: linear-gradient(145deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.02));
}

.jm-winrate-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
}

.jm-gauge {
  width: 3.6rem;
  height: auto;
  flex-shrink: 0;
}

.jm-card-winrate .jm-card-value {
  font-size: 1.05rem;
  align-self: center;
  padding-bottom: 0;
}

.jm-outcome-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.35rem;
  margin-top: 0.1rem;
}

.jm-leg {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 0.58rem;
  font-weight: 600;
  padding: 0.05rem 0.28rem;
  border-radius: 3px;
}

.jm-leg.profit {
  color: var(--positive);
  background: var(--positive-bg);
}

.jm-leg.loss {
  color: var(--negative);
  background: var(--negative-bg);
}

.jm-leg.be {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.12);
}

.jm-avgpnl {
  margin-top: 0.15rem;
}

.jm-avgpnl-ratio {
  font-size: 0.58rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  line-height: 1.2;
}

.jm-avgpnl-track {
  display: flex;
  height: 1rem;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.jm-avgpnl-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 0.55rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 0.15rem;
}

.jm-avgpnl-win {
  background: rgba(34, 197, 94, 0.22);
  color: var(--positive);
}

.jm-avgpnl-loss {
  background: rgba(239, 68, 68, 0.18);
  color: var(--negative);
}

.jm-avgpnl-empty {
  font-size: 0.58rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.jm-pf-bar {
  height: 3px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  overflow: hidden;
  margin-top: 0.1rem;
}

.jm-pf-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

.jm-pf-fill.jm-tone-positive {
  background: linear-gradient(90deg, #22c55e, #4ade80);
}

.jm-pf-fill.jm-tone-negative {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.journal-metrics-eval {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.15rem 0.55rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.jm-eval-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.12rem 0;
}

.jm-eval-label {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.jm-eval-value {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
}

@media (max-width: 1100px) {
  .journal-metrics-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .journal-header-top {
    flex-direction: column;
  }

  .journal-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .journal-account-trigger {
    flex: 1;
    max-width: none;
  }

  .journal-metrics-count {
    margin-left: 0;
    width: 100%;
  }

  .journal-metrics-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.journal-list-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-right: 0.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.journal-list-tabs-row .journal-list-tabs {
  flex: 1 1 auto;
  border-bottom: none;
  padding-right: 0;
}

.journal-cols-wrap {
  flex-shrink: 0;
  padding: 0.35rem 0.5rem 0.35rem 0;
}

.journal-cols-btn {
  font-size: 0.72rem;
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.journal-cols-btn[aria-expanded="true"] {
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.08);
  color: var(--accent);
}

.journal-cols-drawer {
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
}

.ta-trades-drawer {
  z-index: 140;
}

.journal-cols-drawer:not([hidden]) {
  pointer-events: auto;
}

.journal-cols-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.45);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.journal-cols-drawer.is-open .journal-cols-backdrop {
  opacity: 1;
}

.journal-cols-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(21rem, 92vw);
  display: flex;
  flex-direction: column;
  border-radius: 0;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.28);
  transform: translateX(100%);
  transition: transform 0.26s ease;
}

.journal-cols-drawer.is-open .journal-cols-panel {
  transform: translateX(0);
}

body.journal-cols-open {
  overflow: hidden;
}

.journal-cols-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.journal-cols-panel-head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.journal-cols-panel-hint {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.journal-cols-list {
  list-style: none;
  margin: 0;
  padding: 0.65rem;
  flex: 1 1 auto;
  overflow: auto;
}

.journal-cols-panel-foot {
  flex: 0 0 auto;
  padding: 0.65rem 0.85rem 0.85rem;
  border-top: 1px solid var(--border);
}

.journal-col-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: grab;
}

.journal-col-item.is-on {
  background: rgba(59, 130, 246, 0.06);
}

.journal-col-item.is-dragging {
  opacity: 0.55;
  border-color: var(--accent);
  cursor: grabbing;
}

.journal-col-drag {
  flex: 0 0 auto;
  font-size: 0.72rem;
  line-height: 1;
  color: var(--text-muted);
  user-select: none;
  cursor: grab;
}

.journal-col-item-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.78rem;
  cursor: pointer;
}

.journal-col-item-label input {
  accent-color: var(--accent);
  flex-shrink: 0;
}

.journal-col-locked {
  margin-left: auto;
  font-style: normal;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.journal-col-item.is-tab-hidden {
  opacity: 0.55;
}

.journal-col-item input:disabled {
  cursor: not-allowed;
}

.journal-cols-advanced-hint {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
}

.journal-list-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.journal-list-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.journal-list-tab:hover {
  color: var(--text);
  background: rgba(59, 130, 246, 0.06);
}

.journal-list-tab.active {
  color: var(--accent);
  border-color: rgba(59, 130, 246, 0.25);
  background: rgba(59, 130, 246, 0.1);
}

.journal-list-count {
  font-size: 0.68rem;
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
}

.journal-list-tab.active .journal-list-count {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.15);
}

.journal-6m-range {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.journal-6m-range-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.journal-6m-range input[type="date"] {
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.25rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.journal-6m-range-sep {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.panel-table .journal-table-wrap {
  padding-top: 0;
}

.account-kpi-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(34, 197, 94, 0.04));
  animation: kpiFadeIn 0.35s ease;
}

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

.kpi-chip {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 100px;
  padding-right: 1rem;
  border-right: 1px solid var(--border);
}

.kpi-chip:last-child {
  border-right: none;
  padding-right: 0;
}

.kpi-chip.kpi-warn .kpi-value {
  color: var(--warning);
}

.kpi-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 0.92rem;
  font-weight: 600;
}

.kpi-value.positive {
  color: var(--positive);
}

.kpi-value.negative {
  color: var(--negative);
}

.view.active {
  animation: viewFadeIn 0.25s ease;
}

@keyframes viewFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.stat-card {
  transition: transform 0.2s ease, border-color 0.2s ease;
}

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

.badge-pending {
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.badge-broker {
  font-size: 0.6rem;
  padding: 0.1rem 0.35rem;
  margin-left: 0.2rem;
  background: rgba(34, 197, 94, 0.15);
  color: var(--positive);
  vertical-align: middle;
}

.rolling-wr-chart {
  width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 900px) {
  .account-kpi-strip {
    flex-direction: column;
  }
  .kpi-chip {
    border-right: none;
    padding-right: 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
  }
  .kpi-chip:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
  .journal-layout {
    grid-template-columns: 1fr;
  }
  .notebook-layout {
    grid-template-columns: 1fr;
  }
  .setup-layout {
    grid-template-columns: 1fr;
  }
  .trade-workspace-overlay {
    padding: 0.5rem;
  }
}

/* Theme switcher */
.theme-switcher {
  margin-bottom: 0.75rem;
}

.theme-switcher-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.theme-toggle {
  display: flex;
  gap: 0.35rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
}

.theme-btn {
  flex: 1;
  padding: 0.4rem 0.5rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-btn.active {
  background: var(--accent);
  color: white;
}

.sidebar-actions {
  display: flex;
  gap: 0.5rem;
}

/* EdgeWonk-style dashboard filters */
.ew-filters {
  margin-bottom: 1.25rem;
  padding: 0 !important;
  overflow: hidden;
}

.ew-filters.journal-filters {
  overflow: visible;
}

.ew-filters-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-hover);
}

.ew-filter-tabs {
  display: flex;
  gap: 0.25rem;
}

.ew-filter-tab {
  padding: 0.45rem 0.85rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.ew-filter-tab:hover {
  color: var(--text);
  background: var(--bg);
}

.ew-filter-tab.active {
  background: var(--bg-elevated);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--border);
}

.ew-filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
}

.ew-filter-badge[hidden] {
  display: none;
}

.ew-filters-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.ew-unit-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ew-unit-btn {
  padding: 0.3rem 0.55rem;
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.ew-unit-btn + .ew-unit-btn {
  border-left: 1px solid var(--border);
}

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

.ew-filter-panel {
  padding: 0.85rem 1rem 0.5rem;
}

.ew-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.65rem 1rem;
}

.ew-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ew-filter-field span {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.ew-filter-field select {
  padding: 0.45rem 1.75rem 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.22);
  background-color: rgba(59, 130, 246, 0.06);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  cursor: pointer;
}

.ew-filter-field input[type="date"],
.ew-filter-field input[type="search"] {
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.22);
  background-color: rgba(59, 130, 246, 0.06);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
}

.ew-filter-field input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  min-height: 2.05rem;
}

.ew-filter-field input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.55;
  cursor: pointer;
  filter: none;
}

.ew-filter-field input[type="date"]::-webkit-inner-spin-button {
  display: none;
}

.ew-filter-field input:focus,
.ew-filter-field select:focus {
  outline: none;
  border-color: var(--accent);
}

.ew-sort-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ew-sort-field span {
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.ew-sort-field select {
  padding: 0.35rem 1.65rem 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.22);
  background-color: rgba(59, 130, 246, 0.06);
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
  cursor: pointer;
}

/* Journal filters — compact toolbar */
.journal-filters {
  padding: 0;
  overflow: visible;
}

.jf-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.jf-top-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.jf-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.jf-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.jf-top-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.jf-inline-field select,
.jf-inline-field input[type="search"] {
  padding: 0.32rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.76rem;
}

.jf-inline-field select {
  padding-right: 1.4rem;
}

.jf-search-wrap input {
  width: 10.5rem;
  max-width: 42vw;
}

.jf-inline-field input[type="search"]:focus,
.jf-inline-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.jf-section {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.jf-section:last-of-type {
  border-bottom: none;
}

.jf-section-head {
  margin-bottom: 0.4rem;
}

.jf-section-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.jf-section-periods {
  padding-top: 0.42rem;
  padding-bottom: 0.48rem;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.04) 0%, transparent 100%);
}

.journal-period-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.journal-period-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  padding: 0;
  border: none;
  background: transparent;
  flex: 1 1 auto;
  min-width: 0;
}

.journal-period-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.22rem 0.52rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: linear-gradient(155deg, rgba(148, 163, 184, 0.08) 0%, transparent 52%), var(--bg);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    border-color 0.14s ease,
    background 0.14s ease,
    color 0.14s ease;
}

.journal-period-btn::before {
  content: '';
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 999px;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.journal-period-btn-today::before { background: linear-gradient(145deg, #38bdf8, #0284c7); box-shadow: 0 0 6px rgba(14, 165, 233, 0.45); }
.journal-period-btn-this-week::before { background: linear-gradient(145deg, #818cf8, #4f46e5); box-shadow: 0 0 6px rgba(99, 102, 241, 0.42); }
.journal-period-btn-last-week::before { background: linear-gradient(145deg, #c084fc, #9333ea); box-shadow: 0 0 6px rgba(168, 85, 247, 0.4); }
.journal-period-btn-this-month::before { background: linear-gradient(145deg, #4ade80, #16a34a); box-shadow: 0 0 6px rgba(34, 197, 94, 0.4); }
.journal-period-btn-last-month::before { background: linear-gradient(145deg, #fbbf24, #d97706); box-shadow: 0 0 6px rgba(245, 158, 11, 0.42); }
.journal-period-btn-ytd::before { background: linear-gradient(145deg, #fb7185, #e11d48); box-shadow: 0 0 6px rgba(244, 63, 94, 0.4); }

.journal-period-btn-today { border-color: rgba(14, 165, 233, 0.28); background: linear-gradient(155deg, rgba(14, 165, 233, 0.1) 0%, transparent 55%), var(--bg); }
.journal-period-btn-this-week { border-color: rgba(99, 102, 241, 0.28); background: linear-gradient(155deg, rgba(99, 102, 241, 0.1) 0%, transparent 55%), var(--bg); }
.journal-period-btn-last-week { border-color: rgba(168, 85, 247, 0.28); background: linear-gradient(155deg, rgba(168, 85, 247, 0.1) 0%, transparent 55%), var(--bg); }
.journal-period-btn-this-month { border-color: rgba(34, 197, 94, 0.28); background: linear-gradient(155deg, rgba(34, 197, 94, 0.1) 0%, transparent 55%), var(--bg); }
.journal-period-btn-last-month { border-color: rgba(245, 158, 11, 0.28); background: linear-gradient(155deg, rgba(245, 158, 11, 0.1) 0%, transparent 55%), var(--bg); }
.journal-period-btn-ytd { border-color: rgba(244, 63, 94, 0.28); background: linear-gradient(155deg, rgba(244, 63, 94, 0.1) 0%, transparent 55%), var(--bg); }

.journal-period-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.1) 50%, transparent 62%);
  transform: translateX(-120%);
  transition: transform 0.45s ease;
  pointer-events: none;
}

.journal-period-btn:hover {
  transform: translateY(-1px);
  color: var(--text);
  box-shadow:
    0 4px 10px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.journal-period-btn-today:hover { border-color: rgba(14, 165, 233, 0.48); }
.journal-period-btn-this-week:hover { border-color: rgba(99, 102, 241, 0.48); }
.journal-period-btn-last-week:hover { border-color: rgba(168, 85, 247, 0.48); }
.journal-period-btn-this-month:hover { border-color: rgba(34, 197, 94, 0.48); }
.journal-period-btn-last-month:hover { border-color: rgba(245, 158, 11, 0.48); }
.journal-period-btn-ytd:hover { border-color: rgba(244, 63, 94, 0.48); }

.journal-period-btn:hover::after {
  transform: translateX(120%);
}

.journal-period-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px rgba(99, 102, 241, 0.14),
    0 3px 10px rgba(15, 23, 42, 0.07);
}

.journal-period-btn-today.active { border-color: rgba(14, 165, 233, 0.55); background: linear-gradient(155deg, rgba(14, 165, 233, 0.22) 0%, rgba(14, 165, 233, 0.06) 100%); color: #0284c7; box-shadow: 0 3px 12px rgba(14, 165, 233, 0.18); }
.journal-period-btn-this-week.active { border-color: rgba(99, 102, 241, 0.55); background: linear-gradient(155deg, rgba(99, 102, 241, 0.22) 0%, rgba(99, 102, 241, 0.06) 100%); color: #4f46e5; box-shadow: 0 3px 12px rgba(99, 102, 241, 0.18); }
.journal-period-btn-last-week.active { border-color: rgba(168, 85, 247, 0.55); background: linear-gradient(155deg, rgba(168, 85, 247, 0.22) 0%, rgba(168, 85, 247, 0.06) 100%); color: #9333ea; box-shadow: 0 3px 12px rgba(168, 85, 247, 0.18); }
.journal-period-btn-this-month.active { border-color: rgba(34, 197, 94, 0.55); background: linear-gradient(155deg, rgba(34, 197, 94, 0.22) 0%, rgba(34, 197, 94, 0.06) 100%); color: #16a34a; box-shadow: 0 3px 12px rgba(34, 197, 94, 0.18); }
.journal-period-btn-last-month.active { border-color: rgba(245, 158, 11, 0.55); background: linear-gradient(155deg, rgba(245, 158, 11, 0.22) 0%, rgba(245, 158, 11, 0.06) 100%); color: #d97706; box-shadow: 0 3px 12px rgba(245, 158, 11, 0.18); }
.journal-period-btn-ytd.active { border-color: rgba(244, 63, 94, 0.55); background: linear-gradient(155deg, rgba(244, 63, 94, 0.22) 0%, rgba(244, 63, 94, 0.06) 100%); color: #e11d48; box-shadow: 0 3px 12px rgba(244, 63, 94, 0.18); }

.journal-period-btn.active {
  transform: translateY(-1px);
}

.journal-period-clear-btn {
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.22rem 0.55rem;
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 8px;
  background: linear-gradient(155deg, rgba(239, 68, 68, 0.1) 0%, transparent 55%), var(--bg);
  color: #dc2626;
  font: inherit;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    border-color 0.14s ease,
    background 0.14s ease,
    color 0.14s ease;
}

.journal-period-clear-btn::before {
  content: '×';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  background: linear-gradient(145deg, #f87171, #dc2626);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.35);
}

.journal-period-clear-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(239, 68, 68, 0.45);
  background: linear-gradient(155deg, rgba(239, 68, 68, 0.16) 0%, rgba(239, 68, 68, 0.04) 100%);
  color: #b91c1c;
  box-shadow:
    0 4px 10px rgba(239, 68, 68, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.journal-period-clear-btn:focus-visible {
  outline: none;
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.14);
}

.jf-main-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem 0.55rem;
}

.jf-field input[type="number"] {
  width: 100%;
  padding: 0.32rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--num, inherit);
  font-size: 0.76rem;
}

.jf-field input[type="number"]::placeholder {
  color: var(--text-muted);
  font-family: inherit;
}

.jf-field-range {
  grid-column: span 2;
}

.jf-field-cols {
  grid-column: span 2;
}

.jf-section-pickers {
  padding-top: 0.15rem;
}

.jf-picker-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  padding: 0 0.85rem 0.65rem;
}

.jf-picker-row .jf-field-range {
  grid-column: auto;
}

.jf-field-picker {
  min-width: 0;
}

.journal-filter-picker {
  position: relative;
  min-width: 0;
}

.journal-filter-popover:not(.journal-date-popover) {
  width: min(18rem, calc(100vw - 1rem));
}

.journal-filter-search {
  width: 100%;
  margin-bottom: 0.55rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
}

.journal-filter-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
}

.journal-filter-options {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-height: 14rem;
  overflow-y: auto;
  margin-bottom: 0.55rem;
}

.journal-filter-option {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.journal-filter-option:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.18);
}

.journal-filter-option.active {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.35);
  color: var(--accent);
  font-weight: 600;
}

.journal-day-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}

.journal-day-chip {
  padding: 0.45rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.journal-day-chip:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.08);
}

.journal-day-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.journal-filter-popover-foot {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.jf-picker-row--secondary {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  padding-top: 0;
}

.journal-month-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1400px) {
  .jf-picker-row--secondary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .jf-picker-row--secondary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .jf-picker-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .jf-picker-row--secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .jf-picker-row,
  .jf-picker-row--secondary {
    grid-template-columns: 1fr;
  }
}

.jf-date-range-picker {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  min-width: 0;
}

.journal-filter-trigger,
.journal-date-trigger {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(99, 102, 241, 0.22);
  background: rgba(99, 102, 241, 0.05);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  text-align: left;
}

.journal-filter-trigger:hover,
.journal-date-trigger:hover {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.08);
}

.journal-filter-trigger.is-active,
.journal-filter-trigger:focus-visible,
.journal-date-trigger.is-active,
.journal-date-trigger:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
}

.journal-filter-trigger.is-set,
.journal-date-trigger.is-set {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.16);
  box-shadow: inset 3px 0 0 var(--accent), 0 0 0 1px rgba(99, 102, 241, 0.2);
}

.journal-filter-trigger.is-set:hover,
.journal-date-trigger.is-set:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.2);
}

.journal-filter-trigger.is-set .journal-filter-trigger-label,
.journal-date-trigger.is-set .journal-filter-trigger-label,
.journal-date-trigger.is-set .journal-date-trigger-label {
  color: var(--accent);
}

.journal-filter-trigger.is-set .journal-filter-trigger-value,
.journal-date-trigger.is-set .journal-filter-trigger-value,
.journal-date-trigger.is-set .journal-date-trigger-value {
  color: var(--accent);
  font-weight: 700;
}

.journal-filter-trigger.is-set .journal-filter-trigger-icon,
.journal-date-trigger.is-set .journal-filter-trigger-icon,
.journal-date-trigger.is-set .journal-date-trigger-icon {
  color: var(--accent);
}

.jf-field-picker:has(.journal-filter-trigger.is-set) > .jf-field-label {
  color: var(--accent);
  font-weight: 600;
}

.journal-filter-trigger-icon,
.journal-date-trigger-icon {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  color: var(--accent);
  flex-shrink: 0;
}

.journal-filter-trigger-icon svg,
.journal-date-trigger-icon svg {
  width: 100%;
  height: 100%;
}

.journal-filter-trigger-text,
.journal-date-trigger-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  min-width: 0;
}

.journal-filter-trigger-label,
.journal-date-trigger-label {
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.journal-filter-trigger-value,
.journal-date-trigger-value {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.journal-filter-trigger:not(.is-set) .journal-filter-trigger-value,
.journal-date-trigger:not(.is-set) .journal-date-trigger-value {
  color: var(--text-muted);
  font-weight: 500;
}

.journal-filter-trigger-single,
.journal-date-trigger-single {
  width: 100%;
}

.journal-date-popover-hint {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

.jdp-pending-start {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  border-radius: 8px;
}

.jf-field-range:has(#journal-date-popover:not([hidden])) {
  position: relative;
  z-index: 120;
}

.journal-filter-popover,
.journal-date-popover {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  width: min(18.5rem, calc(100vw - 1rem));
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.18);
  background: var(--bg-elevated);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(12px);
}

.journal-date-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.journal-date-popover-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

.journal-date-nav {
  min-width: 2rem;
  padding-inline: 0.45rem;
  font-size: 1.1rem;
  line-height: 1;
}

.journal-date-popover-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.2rem;
  margin-bottom: 0.35rem;
}

.journal-date-popover-weekdays span {
  text-align: center;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.journal-date-popover-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.2rem;
  min-height: 11rem;
}

.jdp-day {
  min-height: 2rem;
  aspect-ratio: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.12s ease;
}

.jdp-day:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-1px);
}

.jdp-day-empty {
  pointer-events: none;
}

.jdp-today {
  border-color: rgba(99, 102, 241, 0.35);
}

.jdp-in-range {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.12);
  border-radius: 4px;
}

.jdp-range-start,
.jdp-range-end {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  border-radius: 8px;
}

.journal-date-popover-foot {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.jf-date-range {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.jf-date-inline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.jf-date-inline input[type="date"] {
  flex: 1;
  min-width: 0;
}

.jf-date-sep {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.jf-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.jf-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.jf-group-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.jf-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.jf-pill {
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

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

.jf-pill.active {
  background: rgba(59, 130, 246, 0.14);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.15);
}

.jf-pill-long.active {
  background: rgba(34, 197, 94, 0.12);
  border-color: var(--positive);
  color: var(--positive);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.15);
}

.jf-pill-short.active {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--negative);
  color: var(--negative);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.12);
}

.jf-pill-win.active {
  background: rgba(34, 197, 94, 0.12);
  border-color: var(--positive);
  color: var(--positive);
}

.jf-pill-loss.active {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--negative);
  color: var(--negative);
}

.jf-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.35rem 0.45rem;
  padding: 0.45rem 0.75rem 0.5rem;
  align-items: end;
}

.ew-filter-grid-basic {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 0.55rem 0.85rem;
  gap: 0.45rem 0.55rem;
  align-items: end;
}

.ew-filter-grid-basic .jf-field-range .jf-date-range-picker {
  width: 100%;
}

@media (max-width: 1100px) {
  .ew-filter-grid-basic {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .ew-filter-grid-basic {
    grid-template-columns: 1fr 1fr;
  }
}

.jf-field {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.jf-field-icon {
  display: none;
}

.jf-field-label {
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jf-field select,
.jf-field input[type="date"] {
  width: 100%;
  padding: 0.32rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.76rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.jf-field select:focus,
.jf-field input[type="date"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.jf-search {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.2);
  background: rgba(59, 130, 246, 0.05);
  min-height: 1.85rem;
}

.jf-grid-search {
  grid-column: 4 / -1;
}

.jf-search-icon {
  color: var(--text-muted);
  font-size: 0.78rem;
  flex-shrink: 0;
}

.jf-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.76rem;
}

.jf-search input:focus {
  outline: none;
}

.jf-more {
  margin: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}

.jf-more summary {
  padding: 0.45rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.04) 0%, transparent 100%);
}

.jf-more summary:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.jf-more[open] summary {
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}

.jf-more-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.42rem 0.5rem;
  padding: 0.55rem 0.85rem 0.65rem;
}

.jf-adv-picker-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.28rem;
  padding: 0 0.85rem 0.45rem;
}

.jf-adv-field {
  min-width: 0;
}

.jf-adv-field > .jf-field-label {
  font-size: 0.5rem;
  line-height: 1.05;
  margin-bottom: 0.08rem;
}

.jf-adv-select-shell {
  display: flex;
  align-items: center;
  gap: 0.22rem;
  width: 100%;
  min-width: 0;
  padding: 0.19rem 0.28rem;
  border-radius: 6px;
  border: 1px solid rgba(99, 102, 241, 0.22);
  background: rgba(99, 102, 241, 0.05);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.jf-adv-select-shell:hover {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.08);
}

.jf-adv-select-shell:focus-within {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.14);
}

.jf-adv-field:has(.jf-adv-select option:checked:not([value=""])) .jf-adv-select-shell {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.16);
  box-shadow: inset 2px 0 0 var(--accent), 0 0 0 1px rgba(99, 102, 241, 0.2);
}

.jf-adv-field:has(.jf-adv-select option:checked:not([value=""])) .journal-filter-trigger-label,
.jf-adv-field:has(.jf-adv-select option:checked:not([value=""])) .jf-adv-select {
  color: var(--accent);
}

.jf-adv-field:has(.jf-adv-select option:checked:not([value=""])) > .jf-field-label {
  color: var(--accent);
  font-weight: 600;
}

.jf-adv-field .journal-filter-trigger-icon {
  width: 0.72rem;
  height: 0.72rem;
}

.jf-adv-select-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.02rem;
  flex: 1;
  min-width: 0;
}

.jf-adv-field .journal-filter-trigger-label {
  font-size: 0.5rem;
  letter-spacing: 0.03em;
  line-height: 1.05;
}

.jf-adv-select {
  width: 100%;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.62rem;
  font-weight: 500;
  line-height: 1.1;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
  background-size: 0.5rem;
  padding-right: 0.55rem;
}

.jf-adv-select:focus {
  outline: none;
  color: var(--text);
}

.jf-adv-field:has(.jf-adv-select option:checked:not([value=""])) .jf-adv-select {
  font-weight: 700;
}

@media (max-width: 1200px) {
  .jf-adv-picker-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .jf-adv-picker-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .jf-adv-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.jf-adv-session .journal-filter-trigger-icon { color: #0891b2; }
.jf-adv-grade .journal-filter-trigger-icon { color: #d97706; }
.jf-adv-pretrade .journal-filter-trigger-icon { color: #9333ea; }
.jf-adv-tilt .journal-filter-trigger-icon { color: #e11d48; }
.jf-adv-timeframe .journal-filter-trigger-icon { color: #2563eb; }
.jf-adv-source .journal-filter-trigger-icon { color: #16a34a; }

.jf-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem 0.55rem;
  border-top: 1px solid var(--border);
  background: var(--bg-hover);
  min-height: 2.25rem;
}

.journal-filters .ew-active-filters {
  flex: 1;
  min-width: 0;
  padding: 0;
  min-height: 0;
  border-top: none;
  background: transparent;
}

.journal-filters .ew-active-filters:empty::before {
  content: 'No filters active';
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

@media (max-width: 1100px) {
  .jf-main-grid,
  .jf-more-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .jf-field-range,
  .jf-field-cols {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .jf-main-grid,
  .jf-more-grid {
    grid-template-columns: 1fr;
  }
  .jf-field-range,
  .jf-field-cols {
    grid-column: span 1;
  }
  .jf-search-wrap input {
    width: 100%;
  }
  .jf-top-actions {
    width: 100%;
  }
}

.jf-more summary::-webkit-details-marker {
  display: none;
}

@media (max-width: 1100px) {
  .jf-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .jf-grid-search {
    grid-column: 1 / -1;
  }
  .jf-more-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .jf-grid,
  .jf-more-grid {
    grid-template-columns: 1fr 1fr;
  }
  .jf-grid-search {
    grid-column: 1 / -1;
  }
  .jf-toolbar {
    flex-direction: column;
    gap: 0.75rem;
  }
  .jf-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Journal filters */
.journal-filters {
  margin-bottom: 0.85rem;
}

.journal-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.65rem 1rem 0.25rem;
  border-bottom: 1px solid var(--border);
}

.journal-status-tab {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.journal-status-tab:hover {
  border-color: var(--accent);
  color: var(--text);
}

.journal-status-tab.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

.journal-search-row {
  padding: 0.65rem 0 0.15rem;
}

.journal-search-row input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.22);
  background-color: rgba(59, 130, 246, 0.06);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
}

.journal-search-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.journal-filter-grid {
  padding-bottom: 0;
}

.journal-col-picker {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.65rem 0.75rem;
  margin-top: 0.35rem;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(59, 130, 246, 0.25);
  background: rgba(59, 130, 246, 0.04);
}

.journal-col-picker-label {
  width: 100%;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.journal-col-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text);
  cursor: pointer;
}

.journal-col-option input {
  accent-color: var(--accent);
}

.journal-cell-notes,
.journal-cell-reason {
  max-width: 200px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.journal-cell-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.journal-tag-chip {
  font-size: 0.68rem;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.journal-cell-empty {
  color: var(--text-muted);
  opacity: 0.5;
}

.journal-cell-hold {
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: nowrap;
}

.journal-cell-hold.hold-running {
  color: var(--accent);
  font-weight: 600;
}

.journal-cell-confluence {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  white-space: nowrap;
}

.journal-cell-confluence.conf-full {
  color: #15803d;
  background: rgba(34, 197, 94, 0.16);
}

.journal-cell-confluence.conf-high {
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.14);
}

.journal-cell-confluence.conf-mid {
  color: #b45309;
  background: rgba(251, 191, 36, 0.16);
}

.journal-cell-confluence.conf-low {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.14);
}

.journal-cell-risk,
.journal-cell-r,
.journal-cell-rr {
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: nowrap;
}

.journal-cell-rr {
  color: var(--accent);
  font-weight: 600;
}

input.input-readonly,
.input-readonly {
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: default;
}

.ew-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  min-height: 2rem;
  align-items: center;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.ew-filter-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.ew-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.35rem 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 500;
}

.ew-filter-chip-x {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0 0.2rem;
  opacity: 0.7;
}

.ew-filter-chip-x:hover {
  opacity: 1;
}

.ew-filter-meta {
  padding: 0.4rem 1rem 0.65rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--mono);
}

/* Monthly overview */
.monthly-overview-panel {
  margin-bottom: 1.25rem;
  padding: 0 !important;
  overflow: hidden;
}

.monthly-layout {
  display: flex;
  min-height: 280px;
}

.monthly-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 148px;
  flex-shrink: 0;
  padding: 0.85rem 0.65rem;
  border-right: 1px solid var(--border);
  background: var(--bg-hover);
}

.monthly-sidebar-label {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 0.45rem 0.5rem;
}

.monthly-tab {
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.monthly-tab:hover {
  color: var(--text);
  background: var(--bg);
}

.monthly-tab.active {
  background: var(--bg-elevated);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--border);
}

.monthly-main {
  flex: 1;
  min-width: 0;
  padding: 1rem 1.25rem 1.25rem;
}

.monthly-panel[hidden] {
  display: none;
}

.monthly-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

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

.month-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.month-nav span {
  font-weight: 600;
  min-width: 140px;
  text-align: center;
}

.month-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}

.month-stat {
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

.month-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.month-stat-value {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
}

.month-stat-value.positive { color: var(--positive); }
.month-stat-value.negative { color: var(--negative); }

.month-risk-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 1rem 0 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

.month-risk-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.month-risk-chip {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 110px;
  padding-right: 0.75rem;
  border-right: 1px solid var(--border);
}

.month-risk-chip:last-child {
  border-right: none;
}

.month-risk-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.month-risk-value {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
}

.month-breakdown-block-spaced {
  margin-top: 1.25rem;
}

@media (max-width: 768px) {
  .monthly-layout {
    flex-direction: column;
  }

  .monthly-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0.65rem;
  }

  .monthly-sidebar-label {
    width: 100%;
    padding-bottom: 0.25rem;
  }
}

.month-breakdown-block h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.month-split-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.month-split-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

.month-split-label.positive { color: var(--positive); }
.month-split-label.negative { color: var(--negative); }

.month-mini-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.month-mini-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.1rem 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.8rem;
}

.month-mini-name {
  font-weight: 600;
  grid-column: 1;
}

.month-mini-meta {
  grid-column: 1;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.month-mini-item .trade-pnl {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.month-mini-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.month-analysis-table {
  overflow-x: auto;
}

.month-analysis-table-spaced {
  margin-top: 0.85rem;
}

.month-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.month-table th,
.month-table td {
  padding: 0.45rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.month-table th {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}

.month-table td:last-child,
.month-table th:last-child {
  text-align: right;
}

.month-row-profit { background: rgba(34, 197, 94, 0.04); }
.month-row-loss { background: rgba(239, 68, 68, 0.04); }

.month-verdict {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.month-verdict-profit {
  background: var(--positive-bg);
  color: var(--positive);
}

.month-verdict-loss {
  background: var(--negative-bg);
  color: var(--negative);
}

.month-verdict-flat {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.month-empty {
  padding: 0.75rem 0;
}

@media (max-width: 900px) {
  .month-split-row {
    grid-template-columns: 1fr;
  }
  .month-risk-chip {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
  }
}

/* Open positions */
.open-positions-panel {
  margin-bottom: 1.25rem;
}

.open-positions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.open-positions-header h3 {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.open-positions-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.open-positions-hint {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.open-filters-row {
  display: flex;
  gap: 0.65rem;
  margin: 0;
}

.open-filters-row .ew-filter-field {
  min-width: 130px;
}

.open-positions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.open-position-card {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.25);
  background: rgba(59, 130, 246, 0.06);
  overflow: hidden;
  transition: border-color 0.2s;
}

.open-position-card.row-selected,
.open-position-card.open-position-expanded {
  border-color: var(--accent);
  background: rgba(41, 98, 255, 0.06);
}

.open-position-card.row-selected {
  box-shadow: 0 0 0 1px rgba(41, 98, 255, 0.2);
}

.open-position-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.55rem 0.85rem;
}

.open-position-card.open-position-expanded .open-position-row,
.open-position-card .live-j-quick {
  border-bottom: 1px solid rgba(59, 130, 246, 0.1);
}

.open-position-card.open-position-closed {
  border-color: var(--border);
  background: var(--bg-elevated);
}

.open-position-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.08);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.open-position-toggle:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent);
}

.open-position-chevron {
  width: 0.35rem;
  height: 0.35rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s;
  margin-top: -0.12rem;
}

.open-position-expanded .open-position-chevron {
  transform: rotate(45deg);
  margin-top: 0.08rem;
  border-color: var(--accent);
}

.open-position-row .trade-main {
  cursor: pointer;
  min-width: 0;
}

.open-position-row .trade-main:hover .trade-symbol {
  color: var(--accent);
}

.open-position-row .trade-meta {
  font-size: 0.74rem;
}

.live-j-quick {
  display: grid;
  grid-template-columns: minmax(88px, 0.9fr) minmax(72px, 0.65fr) minmax(72px, 0.65fr) minmax(90px, 1fr) minmax(100px, 1.2fr);
  gap: 0.35rem 0.5rem;
  padding: 0.4rem 0.85rem 0.45rem 2.6rem;
  align-items: end;
  background: rgba(59, 130, 246, 0.03);
}

.live-j-quick-field {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.live-j-quick-field span {
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.live-j-field.live-j-compact,
.open-position-journal .live-j-field.live-j-compact,
.live-j-quick select.live-j-compact {
  padding: 0.26rem 1.45rem 0.26rem 0.4rem;
  font-size: 0.74rem;
}

.live-j-quick input.live-j-compact {
  padding: 0.26rem 0.4rem;
  font-size: 0.74rem;
}

.open-position-journal {
  padding: 0.65rem 0.85rem 0.75rem 2.6rem;
  background: var(--bg);
}

.open-position-journal[hidden] {
  display: none;
}

.live-j-grid {
  display: grid;
}

.live-j-grid-extra {
  grid-template-columns: repeat(3, minmax(100px, 1fr));
  gap: 0.5rem 0.65rem;
}

.live-j-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.live-j-field-wrap span {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.live-j-wide {
  grid-column: 1 / -1;
}

.live-j-field,
.open-position-journal select {
  width: 100%;
  padding: 0.45rem 1.65rem 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.22);
  background-color: rgba(59, 130, 246, 0.06);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
}

.open-position-journal select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  cursor: pointer;
}

.live-j-field.live-j-notes,
.live-j-field.live-j-entry,
.live-j-field.live-j-exit {
  padding: 0.45rem 0.55rem;
  resize: vertical;
  min-height: 2.5rem;
  line-height: 1.4;
}

.live-j-field.live-j-tags {
  padding: 0.45rem 0.55rem;
}

.live-j-plan-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.live-j-plan-check input {
  width: auto;
  accent-color: var(--accent);
}

.live-j-mistakes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
}

.live-j-mistake {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
}

.live-j-mistake input {
  accent-color: var(--negative);
}

.live-j-field:focus,
.open-position-journal select:focus {
  outline: none;
  border-color: var(--accent);
}

@media (max-width: 900px) {
  .live-j-quick {
    grid-template-columns: 1fr 1fr;
    padding-left: 0.85rem;
  }

  .live-j-grid-extra {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .open-position-row {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto auto;
  }

  .open-position-row .badge-open,
  .open-position-row .trade-pnl,
  .open-position-row .btn-journal {
    grid-column: 2;
    justify-self: start;
  }

  .live-j-quick {
    grid-template-columns: 1fr 1fr;
    padding-left: 0.85rem;
  }

  .live-j-grid-extra {
    grid-template-columns: 1fr;
  }
}

.open-position-card .btn-journal {
  font-size: 0.75rem;
  padding: 0.35rem 0.65rem;
  white-space: nowrap;
}

/* Journal layout */
.journal-quick-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.journal-quick-tab {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.journal-quick-tab:hover {
  border-color: var(--accent);
  color: var(--text);
}

.journal-quick-tab.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.journal-layout {
  display: block;
}

.journal-list-col {
  min-width: 0;
}

.trade-workspace {
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.trade-workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-hover);
}

.trade-workspace-title h3 {
  font-size: 1.15rem;
  margin-bottom: 0.1rem;
}

.live-pulse {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.45rem;
  margin-right: 0.4rem;
  border-radius: 4px;
  background: rgba(242, 54, 69, 0.15);
  color: var(--negative);
  animation: livePulse 2s ease infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.editor-stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.65rem 1.1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}

.editor-stats-bar .stat-chip {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.editor-stats-bar .stat-chip-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.workspace-tabs {
  display: flex;
  gap: 0;
  padding: 0 0.5rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  background: var(--bg-elevated);
}

.workspace-tab {
  flex-shrink: 0;
  padding: 0.65rem 0.85rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}

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

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

.workspace-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.workspace-panel {
  display: none;
  padding: 1rem 1.1rem;
  overflow-y: auto;
  flex: 1;
  max-height: min(52vh, 480px);
}

.trade-workspace-shell .workspace-panel {
  max-height: calc(100vh - 15rem);
}

.workspace-panel.active {
  display: block;
  animation: panelIn 0.2s ease;
}

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

.workspace-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.overview-item {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

.overview-item.full { grid-column: 1 / -1; }

.overview-item .oi-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.overview-item .oi-value {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 500;
}

.oi-hint {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
}

.workspace-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-hover);
}

.discipline-check {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

.journal-form .field {
  margin-bottom: 0.85rem;
}

.journal-form .field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.journal-form input[type="text"],
.journal-form input[type="number"],
.journal-form textarea,
.journal-form select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.journal-form textarea {
  resize: vertical;
  min-height: 60px;
}

.journal-form input.field-synced,
.journal-form input[readonly].field-synced {
  background: var(--positive-bg);
  border-color: rgba(8, 153, 129, 0.25);
  color: var(--text);
  cursor: default;
}

.theme-toggle-3 .theme-btn {
  flex: 1 1 30%;
  font-size: 0.68rem;
  padding: 0.35rem 0.25rem;
}

.journal-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}

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

.journal-table tbody tr.row-selected {
  background: rgba(59, 130, 246, 0.12);
  outline: 1px solid rgba(59, 130, 246, 0.35);
}

.journal-table tbody tr.row-selected td {
  border-color: transparent;
}

/* Dashboard — compact filters, KPI strip, feed tabs */
.dash-filters-fancy {
  padding: 0;
  overflow: hidden;
  margin-bottom: 0.85rem;
  border: 1px solid rgba(59, 130, 246, 0.2);
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.06) 0%, var(--surface) 45%, var(--surface) 100%);
}

.df-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid rgba(59, 130, 246, 0.12);
}

.df-header-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.df-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.df-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.df-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.35rem 0.45rem;
  padding: 0.45rem 0.75rem 0.5rem;
}

.df-field-range {
  grid-column: span 2;
}

.df-date-range {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.df-date-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}

.df-date-period {
  flex: 1.4;
  min-width: 0;
}

.df-date-part {
  flex: 0.85;
  min-width: 0;
  max-width: 4.75rem;
}

.df-date-row select {
  padding: 0.28rem 0.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.18);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.74rem;
}

.df-date-row select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.df-date-inline {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}

.df-date-inline input[type="date"] {
  flex: 1;
  min-width: 0;
}

.df-date-sep {
  flex-shrink: 0;
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1;
}

.df-field {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.df-field-label {
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  line-height: 1.1;
}

.df-field select,
.df-field input[type="date"] {
  width: 100%;
  padding: 0.28rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.18);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.76rem;
}

.df-field input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.65;
}

.df-field input[type="date"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.df-field-search .filter-search {
  position: relative;
}

.filter-search-input {
  width: 100%;
  padding: 0.32rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.76rem;
}

.filter-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.filter-search-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.filter-search-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.2rem);
  z-index: 30;
  max-height: 11rem;
  overflow-y: auto;
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.filter-search-option {
  display: block;
  width: 100%;
  padding: 0.4rem 0.55rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.76rem;
  text-align: left;
  cursor: pointer;
}

.filter-search-option:hover,
.filter-search-option.active {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
}

.filter-search-option.active {
  font-weight: 600;
}

.df-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  padding: 0.35rem 0.75rem 0.45rem;
  border-top: 1px solid rgba(59, 130, 246, 0.1);
}

.dash-filters-fancy .ew-active-filters {
  flex: 1;
  min-width: 0;
  padding: 0;
  min-height: 0;
  border-top: none;
  background: transparent;
}

.dash-filters-fancy .ew-filter-meta {
  padding: 0;
  flex-shrink: 0;
  font-size: 0.72rem;
}

.dash-kpi-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.85rem !important;
  overflow-x: auto;
}

.dash-metrics-viz-host {
  display: contents;
}

.month-metrics-strip {
  margin-bottom: 0.75rem;
}

.dash-kpi-strip .kpi-chip {
  min-width: 88px;
  padding: 0 0.85rem;
}

.dash-kpi-strip .kpi-value {
  font-size: 0.95rem;
}

.dash-kpi-strip .kpi-chip-viz {
  min-width: 108px;
}

.kpi-viz,
.stat-viz {
  margin-top: 0.2rem;
  width: 100%;
  min-width: 88px;
}

.stat-viz-empty,
.kpi-viz-empty {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.dash-wl-track {
  display: flex;
  width: 100%;
  height: 1.15rem;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.dash-wl-track-compact {
  height: 0.75rem;
  border-radius: 3px;
}

.dash-wl-track-compact .dash-wl-seg {
  font-size: 0.5rem;
  padding: 0 0.1rem;
}

.dash-wl-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 0.58rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 0.2rem;
}

.dash-wl-win {
  background: rgba(34, 197, 94, 0.28);
  color: var(--positive);
}

.dash-wl-loss {
  background: rgba(239, 68, 68, 0.22);
  color: var(--negative);
}

.dash-wl-be {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.kpi-avgpnl-track {
  display: flex;
  width: 100%;
  height: 0.75rem;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.kpi-avgpnl-win,
.kpi-avgpnl-loss {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 0.5rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 0.12rem;
}

.kpi-avgpnl-win {
  background: rgba(34, 197, 94, 0.24);
  color: var(--positive);
}

.kpi-avgpnl-loss {
  background: rgba(239, 68, 68, 0.18);
  color: var(--negative);
}

.dash-pf-chart-compact {
  width: 100%;
  height: 2rem;
  display: block;
}

.kpi-chip-primary.kpi-chip-positive {
  border-right-color: rgba(34, 197, 94, 0.25);
}

.kpi-chip-primary.kpi-chip-positive .kpi-value {
  color: var(--positive);
}

.kpi-chip-primary.kpi-chip-negative {
  border-right-color: rgba(239, 68, 68, 0.25);
}

.kpi-chip-primary.kpi-chip-negative .kpi-value {
  color: var(--negative);
}

.dash-feed-panel {
  margin-bottom: 0.85rem;
  padding: 0 !important;
  overflow: hidden;
}

.dash-feed-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-hover);
}

.dash-feed-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.dash-feed-tab:hover {
  color: var(--text);
  background: rgba(59, 130, 246, 0.04);
}

.dash-feed-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--bg-elevated);
}

.dash-feed-panel > .dash-feed-panel {
  padding: 0.85rem 1rem 1rem;
}

.dash-feed-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

.dash-feed-toolbar .open-positions-hint {
  margin: 0;
}

@media (max-width: 900px) {
  .df-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .df-field-range {
    grid-column: span 2;
  }
  .df-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}


/* ─── Sessions (weekly) ─── */
.sessions-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-hover);
  width: fit-content;
  max-width: 100%;
}

.sessions-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
}

.sessions-tab.active {
  background: var(--panel, var(--bg));
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.sessions-week-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.session-week-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.04), transparent 50%),
    var(--panel, var(--bg-hover));
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.session-week-card:hover,
.session-week-card.is-selected {
  border-color: rgba(59, 130, 246, 0.45);
}

.session-week-card:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.55);
  outline-offset: 2px;
}

.session-week-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.session-week-heading {
  min-width: 0;
}

.session-week-period {
  margin: 0;
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.2;
}

.session-week-title {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--text-muted);
}

.session-week-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.session-metric {
  display: inline-flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
  padding: 0.28rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.28);
}

[data-theme="light"] .session-metric,
[data-theme="glass"] .session-metric {
  background: rgba(255, 255, 255, 0.75);
}

.session-metric-label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 700;
  line-height: 1.1;
}

.session-metric strong {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.15;
}

.session-tilt-compact {
  gap: 0.2rem;
}

.session-tilt-ring {
  width: 0.65rem;
  height: 0.65rem;
}

.session-tilt-label {
  font-size: 0.78rem;
}

.session-week-highlights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.75rem;
  margin-top: 0.15rem;
}

@media (max-width: 640px) {
  .session-week-highlights {
    grid-template-columns: 1fr;
  }
}

.session-highlight {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  padding: 0.3rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.2);
}

[data-theme="light"] .session-highlight,
[data-theme="glass"] .session-highlight {
  background: rgba(248, 250, 252, 0.9);
}

.session-highlight-label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 700;
}

.session-highlight-value {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  min-width: 0;
}

.session-highlight-meta {
  color: var(--text-muted);
  font-weight: 650;
  font-size: 0.72rem;
}

.session-week-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.45rem;
}

.session-week-cats .session-cat-chip {
  font-size: 0.68rem;
  padding: 0.15rem 0.4rem;
}

.session-stars {
  display: inline-flex;
  gap: 0.1rem;
  line-height: 1;
}

.session-star,
.session-star-btn {
  color: #475569;
  font-size: 1rem;
}

.session-star.is-on,
.session-star-btn.is-on {
  color: #f59e0b;
}

.session-star-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.1rem;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.session-star-btn:hover {
  color: #fbbf24;
}

.session-tilt-compact {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.session-tilt-ring {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: conic-gradient(currentColor calc(var(--tilt) * 1%), rgba(148, 163, 184, 0.25) 0);
  box-shadow: inset 0 0 0 2px var(--panel, #0f172a);
}

.session-tilt-compact.tilt-good { color: var(--positive); }
.session-tilt-compact.tilt-warn { color: #f59e0b; }
.session-tilt-compact.tilt-bad { color: var(--negative); }

.session-tilt-label {
  font-family: var(--num);
  font-size: 0.88rem;
  font-weight: 650;
}

.session-category-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.session-cat-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
}

button.session-cat-chip:hover {
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--text);
}

.session-cat-chip.is-on {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.12);
  color: var(--text);
}

.session-category-add {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.55rem;
  max-width: 22rem;
}

.session-category-add input {
  flex: 1;
  min-width: 0;
}

.session-workspace {
  max-width: min(56rem, 100%);
  width: min(56rem, 100%);
  max-height: calc(100vh - 2rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #0b1220 !important;
  background-color: #0b1220 !important;
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  opacity: 1;
}

[data-theme="light"] .session-workspace,
[data-theme="glass"] .session-workspace {
  background: #f8fafc !important;
  background-color: #f8fafc !important;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.session-workspace .trade-workspace-header {
  flex: 0 0 auto;
  padding: 1rem 1.15rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.session-workspace .trade-workspace-title h3 {
  font-weight: 750;
  letter-spacing: -0.02em;
}

.session-workspace .trade-workspace-title .subtitle {
  font-weight: 650;
  color: var(--text);
  opacity: 0.85;
}

.session-workspace .editor-stats-bar {
  flex: 0 0 auto;
  padding: 0.65rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.35);
}

[data-theme="light"] .session-workspace .editor-stats-bar,
[data-theme="glass"] .session-workspace .editor-stats-bar {
  background: rgba(226, 232, 240, 0.7);
}

.session-workspace .stat-chip-label {
  font-weight: 700;
}

.session-workspace .stat-chip span:last-child,
.session-workspace .stat-chip .trade-pnl {
  font-weight: 750;
}

.session-editor-form {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 1rem 1.15rem 1.25rem;
  scrollbar-gutter: stable;
}

.session-editor-form .field > label,
.session-editor-form .field label {
  font-weight: 700;
  color: var(--text);
}

.session-editor-form textarea,
.session-editor-form input[type="text"] {
  font-weight: 600;
}

.session-editor-equity,
.session-editor-tilt,
.session-editor-trades {
  margin-top: 0.85rem;
  padding: 0.95rem 1rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

[data-theme="light"] .session-editor-equity,
[data-theme="light"] .session-editor-tilt,
[data-theme="light"] .session-editor-trades,
[data-theme="glass"] .session-editor-equity,
[data-theme="glass"] .session-editor-tilt,
[data-theme="glass"] .session-editor-trades {
  background: #ffffff;
}

.session-editor-equity h4,
.session-editor-tilt h4,
.session-editor-trades h4 {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
  font-weight: 750;
}

.session-editor-equity-chart {
  min-height: 12rem;
}

.session-editor-equity-chart .equity-chart-card {
  gap: 0.35rem;
}

.session-editor-equity-chart .equity-chart-wrap {
  background: rgba(2, 6, 23, 0.55);
}

[data-theme="light"] .session-editor-equity-chart .equity-chart-wrap,
[data-theme="glass"] .session-editor-equity-chart .equity-chart-wrap {
  background: #f1f5f9;
}

.session-editor-equity-chart .equity-chart-kicker,
.session-editor-equity-chart .equity-chart-headline,
.session-editor-equity-chart .equity-stat-label,
.session-editor-equity-chart .equity-stat-value {
  font-weight: 700;
}

.session-rating-picker {
  min-height: 1.6rem;
  display: flex;
  align-items: center;
}

.session-workspace .workspace-footer {
  position: sticky;
  bottom: 0;
  margin-top: 1rem;
  padding-top: 0.85rem;
  background: inherit;
  border-top: 1px solid var(--border);
}

.session-metric-label,
.session-metric strong {
  font-weight: 700;
}


.session-editor-tabs {
  flex: 0 0 auto;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.25);
}

[data-theme="light"] .session-editor-tabs,
[data-theme="glass"] .session-editor-tabs {
  background: rgba(226, 232, 240, 0.55);
}

.session-tab-count {
  font-weight: 700;
  color: var(--text-muted);
  margin-left: 0.2rem;
}

.session-editor-panel[hidden] {
  display: none !important;
}

.session-editor-panel.active {
  display: block;
}

.session-trades-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.session-trades-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text);
}

.session-trades-meta {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-muted);
}

.session-editor-trades-host {
  min-height: 12rem;
}

.session-trades-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  max-height: min(55vh, 28rem);
  background: rgba(2, 6, 23, 0.35);
}

[data-theme="light"] .session-trades-table-wrap,
[data-theme="glass"] .session-trades-table-wrap {
  background: #fff;
}

.session-trades-table {
  width: 100%;
  margin: 0;
}

.session-trades-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-hover);
  font-weight: 750;
}

.session-trade-row {
  cursor: pointer;
}

.session-trade-row:hover,
.session-trade-row:focus-visible {
  background: rgba(59, 130, 246, 0.1);
  outline: none;
}

.session-trade-row td {
  font-weight: 650;
}

.session-notes-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.session-notes-label-row label {
  margin: 0;
}

.session-notes-hint {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}


.session-lessons-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.session-lessons-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.session-lessons-sub {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
  max-width: 36rem;
  line-height: 1.45;
}

.session-lessons-empty {
  padding: 1.5rem 1.1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  background: rgba(15, 23, 42, 0.2);
}

.session-lessons-empty-title {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  font-weight: 500;
}

.session-lessons-empty p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.45;
}

.session-lessons-layout {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.session-lessons-summary-panel {
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background:
    linear-gradient(165deg, rgba(59, 130, 246, 0.1), transparent 55%),
    rgba(15, 23, 42, 0.35);
}

[data-theme="light"] .session-lessons-summary-panel,
[data-theme="glass"] .session-lessons-summary-panel {
  background:
    linear-gradient(165deg, rgba(59, 130, 246, 0.06), transparent 55%),
    #fff;
}

.session-lessons-summary-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.session-lessons-summary-top h5 {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.session-lessons-prose {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text);
  max-width: 46rem;
}

.session-lessons-points {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.session-lessons-points-label {
  margin: 0 0 0.45rem;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
}

.session-lessons-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.session-lessons-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.28rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(2, 6, 23, 0.25);
  min-width: 4.5rem;
}

[data-theme="light"] .session-lessons-kpi,
[data-theme="glass"] .session-lessons-kpi {
  background: rgba(248, 250, 252, 0.9);
}

.session-lessons-kpi span {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 500;
}

.session-lessons-kpi-val {
  font-family: var(--num);
  font-size: 0.88rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.session-lessons-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (max-width: 720px) {
  .session-lessons-grid {
    grid-template-columns: 1fr;
  }
}

.session-lesson-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

[data-theme="light"] .session-lesson-card,
[data-theme="glass"] .session-lesson-card {
  background: #fff;
}

.session-lesson-card-head {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.session-lesson-card-head h5 {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.session-lesson-card-body {
  padding: 0.65rem 0.75rem 0.8rem;
}

.session-lesson-empty {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}

.session-lesson-summary {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.session-lesson-summary li {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.84rem;
  font-weight: 400;
  line-height: 1.4;
}

.session-lesson-summary-text {
  flex: 1;
  min-width: 0;
}

.session-lesson-count {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 400;
  margin-left: auto;
  white-space: nowrap;
}

.session-lesson-badge {
  flex: 0 0 auto;
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.14rem 0.38rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-muted);
}

.session-lesson-badge-entry { background: rgba(59, 130, 246, 0.14); color: #93c5fd; }
.session-lesson-badge-note { background: rgba(168, 85, 247, 0.12); color: #d8b4fe; }
.session-lesson-badge-watch { background: rgba(239, 68, 68, 0.12); color: #fca5a5; }
.session-lesson-badge-keep { background: rgba(34, 197, 94, 0.12); color: #86efac; }

[data-theme="light"] .session-lesson-badge-entry { color: #1d4ed8; }
[data-theme="light"] .session-lesson-badge-note { color: #7e22ce; }
[data-theme="light"] .session-lesson-badge-watch { color: #b91c1c; }
[data-theme="light"] .session-lesson-badge-keep { color: #15803d; }

.session-lesson-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.session-lesson-item {
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.session-lesson-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.session-lesson-text {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 400;
  line-height: 1.45;
}

.session-lesson-meta {
  display: inline-block;
  margin-top: 0.18rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

.session-lesson-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.session-lesson-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.26rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 400;
  background: rgba(15, 23, 42, 0.2);
}

.session-lesson-tag-label {
  font-weight: 400;
}

.session-lesson-tag-count {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 400;
}

.session-lesson-tag.is-good {
  border-color: rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.08);
}

.session-lesson-tag.is-bad {
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.08);
}


/* ─── Markets edge (Analysis) ─── */
.markets-edge-stage {
  padding: 1rem 1.15rem 1.35rem;
}

.markets-edge-intro {
  margin: 0 0 1rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 48rem;
}

.markets-edge-intro em {
  font-style: normal;
  color: var(--text);
}

.markets-edge-hero {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.markets-edge-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.markets-edge-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.2);
  min-width: 6rem;
}

[data-theme="light"] .markets-edge-kpi,
[data-theme="glass"] .markets-edge-kpi {
  background: #fff;
}

.markets-edge-kpi span {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 500;
}

.markets-edge-kpi em {
  font-style: normal;
  font-family: var(--num);
  font-size: 0.95rem;
  font-weight: 500;
}

.markets-insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.5rem;
}

.markets-insight {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    linear-gradient(165deg, rgba(59, 130, 246, 0.08), transparent 60%),
    rgba(15, 23, 42, 0.25);
}

[data-theme="light"] .markets-insight,
[data-theme="glass"] .markets-insight {
  background: linear-gradient(165deg, rgba(59, 130, 246, 0.05), #fff 55%);
}

.markets-insight-label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  font-weight: 500;
}

.markets-insight-name {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.markets-insight-meta {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 400;
}

.markets-section {
  margin-top: 1.35rem;
}

.markets-section-head {
  margin-bottom: 0.65rem;
}

.markets-section-head h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
}

.markets-section-head p {
  margin: 0.2rem 0 0;
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 400;
  max-width: 40rem;
}

.markets-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  gap: 0.55rem;
}

.markets-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
  background: rgba(15, 23, 42, 0.28);
}

[data-theme="light"] .markets-card,
[data-theme="glass"] .markets-card {
  background: #fff;
}

.markets-card.is-up {
  border-color: rgba(34, 197, 94, 0.28);
}

.markets-card.is-down {
  border-color: rgba(239, 68, 68, 0.28);
}

.markets-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.markets-card-head h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
}

.markets-card-pnl {
  font-family: var(--num);
  font-size: 0.82rem;
  font-weight: 500;
}

.markets-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem 0.4rem;
}

.markets-card-metrics div {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.markets-card-metrics span {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  font-weight: 500;
}

.markets-card-metrics em {
  font-style: normal;
  font-family: var(--num);
  font-size: 0.78rem;
  font-weight: 500;
}

.markets-card-sides {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

.markets-empty {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.markets-table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
  background: rgba(15, 23, 42, 0.2);
}

[data-theme="light"] .markets-table-wrap,
[data-theme="glass"] .markets-table-wrap {
  background: #fff;
}

.markets-table th {
  font-weight: 500;
}

.journal-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: rgba(8, 12, 20, 0.72);
}
.journal-gate[hidden] { display: none !important; }
.journal-gate-card {
  width: min(380px, calc(100vw - 32px));
  padding: 24px;
  border-radius: 16px;
  background: #fff;
  color: #0f172a;
  display: grid;
  gap: 12px;
}
.journal-gate-card h2 { margin: 0; }
.journal-gate-card p { margin: 0; opacity: 0.8; }
.journal-gate-card label { display: grid; gap: 6px; font-size: 0.9rem; }
.journal-gate-card input {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}
.journal-gate-error { color: #b91c1c; font-size: 0.85rem; }

/* ─── MAE / MFE Analysis ─── */
.mae-mfe-root {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mae-mfe-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mae-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.15rem 1.25rem;
}

.mae-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.mae-hero-copy h3 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.mae-lede {
  margin: 0;
  max-width: 36rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.mae-hero-kpis,
.mae-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.55rem;
}

.mae-hero-kpis {
  flex: 1 1 320px;
  max-width: 560px;
}

.mae-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: rgba(255,255,255,0.03);
}

[data-theme="light"] .mae-kpi,
[data-theme="glass"] .mae-kpi {
  background: rgba(15, 23, 42, 0.03);
}

.mae-kpi--good { border-color: rgba(34, 197, 94, 0.28); background: rgba(34, 197, 94, 0.06); }
.mae-kpi--mid { border-color: rgba(234, 179, 8, 0.28); background: rgba(234, 179, 8, 0.06); }
.mae-kpi--bad { border-color: rgba(239, 68, 68, 0.28); background: rgba(239, 68, 68, 0.06); }

.mae-kpi-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mae-kpi-value {
  font-size: 1.05rem;
  font-weight: 650;
}

.mae-kpi-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.mae-block {
  padding: 1rem 1.15rem 1.2rem;
}

.mae-block-head {
  margin-bottom: 0.85rem;
}

.mae-block-head h3 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.mae-block-head p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.mae-scatter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.mae-scatter-card h4 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 550;
}

.mae-scatter-svg {
  width: 100%;
  height: auto;
  display: block;
}

.mae-scatter-bg {
  fill: rgba(255,255,255,0.02);
  stroke: var(--border, rgba(255,255,255,0.08));
}

.mae-axis {
  stroke: rgba(148, 163, 184, 0.35);
  stroke-width: 1;
}

.mae-axis-label {
  fill: var(--text-muted);
  font-size: 10px;
}

.mae-dot {
  cursor: pointer;
  stroke: transparent;
  stroke-width: 8;
}

.mae-dot--win { fill: #22c55e; }
.mae-dot--loss { fill: #ef4444; }
.mae-dot--flat { fill: #94a3b8; }

.mae-scatter-empty,
.mae-empty-hint {
  margin: 0;
  padding: 1rem 0.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.mae-lists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

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

.mae-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.mae-table th {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
  white-space: nowrap;
}

.mae-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  white-space: nowrap;
}

.mae-row {
  cursor: pointer;
}

.mae-row:hover {
  background: rgba(255,255,255,0.04);
}

[data-theme="light"] .mae-row:hover,
[data-theme="glass"] .mae-row:hover {
  background: rgba(15, 23, 42, 0.04);
}

.mae-dir {
  display: inline-block;
  margin-left: 0.25rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}
