/* CA_THEDRAL — Calendar P&L Dashboard styles. Extracted S30 R-051 Tier 1 Batch 1A from index.html. */

/* ─── R-051 Calendar P&L Dashboard ─────────────────────────── */

.cal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); opacity: 0; pointer-events: none; transition: opacity 0.25s ease; z-index: 190; }
.cal-backdrop.open { opacity: 1; pointer-events: auto; }

#tab-performance { position: relative; overflow-x: hidden; }
.cal-drawer { position: absolute; inset: 0; background: var(--surface-raised); display: none; flex-direction: column; overflow: hidden; z-index: 1; }
#tab-performance.cal-open .cal-drawer { display: flex; }
#tab-performance.cal-open #lp-toggle-bar, #tab-performance.cal-open #performance-body { display: none; }

.cal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border-default); background: var(--surface-base); gap: 10px; flex-wrap: wrap; }
.cal-header-left, .cal-header-right { display: flex; align-items: center; gap: 8px; }
.cal-nav-btn { background: var(--surface-elevated); color: var(--text-primary); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 5px 10px; font-size: 13px; cursor: pointer; font-family: inherit; }
.cal-nav-btn:hover { background: var(--surface-overlay); }
.cal-month-label { font-size: 16px; font-weight: 600; min-width: 140px; text-align: center; font-family: var(--font-numeric); }
.cal-select { background: var(--surface-elevated); color: var(--text-primary); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 5px 10px; font-size: 12px; font-family: inherit; cursor: pointer; }
.cal-currency-toggle { display: inline-flex; border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: hidden; }
.cal-currency-toggle button { background: var(--surface-elevated); color: var(--text-muted); border: none; padding: 5px 10px; cursor: pointer; font-size: 11px; font-weight: 600; letter-spacing: 0.5px; font-family: inherit; }
.cal-currency-toggle button.active { background: var(--surface-overlay); color: var(--text-primary); }
.cal-close-btn { background: transparent; color: var(--text-muted); border: none; font-size: 18px; cursor: pointer; padding: 0 6px; }
.cal-close-btn:hover { color: var(--text-primary); }

.cal-grid-container { padding: 16px 24px 24px; flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.cal-dow-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 8px; }
.cal-dow { text-align: center; font-size: 10px; font-weight: 700; letter-spacing: 0.6px; color: var(--text-muted); text-transform: uppercase; padding: 4px 0; }
.cal-grid-body { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; gap: 6px; flex: 1; min-height: 0; }
.cal-loading, .cal-error, .cal-empty { grid-column: 1 / -1; text-align: center; padding: 30px 12px; color: var(--text-muted); font-size: 13px; }
.cal-error { color: var(--global-red); }

.cal-cell { border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 14px 14px 10px; background: var(--surface-base); display: flex; flex-direction: column; gap: 4px; cursor: pointer; transition: border-color 0.15s, background 0.15s; min-height: 0; overflow: hidden; }
.cal-cell:hover { border-color: var(--text-muted); background: var(--surface-elevated); }
.cal-cell.empty { pointer-events: none; visibility: hidden; }
.cal-cell.no-data { cursor: default; }
.cal-cell.no-data:hover { border-color: var(--border-default); background: var(--surface-base); }
.cal-cell.today { outline: 2px solid var(--global-green); outline-offset: -2px; }
.cal-cell-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.cal-cell-date { font-size: 22px; font-weight: 600; color: var(--text-primary); font-family: var(--font-numeric); line-height: 1; }
.cal-cell-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.cal-cell-counts { font-size: 11px; font-weight: 600; color: var(--text-muted); font-family: var(--font-numeric); letter-spacing: 0.3px; }
.cal-cell-winrate { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: var(--radius-pill); letter-spacing: 0.3px; }
.cal-winrate-good { background: rgba(27,168,79,0.12);  color: var(--global-green); }    /* derived from --global-green #1BA84F */
.cal-winrate-mid  { background: rgba(245,125,39,0.12); color: var(--global-orange); }   /* derived from --global-orange #F57D27 */
.cal-winrate-bad  { background: rgba(204,43,43,0.12);  color: var(--global-red); }      /* derived from --global-red #CC2B2B */
.cal-cell-feature { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; min-height: 0; }
.cal-cell-pnl-sol { font-family: var(--font-numeric); font-size: 22px; font-weight: 600; line-height: 1; }
.cal-cell-pnl-pct { font-family: var(--font-numeric); font-size: 13px; font-weight: 500; line-height: 1; }
.cal-cell.positive .cal-cell-pnl-sol, .cal-cell.positive .cal-cell-pnl-pct { color: var(--global-green); }
.cal-cell.negative .cal-cell-pnl-sol, .cal-cell.negative .cal-cell-pnl-pct { color: var(--global-red); }
.cal-cell.passive .cal-cell-pnl-sol { color: var(--text-muted); }
.cal-cell.no-data .cal-cell-pnl-sol { color: var(--text-muted); }

