/* ========================================
   Financial Model Web App - Styles
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  --navy: #1a2332;
  --navy-light: #243044;
  --navy-dark: #111827;
  --teal: #0d7377;
  --teal-light: #0f8f94;
  --teal-dark: #0a5c5f;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --input-bg: #fffef5;
  --input-text: #1a5276;
  --calc-bg: #f3f4f6;
  --section-header-bg: #2d3748;
  --total-border: #374151;
  --positive: #059669;
  --negative: #dc2626;
  --font-main: 'Inter', 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --sidebar-width: 220px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: var(--font-main);
  font-size: 13px;
  line-height: 1.4;
  color: var(--gray-800);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Layout
   ======================================== */

.app-container {
  display: flex;
  height: 100vh;
  overflow: visible;
}

/* ========================================
   Sidebar
   ======================================== */

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--white);
}

.sidebar-logo .logo-sub {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.sidebar-label {
  padding: 8px 20px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.sidebar-item:hover {
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.85);
}

.sidebar-item.active {
  background: rgba(13, 115, 119, 0.15);
  color: var(--white);
  border-left-color: var(--teal);
}

.sidebar-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-item.active svg {
  opacity: 1;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
  color: rgba(255,255,255,0.3);
}

/* ========================================
   Main Content
   ======================================== */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: visible;
  background: var(--white);
}

.content-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  overflow: visible;
  position: relative;
  z-index: 200;
}

.content-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.3px;
}

.content-header .header-actions {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 12px;
  white-space: nowrap;
  font-weight: 600;
  font-family: var(--font-main);
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  background: var(--white);
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-primary {
  background: var(--teal);
  color: var(--white);
  border-color: var(--teal);
}

.btn-primary:hover {
  background: var(--teal-light);
  border-color: var(--teal-light);
}

.btn svg {
  width: 14px;
  height: 14px;
}

.content-body {
  flex: 1;
  overflow: auto;
  padding: 0;
}

/* ========================================
   Tab Panels
   ======================================== */

.tab-panel {
  display: none;
  padding: 20px 28px 40px;
}

.tab-panel.active {
  display: block;
}

/* ========================================
   Section Headers (consistent across all tabs)
   ======================================== */

.section-group {
  margin-bottom: 20px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--section-header-bg);
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  user-select: none;
}

.section-header h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-header .chevron {
  width: 16px;
  height: 16px;
  color: rgba(255,255,255,0.5);
  transition: transform 0.2s ease;
}

.section-header.collapsed .chevron {
  transform: rotate(-90deg);
}

.section-content {
  border: 1px solid var(--gray-200);
  border-top: none;
  border-radius: 0 0 4px 4px;
  overflow-x: auto;
}

.section-content.collapsed {
  display: none;
}

/* ========================================
   Tables (CONSISTENT across ALL tabs)
   ======================================== */

.fm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}

.fm-table th,
.fm-table td {
  padding: 6px 10px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--gray-100);
  font-variant-numeric: tabular-nums;
  height: 32px;
}

.fm-table th {
  background: var(--navy);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 2px solid var(--navy-dark);
}

.fm-table th:first-child,
.fm-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 1;
  background: inherit;
}

.fm-table th:first-child {
  z-index: 3;
  min-width: 220px;
  width: 220px;
}

.fm-table td:first-child {
  font-weight: 500;
  color: var(--gray-700);
  min-width: 220px;
  width: 220px;
  background: var(--white);
}

/* Year columns - consistent width */
.fm-table th:not(:first-child),
.fm-table td:not(:first-child) {
  min-width: 100px;
  width: 100px;
}

/* Row types */
.fm-table tr.row-input td {
  background: var(--white);
}

.fm-table tr.row-input td:not(:first-child) {
  background: #fdf8e8;
  color: #1a5276;
  font-weight: 600;
  border-left: 1px solid #f0e6c0;
}

.fm-table tr.row-calc td:not(:first-child) {
  background: #f0f4f8;
  color: #475569;
  font-weight: 400;
  font-style: normal;
}

.fm-table tr.row-total td {
  font-weight: 700;
  border-top: 2px solid var(--total-border);
  background: var(--gray-50);
}

.fm-table tr.row-total td:first-child {
  background: var(--gray-50);
}

.fm-table tr.row-margin td {
  font-style: italic;
  color: var(--gray-500);
  font-size: 11px;
}

.fm-table tr.row-blank td {
  height: 12px;
  border-bottom: none;
}

.fm-table tr.row-sub-header td {
  font-weight: 700;
  font-size: 11px;
  color: var(--navy);
  background: var(--gray-50);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding-top: 10px;
}

.fm-table tr.row-sub-header td:first-child {
  background: var(--gray-50);
}

/* Indent levels */
.fm-table td.indent-1 {
  padding-left: 24px;
}

.fm-table td.indent-2 {
  padding-left: 38px;
}

/* Negative values */
.fm-table td.negative {
  color: var(--negative);
}

/* Positive highlight */
.fm-table td.positive {
  color: var(--positive);
}

/* ========================================
   Assumptions-specific: input cells
   ======================================== */

.fm-table .cell-input {
  background: var(--input-bg);
  color: var(--input-text);
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: 2px;
}

.fm-table .cell-input:hover {
  border-color: var(--teal);
}

/* Toggle switch for % vs absolute */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 3px;
}

.toggle-switch .active {
  color: var(--teal);
  font-weight: 600;
}

/* ========================================
   Editable Input Fields in Assumptions
   ======================================== */

.fm-table .cell-editable {
  padding: 0;
}

.fm-table .cell-editable input {
  width: 100%;
  height: 31px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 0;
  background: #fdf8e8;
  color: #1a5276;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease, background 0.15s ease;
  -moz-appearance: textfield;
}

.fm-table .cell-editable input::-webkit-outer-spin-button,
.fm-table .cell-editable input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.fm-table .cell-editable input:hover {
  border-color: var(--teal);
  background: #fef9e0;
}

.fm-table .cell-editable input:focus {
  border-color: var(--teal);
  background: #fffdf0;
  box-shadow: inset 0 0 0 1px var(--teal);
}

.fm-table .cell-editable input.text-input {
  text-align: left;
}

/* Stream name input in sub-header rows */
.fm-table tr.row-sub-header td.cell-editable {
  padding: 0;
  background: var(--gray-50);
}

.fm-table tr.row-sub-header td.cell-editable input {
  height: 100%;
  min-height: 32px;
  padding: 6px 10px;
  background: var(--gray-50);
  color: var(--navy);
  font-weight: 700;
  font-size: 11px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
}

.fm-table tr.row-sub-header td.cell-editable input:hover {
  background: #eef1f6;
  border-color: var(--teal);
}

.fm-table tr.row-sub-header td.cell-editable input:focus {
  background: #fff;
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px var(--teal);
  text-transform: none;
}

.fm-table .cell-editable input.invalid {
  border-color: var(--negative);
  background: #fff0f0;
}

/* Flash animation for changed cells */
@keyframes cellFlash {
  0% { background-color: #d4edda; }
  100% { background-color: transparent; }
}

.cell-changed {
  animation: cellFlash 0.6s ease-out;
}

/* Last recalculated timestamp */
.recalc-timestamp {
  font-size: 11px;
  color: var(--gray-400);
  font-weight: 400;
  margin-left: 12px;
  font-variant-numeric: tabular-nums;
}

/* Reset button */
/* ========================================
   Currency Toggle Button
   ======================================== */
.currency-toggle-btn {
  background: #fff;
  color: var(--gray-700);
  border: 1.5px solid var(--gray-300);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  gap: 5px;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.currency-toggle-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: #f0fafa;
}
.currency-toggle-btn.currency-toggle-active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}
.currency-toggle-btn.currency-toggle-active:hover {
  background: #0a5c5f;
  border-color: #0a5c5f;
}

.btn-save {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
  font-weight: 600;
}
.btn-save:hover {
  background: #0a5c5f;
  border-color: #0a5c5f;
}

.btn-undo {
  background: transparent;
  color: var(--gray-600);
  border-color: var(--gray-300);
}
.btn-undo:hover {
  color: var(--teal);
  border-color: var(--teal);
  background: #f0fafa;
}

.btn-reset {
  background: transparent;
  color: var(--gray-500);
  border-color: var(--gray-300);
}

