/* ==========================================================================
   Portal de Prestadores - SPRINT-UI design system (aprobado 2026-07)
   Fuentes self-hosted (sin CDN externo, regla del proyecto).
   ========================================================================== */
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono-var.woff2') format('woff2');
  font-weight: 100 800;
  font-display: swap;
}

:root {
  /* Paleta SPRINT-UI */
  --sui-primary: #0d47a1;   /* azul institucional (logo) */
  --sui-accent: #1f6feb;    /* acento (white-label por tenant) */
  --sui-accent-soft: #e8f0fe;
  --sui-accent-deep: #0b3d91;
  --sui-ink: #13233a;       /* navy - titulos / modo documento */
  --sui-body: #1f2933;
  --sui-muted: #5b6b7f;
  --sui-line: #e3e8ef;
  --sui-bg: #f4f6fa;
  --sui-surface: #ffffff;
  --sui-ok-bg: #e6f4ec; --sui-ok-fg: #04663a;
  --sui-warn-bg: #fdf3d2; --sui-warn-fg: #7a4d0b;
  --sui-err-bg: #fde8e8; --sui-err-fg: #9b1c1c;
  --sui-radius: 12px;
  --sui-radius-sm: 8px;
  --sui-shadow: 0 1px 3px rgba(19, 35, 58, 0.06), 0 4px 16px rgba(19, 35, 58, 0.05);
  --sui-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--sui-bg);
  color: var(--sui-body);
  min-height: 100vh;
  font-feature-settings: 'cv05', 'ss01';
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: var(--sui-ink); font-weight: 650; letter-spacing: -0.01em; }
.sui-mono, .card-numero, .tabla td.mono { font-family: var(--sui-mono); font-feature-settings: 'tnum'; }

