/* The Usual Profits — Trade Journal styles (dark theme, TradeZella structure) */

/* style.css locks the dashboard body to height:100vh + overflow:hidden so the
   dashboard's own .main scroll container owns the viewport. Journal pages
   don't have that container — they're a normal scrolling document — so undo
   those rules when the body has the journal-body class. */
body.journal-body {
  overflow: auto;
  height: auto;
  width: auto;
}

.journal-body {
  /* Scoped overrides — most values inherit dark-theme tokens from style.css */
  --bg-deep:         #070a12;
  --bg-primary:      #0a0d18;
  --bg-card:         #0a0d18;
  --bg-card-alt:     #080b14;
  --bg-surface:      #0f1220;
  --bg-row-alt:      rgba(255, 255, 255, 0.02);
  --border:          rgba(255, 255, 255, 0.10);
  --border-subtle:   rgba(255, 255, 255, 0.05);
  --border-highlight:rgba(255, 255, 255, 0.22);

  --green:           #10b981;
  --green-dim:       rgba(16, 185, 129, 0.12);
  --green-glow:      rgba(16, 185, 129, 0.28);
  --red:             #ef4444;
  --red-dim:         rgba(239, 68, 68, 0.12);
  --red-glow:        rgba(239, 68, 68, 0.28);
  --cyan:            #818cf8;                       /* indigo accent (brighter on dark) */
  --cyan-dim:        rgba(129, 140, 248, 0.15);
  --amber:           #f59e0b;
  --amber-dim:       rgba(245, 158, 11, 0.15);
  --amber-glow:      rgba(245, 158, 11, 0.3);

  --text-primary:    #e8e8f0;
  --text-secondary:  #9898b0;
  --text-muted:      #6b7280;
  --text-bright:     #ffffff;

  --chart-grid:      rgba(255, 255, 255, 0.06);
  --chart-axis:      rgba(255, 255, 255, 0.45);
  --chart-zero:      rgba(255, 255, 255, 0.22);

  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  margin: 0;
  padding: 0 28px 48px;
  min-height: 100vh;
}

/* ── Header ── */
.journal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.journal-header .logo {
  display: flex; align-items: center; gap: 12px;
  color: inherit; text-decoration: none;
}
.journal-header .logo-image { width: 40px; height: 40px; object-fit: contain; }
.journal-header .logo-title { font-weight: 700; font-size: 18px; letter-spacing: 0.01em; display: block; }
.journal-header .logo-tagline { font-size: 11px; color: var(--text-secondary); display: block; }
.journal-header-actions {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.header-filter {
  display: flex; flex-direction: column; gap: 2px;
}
.header-filter-label {
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-secondary);
}
.header-filter select, .header-filter input {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  min-width: 110px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-highlight);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover  { background: var(--bg-surface); border-color: var(--border-highlight); }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-primary       { background: var(--cyan-dim); border-color: var(--cyan); color: var(--cyan); }
.btn-primary:hover { background: rgba(129, 140, 248, 0.28); border-color: var(--cyan); }
.btn-ghost         { background: transparent; }
.btn-danger-ghost  { background: transparent; color: var(--red); border-color: rgba(255,68,68,0.4); }
.btn-danger-ghost:hover { background: var(--red-dim); }

/* ── Status ── */
.journal-status-bar {
  display: flex; justify-content: flex-end;
  margin-bottom: 14px;
}
.journal-status { color: var(--text-secondary); font-size: 12px; font-family: var(--font-mono); }

/* ── Stat cards ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
}
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary); }
.stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-bright);
}
.stat-value.pos { color: var(--green); }
.stat-value.neg { color: var(--red); }
.stat-value.neutral { color: var(--text-primary); }
.stat-value .pos { color: var(--green); }
.stat-value .neg { color: var(--red); }

/* Zella score bar */
.score-bar {
  position: relative;
  margin-top: 6px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff4444 0%, #ffaa00 45%, #00ff88 100%);
  overflow: visible;
}
.score-bar-fill {
  position: absolute; inset: 0 auto 0 0;
  height: 100%;
  background: rgba(0,0,0,0.35);
  border-top-right-radius: 999px; border-bottom-right-radius: 999px;
  width: 100%;
  transform-origin: left;
  transform: scaleX(0);
  animation: none;
  display: none;
}
.score-bar-knob {
  position: absolute; top: 50%;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-bright);
  border: 2px solid var(--bg-card);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
}

/* ── Main grid: trades + calendar ── */
.main-grid {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
@media (max-width: 1100px) { .main-grid { grid-template-columns: 1fr; } }

/* ── Panel ── */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 18px;
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px;
}
.panel-head h2 {
  font-size: 13px; font-weight: 600; margin: 0;
  color: var(--text-bright);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.panel-sub { font-size: 11px; color: var(--text-secondary); font-family: var(--font-mono); }

.panel-trades { padding: 0; display: flex; flex-direction: column; }
.panel-trades .table-wrap {
  overflow-y: auto;
  max-height: 560px;
}

/* ── Tabs ── */
.tabs {
  display: flex; border-bottom: 1px solid var(--border);
}
.tab {
  flex: none;
  padding: 14px 18px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text-primary); }