.btn-reset:hover {
  color: var(--negative);
  border-color: var(--negative);
  background: #fff5f5;
}

/* ========================================
   KPI Cards (Summary tab)
   ======================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--teal);
}

.kpi-card .kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.kpi-card .kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.5px;
}

.kpi-card .kpi-sub {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 4px;
}

.kpi-card .kpi-change {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}

.kpi-card .kpi-change.up {
  color: var(--positive);
}

.kpi-card .kpi-change.down {
  color: var(--negative);
}

/* ========================================
   Deal Structure specific
   ======================================== */

.deal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.deal-card {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  overflow: hidden;
}

.deal-card-header {
  padding: 10px 14px;
  background: var(--navy);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.deal-card-body {
  padding: 14px;
}

.deal-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--gray-100);
}

.deal-row:last-child {
  border-bottom: none;
}

.deal-row .label {
  color: var(--gray-600);
}

.deal-row .value {
  font-weight: 600;
  color: var(--gray-800);
  font-variant-numeric: tabular-nums;
}

.deal-row.total {
  border-top: 2px solid var(--total-border);
  font-weight: 700;
  padding-top: 8px;
  margin-top: 4px;
}

.deal-row.total .value {
  color: var(--navy);
}

/* Instrument detail panels */
.instrument-detail {
  display: none;
}

.instrument-detail.active {
  display: block;
}

/* Instrument selector */
.instrument-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.instrument-tab {
  padding: 7px 14px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-main);
  border: 1px solid var(--gray-300);
  border-radius: 5px;
  background: var(--white);
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s ease;
}

.instrument-tab:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.instrument-tab.active {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--white);
}

/* ========================================
   Deal Structure — Interactive Sections
   ======================================== */

/* Uses & Sources Form Grid */
.deal-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 0;
}

.deal-form-card {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  overflow: hidden;
}

.deal-form-card-header {
  padding: 8px 14px;
  background: var(--navy-light);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.deal-form-card-body {
  padding: 12px 14px;
}

.deal-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--gray-100);
  min-height: 32px;
}

.deal-form-row:last-child {
  border-bottom: none;
}

.deal-form-row .form-label {
  color: var(--gray-600);
  font-weight: 500;
  flex: 1;
  min-width: 0;
}

.deal-form-row .form-value {
  font-weight: 600;
  color: var(--gray-800);
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 90px;
}

.deal-form-row .form-value.calc {
  color: var(--gray-500);
  font-weight: 500;
  background: var(--calc-bg);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
}

.deal-form-row.total {
  border-top: 2px solid var(--total-border);
  font-weight: 700;
  padding-top: 8px;
  margin-top: 4px;
}

.deal-form-row.total .form-label,
.deal-form-row.total .form-value {
  font-weight: 700;
  color: var(--navy);
}

/* Sidebar project items */
.sidebar-project-item {
  font-size: 12px !important;
  padding: 6px 16px !important;
  min-height: 28px !important;
}
.sidebar-project-item.active-project {
  background: rgba(13, 115, 119, 0.2) !important;
  color: #0d7377 !important;
  border-left: 3px solid #0d7377;
}
.sidebar-project-item:hover:not(.active-project) {
  background: rgba(255,255,255,0.06) !important;
}
.sidebar-project-item:hover .proj-del-btn {
  opacity: 1 !important;
}
.sidebar-new-project:hover {
  opacity: 1 !important;
  color: #0d7377 !important;
}

/* Tranche rows */
.tranche-row {
  gap: 8px;
}
.tranche-row:hover .tranche-name-input {
  border-bottom-color: var(--gray-300) !important;
}

/* Deal inline inputs */
.deal-input {
  width: 90px;
  height: 26px;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: #fdf8e8;
  color: #1a5276;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
  -moz-appearance: textfield;
}

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

.deal-input:hover {
  border-color: var(--teal);
  background: #fef9e0;
}

.deal-input:focus {
  border-color: var(--teal);
  background: #fffdf0;
  box-shadow: inset 0 0 0 1px var(--teal);
}

.deal-input.wide {
  width: 120px;
}

.deal-input.text-left {
  text-align: left;
}

/* Instrument Selector Cards */
.instrument-selector {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 20px;
  padding: 0;
}

.instrument-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px 12px;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.instrument-card:hover {
  border-color: var(--teal);
  background: #f0fafa;
}

.instrument-card.active {
  border-color: var(--teal);
  background: linear-gradient(135deg, #e8f7f7 0%, #f0fafa 100%);
  box-shadow: 0 0 0 1px var(--teal), 0 2px 8px rgba(13,115,119,0.12);
}

.instrument-card-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--gray-100);
  color: var(--gray-500);
}

.instrument-card.active .instrument-card-icon {
  background: var(--teal);
  color: var(--white);
}

.instrument-card-icon svg {
  width: 18px;
  height: 18px;
}

.instrument-card-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.3;
}

.instrument-card.active .instrument-card-label {
  color: var(--teal-dark);
}

/* Instrument NOT enabled — greyed out */
.instrument-card:not(.inst-enabled) {
  opacity: 0.45;
  filter: grayscale(60%);
  border-color: #d0d0d0;
  background: #f5f5f5;
}
.instrument-card:not(.inst-enabled):hover {
  opacity: 0.7;
  filter: grayscale(30%);
}
.instrument-card:not(.inst-enabled).active {
  opacity: 0.65;
  filter: grayscale(40%);
  border-color: #aaa;
  box-shadow: 0 0 0 1px #aaa;
}
.instrument-card:not(.inst-enabled) .instrument-card-label {
  color: #999;
}

/* Instrument enabled (in projections) state */
.instrument-card.inst-enabled {
  border-color: #2e7d32;
  background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f1 100%);
  opacity: 1;
  filter: none;
}
.instrument-card.inst-enabled.active {
  border-color: var(--teal);
  background: linear-gradient(135deg, #e0f4f4 0%, #e8f5e9 100%);
  box-shadow: 0 0 0 1px var(--teal), 0 2px 8px rgba(13,115,119,0.15);
}

/* Instrument toggle switch */
.instrument-toggle-wrap {
  margin-top: 4px;
}
.inst-toggle {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 16px;
  cursor: pointer;
}
.inst-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.inst-toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--gray-300);
  border-radius: 16px;
  transition: background 0.2s;
}
.inst-toggle-slider::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.inst-toggle input:checked + .inst-toggle-slider {
  background: #2e7d32;
}
.inst-toggle input:checked + .inst-toggle-slider::before {
  transform: translateX(14px);
}

/* Instrument Parameter Panel */
.instrument-params {
  display: none;
  padding: 0;
}

.instrument-params.active {
  display: block;
}

.param-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}

.param-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--gray-100);
  min-height: 32px;
}

.param-row .param-label {
  color: var(--gray-600);
  font-weight: 500;
}

.param-row .param-input {
  width: 90px;
}

/* Per-year row (full width) */
.param-year-row {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--gray-200);
}

.param-year-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.param-year-grid {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.param-year-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
}

.param-year-cell .year-label {
  font-size: 9px;
  color: var(--gray-400);
  font-weight: 600;
  margin-bottom: 2px;
}

.param-year-cell .deal-input {
  width: 68px;
  font-size: 11px;
  height: 24px;
  text-align: center;
}

/* Return highlights in instrument panel */
.return-highlight {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #e8f7f7 0%, #f0f9fa 100%);
  border: 1px solid #c5e8e9;
  border-radius: 6px;
}

.return-metric {
  text-align: center;
  flex: 1;
}

.return-metric-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.return-metric-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--teal-dark);
  font-variant-numeric: tabular-nums;
}

/* Comps editable table overrides */
.comps-table .fm-table {
  table-layout: auto;
}

.comps-table .fm-table th:first-child,
.comps-table .fm-table td:first-child {
  min-width: 160px;
  width: auto;
}

.comps-table .fm-table th:not(:first-child),
.comps-table .fm-table td:not(:first-child) {
  min-width: 120px;
  width: 120px;
}

.comps-table .fm-table .cell-editable input {
  text-align: right;
}

.comps-table .fm-table .cell-editable input.text-input {
  text-align: left;
}

/* Comps summary stats row */
.comps-stats-row td {
  font-weight: 600;
  color: var(--gray-700);
  background: var(--gray-50);
}

