/* Review Stats Overview */

#review-stats-overview {
  padding: 0;
}

#rv-stats-grid { margin-bottom: 0.75rem; }

/* Hero KPI row ────────────────────────────────────────────────── */
.rv-hero-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.625rem;
  margin-bottom: 1.5rem;
}
.rv-hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--rm);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow: hidden;
}
.rv-hero-card .rv-stat-label { font-size: 0.75rem; }
.rv-hero-card .rv-stat-value { font-size: 1.75rem; line-height: 1.1; }
.rv-hero-sub { font-size: 0.75rem; color: var(--text-faint); }

/* Subtitle row that holds left + right aligned text */
.rv-hero-sub-row { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; font-size: 0.75rem; color: var(--text-faint); }
.rv-hero-sub-aux { font-size: 0.6875rem; color: var(--text-faint); }

/* Win Rate stacked proportion bar */
.rv-wr-prop-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--bg-elevated); margin-top: 0.35rem; }
.rv-wr-prop-bar .seg-w { background: var(--green); height: 100%; }
.rv-wr-prop-bar .seg-l { background: var(--red); height: 100%; }

/* Win Rate 50-bar trade sequence */
.rv-wr-50-bars { display: flex; gap: 1px; margin-top: 0.3rem; height: 14px; }
.rv-wr-50-bars .bar { flex: 1; background: var(--bg-elevated); border-radius: 1px; }
.rv-wr-50-bars .bar.w { background: var(--green); }
.rv-wr-50-bars .bar.l { background: var(--red); }

/* Profit Factor two-bar visual */
.rv-pf-bars { display: flex; flex-direction: column; gap: 4px; margin-top: 0.4rem; }
.rv-pf-row { display: flex; align-items: center; gap: 0.4rem; height: 10px; }
.rv-pf-track { flex: 1; height: 5px; background: var(--bg-elevated); border-radius: 999px; overflow: hidden; }
.rv-pf-fill-w { background: var(--green); height: 100%; }
.rv-pf-fill-l { background: var(--red); height: 100%; }
.rv-pf-amt { font-size: 0.625rem; color: var(--text-muted); min-width: 3.2rem; text-align: right; font-variant-numeric: tabular-nums; }
.rv-pf-amt.pos { color: var(--green); }
.rv-pf-amt.neg { color: var(--red); }

/* Sectioned secondary stats ──────────────────────────────────── */
.rv-section { margin-bottom: 0.75rem; }

.rv-stat-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.375rem; }
.rv-stat-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.375rem; }
.rv-stat-grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.375rem; }

.rv-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--rm);
  padding: 0.6rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

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

.rv-stat-value {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.rv-stat-value.pnl-pos { color: var(--green); }
.rv-stat-value.pnl-neg { color: var(--red); }

/* Paired win/loss cards ──────────────────────────────────────── */
.rv-pair-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.375rem;
  margin-bottom: 0.375rem;
}
.rv-pair-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--rm);
  padding: 0.75rem;
  display: flex;
  gap: 1.25rem;
}
.rv-pair-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.rv-pair-col + .rv-pair-col {
  border-left: 1px solid var(--border-sub);
  padding-left: 1.25rem;
}
.rv-pair-card .rv-stat-value { font-size: 1rem; }

.rv-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.rv-table-card {
  border: 1px solid var(--border);
  border-radius: var(--rm);
  overflow: hidden;
}

.rv-table-header {
  display: flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.rv-table-header .widget-label {
  flex: 1;
}

.rv-table-body {
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100vh - 3rem);
}

#rv-recent-trades-table tbody tr { background: var(--bg-surface); }

/* Sparkline inside hero card */
.rv-hero-spark { flex: 1; min-height: 32px; margin: 0.25rem calc(-1.25rem + 2px) calc(-1rem + 2px); }
.rv-hero-spark svg { display: block; width: 100%; height: 100%; }

/* New 2-col grid for streaks */
.rv-stat-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.375rem; }

