/* ── dashboard.css — FI Dashboard styles ── */

/* Layout */
.db-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  min-height: calc(100vh - 73px);
}

/* Sidebar */
.db-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 48px 36px;
  overflow-y: auto;
}

.sidebar-eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
  margin-bottom: 12px;
}

.sidebar-title {
  font-family: var(--ff-display);
  font-size: 42px;
  font-weight: 300;
  line-height: 1.05;
  color: var(--text);
  margin-bottom: 40px;
}

/* Form */
.fi-form { display: flex; flex-direction: column; gap: 0; }

.form-section {
  margin-bottom: 32px;
}

.form-section-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.form-row { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 400;
  margin-bottom: 6px;
  line-height: 1.4;
}

.label-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 300;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 10px 40px 10px 14px;
  color: var(--text);
  font-family: var(--ff-body);
  font-size: 15px;
  font-weight: 400;
  outline: none;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
}

.form-input::-webkit-inner-spin-button,
.form-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.form-input:focus {
  border-color: var(--gold-dim);
}

.input-unit {
  position: absolute;
  right: 12px;
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
  font-weight: 400;
}

.form-hint {
  font-size: 12px;
  color: var(--gold-dim);
  margin-top: 5px;
  min-height: 16px;
  font-weight: 400;
}

/* Risk pills */
.risk-pills {
  display: flex;
  gap: 8px;
}

.risk-pill {
  flex: 1;
  cursor: pointer;
  text-align: center;
  padding: 12px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.risk-pill input[type="radio"] { display: none; }

.risk-pill:has(input:checked) {
  border-color: var(--gold-dim);
  background: var(--surface2);
}

.pill-label {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.pill-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 300;
}

/* CTA */
.cta-btn {
  margin-top: 8px;
  width: 100%;
  padding: 16px 24px;
  background: var(--gold);
  color: #0b0b0b;
  border: none;
  border-radius: 3px;
  font-family: var(--ff-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cta-btn:hover { opacity: 0.88; }
.cta-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-spinner {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Main content */
.db-main {
  padding: 48px 52px;
  overflow-y: auto;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.empty-icon {
  font-size: 48px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1;
}

.empty-title {
  font-family: var(--ff-display);
  font-size: 28px;
  font-weight: 400;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.empty-body {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 380px;
  line-height: 1.7;
  font-weight: 300;
}

/* KPI row */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 36px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px 22px;
}

.kpi-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 8px;
}

.kpi-value {
  font-family: var(--ff-display);
  font-size: 32px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  margin-bottom: 3px;
}

.kpi-value.accent { color: var(--gold); }

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 300;
}

/* Chart */
.chart-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 28px 32px;
  margin-bottom: 28px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.chart-title {
  font-family: var(--ff-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 300;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.chart-wrap { position: relative; }

/* AI Recommendations */
.recs-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 28px 32px;
}

.recs-header { margin-bottom: 24px; }

.recs-title {
  font-family: var(--ff-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.recs-sub {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 300;
}

.recs-loading {
  padding: 32px 0;
  text-align: center;
}

.loading-pulse {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 300;
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* Allocation */
.alloc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.alloc-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 18px 20px;
}

.alloc-vehicle {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
  margin-bottom: 8px;
}

.alloc-pct {
  font-family: var(--ff-display);
  font-size: 38px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  margin-bottom: 10px;
}

.alloc-products {
  list-style: none;
  margin-bottom: 10px;
}

.alloc-products li {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 300;
  line-height: 1.6;
}

.alloc-products li::before {
  content: '— ';
  color: var(--gold-dim);
}

.alloc-rationale {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  font-weight: 300;
  font-style: italic;
}

/* Priorities */
.recs-priorities {
  margin-bottom: 20px;
}

.priorities-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 12px;
}

.priority-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.priority-num {
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--gold-dim);
  line-height: 1.2;
  min-width: 20px;
}

.priority-text {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  font-weight: 300;
}

/* Fiscal + alert */
.recs-fiscal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 16px 18px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  font-weight: 300;
}

.recs-fiscal strong {
  color: var(--text);
  font-weight: 500;
}

.recs-alert {
  background: rgba(201,168,76,0.08);
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  padding: 14px 18px;
  font-size: 13px;
  color: var(--gold);
  line-height: 1.6;
  font-weight: 300;
}

/* Insight banner */
.insight-banner {
  background: linear-gradient(135deg, rgba(201,168,76,0.10) 0%, rgba(201,168,76,0.04) 100%);
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  padding: 16px 22px;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  font-weight: 300;
  display: flex;
  align-items: center;
  gap: 14px;
}
.insight-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}
.insight-banner strong { color: var(--gold); font-weight: 500; }

/* Chart controls row */
.chart-header {
  flex-wrap: wrap;
  gap: 12px;
}
.chart-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.chart-toggle {
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--ff-body);
  transition: all 0.15s;
}
.chart-toggle.active {
  border-color: var(--gold-dim);
  color: var(--gold);
  background: rgba(201,168,76,0.08);
}
.chart-toggle:hover:not(.active) {
  border-color: var(--text-muted);
  color: var(--text-dim);
}

/* ── Progress bar ── */
.progress-section {
  margin-bottom: 24px;
}
.progress-bar-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 18px 22px;
}
.progress-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.progress-bar-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
}
.progress-bar-pct {
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--gold);
}
.progress-bar-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  border-radius: 3px;
  transition: width 0.6s ease;
  min-width: 2px;
}
.progress-bar-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 300;
}