/* Deal select dropdown */
.deal-select {
  height: 26px;
  padding: 3px 24px 3px 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: #fdf8e8;
  color: #1a5276;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%231a5276' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 12px;
  transition: border-color 0.15s ease;
}

.deal-select:hover {
  border-color: var(--teal);
}

.deal-select:focus {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px var(--teal);
}

/* Risk colors for returns comparison */
.risk-high { color: var(--negative); }
.risk-med-high { color: #d97706; }
.risk-medium { color: #d97706; }
.risk-med-low { color: var(--positive); }
.risk-low { color: var(--positive); }

/* Deal section spacing */
#deal .section-group {
  margin-bottom: 16px;
}

/* Instrument selector always visible styling */
.instrument-section {
  margin-bottom: 20px;
}

.instrument-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

@media (max-width: 1200px) {
  .instrument-selector {
    grid-template-columns: repeat(3, 1fr);
  }
  .deal-form-grid {
    grid-template-columns: 1fr;
  }
  .param-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .instrument-selector {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================================
   Scrollbar
   ======================================== */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .deal-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   Narrative Tab — Document Layout
   ======================================== */

#narrative.tab-panel {
  padding: 0;
  background: var(--gray-100);
}

.narrative-document {
  max-width: 820px;
  margin: 32px auto;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  padding: 48px 56px 56px;
  font-family: 'Inter', 'DM Sans', Georgia, serif;
  font-size: 13.5px;
  line-height: 1.75;
  color: #1f2937;
}

.narrative-title-block {
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 2px solid var(--navy);
}

.narrative-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.narrative-subtitle {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 4px;
}

.narrative-meta {
  font-size: 11px;
  color: var(--gray-400);
  letter-spacing: 0.2px;
}

/* Section Headers */
.narrative-section {
  margin-bottom: 32px;
}

.narrative-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #D6E4F0;
  padding: 10px 16px;
  margin-bottom: 18px;
  border-radius: 3px;
  border-left: 4px solid var(--navy);
}

.narrative-section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--navy);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  border-radius: 50%;
  flex-shrink: 0;
}

.narrative-section-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Section Body */
.narrative-section-body {
  padding: 0 4px;
}

.narrative-section-body p {
  margin-bottom: 14px;
  text-align: justify;
  hyphens: auto;
}

.narrative-section-body p:last-child {
  margin-bottom: 0;
}

.narrative-section-body h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 20px 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--gray-200);
}

.narrative-section-body strong {
  color: var(--navy);
  font-weight: 700;
}

/* Key Metrics Table */
.narrative-metrics-table {
  margin: 20px 0;
  overflow-x: auto;
}

.narrative-metrics-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.narrative-metrics-table th {
  background: var(--navy);
  color: var(--white);
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--navy-dark);
}

.narrative-metrics-table th:first-child {
  text-align: left;
  min-width: 160px;
}

.narrative-metrics-table td {
  padding: 7px 12px;
  text-align: right;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

.narrative-metrics-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--gray-800);
}

.narrative-metrics-table tbody tr:nth-child(even) {
  background: #f9fafb;
}

/* Working Capital Table */
.narrative-wc-table {
  max-width: 380px;
  margin: 16px 0 20px;
}

.narrative-wc-table td:last-child,
.narrative-wc-table th:last-child {
  width: 80px;
  text-align: center;
}

.narrative-wc-table tr.wc-total td {
  border-top: 2px solid var(--total-border);
  font-weight: 700;
  background: var(--gray-50);
}

/* Highlight Boxes */
.narrative-highlight-box {
  background: #EBF1F8;
  border: 1px solid #D6E4F0;
  border-radius: 4px;
  padding: 14px 18px;
  margin: 16px 0 18px;
  max-width: 400px;
}

.narrative-highlight-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 12px;
}

.narrative-highlight-row + .narrative-highlight-row {
  border-top: 1px solid rgba(26, 35, 50, 0.08);
}

.narrative-highlight-label {
  color: var(--gray-600);
  font-weight: 500;
}

