/* FGR · Gestión y seguimiento
   Hoja única de la aplicación. Colores, radios y tamaños se definen una sola vez
   en :root; el resto de reglas usa esas variables. Paleta institucional PUCP:
   azul principal #042354, azul secundario #004ea8 y celeste #41b9e4. */

/* ---------- Variables ---------- */
:root {
  --navy: #042354;
  --blue: #004ea8;
  --sky: #41b9e4;
  --ink: #182b49;
  --muted: #5a6a80;
  --bg: #f3f6fb;
  --surface: #fff;
  --surface-soft: #f8fafd;
  --track: #edf1f6;
  --line: #e2e8f1;
  --line-strong: #ccd7e5;

  /* Estados: texto y fondo suave de cada uno */
  --ok: #1d6b50;
  --ok-bg: #e8f5ef;
  --warn: #855709;
  --warn-bg: #fff3da;
  --danger: #a12c2c;
  --danger-bg: #fdf1f1;
  --danger-line: #f2cdcd;
  --info: var(--blue);
  --info-bg: #eaf1fb;
  --neutral: #55657a;
  --neutral-bg: #eff2f6;
  --archived: #5c4b6b;
  --archived-bg: #f1eef6;

  /* Series de gráficos (app.js las referencia por nombre) */
  --chart-1: #004ea8;
  --chart-2: #008768;
  --chart-3: #936000;
  --chart-4: #7954a1;
  --chart-5: #d05243;
  --chart-6: #36809b;
  --chart-7: #77869d;
  /* Decisión de la solicitud: tres tonos que se distinguen también con daltonismo */
  --approved: #004ea8;
  --rejected: #c9532f;
  --undecided: #7954a1;
  --plan: #b7cdea;

  --radius-sm: 6px;
  --radius: 9px;
  --radius-lg: 16px;

  /* 12px es el tamaño mínimo de texto en toda la interfaz */
  --text-xs: 12px;
  --text-sm: 13px;
  --text: 14px;

  --shadow-card: 0 4px 18px #19365b0a;
  --shadow-pop: 0 24px 80px #102b4a33;
  --focus-ring: 0 0 0 3px #004ea81f;
}

/* ---------- Base ---------- */
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  font-size: var(--text);
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
}
a {
  color: var(--blue);
}
a,
button {
  -webkit-tap-highlight-color: transparent;
}
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
h1,
h2 {
  color: var(--navy);
}
h1 {
  margin: 0 0 10px;
  font-size: 29px;
  font-weight: 720;
  line-height: 1.25;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}
