/* Identidad Hermanos López Navarro: azul corporativo #29357E + rojo #EB2432
   (muestreados de su logo). */
:root {
  --brand: #29357E;          /* azul marino corporativo */
  --brand-dark: #1d2760;     /* hover / franjas */
  --brand-ink: #ffffff;
  --accent: #EB2432;         /* rojo del logo (acentos puntuales) */
  --bg: #eef1f6;
  --bg-2: #e4e8f2;
  --card: #ffffff;
  --ink: #1c2233;
  --muted: #6b7482;
  --line: #dfe4ec;
  --line-soft: #eaedf4;
  --warn-bg: #fff6e5; --warn-ink: #8a5a00; --warn-line: #f0d18a;
  --err-bg: #fdecec; --err-ink: #b21c26; --err-line: #f0b4b4;
  --ok: #1f8b4c; --ok-bg: #eaf6ef; --ok-line: #b6e0c7;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(20,29,74,.06), 0 1px 3px rgba(20,29,74,.05);
  --shadow-md: 0 4px 12px rgba(20,29,74,.08), 0 12px 28px rgba(20,29,74,.07);
  --ring: 0 0 0 3px rgba(41,53,126,.18);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  background: radial-gradient(1200px 600px at 100% -5%, #e9ecf7 0%, transparent 60%),
              linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  font: 15px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

/* Cabecera: blanca con el logo y una fina línea azul corporativa abajo. */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.4rem; background: rgba(255,255,255,.85);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(41,53,126,.08), var(--shadow-sm);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: .7rem; font-weight: 700; color: var(--brand); }
.brand img { height: 38px; width: auto; display: block; }
.brand .brand-sub {
  font-size: .78rem; font-weight: 600; color: var(--brand); letter-spacing: .02em;
  padding: .2rem .55rem; border-radius: 999px;
  background: rgba(41,53,126,.08); border: 1px solid rgba(41,53,126,.12);
}
.logout { display: flex; align-items: center; gap: .8rem; margin: 0; }
.who { color: var(--muted); font-size: .9rem; font-weight: 600; }

.wrap { max-width: 880px; margin: 2rem auto; padding: 0 1rem; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 2.5rem 1rem 3rem; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.75rem 2rem; box-shadow: var(--shadow-md);
  position: relative; overflow: hidden;
}
/* Filete corporativo superior en cada tarjeta. */
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand) 72%, var(--accent) 100%);
}
.card-narrow { max-width: 420px; margin: 3.5rem auto; }
.login-logo { display: block; margin: .25rem auto 1.4rem; height: 56px; width: auto; }

h1 { margin-top: .2rem; font-size: 1.45rem; color: var(--brand); letter-spacing: -.01em; }
h2 {
  font-size: 1.02rem; margin: 1.6rem 0 .6rem; color: var(--brand-dark);
  padding-bottom: .3rem; border-bottom: 1px solid var(--line-soft);
}
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.err { color: var(--accent); }

.stack { display: flex; flex-direction: column; gap: 1.1rem; margin-top: 1.25rem; }
label { display: flex; flex-direction: column; gap: .4rem; font-weight: 600; font-size: .9rem; color: var(--brand-dark); }
input[type=text], input[type=password], input[type=file] {
  padding: .65rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 1rem; background: #fff; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type=text]:focus, input[type=password]:focus, input[type=file]:focus {
  outline: none; border-color: var(--brand); box-shadow: var(--ring);
}

/* Input de fichero: el botón nativo ("Seleccionar archivo") es lo más cutre,
   así que lo vestimos con la marca vía ::file-selector-button. */
input[type=file] { cursor: pointer; padding: .5rem .55rem; }
input[type=file]::file-selector-button {
  margin-right: .85rem; padding: .5rem .95rem; border: 0; cursor: pointer;
  border-radius: 7px; font: inherit; font-weight: 600; font-size: .9rem;
  color: var(--brand); background: rgba(41,53,126,.09);
  transition: background .15s ease, color .15s ease;
}
input[type=file]::file-selector-button:hover { background: rgba(41,53,126,.16); }

/* Fila del selector de fichero + botón "Quitar" (solo visible con .xls elegido). */
.file-field { display: flex; align-items: center; gap: .6rem; }
.file-field input[type=file] { flex: 1; min-width: 0; }
.file-clear {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: .3rem;
  padding: .5rem .8rem; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); cursor: pointer;
  font: inherit; font-weight: 600; font-size: .85rem;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.file-clear:hover { color: var(--accent); border-color: var(--err-line); background: var(--err-bg); }
.file-clear:focus-visible { outline: none; box-shadow: var(--ring); }
.file-clear svg { width: 15px; height: 15px; display: block; }
.file-clear[hidden] { display: none; }