.narrative-highlight-value {
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

/* Disclaimer */
.narrative-disclaimer {
  margin-top: 24px !important;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
  font-size: 11px !important;
  line-height: 1.6 !important;
  color: var(--gray-400) !important;
}

/* ========================================
   Responsive (legacy block — non-sidebar rules preserved)
   ======================================== */

@media (max-width: 768px) {
  /* Sidebar handled by new mobile CSS below */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .narrative-document {
    margin: 12px;
    padding: 24px 20px;
  }
  .narrative-highlight-box {
    max-width: 100%;
  }
}

/* ============================================================
   TOOLTIPS
   ============================================================ */
.tooltip-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: #0d7377; color: #fff; font-size: 10px; font-weight: 700;
  margin-left: 6px; cursor: pointer; vertical-align: middle;
  transition: background 0.2s; flex-shrink: 0;
}
.tooltip-icon:hover { background: #0a5c5f; }
.tooltip-popover {
  position: fixed; z-index: 10000; width: 320px;
  background: #fff; border: 1px solid #d4d4d4; border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15); padding: 14px 16px;
  animation: tooltipFade 0.15s ease;
}
@keyframes tooltipFade { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }
.tooltip-popover-title { font-weight: 700; font-size: 13px; color: #1a2332; margin-bottom: 6px; }
.tooltip-popover-text { font-size: 12px; color: #555; line-height: 1.6; }

/* ============================================================
   CHAT ASSISTANT
   ============================================================ */
#chat-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  width: 56px; height: 56px; border-radius: 50%;
  background: #0d7377; color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(13,115,119,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
#chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(13,115,119,0.5); }

#chat-panel {
  position: fixed; bottom: 24px; right: 24px; z-index: 10001;
  width: 400px; height: 560px; max-height: 80vh;
  background: #fff; border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.2);
  display: flex; flex-direction: column;
  transition: opacity 0.2s, transform 0.2s;
}
#chat-panel.chat-hidden { display: none; }

.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: #1a2332; color: #fff;
  border-radius: 12px 12px 0 0; flex-shrink: 0;
}
.chat-header-left { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.chat-close { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 0 4px; }

#chat-messages {
  flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.chat-msg {
  max-width: 85%; padding: 10px 14px; border-radius: 12px;
  font-size: 13px; line-height: 1.55; word-wrap: break-word;
}
.chat-msg-user {
  align-self: flex-end; background: #0d7377; color: #fff; border-bottom-right-radius: 4px;
}
.chat-msg-assistant {
  align-self: flex-start; background: #f0f4f8; color: #333; border-bottom-left-radius: 4px;
}
.chat-msg-assistant strong { color: #1a2332; }

.chat-input-area {
  display: flex; padding: 12px; border-top: 1px solid #e8e8e8; gap: 8px; flex-shrink: 0;
}
.chat-input-area input {
  flex: 1; border: 1px solid #d4d4d4; border-radius: 8px; padding: 10px 12px;
  font-size: 13px; outline: none; transition: border-color 0.2s;
}
.chat-input-area input:focus { border-color: #0d7377; }
.chat-input-area button {
  background: #0d7377; border: none; color: #fff; border-radius: 8px;
  width: 40px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.chat-input-area button:hover { background: #0a5c5f; }

/* ============================================================
   GUIDED SETUP WIZARD
   ============================================================ */
#wizard-overlay {
  position: fixed; inset: 0; z-index: 10002;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
#wizard-overlay.wizard-hidden { display: none; }

.wizard-modal {
  background: #fff; border-radius: 16px; width: 600px; max-width: 92vw;
  max-height: 85vh; overflow-y: auto; position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25); padding: 32px 36px 24px;
}
.wizard-close {
  position: absolute; top: 12px; right: 16px; font-size: 24px;
  color: #999; cursor: pointer; background: none; border: none;
}
.wizard-close:hover { color: #333; }

.wizard-progress { margin-bottom: 24px; }
.wizard-dots { display: flex; justify-content: center; gap: 8px; }
.wizard-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #ddd; transition: background 0.2s, transform 0.2s;
}
.wizard-dot.active { background: #0d7377; transform: scale(1.3); }
.wizard-dot.completed { background: #0d7377; opacity: 0.5; }

.wizard-title { font-size: 22px; font-weight: 700; color: #1a2332; margin-bottom: 20px; text-align: center; }

.wizard-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.wizard-card {
  border: 2px solid #e8e8e8; border-radius: 12px; padding: 20px 12px;
  text-align: center; cursor: pointer; transition: all 0.2s;
  font-size: 13px; font-weight: 600; color: #333;
}
.wizard-card:hover { border-color: #0d7377; background: #f0fafa; }
.wizard-card.selected { border-color: #0d7377; background: #e6f5f5; }
.wizard-card-icon { font-size: 28px; margin-bottom: 8px; }

.wizard-cards-small { grid-template-columns: repeat(2, 1fr); }
.wizard-card-sm { padding: 16px; }
.wizard-card-title { font-size: 14px; font-weight: 700; color: #1a2332; }
.wizard-card-sub { font-size: 18px; font-weight: 700; color: #0d7377; margin: 4px 0; }
.wizard-card-hint { font-size: 11px; color: #888; font-weight: 400; }

.wizard-form { display: flex; flex-direction: column; gap: 16px; }
.wizard-form label { font-size: 13px; font-weight: 600; color: #555; display: flex; flex-direction: column; gap: 6px; }
.wizard-select, .wizard-input {
  padding: 10px 12px; border: 1px solid #d4d4d4; border-radius: 8px;
  font-size: 14px; outline: none; transition: border-color 0.2s;
}
.wizard-select:focus, .wizard-input:focus { border-color: #0d7377; }
.wizard-desc { font-size: 13px; color: #666; margin: 0; }

.wizard-input-group { display: flex; align-items: center; gap: 0; }
.wizard-input-group .wizard-input { border-radius: 0; flex: 1; }
.wizard-prefix { padding: 10px 12px; background: #f0f0f0; border: 1px solid #d4d4d4; border-radius: 8px 0 0 8px; font-size: 14px; color: #666; border-right: none; }
.wizard-suffix { padding: 10px 12px; background: #f0f0f0; border: 1px solid #d4d4d4; border-radius: 0 8px 8px 0; font-size: 12px; color: #888; border-left: none; }

.wizard-slider-container { display: flex; flex-direction: column; gap: 6px; }
.wizard-slider { width: 100%; accent-color: #0d7377; }
.wizard-slider-label { font-size: 14px; font-weight: 700; color: #0d7377; text-align: center; }

.wizard-stream-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.wizard-stream { display: flex; align-items: center; gap: 8px; }
.wizard-stream-num {
  width: 24px; height: 24px; border-radius: 50%; background: #0d7377;
  color: #fff; font-size: 12px; font-weight: 700; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.wizard-stream .wizard-input { flex: 1; }
.wizard-stream .wizard-select { width: 140px; }

.wizard-summary { text-align: center; padding: 20px 0; }
.wizard-summary-icon { font-size: 48px; color: #0d7377; margin-bottom: 16px; }
.wizard-summary p { font-size: 15px; color: #555; margin-bottom: 16px; }
.wizard-summary ul { text-align: left; font-size: 14px; color: #444; line-height: 2; list-style: none; padding: 0; }
.wizard-summary li::before { content: '→ '; color: #0d7377; font-weight: 700; }

.wizard-nav {
  display: flex; justify-content: space-between; margin-top: 24px;
  padding-top: 16px; border-top: 1px solid #eee;
}
.wizard-btn {
  padding: 10px 28px; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; border: none;
}
.wizard-btn-primary { background: #0d7377; color: #fff; }
.wizard-btn-primary:hover { background: #0a5c5f; }
.wizard-btn-secondary { background: #f0f0f0; color: #555; }
.wizard-btn-secondary:hover { background: #e0e0e0; }

/* ========================================
   PRICING PAGE
   ======================================== */

/* Pricing panel - override tab panel padding & allow scrolling */
#pricing.tab-panel {
  padding: 0;
}

.pricing-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 32px 64px;
}

/* Hero */
.pricing-hero {
  text-align: center;
  margin-bottom: 48px;
}

.pricing-hero-headline {
  font-size: 32px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.5px;
  margin-bottom: 12px;
  line-height: 1.2;
}

.pricing-hero-sub {
  font-size: 15px;
  color: var(--gray-500);
  max-width: 560px;
  margin: 0 auto 28px;
  line-height: 1.6;
}

/* Toggle */
.pricing-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--gray-100);
  padding: 6px 16px;
  border-radius: 999px;
}

.pricing-toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-400);
  cursor: pointer;
  transition: color 0.2s;
  user-select: none;
}

.pricing-toggle-label.active {
  color: var(--navy);
}

.pricing-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

.pricing-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.pricing-switch-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--gray-300);
  border-radius: 22px;
  transition: background 0.25s;
}

.pricing-switch-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.pricing-switch input:checked + .pricing-switch-slider {
  background: var(--teal);
}

.pricing-switch input:checked + .pricing-switch-slider::before {
  transform: translateX(18px);
}

.pricing-save-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--teal);
  background: rgba(13, 115, 119, 0.08);
  padding: 3px 8px;
  border-radius: 999px;
  opacity: 0.5;
  transition: opacity 0.25s;
}

.pricing-save-badge.active {
  opacity: 1;
}

/* Cards Grid */
.pricing-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 64px;
}

/* Card Base */
.pricing-card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.pricing-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

/* Popular card */
.pricing-card-popular {
  border-color: var(--teal);
  border-width: 2px;
  box-shadow: 0 4px 16px rgba(13, 115, 119, 0.12);
}

.pricing-card-popular:hover {
  box-shadow: 0 10px 28px rgba(13, 115, 119, 0.18);
}

.pricing-popular-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--teal);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 14px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Dark card (Institution) */
.pricing-card-dark {
  background: var(--navy);
  border-color: var(--navy);
  color: rgba(255,255,255,0.85);
}

.pricing-card-dark .pricing-card-name {
  color: var(--white);
}

.pricing-card-dark .pricing-card-subtitle {
  color: rgba(255,255,255,0.5);
}

.pricing-card-dark .pricing-amount {
  color: var(--white);
}

.pricing-card-dark .pricing-features li {
  color: rgba(255,255,255,0.7);
  border-color: rgba(255,255,255,0.08);
}

.pricing-card-dark .check-icon {
  color: var(--teal-light);
}

.pricing-card-dark:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* Card Header */
.pricing-card-header {
  margin-bottom: 16px;
}

.pricing-card-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 2px;
}

.pricing-card-subtitle {
  font-size: 12px;
  color: var(--gray-500);
  font-weight: 500;
}

/* Card Price */
.pricing-card-price {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.pricing-card-dark .pricing-card-price {
  border-color: rgba(255,255,255,0.1);
}

.pricing-amount {
  font-size: 36px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -1px;
  line-height: 1;
}

.pricing-amount-custom {
  font-size: 28px;
  letter-spacing: -0.5px;
}

.pricing-period {
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 500;
}

.pricing-card-dark .pricing-period {
  color: rgba(255,255,255,0.4);
}

/* Features List */
.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 auto;
  flex: 1;
}

.pricing-features li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 0;
  font-size: 12.5px;
  color: var(--gray-700);
  line-height: 1.4;
  border-bottom: 1px solid var(--gray-100);
}

.pricing-features li:last-child {
  border-bottom: none;
}

.check-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--teal);
  margin-top: 1px;
}

/* Card CTA */
.pricing-card-cta {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pricing-cta-note {
  font-size: 11px;
  color: var(--gray-400);
  font-weight: 500;
}

/* Buttons */
.pricing-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-main);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  width: 100%;
}

.pricing-btn-outline {
  background: transparent;
  color: var(--teal);
  border: 1.5px solid var(--teal);
}

.pricing-btn-outline:hover {
  background: rgba(13, 115, 119, 0.06);
}

.pricing-btn-solid {
  background: var(--teal);
  color: white;
}

.pricing-btn-solid:hover {
  background: var(--teal-light);
}

.pricing-btn-dark {
  background: var(--white);
  color: var(--navy);
  font-weight: 700;
}

.pricing-btn-dark:hover {
  background: var(--gray-100);
}

.pricing-btn-lg {
  padding: 14px 40px;
  font-size: 15px;
  width: auto;
  border-radius: 8px;
}

/* Section Title */
.pricing-section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
  margin-bottom: 28px;
  letter-spacing: -0.3px;
}

/* Comparison Table */
.pricing-comparison {
  margin-bottom: 64px;
}

.pricing-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
}

.pricing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pricing-table th {
  padding: 14px 16px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--navy);
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
}

.pricing-table th.pricing-table-feature {
  text-align: left;
  min-width: 200px;
}

.pricing-table th.pricing-table-highlight {
  background: rgba(13, 115, 119, 0.06);
  color: var(--teal-dark);
}

.pricing-table td {
  padding: 11px 16px;
  text-align: center;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  font-weight: 500;
}

.pricing-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--gray-800);
}

.pricing-table tbody tr:nth-child(even) {
  background: var(--gray-50);
}

.pricing-table tbody tr:hover {
  background: rgba(13, 115, 119, 0.03);
}

/* Highlight the Analyst column in the table */
.pricing-table td:nth-child(3) {
  background: rgba(13, 115, 119, 0.04);
}

.pricing-table tbody tr:nth-child(even) td:nth-child(3) {
  background: rgba(13, 115, 119, 0.06);
}

.pricing-check {
  color: var(--teal);
  font-size: 16px;
  font-weight: 700;
}

.pricing-dash {
  color: var(--gray-300);
  font-size: 14px;
}

/* FAQ */
.pricing-faq {
  margin-bottom: 64px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.pricing-faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pricing-faq-item {
  border-bottom: 1px solid var(--gray-200);
}

.pricing-faq-item:first-child {
  border-top: 1px solid var(--gray-200);
}

.pricing-faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-main);
  text-align: left;
  line-height: 1.4;
}

.pricing-faq-question:hover {
  color: var(--teal);
}

.pricing-faq-chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--gray-400);
  transition: transform 0.25s ease;
  margin-left: 16px;
}

.pricing-faq-item.open .pricing-faq-chevron {
  transform: rotate(180deg);
}

.pricing-faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.pricing-faq-item.open .pricing-faq-answer {
  max-height: 200px;
}

.pricing-faq-answer p {
  padding: 0 0 16px;
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.7;
}

/* Bottom CTA */
.pricing-bottom-cta {
  text-align: center;
  padding: 48px 0;
  background: var(--gray-50);
  border-radius: 12px;
  margin-bottom: 32px;
}

.pricing-bottom-cta h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 20px;
  letter-spacing: -0.3px;
}

/* Responsive */
@media (max-width: 1100px) {
  .pricing-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 600px) {
  .pricing-cards {
    grid-template-columns: 1fr;
  }
  
  .pricing-hero-headline {
    font-size: 24px;
  }
  
  .pricing-page {
    padding: 32px 16px 48px;
  }
}

/* ========================================
   UI POLISH — Production Quality Pass
   ======================================== */

/* --- 5. Sidebar active state: 3px teal left border + smooth hover --- */
.sidebar-item {
  transition: all 0.2s ease;
}

/* --- 6. Section headers: teal left border for visual hierarchy --- */
.section-header {
  border-left: 3px solid var(--teal);
}

/* --- 7. Total/subtotal rows: stronger styling in Projections --- */
.fm-table tr.row-total td {
  font-weight: 700;
  border-top: 2px solid var(--total-border);
  background: #E8EDF2;
}

.fm-table tr.row-total td:first-child {
  background: #E8EDF2;
}

/* --- 8. Margin/ratio rows: italic and muted --- */
.fm-table tr.row-margin td {
  font-style: italic;
  color: #666;
  font-size: 11px;
}

/* --- 9. DSCR color coding classes --- */
.dscr-green {
  color: #059669 !important;
  font-weight: 700;
}

.dscr-amber {
  color: #d97706 !important;
  font-weight: 600;
}

.dscr-red {
  color: #dc2626 !important;
  font-weight: 700;
}

/* --- 10. KPI cards: left border accent + box-shadow --- */
.kpi-card {
  border-left: 3px solid var(--teal);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.kpi-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.kpi-card::before {
  display: none;
}

/* --- 11. Narrative tab: paper-like container with shadow + teal section badges --- */
.narrative-document {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  max-width: 800px;
}

.narrative-section-number {
  background: var(--teal);
}

.narrative-section-header {
  border-left-color: var(--teal);
}

/* --- 12. Tab transitions: smooth fade on panel switching --- */
.tab-panel {
  animation: tabFadeIn 0.2s ease;
}

@keyframes tabFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- 13. Chat button: subtle pulse animation on first load (3 pulses) --- */
@keyframes chatPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(13, 115, 119, 0.4); }
  50% { box-shadow: 0 4px 20px rgba(13, 115, 119, 0.4), 0 0 0 8px rgba(13, 115, 119, 0.15); }
}

#chat-fab {
  animation: chatPulse 1.2s ease-in-out 3;
}

/* --- 14. Table scroll indicator: right edge gradient fade --- */
.section-content {
  position: relative;
}

.section-content::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.85));
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.section-content.has-scroll::after {
  opacity: 1;
}