/* Equity curve (full width) + Drawdown 1x4 row stacked below */
.rv-variance-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.rv-variance-row .rv-dd-grid { margin-bottom: 0; }

.rv-eq-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--rm);
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.rv-eq-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.375rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.rv-eq-current {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.rv-eq-body {
  position: relative;
  padding: 0.5rem 0.75rem 0.75rem;
  height: 250px;
}

.rv-eq-body canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.rv-eq-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 0.875rem;
}

/* Drawdown section */
.rv-dd-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-bottom: 0.5rem; }

.rv-dd-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--rm);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.rv-dd-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rv-dd-values { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; }
.rv-dd-pct { font-size: 1.5rem; font-weight: 700; line-height: 1; color: var(--red); }
.rv-dd-amt { font-size: 1rem; font-weight: 600; line-height: 1; color: var(--red); }
.rv-dd-pct.pos { color: var(--green); }
.rv-dd-amt.pos { color: var(--green); }
.rv-dd-empty { color: var(--text-faint); font-size: 0.875rem; font-style: italic; }
.rv-dd-meta { font-size: 0.75rem; color: var(--text-faint); }
.rv-dd-meta .sep { margin: 0 0.4rem; opacity: 0.6; }

/* Icon-row subtext for drawdown cards */
.rv-dd-irows { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.3rem; }
.rv-dd-irow  { display: flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; }
.rv-dd-ic    { width: 12px; height: 12px; color: var(--text-faint); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rv-dd-ic svg { width: 100%; height: 100%; }
.rv-dd-ivalue { color: var(--text-secondary); font-weight: 500; font-variant-numeric: tabular-nums; }
.rv-dd-ilabel { color: var(--text-faint); }

/* Legacy support row (removed after redesign) */
.rv-dd-support-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.375rem;
  margin-top: 0.5rem;
}
.rv-dd-sub {
  font-size: 0.6875rem;
  color: var(--text-faint);
  margin-top: 0.1rem;
}

@media (max-width: 768px) {
  .rv-hero-grid { grid-template-columns: repeat(2, 1fr); }
  .rv-stat-grid-2 { grid-template-columns: repeat(2, 1fr); }
  .rv-stat-grid-3,
  .rv-stat-grid-4,
  .rv-stat-grid-5 { grid-template-columns: repeat(2, 1fr); }
  .rv-pair-row { grid-template-columns: 1fr; }
  .rv-dd-grid { grid-template-columns: repeat(2, 1fr); }
  .rv-dd-support-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
}

/* Review Header (title + filters on same line) */
.rv-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

/* Review Filter Bar */
.rv-filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.rv-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

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

.rv-filter-inp {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--rm);
  color: var(--input-text);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.45rem 0.75rem;
  min-height: 2rem;
  outline: none;
  width: 6rem;
}
/* No green border on focus — STYLE-GUIDE §7 / §15 #4. The text caret signals
   focus; a green border reads as "validation pass" and creates false signal. */
.rv-filter-inp:focus { outline: none; }
.rv-filter-inp::placeholder { color: var(--input-placeholder); }

.rv-filter-select {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--rm);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.45rem 0.6rem;
  padding-right: 1.75rem;
  min-height: 2rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23c8cbd1' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.4rem center;
  background-size: 10px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rv-filter-select:hover { border-color: rgba(255,255,255,0.12); color: var(--text-primary); }
.rv-filter-select:focus-visible { outline: 1px solid var(--input-border-focus); outline-offset: -1px; }
.rv-filter-select option { background: var(--bg-elevated); color: var(--text-primary); }

.rv-filter-tf-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  text-align: left;
  padding-right: 0.75rem;
  background-image: none;
}

/* Review Timeframe Modal */
#rv-tf-modal {
  position: fixed;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  display: flex;
  width: 820px;
  max-width: 95vw;
  overflow: hidden;
  z-index: 61;
  box-shadow: var(--shadow-lg);
}

.rv-tf-calendars { display: flex; gap: 0; padding: 1rem 1rem 0.5rem; flex: 1; }

