/* ============================================================
   forecast.css  --  Revenue Forecast page (fc-*)
   Mobile-first, clean card layout
   ============================================================ */

/* ── Page wrapper ─────────────────────────────────────────── */
.fc-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 24px;
}

/* ── Page header (visible on mobile; desktop sees filter bar) */
.fc-page-header {
  display: none; /* shown via mobile override below */
  align-items: center;
  gap: 14px;
  padding: 0 2px 4px;
}
.fc-page-header-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.fc-page-title    { font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.2; }
.fc-page-subtitle { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ── Card shell ───────────────────────────────────────────── */
.fc-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Card header ──────────────────────────────────────────── */
.fc-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.fc-card-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fc-card-icon  { color: var(--accent); flex-shrink: 0; }
.fc-card-title { font-size: 15px; font-weight: 700; color: var(--text); }
.fc-card-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 3px 9px;
  white-space: nowrap;
  flex-shrink: 0;
}
.fc-card-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  margin-top: -8px; /* tighten gap after header */
}

/* ── Inline date picker (mobile only) ────────────────────── */
.fc-inline-dates {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: none; /* shown on mobile */
}
.fc-inline-date-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  margin-bottom: 10px;
}
.fc-inline-date-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.fc-date-input {
  flex: 1;
  min-width: 130px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-mono);
}
.fc-date-sep {
  font-size: 12px;
  color: var(--text-2);
  flex-shrink: 0;
}

/* ── Controls grid (2-col desktop, 1-col mobile) ─────────── */
.fc-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ── Control block ────────────────────────────────────────── */
.fc-control-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fc-control-block-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.fc-control-block-hint {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-2);
  text-transform: none;
  letter-spacing: 0;
}

/* ── Pill buttons ─────────────────────────────────────────── */
.fc-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fc-pill {
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
  line-height: 1;
}
/* Commission pills: tighter horizontal padding so 5 fit on one row */
#fcCommPills .fc-pill { padding: 7px 8px; }
.fc-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}
.fc-pill-active {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
  background: var(--accent-dim) !important;
  font-weight: 600;
}

/* ── Custom input row ─────────────────────────────────────── */
.fc-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fc-custom-label {
  font-size: 12px;
  color: var(--text-2);
  flex-shrink: 0;
}
.fc-custom-prefix {
  font-size: 14px;
  color: var(--text-2);
  flex-shrink: 0;
}
.fc-custom-unit {
  font-size: 12px;
  color: var(--text-2);
  flex-shrink: 0;
  white-space: nowrap;
}
.fc-num-input {
  width: 76px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-mono);
  text-align: center;
  transition: border-color 0.15s;
}
.fc-num-input:focus { border-color: var(--accent); outline: none; }

/* ── Output area ──────────────────────────────────────────── */
.fc-output {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 4px;
}
.fc-empty {
  color: var(--text-2);
  font-size: 13px;
  padding: 8px 0;
  text-align: center;
}

/* ── Rate sim output: metric rows ────────────────────────── */
.fc-sim-metrics {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.fc-metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--bg-2);
}
.fc-metric:nth-child(even) { background: var(--bg-3); }

.fc-metric-left  { display: flex; flex-direction: column; gap: 3px; }
.fc-metric-right { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }

.fc-metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.fc-metric-current {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
}
.fc-metric-proj {
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text);
}
.fc-metric-proj-tag {
  font-size: 10px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.fc-metric-change {
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
}
.fc-pos { color: var(--green, #4ade80); }
.fc-neg { color: var(--red,   #f87171); }
.fc-neu { color: var(--text-2); }

/* ── Per-client impact table ─────────────────────────────── */
.fc-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 20px;
  margin-bottom: 10px;
}
.fc-client-table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); }
.fc-client-table      { width: 100%; border-collapse: collapse; font-size: 12px; }
.fc-client-table th   {
  text-align: left;
  padding: 9px 14px;
  background: var(--bg-3);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.fc-client-table td   {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-light, var(--border));
  color: var(--text);
  font-family: var(--font-mono);
}
.fc-client-table tbody tr:last-child td { border-bottom: none; }
.fc-from { color: var(--text-2); font-size: 11px; margin-right: 4px; text-decoration: line-through; }
.fc-to   { color: var(--accent); font-weight: 600; }

/* ── Target calculator: target row ───────────────────────── */
.fc-target-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
  /* prevent either column from blowing out the card */
  overflow: hidden;
}
/* grid children must declare min-width:0 or they ignore the 1fr limit */
.fc-target-row > .fc-control-block-inline {
  min-width: 0;
}
.fc-control-block-inline { gap: 10px; }
.fc-type-pills { flex-wrap: wrap; }
.fc-type-pills .fc-pill  { flex: 1; min-width: 0; justify-content: center; text-align: center; }

.fc-amount-block { justify-content: flex-start; min-width: 0; }
.fc-amount-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  transition: border-color 0.15s;
  /* must not exceed the grid column */
  min-width: 0;
  overflow: hidden;
}
.fc-amount-input-wrap:focus-within { border-color: var(--accent); }
.fc-amount-symbol {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-2);
  flex-shrink: 0;
}
.fc-amount-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 22px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 12px 0;
  min-width: 0;
  width: 0; /* forces the input to shrink to fit flex parent */
  outline: none;
}
.fc-amount-input::placeholder { color: var(--text-2); opacity: 0.5; }