/* --- 15. Content area shadow: subtle left border/inset shadow where it meets sidebar --- */
.main-content {
  box-shadow: inset 2px 0 8px rgba(0, 0, 0, 0.04);
}

/* --- Percentage input suffix styling --- */
.cell-editable {
  position: relative;
}

.input-suffix {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.fm-table .cell-editable {
  position: relative;
}

/* Adjust input padding when suffix is present */
.cell-editable:has(.input-suffix) input {
  padding-right: 18px;
}

/* --- Header company name subtle styling --- */
.header-company {
  font-size: 12px;
  color: var(--gray-400);
  font-weight: 500;
  margin-left: 12px;
}

/* --- Sidebar footer refinements --- */
.sidebar-footer-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.3);
  margin-bottom: 2px;
}

.sidebar-footer-name {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  margin-bottom: 2px;
}

.sidebar-version {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
}

/* ============================================================
   PROFESSIONAL POLISH PASS
   ============================================================ */

/* Global font */
body, * { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important; }
code, .monospace { font-family: 'JetBrains Mono', 'Consolas', monospace !important; }

/* Sidebar — active state with teal left border */
.sidebar-item.active {
  border-left: 3px solid #0d7377 !important;
  background: rgba(13, 115, 119, 0.12) !important;
  padding-left: 13px !important;
}
.sidebar-item {
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
}
.sidebar-item:hover {
  background: rgba(255,255,255,0.06) !important;
  border-left-color: rgba(13, 115, 119, 0.3);
}

/* Sidebar footer separator */
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.08) !important;
  padding-top: 14px !important;
  margin-top: auto !important;
}

/* Content area subtle shadow against sidebar */
.content {
  box-shadow: inset 3px 0 8px rgba(0,0,0,0.04);
}

/* Section headers — teal left accent */
.section-header, .collapsible-header {
  border-left: 3px solid #0d7377 !important;
}

/* Total/subtotal rows — stronger visual treatment */
.row-total td, tr.row-total td, .row-subtotal td {
  border-top: 2px solid #1a2332 !important;
  font-weight: 700 !important;
  background: #E8EDF2 !important;
}

/* Margin/ratio rows — italic and muted */
.row-margin td, .row-ratio td {
  font-style: italic !important;
  color: #666 !important;
}

/* Tab transitions */
.tab-panel {
  animation: tabFadeIn 0.25s ease;
}
@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* KPI cards — depth and accent */
.kpi-card, .stat-card {
  box-shadow: 0 2px 12px rgba(0,0,0,0.06) !important;
  border-left: 3px solid #0d7377 !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.kpi-card:hover, .stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important;
}

/* DSCR color coding */
.dscr-good { color: #2e7d32 !important; font-weight: 600; }
.dscr-warning { color: #f57c00 !important; font-weight: 600; }
.dscr-danger { color: #c62828 !important; font-weight: 600; }

/* Narrative — paper effect */
.narrative-container, #narrative .tab-panel-content {
  max-width: 860px;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 2px 24px rgba(0,0,0,0.08);
  border-radius: 8px;
  padding: 40px 48px;
}

/* Narrative section numbers */
.narrative-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #0d7377;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  margin-right: 10px;
  flex-shrink: 0;
}

/* Chat FAB pulse animation */
@keyframes chatPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(13,115,119,0.4); }
  50% { box-shadow: 0 4px 30px rgba(13,115,119,0.7); }
}
#chat-fab {
  animation: chatPulse 2s ease-in-out 3;
}

/* Table scroll indicator — gradient fade on right */
.table-scroll-wrapper {
  position: relative;
}
.table-scroll-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 40px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8));
  pointer-events: none;
  z-index: 2;
}

