/* ==========================================================================
   Pilotage BRVM Pro — Fintech Components, Charts, Tables & Controls
   ========================================================================== */

/* ---- Cards & Surfaces ---- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.card.card-compact {
  padding: var(--space-4);
}

.card.is-clickable,
.is-clickable {
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.card.is-clickable:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.card-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ---- Verdict / Hero Banner ---- */
.verdict-hero {
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.verdict-hero.tone-ok {
  background: linear-gradient(135deg, var(--ok-bg) 0%, var(--bg-surface) 80%);
  border-color: var(--ok-border);
  border-left-color: var(--ok);
}

.verdict-hero.tone-warn {
  background: linear-gradient(135deg, var(--warn-bg) 0%, var(--bg-surface) 80%);
  border-color: var(--warn-border);
  border-left-color: var(--warn);
}

.verdict-hero.tone-bad {
  background: linear-gradient(135deg, var(--bad-bg) 0%, var(--bg-surface) 80%);
  border-color: var(--bad-border);
  border-left-color: var(--bad);
}

.verdict-hero.tone-info {
  background: linear-gradient(135deg, var(--info-bg) 0%, var(--bg-surface) 80%);
  border-color: var(--info-border);
  border-left-color: var(--info);
}

.verdict-hero-tag {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.verdict-hero-title {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.verdict-hero-sub {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ---- KPI Card ---- */
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  position: relative;
}

.kpi-card.tone-accent {
  background: linear-gradient(155deg, var(--accent-soft) 0%, var(--bg-surface) 75%);
  border-color: var(--accent-border);
}

.kpi-card.tone-gold {
  background: linear-gradient(155deg, var(--gold-soft) 0%, var(--bg-surface) 75%);
  border-color: var(--gold-border);
}

.kpi-card.tone-ok { border-top: 3px solid var(--ok); }
.kpi-card.tone-warn { border-top: 3px solid var(--warn); }
.kpi-card.tone-bad { border-top: 3px solid var(--bad); }

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-icon {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  display: inline-grid;
  place-items: center;
  flex: none;
}

.kpi-icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
}

.kpi-delta {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
}

.kpi-delta.tone-ok { background: var(--ok-bg); color: var(--ok-text); }
.kpi-delta.tone-warn { background: var(--warn-bg); color: var(--warn-text); }
.kpi-delta.tone-bad { background: var(--bad-bg); color: var(--bad-text); }
.kpi-delta.tone-info { background: var(--info-bg); color: var(--info-text); }

.kpi-value {
  font-size: clamp(1.3rem, 2.2vw, 1.65rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.kpi-card.tone-ok .kpi-value { color: var(--ok-text); }
.kpi-card.tone-warn .kpi-value { color: var(--warn-text); }
.kpi-card.tone-bad .kpi-value { color: var(--bad-text); }

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* ---- Pillar Card ---- */
.pillar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.pillar-card.tone-ok { border-left: 4px solid var(--ok); }
.pillar-card.tone-warn { border-left: 4px solid var(--warn); }
.pillar-card.tone-bad { border-left: 4px solid var(--bad); }
.pillar-card.tone-info { border-left: 4px solid var(--info); }

.pillar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.pillar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.pillar-detail {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.pillar-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.pillar-foot {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

/* ---- Status Pills ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.25;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  white-space: nowrap;
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.pill--ok { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.pill--warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); }
.pill--bad { background: var(--bad-bg); color: var(--bad-text); border-color: var(--bad-border); }
.pill--info { background: var(--info-bg); color: var(--info-text); border-color: var(--info-border); }
.pill--accent { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent-border); }
.pill--gold { background: var(--gold-soft); color: var(--gold-ink); border-color: var(--gold-border); }
.pill--n { background: var(--bg-subtle); color: var(--text-muted); border-color: var(--border); }

:root[data-theme="dark"] .pill--accent { color: var(--accent-hover); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill--accent { color: var(--accent-hover); }
}

/* ---- Six Lights Indicator (R.6) ---- */
.six-lights {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.six-lights.is-compact {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.six-lights-compact-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.six-lights-sep {
  width: 1px;
  height: 12px;
  background: var(--border-strong);
  margin: 0 2px;
}

.light-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-muted);
  border: 1px solid var(--border-strong);
  display: inline-block;
  position: relative;
}

.light-dot.is-on {
  background: var(--ok);
  border-color: var(--ok-text);
  box-shadow: 0 0 0 2px var(--ok-bg);
}

.light-dot.is-off {
  background: var(--bg-muted);
  opacity: 0.72;
}

.six-lights-score {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.six-lights-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

@media (min-width: 640px) {
  .six-lights-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.six-lights-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.six-lights-panel-title {
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.six-lights-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.six-light-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
}

.six-light-item.is-on {
  border-color: var(--ok-border);
}

.six-light-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.six-light-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.six-light-item.is-on .six-light-code {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.six-light-state {
  font-size: 11.5px;
  font-weight: 700;
}

/* ---- Stop Gauge ---- */
.stop-gauge {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}

.stop-gauge-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.stop-gauge-track {
  position: relative;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  overflow: hidden;
}

.stop-gauge-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: var(--radius-full);
  background: var(--ok);
  transition: width var(--dur-base) var(--ease);
}

.stop-gauge-fill.tone-warn { background: var(--warn); }
.stop-gauge-fill.tone-bad { background: var(--bad); }

.stop-gauge-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- Advice Item ---- */
.advice-list {
  display: flex;
  flex-direction: column;
}

.advice-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.advice-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.advice-item:first-child {
  padding-top: 0;
}

.advice-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 6px;
  flex: none;
  background: var(--text-faint);
}

.advice-item.tone-ok .advice-dot { background: var(--ok); }
.advice-item.tone-warn .advice-dot { background: var(--warn); }
.advice-item.tone-bad .advice-dot { background: var(--bad); }
.advice-item.tone-info .advice-dot { background: var(--info); }

.advice-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.advice-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.advice-domain {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.advice-impact {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text-muted);
}

.advice-text {
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.45;
}

.advice-action {
  flex: none;
  align-self: center;
}

/* ---- Formation Tip (Collapsible / Dismissible Callout) ---- */
.formation-tip {
  border-radius: var(--radius-lg);
  border: 1px solid var(--accent-border);
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--bg-surface) 90%);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.formation-tip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.formation-tip-trigger {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-deep);
}

:root[data-theme="dark"] .formation-tip-trigger {
  color: var(--accent-hover);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .formation-tip-trigger {
    color: var(--accent-hover);
  }
}

.formation-tip-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #FFFFFF;
  display: inline-grid;
  place-items: center;
  flex: none;
}

.formation-tip-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.formation-tip-btn {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  display: inline-grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
}

.formation-tip-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.formation-tip-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  padding-left: 32px;
}

/* ---- Segmented Tabs ---- */
.seg-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  max-width: 100%;
}

.seg-tabs.is-full {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  width: 100%;
}

.seg-tab {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.seg-tab:hover:not(:disabled) {
  color: var(--text-primary);
}

.seg-tab[aria-selected="true"],
.seg-tab[aria-pressed="true"],
.seg-tab.is-active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

.seg-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.seg-tab-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--text-secondary);
}

/* ---- Buttons & Chips ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--text-faint);
}

.btn:active:not(:disabled) {
  transform: translateY(0.5px);
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn.btn-primary,
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn.btn-primary:hover:not(:disabled),
.btn.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn.btn-gold {
  background: var(--gold);
  border-color: var(--gold);
  color: #FFFFFF;
}

.btn.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-secondary);
}

.btn.btn-ghost:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: transparent;
  color: var(--text-primary);
}

.btn.btn-danger,
.btn.danger {
  background: var(--bad-bg);
  border-color: var(--bad-border);
  color: var(--bad-text);
}

.btn.btn-sm,
.btn.small {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: 7px;
}

.btn.btn-lg {
  height: 44px;
  padding: 0 18px;
  font-size: 14.5px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-md);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips button,
.chip {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.chips button:hover,
.chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.chips button[aria-pressed="true"],
.chip.is-active {
  background: var(--text-primary);
  color: var(--bg-surface);
  border-color: var(--text-primary);
}

/* ---- Forms & Editable Inputs ---- */
form.form-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

label.field,
label.f {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

label.field input,
label.field select,
label.field textarea,
label.f input,
label.f select,
label.f textarea,
.input {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-primary);
  width: 100%;
  min-width: 0;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

label.field.is-editable input,
label.field.is-editable select,
.input.is-editable {
  background: var(--input-editable);
}

label.field input:focus,
label.field select:focus,
label.field textarea:focus,
label.f input:focus,
label.f select:focus,
label.f textarea:focus,
.input:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: var(--focus-ring);
}

/* ---- Sortable Tables ---- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

table.data-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

table.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  user-select: none;
}

table.data-table thead th.align-right,
table.data-table tbody td.align-right {
  text-align: right;
}

table.data-table thead th.align-center,
table.data-table tbody td.align-center {
  text-align: center;
}

table.data-table thead th.is-sortable {
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

table.data-table thead th.is-sortable:hover {
  color: var(--text-primary);
  background: var(--bg-muted);
}

.th-inner {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sort-ind {
  display: inline-flex;
  opacity: 0.35;
  font-size: 10px;
}

th[aria-sort="ascending"] .sort-ind,
th[aria-sort="descending"] .sort-ind {
  opacity: 1;
  color: var(--accent);
}

table.data-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

table.data-table tbody tr:last-child td {
  border-bottom: 0;
}

table.data-table tbody tr.is-clickable:hover {
  background: var(--bg-hover);
}

/* ---- Rows, Lists & Flow Breakdowns ---- */
.list-row,
.flow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.list-row:last-child,
.flow-row:last-child {
  border-bottom: 0;
}

.list-row.is-clickable {
  padding-inline: 8px;
  margin-inline: -8px;
  border-radius: var(--radius-md);
}

.list-row.is-clickable:hover {
  background: var(--bg-hover);
}

.flow-row.is-total {
  border-top: 2px solid var(--border-strong);
  border-bottom: 0;
  padding-top: 12px;
  font-weight: 750;
}

/* ---- Progress Bar ---- */
.progress-track {
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent);
  transition: width var(--dur-base) var(--ease);
}