.tab.is-active {
  color: var(--text-bright);
  border-bottom-color: var(--cyan);
}

/* ── Table base ── */
.journal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: var(--font-mono);
}
.journal-table th, .journal-table td {
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.journal-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  font-weight: 500;
  background: var(--bg-card-alt);
  position: sticky; top: 0; z-index: 1;
}
.journal-table td.num, .journal-table th.num { text-align: right; }
.journal-table td.pos { color: var(--green); }
.journal-table td.neg { color: var(--red); }
.journal-table td.neutral { color: var(--text-primary); }
.cell-date { color: var(--text-primary); font-weight: 500; line-height: 1.2; }
.cell-time { color: var(--text-secondary); font-size: 10px; line-height: 1.2; margin-top: 1px; }

.journal-table td.sym { font-weight: 600; white-space: nowrap; }
.journal-table td.sym .sym-base { color: var(--cyan); }
.journal-table td.sym .sym-opt  { color: var(--amber); font-weight: 700; margin-left: 4px; }
.journal-table td.sym .sym-exp  { color: var(--text-secondary); font-weight: 400; font-size: 11px; }
.journal-table tbody tr:hover { background: var(--bg-surface); }
.journal-table .muted { color: var(--text-muted); text-align: center; padding: 20px; }

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

/* ── Calendar panel ── */
.panel-calendar {
  display: flex; flex-direction: column;
}
.calendar-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.calendar-nav { display: flex; align-items: center; gap: 10px; }
.calendar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  min-width: 150px; text-align: center;
}
.cal-nav-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-highlight);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 16px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.cal-nav-btn:hover { background: rgba(255,255,255,0.04); }
.calendar-stats { display: flex; align-items: center; gap: 10px; }
.cal-stat-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.08em; }
.cal-stat-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}
.cal-stat-chip.pos { background: var(--green-dim); color: var(--green); }
.cal-stat-chip.neg { background: var(--red-dim); color: var(--red); }
.cal-stat-chip.neutral { background: rgba(255,255,255,0.05); color: var(--text-secondary); }
.cal-stat-sub { font-size: 11px; color: var(--text-secondary); font-family: var(--font-mono); }

.calendar-grid {
  display: grid;
  /* 7 day columns + a fixed-width week-summary column. Each calendar row
     contains the 7 day cells followed by that row's week card, so they line
     up vertically without any separate sidebar. */
  grid-template-columns: repeat(7, minmax(0, 1fr)) 140px;
  gap: 6px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .calendar-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .calendar-grid .week-card,
  .calendar-grid .cal-weekday.cal-week-spacer { display: none; }
}

.cal-weekday {
  text-align: center;
  padding: 6px 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  font-weight: 500;
}
.cal-weekday.cal-week-spacer { padding: 0; }
.cal-cell {
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 6px 8px;
  display: flex; flex-direction: column;
  gap: 2px;
  min-height: 84px;
  transition: transform .1s, border-color .1s;
  overflow: hidden;
}
.cal-cell:hover { border-color: var(--border-highlight); transform: translateY(-1px); }
.cal-cell-blank { background: transparent; border-color: transparent; }
.cal-cell-day {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: right;
}
.cal-cell-pnl {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
}
.cal-cell-pnl.pos { color: var(--green); }
.cal-cell-pnl.neg { color: var(--red); }
.cal-cell-sub {
  font-size: 10px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}
.cal-clickable { cursor: pointer; }
.cal-clickable:hover { transform: translateY(-2px); border-color: var(--border-highlight); }
.cal-pos     { background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.4); }
.cal-pos .cal-cell-day { color: var(--green); font-weight: 600; }
.cal-neg     { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.4); }
.cal-neg .cal-cell-day { color: var(--red); font-weight: 600; }
.cal-neutral { background: var(--bg-surface); }

/* ── Week summary card (sits in column 8 of the calendar grid) ── */
.week-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  min-height: 84px;
}
.week-card.pos { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.3); }
.week-card.neg { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.3); }
.week-card.empty { opacity: 0.5; }
.week-title { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }
.week-pnl { font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--text-bright); }
.week-card.pos .week-pnl { color: var(--green); }
.week-card.neg .week-pnl { color: var(--red); }
.week-sub { font-size: 10px; color: var(--text-secondary); font-family: var(--font-mono); }

/* ── 2-col bottom ── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

#equityChart { width: 100%; display: block; }

.panel-help .help-list {
  margin: 0; padding-left: 18px;
  color: var(--text-secondary);
  font-size: 13px; line-height: 1.6;
}
.panel-help .help-list strong { color: var(--text-primary); }
.panel-help code {
  background: var(--bg-surface);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
}
.env-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  margin: 6px 0;
  white-space: pre-wrap;
}

/* ── Sync controls ── */
.sync-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
  transition: background .15s, box-shadow .15s;
}
.sync-dot.is-ok       { background: var(--green); box-shadow: 0 0 6px var(--green-glow); }
.sync-dot.is-error    { background: var(--red); box-shadow: 0 0 6px var(--red-glow); }
.sync-dot.is-syncing  { background: var(--amber); animation: sync-pulse 1s ease-in-out infinite; }
@keyframes sync-pulse {
  0%, 100% { box-shadow: 0 0 4px var(--amber-glow); opacity: 1; }
  50%      { box-shadow: 0 0 10px var(--amber-glow); opacity: 0.6; }
}

