/* ============================================================================
   FinRubah Enterprise Planning Application — Stylesheet
   ----------------------------------------------------------------------------
   Palette mirrors the workbook: navy (#0F2A4A / #1E3A5F), gold (#C9A961),
   teal accent (#2A8F8A), light surfaces (#F4F6F8 / #EEF4FB).
   ============================================================================ */

:root {
  --navy-900: #0F2A4A;
  --navy-700: #1E3A5F;
  --navy-500: #2D4F7A;
  --gold:     #C9A961;
  --gold-dk:  #A88A47;
  --teal:     #2A8F8A;
  --ink:      #1A1A1A;
  --ink-2:    #5A6470;
  --line:     #E5EAEF;
  --surf-1:   #FFFFFF;
  --surf-2:   #F4F6F8;
  --surf-3:   #EEF4FB;
  --danger:   #C0392B;
  --success:  #2C8A4F;
  --warn:     #B98914;
  --shadow-1: 0 1px 2px rgba(15,42,74,0.05), 0 4px 12px rgba(15,42,74,0.06);
  --shadow-2: 0 4px 14px rgba(15,42,74,0.12);
  --radius:   8px;
  --font:     "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue",
              Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--surf-2);
  line-height: 1.45;
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
}

a { color: var(--navy-700); text-decoration: none; }
a:hover { color: var(--gold-dk); }

h1, h2, h3 { color: var(--navy-900); margin: 0 0 0.6em; }
h1 { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1.0rem; font-weight: 600; }

code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--surf-3);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ---------------------------------------------------------------------------
   Top bar
   --------------------------------------------------------------------------- */