.progress-fill.tone-ok { background: var(--ok); }
.progress-fill.tone-warn { background: var(--warn); }
.progress-fill.tone-bad { background: var(--bad); }

/* ---- Empty State ---- */
.empty-state {
  padding: var(--space-8) var(--space-5);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  color: var(--text-muted);
  display: grid;
  place-items: center;
}

.empty-state-title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-primary);
}

.empty-state-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 420px;
  line-height: 1.5;
}

/* ---- Gate Checklist (ACHAT 9 Checks) ---- */
.gate-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gate-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
}

.gate-item.tone-ok { border-color: var(--ok-border); background: var(--ok-bg); }
.gate-item.tone-warn { border-color: var(--warn-border); background: var(--warn-bg); }
.gate-item.tone-bad { border-color: var(--bad-border); background: var(--bad-bg); }

/* ==========================================================================
   Charts & Interactive SVG Tooltips
   ========================================================================== */

.chart-box {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
  min-width: 0;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.chart-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
  touch-action: pan-y;
}

.chart-svg text {
  font-family: var(--font-sans);
  fill: var(--chart-axis);
}

.chart-crosshair {
  stroke: var(--text-muted);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.chart-focus-dot {
  pointer-events: none;
  transition: cx 60ms linear, cy 60ms linear;
}

.chart-donut-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-5);
}