/* ── Override rates section ───────────────────────────────── */
.fc-overrides {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fc-overrides-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}
.fc-overrides-hint {
  font-size: 10px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-2);
  opacity: 0.7;
  margin-left: 2px;
}
.fc-overrides-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.fc-override-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fc-override-label {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 500;
}
.fc-override-input-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}
.fc-override-input-wrap .fc-num-input { width: 100%; flex: 1; }

/* ── Mix slider ───────────────────────────────────────────── */
.fc-mix-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fc-mix-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}
.fc-mix-track {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
  gap: 12px;
}
.fc-mix-endpoint {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fc-mix-endpoint-right { text-align: right; align-items: flex-end; }
.fc-mix-duration { font-size: 10px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; }
.fc-mix-pct      { font-size: 16px; font-family: var(--font-mono); color: var(--accent); }
.fc-slider {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
  height: 4px;
}

/* ── Target output: assumption note ──────────────────────── */
.fc-assumption-note {
  font-size: 12px;
  color: var(--text-2);
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  line-height: 1.55;
}
.fc-quick-btn {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.fc-quick-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ── Scenario cards ───────────────────────────────────────── */
.fc-scenarios {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.fc-scenario-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.fc-scenario-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
}
.fc-scenario-note {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.4;
  margin-bottom: 14px;
}
.fc-scenario-stats {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 12px;
}
.fc-scenario-stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light, var(--border));
}
.fc-scenario-stat:last-child { border-bottom: none; }
.fc-stat-num { font-size: 15px; font-weight: 700; color: var(--text); font-family: var(--font-mono); }
.fc-stat-lbl { font-size: 11px; color: var(--text-2); text-align: right; }
.fc-stat-highlight .fc-stat-num { color: var(--accent); font-size: 20px; }
.fc-stat-highlight .fc-stat-lbl { color: var(--accent); font-weight: 600; font-size: 12px; }

/* ── Mobile overrides ─────────────────────────────────────── */
@media (max-width: 700px) {
  .fc-page-header   { display: flex; }
  .fc-inline-dates  { display: block; }

  .fc-card { padding: 18px 16px; gap: 16px; border-radius: 12px; }

  .fc-controls-grid { grid-template-columns: 1fr; gap: 20px; }

  /* Pill buttons: larger tap targets on mobile */
  .fc-pill { padding: 9px 14px; font-size: 13px; }

  /* Target row stacks on mobile */
  .fc-target-row {
    grid-template-columns: 1fr;
    gap: 16px;
    overflow: visible;
  }
  .fc-target-row > .fc-control-block-inline {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  /* Pills must wrap and fill the full card width */
  .fc-type-pills {
    flex-wrap: wrap;
    width: 100%;
  }
  .fc-type-pills .fc-pill {
    flex: 1 1 0;
    min-width: 0;
    padding: 10px 6px;
    font-size: 12px;
    text-align: center;
    box-sizing: border-box;
  }
  /* Amount wrapper fills its column */
  .fc-amount-input-wrap {
    padding: 0 14px;
    width: 100%;
    box-sizing: border-box;
  }
  .fc-amount-input {
    font-size: 22px;
    padding: 12px 0;
    width: 0;
    min-width: 0;
  }

  /* Overrides: 3-col is too tight on mobile */
  .fc-overrides-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* Mix track: tighter labels */
  .fc-mix-track { grid-template-columns: 52px 1fr 52px; gap: 8px; }
  .fc-mix-pct   { font-size: 14px; }

  /* Rate sim metrics: rearrange to label top, values bottom */
  .fc-metric { flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 14px; }
  .fc-metric-right { align-items: flex-start; flex-direction: row; gap: 10px; flex-wrap: wrap; }
  .fc-metric-current { font-size: 20px; }

  /* Scenario cards: single column on mobile */
  .fc-scenarios { grid-template-columns: 1fr; gap: 12px; }
  .fc-scenario-card { padding: 16px 14px; }
  .fc-stat-highlight .fc-stat-num { font-size: 22px; }

  /* Per-client table: always horizontal scroll */
  .fc-client-table-wrap { border-radius: 8px; }
}

@media (min-width: 701px) and (max-width: 960px) {
  /* Tablet: 2-col scenarios */
  .fc-scenarios { grid-template-columns: 1fr 1fr; }
  /* Overrides: 3 still fits */
}