.topbar {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 100%);
  color: #fff;
  border-bottom: 3px solid var(--gold);
}
.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  color: #fff;
}
.brand:hover { color: var(--gold); }
.brand-logo { width: 38px; height: 38px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-main {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}
.brand-sub {
  font-size: 0.72rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topnav { display: flex; gap: 4px; margin-left: auto; }
.navlink {
  color: rgba(255,255,255,0.9);
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.92rem;
  display: inline-block;
  transition: all 0.15s ease;
}
.navlink:hover {
  background: rgba(255,255,255,0.1);
  color: var(--gold);
}

.navdropdown { position: relative; }
.navdropdown-menu {
  position: absolute;
  top: 100%; left: 0;
  background: #fff;
  min-width: 220px;
  border-radius: 6px;
  box-shadow: var(--shadow-2);
  padding: 6px;
  display: none;
  z-index: 100;
}
.navdropdown:hover .navdropdown-menu { display: block; }
.navdropdown-menu a {
  display: block;
  padding: 8px 12px;
  color: var(--ink);
  border-radius: 4px;
  font-size: 0.9rem;
}
.navdropdown-menu a:hover { background: var(--surf-3); color: var(--navy-700); }

.userbox { display: flex; align-items: center; gap: 8px; margin-left: 16px; }
.usermeta { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.username { font-size: 0.85rem; color: #fff; font-weight: 500; }
.userrole {
  font-size: 0.65rem;
  padding: 1px 8px;
  border-radius: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}
.role-business_owner { background: var(--gold); color: var(--navy-900); }
.role-investor { background: var(--teal); color: #fff; }
.iconlink {
  background: rgba(255,255,255,0.1);
  border: 0;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem;
  cursor: pointer;
}
.iconlink:hover { background: rgba(255,255,255,0.22); color: var(--gold); }

/* ---------------------------------------------------------------------------
   Layout
   --------------------------------------------------------------------------- */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 24px 60px;
  flex: 1;
  width: 100%;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 24px;
  flex-wrap: wrap;
}
.page-header h1 { margin: 0 0 4px; }
.page-subtitle { color: var(--ink-2); margin: 0; max-width: 700px; }

/* ---------------------------------------------------------------------------
   Flash messages
   --------------------------------------------------------------------------- */
.flashes { margin-bottom: 18px; }
.flash {
  padding: 10px 16px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 0.92rem;
  border-left: 4px solid;
}
.flash-success { background: #E6F5EC; border-color: var(--success); color: #1F5A37; }
.flash-info    { background: #E6EEF7; border-color: var(--navy-700); color: var(--navy-900); }
.flash-warning { background: #FCF4E1; border-color: var(--warn);    color: #7C5E10; }
.flash-danger  { background: #FBE7E4; border-color: var(--danger);  color: #7C2519; }

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */
.btn {
  display: inline-block;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn-primary {
  background: var(--navy-700);
  color: #fff;
  border-color: var(--navy-700);
}
.btn-primary:hover { background: var(--navy-900); color: #fff; }
.btn-ghost {
  background: #fff;
  color: var(--navy-700);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--surf-3); border-color: var(--navy-500); }
.btn-block { width: 100%; }
.btn-large { padding: 14px 32px; font-size: 1rem; }

/* ---------------------------------------------------------------------------
   Login page
   --------------------------------------------------------------------------- */
.login-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: 72vh;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  margin-top: 32px;
}
@media (max-width: 900px) { .login-wrap { grid-template-columns: 1fr; } }

.login-card { padding: 48px; display: flex; flex-direction: column; justify-content: center; }
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand img { width: 70px; height: 70px; }
.login-brand h1 {
  font-size: 1.8rem; margin: 14px 0 4px;
  color: var(--navy-900);
}
.login-tagline { color: var(--gold-dk); letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.78rem; font-weight: 600; }

.login-form label { display: block; margin-bottom: 16px; }
.login-form span { display: block; font-size: 0.86rem; color: var(--ink-2); margin-bottom: 4px; font-weight: 500; }
.login-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
}
.login-form input:focus { outline: 2px solid var(--gold); outline-offset: -2px; border-color: var(--gold); }
.login-footer {
  margin-top: 28px;
  font-size: 0.82rem;
  color: var(--ink-2);
  text-align: center;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.login-side {
  background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-700) 100%);
  color: #fff;
  padding: 48px;
  display: flex; flex-direction: column; justify-content: center;
}
.login-side h2 { color: #fff; font-size: 1.4rem; margin-bottom: 24px; line-height: 1.3; }
.login-side ul { list-style: none; padding: 0; }
.login-side li { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 0.92rem; }
.login-side li strong { color: var(--gold); }
.login-side-foot { margin-top: 24px; color: var(--gold); font-size: 0.82rem; letter-spacing: 0.1em; }

/* ---------------------------------------------------------------------------
   Dashboard
   --------------------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.kpi {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-1);
  border-top: 3px solid var(--navy-700);
}
.kpi-highlight { border-top-color: var(--gold); background: linear-gradient(160deg, #FCF8EE 0%, #fff 100%); }
.kpi-scenario  { border-top-color: var(--teal); }
.kpi-label {
  font-size: 0.7rem; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 600; margin-bottom: 6px;
}
.kpi-value {
  font-size: 1.6rem; font-weight: 700;
  color: var(--navy-900);
  line-height: 1.1;
}
.kpi-sub { font-size: 0.78rem; color: var(--ink-2); margin-top: 6px; }

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.action-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-1);
  color: var(--ink);
  transition: all 0.18s ease;
  border: 1px solid transparent;
}
.action-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--navy-500);
  color: var(--ink);
}
.action-icon { font-size: 1.8rem; margin-bottom: 8px; }
.action-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--navy-900);
  margin-bottom: 4px;
}
.action-desc { color: var(--ink-2); font-size: 0.88rem; }
.action-card-accent {
  background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-700) 100%);
  color: #fff;
}
.action-card-accent .action-title { color: var(--gold); }
.action-card-accent .action-desc { color: rgba(255,255,255,0.85); }
.action-card-accent:hover { color: #fff; border-color: var(--gold); }

.audit-section {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-1);
}
.audit-table { width: 100%; border-collapse: collapse; }
.audit-table th, .audit-table td {
  text-align: left;
  padding: 8px 10px;
  font-size: 0.86rem;
  border-bottom: 1px solid var(--line);
}
.audit-table th { color: var(--ink-2); font-weight: 600; }

/* ---------------------------------------------------------------------------
   Inputs form
   --------------------------------------------------------------------------- */
.inputs-form .input-group {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 24px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-1);
  border: 0;
}
.inputs-form legend {
  font-weight: 700;
  color: var(--navy-900);
  font-size: 1.0rem;
  padding: 0 6px;
  background: #fff;
  border-left: 3px solid var(--gold);
  padding-left: 10px;
  margin-left: -10px;
}
.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 12px 28px;
  margin-top: 16px;
}
.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--surf-2);
}
.input-row label { display: flex; flex-direction: column; }
.input-label { font-weight: 500; color: var(--ink); font-size: 0.92rem; }
.input-notes { font-size: 0.76rem; color: var(--ink-2); margin-top: 3px; }
.input-cellref {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.7rem;
  color: var(--navy-500);
  background: var(--surf-3);
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  margin-top: 4px;
  width: fit-content;
}
.input-control { display: flex; align-items: center; gap: 8px; }
.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}
.input-with-unit input,
.input-control select {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-family: inherit;
  font-size: 0.92rem;
  background: #fff;
  width: 100%;
}
.input-with-unit input:focus,
.input-control select:focus { outline: 2px solid var(--gold); outline-offset: -2px; border-color: var(--gold); }
.input-with-unit input[readonly] { background: var(--surf-2); color: var(--ink-2); }
.input-unit {
  font-size: 0.78rem;
  color: var(--ink-2);
  margin-left: 8px;
  white-space: nowrap;
}
.input-modified-badge {
  color: var(--gold);
  font-size: 1.4rem;
  line-height: 1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin: 24px 0;
  padding: 18px 24px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.readonly-note { color: var(--ink-2); font-size: 0.9rem; margin: 0; }

/* ---------------------------------------------------------------------------
   Customer Ramp
   --------------------------------------------------------------------------- */
.ramp-form { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-1); }
.ramp-table-wrap { overflow-x: auto; }
.ramp-table { border-collapse: collapse; min-width: 100%; }
.ramp-table th, .ramp-table td {
  padding: 6px 4px;
  text-align: center;
  font-size: 0.82rem;
  border: 1px solid var(--line);
}
.ramp-table thead th {
  background: var(--navy-700);
  color: #fff;
  font-weight: 600;
  font-size: 0.74rem;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.ramp-country {
  background: var(--surf-3) !important;
  color: var(--navy-900) !important;
  font-weight: 700 !important;
  position: sticky; left: 0;
  z-index: 2;
}
.ramp-cell {
  width: 70px;
  padding: 5px 4px;
  border: 1px solid transparent;
  border-radius: 3px;
  text-align: right;
  font-family: inherit;
  font-size: 0.85rem;
  background: transparent;
}
.ramp-cell:focus { outline: 2px solid var(--gold); outline-offset: -2px; border-color: var(--gold); }
.ramp-cell.modified { background: #FCF8EE; color: var(--gold-dk); font-weight: 600; }

/* ---------------------------------------------------------------------------
   Export
   --------------------------------------------------------------------------- */
.export-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow-1);
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}
.export-icon { font-size: 3.5rem; margin-bottom: 12px; }
.export-card h2 { font-size: 1.4rem; margin-bottom: 12px; }
.export-card-bo .export-icon { color: var(--navy-700); }
.export-card-investor { border-top: 4px solid var(--gold); }
.export-card-investor .export-icon { color: var(--gold); }
.export-steps {
  text-align: left;
  max-width: 460px;
  margin: 16px auto;
  color: var(--ink-2);
  font-size: 0.92rem;
}
.export-steps li { padding: 4px 0; }
.export-note {
  font-size: 0.84rem;
  color: var(--ink-2);
  margin-top: 16px;
}
.contact-block {
  background: var(--surf-2);
  border-radius: 6px;
  padding: 16px;
  margin: 20px auto;
  max-width: 420px;
  text-align: left;
  font-size: 0.92rem;
}
.contact-line { color: var(--ink-2); font-size: 0.88rem; }

/* ---------------------------------------------------------------------------
   Profile
   --------------------------------------------------------------------------- */
.profile-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow-1);
  max-width: 520px;
}
.profile-form label { display: block; margin-bottom: 14px; }
.profile-form span { display: block; font-size: 0.86rem; color: var(--ink-2); margin-bottom: 4px; font-weight: 500; }
.profile-form input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
}
.profile-form input:focus { outline: 2px solid var(--gold); outline-offset: -2px; border-color: var(--gold); }
.profile-note { font-size: 0.84rem; color: var(--ink-2); margin-top: 12px; }