/* --------------------------------------------------------- Login */
.login-body {
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(31, 111, 235, 0.10), transparent),
    var(--sui-bg);
}
.login-card {
  background: var(--sui-surface);
  border: 1px solid var(--sui-line);
  border-radius: var(--sui-radius);
  box-shadow: var(--sui-shadow);
  padding: 2.5rem;
  width: 100%;
  max-width: 410px;
  margin: 1rem;
}
.login-logo { height: 34px; margin-bottom: 1.4rem; display: block; }
.login-card h1 { font-size: 1.35rem; margin-bottom: 0.25rem; }
.subtitle { color: var(--sui-muted); margin-bottom: 1.5rem; font-size: 0.95rem; }
label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--sui-ink); margin: 0.9rem 0 0.35rem; }
input, select, textarea {
  width: 100%;
  padding: 0.62rem 0.75rem;
  border: 1px solid var(--sui-line);
  border-radius: var(--sui-radius-sm);
  font-size: 0.97rem;
  font-family: inherit;
  background: var(--sui-surface);
  color: var(--sui-body);
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--sui-accent);
  box-shadow: 0 0 0 3px var(--sui-accent-soft);
}
button[type="submit"] {
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.72rem;
  background: var(--sui-accent);
  color: #fff;
  border: none;
  border-radius: var(--sui-radius-sm);
  font-size: 0.98rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s;
}
button[type="submit"]:hover { background: var(--sui-accent-deep); }
button[type="submit"]:disabled { background: #9db9ec; cursor: wait; }

.alert { padding: 0.72rem 0.95rem; border-radius: var(--sui-radius-sm); margin-bottom: 0.9rem; font-size: 0.9rem; }
.alert-error { background: var(--sui-err-bg); color: var(--sui-err-fg); border: 1px solid #f6c6c6; }
.alert-success { background: var(--sui-ok-bg); color: var(--sui-ok-fg); border: 1px solid #a7d7bd; }

/* --------------------------------------------------------- Layout */
.topbar {
  background: var(--sui-ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1.4rem;
}
.topbar .brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; }
.topbar-logo { height: 22px; display: block; filter: brightness(0) invert(1); opacity: 0.95; }
.topbar-sep { width: 1px; height: 20px; background: rgba(255, 255, 255, 0.22); }
.topbar-titulo { color: #fff; font-weight: 600; font-size: 0.95rem; letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 0.9rem; }
.user-email { font-size: 0.85rem; color: #b8c4d4; font-family: var(--sui-mono); }
.btn-secondary {
  background: transparent; color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--sui-radius-sm);
  padding: 0.38rem 0.95rem; cursor: pointer; font-size: 0.85rem; font-family: inherit;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.10); }

/* --------------------------------------------------------- App shell (sidebar) */
body.app { display: flex; min-height: 100vh; background: var(--sui-bg); }
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--sui-ink);
  color: #cdd8e6;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-logo {
  display: flex; align-items: baseline; gap: 0.5rem;
  padding: 1.15rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-logo img { height: 22px; filter: brightness(0) invert(1); }
.sidebar-sub { font-size: 0.72rem; color: #7f93ac; letter-spacing: 0.06em; text-transform: uppercase; }
.sidebar-nav { padding: 0.6rem 0.6rem 1.2rem; overflow-y: auto; }
.nav-group {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: #6f839c; padding: 1rem 0.7rem 0.35rem;
}
.nav-link {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.52rem 0.7rem; margin: 0.1rem 0;
  border-radius: var(--sui-radius-sm);
  color: #c3cfe0; text-decoration: none; font-size: 0.9rem;
  transition: background 0.12s, color 0.12s;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-link.active { background: var(--sui-accent); color: #fff; font-weight: 600; }
.nav-ico { font-size: 0.5rem; opacity: 0.8; }
.nav-link.active .nav-ico { opacity: 1; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-main .topbar {
  background: var(--sui-surface);
  color: var(--sui-ink);
  border-bottom: 1px solid var(--sui-line);
  box-shadow: none;
}
.app-main .topbar-titulo { color: var(--sui-ink); }
.app-main .user-email { color: var(--sui-muted); }
.app-main .btn-secondary {
  color: var(--sui-body); border-color: var(--sui-line);
}
.app-main .btn-secondary:hover { background: #f1f4f8; }
.content { padding: 1.8rem 2rem; max-width: 1200px; width: 100%; }
.content h1 { font-size: 1.5rem; margin-bottom: 0.2rem; }

@media (max-width: 780px) {
  body.app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar-logo { border-bottom: none; padding: 0.8rem 1rem; }
  .sidebar-nav { display: flex; flex-wrap: wrap; padding: 0 0.6rem 0.6rem; gap: 0.2rem; }
  .nav-group { display: none; }
  .content { padding: 1.2rem; }
}

.container { max-width: 1000px; margin: 0 auto; padding: 1.8rem 1.2rem; }
.container h1 { font-size: 1.55rem; margin-bottom: 0.2rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.1rem;
  margin-top: 1.6rem;
}
.card {
  background: var(--sui-surface);
  border: 1px solid var(--sui-line);
  border-radius: var(--sui-radius);
  box-shadow: var(--sui-shadow);
  padding: 1.2rem;
}
.card h2 { font-size: 1.05rem; margin-bottom: 0.4rem; }
.card p { font-size: 0.88rem; color: var(--sui-muted); }
.card-link { text-decoration: none; color: inherit; display: block; transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s; }
.card-link:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(19, 35, 58, 0.10); border-color: #cdd8e6; }
.card-disabled { opacity: 0.6; }
.card-numero { font-size: 2rem; font-weight: 650; color: var(--sui-ink); margin: 0.2rem 0 0.1rem; letter-spacing: -0.02em; }
.numero-alerta { color: var(--sui-err-fg); }
.btn-link { color: var(--sui-accent); text-decoration: none; font-weight: 600; }

/* --------------------------------------------------------- Mis datos / paneles */
.breadcrumb { font-size: 0.85rem; margin-bottom: 0.9rem; color: var(--sui-muted); }
.breadcrumb a { color: var(--sui-accent); text-decoration: none; }
.panel {
  background: var(--sui-surface);
  border: 1px solid var(--sui-line);
  border-radius: var(--sui-radius);
  box-shadow: var(--sui-shadow);
  padding: 1.4rem;
  margin-top: 1.2rem;
}
.panel h2 { font-size: 1.1rem; margin-bottom: 0.2rem; }
.hint { font-size: 0.83rem; color: var(--sui-muted); margin-bottom: 1rem; }
.datos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem 1.2rem;
}
.datos-grid dt { font-size: 0.74rem; color: var(--sui-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.datos-grid dd { font-size: 0.95rem; margin-top: 0.15rem; word-break: break-word; color: var(--sui-ink); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.5rem 1.2rem;
}
a.brand { color: #fff; text-decoration: none; }

/* --------------------------------------------------------- Tablas / flota / choferes */
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.8rem; }
.btn-primary-sm {
  background: var(--sui-accent); color: #fff; border: none; border-radius: var(--sui-radius-sm);
  padding: 0.48rem 1rem; font-size: 0.87rem; font-weight: 600; font-family: inherit; cursor: pointer;
}
.btn-primary-sm:hover { background: var(--sui-accent-deep); }
.empty-state { color: var(--sui-muted); font-size: 0.92rem; padding: 1.2rem 0; }
.table-wrap { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.tabla th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--sui-muted); border-bottom: 2px solid var(--sui-line); padding: 0.55rem 0.65rem;
}
.tabla td { border-bottom: 1px solid var(--sui-line); padding: 0.6rem 0.65rem; color: var(--sui-body); }
.tabla tr:hover td { background: #f8fafc; }
.badge { font-size: 0.7rem; font-weight: 700; padding: 0.16rem 0.55rem; border-radius: 999px; letter-spacing: 0.02em; }
.badge-activo { background: var(--sui-ok-bg); color: var(--sui-ok-fg); }
.badge-mantenimiento { background: var(--sui-warn-bg); color: var(--sui-warn-fg); }
.badge-inactivo { background: #eaeef3; color: var(--sui-muted); }
.badge-vencido { background: var(--sui-err-bg); color: var(--sui-err-fg); }
.acciones { white-space: nowrap; text-align: right; }
.btn-mini {
  background: var(--sui-surface); border: 1px solid var(--sui-line); border-radius: 6px;
  padding: 0.28rem 0.65rem; font-size: 0.78rem; font-family: inherit; cursor: pointer; margin-left: 0.3rem;
  color: var(--sui-body); text-decoration: none; display: inline-block;
}
.btn-mini:hover { background: var(--sui-accent-soft); border-color: #b9d0f5; color: var(--sui-accent-deep); }
.btn-peligro { color: var(--sui-err-fg); border-color: #f0c2c2; }
.btn-peligro:hover { background: var(--sui-err-bg); color: var(--sui-err-fg); }
.checks { border: none; margin: 0.9rem 0 0; display: flex; flex-wrap: wrap; gap: 1rem; }
.checks legend { font-size: 0.85rem; font-weight: 600; color: var(--sui-ink); margin-bottom: 0.3rem; }
.checks label { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 400; margin: 0; font-size: 0.9rem; color: var(--sui-body); }
.checks input[type="checkbox"] { width: auto; }
.check-linea { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.95rem; }
.check-linea input { width: auto; }
.form-acciones { display: flex; gap: 0.7rem; margin-top: 1.3rem; }
.form-acciones button[type="submit"] { width: auto; margin-top: 0; padding: 0.62rem 1.5rem; }
.btn-secondary-dark {
  background: var(--sui-surface); color: var(--sui-body); border: 1px solid var(--sui-line);
  border-radius: var(--sui-radius-sm); padding: 0.62rem 1.3rem; font-size: 0.95rem; font-family: inherit; cursor: pointer;
}
.btn-secondary-dark:hover { background: #f1f4f8; }

/* Stat row (home metricas casos) */
.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-top: 1.4rem; }
.stat {
  background: var(--sui-surface); border: 1px solid var(--sui-line); border-radius: var(--sui-radius);
  box-shadow: var(--sui-shadow); padding: 1.1rem 1.2rem; text-decoration: none;
  display: flex; flex-direction: column; gap: 0.15rem; transition: transform 0.12s, box-shadow 0.12s;
}
.stat:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(19,35,58,0.10); }
.stat-num { font-size: 1.9rem; font-weight: 650; color: var(--sui-ink); letter-spacing: -0.02em; }
.stat-label { font-size: 0.82rem; color: var(--sui-muted); }

/* Tabs */
.tabs { display: flex; gap: 0.3rem; margin: 1rem 0 0; border-bottom: 1px solid var(--sui-line); }
.tab {
  padding: 0.5rem 0.95rem; font-size: 0.88rem; color: var(--sui-muted); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--sui-ink); }
.tab-active { color: var(--sui-accent); border-bottom-color: var(--sui-accent); font-weight: 600; }

/* Celdas de direccion (truncar) */
.celda-dir { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabla td.mono { font-family: var(--sui-mono); font-size: 0.83rem; }

/* Liquidaciones */
.tabla th.num, .tabla td.num { text-align: right; }
.sub-h { font-size: 0.95rem; color: var(--sui-ink); margin: 1.3rem 0 0.5rem; }
.montos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.7rem; margin-top: 0.5rem; }
.montos-grid > div { background: #f6f8fb; border: 1px solid var(--sui-line); border-radius: var(--sui-radius-sm); padding: 0.6rem 0.8rem; display: flex; flex-direction: column; gap: 0.15rem; }
.montos-grid .m-label { font-size: 0.72rem; text-transform: uppercase; color: var(--sui-muted); letter-spacing: 0.03em; }
.montos-grid .m-val { font-size: 1.02rem; color: var(--sui-ink); font-weight: 600; }
.montos-grid .m-neto { background: var(--sui-accent-soft); border-color: #b9d0f5; }
.montos-grid .m-neto .m-val { color: var(--sui-accent-deep); }

/* Requisitos de password */
.pwd-reqs { font-size: 0.78rem; color: var(--sui-muted); margin-top: 0.3rem; }