.auto-sync-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-highlight);
  background: var(--bg-surface);
  font-size: 12px; color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.auto-sync-toggle input { accent-color: var(--green); cursor: pointer; }
.auto-sync-toggle:has(input:checked) { color: var(--green); border-color: var(--green); }

#lastSync { margin-right: auto; }
.journal-status-bar { justify-content: space-between; }

/* ── Day-detail modal ── */
.day-modal[hidden] { display: none; }
.day-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.day-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
}
.day-modal-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(1100px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px 28px 20px;
  box-shadow: 0 20px 60px rgba(17, 24, 39, 0.25);
}
.day-modal-close {
  position: absolute; top: 12px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 20px; line-height: 1;
  cursor: pointer;
}
.day-modal-close:hover { background: var(--bg-surface); color: var(--text-bright); }
.day-modal-head { margin-bottom: 18px; }
.day-modal-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
  color: var(--text-bright);
  font-weight: 600;
}
.day-modal-subtitle { font-size: 13px; color: var(--text-secondary); }
.day-modal-subtitle .pos { color: var(--green); font-weight: 600; }
.day-modal-subtitle .neg { color: var(--red); font-weight: 600; }
.day-modal-subtitle .neutral { color: var(--text-primary); font-weight: 600; }

.day-modal-top {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(360px, 2fr);
  gap: 20px;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
@media (max-width: 760px) {
  .day-modal-top { grid-template-columns: 1fr; }
}
#dayModalChart { width: 100%; display: block; }
.day-modal-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 20px;
}
.day-modal-stats > div {
  display: flex; flex-direction: column; gap: 2px;
}
.day-modal-stats .stat-label { font-size: 10px; }
.day-modal-stats .stat-value { font-size: 16px; }

.day-modal-table-wrap { max-height: 420px; overflow-y: auto; }

.ticker-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-highlight);
  color: var(--cyan);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 11px;
}
.side-call { color: var(--green); font-weight: 600; }
.side-put  { color: var(--red); font-weight: 600; }

/* ── Monthly Target pie ── */
.goal-wrap {
  display: flex;
  align-items: center;
  gap: 30px;
  flex-wrap: wrap;
}
.goal-pie {
  flex: none;
  line-height: 0;
  filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.18));
}
.goal-meta { display: flex; flex-direction: column; gap: 2px; }
.goal-amount {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-bright);
}
.goal-amount.pos { color: var(--green); }
.goal-amount.neg { color: var(--red); }
.goal-of { color: var(--text-secondary); font-size: 13px; }
.goal-pct {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-primary);
  margin-top: 8px;
}
.goal-note {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 10px;
  max-width: 340px;
}
@media (max-width: 640px) {
  .goal-wrap { justify-content: center; text-align: center; }
}

/* Collapsible panel (Recent Fills) — header toggles the body */
.panel-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.panel-toggle-left { display: flex; align-items: center; gap: 9px; }
.panel-chevron {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1;
  transition: transform 0.15s ease;
}
.panel-toggle:hover .panel-chevron { color: var(--text-primary); }
.panel-collapsible:not(.is-collapsed) .panel-toggle { margin-bottom: 12px; }
.panel-collapsible:not(.is-collapsed) .panel-chevron { transform: rotate(90deg); }
.panel-collapsible.is-collapsed .table-wrap { display: none; }
.panel-collapsible.is-collapsed .panel-body { display: none; }

/* The Wall — brick-by-brick monthly progress shelf next to the pie */
.goal-rewards { margin-top: 18px; }
.goal-rewards-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 9px;
}
.wall { display: flex; flex-direction: column; gap: 4px; width: max-content; }
.brick-row { display: flex; gap: 4px; }
.brick {
  width: 30px;
  height: 15px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  transition: background-color .3s ease, border-color .3s ease, box-shadow .3s ease;
}
.brick-laid {
  background: linear-gradient(180deg, #c9752f, #a35a22);
  border-style: solid;
  border-color: rgba(0,0,0,0.3);
  box-shadow: 0 0 8px -3px rgba(201,117,47,0.7), inset 0 -2px 0 rgba(0,0,0,0.2);
}
.brick-row-over { margin-bottom: 2px; }
.brick-gold {
  background: linear-gradient(180deg, var(--gold, #d8b34a), #b8912f);
  border-style: solid;
  border-color: rgba(0,0,0,0.3);
  box-shadow: 0 0 10px -3px var(--gold, #d8b34a), inset 0 -2px 0 rgba(0,0,0,0.2);
}
.brick-more {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  align-self: center;
  margin-left: 2px;
}

/* Rule-violation badges — flag trades that broke the locked rules. */
.rule-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 82, 82, 0.14);
  border: 1px solid rgba(255, 82, 82, 0.35);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
  cursor: help;
}

/* ── Sign-in gate ── */
body.is-gated > :not(.auth-gate) { filter: blur(8px) brightness(0.9); pointer-events: none; user-select: none; }
.auth-gate[hidden] { display: none; }
.auth-gate {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(8px);
}
.auth-gate-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 36px;
  width: min(440px, 92%);
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.35);
  display: flex; flex-direction: column; gap: 14px;
  text-align: center;
}
.auth-gate-kicker {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--cyan); font-weight: 600;
}
.auth-gate-title {
  margin: 0; font-size: 22px; color: var(--text-bright); font-weight: 700;
}
.auth-gate-copy {
  margin: 0; font-size: 14px; color: var(--text-secondary); line-height: 1.5;
}
.auth-gate-note { font-size: 11px; color: var(--text-muted); }
.auth-gate .btn { align-self: center; padding: 12px 24px; font-size: 14px; }