h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}
h3 {
  margin: 0 0 10px;
  font-size: var(--text);
}
p {
  line-height: 1.65;
}
textarea {
  resize: vertical;
  min-height: 70px;
}
.muted {
  color: var(--muted);
}
.small-text {
  font-size: var(--text-xs);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Estructura: barra lateral, cabecera y pie ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  padding: 16px 22px 36px;
  display: flex;
  flex-direction: column;
  background: var(--navy);
  color: #fff;
}
.sidebar :focus-visible {
  outline-color: var(--sky);
}
.brand {
  display: block;
  border-radius: var(--radius-sm);
}
.brand-logo {
  display: block;
  width: 100%;
  height: auto;
}
.mobile-brand {
  display: none;
}
.product {
  margin-top: 8px;
  padding: 26px 10px 30px;
  border-top: 1px solid #ffffff20;
  font-size: 21px;
  font-weight: 700;
}
.product span {
  display: block;
  margin-top: 7px;
  font-size: var(--text-xs);
  font-weight: 400;
  color: #aac3d8;
}
.nav-label {
  padding: 0 12px;
  margin-bottom: 10px;
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  color: #9fbad0;
}
nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: #c9d8e6;
  font-size: var(--text);
  text-decoration: none;
  transition:
    background 0.16s,
    color 0.16s;
}
nav a:hover {
  background: #ffffff20;
}
nav a.active {
  background: #ffffff19;
  color: #fff;
  box-shadow: inset 3px 0 var(--sky);
}
nav svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.nav-count {
  min-width: 22px;
  margin-left: auto;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: #ffffff24;
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: center;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 20px 10px 0;
  font-size: var(--text-xs);
  color: #d0dfe9;
}
.sidebar-bottom small {
  display: block;
  margin: 10px 0;
  font-size: var(--text-xs);
  line-height: 1.6;
  color: #9fbad0;
}
.connection {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--sky);
}
.workspace {
  margin-left: 248px;
}
.topbar {
  height: 88px;
  padding: 0 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--surface);
  border-top: 4px solid var(--navy);
  border-bottom: 1px solid var(--line);
}
.breadcrumb {
  font-size: var(--text-sm);
  color: var(--muted);
}
.breadcrumb span {
  margin: 0 13px;
  color: #b1bdc8;
}
.breadcrumb strong {
  font-weight: 500;
  color: var(--ink);
}
.profile {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.demo-label,
.role-label {
  font-size: var(--text-xs);
  color: var(--muted);
}
.demo-label {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.role-label {
  line-height: 1.6;
}
.role-label select {
  display: block;
  max-width: 230px;
  color: var(--ink);
}
main {
  max-width: 1560px;
  min-height: calc(100vh - 140px);
  margin: auto;
  padding: 36px 38px 55px;
  transition: opacity 0.15s;
}
/* El retardo evita el parpadeo cuando la respuesta llega enseguida */
main.loading {
  opacity: 0.5;
  pointer-events: none;
  cursor: progress;
  transition-delay: 0.12s;
}
footer {
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  color: var(--navy);
  font-size: var(--text-xs);
  line-height: 1.6;
}
footer > div {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}
footer > div > span {
  display: block;
  color: var(--muted);
}

/* ---------- Encabezado de página y textos de apoyo ---------- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.eyebrow {
  margin-bottom: 10px;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--blue);
}
.subtitle {
  margin: 0;
  font-size: var(--text);
  line-height: 1.65;
  color: var(--muted);
}
.back {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 23px;
  font-size: var(--text-sm);
  color: var(--muted);
  text-decoration: none;
}
.back:hover {
  color: var(--blue);
}
.section-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 28px 0 16px;
}
.section-intro p {
  margin: 6px 0 0;
  font-size: var(--text-sm);
  color: var(--muted);
}
.summary-line {
  margin: 12px 0 22px;
  font-size: var(--text-sm);
  color: var(--muted);
}
.form-note {
  grid-column: 1/-1;
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted);
}
.legend-note {
  padding: 0 22px 18px;
  font-size: var(--text-xs);
  color: var(--muted);
}
.description {
  white-space: pre-wrap;
  line-height: 1.75;
  color: var(--muted);
}

/* ---------- Botones, campos y enlaces de acción ---------- */
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.btn {
  min-height: 38px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 550;
  text-decoration: none;
  transition:
    background 0.15s,
    box-shadow 0.15s;
}
.btn:hover {
  background: var(--info-bg);
}
.btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 3px 8px #004ea824;
}
.btn.primary:hover {
  background: var(--navy);
  border-color: var(--navy);
}
.btn:disabled {
  opacity: 0.45;
}
.btn svg {
  width: 15px;
  height: 15px;
}
.field,
.role-label select {
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-sm);
}
.field:focus,
.role-label select:focus {
  border-color: var(--blue);
  box-shadow: var(--focus-ring);
}
.field:disabled {
  background: var(--surface-soft);
  color: var(--muted);
}
.field[aria-invalid='true'] {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.row-link {
  padding: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--blue);
  white-space: nowrap;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  background: var(--neutral-bg);
  color: var(--neutral);
  font-size: var(--text-xs);
  font-weight: 550;
}
.badge.draft,
.badge.imported {
  background: var(--info-bg);
  color: var(--info);
}
.badge.submitted {
  background: #e3e9f3;
  color: var(--navy);
}
.badge.observed,
.badge.scheduled {
  background: var(--warn-bg);
  color: var(--warn);
}
.badge.validated,
.badge.open {
  background: var(--ok-bg);
  color: var(--ok);
}
.badge.rejected {
  background: var(--danger-bg);
  color: var(--danger);
}
.badge.closed {
  background: var(--archived-bg);
  color: var(--archived);
}