/* Reuse the .tf-presets layout for .rv-tf-presets */
.rv-tf-presets {
  width: 11rem;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 0.5rem 0;
  overflow-y: auto;
  list-style: none;
  margin: 0;
}
.rv-tf-presets li {
  padding: 0.6rem 1rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.1s, color 0.1s;
}
.rv-tf-presets li:hover { background: var(--bg-elevated); }
.rv-tf-presets li.active { color: var(--green); }
.rv-tf-presets li .tf-check { opacity: 0; font-size: 0.75rem; }
.rv-tf-presets li.active .tf-check { opacity: 1; }

/* Review Trade Detail Card Grid */
.rv-detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin-bottom: 1rem; }

.rv-detail-cell {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border-radius: 0;
}

/* Corner radius for 3x3 grid */
.rv-detail-cell:nth-child(1) { border-radius: var(--rm) 0 0 0; }
.rv-detail-cell:nth-child(3) { border-radius: 0 var(--rm) 0 0; }
.rv-detail-cell:nth-child(7) { border-radius: 0 0 0 var(--rm); }
.rv-detail-cell:nth-child(9) { border-radius: 0 0 var(--rm) 0; }

/* Time of Day filter */
.rv-filter-hour-wrap { position: relative; }

.rv-filter-hour-btn {
  min-width: 7rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23c8cbd1' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.4rem center;
  background-size: 10px 6px;
  padding-right: 1.75rem;
  text-align: left;
}

.rv-filter-active { color: var(--text-primary) !important; }


.rv-hour-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 11rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--rm);   /* Match Review filter row — see .rv-drop-panel */
  box-shadow: var(--shadow-lg);
  z-index: 60;
  overflow: hidden;
}

.rv-hour-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  gap: 1rem;
  transition: background 0.1s, color 0.1s;
}
.rv-hour-row:hover { background: var(--bg-surface); color: var(--text-primary); }
.rv-hour-row.active { color: var(--text-primary); background: var(--bg-surface); }
.rv-hour-row.rv-hour-all { border-bottom: 1px solid var(--border); }
.rv-hour-label { flex: 1; }
.rv-hour-pnl { font-size: 0.75rem; font-weight: 600; }
.rv-hour-pnl.pnl-pos { color: var(--green); }
.rv-hour-pnl.pnl-neg { color: var(--red); }

/* Readonly inputs look like stat values */
.rv-detail-cell .review-inp[readonly],
.rv-detail-cell .review-inp:disabled {
  background: transparent !important;
  border: none !important;
  padding: 0;
  min-height: auto;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  opacity: 1;
  pointer-events: none;
  width: 100%;
}

/* P&L coloring */
.rv-detail-cell .review-inp.pnl-pos { color: var(--green) !important; }
.rv-detail-cell .review-inp.pnl-neg { color: var(--red) !important; }

/* Edit mode: subtle input appearance inside card cell */
.rv-detail-cell .review-inp:not([readonly]):not(:disabled) {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--rm);
  padding: 0.35rem 0.5rem;
  min-height: auto;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  pointer-events: auto;
  width: 100%;
}
.rv-detail-cell .review-inp:not([readonly]):not(:disabled):focus {
  border-color: var(--green);
}

/* Shared custom filter dropdown panel */
.rv-filter-drop-wrap { position: relative; }

.rv-filter-drop-btn {
  min-width: 6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23c8cbd1' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.4rem center;
  background-size: 10px 6px;
  padding-right: 1.75rem;
  text-align: left;
}

.rv-drop-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 10rem;
  max-height: 18rem;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  /* Tighter radius than the standard menu spec — owner-set preference for
     the Review filter row. STYLE-GUIDE §7 prefers --r for menu containers;
     this row of filter panels intentionally overrides that to read sharper. */
  border-radius: var(--rm);
  box-shadow: var(--shadow-lg);
  z-index: 60;
}