/* Pricing — Most Popular pulse */
.pricing-card.popular {
  position: relative;
  overflow: visible;
}
.pricing-card.popular::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px solid #0d7377;
  animation: popularGlow 3s ease-in-out infinite;
}
@keyframes popularGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(13,115,119,0); }
  50% { box-shadow: 0 0 16px 2px rgba(13,115,119,0.15); }
}

/* Button hover improvements */
.btn, button {
  transition: all 0.2s ease !important;
}
.btn:hover, .header-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Instrument cards — active state improvement */
.instrument-card.active, .instrument-btn.active {
  border-left: 4px solid #0d7377 !important;
  box-shadow: 0 4px 16px rgba(13,115,119,0.15) !important;
  transform: scale(1.02);
}

/* Better zebra striping for tables */
.data-table tbody tr:nth-child(even),
.fm-table tbody tr:nth-child(even) {
  background: #f8f9fb;
}

/* Responsive — smaller screens */
@media (max-width: 1200px) {
  .sidebar { width: 60px !important; }
  .sidebar-item span, .sidebar-label, .sidebar-footer, .logo-sub { display: none !important; }
  .sidebar-logo svg { width: 32px !important; }
  .sidebar-item { justify-content: center; padding: 10px 0 !important; }
  .content { margin-left: 60px !important; }
}

/* ========================================
   Benchmarking Tab
   ======================================== */

.bench-section {
  margin-bottom: 16px;
}

.bench-section .section-header {
  margin-bottom: 0;
}

.bench-section .section-content {
  padding: 16px 0;
}

/* Data Sources Info Box */
.bench-info-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 20px;
}

.bench-info-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 16px;
}

.bench-info-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.bench-info-col-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.bench-info-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.bench-info-list li {
  padding: 5px 0;
  font-size: 12px;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-100);
}

.bench-info-list li:last-child {
  border-bottom: none;
}

.bench-info-list li strong {
  color: var(--gray-800);
}

/* Comp Table */
.bench-comp-table input {
  width: 100%;
  border: none;
  background: var(--input-bg);
  padding: 4px 6px;
  font-size: 12px;
  font-family: var(--font-main);
  color: var(--input-text);
  border-radius: 3px;
}

.bench-comp-table input:focus {
  outline: 2px solid var(--teal);
  outline-offset: -1px;
}

/* KPI Tables */
.bench-kpi-block {
  margin-bottom: 20px;
}

.bench-kpi-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  padding: 8px 0 6px;
  border-bottom: 2px solid var(--teal);
  margin-bottom: 0;
}

.bench-kpi-collapsible {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  padding: 8px 6px 6px;
  border-radius: 4px 4px 0 0;
}

.bench-kpi-collapsible:hover {
  background: rgba(13, 115, 119, 0.04);
}

.bench-kpi-chevron {
  display: inline-block;
  transition: transform 0.2s;
  margin-right: 4px;
  font-size: 12px;
}

.bench-kpi-collapsible.collapsed .bench-kpi-chevron {
  transform: rotate(-90deg);
}

.bench-kpi-collapsible.collapsed {
  border-bottom-color: var(--gray-200);
}

.bench-kpi-hidden {
  display: none !important;
}

.bench-kpi-table {
  width: 100%;
}

.bench-kpi-table th {
  font-size: 11px;
  padding: 6px 10px;
}

.bench-kpi-table td {
  font-size: 12px;
  padding: 5px 10px;
}

.bench-kpi-table input.bench-kpi-input {
  width: 70px;
  border: none;
  background: var(--input-bg);
  padding: 3px 6px;
  font-size: 12px;
  font-family: var(--font-main);
  color: var(--input-text);
  text-align: right;
  border-radius: 3px;
}

.bench-kpi-table input.bench-kpi-input:focus {
  outline: 2px solid var(--teal);
  outline-offset: -1px;
}

.bench-kpi-table input.bench-your-input {
  background: rgba(13, 115, 119, 0.08);
  color: var(--teal-dark);
  font-weight: 500;
}

.bench-your-company-row {
  background: rgba(13, 115, 119, 0.04) !important;
}

.bench-your-company-row td {
  border-bottom: 2px solid rgba(13, 115, 119, 0.2);
}

.bench-your-cell {
  background: transparent !important;
}

.bench-avg-cell {
  font-weight: 600;
  color: var(--gray-700);
  background: var(--gray-50);
}

.bench-variance-row td {
  font-weight: 500;
  font-style: italic;
  font-size: 11px;
  background: var(--gray-50);
}

.bench-positive {
  color: var(--positive) !important;
}

.bench-negative {
  color: var(--negative) !important;
}

/* Charts */
.bench-chart-group-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-200);
}

.bench-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 8px;
}

.bench-chart-container {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 12px;
  height: 280px;
  position: relative;
}

.bench-chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Insights */
.bench-insights {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 16px;
}

.bench-insight-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}

.bench-insight-item:last-child {
  border-bottom: none;
}

.bench-insight-icon {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  background: var(--teal);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.bench-insight-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--gray-700);
}

.bench-insight-text strong {
  color: var(--gray-900);
}

@media (max-width: 900px) {
  .bench-info-columns {
    grid-template-columns: 1fr;
  }
  .bench-charts-grid {
    grid-template-columns: 1fr;
  }
}

/* Print styles */
@media print {
  .sidebar, #chat-fab, #chat-panel, .header-actions { display: none !important; }
  .content { margin-left: 0 !important; }
}

/* ============================================================
   EXPORT DROPDOWN
   ============================================================ */
.export-dropdown-wrap { position: relative; display: inline-block; }
.export-dropdown {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 6px;
  background: #fff; border: 1px solid #e0e0e0; border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15); z-index: 100; min-width: 240px;
  padding: 6px; overflow: hidden;
}
.export-dropdown.show { display: block; animation: dropIn 0.15s ease; }
@keyframes dropIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
.export-option {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  padding: 10px 14px; border: none; background: none; cursor: pointer;
  text-align: left; font-size: 13px; font-weight: 600; color: #1a2332;
  border-radius: 6px; transition: background 0.15s; flex-wrap: wrap;
}
.export-option:hover { background: #f0fafa; }
.export-option svg { flex-shrink: 0; margin-top: 2px; }
.export-desc {
  display: block; width: 100%; font-size: 11px; font-weight: 400;
  color: #888; margin-top: 2px; padding-left: 26px;
}

/* Fix Export dropdown clipping */
.content-header, header, .header-actions {
  overflow: visible !important;
}
.export-dropdown-wrap {
  position: relative;
  z-index: 1000;
}
.export-dropdown {
  z-index: 1001 !important;
  position: absolute !important;
  top: calc(100% + 4px) !important;
  right: 0 !important;
}

/* Export dropdown visibility controlled by inline style */

/* ============================================================
   NESTED EXPORT DROPDOWN — Two-level structure
   ============================================================ */

/* Widen the dropdown for multi-section layout */
#export-dropdown {
  min-width: 280px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 8px;
}

/* Section label (e.g., "Export Current Page") */
.export-section-label {
  font-size: 11px;
  font-weight: 700;
  color: #0d7377;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 8px 12px 4px;
  margin-top: 2px;
}

/* Submenu container */
.export-submenu {
  padding: 2px 0;
}

/* Sub-options are indented and smaller */
.export-sub-option {
  font-size: 12px !important;
  font-weight: 500 !important;
  padding: 7px 14px 7px 20px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  color: #333 !important;
}

.export-sub-option:hover {
  background: #e8f5f5 !important;
  color: #0d7377 !important;
}

/* Tab-specific sub-options (no icons) */
.export-tabs-submenu .export-sub-option {
  padding-left: 28px !important;
  font-size: 12px !important;
  color: #555 !important;
}

.export-tabs-submenu .export-sub-option:hover {
  background: #e8f5f5 !important;
  color: #0d7377 !important;
}

/* Separator between sections */
.export-separator {
  height: 1px;
  background: #e8edf2;
  margin: 6px 8px;
}