.chart-donut-svg-wrap {
  position: relative;
  width: 180px;
  max-width: 100%;
  flex: none;
  margin-inline: auto;
}

.chart-donut-seg {
  cursor: pointer;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  transform-origin: center;
}

.chart-donut-seg.is-dimmed {
  opacity: 0.35;
}

.chart-donut-seg.is-active {
  opacity: 1;
  filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.22));
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.chart-donut-legend {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

.chart-legend-item:hover,
.chart-legend-item.is-active {
  background: var(--bg-subtle);
}

.chart-legend-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.chart-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}

.chart-swatch.is-dashed {
  width: 14px;
  height: 0;
  border-top: 2px dashed currentColor;
  border-radius: 0;
}

/* Horizontal Bars (Budget categories / Sector exposure vs R.16) */
.hbar-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hbar-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 8px;
  margin-inline: -8px;
  border-radius: var(--radius-md);
  transition: background var(--dur-fast) var(--ease);
}

.hbar-row:hover,
.hbar-row.is-active {
  background: var(--bg-hover);
}

.hbar-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.hbar-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
}

.hbar-val {
  font-weight: 700;
  white-space: nowrap;
  color: var(--text-primary);
}

.hbar-track {
  position: relative;
  height: 9px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
}

.hbar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--chart-1);
  transition: width var(--dur-base) var(--ease);
}

.hbar-fill.tone-ok { background: var(--ok); }
.hbar-fill.tone-warn { background: var(--warn); }
.hbar-fill.tone-bad { background: var(--bad); }
.hbar-fill.tone-gold { background: var(--gold); }

.hbar-mark {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transform: translateX(-50%);
}

.hbar-mark::after {
  content: "";
  position: absolute;
  top: -2px;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-primary);
  transform: translateX(-50%);
}

.hbar-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Progress Ring */
.chart-ring-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.chart-ring-progress {
  transition: stroke-dashoffset 480ms var(--ease);
}

/* Floating Chart Tooltip */
.chart-tooltip {
  position: absolute;
  z-index: 25;
  pointer-events: none;
  background: var(--chart-tooltip-bg);
  color: var(--chart-tooltip-fg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 8px 11px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  min-width: 140px;
  max-width: 240px;
  transform: translate(-50%, calc(-100% - 10px));
  white-space: normal;
}

.chart-tooltip-title {
  font-weight: 700;
  margin-bottom: 4px;
  color: #FFFFFF;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 3px;
}

.chart-tooltip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}

.chart-tooltip-key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #CBD5E1;
}

.chart-tooltip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

.chart-tooltip-val {
  font-weight: 700;
  color: #FFFFFF;
}