/* ---------- Avisos, errores y estados vacíos ---------- */
.notice {
  margin: 0 0 24px;
  padding: 15px 17px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  border: 1px solid #d4e1f1;
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
  background: var(--info-bg);
  color: #264971;
  font-size: var(--text-sm);
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.notice.amber {
  border-color: #efe1c5;
  border-left-color: #d79a12;
  background: #fff8eb;
  color: var(--warn);
}
.error {
  margin: 12px 0;
  color: var(--danger);
  font-size: var(--text-sm);
  line-height: 1.6;
}
.error:empty {
  display: none;
}
.inline-error {
  padding: 14px;
  border: 1px solid var(--danger-line);
  border-radius: var(--radius);
  background: var(--danger-bg);
}
.empty,
.blank {
  padding: 50px 25px;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
}

/* ---------- Tarjetas e indicadores de resumen ---------- */
.card,
.stat {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.card-head {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}
.card-head small {
  display: block;
  margin-top: 6px;
  font-size: var(--text-xs);
  color: var(--muted);
}
.card-body {
  min-width: 0;
  padding: 22px;
}
.detail-section {
  margin: 24px 0;
}
.detail-section > summary {
  padding: 18px 22px;
  cursor: pointer;
  color: var(--navy);
  font-size: var(--text);
  font-weight: 600;
}
.detail-section > .card-body {
  border-top: 1px solid var(--line);
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 23px;
}
.stat {
  position: relative;
  padding: 20px;
}
.stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 24px;
  width: 34px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--blue);
}
.stat-label {
  font-size: var(--text-sm);
  color: var(--muted);
}
.stat-value {
  margin: 12px 0 8px;
  color: var(--navy);
  font-size: 32px;
  font-weight: 650;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}
