:root {
  --cgb-navy: #0b3150;
  --cgb-navy-deep: #06243c;
  --cgb-blue: #0c5eaa;
  --cgb-sky: #0497cf;
  --cgb-ink: #102a43;
  --cgb-slate: #526b82;
  --cgb-bg: #eef3f8;
  --cgb-soft: #f6f9fc;
  --cgb-line: #d8e2ec;
  --cgb-white: #ffffff;
  --cgb-success: #147d64;
  --cgb-warning: #a96705;
  --cgb-danger: #b42318;
  --cgb-shadow: 0 12px 32px rgba(15, 49, 78, 0.08);
}

html {
  min-height: 100%;
  background: var(--cgb-bg);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--cgb-ink);
  background:
    radial-gradient(circle at 90% 0, rgba(4, 151, 207, 0.07), transparent 32rem),
    var(--cgb-bg);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.corporate-header {
  position: relative;
  z-index: 20;
  color: white;
  background: linear-gradient(112deg, var(--cgb-navy-deep), var(--cgb-navy) 68%, #10476e);
  border-bottom: 3px solid var(--cgb-sky);
  box-shadow: 0 6px 24px rgba(6, 36, 60, 0.16);
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  width: min(1220px, calc(100% - 40px));
  min-height: 108px;
  margin: 0 auto;
}

.corporate-brand {
  display: flex;
  align-items: center;
  width: 204px;
  height: 78px;
  padding: 5px 12px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.corporate-brand img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-identity {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 24px;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}

.product-identity strong {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.product-kicker {
  color: #9cd8f0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.main-navigation {
  display: flex;
  align-items: center;
  gap: 6px;
}

.main-navigation a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #d9eaf6;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  transition: 160ms ease;
}

.main-navigation a:hover,
.main-navigation a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.16);
}

.shell,
.shell.wide {
  width: min(1220px, calc(100% - 40px));
  padding: 42px 0 56px;
}

.corporate-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 34px;
  border-top: 1px solid var(--cgb-line);
  color: #71869a;
  font-size: 12px;
}

.panel,
.summary {
  border-color: var(--cgb-line);
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(15, 49, 78, 0.04);
}

.eyebrow {
  color: var(--cgb-blue);
  font-size: 11px;
  letter-spacing: 0.14em;
}

h1,
h2,
h3 {
  color: var(--cgb-ink);
}

h1 {
  font-size: clamp(30px, 3vw, 43px);
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

h2 {
  font-size: 20px;
  font-weight: 670;
  letter-spacing: -0.015em;
}

.muted,
.page-subtitle,
.field-help {
  color: var(--cgb-slate);
}

input,
textarea {
  color: var(--cgb-ink);
  border-color: #c9d6e2;
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--cgb-blue);
  box-shadow: 0 0 0 3px rgba(12, 94, 170, 0.12);
}

button,
.link-button {
  border-radius: 7px;
  background: var(--cgb-blue);
  box-shadow: 0 4px 10px rgba(12, 94, 170, 0.16);
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

button:hover,
.link-button:hover {
  background: #084d8d;
  box-shadow: 0 7px 16px rgba(12, 94, 170, 0.2);
  transform: translateY(-1px);
}

.secondary-button,
.secondary-action {
  color: var(--cgb-blue);
  background: #edf5fb;
  box-shadow: none;
}

.secondary-button:hover,
.secondary-action:hover {
  color: #fff;
  background: var(--cgb-blue);
}

.danger-button {
  background: var(--cgb-danger);
  box-shadow: 0 4px 10px rgba(180, 35, 24, 0.16);
}

/* Inicio */

.home-shell {
  display: grid;
  gap: 22px;
}

.page-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.7fr);
  align-items: end;
  gap: 44px;
  min-height: 270px;
  padding: 44px 48px;
  border-radius: 14px;
  color: white;
  background:
    linear-gradient(120deg, rgba(6, 36, 60, 0.98), rgba(11, 49, 80, 0.94)),
    var(--cgb-navy);
  box-shadow: var(--cgb-shadow);
}