/* ── Chart tooltip ── */
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  font-size: 12px;
  font-family: var(--ff-body);
  min-width: 180px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  z-index: 10;
}
.tt-year {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.tt-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  color: var(--text-dim);
  font-weight: 300;
  justify-content: space-between;
}
.tt-row span:first-child { flex-shrink: 0; }
.tt-row span:nth-child(2) { flex: 1; }
.tt-row strong { color: var(--text); font-weight: 500; }
.tt-target { opacity: 0.65; }
.tt-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Allocation bar ── */
.alloc-bar-wrap {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 10px;
  gap: 2px;
}
.alloc-bar-seg {
  height: 100%;
  border-radius: 3px;
  transition: opacity 0.15s;
}
.alloc-bar-seg:hover { opacity: 0.8; }
.alloc-bar-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.alloc-bar-leg-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 300;
}
.alloc-bar-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.alloc-bar-leg-item strong { color: var(--text); font-weight: 500; }

/* ── Reverse calculator ── */
.reverse-calc {
  margin-top: 28px;
  padding: 20px 0 0;
  border-top: 1px solid var(--border);
}
.rc-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 12px;
}
.rc-question {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  font-weight: 300;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.rc-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px 8px;
  color: var(--text);
  font-family: var(--ff-body);
  font-size: 13px;
  width: 56px;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}
.rc-input::-webkit-inner-spin-button,
.rc-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.rc-input:focus { border-color: var(--gold-dim); }
.rc-result {
  margin-top: 10px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rc-value {
  font-family: var(--ff-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--gold);
  line-height: 1.1;
}
.rc-delta {
  font-size: 12px;
  font-weight: 300;
}
.rc-delta.negative { color: #c07070; }
.rc-delta.positive { color: #6b9e6b; }
.rc-delta.neutral { color: var(--text-muted); }

/* Utility */
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 1100px) {
  .db-layout { grid-template-columns: 1fr; }
  .db-sidebar { border-right: none; border-bottom: 1px solid var(--border); }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .alloc-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .db-sidebar { padding: 32px 20px; }
  .db-main { padding: 32px 20px; }
  .chart-section { padding: 20px 16px; }
  .recs-section { padding: 20px 16px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .risk-pills { flex-direction: column; }
}