/* S70 revision — centered + slash-separated; value-above-label order (was
   label-above-value). Matches the coin-card P&L convention "+0.0001 SOL/+6.72%"
   for the slash; flex-start alignment puts the slash on the value row at top. */
.cal-streak-footer { display: flex; justify-content: center; align-items: flex-start; padding: 14px 18px; border-top: 1px solid var(--border-default); background: var(--surface-base); gap: 18px; }
.cal-streak-item { text-align: center; flex: 0 0 auto; display: flex; flex-direction: column-reverse; align-items: center; gap: 4px; }
.cal-streak-label { font-size: 10px; font-weight: 700; letter-spacing: 0.6px; color: var(--text-muted); text-transform: uppercase; }
.cal-streak-value { font-family: var(--font-numeric); font-weight: 700; font-size: 16px; color: var(--global-green); }
.cal-streak-sep   { font-family: var(--font-numeric); font-weight: 400; font-size: 16px; color: var(--text-secondary); }

/* Day-detail drawer (R-051C) */
.cal-day-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); opacity: 0; pointer-events: none; transition: opacity 0.25s ease; z-index: 210; }
.cal-day-backdrop.open { opacity: 1; pointer-events: auto; }
.cal-day-drawer { position: absolute; top: 0; right: 0; bottom: 0; width: 50%; background: var(--surface-raised); border-left: 1px solid var(--border-default); display: flex; flex-direction: column; overflow: hidden; z-index: 2; transform: translateX(100%); transition: transform 0.25s ease; box-shadow: -8px 0 24px rgba(0,0,0,0.4); }
#tab-performance.cal-day-open .cal-day-drawer { transform: translateX(0); }
.cal-day-body { overflow-y: auto; flex: 1; }
.cal-day-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border-default); background: var(--surface-base); }
.cal-day-title { font-weight: 600; font-size: 15px; }
.cal-day-body { padding: 14px 18px; flex: 1; }
.cal-day-summary { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.cal-day-list { display: flex; flex-direction: column; gap: 8px; }
/* Daily-detail trade row — UNIVERSAL 2-line header + centered PnL block + stats stack.
   S72b: operator-ratified for desktop too per "pickup new formatting on desktop" directive.
   JS `_calRenderTradeRow` emits the same markup on both viewports. */
.cal-day-row { display: block; padding: 16px 18px; background: var(--surface-base); border: 1px solid var(--border-default); border-radius: var(--radius-md); }
.cal-day-row-l1 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.cal-day-row-l2 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.cal-day-row-pnl-block { text-align: center; font-size: 16px; font-weight: 600; font-family: var(--font-numeric); padding: 6px 0 10px; }
.cal-day-row-pnl-block.positive { color: var(--global-green); }
.cal-day-row-pnl-block.negative { color: var(--global-red); }
.cal-day-token-name { font-size: 13px; color: var(--text-secondary); }
.cal-day-tp-pill { font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 3px; color: var(--global-orange); border: 1px solid var(--global-orange); letter-spacing: 0.6px; text-transform: uppercase; }
.cal-day-symbol { font-weight: 700; font-size: 16px; color: var(--text-primary); }
/* Mini-card stats stack — universal (was mobile @media-only). */
.cal-day-row-stats { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.cal-day-row-stat-cell { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 16px; background: var(--surface-elevated); padding: 10px 14px; border-radius: var(--radius-sm); width: 100%; box-sizing: border-box; }
.cal-day-row-stat-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 700; text-align: left; }
.cal-day-row-stat-value { font-size: 13px; font-weight: 600; font-family: var(--font-numeric); text-align: right; }
.cal-day-reason { font-size: 9px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.6px; text-transform: uppercase; padding: 2px 6px; background: var(--surface-elevated); border-radius: var(--radius-sm); }
.cal-day-row-pnl { font-family: var(--font-numeric); font-size: 14px; font-weight: 600; color: var(--text-primary); white-space: nowrap; margin-left: auto; }
.cal-day-row-pnl.positive { color: var(--global-green); }
.cal-day-row-pnl.negative { color: var(--global-red); }
.cal-day-icon-wrap { grid-row: 1 / span 2; position: relative; display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; flex-shrink: 0; }
.cal-day-icon-fallback { display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 50%; background: var(--surface-elevated); color: var(--text-secondary); font-size: 11px; font-weight: 700; letter-spacing: 0; }
.cal-day-icon-img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--surface-elevated); }
.cal-day-ca { display: inline-flex; align-items: center; gap: 0; }
.cal-day-row-stat { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 10px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--surface-raised); font-size: 11px; }
.cal-day-row-stat b { color: var(--text-primary); font-weight: 600; font-family: var(--font-numeric); }