/* Print button */
.btn-print {
  color: var(--gray-500, #888);
}

.btn-print:hover {
  color: #0d7377;
}

/* ============================================================
   PRINT STYLESHEET — "Print This Page"
   ============================================================ */
@media print {
  /* Hide non-content elements */
  .sidebar { display: none !important; }
  .content-header { display: none !important; }
  .agent-chat-btn,
  .agent-chat-panel { display: none !important; }
  #scenario-modal { display: none !important; }

  /* Make main content full-width */
  .app-container { display: block !important; }
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .content-body {
    padding: 0 !important;
  }

  /* Print-friendly table styling */
  table {
    page-break-inside: avoid;
    border-collapse: collapse;
  }
  thead { display: table-header-group; }
  tr { page-break-inside: avoid; }

  /* Tab panels — only show active */
  .tab-panel { display: none !important; }
  .tab-panel.active { display: block !important; }

  /* Section cards shouldn't have shadows */
  .section-card, .card, [class*="card"] {
    box-shadow: none !important;
    border: 1px solid #e0e0e0 !important;
  }

  /* Print header/footer via CSS */
  @page {
    margin: 1.5cm;
    size: A4 portrait;
  }

  /* Add page numbers via CSS counter */
  body::after {
    content: "Financial Modelling Pro | Printed " attr(data-print-date);
    display: block;
    text-align: center;
    font-size: 9px;
    color: #aaa;
    border-top: 1px solid #e0e0e0;
    padding-top: 6px;
    margin-top: 20px;
  }
}


/* ============================================================
   FEATURE 1: DECISION INTELLIGENCE PANEL
   ============================================================ */
.di-panel {
  background: linear-gradient(135deg, #1a2332 0%, #0f1922 100%);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid rgba(13, 115, 119, 0.3);
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}

.di-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
  color: #fff;
}

.di-title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.di-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  margin-top: 2px;
}

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

.di-kpi-box {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 14px 16px;
  transition: background 0.2s;
}

.di-kpi-box:hover {
  background: rgba(255,255,255,0.1);
}

.di-kpi-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 6px;
}

.di-kpi-value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.di-kpi-value.di-positive { color: #34d399; }
.di-kpi-value.di-warning  { color: #fbbf24; }
.di-kpi-value.di-critical { color: #f87171; }
.di-kpi-value.di-neutral  { color: #93c5fd; }

.di-kpi-note {
  font-size: 10px;
  color: rgba(255,255,255,0.38);
}

.di-decisions {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 16px;
}

.di-decisions-title {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}

.di-bullet {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  line-height: 1.4;
}
.di-bullet:last-child { border-bottom: none; }
.di-bullet-positive { color: #34d399; }
.di-bullet-warning  { color: #fbbf24; }
.di-bullet-critical { color: #f87171; }

/* ============================================================
   FEATURE 4: ENHANCED KPI DASHBOARD
   ============================================================ */
.enh-kpi-section {
  margin-bottom: 24px;
}

.enh-kpi-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--teal);
  letter-spacing: -0.2px;
}

.enh-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.enh-kpi-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.enh-kpi-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.enh-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--teal);
}

.enh-kpi-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.enh-kpi-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.enh-kpi-trend {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}
.enh-kpi-trend.up     { color: var(--positive); }
.enh-kpi-trend.down   { color: var(--negative); }
.enh-kpi-trend.neutral { color: var(--gray-500); }

.enh-kpi-sub {
  font-size: 10px;
  color: var(--gray-400);
  margin-top: 3px;
}

.enh-kpi-runway-bar {
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  margin: 6px 0 3px;
  overflow: hidden;
}
.enh-kpi-runway-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* EBITDA Bridge */
.ebitda-bridge {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 16px 20px;
}

.ebitda-bridge-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.ebitda-bridge-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ebitda-bridge-row {
  display: grid;
  grid-template-columns: 110px 1fr 90px;
  align-items: center;
  gap: 12px;
}

.ebitda-bridge-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-600);
}

.ebitda-bridge-bar-wrap {
  height: 18px;
  background: var(--gray-100);
  border-radius: 3px;
  overflow: hidden;
}

.ebitda-bridge-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.ebitda-bridge-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--navy);
  text-align: right;
}

/* ============================================================
   FEATURE 2: SENSITIVITY ANALYSIS
   ============================================================ */
.sens-panel {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  margin-bottom: 24px;
  overflow: hidden;
}

.sens-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  color: var(--navy);
}

.sens-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}

.sens-subtitle {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}

.sens-body {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0;
}

.sens-sliders {
  padding: 20px;
  border-right: 1px solid var(--gray-200);
}

.sens-slider-group {
  margin-bottom: 18px;
}
.sens-slider-group:last-child { margin-bottom: 0; }

.sens-slider-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.sens-slider-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-700);
}

.sens-slider-val {
  font-size: 11px;
  font-weight: 700;
  color: var(--teal);
  min-width: 40px;
  text-align: right;
}

.sens-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--gray-200);
  outline: none;
  cursor: pointer;
}
.sens-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--teal);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.sens-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--teal);
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.sens-slider-range {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--gray-400);
  margin-top: 3px;
}

.sens-results {
  padding: 20px;
}

.sens-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 20px;
}
.sens-table th {
  background: var(--navy);
  color: #fff;
  padding: 7px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
}
.sens-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 12px;
  color: var(--gray-700);
}
.sens-row-base td { background: var(--gray-50); font-weight: 600; color: var(--navy); }
.sens-row-adj td  { background: #f0fafa; }
.sens-row-delta td { font-weight: 700; }

.sens-tornado {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 14px;
}

.sens-tornado-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 12px;
}

.sens-tornado-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.sens-tornado-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-600);
  white-space: nowrap;
}

.sens-tornado-bar-wrap {
  height: 20px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}

.tornado-bar {
  height: 100%;
  border-radius: 3px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 6px;
  transition: width 0.5s ease;
}
.tornado-bar.positive { background: #059669; }
.tornado-bar.negative { background: #dc2626; }

/* ============================================================
   FEATURE 3: RISK ASSESSMENT
   ============================================================ */
.risk-panel {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  margin-bottom: 24px;
  overflow: hidden;
}

.risk-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  color: var(--navy);
}

.risk-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}

.risk-subtitle {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}

.risk-composite-badge {
  margin-left: auto;
  flex-shrink: 0;
  border-radius: 8px;
  padding: 8px 14px;
  text-align: center;
  color: #fff;
  min-width: 90px;
}

.risk-composite-score {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.risk-composite-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.9;
}

.risk-bars {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.risk-bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 50px;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.risk-bar-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
}

.risk-bar-track {
  height: 10px;
  background: var(--gray-100);
  border-radius: 5px;
  overflow: hidden;
}

.risk-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease;
}

.risk-bar-score {
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.risk-bar-note {
  grid-column: 1 / -1;
  font-size: 10px;
  color: var(--gray-500);
  font-style: italic;
  margin-top: -6px;
  padding-left: 2px;
}


/* ============================================================
   MOBILE RESPONSIVE — Added for full mobile support
   Breakpoints: 480px (phone), 768px (tablet), 1024px (small desktop)
   ALL desktop layout is preserved — mobile changes only inside @media
   ============================================================ */

/* ---- Hamburger button: hidden on desktop, shown on mobile ---- */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  color: var(--gray-700);
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 8px;
  transition: background 0.15s ease;
}
.hamburger-btn:hover {
  background: var(--gray-100);
}

/* ---- Sidebar overlay for mobile ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* ============================================================
   TABLET  (≤ 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 200px;
  }
  .tab-panel {
    padding: 16px 20px 32px;
  }
}

/* ============================================================
   MOBILE (≤ 767px)
   ============================================================ */
