:root {
  --ink: #101828;
  --muted: #5b6b84;
  --brand: #2563eb;
  --brand-dark: #0b2447;
  --brand-light: #eaf1ff;
  --brand-soft: #dbeafe;
  --line: #dbe4f0;
  --paper: #f5f8fc;
  --surface: #ffffff;

  --bs-primary: var(--brand);
  --bs-primary-rgb: 37, 99, 235;
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: var(--bs-primary-rgb);
  --bs-link-hover-color: #1d4ed8;
  --bs-link-hover-color-rgb: 29, 78, 216;
  --bs-body-color: var(--ink);
  --bs-border-color: var(--line);
  --bs-border-radius: 0.6rem;
  --bs-border-radius-sm: 0.45rem;
  --bs-border-radius-lg: 0.85rem;
  --bs-focus-ring-color: rgba(37, 99, 235, 0.25);

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 10px 30px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, 0.14);
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a {
  transition: color 0.15s ease;
}

.app-nav {
  background: var(--brand-dark);
  box-shadow: var(--shadow-md);
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.app-nav .btn {
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.app-nav .btn:hover {
  transform: translateY(-1px);
}

.page-heading,
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

h1 {
  font-size: clamp(1.8rem, 2.5vw, 2.6rem);
  font-weight: 750;
}

h2 {
  font-size: 1.2rem;
  font-weight: 720;
}

h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 1rem;
}

.eyebrow {
  color: var(--brand);
  font-size: 0.78rem;
  text-transform: uppercase;
  font-weight: 750;
  letter-spacing: 0;
  margin-bottom: 0.2rem;
}

.btn {
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 0 0 0 rgba(37, 99, 235, 0);
}

.btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.btn-outline-primary:hover {
  transform: translateY(-1px);
}

.surface,
.empty-state,
.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
}

