/* ARB-A · portal. Tokens de "Corporate Precision" (Material 3, claro). */

/* Fuentes auto-hospedadas (SIL Open Font License 1.1, Google Fonts).
   No se cargan de terceros: la CSP es `default-src 'self'`. */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/fraunces-600.woff2") format("woff2");
}
@font-face {
  font-family: "Edu TAS Beginner";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/edu-tas-beginner.woff2") format("woff2");
}

:root {
  --primario: #0b57d0;
  --primario-hover: #0842a0;
  --superficie: #f8f9fa;
  --tarjeta: #ffffff;
  --borde: #e1e3e1;
  --outline: #c4c7c5;
  --texto: #1f1f1f;
  --texto-suave: #444746;
  --error: #b3261e;
  --exito: #146c2e;
  --alerta: #8a5100;
  --radio: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--superficie);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

/* Portal (login, mis archivos, admin solo conserva la tipografía del sistema). */
body.portal {
  font-family: "Edu TAS Beginner", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
}
body.portal h1,
body.portal .marca {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  letter-spacing: 0;
}
body.portal .marca { font-size: 24px; letter-spacing: .01em; }
body.portal h1 { font-size: 34px; }

a { color: var(--primario); text-decoration: none; }
a:hover { color: var(--primario-hover); }

/* Barra superior */
.barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  height: 56px;
  background: var(--tarjeta);
  border-bottom: 1px solid var(--borde);
}
.marca { font-weight: 700; letter-spacing: .04em; color: var(--texto); }
.nav { display: flex; align-items: center; gap: 18px; }
.nav-enlace { color: var(--texto-suave); }
.nav-enlace:hover { color: var(--primario); }
.nav-usuario {
  color: var(--texto-suave);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-salir { margin: 0; }
.enlace {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--texto-suave);
  cursor: pointer;
}
.enlace:hover { color: var(--error); }

/* Contenido */
.contenido { max-width: 1080px; margin: 0 auto; padding: 28px 24px 56px; }
.pie { text-align: center; color: var(--texto-suave); font-size: 12px; padding: 0 24px 32px; }

h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.sub { color: var(--texto-suave); margin: 0 0 22px; }

/* Tarjetas */
.tarjeta {
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 20px;
}

/* Login */
.login { max-width: 380px; margin: 8vh auto 0; }
.login .tarjeta { padding: 28px; }
.login h1 { margin-bottom: 18px; text-align: center; }

/* Formularios */
.campo { margin-bottom: 16px; }
.campo label { display: block; font-weight: 500; margin-bottom: 6px; }
.campo input,
.filtros input,
.filtros select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: #fff;
  color: var(--texto);
  font: inherit;
}
.campo input:focus,
.filtros input:focus,
.filtros select:focus {
  outline: 2px solid var(--primario);
  outline-offset: -1px;
}

.boton {
  display: inline-block;
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--primario);
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.boton:hover { background: var(--primario-hover); color: #fff; }
.boton-ancho { width: 100%; }
.boton-suave {
  background: transparent;
  border: 1px solid var(--outline);
  color: var(--primario);
}
.boton-suave:hover { background: var(--superficie); }

/* Avisos */
.aviso {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
  border: 1px solid var(--borde);
}
.aviso-error { background: #fce8e6; border-color: #f0b4ae; color: var(--error); }
.aviso-ok { background: #e6f4ea; border-color: #b7dfc2; color: var(--exito); }

/* Filtros */
.filtros { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filtros input { flex: 1 1 260px; }
.filtros select { flex: 0 0 190px; width: auto; }
.filtros .check-filtro { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.filtros .check-filtro input { width: auto; flex: 0 0 auto; }

/* Panel de administración */
.seccion { margin-bottom: 34px; }
.seccion h2 { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.rejilla-datos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.dato { display: flex; flex-direction: column; gap: 6px; }
.dato-etiqueta { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--texto-suave); }
.dato-valor { font-size: 24px; font-weight: 600; }
.dato-pie { font-size: 13px; color: var(--texto-suave); }
progress.uso { width: 100%; height: 8px; appearance: none; border: 0; }
progress.uso::-webkit-progress-bar { background: var(--superficie); border-radius: 999px; border: 1px solid var(--borde); }
progress.uso::-webkit-progress-value { background: var(--primario); border-radius: 999px; }
progress.uso::-moz-progress-bar { background: var(--primario); border-radius: 999px; }
.col-check { width: 40px; }
.acciones-panel { display: flex; justify-content: flex-end; margin-top: 12px; }
.boton-peligro { background: var(--error); }
.boton-peligro:hover { background: #8c1d18; }

/* Tabla */
.tabla-caja {
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; }
th {
  background: var(--superficie);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--texto-suave);
  border-bottom: 1px solid var(--borde);
}
tbody tr { border-bottom: 1px solid var(--borde); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--superficie); }
td.nombre { font-weight: 500; }
td.accion { text-align: right; }

/* Etiquetas */
.etiqueta {
  display: inline-block;
  padding: 2px 8px;
  margin: 0 4px 2px 0;
  border-radius: 999px;
  background: var(--superficie);
  border: 1px solid var(--borde);
  color: var(--texto-suave);
  font-size: 12px;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.badge-ok { background: #e6f4ea; color: var(--exito); }
.badge-alerta { background: #fce8e6; color: var(--error); }
.badge-pronto { background: #fef7e0; color: var(--alerta); }

/* Estado vacío */
.vacio { text-align: center; padding: 48px 24px; color: var(--texto-suave); }
.vacio h2 { font-size: 16px; font-weight: 600; color: var(--texto); margin: 0 0 6px; }

/* Detalle de descarga */
.detalle { max-width: 520px; margin: 8vh auto 0; text-align: center; }
.detalle h1 { font-size: 20px; word-break: break-all; }
.detalle .dato { color: var(--texto-suave); margin: 6px 0; }
.detalle .boton { margin-top: 18px; }

@media (max-width: 640px) {
  .barra { padding: 0 14px; gap: 10px; }
  .nav { gap: 12px; }
  .nav-usuario { display: none; }
  .contenido { padding: 20px 14px 40px; }
  th:nth-child(3), td:nth-child(3) { display: none; }
}

/* API-Key recién regenerada: se muestra una sola vez. */
.clave-nueva { padding: 16px; border-color: var(--primario); }
.clave-nueva p { margin: 0 0 8px; }
code.clave {
  display: block;
  padding: 10px 12px;
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  word-break: break-all;
  user-select: all;
}

/* --- Composición tipográfica del portal (el panel admin no se toca) --- */
body.portal { line-height: 1.5; }

body.portal h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0;
  margin: 0 0 6px;
}

body.portal .marca { font-weight: 600; }
body.portal .nav-enlace,
body.portal .nav-usuario,
body.portal .enlace { font-size: 16px; }

body.portal .sub { font-size: 17px; margin-bottom: 24px; }
body.portal .pie { font-size: 14px; }

body.portal .campo label { font-size: 16px; font-weight: 600; }
body.portal .aviso { font-size: 17px; }

body.portal .boton { font-size: 17px; font-weight: 600; padding: 11px 20px; }

body.portal th { font-size: 13px; letter-spacing: .06em; }
body.portal td { padding: 13px 16px; }
body.portal td.nombre { font-weight: 600; }

body.portal .etiqueta,
body.portal .badge { font-size: 13px; }

body.portal .dato-etiqueta { font-size: 13px; }
body.portal .dato-valor { font-size: 26px; }
body.portal .dato-pie { font-size: 15px; }

body.portal .vacio h2 { font-size: 20px; }
body.portal .detalle h1 { font-size: 26px; }