@media (max-width: 768px) {
  .cal-day-drawer { width: 100%; }
  .cal-header { padding: 10px 12px; }
  .cal-grid-container { padding: 10px; }
  .cal-cell { padding: 10px 10px 8px; }
  .cal-cell-date { font-size: 16px; }
  .cal-cell-pnl-sol { font-size: 16px; }
  .cal-cell-pnl-pct { font-size: 10px; }
  .cal-cell-meta { gap: 4px; }
  .cal-cell-counts, .cal-cell-winrate { font-size: 10px; }
  .cal-cell-winrate { padding: 1px 4px; }
  .cal-month-label { min-width: 110px; font-size: 14px; }
  .cal-day-stats { padding: 14px 16px 16px; }
  .cal-day-headline-value { font-size: 16px; }
  .cal-day-stat-row { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .cal-day-stat-cell { padding: 10px 12px; }
  .cal-day-stat-value { font-size: 12px; }
  /* S72b — mobile-only toolbar stack: period row / summary descriptor / sort+filter,
     each on its own line and horizontally centered (operator-ratified at S72b). */
  .cal-day-toolbar { padding: 8px 12px; gap: 14px; flex-direction: column; align-items: center; }
  .cal-day-toolbar .cal-day-toolbar-summary { flex: none; padding: 0; }
  .cal-day-toolbar .cal-day-toolbar-right { justify-content: center; }
  .cal-day-period-btn { padding: 5px 10px; font-size: 10px; }
  .cal-day-filter-drawer { padding: 10px 12px; gap: 16px; }
  .cal-day-forecast { padding: 8px 12px; gap: 6px; font-size: 10px; }
  .cal-day-forecast-projection { font-size: 12px; }
}
/* Wallet picker (multi-select) — added in S30 R-051 Tier 1 Batch 1C */
.cal-wallet-picker { position: relative; display: inline-block; }
.cal-wallet-btn { display: inline-flex; align-items: center; gap: 4px; }
.cal-wallet-caret { font-size: 9px; color: var(--text-muted); }
.cal-wallet-panel { position: absolute; top: calc(100% + 4px); left: 0; min-width: 180px; max-width: 260px; background: var(--surface-raised); border: 1px solid var(--border-default); border-radius: var(--radius-md); box-shadow: 0 4px 16px rgba(0,0,0,0.4); z-index: 10; max-height: 280px; overflow-y: auto; padding: 4px 0; }
.cal-wallet-panel[hidden] { display: none; }
.cal-wallet-row { display: flex; align-items: center; gap: 8px; padding: 6px 12px; cursor: pointer; font-size: 12px; color: var(--text-primary); white-space: nowrap; }
.cal-wallet-row:hover { background: var(--surface-elevated); }
.cal-wallet-row input[type="checkbox"] { margin: 0; cursor: pointer; }
.cal-wallet-divider { height: 1px; background: var(--border-default); margin: 4px 0; }


/* Day-detail top-zone (Tier 4) */
.cal-day-stats { padding: 20px 22px 22px; border-bottom: 1px solid var(--border-default); background: var(--surface-base); }
/* S72b — REALIZED block: value-above-label, both centered. Universal per "center data points in containers" directive. */
.cal-day-headline { display: flex; flex-direction: column-reverse; align-items: center; text-align: center; margin-bottom: 18px; gap: 4px; }
.cal-day-headline-label { font-size: 10px; font-weight: 700; letter-spacing: 0.6px; color: var(--text-muted); text-transform: uppercase; }
.cal-day-headline-value { font-family: var(--font-numeric); font-size: 20px; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.cal-day-headline-value.positive { color: var(--global-green); }
.cal-day-headline-value.negative { color: var(--global-red); }
.cal-day-stat-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 12px; }
.cal-day-stat-cell { background: var(--surface-raised); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 14px 16px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; }
.cal-day-stat-label { font-size: 9px; font-weight: 700; letter-spacing: 0.5px; color: var(--text-muted); text-transform: uppercase; }
.cal-day-stat-value { font-family: var(--font-numeric); font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.1; }
.cal-day-stat-sub { font-family: var(--font-numeric); font-size: 10px; font-weight: 500; color: var(--text-muted); line-height: 1; margin-top: 1px; }
.cal-day-stat-sub.cal-winrate-good { color: var(--global-green); }
.cal-day-stat-sub.cal-winrate-mid { color: var(--global-orange); }
.cal-day-stat-sub.cal-winrate-bad { color: var(--global-red); }
/* S72b revisions — callouts stack on their own lines (no `|` separator); labels carry `:` suffix from JS. */
.cal-day-callouts { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; }
.cal-day-callout { display: inline-flex; align-items: baseline; gap: 6px; }
.cal-day-callout-label { font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); font-size: 9px; }
.cal-day-callout-symbol { font-weight: 600; color: var(--text-primary); }
.cal-day-callout-pnl { font-family: var(--font-numeric); font-weight: 600; }
.cal-day-callout-pnl.positive { color: var(--global-green); }
.cal-day-callout-pnl.negative { color: var(--global-red); }