/* ── Settings modal ── */
.btn-icon { padding: 8px; }
.settings-card { width: min(520px, 100%); }
.settings-form {
  display: flex; flex-direction: column; gap: 18px;
  padding-top: 4px;
}
.settings-form label {
  display: flex; flex-direction: column; gap: 6px;
}
.settings-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-secondary);
  font-weight: 600;
}
.settings-form input,
.settings-form select {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.settings-form input:focus,
.settings-form select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.settings-hint {
  font-size: 11px; color: var(--text-secondary);
}
.settings-actions {
  display: flex; align-items: center; gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 14px;
}
.settings-spacer { flex: 1; }
.settings-status {
  font-size: 12px; color: var(--text-secondary);
  font-family: var(--font-mono);
  min-height: 16px;
}

/* ---------- Trade detail modal ---------- */
.trade-detail-card {
  width: min(1100px, 100%);
  max-height: calc(100vh - 48px);
}
.trade-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
  padding-right: 40px; /* leave room for close button */
}
.trade-detail-kicker {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.trade-detail-kicker .ticker-pill { font-size: 12px; padding: 3px 8px; }
.trade-detail-instrument { color: var(--text-primary); font-weight: 600; }
.trade-detail-head h3 {
  margin: 0;
  font-size: 24px;
  color: var(--text-bright);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.trade-detail-head h3 .pos { color: var(--green); }
.trade-detail-head h3 .neg { color: var(--red); }
.trade-detail-side-wrap { display: flex; gap: 6px; align-items: center; }
.side-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--cyan-dim);
  color: var(--cyan);
  border: 1px solid var(--border-highlight);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}
.side-badge.is-call { background: var(--green-dim); color: var(--green); }
.side-badge.is-put  { background: var(--red-dim); color: var(--red); }
.side-badge.is-open { background: var(--amber-dim); color: var(--amber); }

.trade-detail-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
}
@media (max-width: 800px) {
  .trade-detail-body { grid-template-columns: 1fr; }
}

.trade-detail-stats {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 0;
}
.trade-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  font-size: 13px;
  border-top: 1px solid var(--border-subtle);
}
.trade-stat-row:first-child { border-top: none; }
.trade-stat-row > span:first-child { color: var(--text-secondary); }
.trade-stat-row > span:last-child { color: var(--text-primary); font-family: var(--font-mono); font-weight: 500; }
.trade-stat-row > span.pos { color: var(--green); }
.trade-stat-row > span.neg { color: var(--red); }

.trade-detail-right {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.trade-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--border-subtle);
  border-bottom: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.trade-chart-controls, .trade-chart-toolbar label { display: flex; align-items: center; gap: 8px; }
.trade-chart-toolbar select {
  min-width: 82px;
  padding: 6px 28px 6px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font: 600 12px var(--font-mono);
  letter-spacing: 0;
  text-transform: none;
}
.trade-chart-auto-size {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font: 600 12px var(--font-mono);
  cursor: pointer;
}
.trade-chart-auto-size:hover:not(:disabled) { border-color: var(--cyan); color: var(--cyan); }
.trade-chart-auto-size:disabled { cursor: default; opacity: 0.45; }
.trade-chart-toolbar :is(select, button):focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
@media (max-width: 520px) {
  .trade-chart-toolbar { align-items: flex-start; }
  .trade-chart-controls { align-items: flex-end; flex-direction: column; }
}
.trade-detail-chart {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow: hidden;
  min-height: 260px;
  position: relative;
}
.trade-detail-chart + .trade-detail-notes-wrap { margin-top: 14px; }
.trade-detail-notes-wrap + .trade-detail-fills-wrap { margin-top: 14px; }
.trade-detail-chart iframe { display: block; width: 100%; border: 0; }
.trade-chart-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 340px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
}
.trade-chart-fallback-msg {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--amber-dim);
  border-bottom: 1px solid var(--border-subtle);
}

.trade-detail-fills-wrap { min-width: 0; }
.trade-detail-fills-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}
.trade-detail-fills-table th, .trade-detail-fills-table td {
  padding: 8px 10px;
  font-size: 12.5px;
}

