:root {
  color-scheme: light;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #152934;
  background: #f3f6f7;
  --ink: #152934;
  --mute: #52656d;
  --line: #d9e4e7;
  --brand: #087a70;
  --brand-dark: #065b55;
  --soft: #ebf7f4;
  --sombra: 0 2px 8px rgb(22 52 68 / 4%);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 290px; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #419e95;
  outline-offset: 2px;
}
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 4vw, 2.1rem); line-height: 1.22; letter-spacing: -.045em; }
h2 { font-size: 1.1rem; line-height: 1.3; letter-spacing: -.018em; }

.inicio { width: fit-content; margin: 4rem auto; color: var(--mute); }
.marca { display: flex; align-items: center; gap: .7rem; font-weight: 725; letter-spacing: -.025em; }
.isotipo {
  display: inline-grid;
  flex: 0 0 2.25rem;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  background: var(--brand);
  color: white;
  border-radius: .62rem;
  font-size: .75rem;
  letter-spacing: .045em;
}

.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background: radial-gradient(ellipse at 50% 10%, #e4f3f0 0%, transparent 56%), #f3f6f7;
}
.login-column { width: min(100%, 448px); display: grid; gap: 1.45rem; }
.login-column > .marca { justify-self: center; }
.login-panel.tarjeta { padding: clamp(1.3rem, 5vw, 2.35rem); gap: 1.15rem; }
.login-panel h1 { font-size: clamp(1.52rem, 5vw, 1.92rem); }
.intro { color: var(--mute); font-size: .95rem; }
.login-panel form > .primario { margin-top: .4rem; }