.narrow {
  max-width: 780px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.kpi {
  min-height: 112px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.kpi:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kpi span {
  color: var(--muted);
  display: block;
  font-size: 0.9rem;
}

.kpi strong {
  display: block;
  font-size: 1.55rem;
  margin-top: 1.2rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1rem;
}

.signal {
  border-radius: 8px;
  margin-bottom: 0.75rem;
  padding: 0.85rem 1rem;
  font-weight: 700;
}

.signal.green { background: #dcfce7; color: #166534; }
.signal.yellow { background: #fef9c3; color: #854d0e; }
.signal.red { background: #fee2e2; color: #991b1b; }

.recommendation {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  min-height: 110px;
  margin-bottom: 1rem;
}

.news-board .section-head {
  padding-bottom: 0.75rem;
}

.news-board .section-head h2 {
  margin-bottom: 0;
}

.news-list {
  border-top: 1px solid var(--line);
}

.news-item {
  position: relative;
  padding: 1.15rem 0 1.15rem 1rem;
  border-bottom: 1px solid var(--line);
}

.news-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.news-item::before {
  position: absolute;
  inset: 1.15rem auto 1.15rem 0;
  width: 3px;
  content: "";
  background: var(--brand);
}

.news-item.important::before {
  background: #c2413b;
}

.news-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.news-priority {
  color: #991b1b;
  font-weight: 750;
  text-transform: uppercase;
}

.news-item h3 {
  margin: 0.35rem 0 0.45rem;
  font-size: 1.05rem;
}

.news-body {
  max-width: 900px;
  color: var(--ink);
  line-height: 1.55;
}

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

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.tool-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 260px;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.tool-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-soft);
  transform: translateY(-3px);
}

.table {
  --bs-table-color: var(--ink);
}

.table thead th {
  background: var(--brand-light);
  color: var(--brand-dark);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 0;
}

.table > :not(caption) > * > * {
  border-bottom-color: var(--line);
}

.table tbody tr:hover {
  background-color: var(--brand-light);
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.month-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 190px;
  padding: 1rem;
}

.month-tile.done {
  border-color: #16a34a;
}

.month-tile.error {
  border-color: #dc2626;
}

.month-tile span {
  color: var(--muted);
  display: block;
  font-size: 0.85rem;
}

.month-tile p {
  color: var(--muted);
  flex: 1;
  font-size: 0.9rem;
  margin: 0;
}

.preline {
  white-space: pre-line;
}

.cash-flow-report {
  overflow: hidden;
  padding: 0;
}

.cash-flow-title {
  background: var(--brand-dark);
  color: white;
  padding: 0.65rem 1rem;
  text-align: center;
}

.cash-flow-title h2 {
  font-size: 1.5rem;
  margin: 0;
  text-transform: uppercase;
}

.cash-flow-source {
  color: var(--muted);
  font-style: italic;
  margin: 0;
  padding: 0.5rem 1rem;
}

.cash-flow-report > .alert,
.cash-flow-report > h3,
.cash-flow-report > .cash-flow-evidence,
.cash-flow-report > .cash-flow-legacy,
.cash-flow-summary {
  margin-left: 1rem;
  margin-right: 1rem;
}

.cash-flow-columns {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 1rem;
}

.cash-flow-block h3,
.cash-flow-quick h3 {
  background: var(--brand-dark);
  color: white;
  font-size: 1.05rem;
  margin: 0;
  padding: 0.35rem 0.5rem;
  text-transform: uppercase;
}

.cash-flow-block table,
.cash-flow-quick table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
}

.cash-flow-block th,
.cash-flow-block td,
.cash-flow-quick th,
.cash-flow-quick td {
  border: 1px solid var(--line);
  padding: 0.35rem 0.5rem;
}

.cash-flow-block th,
.cash-flow-quick th {
  background: var(--brand-light);
  color: var(--brand-dark);
  text-align: center;
}

.cash-flow-block th:last-child,
.cash-flow-block td:last-child {
  width: 40%;
}

.cash-value {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.cash-flow-block tr.total td,
.cash-flow-quick tr.result td {
  font-weight: 700;
}

.cash-flow-block tr.result td,
.cash-flow-quick tr.result td {
  background: #fde6d8;
  font-weight: 700;
}

.cash-flow-block tr.available td {
  background: #e2f0d9;
  font-weight: 700;
}

.cash-value.negative {
  color: #d00000;
}

.cash-flow-quick {
  max-width: 900px;
  padding: 1rem;
}

.cash-flow-note {
  background: #fff3cd;
  color: #795500;
  font-style: italic;
  margin: 1rem 0 0;
  padding: 0.8rem 1rem;
}

.source-preview {
  border-block: 1px solid var(--line);
  margin: 1.25rem 0;
  padding: 1rem 0;
}

.source-preview-heading,
.validation-summary-main {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.source-preview-heading div {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.source-preview-heading span,
.source-preview-heading small,
.source-preview-items small {
  color: var(--muted);
}

.source-preview-heading strong {
  overflow-wrap: anywhere;
}

.source-preview > p {
  margin: 0.8rem 0 0;
}

.source-preview-items {
  border-top: 1px solid var(--line);
  list-style: none;
  margin: 0.8rem 0 0;
  max-height: 15rem;
  overflow: auto;
  padding: 0;
}

.source-preview-items li {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 0.55rem 0;
}

.source-preview-warning {
  color: #8a5a00;
  font-size: 0.9rem;
}

.validation-summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid #b7791f;
  border-radius: 8px;
  padding: 1.15rem;
}

.validation-summary.validation-reconciled {
  border-left-color: #16835b;
}

.validation-summary-main h2 {
  font-size: 1.35rem;
  margin: 0;
}

.validation-summary-main p:last-child {
  color: var(--muted);
  margin: 0.35rem 0 0;
}

.validation-score {
  align-items: baseline;
  background: #eef7f2;
  border: 1px solid #b9ddcd;
  color: #146c4c;
  display: flex;
  flex: 0 0 7rem;
  justify-content: center;
  min-height: 4.5rem;
  padding: 0.75rem;
}

.validation-requires_review .validation-score {
  background: #fff8e6;
  border-color: #ead39b;
  color: #805500;
}

.validation-score strong {
  font-size: 1.65rem;
}

.validation-counts {
  border-block: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 1rem 0 0;
}

.validation-counts div {
  padding: 0.75rem 0;
}

.validation-counts dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.validation-counts dd {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

.validation-details {
  margin-top: 0.9rem;
}

.validation-details summary {
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 700;
}

.validation-check {
  border: 1px solid currentColor;
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
}

.validation-check-pass {
  color: #146c4c;
}

.validation-check-warning,
.validation-check-skipped {
  color: #805500;
}

.validation-check-fail {
  color: #a12424;
}

.executive-summary-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.executive-summary-header h2 {
  margin: 0;
  font-size: 1.45rem;
}

.executive-summary-header > span {
  color: var(--muted);
  font-weight: 700;
}

.executive-summary-overview {
  max-width: 980px;
  padding: 1.25rem 0;
  font-size: 1.02rem;
  line-height: 1.65;
}

.executive-summary-overview p:last-child {
  margin-bottom: 0;
}

.executive-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.executive-summary-section {
  padding-top: 0.9rem;
  border-top: 4px solid var(--line);
}

.executive-summary-section.risks {
  border-color: #c2413b;
}

.executive-summary-section.opportunities {
  border-color: #18835e;
}

.executive-summary-section.recommendations {
  border-color: var(--brand);
}

.executive-summary-section h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.executive-summary-section ol {
  margin: 0;
  padding-left: 1.25rem;
}

.executive-summary-section li {
  margin-bottom: 0.65rem;
  line-height: 1.45;
}

.executive-summary-section p {
  color: var(--muted);
}

.tutorial-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.tutorial-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tutorial-media {
  aspect-ratio: 16 / 9;
  background: #0f172a;
  border-radius: 8px;
  overflow: hidden;
}

.tutorial-media video,
.tutorial-media iframe {
  border: 0;
  display: block;
  height: 100%;
  width: 100%;
}

.upload-guidance {
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
}

.upload-guidance p {
  color: var(--muted);
}

.guidance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.guidance-grid ul {
  margin-bottom: 0;
  padding-left: 1.15rem;
}

.guidance-note {
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: 8px;
  color: #854d0e;
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
}

.chat-context {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  margin-bottom: 1rem;
  padding-bottom: 1rem;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 58vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.chat-message {
  display: flex;
  flex-direction: column;
  max-width: min(760px, 92%);
}

.chat-message.user {
  align-self: flex-end;
}

.chat-message.assistant {
  align-self: flex-start;
}

.chat-meta {
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}

.chat-bubble {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.chat-message.user .chat-bubble {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.chat-message.assistant .chat-bubble {
  background: var(--brand-light);
}

.chat-form {
  border-top: 1px solid var(--line);
  margin-top: 1.25rem;
  padding-top: 1.25rem;
}

.empty-chat {
  color: var(--muted);
  padding: 1.25rem 0;
}

.login-shell {
  position: relative;
  isolation: isolate;
  min-height: calc(100vh - 94px);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: clamp(1.5rem, 5vw, 5rem) clamp(1.5rem, 7vw, 7rem);
  background: url("../img/login-finance.bbad1010be95.jpg") center center / cover no-repeat;
}

.login-shell::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background: linear-gradient(160deg, rgba(11, 36, 71, 0.72), rgba(11, 36, 71, 0.42));
}

.login-page main {
  padding: 0 !important;
}

.login-panel {
  width: min(470px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 24px 70px rgba(7, 25, 33, 0.28);
  backdrop-filter: blur(8px);
}

.login-panel > div {
  text-align: center;
}

.login-panel .text-secondary {
  max-width: 36ch;
  margin: 0 auto;
}

.login-form .form-control {
  min-height: 46px;
}

.login-form .btn-primary {
  min-height: 46px;
}

.logo-brand {
  display: inline-flex;
  align-items: center;
  min-height: 64px;
  padding: 0;
}

.logo-brand img {
  display: block;
  height: 78px;
  width: auto;
  max-width: 280px;
  object-fit: contain;
}

.login-logo {
  display: block;
  width: min(320px, 88%);
  height: auto;
  margin: 0.45rem auto 1rem;
}

.auth-wide {
  max-width: 1080px;
  margin: 0 auto;
}

.signup-form {
  display: grid;
  gap: 1.5rem;
}

.form-section {
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.signup-form .errorlist {
  color: #991b1b;
  font-size: 0.85rem;
  margin: 0.35rem 0 0;
  padding-left: 1rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.billing-panel {
  display: grid;
  gap: 1.25rem;
}

.billing-status-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.status-pill.pending,
.status-pill.past_due {
  background: #fef9c3;
  color: #854d0e;
}

.status-pill.active {
  background: #dcfce7;
  color: #166534;
}

.status-pill.blocked,
.status-pill.canceled {
  background: #fee2e2;
  color: #991b1b;
}

.billing-price {
  min-width: 220px;
  text-align: right;
}

.billing-price span,
.billing-details dt {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
}

.billing-price strong {
  display: block;
  font-size: 1.5rem;
}

.billing-details {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
}

.billing-details dd {
  margin: 0.2rem 0 0;
}

.billing-blocked {
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
}

.report-loading {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(11, 24, 47, 0.58);
}

.report-loading[hidden] {
  display: none;
}

.report-loading-panel {
  display: flex;
  align-items: flex-start;
  gap: 1.15rem;
  width: min(560px, 100%);
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.report-loading-panel strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 1.05rem;
}

.report-loading-panel p {
  margin: 0;
  color: var(--muted);
}

.report-loading-body {
  min-width: 0;
}

.report-loading-spinner {
  flex: none;
  width: 64px;
  height: 64px;
  animation: report-loading-spin 1.1s steps(12) infinite;
}

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

/* Frase rotativa sobre la utilidad de la herramienta. */
.report-loading-tip {
  margin-top: 0.85rem !important;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  min-height: 3.4rem;
  color: var(--ink) !important;
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.report-loading-tip.is-visible {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .report-loading-spinner {
    animation-duration: 3s;
  }

  .report-loading-tip {
    transition: none;
  }
}

@media (max-width: 560px) {
  .report-loading-panel {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

.tool-features {
  margin: 1rem 0 1.5rem;
  padding-left: 1.15rem;
  color: var(--ink);
}

.tool-features li {
  margin-bottom: 0.55rem;
}

.strategic-report-header {
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.strategic-report-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.strategic-summary {
  max-width: 1050px;
  margin: 1.25rem 0;
  line-height: 1.65;
}

.strategic-table {
  table-layout: fixed;
}

.strategic-table th {
  background: var(--brand-light);
  color: var(--brand-dark);
}

.strategic-table th:nth-child(1) { width: 17%; }
.strategic-table th:nth-child(2),
.strategic-table th:nth-child(3),
.strategic-table th:nth-child(4) { width: 13%; }

.strategic-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.strategic-columns > div {
  border-top: 3px solid var(--brand);
  padding-top: 0.75rem;
}

.strategic-columns h3 {
  margin-top: 0;
}

.strategic-columns ul,
.strategic-columns ol {
  margin: 0;
  padding-left: 1.2rem;
}

.strategic-columns li {
  margin-bottom: 0.55rem;
}

.strategic-limitations {
  margin-top: 1.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid #e6cf7a;
  border-radius: 8px;
  background: #fff8d8;
  color: #6b5700;
}

.strategic-limitations ul {
  margin: 0.45rem 0 0;
}

.valuation-form-shell {
  max-width: 980px;
}

.valuation-intro,
.valuation-files {
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.valuation-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 2rem;
  align-items: center;
}

.valuation-hero p:last-child {
  max-width: 850px;
  margin-bottom: 0;
  line-height: 1.65;
}

.valuation-range {
  padding-left: 1.5rem;
  border-left: 4px solid var(--brand);
}

.valuation-range span,
.valuation-range small,
.kpi small {
  display: block;
  color: var(--muted);
}

.valuation-range strong {
  display: block;
  margin: 0.25rem 0;
  font-size: 1.65rem;
  font-variant-numeric: tabular-nums;
}

.valuation-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.valuation-kpis .kpi strong {
  font-size: 1.2rem;
}

.method-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.valuation-table th {
  background: var(--brand-light);
  color: var(--brand-dark);
  white-space: nowrap;
}

.source-list {
  display: grid;
  gap: 0.75rem;
  padding-left: 1.25rem;
}

.source-list a,
.source-list span {
  display: block;
}

.source-list span {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.valuation-disclaimer {
  max-width: 950px;
  padding: 0.9rem 1rem;
  border-left: 4px solid #c28a16;
  background: #fff8d8;
  color: #6b5700;
  font-size: 0.9rem;
}

.app-nav .container-fluid,
.app-nav .d-flex {
  flex-wrap: wrap;
}

/* ---------- Asistente virtual Lumina ---------- */

.lumina {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 1090;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

.lumina-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.8rem 1.15rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  font-weight: 650;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.lumina-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 38px rgba(37, 99, 235, 0.45);
}

.lumina-toggle-icon {
  display: inline-flex;
}

.lumina.is-open .lumina-toggle {
  display: none;
}

.lumina-panel {
  display: flex;
  flex-direction: column;
  width: min(410px, calc(100vw - 2rem));
  max-height: min(640px, calc(100vh - 6rem));
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.lumina-panel[hidden] {
  display: none;
}

.lumina-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  background: linear-gradient(135deg, var(--brand-dark) 0%, #123a6d 100%);
  color: #fff;
}

.lumina-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.lumina-eyebrow {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.75);
}

.lumina-close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  padding: 0 0.25rem;
  opacity: 0.85;
}

.lumina-close:hover {
  opacity: 1;
}

.lumina-thread {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  flex: 1;
  min-height: 220px;
  overflow-y: auto;
  padding: 1.15rem;
  background: var(--paper);
}

.lumina-message {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}

.lumina-message.user {
  align-self: flex-end;
  align-items: flex-end;
}

.lumina-message.assistant {
  align-self: flex-start;
}

.lumina-meta {
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.lumina-bubble {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 0.92rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* El mensaje del usuario es texto plano y conserva sus saltos de linea. */
.lumina-message.user .lumina-bubble {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  white-space: pre-wrap;
}

.lumina-bubble p {
  margin: 0 0 0.6rem;
}

.lumina-bubble p:last-child {
  margin-bottom: 0;
}

.lumina-bubble ul,
.lumina-bubble ol {
  margin: 0 0 0.6rem;
  padding-left: 1.25rem;
}

.lumina-bubble ul:last-child,
.lumina-bubble ol:last-child {
  margin-bottom: 0;
}

.lumina-bubble li {
  margin-bottom: 0.3rem;
}

.lumina-bubble li:last-child {
  margin-bottom: 0;
}

.lumina-bubble strong {
  font-weight: 700;
  color: var(--brand-dark);
}

.lumina-bubble code {
  padding: 0.1rem 0.35rem;
  border-radius: 5px;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-size: 0.85em;
}

.lumina-typing .lumina-bubble {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.lumina-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: lumina-blink 1.2s infinite ease-in-out;
}

.lumina-dot:nth-child(2) {
  animation-delay: 0.18s;
}

.lumina-dot:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes lumina-blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

.lumina-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.75rem 1.15rem 0;
}

.lumina-suggestions button {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.lumina-suggestions button:hover {
  background: var(--brand-light);
  border-color: var(--brand-soft);
}

.lumina-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  padding: 0.85rem 1.15rem 0.5rem;
}

.lumina-form textarea {
  flex: 1;
  min-height: 44px;
  max-height: 130px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: inherit;
  resize: none;
}

.lumina-form textarea:focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--bs-focus-ring-color);
}

.lumina-form .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 10px;
}

.lumina-disclaimer {
  margin: 0;
  padding: 0 1.15rem 0.9rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

@media (max-width: 480px) {
  .lumina-panel {
    max-height: calc(100vh - 4.5rem);
  }

  .lumina-toggle-label {
    display: none;
  }
}

/* ---------- Panel de inicio ---------- */

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.health-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.health-score {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.health-score strong {
  font-size: 2.9rem;
  font-weight: 750;
  line-height: 1;
}

.health-score span {
  color: var(--muted);
  font-size: 0.9rem;
}

.health-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.health-badge.green { background: #dcfce7; color: #166534; }
.health-badge.yellow { background: #fef9c3; color: #854d0e; }
.health-badge.red { background: #fee2e2; color: #991b1b; }

.health-components {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.health-components li {
  font-size: 0.85rem;
}

.health-components .bar {
  height: 6px;
  margin-top: 0.3rem;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.health-components .bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--brand);
}

.trend-card {
  min-height: 300px;
}

.trend-chart-wrap {
  position: relative;
  height: 280px;
  margin-top: 0.75rem;
}

.kpi .delta {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.kpi .delta.up { color: #166534; }
.kpi .delta.down { color: #991b1b; }

/* ---------- Sala de escenarios ---------- */

.scenario-layout {
  display: grid;
  grid-template-columns: minmax(0, 330px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  margin-top: 1rem;
}

.driver-group {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.driver-group:last-of-type {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.driver {
  margin-bottom: 1.1rem;
}

.driver-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
}

.driver-head label {
  font-size: 0.88rem;
  font-weight: 600;
}

.driver-value {
  color: var(--brand);
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.driver input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
}

.driver small {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.driver input[type="number"] {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
}

.scenario-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.scenario-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-top: 4px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.scenario-card.pesimista { border-top-color: #dc2626; }
.scenario-card.base { border-top-color: var(--brand); }
.scenario-card.optimista { border-top-color: #16a34a; }

.scenario-card h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.scenario-card .amount {
  display: block;
  font-size: 1.3rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.scenario-card .amount.negative { color: #d00000; }

.scenario-card dl {
  display: grid;
  gap: 0.4rem;
  margin: 0.75rem 0 0;
  font-size: 0.83rem;
}

.scenario-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.scenario-card dt {
  color: var(--muted);
  font-weight: 500;
}

.scenario-card dd {
  margin: 0;
  font-weight: 650;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.scenario-card .break {
  color: #991b1b;
}

.scenario-chart-wrap {
  position: relative;
  height: 340px;
  margin-top: 0.75rem;
}

.scenario-baseline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  background: var(--brand-light);
  font-size: 0.85rem;
}

.scenario-baseline strong {
  display: block;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.scenario-narrative {
  white-space: pre-line;
  line-height: 1.6;
}

/* Cuando el texto se convierte a bloques reales ya no hace falta pre-line. */
.scenario-narrative.is-rich {
  white-space: normal;
}

.scenario-narrative p {
  margin-bottom: 0.85rem;
}

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

.scenario-narrative ul,
.scenario-narrative ol {
  margin-bottom: 0.85rem;
  padding-left: 1.3rem;
}

.scenario-narrative li {
  margin-bottom: 0.4rem;
}

.scenario-narrative strong {
  color: var(--brand-dark);
}

@media (max-width: 1100px) {
  .scenario-layout,
  .overview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .scenario-cards,
  .scenario-baseline {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .kpi-grid,
  .detail-grid,
  .executive-summary-grid,
  .guidance-grid,
  .form-grid,
  .billing-details,
  .tool-grid,
  .month-grid,
  .tutorial-grid,
  .strategic-columns,
  .valuation-kpis,
  .valuation-hero,
  .login-panel {
    grid-template-columns: 1fr;
  }

  .cash-flow-columns {
    grid-template-columns: 1fr;
  }

  .valuation-range {
    padding-top: 1rem;
    padding-left: 0;
    border-top: 4px solid var(--brand);
    border-left: 0;
  }

  .page-heading,
  .section-head,
  .billing-status-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid .span-2 {
    grid-column: auto;
  }

  .billing-price {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .source-preview-heading,
  .validation-summary-main {
    flex-direction: column;
  }

  .source-preview-items li {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.15rem;
  }

  .validation-counts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .validation-score {
    flex-basis: auto;
    min-height: 0;
  }

  .app-nav .container-fluid {
    align-items: flex-start;
  }

  .app-nav .d-flex {
    width: 100%;
    justify-content: flex-start;
  }

  .logo-brand img {
    height: 62px;
  }

  .strategic-table {
    min-width: 850px;
  }

  .login-shell {
    min-height: calc(100vh - 94px);
    justify-content: center;
    padding: 1.25rem;
    background-position: 58% center;
  }

  .login-shell::before {
    background: rgba(11, 36, 71, 0.68);
  }

  .login-panel {
    padding: 1.5rem;
  }
}

/* Operations, guided upload and accessible navigation */
.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2000;
  padding: 0.6rem 0.85rem;
  background: #ffffff;
  color: #0b2447;
  border: 2px solid var(--brand);
  border-radius: 6px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 65%, #ffffff);
  outline-offset: 3px;
}

.account-indicator {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 6px;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.account-indicator:hover,
.account-indicator:focus {
  background: #ffffff;
  color: var(--brand-dark);
}

.account-indicator.account-active {
  border-color: #6ee7b7;
}

.account-indicator.account-blocked,
.account-indicator.account-past_due {
  border-color: #fdba74;
}

.upload-wizard {
  width: min(100%, 920px);
  margin-inline: auto;
  padding: 0;
  overflow: hidden;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  margin: 0;
  padding: 1.15rem 1.5rem;
  background: #f7f9fc;
  border-bottom: 1px solid var(--line);
}

.wizard-steps li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  min-width: 0;
}

.wizard-steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(50% + 1.5rem);
  right: 0.75rem;
  top: 50%;
  border-top: 2px solid #cbd5e1;
}

.wizard-steps span {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border: 2px solid #94a3b8;
  border-radius: 50%;
  background: #ffffff;
  font-size: 0.82rem;
}

.wizard-steps strong {
  overflow-wrap: anywhere;
  font-size: 0.86rem;
}

.wizard-steps .is-active,
.wizard-steps .is-complete {
  color: var(--brand-dark);
}

.wizard-steps .is-active span,
.wizard-steps .is-complete span {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.wizard-panel {
  padding: 1.75rem;
}

.wizard-panel[hidden] {
  display: none;
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.upload-confirmation {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.upload-confirmation div {
  min-width: 0;
  padding: 1rem;
}

.upload-confirmation div + div {
  border-left: 1px solid var(--line);
}

.upload-confirmation dt {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.upload-confirmation dd {
  margin: 0.25rem 0 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.processing-panel,
.processing-error {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.processing-error {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-left-color: #b42318;
}

.processing-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.processing-heading p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.processing-percent {
  color: var(--brand-dark);
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
}

.processing-progress {
  height: 8px;
  margin: 1rem 0;
  background: #e5eaf1;
}

.processing-progress .progress-bar {
  background: var(--brand);
  transition: width 0.35s ease;
}

.processing-stages {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.processing-stages li {
  padding-top: 0.5rem;
  border-top: 3px solid #cbd5e1;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.processing-stages li.is-active {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.processing-stages li.is-complete {
  border-color: #1f8a70;
  color: #176b57;
}

.report-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.report-chart {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.report-chart h3 {
  margin: 0 0 0.75rem;
}

.report-chart-canvas {
  position: relative;
  width: 100%;
  height: 300px;
}

.cash-value.negative {
  color: #b42318;
  font-weight: 750;
}

@media (max-width: 991.98px) {
  .app-nav .navbar-collapse {
    padding-top: 0.85rem;
  }

  .app-nav .navbar-nav {
    align-items: stretch;
  }

  .app-nav .navbar-nav .btn,
  .app-nav .navbar-nav form,
  .app-nav .navbar-nav form .btn,
  .account-indicator {
    width: 100%;
    text-align: left;
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  .wizard-steps {
    padding-inline: 1rem;
  }

  .wizard-steps li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }

  .wizard-steps li:not(:last-child)::after {
    left: 38px;
    right: 8px;
    top: 15px;
  }

  .wizard-panel {
    padding: 1.25rem;
  }

  .upload-confirmation,
  .report-chart-grid {
    grid-template-columns: 1fr;
  }

  .upload-confirmation div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .processing-stages {
    grid-template-columns: 1fr;
  }

  .processing-stages li {
    padding: 0.35rem 0 0.35rem 0.65rem;
    border-top: 0;
    border-left: 3px solid #cbd5e1;
  }

  .processing-error,
  .processing-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .report-chart-canvas {
    height: 250px;
  }
}