/* ---------------------------------------------------------------------------
   Error
   --------------------------------------------------------------------------- */
.error-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 60px;
  box-shadow: var(--shadow-1);
  text-align: center;
  max-width: 540px;
  margin: 60px auto;
}
.error-code {
  font-size: 4rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 12px;
}

.empty-state { background: #fff; padding: 40px; border-radius: var(--radius); text-align: center; color: var(--ink-2); }

/* ---------------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------------- */
.footer {
  background: var(--navy-900);
  color: rgba(255,255,255,0.85);
  padding: 20px 0;
  margin-top: auto;
  font-size: 0.84rem;
  border-top: 3px solid var(--gold);
}
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 0 24px; max-width: 1400px; margin: 0 auto; }
.footer-sub { color: rgba(255,255,255,0.6); font-size: 0.76rem; }

/* ============================================================================
   WORKBOOK VIEWER (v2)
   ----------------------------------------------------------------------------
   Renders the recalculated workbook faithfully: navy headers, alternating
   row fills, blue-text input cells.  Tab strip mirrors Excel sheet tabs.
   ============================================================================ */

.viewer-shell {
  margin: -8px -8px 0;
  /* The viewer needs more horizontal real estate than other pages */
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.viewer-title {
  margin: 0;
  font-size: 1.55rem;
}
.viewer-subtitle {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 0.92rem;
  max-width: 720px;
}
.viewer-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.viewer-restricted {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surf-3);
  color: var(--navy-700);
  font-size: 0.84rem;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

/* ── Sheet tab strip ────────────────────────────────────────── */
.viewer-tabs {
  background: linear-gradient(180deg, #FFFFFF 0%, #F4F6F8 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tab-group {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px dashed var(--line);
  padding: 4px 0 8px;
}
.tab-group:last-child { border-bottom: none; padding-bottom: 4px; }
.tab-group-label {
  flex: 0 0 168px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  padding-right: 8px;
  border-right: 2px solid var(--gold);
  text-align: right;
}
.tab-group-sheets {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.tab {
  display: inline-block;
  padding: 5px 11px;
  font-size: 0.78rem;
  background: #FFFFFF;
  color: var(--navy-700);
  border: 1px solid var(--line);
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}
.tab:hover {
  background: var(--surf-3);
  color: var(--navy-900);
  border-color: var(--navy-500);
}
.tab-active {
  background: var(--navy-700);
  color: #FFFFFF !important;
  border-color: var(--navy-900);
  font-weight: 600;
  box-shadow: 0 1px 0 var(--gold) inset, 0 1px 4px rgba(15,42,74,0.18);
}
.tab-active:hover {
  background: var(--navy-900);
  color: #FFFFFF;
}

/* ── Current sheet name banner ──────────────────────────────── */
.viewer-sheet-wrap {
  background: var(--surf-1);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.viewer-sheet-name {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 100%);
  color: #FFFFFF;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--gold);
}

.viewer-sheet-scroll {
  overflow-x: auto;
  background: #FAFBFC;
  padding: 12px;
}

/* ── The xlsx grid itself ───────────────────────────────────── */
.xlsx-grid {
  border-collapse: collapse;
  font-family: "Calibri", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 11px;
  background: #FFFFFF;
  table-layout: fixed;
  width: auto;       /* respect col widths from <colgroup> */
  margin: 0;
}
.xlsx-grid td {
  border: 1px solid #EBEEF2;
  padding: 4px 7px;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  /* default text color overridden by inline cell css when present */
  color: #1A1A1A;
}
.col-hidden { display: none; }

/* ── Charts ─────────────────────────────────────────────────── */
.viewer-charts {
  border-top: 1px solid var(--line);
  padding: 18px;
  background: var(--surf-1);
}
/* Inline chart strip rendered between row tables when a sheet's charts have
   anchor rows (Investor_Dashboard, OpEx, Revenue_Engine, etc.).  Mimics
   the visual rhythm of the Excel sheet where each section header is
   immediately followed by its chart. */
.viewer-inline-charts {
  padding: 18px;
  background: var(--surf-1);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.viewer-charts-heading {
  font-size: 1.0rem;
  margin: 0 0 14px;
  color: var(--navy-900);
  border-left: 3px solid var(--gold);
  padding-left: 10px;
}
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
}
.chart-card {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 16px;
  box-shadow: var(--shadow-1);
}
.chart-card-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--navy-900);
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}
.chart-canvas-wrap {
  position: relative;
  height: 260px;
}

/* ── Footnote strip ─────────────────────────────────────────── */
.viewer-footnote {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--surf-3);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  color: var(--ink-2);
  font-size: 0.86rem;
}
.viewer-footnote a {
  color: var(--navy-700);
  font-weight: 600;
}