/* Campo de contraseña con botón "ojito" para mostrar/ocultar. */
.pass-field { position: relative; display: flex; }
.pass-field input { flex: 1; width: 100%; padding-right: 2.7rem; }
.pass-toggle {
  position: absolute; right: .3rem; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; padding: .35rem;
  color: var(--muted); border-radius: 6px; transition: color .15s ease;
}
.pass-toggle:hover { color: var(--brand); }
.pass-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.pass-toggle svg { width: 20px; height: 20px; display: block; }
/* Por defecto se ve el ojo abierto; al revelar la contraseña, el ojo tachado. */
.pass-toggle .eye-off { display: none; }
.pass-toggle.revealed .eye { display: none; }
.pass-toggle.revealed .eye-off { display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem 1.3rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-size: .95rem; font-weight: 600;
  cursor: pointer; text-decoration: none; text-align: center; line-height: 1.1;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary {
  color: var(--brand-ink);
  background: linear-gradient(180deg, #33409a 0%, var(--brand) 55%, var(--brand-dark) 100%);
  box-shadow: 0 1px 1px rgba(255,255,255,.25) inset, 0 4px 12px rgba(41,53,126,.28);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #3a48a8 0%, #2c3888 55%, var(--brand-dark) 100%);
  box-shadow: 0 1px 1px rgba(255,255,255,.25) inset, 0 6px 18px rgba(41,53,126,.36);
}
.btn-primary:disabled {
  background: #c3c9de; color: #f3f4fa; cursor: not-allowed;
  box-shadow: none; transform: none;
}
.btn-ghost { background: #fff; color: var(--brand); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { border-color: var(--brand); background: rgba(41,53,126,.04); }

/* En formularios de la pantalla de subida/login, el botón ocupa el ancho. */
.stack > .btn { width: 100%; padding-top: .8rem; padding-bottom: .8rem; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.75rem; margin-top: 1rem; }
@media (max-width: 620px) { .grid2 { grid-template-columns: 1fr; } }
.client { line-height: 1.7; }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { border-collapse: collapse; width: 100%; }
.lines th { background: #f4f6fb; color: var(--brand-dark); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.lines th, .lines td { padding: .6rem .75rem; border-bottom: 1px solid var(--line-soft); text-align: left; }
.lines tbody tr:last-child td { border-bottom: 0; }
.lines tbody tr:hover td { background: #f8f9fd; }
.lines td { vertical-align: top; }
.line-mod { display: block; font-weight: 600; }
.line-desc { display: block; margin-top: .2rem; color: var(--muted); font-size: .85rem; white-space: pre-line; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals { width: 100%; }
.totals td { padding: .35rem .4rem; }
.totals .grand td { border-top: 2px solid var(--brand); font-weight: 700; color: var(--brand); padding-top: .55rem; font-size: 1.05rem; }

.thumbs { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; }
.thumbs figure { margin: 0; text-align: center; }
.thumbs img {
  width: 150px; height: 110px; object-fit: cover;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .15s ease;
}
.thumbs img:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.thumbs figcaption { font-size: .8rem; color: var(--muted); margin-top: .4rem; }

.alert { border-radius: var(--radius-sm); padding: .85rem 1.1rem; margin: 1.15rem 0; border: 1px solid transparent; }
.alert ul { margin: .45rem 0 0; padding-left: 1.2rem; }
.alert-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); border-left: 4px solid #e0a92e; }
/* Rojo de error con un acento en el rojo corporativo (--accent) al costado. */
.alert-error { background: var(--err-bg); color: var(--err-ink); border-color: var(--err-line); border-left: 4px solid var(--accent); }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); border-left: 4px solid var(--ok); }

/* Mini-guía de pasos "1 · 2 · 3" en la pantalla de subida. */
.steps {
  display: flex; flex-wrap: wrap; gap: .5rem .75rem; margin: 1.25rem 0 0;
  padding: 0; list-style: none; counter-reset: step;
}
.steps li {
  display: flex; align-items: center; gap: .45rem;
  padding: .35rem .8rem .35rem .4rem; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  color: var(--brand-dark); font-size: .85rem; counter-increment: step;
}
.steps li::before {
  content: counter(step); display: inline-flex; align-items: center; justify-content: center;
  width: 1.35rem; height: 1.35rem; border-radius: 999px; flex: 0 0 auto;
  background: var(--brand); color: #fff; font-size: .78rem; font-weight: 700;
}

/* Panel de comprobaciones: siempre visible, claro para el cliente. */
.checks { margin: 1.5rem 0 0; }
.checks h2 { display: flex; align-items: center; gap: .55rem; }
.checks-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.5rem; height: 1.5rem; padding: 0 .45rem; border-radius: 999px;
  background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line);
  font-size: .8rem; font-weight: 700;
}
.checklist { list-style: none; margin: .9rem 0 0; padding: 0; display: grid; gap: .5rem; }
.checklist li {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .7rem .9rem; border-radius: var(--radius-sm);
  background: var(--ok-bg); border: 1px solid var(--ok-line);
  color: #1c5636; line-height: 1.45;
}
.check-mark {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 1.35rem; height: 1.35rem; margin-top: .05rem; border-radius: 999px;
  background: var(--ok); color: #fff; font-size: .8rem; font-weight: 700;
  box-shadow: 0 1px 2px rgba(31,139,76,.35);
}
.details { color: var(--err-ink); }

.actions {
  display: flex; align-items: center; gap: 1rem; margin-top: 1.75rem; flex-wrap: wrap;
  padding-top: 1.4rem; border-top: 1px solid var(--line-soft);
}
.actions form { margin: 0; }
.hint { color: var(--muted); font-size: .85rem; }

@media (max-width: 620px) {
  .card { padding: 1.4rem 1.25rem; }
  .actions .btn, .actions form { width: 100%; }
  .actions form .btn { width: 100%; }
}