/* ---------- Day/Week view toggle ---------- */
.view-toggle {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.view-toggle-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.view-toggle-btn:hover { color: var(--text-primary); }
.view-toggle-btn.is-active {
  background: var(--cyan-dim);
  color: var(--cyan);
}

/* ---------- Week modal ---------- */
.week-modal-card { max-width: 1100px; }
.week-day-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 4px;
}
.week-day-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 8px;
  background: var(--bg-surface);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 78px;
  justify-content: center;
}
.week-day-card.pos { border-color: var(--green); background: var(--green-dim); }
.week-day-card.neg { border-color: var(--red); background: var(--red-dim); }
.week-day-card.empty { opacity: 0.55; }
.week-day-card .wd-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.week-day-card .wd-pnl { font-size: 15px; font-weight: 700; }
.week-day-card .wd-sub { font-size: 11px; color: var(--text-muted); }

.zella-scale {
  padding: 8px 0 6px;
  margin-bottom: 6px;
  border-top: 1px solid var(--border-subtle);
}
.zella-scale-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.zella-scale-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
}
.zella-scale-loss   { color: var(--red); }
.zella-scale-profit { color: var(--green); text-align: right; }
.zella-scale-track {
  height: 6px;
  background: linear-gradient(to right, var(--red) 0%, rgba(150,150,150,0.35) 50%, var(--green) 100%);
  border-radius: 999px;
  position: relative;
}
.zella-scale-fill {
  position: absolute;
  top: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-bright);
  border: 2px solid var(--bg-card);
  transform: translateX(-50%);
  left: 50%;
}

.week-cell-day {
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-muted);
}

.week-card.clickable { cursor: pointer; }
.week-card.clickable:hover {
  filter: brightness(1.08);
  border-color: var(--border-highlight);
}

/* ---------- Trade-detail notes ---------- */
.trade-detail-notes-wrap {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.trade-detail-notes-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.trade-detail-notes-status {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}
.trade-detail-notes {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 12px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.trade-detail-notes:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-dim);
}
.trade-detail-notes:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- Light theme ----------
   Opt-in by adding `is-light` to `.journal-body`. Flips the CSS custom
   properties defined at the top of this file so every component picks up
   light backgrounds/text without bespoke overrides. */
.journal-body.is-light {
  --bg-deep:          #f6f7fb;
  --bg-primary:       #ffffff;
  --bg-card:          #ffffff;
  --bg-card-alt:      #f9fafb;
  --bg-surface:       #f3f4f6;
  --bg-row-alt:       rgba(0, 0, 0, 0.02);
  --border:           rgba(0, 0, 0, 0.10);
  --border-subtle:    rgba(0, 0, 0, 0.05);
  --border-highlight: rgba(0, 0, 0, 0.22);

  --green:            #059669;
  --green-dim:        rgba(5, 150, 105, 0.10);
  --green-glow:       rgba(5, 150, 105, 0.22);
  --red:              #dc2626;
  --red-dim:          rgba(220, 38, 38, 0.10);
  --red-glow:         rgba(220, 38, 38, 0.22);
  --cyan:             #4f46e5;
  --cyan-dim:         rgba(79, 70, 229, 0.14);
  --amber:            #d97706;
  --amber-dim:        rgba(217, 119, 6, 0.14);
  --amber-glow:       rgba(217, 119, 6, 0.28);

  --text-primary:     #1f2937;
  --text-secondary:   #4b5563;
  --text-muted:       #6b7280;
  --text-bright:      #111827;

  --chart-grid:       rgba(0, 0, 0, 0.06);
  --chart-axis:       rgba(0, 0, 0, 0.45);
  --chart-zero:       rgba(0, 0, 0, 0.22);

  color-scheme: light;
}

/* ══════════════════════════════════════════════════════════════════
   WHY I TRADE — the goal, the reasons, the compounding math
   ══════════════════════════════════════════════════════════════════ */
.panel-why { margin-bottom: var(--gap, 16px); }

.why-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
}

.why-headline {
  font-family: 'Fraunces', var(--font-sans);
  font-optical-sizing: auto;
  font-weight: 620;
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.15;
  color: var(--text-bright);
  margin: 6px 0 0;
}

.why-goal {
  font-family: 'Fraunces', var(--font-sans);
  font-optical-sizing: auto;
  font-weight: 700;
  font-size: clamp(32px, 6vw, 44px);
  line-height: 1;
  color: var(--amber);
  margin-top: 10px;
}
.why-goal span {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.32em;
  color: var(--text-secondary);
  margin-left: 4px;
}

.why-reasons {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.why-reason {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-primary);
}
.why-reason b { color: var(--amber); font-weight: 600; }
.why-reason-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  width: 16px;
  flex-shrink: 0;
}

.why-compound {
  margin-top: 18px;
  padding: 14px 16px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-surface);
}
.why-compound-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 10px;
}
.why-compound-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.why-cstep { text-align: center; min-width: 0; }
.why-cstep-period {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.why-cstep-num {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(13px, 2.2vw, 16px);
  color: var(--text-bright);
}
.why-cstep-num.why-gold { color: var(--amber); }
.why-compound-note {
  margin-top: 10px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-secondary);
  text-align: center;
}