.rv-drop-row {
  display: flex;
  align-items: center;
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.rv-drop-row:hover { background: var(--bg-surface); color: var(--text-primary); }
.rv-drop-row.active { color: var(--text-primary); background: var(--bg-surface); }
.rv-drop-row:first-child { border-bottom: 1px solid var(--border); }

/* Review Tags B2 multi-select panel */

#rv-filter-tags-panel {
  width: 44rem;
  max-width: calc(100vw - 60px);
  max-height: none;
  overflow-y: visible;
  display: flex;
  flex-direction: column;
}
#rv-filter-tags-panel[hidden] { display: none; }

.rv-tags-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.rv-tags-panel-header strong { color: var(--text-primary); font-weight: 600; }

.rv-tags-header-count { color: var(--text-secondary); font-size: 0.8125rem; }

.rv-tags-btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.1s;
}
.rv-tags-btn-link:hover { color: var(--text-primary); }

.rv-tags-selected-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  /* Reserve enough room for a tag-pill (padding 0.2rem each + line-height
     1.4 * font-size 0.75rem ≈ 1.45rem) so the zone doesn't grow when the
     first pill is added, which would shift the rows below. */
  min-height: 2.65rem;
  align-items: center;
  flex-shrink: 0;
}
.rv-tags-selected-zone .tag-pill { cursor: pointer; }
.rv-tags-clear-inline { margin-left: auto; }
.rv-tags-selected-zone .tag-pill-x {
  margin-left: 0.35em;
  opacity: 0.65;
  cursor: pointer;
  font-weight: 700;
  transition: opacity 0.12s;
}
.rv-tags-selected-zone .tag-pill-x:hover { opacity: 1; }

.rv-tags-chip-empty {
  font-size: 0.75rem;
  color: var(--text-faint);
  font-style: italic;
}

.rv-tags-stat-headers {
  display: grid;
  /* Tighter column widths + smaller gap match the Side / Grade / Hour panels.
     Numeric columns hold every value _computeFilterStats produces with margin
     ($10,000-class P&L, 100% WR, 999.9 PF, $10,000-class EXP). */
  grid-template-columns: 1fr 3rem 4.5rem 3rem 3rem 4.5rem;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.rv-tags-stat-headers > span:not(:first-child) { text-align: right; }
.rv-tags-stat-headers > span {
  cursor: pointer;
  user-select: none;
  transition: color 0.1s;
}
.rv-tags-stat-headers > span:hover { color: var(--text-secondary); }
.rv-tags-stat-headers > span.sorted { color: var(--text-primary); }
.rv-tags-sort-arrow {
  font-size: 0.55rem;
  margin-left: 0.2em;
  opacity: 0.85;
}

.rv-tags-cat-strip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem 0.5rem;
}
.rv-cat-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
}

.rv-tags-stat-row {
  display: grid;
  /* Must match .rv-tags-stat-headers exactly so columns line up. */
  grid-template-columns: 1fr 3rem 4.5rem 3rem 3rem 4.5rem;
  gap: 0.4rem;
  align-items: center;
  padding: 0.3rem 1rem;
  border-bottom: 1px solid var(--border-sub);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: background 0.1s;
}
.rv-tags-stat-row:hover { background: var(--bg-surface); color: var(--text-primary); }
.rv-tags-stat-row.selected { background: var(--bg-surface); }
.rv-tags-stat-row.selected .rv-tags-row-name { font-weight: 600; }
.rv-tags-stat-row > span:not(.rv-tags-row-name) { text-align: right; }