.page-hero::after {
  content: "";
  position: absolute;
  width: 330px;
  height: 330px;
  right: -90px;
  top: -160px;
  border: 45px solid rgba(4, 151, 207, 0.15);
  border-radius: 50%;
}

.hero-copy,
.hero-assurance {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.page-hero .eyebrow {
  color: #80d0ef;
}

.page-hero h1 {
  max-width: 680px;
  color: white;
}

.hero-description {
  max-width: 690px;
  margin: 18px 0 0;
  color: #c9deed;
  font-size: 16px;
  line-height: 1.65;
}

.hero-assurance {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.hero-assurance div {
  padding: 18px 12px;
  text-align: center;
}

.hero-assurance div + div {
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}

.hero-assurance strong,
.hero-assurance span {
  display: block;
}

.hero-assurance strong {
  margin-bottom: 5px;
  color: #fff;
  font-size: 24px;
}

.hero-assurance span {
  color: #acd2e8;
  font-size: 11px;
  line-height: 1.3;
}

.analysis-options {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.85fr);
  gap: 22px;
  align-items: stretch;
}

.analysis-options > *,
.upload-form,
.document-grid,
.document-field {
  min-width: 0;
}

.upload-card {
  padding: 30px;
}

.upload-card-primary {
  border-top: 4px solid var(--cgb-blue);
}

.secondary-analysis-card {
  background: #f9fbfd;
}

.card-heading {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: start;
}

.card-heading h2 {
  margin-bottom: 7px;
  font-size: 23px;
}

.card-heading p:last-child {
  max-width: 600px;
  margin: 0;
  color: var(--cgb-slate);
  font-size: 14px;
  line-height: 1.55;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 9px;
  color: white;
  background: linear-gradient(135deg, var(--cgb-blue), var(--cgb-sky));
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.step-number.subtle {
  color: var(--cgb-blue);
  background: #e6f1f9;
}

.upload-form {
  margin-top: 25px;
}

.document-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.document-field {
  display: flex;
  flex-direction: column;
  min-height: 174px;
  margin: 0;
  padding: 18px;
  border: 1px dashed #aebfd0;
  border-radius: 9px;
  color: var(--cgb-ink);
  background: var(--cgb-soft);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.document-field:hover {
  border-color: var(--cgb-blue);
  background: #edf6fc;
}

.document-field strong,
.document-field small {
  display: block;
}

.document-field strong {
  margin: 11px 0 4px;
  font-size: 15px;
}

.document-field small {
  color: var(--cgb-slate);
  font-size: 12px;
}

.document-type {
  align-self: flex-start;
  padding: 5px 8px;
  border-radius: 5px;
  color: var(--cgb-blue);
  background: #dcecf8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.document-field input[type="file"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-top: auto;
  padding: 8px;
  font-size: 11px;
  background: #fff;
}

.field-label {
  color: #334e68;
  font-size: 12px;
  font-weight: 700;
}

.field-label span {
  color: #8296a8;
  font-weight: 500;
}

.field-help {
  margin: 7px 0 0;
  font-size: 12px;
  line-height: 1.45;
}

.primary-action,
.secondary-action {
  min-height: 48px;
}

.primary-action {
  gap: 10px;
}

.primary-action span {
  font-size: 20px;
  font-weight: 400;
}

.feedback-message {
  display: grid;
  gap: 3px;
  padding: 15px 18px;
  border: 1px solid #f3b7b1;
  border-left: 4px solid var(--cgb-danger);
  border-radius: 8px;
  color: #8f251d;
  background: #fff4f2;
}

.feedback-message span {
  font-size: 13px;
}

.process-strip {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 24px 30px;
  border: 1px solid var(--cgb-line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.66);
}

.process-strip div {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
}

.process-strip div span {
  grid-row: span 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--cgb-blue);
  background: #e5f1f9;
  font-size: 11px;
  font-weight: 800;
}

.process-strip div strong {
  font-size: 13px;
}

.process-strip div small {
  margin-top: 2px;
  color: var(--cgb-slate);
  font-size: 11px;
}

.process-strip i {
  height: 1px;
  background: #bdd0df;
}

/* Historial */

.page-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-title-row h1 {
  font-size: 36px;
}

.page-subtitle {
  margin: 10px 0 0;
  font-size: 14px;
}

.record-count {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 150px;
  padding: 14px 17px;
  border: 1px solid var(--cgb-line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.75);
}

.record-count strong {
  color: var(--cgb-blue);
  font-size: 25px;
}

.record-count span {
  color: var(--cgb-slate);
  font-size: 12px;
}

.history-panel {
  padding: 0;
  overflow: hidden;
}

.history-search {
  max-width: none;
  margin: 0;
  padding: 22px 24px;
  border-bottom: 1px solid var(--cgb-line);
  background: #f9fbfd;
}

.search-control {
  display: flex;
  align-items: center;
  max-width: 690px;
  margin-top: 7px;
}

.search-control > span {
  position: absolute;
  margin-left: 13px;
  color: #7890a5;
  font-size: 20px;
}

.search-control input {
  min-height: 44px;
  padding-left: 40px;
  border-radius: 7px 0 0 7px;
}

.search-control button {
  min-height: 44px;
  border-radius: 0 7px 7px 0;
  box-shadow: none;
}

.search-control > a {
  margin-left: 14px;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.history-table {
  margin-top: 0;
  border: 0;
  border-radius: 0;
}

.history-table table {
  min-width: 1180px;
}

.history-table th {
  padding-top: 13px;
  padding-bottom: 13px;
  color: #587086;
  background: #f3f7fa;
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.history-table td {
  padding-top: 14px;
  padding-bottom: 14px;
  border-color: #e5ecf2;
  font-size: 12px;
}

.history-table tbody tr:hover {
  background: #f8fbfd;
}

.company-cell {
  min-width: 180px;
  font-weight: 650;
}

.cell-mono {
  color: #334e68;
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
}

.cell-secondary {
  color: #71869a;
}

.score-value {
  display: inline-flex;
  justify-content: center;
  min-width: 42px;
  padding: 4px 8px;
  border-radius: 5px;
  color: var(--cgb-navy);
  background: #e9f2f8;
  font-weight: 750;
}

.decision-label,
.decision-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.decision-label {
  min-height: 25px;
  padding: 0 9px;
  color: #3c5870;
  background: #edf2f6;
}

.decision-verde {
  color: #0c654f;
  background: #def3ec;
}

.decision-amarillo {
  color: #8b5908;
  background: #fff1ce;
}

.decision-rojo,
.decision-failed {
  color: #9b291f;
  background: #fde7e4;
}

.status-pill {
  border-color: #d0dde7;
  color: #3f5b70;
  background: #eff4f7;
  text-transform: capitalize;
}

.status-finished {
  color: #0c654f;
  border-color: #b9dfd2;
  background: #e4f4ef;
}

.status-failed,
.status-cancelled {
  color: #9b291f;
  border-color: #efc2bd;
  background: #fceae8;
}

.observations-form {
  min-width: 210px;
}

.observations-form textarea {
  min-height: 58px;
  margin-bottom: 6px;
  border-color: #d3dee7;
  background: #fbfcfd;
  font-size: 11px;
}

.compact-button {
  min-height: 29px;
  padding: 0 10px;
  border: 1px solid #bed1df;
  color: var(--cgb-blue);
  background: #eef6fb;
  box-shadow: none;
  font-size: 11px;
}

.compact-button:hover {
  color: white;
  background: var(--cgb-blue);
}

.table-action,
.danger-link {
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.table-action {
  color: var(--cgb-blue);
}

.danger-link {
  color: var(--cgb-danger);
}

/* Historial compacto */

.history-table .compact-history-table {
  min-width: 1180px;
  table-layout: fixed;
}

.compact-history-table th:nth-child(1) { width: 20%; }
.compact-history-table th:nth-child(2) { width: 10%; }
.compact-history-table th:nth-child(3) { width: 13%; }
.compact-history-table th:nth-child(4) { width: 10%; }
.compact-history-table th:nth-child(5) { width: 8%; }
.compact-history-table th:nth-child(6) { width: 10%; }
.compact-history-table th:nth-child(7) { width: 18%; }
.compact-history-table th:nth-child(8) { width: 11%; }

.compact-history-table td {
  height: 68px;
  padding: 11px 14px;
  vertical-align: middle;
}

.compact-history-table .company-cell {
  min-width: 0;
}

.company-cell > strong,
.company-cuit,
.history-date strong,
.history-date span,
.score-caption,
.debt-months strong,
.debt-months span {
  display: block;
}

.company-cell > strong {
  overflow: hidden;
  color: var(--cgb-ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-cuit {
  margin-top: 4px;
  color: #70869a;
  font-family: Consolas, "Courier New", monospace;
  font-size: 10px;
  font-weight: 500;
}

.compact-status {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-top: 5px;
  padding: 0 7px;
  border-radius: 999px;
  color: #3f5b70;
  background: #edf2f6;
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.compact-status.status-failed,
.compact-status.status-cancelled {
  color: #9b291f;
  background: #fde7e4;
}

.compact-status.status-running,
.compact-status.status-queued {
  color: #75500c;
  background: #fff1ce;
}

.history-date strong {
  color: #314d64;
  font-size: 12px;
  font-weight: 650;
}

.history-date span {
  margin-top: 3px;
  color: #8295a7;
  font-size: 10px;
}

.history-investigator strong,
.history-investigator span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-investigator strong {
  color: var(--cgb-ink);
  font-size: 11px;
  white-space: nowrap;
}

.history-investigator span {
  margin-top: 4px;
  font-size: 9px;
  white-space: nowrap;
}

.risk-summary {
  display: flex;
  align-items: center;
  gap: 9px;
}

.score-caption {
  color: #71869a;
  font-size: 9px;
  line-height: 1.3;
  white-space: nowrap;
}

.score-caption strong {
  color: #28465e;
  font-size: 12px;
}

.history-score strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 30px;
  padding: 0 9px;
  border-radius: 6px;
  color: var(--cgb-navy);
  background: #e9f2f8;
  font-size: 14px;
  font-weight: 800;
}

.debt-months {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.debt-months strong {
  color: var(--cgb-ink);
  font-size: 16px;
}

.debt-months span {
  color: #71869a;
  font-size: 10px;
}

.observation-preview {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.observation-preview > span {
  flex: 1;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-observation {
  min-width: 0;
}

.history-actions-cell {
  white-space: nowrap;
}

.edit-note-button,
.action-popover button,
.dialog-close {
  min-height: auto;
  padding: 0;
  border: 0;
  color: var(--cgb-blue);
  background: transparent;
  box-shadow: none;
  font-size: 10px;
}

.edit-note-button:hover,
.action-popover button:hover,
.dialog-close:hover {
  color: var(--cgb-navy);
  background: transparent;
  box-shadow: none;
  transform: none;
}

.edit-note-button {
  flex: 0 0 auto;
  font-weight: 750;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.row-actions .table-action {
  font-size: 11px;
}

.action-menu {
  position: relative;
}

.action-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid #d4dfe8;
  border-radius: 6px;
  color: #587086;
  background: #f8fafc;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  list-style: none;
}

.action-menu summary::-webkit-details-marker {
  display: none;
}

.action-menu[open] summary {
  color: var(--cgb-blue);
  border-color: #9fc3dc;
  background: #edf6fb;
}

.action-popover {
  position: absolute;
  z-index: 30;
  top: 35px;
  right: 0;
  display: grid;
  gap: 3px;
  width: 170px;
  padding: 7px;
  border: 1px solid #d5e0e8;
  border-radius: 8px;
  background: white;
  box-shadow: 0 12px 30px rgba(15, 49, 78, 0.17);
}

.action-popover button,
.action-popover a {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 650;
  text-align: left;
  text-decoration: none;
}

.action-popover button:hover {
  background: #eef6fb;
}

.action-popover .danger-link:hover {
  background: #fff1ef;
}

.observation-dialog {
  width: min(520px, calc(100% - 32px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: var(--cgb-ink);
  background: white;
  box-shadow: 0 24px 70px rgba(6, 36, 60, 0.3);
}

.observation-dialog::backdrop {
  background: rgba(6, 28, 47, 0.58);
  backdrop-filter: blur(2px);
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px 16px;
  border-bottom: 1px solid #e2eaf0;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 21px;
}

.dialog-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #60788c;
  background: #eef3f7;
  font-size: 22px;
  line-height: 1;
}

.dialog-close:hover {
  background: #e1eaf1;
}

.dialog-company {
  margin: 18px 26px 0;
  color: #526b82;
  font-size: 12px;
  font-weight: 650;
}

.note-dialog-form {
  padding: 18px 26px 26px;
}

.note-dialog-form textarea {
  min-height: 130px;
  margin-top: 7px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.dialog-actions button {
  min-height: 40px;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 7px;
  margin: 0;
  padding: 72px 24px;
  color: var(--cgb-slate);
  text-align: center;
}

.empty-state > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  border-radius: 50%;
  color: var(--cgb-blue);
  background: #e6f1f8;
  font-size: 28px;
}

.empty-state strong {
  color: var(--cgb-ink);
}

.empty-state p {
  margin: 0;
  font-size: 13px;
}

.pagination {
  margin: 0;
  padding: 18px 24px;
  border-top: 1px solid var(--cgb-line);
  background: #f9fbfd;
  font-size: 13px;
}

/* Informe */

.refresh-notice {
  margin-bottom: 14px;
  padding: 11px 15px;
  border: 1px solid #bdd9ea;
  border-radius: 7px;
  color: #245a7a;
  background: #eaf5fb;
  font-size: 12px;
}

.analysis-summary {
  padding: 27px 30px;
  border-left: 4px solid var(--cgb-blue);
}

.analysis-heading h1 {
  font-size: 30px;
}

.analysis-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 11px;
  color: var(--cgb-slate);
  font-size: 12px;
}

.analysis-meta span + span {
  font-family: Consolas, "Courier New", monospace;
  font-size: 10px;
}

.decision-badge {
  min-height: 34px;
  padding: 0 13px;
  color: #3c5870;
  background: #edf2f6;
}

.analysis-shell > .panel,
.analysis-shell > .grid,
.analysis-shell > .summary {
  margin-bottom: 18px;
}

.company-facts div,
.chart-card,
.bcra-metrics div,
.sales-grid article,
.operation-parties article {
  border-color: #dce5ed;
  border-radius: 9px;
  background: #f8fafc;
}

.company-facts span,
.bcra-metrics span,
.sales-grid span {
  color: #647c90;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.chart-card {
  box-shadow: none;
}

.chart-card svg {
  border: 1px solid #e6edf3;
}

.table-wrap {
  border-color: #dce5ed;
  border-radius: 9px;
}

.table-wrap th {
  color: #587086;
  background: #f1f6f9;
  font-size: 11px;
}

.report {
  padding: 34px 38px;
}

.report > h2 {
  padding-bottom: 14px;
  border-bottom: 2px solid var(--cgb-navy);
}

.report-content {
  color: #243b53;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  line-height: 1.65;
}

.report-content h1,
.report-content h2,
.report-content h3,
.report-content table {
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

.report-content h2 {
  color: var(--cgb-navy);
  font-size: 19px;
}

.files a {
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

/* Confirmación */

.delete-confirmation {
  max-width: 620px;
  margin: 40px auto;
  padding: 38px;
  text-align: center;
}

.warning-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  margin-bottom: 20px;
  border-radius: 50%;
  color: var(--cgb-danger);
  background: #fde9e7;
  font-size: 27px;
  font-weight: 800;
}

.delete-confirmation h1 {
  font-size: 30px;
}

.confirmation-copy {
  margin: 18px 0;
  color: var(--cgb-slate);
  line-height: 1.6;
}

.preservation-note {
  display: grid;
  gap: 4px;
  padding: 15px;
  border: 1px solid #d5e1ea;
  border-radius: 8px;
  color: #3e5b71;
  background: #f4f8fb;
  font-size: 12px;
  text-align: left;
}

.confirmation-actions {
  margin-top: 28px;
}

@media (max-width: 980px) {
  .header-inner {
    grid-template-columns: auto 1fr;
  }

  .product-identity {
    display: none;
  }

  .main-navigation {
    justify-self: end;
  }

  .page-hero,
  .analysis-options {
    grid-template-columns: 1fr;
  }

  .page-hero {
    gap: 30px;
  }

  .process-strip {
    grid-template-columns: repeat(4, 1fr);
  }

  .process-strip i {
    display: none;
  }

  .chart-grid.three {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .header-inner {
    grid-template-columns: 112px minmax(0, 1fr);
    width: min(1220px, calc(100% - 24px));
    min-height: 84px;
    gap: 12px;
  }

  .corporate-brand {
    width: 112px;
    height: 56px;
    padding: 4px 7px;
  }

  .main-navigation {
    width: 100%;
    min-width: 0;
    gap: 2px;
    overflow: hidden;
  }

  .main-navigation a {
    min-height: 38px;
    padding: 0 7px;
    font-size: 10px;
    white-space: nowrap;
  }

  .shell,
  .shell.wide {
    width: min(1220px, calc(100% - 24px));
    padding-top: 26px;
  }

  .corporate-footer {
    display: grid;
    width: min(1220px, calc(100% - 24px));
  }

  .page-hero {
    width: 100%;
    max-width: 100%;
    min-height: auto;
    padding: 30px 24px;
  }

  .page-hero h1,
  .hero-description {
    max-width: 100%;
    overflow-wrap: break-word;
  }

  .hero-assurance {
    grid-template-columns: 1fr;
  }

  .hero-assurance div + div {
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    border-left: 0;
  }

  .analysis-options,
  .document-grid,
  .process-strip,
  .chart-grid.three {
    grid-template-columns: 1fr;
  }

  .upload-card {
    padding: 23px;
  }

  .process-strip {
    gap: 18px;
  }

  .page-title-row,
  .analysis-summary,
  .summary-actions,
  .confirmation-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .page-title-row {
    align-items: flex-start;
  }

  .record-count {
    align-self: stretch;
  }

  .search-control {
    flex-wrap: wrap;
  }

  .search-control input {
    width: calc(100% - 90px);
  }

  .search-control > a {
    margin-top: 10px;
    margin-left: 0;
  }

  .report {
    padding: 25px 20px;
  }
}

/* Experiencia móvil */

.table-wrap,
.report-content table {
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 720px) {
  .corporate-header {
    border-bottom-width: 2px;
  }

  .header-inner {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 12px 0 10px;
    gap: 10px;
  }

  .corporate-brand {
    justify-self: start;
    width: 142px;
    height: 54px;
    padding: 4px 9px;
    border-radius: 8px;
  }

  .main-navigation {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
    overflow: visible;
  }

  .main-navigation a {
    justify-content: center;
    min-height: 44px;
    padding: 0 10px;
    border-color: rgba(255, 255, 255, 0.12);
    font-size: 13px;
  }

  .shell,
  .shell.wide {
    width: min(100% - 24px, 1220px);
    padding: 24px 0 40px;
  }

  .corporate-footer {
    width: min(100% - 24px, 1220px);
    gap: 7px;
    padding: 20px 0 28px;
    line-height: 1.45;
  }

  h1,
  .page-title-row h1,
  .analysis-heading h1 {
    font-size: clamp(27px, 8vw, 32px);
    line-height: 1.12;
  }

  h2 {
    font-size: 19px;
  }

  input,
  textarea,
  select {
    font-size: 16px;
  }

  button,
  .link-button,
  .summary-actions button,
  .summary-actions .link-button,
  .confirmation-actions button,
  .confirmation-actions .link-button {
    min-height: 44px;
  }

  .page-hero {
    padding: 28px 20px 22px;
    gap: 24px;
    border-radius: 12px;
  }

  .page-hero::after {
    width: 220px;
    height: 220px;
    top: -120px;
    right: -90px;
    border-width: 30px;
  }

  .hero-description {
    margin-top: 14px;
    font-size: 14px;
    line-height: 1.55;
  }

  .hero-assurance {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-assurance div {
    min-width: 0;
    padding: 14px 7px;
  }

  .hero-assurance div + div {
    border-top: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.14);
  }

  .hero-assurance strong {
    font-size: 21px;
  }

  .hero-assurance span {
    font-size: 10px;
  }

  .upload-card {
    padding: 21px 18px;
  }

  .card-heading {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
  }

  .card-heading h2 {
    font-size: 20px;
  }

  .step-number {
    width: 40px;
    height: 40px;
  }

  .document-field {
    min-height: 158px;
    padding: 15px;
  }

  .document-field input[type="file"] {
    font-size: 13px;
  }

  .process-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 12px;
    padding: 20px 18px;
  }

  .process-strip div {
    min-width: 0;
  }

  .page-title-row {
    gap: 16px;
    margin-bottom: 18px;
  }

  .record-count {
    justify-content: space-between;
    width: 100%;
    min-width: 0;
    padding: 11px 14px;
  }

  /* El historial deja de comportarse como una tabla ancha y pasa a tarjetas. */

  .history-panel {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .history-search {
    margin-bottom: 14px;
    padding: 17px;
    border: 1px solid var(--cgb-line);
    border-radius: 11px;
    background: white;
    box-shadow: 0 3px 10px rgba(15, 49, 78, 0.04);
  }

  .search-control {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    width: 100%;
    max-width: none;
  }

  .search-control > span {
    top: 11px;
    left: 0;
    margin-left: 13px;
  }

  .search-control input {
    width: 100%;
    min-width: 0;
  }

  .search-control button {
    min-width: 86px;
  }

  .search-control > a {
    grid-column: 1 / -1;
    justify-self: start;
    min-height: 36px;
    margin: 7px 0 -7px;
    padding: 8px 0;
  }

  .history-table {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .history-table .compact-history-table,
  .compact-history-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .compact-history-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .compact-history-table tbody {
    display: grid;
    gap: 13px;
  }

  .compact-history-table .history-row {
    display: grid;
    grid-template-columns: minmax(0, 0.82fr) minmax(112px, 1.25fr) minmax(0, 0.78fr);
    overflow: visible;
    border: 1px solid var(--cgb-line);
    border-radius: 12px;
    background: white;
    box-shadow: 0 5px 16px rgba(15, 49, 78, 0.06);
  }

  .compact-history-table td {
    display: block;
    min-width: 0;
    height: auto;
    padding: 12px 10px;
    border: 0;
  }

  .compact-history-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 7px;
    color: #71869a;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .compact-history-table .history-company {
    grid-column: 1 / -1;
    padding: 15px 16px;
    border-bottom: 1px solid #e2eaf0;
    border-radius: 12px 12px 0 0;
    background: #f8fbfd;
  }

  .compact-history-table .history-company::before,
  .compact-history-table .history-actions-cell::before {
    display: none;
  }

  .history-company > strong {
    font-size: 15px;
  }

  .company-cuit {
    font-size: 11px;
  }

  .history-created,
  .history-investigator,
  .history-evaluation,
  .history-score,
  .history-debt {
    min-height: 90px;
    border-bottom: 1px solid #e7edf2 !important;
  }

  .history-created,
  .history-investigator,
  .history-score {
    border-right: 1px solid #e7edf2 !important;
  }

  .history-date strong {
    font-size: 12px;
  }

  .risk-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .decision-label {
    min-height: 25px;
    padding: 0 8px;
    font-size: 10px;
  }

  .score-caption {
    white-space: normal;
  }

  .debt-months strong {
    font-size: 17px;
  }

  .history-observation {
    grid-column: 1 / -1;
    padding: 13px 16px !important;
    border-bottom: 1px solid #e7edf2 !important;
  }

  .observation-preview {
    align-items: center;
  }

  .observation-preview > span {
    white-space: normal;
  }

  .edit-note-button {
    min-height: 44px;
    padding: 0 9px;
    font-size: 12px;
  }

  .history-actions-cell {
    grid-column: 1 / -1;
    padding: 10px 12px !important;
  }

  .row-actions {
    justify-content: stretch;
  }

  .row-actions .table-action {
    display: inline-flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 7px;
    color: var(--cgb-blue);
    background: #edf5fb;
    font-size: 12px;
  }

  .action-menu summary {
    width: 44px;
    height: 44px;
  }

  .action-popover {
    top: 49px;
    width: min(210px, calc(100vw - 48px));
  }

  .action-popover button,
  .action-popover a {
    min-height: 44px;
    font-size: 12px;
  }

  .pagination {
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding: 13px;
    border: 1px solid var(--cgb-line);
    border-radius: 10px;
    background: white;
  }

  .pagination a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 10px;
  }

  .observation-dialog {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    border-radius: 14px;
  }

  .dialog-heading {
    padding: 19px 18px 14px;
  }

  .dialog-close {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
  }

  .dialog-company {
    margin: 15px 18px 0;
  }

  .note-dialog-form {
    padding: 15px 18px 20px;
  }

  .note-dialog-form textarea {
    min-height: 150px;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .dialog-actions button {
    width: 100%;
    min-height: 46px;
    justify-content: center;
  }

  /* Informe y resultados */

  .analysis-summary {
    gap: 18px;
    padding: 21px 18px;
    border-left-width: 3px;
  }

  .summary-actions {
    width: 100%;
  }

  .summary-actions > *,
  .summary-actions form,
  .summary-actions form button {
    width: 100%;
  }

  .summary-actions .decision-badge {
    justify-content: center;
  }

  .panel {
    padding: 20px 17px;
  }

  .section-head {
    flex-wrap: wrap;
  }

  .company-facts,
  .bcra-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .company-facts div {
    min-height: 84px;
  }

  .chart-card {
    padding: 14px;
  }

  .chart-head {
    gap: 8px;
  }

  .chart-head h3 {
    font-size: 14px;
  }

  .chart-head strong {
    font-size: 14px;
  }

  .table-wrap {
    scrollbar-width: thin;
  }

  .table-wrap th,
  .table-wrap td {
    padding: 10px;
    font-size: 12px;
  }

  .report {
    padding: 22px 17px;
  }

  .report-content {
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.6;
  }

  .report-content h2 {
    font-size: 18px;
  }

  .report-content table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    scrollbar-width: thin;
  }

  .report-content th,
  .report-content td {
    min-width: 120px;
    padding: 9px;
    font-size: 12px;
  }

  .report-content th:first-child,
  .report-content td:first-child {
    min-width: 150px;
    white-space: normal;
  }

  dl div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .files a {
    overflow-wrap: anywhere;
  }

  .delete-confirmation {
    margin: 12px auto;
    padding: 26px 18px;
  }

  .confirmation-actions,
  .confirmation-actions form,
  .confirmation-actions a,
  .confirmation-actions button {
    width: 100%;
  }

  .confirmation-actions a,
  .confirmation-actions button {
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .company-facts,
  .bcra-metrics {
    grid-template-columns: 1fr;
  }

  .compact-history-table .history-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact-history-table td {
    padding-right: 8px;
    padding-left: 8px;
  }

  .history-created,
  .history-investigator,
  .history-evaluation,
  .history-score,
  .history-debt {
    min-height: 96px;
  }

  .history-date strong,
  .score-caption strong {
    font-size: 11px;
  }

  .debt-months {
    display: block;
  }

  .debt-months span {
    margin-top: 2px;
  }
}

.auth-panel {
  max-width: 520px;
  margin: 48px auto;
}

.stacked-form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.current-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.current-user .link-button {
  padding: 6px 10px;
}

.user-form-grid,
.user-inline-form {
  display: grid;
  gap: 12px;
  align-items: end;
}

.user-form-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
}

.user-form-grid label {
  display: grid;
  gap: 6px;
}

.user-inline-form {
  grid-template-columns: minmax(140px, 1fr) 130px auto minmax(180px, 1fr) auto;
}

@media (max-width: 900px) {
  .user-form-grid,
  .user-inline-form {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