.why-gate {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--amber-dim);
  border-radius: 10px;
  background: var(--amber-dim);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-bright);
}

@media (max-width: 460px) {
  .why-compound-row { grid-template-columns: repeat(2, 1fr); gap: 10px 6px; }
}

/* ══════════════════════════════════════════════════════════════════
   THE BUILD — gamified all-time P&L construction site
   ══════════════════════════════════════════════════════════════════ */
.panel-kingdom { margin-bottom: var(--gap, 16px); }
.kingdom-wrap {
  display: flex; gap: 20px; align-items: stretch; flex-wrap: wrap;
}
.kingdom-stage {
  flex: 0 1 380px; min-width: 260px;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(120% 80% at 50% 15%, rgba(0,212,255,0.06), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.12));
  border: 1px solid var(--border, rgba(255,255,255,0.07));
  border-radius: 14px; padding: 14px; overflow: hidden;
}
.kingdom-stage svg { width: 100%; height: auto; display: block; }
.kingdom-side {
  flex: 1 1 240px; min-width: 220px;
  display: flex; flex-direction: column; gap: 12px; justify-content: center;
}
.kingdom-rank {
  font-family: var(--font-mono, monospace); font-size: .72rem;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--cyan, #00d4ff);
}
.kingdom-net {
  font-family: var(--font-mono, monospace); font-size: 2rem; font-weight: 700;
  line-height: 1;
}
.kingdom-net.pos { color: var(--green, #00ff88); }
.kingdom-net.neg { color: var(--red, #ff4444); }
.kingdom-net.neutral { color: var(--text-secondary, #9898b0); }
.kingdom-progress-top {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono, monospace); font-size: .72rem;
  color: var(--text-secondary, #9898b0); margin-bottom: 6px;
}
.kingdom-bar {
  height: 10px; border-radius: 6px; overflow: hidden;
  background: rgba(255,68,68,0.18);
  border: 1px solid var(--border, rgba(255,255,255,0.07));
}
.kingdom-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #22c55e, #00ff88);
  box-shadow: 0 0 10px rgba(0,255,136,0.5);
  transition: width .8s cubic-bezier(.22,1,.36,1);
}
.kingdom-next {
  font-family: var(--font-mono, monospace); font-size: .78rem;
  color: var(--text-primary, #e8e8f0); margin-top: 7px;
}
.kingdom-milestones {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px;
}
.km-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono, monospace); font-size: .66rem;
  padding: 4px 8px; border-radius: 20px;
  border: 1px solid var(--border, rgba(255,255,255,0.07));
  background: rgba(255,255,255,0.03);
  color: var(--text-muted, #6a6a80);
  transition: all .2s;
}
.km-chip .km-ico {
  width: 12px; height: 7px; border-radius: 1px; flex-shrink: 0;
  background: rgba(255,255,255,0.12);
}
.km-chip.unlocked {
  color: var(--green, #00ff88);
  border-color: rgba(0,255,136,0.35);
  background: rgba(0,255,136,0.10);
}
.km-chip.unlocked .km-ico { background: linear-gradient(180deg, #c9752f, #a35a22); }
.km-chip.target {
  color: var(--amber, #ffaa00);
  border-color: rgba(255,170,0,0.5);
  background: rgba(255,170,0,0.10);
  animation: km-pulse 1.8s ease-in-out infinite;
}
.km-chip.target .km-ico { background: var(--amber, #ffaa00); }
@keyframes km-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,170,0,0.0); }
  50%     { box-shadow: 0 0 10px 1px rgba(255,170,0,0.35); }
}
.kingdom-tile { transition: opacity .5s; }
.kingdom-struct { animation: km-pop .5s cubic-bezier(.34,1.56,.64,1); }
@keyframes km-pop {
  0% { opacity: 0; transform: translateY(6px) scale(.6); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 640px) {
  .kingdom-net { font-size: 1.6rem; }
}

/* The Build — layered brick construction scene */
.kingdom-stage { background: #060b13; }
.ki-scene {
  position: relative; width: 100%; max-width: 340px; margin: 0 auto;
  aspect-ratio: 2 / 3;
}
.ki-island {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; user-select: none; -webkit-user-drag: none;
}
.ki-green { transition: opacity .6s ease; }
.ki-roof { opacity: 0; transition: opacity .6s ease; }
.ki-struct {
  position: absolute; transform: translate(-50%, -100%);
  transform-origin: bottom center;
  filter: drop-shadow(0 5px 7px rgba(0,0,0,0.5));
  opacity: 0; transition: opacity .5s ease;
  pointer-events: none; user-select: none; -webkit-user-drag: none;
}
.ki-struct.shown { opacity: 1; animation: ki-rise .6s cubic-bezier(.34,1.56,.64,1); }
@keyframes ki-rise {
  0%   { opacity: 0; transform: translate(-50%, -80%) scale(.5); }
  100% { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}

/* Historical trade executions */
.trade-chart-caption, .trade-chart-events { padding: 10px 14px; font-size: 12px; line-height: 1.6; }
.trade-chart-caption { color: var(--text-secondary); border-bottom: 1px solid var(--border-subtle); }
.trade-chart-events { display: flex; flex-wrap: wrap; gap: 6px 18px; border-top: 1px solid var(--border-subtle); max-height: 100px; overflow-y: auto; }
.trade-chart-entry { color: #10b981; }
.trade-chart-exit { color: #ef4444; }
body.is-light .trade-chart-entry { color: #047857; }
body.is-light .trade-chart-exit { color: #b91c1c; }

/* Personal monthly plan */
.goal-settings-form { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--border-subtle); }
.goal-settings-form label, .goal-daily-preview { display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: var(--text-secondary); }
.goal-settings-form input { width: 180px; max-width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-surface); color: var(--text-primary); font: inherit; font-size: 15px; }
.goal-settings-form input:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.goal-daily-preview output { color: var(--green); font-family: var(--font-mono); font-size: 20px; padding: 6px 0; }
.goal-plan-help, .goal-save-status { flex-basis: 100%; margin: 0; font-size: 12px; color: var(--text-secondary); }
.goal-save-status:empty { display: none; }
.goal-daily-target { margin-top: 8px; color: var(--green); font-size: 13px; }
.why-goal strong { font-weight: inherit; }
@media (max-width: 640px) {
  .goal-settings-form label { flex: 1 1 140px; }
  .goal-settings-form input { width: 100%; }
  .goal-daily-preview { flex: 1 1 180px; }
}

/* Quiet, separate blocks keep the calendar close to the monthly overview. */
.journal-plan-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  margin-bottom: 18px;
}
.journal-plan-grid > .panel { min-width: 0; margin-bottom: 0; padding: 22px; border-color: var(--border-subtle); border-radius: 14px; }
.journal-plan-grid .panel-goal { background: #151618; }
.journal-plan-grid .panel-why {
  background: #111214;
  --text-primary: #e5e5e5;
  --text-secondary: #a3a3a3;
  --text-muted: #a3a3a3;
  --text-bright: #f5f5f5;
}
.journal-body.is-light .journal-plan-grid .panel-goal { background: #f7f7f7; }
.journal-body.is-light .journal-plan-grid .panel-why {
  background: #fafafa;
  --text-primary: #262626;
  --text-secondary: #626262;
  --text-muted: #626262;
  --text-bright: #171717;
}
.journal-plan-grid .panel-head { display: block; margin-bottom: 18px; }
.journal-plan-grid .panel-sub { display: block; margin-top: 5px; font-size: 11px; }
.journal-plan-grid .goal-wrap { flex-wrap: nowrap; gap: 22px; }
.journal-plan-grid .goal-pie { width: 120px; filter: none; }
.journal-plan-grid .goal-pie svg { display: block; width: 100%; height: auto; }
.journal-plan-grid .goal-meta { min-width: 0; flex: 1; }
.journal-plan-grid .goal-amount { font-size: clamp(25px, 2.5vw, 34px); overflow-wrap: anywhere; }
.journal-plan-grid .goal-pct { font-size: 12px; color: var(--text-secondary); }
.journal-plan-grid .goal-note { margin-top: 6px; font-size: 11px; }
.journal-plan-grid .goal-daily-target { color: var(--text-primary); font-size: 12px; }
.goal-secondary-actions { margin-top: 18px; }
.plan-disclosure { border-top: 1px solid var(--border); }
.plan-disclosure > summary { padding: 12px 0; cursor: pointer; color: var(--text-secondary); font-size: 12px; font-weight: 500; }
.plan-disclosure > summary:hover { color: var(--text-primary); }
.plan-disclosure > summary:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 3px; }
.journal-plan-grid .goal-settings-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 4px 0 16px; padding: 0; border: 0; }
.journal-plan-grid .goal-settings-form label { min-width: 0; }
.journal-plan-grid .goal-settings-form input { width: 100%; }
.journal-plan-grid .goal-settings-form .btn { justify-self: end; }
.journal-plan-grid .goal-plan-help, .journal-plan-grid .goal-save-status { grid-column: 1 / -1; line-height: 1.5; }
.journal-plan-grid .goal-daily-preview output { font-size: 18px; overflow-wrap: anywhere; }
.journal-plan-grid .goal-rewards { margin: 4px 0 14px; }
.journal-plan-grid .why-eyebrow { color: var(--text-secondary); }
.journal-plan-grid .why-headline { font-family: var(--font-sans); font-size: 20px; font-weight: 500; line-height: 1.4; margin-top: 12px; }
.journal-plan-grid .why-reasons { gap: 0; margin: 16px 0; }
.journal-plan-grid .why-reason { padding: 8px 0; font-size: 13px; line-height: 1.6; color: var(--text-secondary); }

.journal-plan-grid .why-reason b { color: var(--text-primary); font-weight: 600; }
.journal-plan-grid .why-reason-num { color: var(--text-secondary); }
.journal-plan-grid .why-goal { font-family: var(--font-mono); font-size: 24px; color: var(--text-primary); }
.journal-plan-grid .why-goal span { font-size: 12px; color: var(--text-secondary); }
.journal-plan-grid .why-compound { margin-top: 16px; padding: 0; background: transparent; border: 0; border-radius: 0; }
.journal-plan-grid .why-compound-label, .journal-plan-grid .why-cstep-num.why-gold { color: var(--text-secondary); }
.journal-plan-grid .why-cstep-num { overflow-wrap: anywhere; }
.journal-plan-grid .why-gate { background: transparent; border: 0; padding: 0; font-size: 12px; color: var(--text-secondary); }
@media (min-width: 1024px) {
  .journal-plan-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .journal-plan-grid > .panel { padding: 18px; }
  .journal-plan-grid .goal-wrap { gap: 14px; }
  .journal-plan-grid .goal-pie { width: 88px; }
  .journal-plan-grid .goal-settings-form { grid-template-columns: minmax(0, 1fr); }
  .journal-plan-grid .goal-settings-form .btn { justify-self: stretch; }
}

/* Discipline stars are independent of P&L. */
.cal-rule-star { color: #e8b339; font-size: 15px; margin-left: 5px; }
.cal-rule-star[hidden] { display: none; }
.journal-body.is-light .cal-rule-star { color: #926800; }
.cal-clickable:focus-visible { outline: 2px solid var(--text-secondary); outline-offset: -2px; }
.day-rules-check { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.day-rules-check p, #dayRulesStatus { color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.day-rules-check p { margin: 8px 0 4px; }
#dayRulesButton[aria-pressed="true"] { color: #e8b339; border-color: currentColor; }
.journal-body.is-light #dayRulesButton[aria-pressed="true"] { color: #926800; }

/* Monthly progress follows a segmented route to the trophy. */
.goal-path { width: 100%; max-width: 280px; margin: 0 auto; }
.goal-path svg { display: block; width: 100%; height: auto; max-height: 100px; }
.goal-path-segment, .goal-path-fill { fill: none; stroke-width: 11; stroke-linecap: butt; stroke-linejoin: round; }
.goal-path-segment { stroke: var(--border-highlight); }
.goal-path-fill { stroke: var(--green); }
.goal-path-trophy { fill: none; stroke: var(--text-secondary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.goal-path-trophy.is-earned { stroke: var(--amber); }
.goal-path-trophy text { fill: var(--text-secondary); stroke: none; font: 9px var(--font-mono); text-anchor: middle; letter-spacing: 1px; }
.goal-path-caption { margin: 0; color: var(--text-secondary); font-size: 11px; line-height: 1.5; text-align: center; }
.journal-plan-grid .panel-goal .goal-secondary-actions { margin-top: 12px; }

/* Keep the route beside the totals instead of growing with the panel. */
.goal-path-block { flex: 1 1 240px; min-width: 0; max-width: 280px; }
.journal-plan-grid .panel-goal .goal-meta { flex: 1 1 180px; }
.journal-plan-grid .panel-goal .panel-head { margin-bottom: 12px; }
@media (max-width: 600px) {
  .journal-plan-grid .panel-goal .goal-wrap { flex-direction: column; gap: 6px; }
  .journal-plan-grid .panel-goal .goal-meta { flex: auto; }
  .goal-path-block { flex: auto; width: 100%; max-width: 240px; }
}

/* The privacy toggle only conceals the headline Net P&L value. */
body.is-private #netPnl {
  visibility: hidden !important;
  pointer-events: none !important;
  user-select: none !important;
}
#privacyToggle[aria-pressed="true"] { border-color: var(--text-secondary); }
body.is-account-loading > section, body.is-account-loading > .journal-plan-grid { visibility: hidden; }
.sync-notice { margin: 12px 0; padding: 12px 16px; border: 1px solid #444856; border-radius: 8px; background: #171b27; color: #e5e7eb; line-height: 1.5; overflow-wrap: anywhere; }
.sync-notice.is-error { border-color: #b85555; background: #291b23; color: #ffd8d8; }
.sync-notice[hidden] { display: none; }

/* Fuel-style account-cost goal; green recovered, red remaining. */
.recovery-panel[hidden] { display: none; }
.recovery-body { padding: 16px 20px; }
.recovery-body progress { display: block; width: 100%; height: 16px; margin: 12px 0; appearance: none; -webkit-appearance: none; border: 0; border-radius: 999px; overflow: hidden; background: #b83b45; color: #22c55e; accent-color: #22c55e; }
.recovery-body progress::-webkit-progress-bar { background: #b83b45; border-radius: 999px; }
.recovery-body progress::-webkit-progress-value { background: #22c55e; border-radius: 999px 0 0 999px; }
.recovery-body progress::-moz-progress-bar { background: #22c55e; border-radius: 999px 0 0 999px; }
.recovery-body progress[hidden] { display: none; }
.recovery-body summary { cursor: pointer; font-size: 13px; color: var(--muted, #9295a5); }
body.is-private #recoverySummary, body.is-private #recoveryProgress { filter: blur(8px); user-select: none; }