.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100dvh; }
.lateral {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  gap: 2.1rem;
  padding: 1.65rem 1.2rem 1.25rem;
  color: #f0fafb;
  background: #12333c;
}
.lateral .marca { padding-left: .35rem; white-space: nowrap; }
.lateral .isotipo { background: #a8e3d7; color: #12333c; }
.lateral nav { display: grid; gap: .3rem; }
.nav-boton, .salir {
  padding: .6rem .8rem;
  border: 0;
  border-radius: .48rem;
  background: transparent;
  color: #cce0e3;
  text-align: start;
  font-size: .95rem;
  font-weight: 600;
}
.nav-boton:hover, .salir:hover { color: white; background: #214752; }
.nav-boton[aria-current="page"] { color: white; background: #26615e; }
.lateral-pie { display: grid; gap: .85rem; margin-top: auto; }
.perfil { display: flex; align-items: center; gap: .65rem; min-width: 0; padding: .9rem .25rem 0; border-top: 1px solid #34525a; }
.perfil > :last-child { min-width: 0; }
.perfil strong, .perfil span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perfil strong { font-size: .83rem; font-weight: 650; }
.perfil span { color: #cce0e3; font-size: .77rem; }
.avatar {
  display: grid; place-items: center; flex: 0 0 2rem; height: 2rem; border-radius: 50%;
  background: #2a5961; color: #e0f5f2; font-size: .71rem; font-weight: 750;
}
.salir { width: fit-content; padding: .3rem .45rem; font-size: .84rem; }
.espacio { display: flex; flex-direction: column; gap: 1.15rem; margin: 0 auto; max-width: 1440px; width: 100%; padding: clamp(1.15rem, 4vw, 3rem); }
.encabezado { padding: .4rem 0 .2rem; }
.modulo { display: grid; min-width: 0; gap: 1.1rem; }
.tarjeta { display: grid; min-width: 0; gap: 1rem; padding: 1.2rem; border: 1px solid var(--line); border-radius: .72rem; background: white; box-shadow: var(--sombra); }
.cabecera-panel { display: flex; gap: .5rem 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.ayuda { color: var(--mute); font-size: .86rem; }
.cabecera-panel .ayuda { margin-top: .2rem; }
.vacio { padding: 1.55rem 1rem; color: var(--mute); text-align: center; background: #f6f9fa; border-radius: .48rem; border: 1px dashed #d4e1e4; }

.formulario { display: grid; min-width: 0; gap: .85rem; }
.campo { display: grid; min-width: 0; gap: .28rem; }
.campo > span { font-size: .88rem; font-weight: 630; }
.campo input, .campo select, .campo textarea {
  min-width: 0;
  width: 100%;
  min-height: 2.65rem;
  padding: .44rem .65rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid #bfced3;
  border-radius: .45rem;
}
.campo input[type="file"] { background: #f9fbfb; }
.campo input[type="file"]::file-selector-button {
  margin-right: .65rem; padding: .26rem .66rem; border: 1px solid #bfd5d2; border-radius: .32rem;
  color: var(--brand-dark); background: var(--soft); font: inherit; font-size: .86rem; cursor: pointer;
}
.campo input:read-only { background: #f5f8f9; }
.campo textarea { resize: vertical; min-height: 6rem; }
.primario, .secundario, .discreto {
  width: fit-content; border: 1px solid transparent; border-radius: .45rem;
  padding: .52rem .85rem; min-height: 2.65rem; white-space: nowrap; font-weight: 650; font-size: .89rem;
}
.primario { color: white; background: var(--brand); }
.primario:hover { background: var(--brand-dark); }
.secundario { color: #164a47; background: white; border-color: #bdd2d0; }
.secundario:hover { background: var(--soft); }
.discreto { min-height: auto; padding: .25rem .4rem; color: var(--brand-dark); background: transparent; font-size: .85rem; }
.discreto:hover { background: var(--soft); }
.peligro { color: #9c2b36; }
.peligro:hover { background: #fff1f0; }
.login-panel form > .primario { width: 100%; }
.acciones, .filtros { display: flex; align-items: end; gap: .65rem; flex-wrap: wrap; }
.filtros .campo { flex: 0 1 auto; min-width: 8rem; }
.busqueda .campo { flex: 0 1 24rem; }
.aviso { padding: .55rem .75rem; border-radius: .42rem; background: #edf5f5; color: #255452; font-size: .9rem; }
.error { background: #fff0f1; color: #982736; }
.exito { background: #e9f7ef; color: #225f48; }
progress { width: 100%; height: .6rem; accent-color: var(--brand); }
.vista-previa:empty { display: none; }
.vista-previa { display: grid; gap: .8rem; }

.metricas { display: grid; min-width: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.metricas .tarjeta { gap: .4rem; align-content: start; }
.metricas .tarjeta:first-child { background: var(--soft); border-color: #c6ddd8; }
.kpi-etiqueta, .resumen-carga dt { color: var(--mute); font-size: .86rem; font-weight: 570; }
.kpi-monto { font-variant-numeric: tabular-nums; font-size: clamp(1.22rem, 2.45vw, 1.88rem); font-weight: 720; letter-spacing: -.045em; overflow-wrap: anywhere; }
.grafico-scroll, .tabla-scroll { overflow-x: auto; }
.grafico { display: block; width: 100%; min-width: 500px; height: auto; }
.grafico text { fill: var(--mute); font-size: 12px; }
.guia { stroke: #dde8e9; stroke-width: 1; }
.barra { fill: var(--brand); }
.barra:hover { fill: #159d8e; }
.resumen-carga { display: flex; gap: .8rem 1.6rem; flex-wrap: wrap; margin: 0; padding: .75rem .9rem; background: #f5f9f9; border: 1px solid #e4eded; border-radius: .45rem; }
.resumen-carga dd { margin: .15rem 0 0; font-weight: 630; overflow-wrap: anywhere; }
table { border-collapse: collapse; width: 100%; font-size: .87rem; }
th, td { border-bottom: 1px solid #e6edef; padding: .66rem .55rem; text-align: start; vertical-align: top; }
th { color: #34515a; background: #f4f8f9; font-size: .81rem; white-space: nowrap; font-weight: 680; }
td { overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
.paginacion { display: flex; align-items: center; justify-content: flex-end; gap: .75rem; margin-top: .6rem; color: var(--mute); font-size: .84rem; }
.estado { display: inline-block; padding: .16rem .52rem; background: #edf2f4; color: #405964; border-radius: 1rem; font-size: .76rem; font-weight: 650; white-space: nowrap; }
.estado-activo { background: #e3f5ee; color: #12624d; }
.estado-pendiente { background: #fff3d7; color: #715108; }
.texto-nota { white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .lateral { position: static; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .8rem; height: auto; padding: .8rem 1rem; }
  .lateral nav { grid-area: 2 / 1 / 3 / 3; display: flex; overflow-x: auto; padding: 2px; }
  .nav-boton { padding: .42rem .62rem; font-size: .88rem; }
  .lateral-pie { grid-area: 1 / 2 / 2 / 3; margin: 0; align-self: center; }
  .perfil { display: none; }
  .espacio { padding: 1rem; }
}
@media (max-width: 500px) {
  .metricas { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .metricas .tarjeta:first-child { grid-column: 1 / -1; }
  .tarjeta { padding: .9rem; }
}