.rv-tags-row-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  overflow: hidden;
}
.rv-tags-row-name .tag-pill {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.rv-tags-row-check {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--text-faint);
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rv-tags-stat-row.selected .rv-tags-row-check {
  background: var(--green);
  border-color: var(--green);
}
.rv-tags-stat-row.selected .rv-tags-row-check::after {
  content: '';
  width: 4px;
  height: 7px;
  border: solid var(--bg-base);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.rv-tags-scroll {
  overflow-y: auto;
  max-height: calc(100vh - 10rem);
  flex: 0 0 auto;
}

.rv-tags-scroll-empty {
  padding: 1rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-faint);
  font-style: italic;
  text-align: center;
  line-height: 1.5;
}

/* Per-control widths in the filter bar: each button sized to its longest realistic content */
#rv-dataset-btn      { min-width: 7rem; max-width: 8.5rem; }
#rv-filter-tags-btn  { min-width: 7rem; max-width: 9rem; }
#rv-filter-side-btn  { width: 5rem; min-width: 5rem; }
#rv-filter-grade-btn { min-width: 7rem; max-width: 9rem; }
#rv-filter-hour-btn  { width: 7rem; min-width: 7rem; }
#rv-tf-btn          { min-width: 8rem; max-width: 10rem; }

/* ── Review equity curve: gear button + settings dropdown ──────────────── */
.rv-eq-head-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  position: relative;
}

.rv-eq-gear-btn {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.rv-eq-gear-btn:hover {
  color: var(--text);
  background: var(--bg-elevated);
}

.rv-eq-settings-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 320px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--rm);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  padding: 0.75rem;
  z-index: 20;
}

/* ── Lucide icon size helpers ───────────────────────────────────────────────── */
.rv-icon-sm svg { width: 14px; height: 14px; }
.rv-icon-md svg { width: 16px; height: 16px; }

/* ── Review filter presets ──────────────────────────────────────────────────── */
.rv-preset-drop-btn { width: 6rem; min-width: 6rem; max-width: 6rem; display: inline-flex; align-items: center; gap: 0.4rem; }
.rv-preset-drop-btn .rv-preset-label-text { flex: 1 1 auto; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-preset-drop-btn.rv-preset-active { color: var(--text-primary); }

.rv-preset-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 18rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--rm);   /* Match Review filter row — see .rv-drop-panel */
  box-shadow: var(--shadow-lg);
  z-index: 60;
  overflow: hidden;
}
.rv-preset-panel-header {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0.5rem 0.75rem 0.35rem;
}

.rv-preset-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  position: relative;
}
.rv-preset-row:hover { background: var(--bg-surface); color: var(--text-primary); }
.rv-preset-row.rv-preset-row-active {
  color: var(--text-primary);
  box-shadow: inset 2px 0 0 var(--green);
}
.rv-preset-row .rv-preset-row-name { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-preset-row .rv-preset-row-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.1s;
}
.rv-preset-row:hover .rv-preset-row-actions { opacity: 1; }

.rv-preset-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border: none;
  border-radius: var(--rm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  padding: 0;
}
.rv-preset-icon-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }
.rv-preset-icon-btn.rv-preset-icon-danger:hover { background: var(--red-bg); color: var(--red); }
.rv-preset-icon-btn.rv-preset-icon-confirm:hover { color: var(--green); }

.rv-preset-row--editing { background: var(--bg-surface); }
.rv-preset-rename-inp {
  flex: 1 1 auto;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--rm);
  color: var(--input-text);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.3rem 0.5rem;
  outline: none;
  min-width: 0;
}
.rv-preset-rename-inp::placeholder { color: var(--input-placeholder); }
.rv-preset-rename-inp:focus { border-color: var(--input-border-focus); }

.rv-preset-panel-divider { border-top: 1px solid var(--border); margin: 0.25rem 0; }
.rv-preset-footer-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.1s, color 0.1s;
}
.rv-preset-footer-row:hover { background: var(--bg-surface); color: var(--text-primary); }
.rv-preset-footer-row:disabled { cursor: default; opacity: 0.45; font-style: italic; }
.rv-preset-footer-row:disabled:hover { background: transparent; color: var(--text-muted); }

.rv-preset-save-expanded {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-surface);
}
.rv-preset-save-expanded .btn { min-height: 1.85rem; padding: 0.3rem 0.65rem; font-size: 0.75rem; }

.rv-preset-empty {
  padding: 1.25rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.rv-eq-settings-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.rv-eq-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0;
  font-size: 0.8125rem;
}