@media (max-width: 767px) {

  /* --- App layout --- */
  .app-container {
    height: 100vh;
    overflow: hidden;
  }

  /* --- Sidebar: collapsed by default, slides in as overlay --- */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 56px !important;
    min-width: 56px !important;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.25s ease, width 0.25s ease;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* When toggled open on mobile, sidebar becomes full panel */
  .sidebar.mobile-open {
    width: var(--sidebar-width, 220px) !important;
    min-width: 220px !important;
    transform: translateX(0);
  }

  /* Hide labels/text when sidebar is in collapsed icon state */
  .sidebar:not(.mobile-open) .sidebar-logo div:last-child,
  .sidebar:not(.mobile-open) .sidebar-label,
  .sidebar:not(.mobile-open) .sidebar-item span,
  .sidebar:not(.mobile-open) .sidebar-footer,
  .sidebar:not(.mobile-open) .sidebar-footer-label,
  .sidebar:not(.mobile-open) .sidebar-footer-name,
  .sidebar:not(.mobile-open) .sidebar-version {
    display: none;
  }

  .sidebar:not(.mobile-open) .sidebar-item {
    justify-content: center;
    padding: 12px 8px;
  }

  .sidebar:not(.mobile-open) .sidebar-logo {
    padding: 16px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Main content takes full width since sidebar is overlaid */
  .main-content {
    width: 100%;
    margin-left: 0 !important;
    overflow: hidden;
  }

  /* --- Hamburger: show on mobile --- */
  .hamburger-btn {
    display: flex;
  }

  /* --- Header --- */
  .content-header {
    padding: 8px 12px;
    gap: 8px;
  }

  .header-left {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }

  .content-header h2 {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-company {
    display: none;
  }

  /* --- Header action buttons: compact on mobile --- */
  .header-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
  }

  /* Hide less-critical buttons on mobile */
  .header-actions .btn-undo,
  .header-actions .btn-print,
  .header-actions .btn-reset,
  .header-actions #agent-wizard-btn,
  .header-actions .currency-toggle-btn,
  .header-actions .btn-scenarios {
    display: none !important;
  }

  /* Keep only save + export visible */
  .header-actions .btn-save,
  .header-actions #export-toggle-btn {
    display: inline-flex !important;
  }

  .header-actions .btn {
    padding: 6px 10px;
    font-size: 11px;
    min-height: 36px;
  }

  /* Dividers in header */
  .content-header [style*="width:1px"] {
    display: none;
  }

  /* --- Tab panel padding --- */
  .tab-panel {
    padding: 12px 12px 32px;
  }

  /* --- Typography scale reduction --- */
  h1 { font-size: 22px !important; }
  h2 { font-size: 18px !important; }
  h3 { font-size: 14px !important; }

  /* --- Tables: horizontal scroll + sticky first column --- */
  .section-content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .fm-table {
    font-size: 11px;
    min-width: 600px;
  }

  .fm-table th,
  .fm-table td {
    padding: 5px 7px;
    font-size: 10px;
    height: 28px;
  }

  .fm-table th:first-child {
    min-width: 140px;
    width: 140px;
    background: var(--navy);
    z-index: 3;
  }

  .fm-table td:first-child {
    min-width: 140px;
    width: 140px;
    background: var(--white);
    z-index: 1;
  }

  .fm-table tr.row-total td:first-child,
  .fm-table tr.row-sub-header td:first-child {
    background: var(--gray-50);
  }

  /* Ensure section-content wrapper allows scroll */
  .section-group .section-content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* --- KPI Cards grid --- */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }

  .kpi-card {
    padding: 12px;
  }

  .kpi-card .kpi-value {
    font-size: 18px;
  }

  .kpi-card .kpi-label {
    font-size: 10px;
  }

  /* --- Deal grid: single column --- */
  .deal-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .deal-form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .param-form {
    grid-template-columns: 1fr;
  }

  /* --- Instrument selector: 2 columns --- */
  .instrument-selector {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* --- Sensitivity sliders: full width, label above --- */
  .sens-slider-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 8px;
  }

  .sens-slider-val {
    align-self: flex-end;
  }

  .sens-slider {
    width: 100%;
    height: 6px;
  }

  /* Touch target improvement for slider thumb */
  .sens-slider::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
  }
  .sens-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
  }

  /* --- Risk scoring bars: full width, stacked labels --- */
  .risk-bar-row {
    grid-template-columns: 1fr 50px;
    gap: 6px;
  }

  .risk-bar-name {
    grid-column: 1 / -1;
    font-size: 11px;
  }

  .risk-bar-track {
    grid-column: 1;
  }

  .risk-bar-score {
    grid-column: 2;
    text-align: right;
  }

  /* --- Narrative document --- */
  .narrative-document {
    margin: 8px;
    padding: 20px 16px;
    font-size: 12.5px;
  }

  .narrative-title {
    font-size: 18px;
  }

  .narrative-subtitle {
    font-size: 13px;
  }

  /* --- Export dropdown: left-align on mobile so it doesn't go off screen --- */
  .export-dropdown {
    right: auto;
    left: 0;
    min-width: 200px;
  }

  /* --- Wizard modal: full width on mobile --- */
  .wizard-modal {
    width: 96vw;
    max-width: 96vw;
    border-radius: 12px;
    margin: 0 auto;
  }

  /* --- Chat panel: full width/height on mobile (handled via agent.js CSS too) --- */
  #chat-panel {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 80vh !important;
    max-height: 80vh !important;
    border-radius: 16px 16px 0 0 !important;
    z-index: 10000 !important;
  }

  #chat-fab {
    width: 48px !important;
    height: 48px !important;
    bottom: 16px !important;
    right: 16px !important;
  }

  /* --- Touch targets: minimum 44px for all interactive elements --- */
  .sidebar-item {
    min-height: 44px;
  }

  .btn {
    min-height: 36px;
  }

  .instrument-tab {
    min-height: 36px;
  }
}

/* ============================================================
   SMALL PHONE (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {

  /* Tighten tab panel padding further */
  .tab-panel {
    padding: 8px 8px 28px;
  }

  /* KPI grid: 2 cols still works, but tighten */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .kpi-card .kpi-value {
    font-size: 16px;
  }

  /* Instrument selector: 2 cols */
  .instrument-selector {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Header title even more compact */
  .content-header h2 {
    font-size: 12px;
  }

  /* Section header */
  .section-header h3 {
    font-size: 10px;
  }

  /* Narrative document */
  .narrative-document {
    margin: 4px;
    padding: 16px 12px;
    font-size: 12px;
  }
}

/* ============================================================
   HOME PAGE — Inline-style overrides for cards/grids via class wrappers
   The intro tab uses inline styles; we override with .intro-responsive classes
   injected by JS. Alternatively we override the specific containers.
   ============================================================ */

/* CTA cards grid: responsive class added by JS */
@media (max-width: 767px) {
  .intro-cta-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .intro-feature-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .intro-steps-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 16px !important;
    align-items: start !important;
  }

  /* Hide the arrows between steps on mobile */
  .intro-steps-arrow {
    display: none !important;
  }

  /* Hero font sizes */
  .intro-hero h1 {
    font-size: 22px !important;
  }

  .intro-hero p {
    font-size: 14px !important;
  }
}

@media (max-width: 480px) {
  .intro-steps-row {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   BODY SCROLL LOCK when mobile sidebar is open
   ============================================================ */
body.sidebar-mobile-open {
  overflow: hidden;
}

/* ============================================================
   CHAT — Additional mobile touch improvements
   ============================================================ */
@media (max-width: 767px) {
  .chat-close {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    padding: 0 8px;
  }

  .chat-input-area {
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .chat-input-area input {
    font-size: 16px; /* Prevents iOS zoom on focus */
    padding: 12px;
    min-height: 44px;
  }

  .chat-input-area button {
    width: 44px;
    min-height: 44px;
    border-radius: 10px;
  }

  .chat-msg {
    font-size: 14px;
    padding: 10px 14px;
    max-width: 90%;
  }

  /* Ensure chat panel messages area scrolls properly */
  #chat-messages {
    -webkit-overflow-scrolling: touch;
  }
}

/* ============================================================
   MOBILE LAYOUT FIXES — content-body height
   ============================================================ */
@media (max-width: 767px) {
  .app-container {
    position: relative;
  }

  .content-body {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    height: calc(100vh - 57px); /* header height approx */
  }

  /* Fix for iOS safe area bottom padding */
  .tab-panel {
    padding-bottom: max(32px, calc(32px + env(safe-area-inset-bottom)));
  }

  /* Section-content table wrapper — critical for projection tables */
  .section-content,
  .table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  /* Deal grid responsive */
  .deal-grid {
    grid-template-columns: 1fr;
  }

  /* Instrument params full width */
  .instrument-params.active {
    overflow-x: auto;
  }

  /* Return highlight flexbox: wrap on small screens */
  .return-highlight {
    flex-wrap: wrap;
    gap: 12px;
  }

  .return-metric {
    min-width: calc(50% - 8px);
  }

  /* Pricing cards: already handled, make sure they stack */
  .pricing-cards {
    grid-template-columns: 1fr !important;
  }
}