.cal-day-callout-sep { color: var(--text-muted); margin: 0 10px; font-weight: 400; font-size: 11px; }
.cal-day-stat-bar { height: 6px; border-radius: 3px; overflow: hidden; margin-top: 4px; display: flex; background: var(--surface-elevated); }
.cal-day-stat-bar-win { background: var(--global-green); height: 100%; }
.cal-day-stat-bar-loss { background: var(--global-orange); height: 100%; }


/* Day-detail toolbar (Tier 6) */
.cal-day-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px 12px; flex-wrap: wrap; }
.cal-day-period-row { display: inline-flex; border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: hidden; }
.cal-day-period-btn { background: var(--surface-raised); color: var(--text-muted); border: none; padding: 6px 14px; cursor: pointer; font-size: 11px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; font-family: inherit; transition: all 0.15s; border-right: 1px solid var(--border-default); }
.cal-day-period-btn:last-child { border-right: none; }
.cal-day-period-btn:hover { background: var(--surface-elevated); color: var(--text-primary); }
.cal-day-period-btn.active { background: var(--global-green); color: #000; }
.cal-day-toolbar-right { display: inline-flex; gap: 8px; align-items: center; }
.cal-day-toolbar-summary { color: var(--text-muted); font-size: 11px; flex: 1; text-align: center; padding: 0 12px; }
.cal-day-sort-select { background: var(--surface-elevated); color: var(--text-primary); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 6px 10px; font-size: 11px; font-family: inherit; cursor: pointer; }
.cal-day-filter-btn { background: var(--surface-elevated); color: var(--text-primary); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 6px 12px; font-size: 11px; font-family: inherit; cursor: pointer; transition: all 0.15s; }
.cal-day-filter-btn:hover { background: var(--surface-overlay); border-color: var(--text-muted); }
.cal-day-filter-drawer { display: none; padding: 12px 18px 14px; gap: 24px; flex-wrap: wrap; background: var(--surface-base); border-bottom: 1px solid var(--border-default); }
.cal-day-filter-drawer.open { display: flex; }
.cal-day-filter-section { display: flex; flex-direction: column; gap: 6px; min-width: 140px; }
.cal-day-filter-section-title { font-size: 9px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; }
.cal-day-filter-row { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 11px; color: var(--text-primary); padding: 2px 0; }
.cal-day-filter-row input[type="checkbox"] { margin: 0; cursor: pointer; }

.cal-day-filter-footer { display: flex; gap: 8px; align-items: center; flex-basis: 100%; justify-content: flex-end; padding-top: 10px; border-top: 1px solid var(--border-default); margin-top: 4px; }
.cal-day-filter-reset { background: transparent; color: var(--text-muted); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 6px 14px; font-size: 11px; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.cal-day-filter-reset:hover { color: var(--text-primary); border-color: var(--text-muted); }
.cal-day-filter-apply { background: var(--global-green); color: #000; border: none; border-radius: var(--radius-md); padding: 6px 18px; font-size: 11px; font-weight: 700; cursor: pointer; font-family: inherit; transition: opacity 0.15s; }
.cal-day-filter-apply:hover { opacity: 0.85; }


/* Forecast multiplier widget (Tier 7) */
.cal-day-forecast { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 14px 18px; margin: 12px 0; background: var(--surface-base); border: 1px solid var(--border-default); border-radius: var(--radius-md); flex-wrap: wrap; font-size: 11px; }
.cal-day-forecast-label { font-size: 10px; font-weight: 700; letter-spacing: 0.6px; color: var(--text-muted); text-transform: uppercase; }
.cal-day-forecast-base { color: var(--text-muted); }
.cal-day-forecast-base b { color: var(--text-primary); font-weight: 600; font-family: var(--font-numeric); }
.cal-day-forecast-spacer, .cal-day-forecast-equals { color: var(--text-muted); font-weight: 700; }
.cal-day-forecast-controls { display: inline-flex; align-items: center; gap: 6px; }
.cal-day-forecast-n { width: 56px; padding: 4px 8px; background: var(--surface-elevated); color: var(--text-primary); border: 1px solid var(--border-default); border-radius: var(--radius-sm); font-size: 11px; font-family: var(--font-numeric); text-align: center; appearance: textfield; -moz-appearance: textfield; }
.cal-day-forecast-n::-webkit-outer-spin-button, .cal-day-forecast-n::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cal-day-forecast-unit { padding: 4px 8px; background: var(--surface-elevated); color: var(--text-primary); border: 1px solid var(--border-default); border-radius: var(--radius-sm); font-size: 11px; font-family: inherit; cursor: pointer; }
.cal-day-forecast-projection { font-family: var(--font-numeric); font-size: 14px; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.cal-day-forecast-projection.positive { color: var(--global-green); }
.cal-day-forecast-projection.negative { color: var(--global-red); }
.cal-day-forecast-empty { color: var(--text-muted); font-style: italic; }

.cal-day-list-section-title { font-size: 9px; font-weight: 700; letter-spacing: 0.5px; color: var(--text-muted); text-transform: uppercase; padding: 14px 4px 6px; border-top: 1px solid var(--border-default); margin-top: 4px; }
.cal-day-list .cal-day-list-section-title:first-child { padding-top: 6px; border-top: none; margin-top: 0; }

/* End R-051 Calendar P&L Dashboard */
