/* ============================================================
   Relevamiento Taxis — Sistema visual tipo Poncho gob.ar
   modernizado. PC primero, responsive móvil.
   Tipografías: Archivo (display) + Public Sans (body).
   ============================================================ */

:root {
  /* Paleta institucional argentina */
  --azul: #0072bb;          /* azul Poncho */
  --azul-700: #005a94;
  --azul-900: #003c65;
  --celeste: #34b5e2;
  --celeste-100: #e3f4fb;
  --sol: #f7941d;           /* naranja institucional */
  --bg: #f0f4f8;
  --surface: #ffffff;
  --fg: #10243a;
  --fg-soft: #4a5f74;
  --border: #d4dfea;
  --err: #b0263f;
  --err-bg: #fdeef0;
  --ok: #0a7a2f;
  --ok-bg: #e8f6ec;
  --warn-bg: #fff8dc;
  --media: 960px; /* breakpoint móvil */
  --radius: 8px;
  --shadow-card: 0 1px 2px rgba(16,36,58,.06), 0 4px 14px rgba(16,36,58,.07);
  --font-display: "Archivo", sans-serif;
  --font-body: "Public Sans", sans-serif;
}

/* Google Fonts con fallback si CDN cae */
@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800&family=Public+Sans:wght@400;500;600;700&display=swap");

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body), system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3, .brand-name {
  font-family: var(--font-display), system-ui, sans-serif;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
h1 { font-size: 1.8rem; font-weight: 800; margin: 0 0 .25rem; }
h2 { font-size: 1.25rem; font-weight: 700; margin: 1.25rem 0 .5rem; }
h3 { font-size: 1.05rem; font-weight: 700; margin: 1rem 0 .4rem; }
code { background: var(--celeste-100); padding: .05em .35em; border-radius: 4px; font-size: .9em; }

a { color: var(--azul); }
a:hover { color: var(--azul-700); }

/* Foco visible accesible en TODO control interactivo */
:focus-visible {
  outline: 3px solid var(--celeste);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Header institucional ---------- */
.topbar {
  background: var(--azul);
  color: #fff;
  border-bottom: 4px solid var(--sol);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: .6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  text-decoration: none;
  font-family: var(--font-display), sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}
.brand:hover { color: #fff; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--sol);
  color: var(--azul-900);
  font-weight: 800;
  font-size: .85rem;
  letter-spacing: 0;
  transition: transform .2s ease;
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }
.brand-sub { display: block; font-size: .72rem; font-weight: 500; opacity: .85; font-family: var(--font-body), sans-serif; }

.mainnav { display: flex; gap: .25rem; align-items: center; flex-wrap: wrap; }
.mainnav a {
  color: #fff;
  text-decoration: none;
  padding: .45rem .8rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .95rem;
  transition: background .15s ease, transform .15s ease;
}
.mainnav a:hover { background: rgba(255,255,255,.16); color: #fff; }
.mainnav a[aria-current="page"] { background: #fff; color: var(--azul-900); }
.mainnav a.nav-logout {
  margin-left: .5rem;
  background: rgba(0,0,0,.22);
}
.mainnav a.nav-logout:hover { background: var(--err); }

/* ---------- Stepper (cargar) ---------- */
.stepper {
  list-style: none;
  display: flex;
  gap: .4rem;
  margin: 0;
  padding: .75rem 1rem;
  max-width: 980px;
  overflow-x: auto;
  counter-reset: step;
}
.stepper li { flex: 1 0 auto; }
.stepper a {
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  color: var(--fg-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .35rem .8rem .35rem .4rem;
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color .15s ease, color .15s ease, transform .15s ease;
}
.stepper a::before {
  counter-increment: step;
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--border);
  color: var(--fg-soft);
  font-weight: 700;
  font-size: .8rem;
  transition: background .15s ease, color .15s ease;
}
.stepper a:hover { border-color: var(--azul); color: var(--azul-700); transform: translateY(-1px); }
.stepper a.active { border-color: var(--azul); color: var(--azul-900); box-shadow: inset 0 0 0 1px var(--azul); }
.stepper a.active::before { background: var(--azul); color: #fff; }

/* ---------- Layout ---------- */
main {
  max-width: 980px;
  margin: 1rem auto 3rem;
  padding: 0 1rem;
}
main > .pageintro { margin-bottom: 1rem; }
.confdense {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--fg-soft);
  background: var(--warn-bg);
  border: 1px solid #f0e3aa;
  border-radius: 999px;
  padding: .15rem .6rem;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  animation: rise .35s ease both;
}
.card:nth-child(2) { animation-delay: .04s; }
.card:nth-child(3) { animation-delay: .08s; }
.card:nth-child(4) { animation-delay: .12s; }
.card:nth-child(5) { animation-delay: .16s; }
.card:nth-child(6) { animation-delay: .2s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
  * { transition-duration: 0s !important; }
}

/* fieldset → card con leyenda estilo Poncho */
fieldset.card {
  border-top: 4px solid var(--azul);
  padding-top: 1rem;
}
fieldset.card legend {
  font-family: var(--font-display), sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--azul-900);
  padding: 0 .25rem;
}
fieldset.card legend small { font-weight: 500; color: var(--fg-soft); }

/* ---------- Formularios ---------- */
label { display: block; margin: .8rem 0 .25rem; font-weight: 600; font-size: .93rem; color: var(--fg); }

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input:not([type]), select, textarea {
  width: 100%;
  font-size: 1rem;
  padding: .55rem .7rem;
  font-family: var(--font-body), sans-serif;
  color: var(--fg);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:not([type="checkbox"]):not([type="radio"]):hover,
select:hover { border-color: var(--celeste); }
input.is-invalid:not([type="checkbox"]):not([type="radio"]) {
  border-color: var(--err);
  background: var(--err-bg);
}
input.is-valid:not([type="checkbox"]):not([type="radio"]) {
  border-color: var(--ok);
  background: var(--ok-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%230a7a2f' d='M6.5 11.2 3.7 8.4l-1 1 3.8 3.8 7.5-7.5-1-1z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .55rem center;
  background-size: 1em;
  padding-right: 2.1rem;
}

/* error inline bajo el campo */
.field-error {
  margin: .25rem 0 0;
  font-size: .85rem;
  font-weight: 600;
  color: var(--err);
  min-height: 0;
}
.field-ok { color: var(--ok); }

/* resumen de errores */
.error-summary {
  background: var(--err-bg);
  border: 1px solid var(--err);
  border-left-width: 6px;
  border-radius: 6px;
  padding: .8rem 1rem;
  margin-bottom: 1rem;
}
.error-summary[hidden] { display: none; }
.error-summary strong { color: var(--err); font-family: var(--font-display), sans-serif; }
.error-summary ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.error-summary a { color: var(--err); font-weight: 600; }

/* ---------- Botones ---------- */
button, .btn {
  font-family: var(--font-body), sans-serif;
  font-size: 1rem;
  font-weight: 700;
  padding: .6rem 1.2rem;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: var(--azul);
  color: #fff;
  width: auto;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 1px 2px rgba(0,60,101,.25);
}
button:hover { background: var(--azul-700); transform: translateY(-1px); }
button:active { transform: none; box-shadow: none; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button[type="button"].btn-ghost {
  background: transparent;
  color: var(--azul-700);
  box-shadow: inset 0 0 0 2px var(--azul);
}
button[type="button"].btn-ghost:hover { background: var(--celeste-100); }
form > p > button, .form-actions button { width: auto; }
form button { width: auto; } /* botones inline, no full-width */

/* ---------- Checkbox/radio estilo chip ---------- */
.choice {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: .3rem .5rem .3rem 0;
  padding: .35rem .7rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
  font-size: .92rem;
  user-select: none;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.choice:hover { border-color: var(--azul); transform: translateY(-1px); }
.choice input { accent-color: var(--azul); width: auto; margin: 0; }
.choice:has(input:checked) {
  background: var(--celeste-100);
  border-color: var(--azul);
  color: var(--azul-900);
  box-shadow: inset 0 0 0 1px var(--azul);
}
.choice:has(input:disabled) { opacity: .45; cursor: not-allowed; transform: none; }

fieldset p > label.choice { display: inline-flex; margin: .3rem .5rem .3rem 0; }

/* ---------- Badges / estado ---------- */
.badge {
  display: inline-block;
  padding: .15rem .6rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  background: var(--celeste-100);
  color: var(--azul-900);
  border: 1px solid var(--celeste);
}
.badge-nivel-bajo { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.badge-nivel-medio { background: var(--warn-bg); color: #7a6000; border-color: #d9b900; }
.badge-nivel-critico { background: var(--err-bg); color: var(--err); border-color: var(--err); }

.score-box {
  margin-top: 1rem;
  padding: .8rem 1rem;
  background: linear-gradient(90deg, var(--celeste-100), var(--surface) 60%);
  border: 1px solid var(--celeste);
  border-radius: 6px;
  font-size: 1.05rem;
}
.score-box strong { font-family: var(--font-display), sans-serif; font-size: 1.3rem; color: var(--azul-900); }

/* Avisos */
.error { color: var(--err); min-height: 1.5em; font-weight: 600; }
.oktext { color: var(--ok); font-weight: 600; }
.warn { color: #7a6000; font-weight: 600; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--border); }
thead th {
  background: var(--azul);
  color: #fff;
  font-family: var(--font-display), sans-serif;
  font-weight: 700;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  position: sticky;
  top: 0;
}
tbody tr:nth-child(even) { background: #f7fafc; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--celeste-100); }

/* Filtros form → card inline */
.filters-card { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .25rem 1rem; align-items: end; }
.filters-card .form-actions { grid-column: 1 / -1; display: flex; gap: .6rem; flex-wrap: wrap; margin: .5rem 0 .25rem; }

.stub {
  padding: 2.5rem;
  text-align: center;
  color: var(--fg-soft);
}
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  h1 { font-size: 1.45rem; }
  .topbar { position: static; }
  .topbar-inner { padding: .5rem .75rem; }
  .stepper { gap: .3rem; padding: .6rem .75rem; }
  .stepper a { padding: .3rem .6rem .3rem .3rem; font-size: .78rem; }
  main { margin-top: .8rem; }
  .card { padding: 1rem; }
  .form-actions button, form > p button { width: 100%; }
  .filters-card .form-actions button { width: auto; flex: 1; }
}