/* ── Print styles — hide the chrome when printing the sheet ── */
@media print {
  .topbar, .footer, .viewer-tabs, .viewer-actions, .viewer-footnote { display: none !important; }
  .viewer-sheet-wrap { box-shadow: none; border: none; }
  .viewer-sheet-name { background: #FFFFFF !important; color: var(--navy-900) !important; }
  body, html { background: #FFFFFF; }
  .viewer-sheet-scroll { overflow: visible; padding: 0; }
}

/* ── Recalc warning banner ──────────────────────────────────── */
.recalc-warning {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: #FFF8E6;
  border: 1px solid #E5C66B;
  border-left: 4px solid var(--gold-dk);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 14px;
  color: #6B4F0E;
  font-size: 0.88rem;
  line-height: 1.5;
}
.recalc-warning-icon {
  font-size: 1.4rem;
  line-height: 1;
  color: var(--gold-dk);
  flex-shrink: 0;
}
.recalc-warning-body strong { color: #4A370A; }
.recalc-warning-body a {
  color: var(--navy-700);
  font-weight: 600;
  text-decoration: underline;
}

/* RESPONSIVE_TABLES_FIX_v3 */
/* Make wide sheet tables stay inside the viewer-shell on smaller laptops.
   The inner table preserves its column widths; the scroll container
   shows a scrollbar only when truly required. */
.viewer-sheet-wrap {
  max-width: 100%;
  box-sizing: border-box;
}
.viewer-sheet-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.viewer-inline-charts {
  /* Inline chart blocks should never push the page wider than the parent. */
  max-width: 100%;
  box-sizing: border-box;
}
.viewer-inline-charts .charts-grid {
  width: 100%;
}

/* FIXED_TABLE_LAYOUT_v3 */
/* Force the table to honour its declared column widths so a single
   long-content cell (e.g. the funding-text formula) cannot widen its
   column past the viewport.  Content that exceeds the declared width
   wraps to multiple lines instead. */
.xlsx-grid {
  table-layout: fixed;
}
.xlsx-grid td {
  overflow-wrap: break-word;
  word-wrap: break-word;
}
