/* =====================================================================
   IT Vault — hoja de estilo (SPEC.md §10). Autoalojada, sin CDN.
   Dirección: el casillero de llaves de recepción. Denso y sobrio.
   El diseño definitivo es la Fase 9; esto es la base funcional.
   ===================================================================== */

:root {
  --ink: #10151c;
  --slate: #1b2430;
  --porcelain: #eef1f4;
  --brass: #b08d57;
  --teal: #0e5c63;
  --signal: #c6412f;
  --verdigris: #2f7a54;

  --bg: var(--porcelain);
  --surface: #ffffff;
  --text: var(--ink);
  --text-muted: #4b5563;
  --border: #d7dce2;
  --focus: var(--brass);
}

:root[data-theme="dark"] {
  --bg: var(--ink);
  --surface: var(--slate);
  --text: var(--porcelain);
  --text-muted: #a7b0bc;
  --border: #2a3542;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--ink);
    --surface: var(--slate);
    --text: var(--porcelain);
    --text-muted: #a7b0bc;
    --border: #2a3542;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

/* --- Foco visible: anillo de latón de 2 px en todo lo interactivo ----- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 8px;
  top: 8px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--brass);
  border-radius: 4px;
}

/* --- Tipografía ------------------------------------------------------ */
.eyebrow {
  font-family: "Archivo", system-ui, sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 4px;
}

h1,
h2,
h3 {
  font-family: "Archivo", system-ui, sans-serif;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
}

.page-title {
  font-size: 24px;
  margin-bottom: 24px;
}

.card-title {
  font-size: 16px;
  margin-bottom: 16px;
}

/* Todos los valores de credencial en monoespaciada: distingue 0/O y 1/l/I,
   que en una credencial es funcional, no decorativo (SPEC §10). */
code,
.mono {
  font-family: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
}

.nums {
  font-variant-numeric: tabular-nums;
}

/* --- Layout general -------------------------------------------------- */
.content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-brand {
  color: inherit;
  text-decoration: none;
  display: block;
  border-top: 2px solid var(--brass);
  padding-top: 6px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.inline-form {
  display: inline;
}

/* --- Pantallas de acceso --------------------------------------------- */
.auth-shell {
  max-width: 400px;
  margin: 0 auto;
  padding: 64px 20px;
}

.auth-brand {
  margin-bottom: 24px;
  border-top: 2px solid var(--brass);
  padding-top: 12px;
}

.auth-title {
  font-size: 28px;
  margin: 0;
}

.auth-footer {
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-footer p {
  margin: 0;
}

/* --- Tarjeta-casillero: filo superior en el color del tipo ----------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--brass);
  border-radius: 6px;
  padding: 24px;
  margin-bottom: 20px;
}

.card:last-child {
  margin-bottom: 0;
}

/* --- Formularios ----------------------------------------------------- */
.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  min-height: 44px;
}

.field-help {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* --- Botones: mínimo 44 px de alto para el pulgar (SPEC §10) --------- */
.btn {
  display: inline-block;
  padding: 11px 20px;
  min-height: 44px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  width: 100%;
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.btn-quiet {
  padding: 6px 12px;
  min-height: 36px;
  font-size: 13px;
  font-weight: 500;
}

/* --- Avisos ---------------------------------------------------------- */
.notice {
  margin: 0 0 20px;
  padding: 12px 14px;
  border-radius: 4px;
  border-left: 3px solid var(--teal);
  background: color-mix(in srgb, var(--teal) 8%, transparent);
  font-size: 14px;
}

.notice p {
  margin: 0 0 4px;
}

.notice p:last-child {
  margin-bottom: 0;
}

.notice-error {
  border-left-color: var(--signal);
  background: color-mix(in srgb, var(--signal) 10%, transparent);
}

/* --- Filas de estado ------------------------------------------------- */
.status-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.status-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.status-ok {
  color: var(--verdigris);
  font-weight: 600;
}

.status-warn {
  color: var(--brass);
  font-weight: 600;
}

.status-error {
  color: var(--signal);
  font-weight: 600;
}

/* --- Pastillas ------------------------------------------------------- */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
}

.pill-role {
  color: var(--brass);
  border-color: var(--brass);
}

.pill-ok {
  color: var(--verdigris);
  border-color: var(--verdigris);
}

.pill-fail {
  color: var(--signal);
  border-color: var(--signal);
}

/* --- Tablas: densas, con scroll propio para no romper la página ------ */
.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table th {
  font-family: "Archivo", system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  color: var(--text-muted);
}

.table tr:last-child td {
  border-bottom: none;
}

/* --- Móvil: sin scroll horizontal a 375 px --------------------------- */
@media (max-width: 640px) {
  .content {
    padding: 20px 16px 48px;
  }

  .card {
    padding: 18px 16px;
  }

  .auth-shell {
    padding: 32px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
