/* ==========================================================================
   Long Equity: Comprehensive Valuation
   2-Column Side-by-Side Layout: 2x3 Line Charts (Left) | Valuation Model (Right)
   Complements assets/raw-financials.css
   ========================================================================== */

.cv-subtitle {
  margin: 8px 0 0;
  max-width: 820px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text2);
}

#cv-search-input {
  flex: 1;
  width: 100%;
  height: 40px;
  padding: 8px 14px 8px 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-family: 'Manrope', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#cv-search-input:focus {
  border-color: #1C1917;
  box-shadow: 0 0 0 3px rgba(28, 25, 23, 0.08);
}

/* Horizon Controls in Toolbar */
.cv-horizon-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.cv-horizon-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cv-toolbar-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
}

.cv-horizon-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cv-custom-years-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cv-custom-years-wrap:focus-within {
  border-color: #1C1917;
  box-shadow: 0 0 0 3px rgba(28, 25, 23, 0.08);
}

.cv-custom-years-wrap input {
  width: 34px;
  border: none;
  background: transparent;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}

.cv-custom-years-wrap input::-webkit-inner-spin-button,
.cv-custom-years-wrap input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cv-price-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 9999px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 700;
  color: #1D4ED8;
}

/* Main 2-Column Valuation Workspace */
.cv-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(410px, 0.96fr);
  gap: 16px;
  align-items: stretch;
}

/* Left Column: 2x3 Line Charts Grid */
.cv-charts-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 14px;
  height: 100%;
}

.cv-chart-card {
  padding: 13px 15px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  min-height: 0;
}

.cv-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.cv-chart-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cv-step-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
}

.cv-chart-header h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.cv-stat-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 9999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.cv-stat-badge.is-blue {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1D4ED8;
}

.cv-stat-badge.is-emerald {
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  color: #047857;
}

.cv-stat-badge.is-amber {
  background: #FFF7ED;
  border: 1px solid #FED7AA;
  color: #C2410C;
}

.cv-stat-badge.is-teal {
  background: #F0FDFA;
  border: 1px solid #99F6E4;
  color: #0F766E;
}

.cv-stat-badge.is-indigo {
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  color: #4338CA;
}

.cv-stat-badge.is-rose {
  background: #FDF2F8;
  border: 1px solid #FBCFE8;
  color: #9D174D;
}

.cv-chart-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 176px;
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 8px 8px 4px;
}

.cv-chart-foot {
  font-size: 11px;
  color: var(--text3);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right Column: Valuation Scenario Calculator Panel */
.cv-model-panel {
  height: 100%;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cv-model-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.cv-model-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.cv-model-sub-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.cv-model-sub {
  margin: 0;
  font-size: 11.5px;
  color: var(--text3);
}

.cv-saved-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 9999px;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  color: #047857;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.5;
}

.cv-saved-pill[hidden] {
  display: none;
}

.cv-preset-btns {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.cv-preset-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.cv-preset-btn:hover {
  border-color: #1C1917;
  color: var(--text);
  background: #ffffff;
}

.cv-preset-btn.is-active {
  background: #1C1917;
  border-color: #1C1917;
  color: #ffffff;
}

.cv-table-headers {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, 1fr);
  gap: 6px;
  align-items: center;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
  padding: 2px 2px 0;
}

.cv-col-head {
  text-align: center;
}

.cv-stage-block {
  flex: 1 0 auto;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.cv-val-row {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, 1fr);
  gap: 6px;
  align-items: center;
}

.cv-row-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text2);
  min-width: 0;
}

.cv-milestone-row .cv-row-label {
  font-size: 12.5px;
  font-weight: 800;
  color: #1C1917;
}

.cv-sub-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
}

.cv-row-num {
  width: 17px;
  height: 17px;
  border-radius: 9999px;
  background: #EDE9E3;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cv-input-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 32px;
  padding: 0 7px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: #ffffff;
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cv-input-wrap:focus-within {
  border-color: #0284C7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.cv-readonly-wrap {
  background: #F5F3EE;
  border-color: #E7E2D8;
}

.cv-readonly-wrap:focus-within {
  border-color: #E7E2D8;
  box-shadow: none;
}

.cv-price-forecast-wrap {
  background: #D1FAE5;
  border-color: #34D399;
}

.cv-milestone-wrap {
  background: #FEF9EC;
  border-color: #E2B857;
}

.cv-milestone-wrap .cv-affix,
.cv-milestone-wrap .cv-input {
  font-weight: 800;
  color: #111827;
}

.cv-milestone-wrap .cv-input {
  font-size: 12.5px;
}

.cv-milestone-price {
  background: #D1FAE5;
  border: 1.5px solid #10B981;
  box-shadow: 0 1px 3px rgba(4, 120, 87, 0.12);
}

.cv-milestone-price .cv-affix,
.cv-milestone-price .cv-input.is-price {
  font-size: 13px;
  font-weight: 800;
  color: #065F46;
}

.cv-affix {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text3);
  flex-shrink: 0;
  line-height: 1;
}