.rv-eq-settings-label { color: var(--text-secondary); }

.rv-eq-settings-hint {
  color: var(--text-faint);
  font-size: 0.6875rem;
  margin-top: 0.1rem;
}

.rv-eq-settings-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.4rem 0;
}

.rv-eq-num-input {
  width: 72px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.rv-eq-num-input:focus {
  outline: 1px solid var(--blue);
  border-color: var(--blue);
}

.rv-eq-toggle {
  appearance: none;
  -webkit-appearance: none;
  width: 28px;
  height: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.rv-eq-toggle:checked {
  background: var(--blue);
  border-color: var(--blue);
}
.rv-eq-toggle::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 12px;
  height: 12px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 0.15s;
}
.rv-eq-toggle:checked::after {
  transform: translateX(12px);
  background: white;
}

/* ── Typical Drawdown card: gear button + settings dropdown ─────────────── */
.rv-dd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.rv-dd-head-right {
  display: flex;
  align-items: center;
  position: relative;
}

.rv-dd-gear-btn {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0.15rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.rv-dd-gear-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.rv-dd-settings-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 300px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--rm);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  padding: 0.75rem;
  z-index: 20;
}

.rv-dd-settings-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.rv-dd-settings-methods {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.rv-dd-radio-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.35rem;
  border-radius: var(--rm);
  cursor: pointer;
  transition: background 0.1s;
}
.rv-dd-radio-row:hover {
  background: var(--bg-surface);
}
.rv-dd-radio-row:has(input:checked) {
  background: rgba(96, 165, 250, 0.08);
}
.rv-dd-radio-row input[type="radio"] {
  margin-top: 0.15rem;
  flex-shrink: 0;
  accent-color: var(--blue);
}

.rv-dd-radio-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.rv-dd-radio-hint {
  font-size: 0.6875rem;
  color: var(--text-faint);
  margin-top: 0.1rem;
}

.rv-dd-settings-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.4rem 0;
}

.rv-dd-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0;
  font-size: 0.8125rem;
}

.rv-dd-settings-label {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.rv-dd-settings-hint {
  color: var(--text-faint);
  font-size: 0.6875rem;
  margin-top: 0.1rem;
}

.rv-dd-num-input {
  width: 60px;
  text-align: right;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.25rem 0.5rem;
  border-radius: var(--rm);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.rv-dd-num-input:focus {
  outline: 1px solid var(--blue);
  border-color: var(--blue);
}
.rv-dd-num-input:disabled {
  opacity: 0.4;
  cursor: default;
}

.rv-dd-method-chip {
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border-sub);
  padding: 0.15rem 0.5rem;
  border-radius: var(--rm);
  display: inline-block;
  align-self: flex-start;
}

/* V1 Filter Stats Rows (Hour / Side / Grade) */

.rv-stat-headers {
  display: grid;
  grid-template-columns: 4.5rem 1fr 2.4rem 2.4rem 3rem;
  gap: 0.4rem;
  padding: 0.5rem 1rem 0.35rem;
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.rv-stat-headers > span:not(:first-child) { text-align: right; }

.rv-stat-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr 2.4rem 2.4rem 3rem;
  gap: 0.4rem;
  align-items: center;
  padding: 0.55rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  font-variant-numeric: tabular-nums;
}
.rv-stat-row:hover { background: var(--bg-surface); color: var(--text-primary); }
.rv-stat-row.active { color: var(--text-primary); background: var(--bg-surface); }
.rv-stat-row.rv-stat-row-all { border-bottom: 1px solid var(--border); }

.rv-stat-name { /* first column */ }

.rv-stat-pnl {
  text-align: right;
  font-weight: 600;
}

.rv-stat-wr,
.rv-stat-pf,
.rv-stat-exp {
  text-align: right;
  font-size: 0.75rem;
}

/* PF quality tints */
.rv-stat-pf-good { color: var(--green); }
.rv-stat-pf-bad  { color: var(--red); }
.rv-stat-pf-flat { color: var(--text-muted); }