.stat-value .unit {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}
.stat small {
  display: block;
}
.stat .meter {
  margin-top: 12px;
}
.sparkline {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 96px;
  height: 26px;
}
.sparkline polyline {
  stroke: var(--blue);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sparkline circle {
  fill: var(--blue);
}
/* Indicadores que se reparten el ancho disponible (ficha de solicitud y reporte) */
.stats.fit {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.stats.fit .stat-value {
  font-size: 24px;
  letter-spacing: -0.02em;
}
/* Medidor: el relleno y su pista son dos pasos del mismo azul */
.meter {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--plan);
}
.meter i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--blue);
}
.stat small {
  font-size: var(--text-xs);
  color: var(--muted);
}
/* ---------- Tablas y paginación ---------- */
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th {
  padding: 13px 20px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
td {
  padding: 17px 20px;
  border-top: 1px solid var(--line);
  font-size: var(--text-sm);
  vertical-align: middle;
  overflow-wrap: break-word;
}
tbody tr:hover {
  background: var(--surface-soft);
}
td strong {
  display: block;
  font-weight: 600;
  line-height: 1.55;
}
td small {
  display: block;
  margin-top: 5px;
  font-size: var(--text-xs);
  color: var(--muted);
}
td.project-cell {
  min-width: 260px;
  max-width: 420px;
  overflow-wrap: anywhere;
}
td.progress-cell {
  min-width: 130px;
}
td .meter {
  max-width: 150px;
  margin-top: 8px;
}
td.amount {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* Encabezado ordenable: se comporta como botón sin perder el estilo de columna */
.sort {
  margin: -6px -8px;
  padding: 6px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
.sort span {
  opacity: 0.45;
}
.sort:hover,
.sort.active {
  color: var(--navy);
}
.sort:hover {
  background: var(--track);
}
.sort.active span {
  opacity: 1;
}
.pagination {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-soft);
  border-top: 1px solid var(--line);
}
.pagination span {
  font-size: var(--text-xs);
  color: var(--muted);
}

/* ---------- Filtros ---------- */
.filters {
  margin-bottom: 22px;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.filters-grid {
  padding-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.filters label,
.editor label,
.chart-control {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted);
}
.filters .field,
.editor .field {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 6px;
}
.filters .wide {
  grid-column: 1/-1;
}
.more-filters > summary {
  width: fit-content;
  padding: 4px 0;
  cursor: pointer;
  color: var(--blue);
  font-size: var(--text-sm);
  font-weight: 600;
}
.filter-actions {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.filter-summary {
  flex: 1;
  min-width: 200px;
  font-size: var(--text-sm);
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ---------- Gráficos del monitoreo ---------- */
.split-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 22px;
}
.chart-legend {
  padding: 16px 22px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: var(--text-xs);
  color: var(--muted);
}
.chart-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chart-legend i {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  border-radius: 3px;
}
.chart-scroll {
  max-height: 440px;
  overflow-y: auto;
}
/* Fila de barra: etiqueta y valor arriba, marca delgada debajo */
.bar-row {
  margin-bottom: 18px;
}
.bar-row:last-child {
  margin-bottom: 0;
}
.bar-head {
  margin-bottom: 7px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  font-size: var(--text-sm);
  line-height: 1.5;
}
.bar-head b {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.clamp {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}
.bar-row small {
  display: block;
  margin-top: 6px;
  font-size: var(--text-xs);
  color: var(--muted);
}
/* Los segmentos se separan con 2px de fondo, sin bordes */
.stack,
.bullet {
  height: 12px;
  min-width: 4px;
}
.stack {
  display: flex;
  gap: 2px;
}
.stack i {
  min-width: 3px;
  border-radius: 3px;
}
.stack i:hover,
.bullet i:hover {
  filter: brightness(1.12);
}
.bullet {
  position: relative;
}
.bullet i {
  position: absolute;
  inset: 0 auto 0 0;
  min-width: 3px;
  border-radius: 3px;
}
.bullet-plan,
.swatch-plan {
  background: var(--plan);
}
.bullet-done {
  top: 3px !important;
  bottom: 3px !important;
}
.bullet-done,
.swatch-done {
  background: var(--blue);
}
.chart-empty {
  margin: 0;
}
.dashboard-chart svg {
  display: block;
  width: 100%;
  overflow: visible;
}
.dashboard-chart svg text {
  fill: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.line-chart .grid {
  stroke: var(--line);
}
.line-chart polyline {
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.line-chart .area {
  opacity: 0.1;
}
.line-chart circle {
  stroke: var(--surface);
  stroke-width: 2;
}
.line-chart .hover-col {
  fill: transparent;
}
.line-chart .hover-col:hover {
  fill: #0423540f;
}
.dashboard-finance {
  margin-bottom: 24px;
}
.dashboard-finance .card-head {
  flex-wrap: wrap;
  gap: 16px;
}
.chart-control select {
  display: block;
  max-width: 220px;
  margin-top: 5px;
}
.finance-summary {
  padding: 24px 22px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  border-bottom: 1px solid var(--line);
}
.finance-summary small {
  display: block;
  margin-bottom: 10px;
  font-size: var(--text-xs);
  color: var(--muted);
}
.finance-summary strong {
  display: block;
  color: var(--navy);
  font-size: 26px;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.finance-summary span {
  display: block;
  margin-top: 6px;
  font-size: var(--text-xs);
  color: var(--muted);
}
/* Tres tarjetas pequeñas sobre el listado de reportes */
.mini-dash {
  margin-bottom: 23px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.mini-dash .card-body {
  padding: 18px 22px;
}

/* ---------- Ficha de solicitud: cabecera y resumen ---------- */
.project-head {
  margin-bottom: 24px;
}
.project-head h1 {
  max-width: 980px;
}
.chips {
  margin: 14px 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  align-items: start;
  gap: 20px;
}
.summary-grid > * {
  min-width: 0;
}
.facts {
  margin: 0;
  display: grid;
  gap: 16px;
}
.facts dt {
  margin-bottom: 4px;
  font-size: var(--text-xs);
  color: var(--muted);
}
.facts dd {
  margin: 0;
  font-size: var(--text);
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.facts.stacked > div + div {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.description.collapsed {
  max-height: 15em;
  overflow: hidden;
  mask-image: linear-gradient(#000 60%, transparent);
}
.expand {
  margin-top: 14px;
}
.mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: var(--text-sm);
}

/* ---------- Ficha de solicitud: pestañas ---------- */
.tabs {
  margin: 26px 0 22px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line-strong);
}
.tab {
  margin-bottom: -1px;
  padding: 11px 16px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: none;
  color: var(--muted);
  font-size: var(--text);
  font-weight: 600;
  white-space: nowrap;
}
.tab:hover {
  background: var(--track);
  color: var(--navy);
}
.tab[aria-selected='true'] {
  border-bottom-color: var(--blue);
  color: var(--navy);
}
.tab:focus-visible {
  outline-offset: -2px;
}
.tab-panel > :first-child {
  margin-top: 0;
}

/* ---------- Reporte anual ---------- */
.report-picker {
  margin: 0 0 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.report-picker .active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.status-actions {
  margin: 18px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.result-card {
  margin-bottom: 18px;
}
.result-card.invalid {
  border-color: var(--danger);
}
.result-top {
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.result-top h3 {
  margin: 0 0 6px;
  line-height: 1.6;
}
.result-top p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted);
}
.number {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 1px solid #d7e5ef;
  border-radius: var(--radius-sm);
  background: var(--info-bg);
  color: var(--blue);
  font-size: var(--text-sm);
  font-weight: 650;
}
.result-controls {
  margin-left: auto;
  flex-shrink: 0;
}
.result-content {
  min-width: 0;
  padding: 22px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
}
.target-panel {
  padding-right: 24px;
  border-right: 1px solid var(--line);
}
.target-panel small {
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  color: var(--muted);
}
.target-value {
  margin: 8px 0 17px;
  font-size: 28px;
  font-weight: 600;
}
.target-value span {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--muted);
}
.baseline {
  margin-bottom: 18px;
  font-size: var(--text-sm);
}
.status-note {
  margin-top: 8px;
  font-size: var(--text-xs);
  color: var(--muted);
}
.form-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
}
.form-grid label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
}
.form-grid .hint {
  font-weight: 400;
  color: var(--muted);
}
.form-grid .field {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 8px;
}
.form-grid .wide {
  grid-column: 1/-1;
}
.form-grid label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}
.form-grid label.check input {
  width: 16px;
  height: 16px;
  margin: 0;
}
.item-error {
  margin: 0;
}
.live-rate {
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  font-size: var(--text-sm);
  color: var(--muted);
}
.live-rate b {
  font-size: 17px;
  color: var(--blue);
}
.evidence-link {
  display: inline-block;
  margin-top: 8px;
  font-size: var(--text-xs);
  font-weight: 400;
}
.reason-field {
  margin: 16px 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.reason-field label {
  display: block;
  font-size: var(--text-sm);
}
.reason-field .field {
  width: 100%;
  margin-top: 8px;
}
.form-actions {
  position: sticky;
  bottom: 12px;
  margin-top: 24px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 5px 22px #122c431a;
}
.form-actions small {
  font-size: var(--text-sm);
  color: var(--muted);
}
.history-item {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--text-sm);
  line-height: 1.6;
}
.history-item:first-child {
  padding-top: 0;
}
.history-item:last-child {
  padding-bottom: 0;
  border: 0;
}
.history-item small {
  display: block;
  margin-bottom: 8px;
  font-size: var(--text-xs);
  color: var(--muted);
}

/* ---------- Actualización desde Kissflow ---------- */
.sync {
  flex-shrink: 0;
  display: grid;
  justify-items: end;
  gap: 7px;
}
.sync small {
  max-width: 280px;
  font-size: var(--text-xs);
  color: var(--muted);
  text-align: right;
}

/* ---------- Acceso con cuenta PUCP ---------- */
.account {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: var(--text-sm);
  line-height: 1.5;
}
.account small {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted);
}
.signed-out .sidebar,
.signed-out .topbar,
.signed-out footer {
  display: none;
}
.signed-out .workspace {
  margin-left: 0;
}
.signed-out main {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login {
  width: min(430px, 100%);
  padding: 40px 34px;
  display: grid;
  justify-items: center;
  gap: 16px;
  border-top: 4px solid var(--navy);
  text-align: center;
}
.login img {
  height: 54px;
}
.login h1 {
  margin: 6px 0 0;
  font-size: 21px;
  color: var(--navy);
}
.login p {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}
.login small {
  font-size: var(--text-xs);
  color: var(--muted);
}

/* ---------- Línea de tiempo del trámite ---------- */
.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}
.tl-row,
.tl-axis {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.5fr) 290px;
  align-items: center;
  gap: 6px 22px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.tl-row:last-child {
  padding-bottom: 0;
  border: 0;
}
.tl-axis {
  padding-top: 0;
  font-size: var(--text-xs);
  color: var(--muted);
}
.tl-axis div:nth-child(2) {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.tl-axis div:last-child,
.tl-time {
  text-align: right;
}
.tl-info strong {
  display: block;
  font-size: var(--text-sm);
  line-height: 1.45;
}
.tl-info small,
.tl-time small {
  display: block;
  margin-top: 3px;
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--muted);
}
.tl-info .badge {
  margin-top: 7px;
}
.tl-par .tl-info {
  padding-left: 10px;
  border-left: 3px solid var(--line-strong);
}
.tl-row.idle .tl-info strong {
  font-weight: 500;
  color: var(--muted);
}
.tl-track {
  position: relative;
  height: 12px;
  border-radius: 3px;
  background: var(--track);
}
.tl-track i {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 4px;
  border-radius: 3px;
  background: var(--chart-1);
}
.tl-track i:hover {
  filter: brightness(1.12);
}
.tl-track i.SentBack {
  background: var(--chart-3);
}
.tl-track i.Rejected {
  background: var(--chart-5);
}
.tl-track i.Stopped {
  background: var(--chart-7);
}
.tl-track i.InProgress {
  background: var(--sky);
}
.tl-track i.mark {
  top: -4px;
  bottom: -4px;
  width: 4px;
  margin-left: -2px;
  background: var(--navy);
}
.tl-time {
  font-variant-numeric: tabular-nums;
}
.tl-time b {
  font-size: var(--text-sm);
}
@media (max-width: 850px) {
  .tl-row,
  .tl-axis {
    grid-template-columns: 1fr;
  }
  .tl-axis div:first-child,
  .tl-axis div:last-child {
    display: none;
  }
  .tl-time {
    text-align: left;
  }
}

/* ---------- Formularios administrativos y finanzas ---------- */
.editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.editor .wide,
.editor .actions,
.editor .error {
  grid-column: 1/-1;
}
.editor select[multiple] {
  min-height: 130px;
}
.editor textarea {
  min-height: 86px;
}
.finance-row {
  padding: 20px 0;
  display: grid;
  grid-template-columns: 60px repeat(3, minmax(100px, 1fr)) minmax(160px, 1.5fr);
  align-items: start;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  font-size: var(--text);
}
.finance-row > div {
  overflow-wrap: anywhere;
}
.finance-row small {
  display: block;
  margin-bottom: 7px;
  font-size: var(--text-xs);
  color: var(--muted);
}
#finance-editor {
  margin-top: 24px;
}
.quality-detail {
  margin: 16px 0;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--bg);
  font-size: var(--text-sm);
  line-height: 1.7;
}

/* ---------- Diálogos y mensajes ---------- */
dialog {
  width: calc(100% - 32px);
  max-width: 760px;
  max-height: 90vh;
  padding: 28px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: var(--ink);
  box-shadow: var(--shadow-pop);
}
dialog#confirm {
  max-width: 460px;
}
dialog::backdrop {
  background: #102b4a66;
  backdrop-filter: blur(3px);
}
dialog h2 {
  margin-bottom: 17px;
  font-size: 20px;
}
dialog p {
  font-size: var(--text);
  color: var(--muted);
}
dialog .actions {
  margin-top: 23px;
  justify-content: flex-end;
}
dialog .field {
  width: 100%;
}
#tip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  max-width: 280px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: #fff;
  font-size: var(--text-xs);
  line-height: 1.55;
  white-space: pre-line;
  pointer-events: none;
  box-shadow: 0 6px 20px #00152b40;
}
#toast {
  position: fixed;
  bottom: 27px;
  left: 50%;
  z-index: 10;
  display: none;
  max-width: 90vw;
  padding: 14px 22px;
  transform: translateX(-50%);
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  font-size: var(--text-sm);
  box-shadow: 0 8px 35px #00152b40;
}

/* ---------- Adaptación a pantallas ---------- */
@media (min-width: 1450px) {
  main {
    padding-top: 43px;
  }
  .stat {
    padding: 24px;
  }
}
@media (max-width: 1150px) {
  .sidebar {
    width: 210px;
    padding-inline: 15px;
  }
  .workspace {
    margin-left: 210px;
  }
  main {
    padding: 28px 24px;
  }
  .topbar {
    padding: 0 24px;
  }
  .breadcrumb {
    max-width: 260px;
    line-height: 1.6;
  }
  .stat {
    padding: 17px;
  }
  .demo-label {
    display: none;
  }
}
@media (max-width: 1050px) {
  .filters,
  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .split-charts,
  .mini-dash,
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .role-label select {
    max-width: 170px;
  }
}
@media (max-width: 850px) {
  /* La barra lateral queda como riel de iconos */
  .sidebar {
    width: 76px;
    padding: 16px 10px 24px;
  }
  .brand,
  .nav-label,
  .product,
  .sidebar-bottom,
  nav a span,
  .sidebar .nav-count,
  .breadcrumb {
    display: none;
  }
  nav {
    margin-top: 10px;
  }
  nav a {
    justify-content: center;
    padding: 13px 6px;
  }
  .mobile-brand {
    display: block;
    flex-shrink: 0;
    padding: 16px 0;
  }
  .mobile-brand img {
    display: block;
    width: auto;
    height: auto;
    max-width: 120px;
  }
  .workspace {
    margin-left: 76px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .page-head {
    align-items: flex-start;
  }
  .result-content {
    grid-template-columns: 170px 1fr;
    gap: 17px;
  }
  .target-panel {
    padding-right: 17px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .wide {
    grid-column: auto;
  }
  .finance-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .finance-row > strong {
    grid-column: 1/-1;
  }
}
@media (max-width: 550px) {
  .sidebar {
    width: 58px;
    padding-inline: 5px;
  }
  .workspace {
    margin-left: 58px;
  }
  main {
    padding: 24px 15px;
  }
  .topbar {
    height: 78px;
    padding: 12px 15px;
    gap: 8px;
  }
  .profile {
    margin-left: auto;
  }
  .role-label select {
    max-width: 145px;
  }
  .mobile-brand img {
    max-width: 86px;
  }
  h1 {
    font-size: 24px;
  }
  .page-head {
    flex-direction: column;
    gap: 17px;
  }
  .stats {
    gap: 10px;
  }
  .stat {
    padding: 15px 12px;
  }
  .stat-value {
    font-size: 26px;
  }
  .stats.fit .stat-value {
    font-size: 19px;
  }
  .sparkline {
    display: none;
  }
  .card-head,
  .card-body {
    padding: 17px;
  }
  .card-head,
  .section-intro,
  .pagination,
  .result-top {
    flex-wrap: wrap;
  }
  .section-intro {
    align-items: flex-start;
    gap: 10px;
  }
  .filters {
    padding: 14px;
  }
  .filters,
  .filters-grid,
  .editor {
    grid-template-columns: 1fr;
  }
  .editor .wide,
  .editor .actions,
  .editor .error {
    grid-column: auto;
  }
  .chart-legend {
    padding: 14px 17px 0;
  }
  .finance-summary {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .tab {
    padding: 10px 12px;
  }
  .result-top {
    padding: 17px;
    gap: 10px;
  }
  .result-controls {
    margin-left: 40px;
  }
  .result-content {
    grid-template-columns: 1fr;
    padding: 17px;
  }
  .target-panel {
    padding: 0 0 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .target-value {
    margin: 0;
    font-size: 24px;
  }
  .baseline {
    margin: 0;
  }
  .target-panel .status-note {
    width: 100%;
  }
  .form-actions {
    bottom: 5px;
    padding: 13px;
    flex-direction: column;
    align-items: stretch;
  }
  .form-actions .btn {
    flex: 1;
  }
  dialog {
    padding: 20px;
  }
  footer {
    padding: 16px 15px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  footer > div {
    padding-left: 0;
    border-left: 0;
  }
}
@media (max-width: 380px) {
  .topbar {
    height: auto;
    min-height: 88px;
    flex-wrap: wrap;
    gap: 8px 16px;
  }
  .profile {
    padding-bottom: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Ajustes de composición ---------- */
/* Solo el gráfico financiero puede tener muchas filas (una por unidad); los demás crecen con su contenido */
.split-charts .chart-scroll {
  max-height: none;
}
.tabs {
  overflow-y: hidden;
}
td .badge {
  white-space: nowrap;
}
