:root {
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #64748b;
  --border: #d8e1ec;
  --blue: #0065a8;
  --blue-dark: #004e82;
  --red: #a61d21;
  --green: #2e7d5b;
  --amber: #d99a2b;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #e7eef7 0%, #f7f9fc 52%, #eef3f8 100%);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.page {
  min-height: 100vh;
}

.hero {
  padding: 44px clamp(20px, 5vw, 72px) 34px;
  background:
    linear-gradient(135deg, rgba(0, 101, 168, 0.96), rgba(0, 78, 130, 0.88)),
    url("https://images.unsplash.com/photo-1551288049-bebda4e38f71?auto=format&fit=crop&w=1600&q=80");
  background-position: center;
  background-size: cover;
  color: #fff;
}

.hero-copy {
  max-width: 860px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
}

.brand-logo {
  display: block;
  width: 118px;
  height: auto;
  filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.22));
}

.brand-row::before {
  content: "";
  width: 4px;
  height: 42px;
  border-radius: 999px;
  background: var(--red);
}

.eyebrow,
.badge {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-text {
  max-width: 710px;
  margin: 20px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.06rem;
  line-height: 1.55;
}

.data-carga {
  display: inline-flex;
  margin: 16px 0 0;
  padding: 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.34);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.88rem;
  font-weight: 800;
}

.shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.tabs {
  background: transparent;
}

.tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  padding: 14px 18px;
}

.tab-selected {
  border: 0;
  border-bottom: 2px solid var(--blue);
  background: transparent;
  color: var(--blue-dark);
  font-weight: 900;
}

.filters,
.kpi-grid,
.charts-grid,
.analytics-section,
.preview-section,
.linked-items-section,
.table-section {
  margin-bottom: 22px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 0.8fr) minmax(260px, 1.2fr) 180px;
  gap: 18px;
  align-items: end;
  padding: 4px 0 18px;
  border-bottom: 1px solid rgba(100, 116, 139, 0.22);
}

.proposal-filters {
  grid-template-columns: minmax(160px, 0.7fr) minmax(240px, 1fr) minmax(260px, 1fr) minmax(320px, 1.2fr);
}

.control label {
  display: block;
  margin: 0 0 6px;
  color: #52647a;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dash-dropdown .Select-control,
.dash-dropdown .Select-menu-outer,
.dash-dropdown .Select-value,
.dash-dropdown .Select-placeholder {
  border-radius: 0;
}

.dash-dropdown .Select-control {
  min-height: 40px;
  border: 0;
  border-bottom: 2px solid #cbd7e6;
  background: transparent;
  box-shadow: none;
}

.dash-dropdown .Select-control:hover {
  border-bottom-color: var(--blue);
}

.dash-dropdown.is-focused .Select-control,
.dash-dropdown .is-focused:not(.is-open) > .Select-control {
  border-bottom-color: var(--blue);
  box-shadow: none;
}

.dash-dropdown .Select-placeholder,
.dash-dropdown .Select--single > .Select-control .Select-value {
  padding-left: 0;
}

.dash-dropdown .Select-input {
  padding-left: 0;
}

.dash-dropdown .Select-menu-outer {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
}

button.dash-dropdown {
  width: 100%;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid #cbd7e6;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  box-shadow: none;
}

button.dash-dropdown:hover,
button.dash-dropdown:focus,
button.dash-dropdown[data-state="open"] {
  border-bottom-color: var(--blue);
  outline: none;
}

button.dash-dropdown .dash-dropdown-grid-container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

button.dash-dropdown .dash-dropdown-value {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.96rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.dash-dropdown .dash-dropdown-placeholder {
  color: #697a92;
}

button.dash-dropdown svg {
  color: #52647a;
}

.text-input {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-bottom: 2px solid #cbd7e6;
  background: transparent;
  color: var(--text);
  font: inherit;
  outline: none;
}

.text-input:focus {
  border-bottom-color: var(--blue);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-height: 40px;
  padding-bottom: 2px;
  border-bottom: 2px solid #cbd7e6;
}

.segmented label {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 6px;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: none;
}

.segmented input {
  margin-right: 6px;
  accent-color: var(--blue);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card,
.chart,
.table-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
}

.kpi-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 20px;
  min-width: 0;
}

.kpi-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi-value {
  min-width: 0;
  color: var(--text);
  font-size: clamp(1.45rem, 2.2vw, 2.35rem);
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-detail {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.chart {
  min-width: 0;
  overflow: hidden;
  padding: 8px;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.preview-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
}

.preview-title {
  display: grid;
  gap: 6px;
  padding: 18px 18px 10px;
}

.preview-title h3,
.preview-title p {
  margin: 0;
}

.preview-title h3 {
  font-size: 1.08rem;
}

.preview-title p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.preview-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 18px 6px;
}

.preview-kpi-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(216, 225, 236, 0.9);
  border-radius: 8px;
  background: var(--surface-soft);
}

.preview-kpi-label {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.preview-kpi-value {
  display: block;
  min-width: 0;
  margin-top: 6px;
  color: var(--text);
  font-size: clamp(1rem, 1.35vw, 1.35rem);
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-kpi-detail {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.chart-large {
  grid-column: 1 / -1;
}

.table-section {
  overflow: hidden;
}

.linked-items-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.linked-table-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
}

.linked-table-panel h3 {
  margin: 0;
  padding: 18px 18px 8px;
  font-size: 1.05rem;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 22px 14px;
}

.action-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
}

.action-button:hover,
.action-button:focus {
  background: var(--blue-dark);
  outline: none;
}

.proposal-summary {
  display: grid;
  gap: 8px;
  max-width: 100%;
}

.proposal-summary-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.proposal-summary-heading strong {
  color: var(--text);
}

.proposal-summary-heading span,
.proposal-summary-alerts span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e7f1f8;
  color: var(--blue-dark);
  font-size: 0.76rem;
  font-weight: 800;
}

.proposal-summary-meta,
.proposal-summary-object {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.proposal-summary-object {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.proposal-summary-values,
.proposal-summary-alerts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.proposal-summary-values span {
  display: inline-flex;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid rgba(216, 225, 236, 0.9);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
}

.proposal-summary-footnote {
  color: var(--muted);
  font-size: 0.78rem;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 8px;
}

.section-title h2,
.section-title p {
  margin: 0;
}

.section-title h2 {
  font-size: 1.2rem;
}

.section-title p {
  color: var(--muted);
}

@media (max-width: 1100px) {
  .hero,
  .filters,
  .charts-grid,
  .preview-grid {
    grid-template-columns: 1fr;
  }

  .chart-large {
    grid-column: auto;
    grid-row: auto;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .hero {
    padding: 32px 20px 26px;
  }

  .brand-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .shell {
    width: min(100% - 24px, 1440px);
    padding-top: 16px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .preview-kpi-grid {
    grid-template-columns: 1fr;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-actions {
    justify-content: stretch;
    padding-inline: 14px;
  }

  .action-button {
    width: 100%;
  }
}