.cv-input {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  outline: none;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.cv-input-wrap.cv-has-steppers .cv-input {
  padding-right: 1px;
}

.cv-input-wrap.cv-has-steppers .cv-affix {
  margin-right: 4px;
}

.cv-input::-webkit-inner-spin-button,
.cv-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cv-input-wrap.cv-has-steppers {
  padding: 0 0 0 6px;
  overflow: hidden;
}

.cv-steppers {
  width: 17px;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: #FAF8F5;
  flex-shrink: 0;
}

.cv-step-btn {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text2);
  padding: 0;
  margin: 0;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.cv-step-btn + .cv-step-btn {
  border-top: 1px solid var(--border-subtle);
}

.cv-step-btn:hover {
  background: #EDE9E3;
  color: #1C1917;
}

.cv-step-btn:active {
  background: #E2DDD5;
}

.cv-input.cv-readonly {
  color: var(--text2);
  cursor: default;
}

.cv-input.is-price {
  color: #047857;
}

.cv-input.cv-blue { color: #1D4ED8; }
.cv-input.cv-emerald { color: #047857; }
.cv-input.cv-amber { color: #C2410C; }
.cv-input.cv-teal { color: #0F766E; }
.cv-input.cv-indigo { color: #4338CA; }
.cv-input.cv-rose { color: #9D174D; }

.cv-stage-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text3);
  padding-left: 2px;
}

/* Intermediate Calculated Rows */
.cv-calc-row {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, 1fr);
  gap: 6px;
  align-items: center;
  padding-top: 5px;
  border-top: 1px dashed var(--border);
}

.cv-calc-label {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.cv-calc-label span {
  font-size: 12px;
  font-weight: 800;
  color: #1C1917;
}

.cv-calc-label small {
  font-size: 9.5px;
  color: var(--text3);
  font-weight: 600;
}

.cv-calc-val {
  height: 28px;
  border-radius: 7px;
  background: #F5F3EE;
  border: 1px solid #E7E2D8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text2);
  padding: 0 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cv-calc-val.is-strong.cv-milestone-val {
  height: 31px;
  background: #FEF9EC;
  border: 1.5px solid #E2B857;
  color: #111827;
  font-size: 12.5px;
  font-weight: 800;
}

@keyframes cvMilestonePulse {
  0% {
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.28);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(217, 119, 6, 0);
  }
}

@keyframes cvPricePulse {
  0% {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.34);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.cv-milestone-wrap.is-updated,
.cv-milestone-val.is-updated {
  animation: cvMilestonePulse 0.55s ease-out;
}

.cv-milestone-price.is-updated,
.cv-cagr-card.is-updated {
  animation: cvPricePulse 0.65s ease-out;
}

.cv-price-row {
  padding-top: 5px;
  border-top: 1px dashed var(--border);
}

.cv-delta-cell {
  height: 30px;
  border-radius: 8px;
  background: #F5F3EE;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  padding: 0 4px;
  white-space: nowrap;
}

.cv-delta-cell.positive {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.35);
  color: #047857;
}

.cv-delta-cell.negative {
  background: rgba(225, 29, 72, 0.08);
  border-color: rgba(225, 29, 72, 0.3);
  color: #BE123C;
}

/* Final Implied Growth Rate Card */
.cv-cagr-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  margin-top: 2px;
}

.cv-cagr-card.positive {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.09) 0%, rgba(4, 120, 87, 0.14) 100%);
  border-color: rgba(16, 185, 129, 0.45);
}

.cv-cagr-card.negative {
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.08) 0%, rgba(190, 18, 60, 0.14) 100%);
  border-color: rgba(225, 29, 72, 0.4);
}

.cv-cagr-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cv-cagr-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.cv-cagr-desc {
  font-size: 10.5px;
  color: var(--text2);
}

.cv-cagr-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 6px 12px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  flex-shrink: 0;
}

.cv-cagr-card.positive .cv-cagr-badge {
  border-color: rgba(16, 185, 129, 0.45);
  color: #047857;
}

.cv-cagr-card.negative .cv-cagr-badge {
  border-color: rgba(225, 29, 72, 0.4);
  color: #BE123C;
}

/* Responsive Breakpoints */
@media (max-width: 1160px) {
  .cv-main-grid {
    grid-template-columns: 1fr;
  }

  .cv-charts-col {
    height: auto;
    grid-template-rows: auto;
  }

  .cv-chart-card {
    height: auto;
  }

  .cv-chart-wrap {
    flex: none;
    height: 185px;
  }

  .cv-model-panel {
    height: auto;
    position: static;
  }

  .cv-stage-block {
    flex: 0 0 auto;
  }
}

@media (max-width: 720px) {
  .cv-charts-col {
    grid-template-columns: 1fr;
  }

  .cv-model-header {
    flex-wrap: wrap;
  }

  .cv-preset-btns {
    width: 100%;
    flex-wrap: wrap;
  }

  .cv-table-headers,
  .cv-val-row,
  .cv-calc-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cv-table-headers > div:first-child {
    display: none;
  }

  .cv-row-label,
  .cv-calc-label {
    grid-column: 1 / -1;
  }

  #cv-search-input,
  .cv-custom-years-wrap input,
  .cv-input {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .cv-cagr-card {
    flex-wrap: wrap;
  }

  .cv-cagr-badge {
    width: 100%;
  }
}
