@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Source+Sans+3:wght@400;500;600;700&display=swap');

/* =========================================================================
   MiLabFQ — Identidad visual
   Bitácora digital de Biofarmacia · Facultad de Química, UNAM

   La identidad parte de la libreta de laboratorio encuadernada:
   - el azul institucional es la cubierta;
   - el filete dorado es la greca que separa cubierta y hoja;
   - la hoja blanca es la superficie de trabajo;
   - el escudo FQ es el único elemento con movimiento propio.

   Reglas de la casa:
   - el filete dorado marca jerarquía, no decora;
   - una sola familia de display (Sora) y una de texto (Source Sans 3);
   - sin sombras difusas: borde fino + filete;
   - movimiento solo cuando responde a una acción;
   - líneas de texto por debajo de 75 caracteres.
   ========================================================================= */

:root {
  /* Cubierta */
  --navy-950: #061C33;
  --navy-900: #08243E;
  --navy-800: #0B2C4C;
  --navy-700: #143A5E;

  /* Filete */
  --gold-600: #A9833C;
  --gold-500: #C9A45C;
  --gold-400: #DCC08A;
  --gold-100: #F7F0E1;

  /* Papel */
  --paper: #F2F6FA;
  --sheet: #FFFFFF;
  --tint: #E9F0F7;
  --tint-strong: #DEE8F2;

  /* Tinta */
  --ink: #14314C;
  --ink-2: #45627C;
  --ink-3: #6E8497;

  /* Reglas */
  --rule: #D9E3ED;
  --rule-soft: #E8EEF4;

  /* Estados */
  --ok: #0E7C57;
  --ok-bg: #EAF6F0;
  --ok-rule: #BFE3D2;
  --bad: #B23B2E;
  --bad-bg: #FBEDEA;
  --bad-rule: #F0CDC6;

  /* Tipografía */
  --font-display: 'Sora', 'Segoe UI', system-ui, sans-serif;
  --font-ui: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --font-data: ui-monospace, 'Cascadia Mono', 'JetBrains Mono', Consolas, monospace;

  /* Geometría */
  --radius-sm: 5px;
  --radius: 8px;
  --radius-lg: 11px;
  --nav-height: 64px;

  /* Aliases heredados (algunos scripts todavía los usan) */
  --primary-color: var(--navy-900);
  --accent-color: var(--gold-500);
  --color-primary: var(--navy-900);
  --color-primary-hover: var(--navy-800);
  --color-accent: var(--gold-500);
  --color-accent-hover: var(--gold-600);
  --color-success: var(--ok);
  --color-success-hover: #0A6647;
  --color-bg: var(--paper);
  --color-surface: var(--sheet);
  --color-surface-muted: var(--paper);
  --color-text: var(--ink);
  --color-text-muted: var(--ink-3);
  --color-text-inverse: #FFFFFF;
  --color-border: var(--rule);
  --color-border-focus: var(--gold-500);
  --shadow-sm: 0 1px 2px rgba(8, 36, 62, 0.05);
  --shadow-md: 0 18px 40px rgba(8, 36, 62, 0.14);
  --transition: 140ms ease;
  --logo-width: 36px;
  --logo-height: 36px;
}

/* -------------------------------------------------------------------------
   Base
   ------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.6rem;
  color: var(--navy-900);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.015em;
}

h1 { font-size: 1.85rem; font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: 1.32rem; }
h3 { font-size: 1.03rem; }
h4 { font-size: 0.95rem; }

p { margin: 0 0 1rem; max-width: 72ch; }

a { color: var(--navy-800); text-decoration: none; }
a:hover { color: var(--gold-600); }

img { max-width: 100%; }

::selection { background: var(--gold-400); color: var(--navy-950); }

:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
  border-radius: 3px;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.mono, .data { font-family: var(--font-data); font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------------------
   Barra institucional
   ------------------------------------------------------------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: var(--nav-height);
  padding: 0 28px;
  background: var(--navy-900);
  border-bottom: 1px solid rgba(201, 164, 92, 0.32);
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: #fff;
  text-decoration: none;
}

.navbar-brand:hover { color: #fff; }

.navbar-brand img {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex: none;
}

.navbar .nav-title {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.navbar .nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.navbar a.nav-link {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.92rem;
  font-weight: 600;
  transition: color var(--transition), background var(--transition);
}

.navbar a.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.navbar a.nav-link[aria-current="page"] {
  color: #fff;
  box-shadow: inset 0 -2px 0 var(--gold-500);
  border-radius: 0;
}

.navbar a.nav-link--admin { color: var(--gold-400); }
.navbar a.nav-link--admin:hover { color: var(--gold-400); }

/* Marca FQ reutilizable */
.logo-fq img {
  display: block;
  width: 100%;
  height: auto;
}

/* -------------------------------------------------------------------------
   Estructura de página
   ------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px 72px;
}

.admin-container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px 72px;
}

.page {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 20px 72px;
}

.flex-center {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 20px;
}

/* Hoja: la unidad de superficie de la identidad */
.sheet {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 22px;
  box-shadow: 0 1px 2px rgba(8, 36, 62, 0.04);
}

.sheet--ledger { border-top: 3px solid var(--gold-500); }
.sheet--quiet { background: transparent; border-color: transparent; box-shadow: none; padding: 0; }

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule-soft);
}

.sheet-head h1, .sheet-head h2, .sheet-head h3 { margin: 0; }
.sheet-head .sheet-sub { margin: 4px 0 0; color: var(--ink-3); font-size: 0.9rem; }

.guardado-estado {
  margin: 0;
  color: var(--ink-3);
  font-family: var(--font-data);
  font-size: 0.74rem;
  text-align: right;
  white-space: nowrap;
}

.page-head { margin-bottom: 26px; }
.page-head h1 { margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--ink-3); }

.rule-gold {
  width: 56px;
  height: 2px;
  margin: 14px 0;
  background: var(--gold-500);
  border: 0;
}

/* Tarjetas heredadas */
.card {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 22px;
  box-shadow: 0 1px 2px rgba(8, 36, 62, 0.04);
}

.card-hub {
  width: 100%;
  max-width: 360px;
  padding: 30px 26px;
  background: var(--tint);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  text-align: center;
}

.admin-section { margin-bottom: 0; }

.form-panel, .upload-section {
  padding: 20px;
  margin-bottom: 22px;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
}

/* -------------------------------------------------------------------------
   Acceso — cubierta azul, hoja blanca, filete dorado
   ------------------------------------------------------------------------- */
body.login-page {
  background: var(--navy-900);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}

.login-shell {
  width: 100%;
  max-width: 424px;
  margin: 0 auto;
}

.login-card {
  background: var(--sheet);
  border-top: 4px solid var(--gold-500);
  border-radius: 10px;
  padding: 34px 32px 30px;
  box-shadow: 0 26px 60px rgba(3, 15, 28, 0.38);
}

.login-mark {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.login-mark img {
  width: 84px;
  height: 84px;
  object-fit: contain;
}

.login-title {
  margin: 0;
  color: var(--navy-900);
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-align: center;
}

.login-rule {
  width: 64px;
  height: 2px;
  margin: 16px auto;
  background: var(--gold-500);
  border: 0;
}

.login-sub {
  margin: 0;
  color: var(--ink-3);
  font-size: 0.94rem;
  line-height: 1.45;
  text-align: center;
  max-width: none;
}

.login-divider {
  height: 1px;
  margin: 24px 0;
  background: var(--rule-soft);
  border: 0;
}

.login-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.login-foot {
  margin: 18px 0 0;
  text-align: center;
  font-size: 0.9rem;
}

.login-caption {
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-align: center;
}

.login-caption strong {
  color: rgba(255, 255, 255, 0.62);
  font-weight: 600;
}

/* Tarjeta de recuperación reutiliza el mismo lenguaje */
.login-card--wide { max-width: 460px; }

/* -------------------------------------------------------------------------
   Hub
   ------------------------------------------------------------------------- */
body.hub-page { background: var(--paper); }

.hub-card {
  width: 100%;
  max-width: 420px;
  margin: 12px auto 0;
  padding: 34px 30px 30px;
  background: var(--tint);
  border: 1px solid var(--rule);
  border-radius: 12px;
  text-align: center;
}

.hub-mark { display: flex; justify-content: center; margin-bottom: 6px; }
.hub-mark img { width: 78px; height: 78px; object-fit: contain; }

.hub-card h1 {
  margin: 10px 0 6px;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.hub-sub {
  margin: 0 0 24px;
  color: var(--ink-3);
  font-size: 0.9rem;
  max-width: none;
}

.hub-actions { display: grid; gap: 10px; }

.hub-link {
  display: block;
  padding: 12px 16px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  transition: border-color var(--transition), color var(--transition);
}

.hub-link:hover { border-color: var(--gold-500); color: var(--navy-900); }
.hub-link.disabled { opacity: 0.55; pointer-events: none; }

.hub-admin { margin-top: 12px; }

.hint {
  margin: 0 0 18px;
  color: var(--ink-3);
  font-size: 0.86rem;
  max-width: none;
}

/* -------------------------------------------------------------------------
   Controles
   ------------------------------------------------------------------------- */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="search"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: #FCFDFF;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.98rem;
  line-height: 1.4;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:hover:not(:disabled),
select:hover:not(:disabled) { border-color: #C4D2E0; }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(201, 164, 92, 0.16);
}

input::placeholder,
textarea::placeholder { color: #93A6B8; }

input:disabled,
select:disabled,
textarea:disabled {
  background: #EFF4F9;
  border-color: var(--rule-soft);
  color: #6E8497;
  cursor: not-allowed;
  -webkit-text-fill-color: #6E8497;
  opacity: 1;
}

input[type="file"] {
  padding: 8px 10px;
  font-size: 0.9rem;
  background: var(--sheet);
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 7px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

input[type="file"]::file-selector-button:hover {
  border-color: var(--gold-500);
  color: var(--navy-900);
}

select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2345627C' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
}

label {
  color: var(--ink-2);
  font-size: 0.83rem;
  font-weight: 600;
}

.field { margin-bottom: 15px; }
.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-2);
  font-size: 0.83rem;
  font-weight: 600;
}
.field--inline { display: flex; align-items: center; gap: 10px; }
.field--inline input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--navy-800); }

.input-group { margin-bottom: 4px; }
.input-group label {
  display: block;
  margin-bottom: 5px;
  color: var(--ink-2);
  font-size: 0.8rem;
  font-weight: 600;
}
.input-group input { width: 100%; }

.timestamp {
  display: block;
  margin-top: 5px;
  color: var(--ink-3);
  font-family: var(--font-data);
  font-size: 0.7rem;
  letter-spacing: -0.01em;
}

/* Pasos: solo cuando el contenido es realmente una secuencia */
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.step { min-width: 0; }

.step-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--ink-2);
  font-size: 0.82rem;
  font-weight: 600;
}

.step-n {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  border: 1px solid var(--gold-500);
  border-radius: 50%;
  color: var(--gold-600);
  font-family: var(--font-data);
  font-size: 0.7rem;
  font-weight: 600;
}

.step select, .step input { width: 100%; }

/* -------------------------------------------------------------------------
   Botones
   ------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--navy-900);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--navy-900); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy-800); color: #fff; }

.btn-accent { background: var(--gold-500); color: var(--navy-950); }
.btn-accent:hover:not(:disabled) { background: var(--gold-400); color: var(--navy-950); }

.btn-success { background: var(--ok); color: #fff; }
.btn-success:hover:not(:disabled) { background: #0A6647; color: #fff; }

.btn-outline {
  background: var(--sheet);
  border-color: var(--rule);
  color: var(--ink);
}
.btn-outline:hover:not(:disabled) { border-color: var(--gold-500); color: var(--navy-900); }

.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
  padding: 8px 10px;
}
.btn-quiet:hover:not(:disabled) { background: var(--tint); color: var(--navy-900); }

.btn-delete { background: var(--bad); color: #fff; font-size: 0.84rem; padding: 9px 14px; }
.btn-delete:hover:not(:disabled) { background: #9A3126; color: #fff; }

.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #9A3126; color: #fff; }

.btn-add { background: var(--navy-900); color: #fff; font-size: 0.88rem; padding: 8px 15px; }
.btn-add:hover:not(:disabled) { background: var(--navy-800); color: #fff; }

.btn-fill { background: var(--gold-500); color: var(--navy-950); font-size: 0.88rem; padding: 8px 15px; }
.btn-fill:hover:not(:disabled) { background: var(--gold-400); color: var(--navy-950); }

.btn-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--navy-900);
  color: #fff;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.btn-main:hover { background: var(--navy-800); color: #fff; }

.btn-save, .btn-submit, .btn-upload {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--navy-900);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-save:hover:not(:disabled),
.btn-submit:hover:not(:disabled),
.btn-upload:hover:not(:disabled) { background: var(--navy-800); }

.btn-login {
  display: block;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--navy-900);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-login:hover:not(:disabled) { background: var(--navy-800); }

.btn-download {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--sheet);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
}
.btn-download:hover { border-color: var(--gold-500); color: var(--navy-900); }

/* Botón de evaluación: dos estados, un solo control */
.btn-eval {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--sheet);
  color: var(--ink-3);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.btn-eval:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-eval.correct { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-eval.incorrect { background: var(--bad); border-color: var(--bad); color: #fff; }

/* Botones tipo fila (compatibilidad con vistas antiguas) */
.btn-sub {
  display: block;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--sheet);
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 600;
}
.btn-sub:hover:not(.disabled) { border-color: var(--gold-500); color: var(--navy-900); }
.btn-sub.disabled { pointer-events: none; opacity: 0.55; }

.btn-block { width: 100%; }
.btn-lg { padding: 13px 22px; font-size: 1rem; }

.btn--row { justify-content: flex-start; text-align: left; }

.disabled { pointer-events: none; opacity: 0.55; }

/* -------------------------------------------------------------------------
   Tablas
   ------------------------------------------------------------------------- */
.table-wrap {
  width: 100%;
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--sheet);
}

table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  background: var(--sheet);
  font-size: 0.9rem;
}

th, td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--rule-soft);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--navy-900);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #FAFCFE; }

td input, td select { min-width: 120px; }
td .btn { padding: 7px 12px; font-size: 0.85rem; }

/* -------------------------------------------------------------------------
   Listas de prácticas y jerarquía
   ------------------------------------------------------------------------- */
.practice-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.practice-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.practice-list li > div { min-width: 0; }
.practice-list li strong { color: var(--navy-900); font-weight: 600; }
.practice-list li .meta { color: var(--ink-3); font-size: 0.8rem; }

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  margin-bottom: 4px;
  background: var(--tint);
  border: 1px solid var(--rule-soft);
  border-left: 3px solid var(--gold-500);
  border-radius: var(--radius);
  color: var(--navy-900);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.group-header:hover { background: var(--tint-strong); }

.group-tools { display: flex; align-items: center; gap: 12px; }
.group-caret { color: var(--ink-3); font-size: 0.8rem; line-height: 1; }

.group-content {
  display: none;
  padding: 16px;
  margin-bottom: 16px;
  background: #FBFDFF;
  border: 1px solid var(--rule-soft);
  border-radius: 0 0 var(--radius) var(--radius);
}

.team-row { padding: 11px 0; border-bottom: 1px solid var(--rule-soft); }
.team-row:last-child { border-bottom: 0; }
.team-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.team-actions button { margin-left: 0; }

.team-members {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 0.85rem;
}

.team-unassigned {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--rule-soft);
}

.team-unassigned h4 { margin: 0 0 8px; font-size: 0.9rem; }

.team-unassigned ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 0.86rem;
}

.team-unassigned li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-sm);
}

/* Etiquetas de estado y de integrantes */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--sheet);
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 600;
}

.chip--ok { background: var(--ok-bg); border-color: var(--ok-rule); color: #0A5B41; }
.chip--pending { background: var(--gold-100); border-color: #E8D5AE; color: #7A5A1E; }

.chip-x {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}

.chip-x:hover { background: var(--bad-bg); color: var(--bad); }

/* Monitoreo en dos columnas */
.monitor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.monitor-col {
  min-width: 0;
  padding: 16px;
  background: var(--sheet);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
}

.monitor-title {
  margin: 0 0 12px;
  color: var(--ink-2);
  font-family: var(--font-ui);
  font-size: 0.86rem;
  font-weight: 600;
}

.section-label {
  margin: 26px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

.btn-edit {
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--sheet);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-edit:hover { border-color: var(--gold-500); color: var(--navy-900); }

@media (max-width: 720px) {
  .monitor-grid { grid-template-columns: 1fr; }
  .team-header { flex-direction: column; align-items: flex-start; }
}

/* -------------------------------------------------------------------------
   Bitácora
   ------------------------------------------------------------------------- */
.folio {
  margin: 2px 0 0;
  color: var(--ink-3);
  font-family: var(--font-data);
  font-size: 0.74rem;
  letter-spacing: 0.01em;
  max-width: none;
}

.folio::before { content: "Folio "; color: var(--gold-600); }

.section-block {
  margin-bottom: 18px;
  padding: 24px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: border-color 180ms ease, background 180ms ease;
}

.section-block + .section-block { margin-top: 0; }

.section-title {
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--navy-900);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

.section-block.seccion-firmada {
  background: #F6FBF8;
  border-color: var(--ok-rule);
  border-left: 3px solid var(--ok);
}

.section-block.seccion-firmada .section-title { border-bottom-color: var(--ok-rule); }

/* En una bitácora ya firmada, los campos se leen como documento, no como formulario */
.section-block.seccion-firmada input:disabled {
  background: transparent;
  border-color: transparent;
  border-bottom: 1px solid rgba(14, 124, 87, 0.2);
  border-radius: 0;
  padding-left: 0;
}

.status-firmas {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--rule-soft);
  color: var(--ok);
  font-size: 0.84rem;
  font-weight: 600;
  text-align: right;
}

.status-firmas span + span::before {
  content: "·";
  margin: 0 8px;
  color: var(--ink-3);
}

.grade-banner {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0 0 22px;
  padding: 12px 16px;
  background: var(--gold-100);
  border-left: 3px solid var(--gold-500);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--navy-900);
  font-family: var(--font-data);
  font-size: 0.92rem;
  font-weight: 600;
}

.firma-realizador,
.firma-verificador {
  justify-content: flex-end;
  padding: 14px 16px !important;
  margin-top: 16px !important;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.firma-realizador select,
.firma-verificador select {
  width: auto;
  min-width: 190px;
  margin: 0;
  padding: 7px 10px;
  font-size: 0.88rem;
}

.firma-realizador input,
.firma-verificador input {
  width: 74px !important;
  margin: 0;
  padding: 7px 10px !important;
  text-align: center;
  font-family: var(--font-data);
  letter-spacing: 0.22em;
}

.firma-realizador span,
.firma-verificador span { color: var(--ink-2); font-size: 0.88rem; font-weight: 600; }

.firma-realizador input::placeholder,
.firma-verificador input::placeholder {
  font-family: var(--font-ui);
  letter-spacing: normal;
}

/* Panel flotante de evaluación */
.floating-panel {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 28px;
  background: var(--navy-900);
  border-top: 1px solid rgba(201, 164, 92, 0.35);
  box-shadow: 0 -14px 30px rgba(8, 36, 62, 0.18);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

.floating-panel > div { display: flex; align-items: center; gap: 10px; }

.score-display {
  color: var(--gold-400);
  font-family: var(--font-data);
  font-size: 1.55rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Rejilla de campos */
.grid-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
}

/* Revisión: campo + dos marcas de evaluación */
.input-wrapper { min-width: 0; }
.input-wrapper label { display: block; margin-bottom: 5px; }

.input-group--eval {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  margin-bottom: 0;
}

.input-group--eval > div:last-child {
  display: flex;
  gap: 4px;
  padding-top: 18px;
}

.eval-mark {
  margin-left: 7px;
  font-weight: 700;
  font-size: 0.9rem;
}

.eval-mark--ok { color: var(--ok); }
.eval-mark--bad { color: var(--bad); }

/* -------------------------------------------------------------------------
   Constructor de prácticas
   ------------------------------------------------------------------------- */
.layout {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 72px;
}

.tools-panel {
  position: sticky;
  top: calc(var(--nav-height) + 20px);
  width: 300px;
  flex: none;
  padding: 20px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--gold-500);
  border-radius: var(--radius);
}

.tools-panel h3 { margin-bottom: 4px; }

.tools-panel .section-title {
  margin: 18px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--ink-3);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
}

.tools-panel .btn-add {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  margin-bottom: 6px;
  padding: 9px 12px;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
}

.tools-panel .btn-add:hover {
  background: var(--tint);
  border-color: var(--gold-500);
  color: var(--navy-900);
}

.canvas {
  flex: 1;
  min-width: 0;
  padding: 28px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--gold-500);
  border-radius: var(--radius);
}

.canvas-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule-soft);
}

.canvas-header label { display: block; margin-bottom: 6px; }

.editor-banner {
  padding: 16px;
  background: var(--tint);
  border: 1px solid var(--rule-soft);
  border-left: 3px solid var(--gold-500);
  border-radius: var(--radius-sm);
}

.block {
  position: relative;
  margin-bottom: 16px;
  padding: 18px;
  background: #FBFDFF;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.block-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--navy-900);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
}

.block-title .input-titulo-bloque {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  color: var(--navy-900);
  font-family: var(--font-display);
  font-weight: 600;
}

.block-acciones {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.campo-item select.campo-tipo {
  width: 190px;
  flex: none;
  padding-top: 6px;
  padding-bottom: 6px;
  font-size: 0.84rem;
}

.config-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 0.85rem;
}

.config-row input[type="number"] { width: 92px; }
.config-row select { width: auto; min-width: 140px; }

.config-hint {
  color: var(--ink-3);
  font-size: 0.8rem;
}

.vista-previa {
  margin-top: 14px;
  padding: 14px;
  background: var(--paper);
  border: 1px dashed var(--rule);
  border-radius: var(--radius-sm);
}

.vista-previa-head {
  margin-bottom: 10px;
  color: var(--ink-3);
  font-size: 0.78rem;
  font-weight: 600;
}

.vista-previa-cuerpo .xls-wrap { max-height: 320px; }

.config-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--rule);
  color: var(--ink-2);
  font-size: 0.86rem;
}

.config-row input[type="number"] { width: 84px; }
.config-row input[type="checkbox"] { width: auto; accent-color: var(--navy-800); }

.campos-dinamicos {
  margin-top: 12px;
  padding: 14px;
  background: var(--sheet);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-sm);
}

.campos-dinamicos > strong {
  display: block;
  margin-bottom: 10px;
  color: var(--ink-3);
  font-size: 0.8rem;
  font-weight: 600;
}

.campo-item { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.campo-item input { flex: 1; }

.btn-remove-field {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-3);
  font-family: var(--font-ui);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.btn-remove-field:hover { background: var(--bad-bg); color: var(--bad); }

.btn-remove-field:focus-visible { outline-color: var(--bad); }

.block-title .btn-delete { white-space: nowrap; padding: 7px 12px; }

/* -------------------------------------------------------------------------
   Constructor de prácticas: paleta por grupos, columnas con fórmula y
   resultados del bloque. La lógica de cada columna se escribe como en Excel.
   ------------------------------------------------------------------------- */

.paleta-grupo + .paleta-grupo { margin-top: 18px; }

.tools-panel .btn-add {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.3;
}

.btn-add-titulo {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
}

.btn-add-desc {
  display: block;
  color: var(--ink-3);
  font-size: 0.74rem;
  font-weight: 400;
}

.tools-panel .btn-add:hover .btn-add-desc { color: var(--ink-2); }

.block-descripcion {
  margin: -4px 0 12px;
  color: var(--ink-3);
  font-size: 0.82rem;
}

.estado-vacio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 44px 24px;
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  color: var(--ink-3);
  text-align: center;
}

.estado-vacio strong {
  color: var(--navy-900);
  font-family: var(--font-display);
  font-size: 1rem;
}

.estado-vacio span { max-width: 46ch; font-size: 0.88rem; }

.campo-letra {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-sm);
  background: var(--tint);
  color: var(--navy-800);
  font-family: var(--font-data);
  font-size: 0.72rem;
  font-weight: 600;
}

.campo-item--formula {
  flex-wrap: wrap;
  padding: 8px;
  border: 1px solid var(--gold-200, #E8D5AE);
  border-radius: var(--radius-sm);
  background: #FFFDF7;
}

.campo-item--formula .campo-label,
.campo-item--formula .campo-formula { flex: 1 1 180px; }

.campo-formula {
  font-family: var(--font-data);
  font-size: 0.84rem;
  color: var(--navy-900);
  background: #fff;
}

.formula-estado {
  margin: 2px 0 10px 34px;
  font-size: 0.74rem;
}

.formula-estado.es-ok { color: var(--ink-3); }
.formula-estado.es-error { color: var(--bad); font-weight: 600; }

.formula-ayuda {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--tint);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-sm);
}

.formula-ayuda-texto {
  margin-bottom: 8px;
  color: var(--ink-2);
  font-size: 0.79rem;
  line-height: 1.5;
}

.formula-ayuda-texto code {
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--sheet);
  border: 1px solid var(--rule-soft);
  color: var(--navy-900);
  font-family: var(--font-data);
  font-size: 0.78rem;
}

.formula-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}

.formula-chips > span {
  margin-right: 2px;
  color: var(--ink-3);
  font-size: 0.72rem;
  font-weight: 600;
}

.formula-chips .chip {
  padding: 2px 8px;
  background: var(--sheet);
  border-color: var(--rule);
  color: var(--navy-800);
  font-family: var(--font-data);
  font-size: 0.72rem;
  cursor: pointer;
}

.formula-chips .chip:hover {
  border-color: var(--gold-500);
  background: var(--gold-100, #FBF3E4);
  color: var(--navy-900);
}

.bloque-resumen {
  margin-top: 12px;
  padding: 14px;
  background: var(--sheet);
  border: 1px solid var(--rule-soft);
  border-left: 3px solid var(--gold-500);
  border-radius: var(--radius-sm);
}

.bloque-resumen-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--ink-3);
  font-size: 0.78rem;
}

.bloque-resumen-head strong {
  color: var(--navy-900);
  font-size: 0.84rem;
}

.resumen-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.resumen-etiqueta { flex: 0 1 220px; }
.resumen-formula { flex: 1 1 240px; font-family: var(--font-data); font-size: 0.84rem; }

.resumen-item .formula-estado {
  flex: 1 0 100%;
  margin: 0 0 4px 0;
}

.btn-compacto {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.vista-previa-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.vista-previa-head > span {
  color: var(--ink-3);
  font-size: 0.75rem;
  font-weight: 400;
}

@media (max-width: 720px) {
  .campo-item { flex-wrap: wrap; }
  .campo-item select.campo-tipo { width: 100%; }
  .campo-item--formula .campo-label,
  .campo-item--formula .campo-formula { flex: 1 1 100%; }
  .formula-estado { margin-left: 0; }
  .resumen-etiqueta,
  .resumen-formula { flex: 1 1 100%; }
}

/* -------------------------------------------------------------------------
   Tablas en lenguaje de hoja de cálculo
   Letras de columna, números de fila, encabezado fijo, cebra y celdas
   calculadas. Es el mismo componente que usa la vista previa del editor.
   ------------------------------------------------------------------------- */
.xls-wrap {
  overflow: auto;
  max-height: 540px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--sheet);
}

.xls {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
}

.xls th,
.xls td {
  padding: 0;
  border-right: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: middle;
}

.xls thead th {
  position: sticky;
  z-index: 3;
  padding: 9px 12px;
  background: var(--tint);
  color: var(--navy-900);
  font-size: 0.79rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.xls-letras th {
  top: 0;
  z-index: 4;
  padding: 4px 8px;
  background: var(--navy-900);
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--font-data);
  font-size: 0.66rem;
  font-weight: 600;
  text-align: center;
}

.xls-encabezados th { top: 26px; }

.xls-esquina {
  left: 0;
  z-index: 5;
  width: 44px;
  min-width: 44px;
}

.xls-letras .xls-esquina { background: var(--navy-900); }

.xls-encabezados .xls-esquina {
  background: var(--tint-strong);
  color: var(--ink-3);
  font-family: var(--font-data);
  font-size: 0.68rem;
  text-align: center;
}

.xls-th-calculo { color: var(--gold-600); }
.xls-th-verificacion { color: var(--navy-900); }

.xls-sub {
  display: block;
  color: var(--gold-600);
  font-size: 0.69rem;
  font-weight: 500;
}

.xls-sub--formula {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-data);
  font-size: 0.66rem;
  opacity: 0.9;
}

.xls-num {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 44px;
  min-width: 44px;
  padding: 8px 6px;
  background: var(--tint);
  color: var(--ink-3);
  font-family: var(--font-data);
  font-size: 0.72rem;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

.xls-num .eval-mark { margin-left: 4px; }

.xls-celda { position: relative; }

.xls-celda input {
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 0.88rem;
}

.xls-celda input:focus {
  outline: 2px solid var(--gold-500);
  outline-offset: -2px;
  background: #FFFDF6;
}

.xls-celda .timestamp { display: none; }

.xls-computada {
  padding: 9px 10px;
  background: var(--gold-100);
  color: var(--navy-900);
  font-family: var(--font-data);
  font-size: 0.8rem;
  text-align: right;
  white-space: nowrap;
}

.xls-verificacion { text-align: center; }

.xls-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 10px;
  cursor: pointer;
}

.xls-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--navy-800);
}

.xls-check-derivado {
  font-size: 0.85rem;
  font-weight: 700;
}

.xls-check-derivado.es-cumple { color: var(--ok); }
.xls-check-derivado.es-incumple { color: var(--bad); }

.xls-evaluacion { text-align: center; white-space: nowrap; }
.xls-evaluacion .btn-eval { margin: 0 2px; }

.xls tbody tr:nth-child(even) td { background: #FAFCFE; }
.xls tbody tr:nth-child(even) td.xls-computada { background: #FBF3E3; }
.xls tbody tr:hover td { background: #F5FAFD; }

.xls-resumen {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-family: var(--font-data);
  font-size: 0.8rem;
}

.xls-resumen-item b {
  margin-right: 6px;
  color: var(--navy-900);
  font-family: var(--font-ui);
  font-weight: 600;
}

.xls-resumen-vacio { color: var(--ink-3); font-family: var(--font-ui); }

.grafico {
  margin-top: 14px;
  padding: 12px;
  background: var(--sheet);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
}

.grafico-svg {
  display: block;
  width: 100%;
  height: auto;
}

/* -------------------------------------------------------------------------
   Recursos
   ------------------------------------------------------------------------- */
.resource-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
  padding: 16px 18px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold-500);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.resource-card h4 { margin: 0 0 3px; font-size: 0.98rem; }
.resource-card p { margin: 0 0 4px; color: var(--ink-2); font-size: 0.88rem; }
.resource-date { color: var(--ink-3); font-family: var(--font-data); font-size: 0.72rem; }
.resource-card .btn { flex: none; }

.upload-grid { display: grid; gap: 10px; margin-bottom: 14px; }

/* -------------------------------------------------------------------------
   Mensajes y estados
   ------------------------------------------------------------------------- */
.msg {
  padding: 11px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.msg.success { background: var(--ok-bg); border-color: var(--ok-rule); color: #0A5B41; }
.msg.error { background: var(--bad-bg); border-color: var(--bad-rule); color: #8E2C22; }

.error {
  display: none;
  margin-top: 10px;
  color: var(--bad);
  font-size: 0.86rem;
  font-weight: 500;
}

.hint-inline { color: var(--ink-3); font-size: 0.84rem; }

/* -------------------------------------------------------------------------
   Modal
   ------------------------------------------------------------------------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 28, 51, 0.55);
}

.modal-content {
  width: 100%;
  max-width: 360px;
  padding: 24px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--gold-500);
  border-radius: var(--radius);
  box-shadow: 0 24px 50px rgba(4, 18, 33, 0.3);
  text-align: left;
}

.modal-content h3 { margin-bottom: 14px; }
.modal-content select, .modal-content input { margin-bottom: 10px; }
.modal-content button { width: 100%; margin-bottom: 8px; }

/* -------------------------------------------------------------------------
   Utilidades
   ------------------------------------------------------------------------- */
.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-16 { margin-bottom: 16px; }
.mt-24 { margin-top: 24px; }
.text-muted { color: var(--ink-3); }
.text-center { text-align: center; }
.divider { height: 1px; margin: 20px 0; background: var(--rule-soft); border: 0; }

/* -------------------------------------------------------------------------
   Adaptación a pantallas pequeñas
   ------------------------------------------------------------------------- */
@media (max-width: 860px) {
  .navbar { padding: 0 18px; }
  .layout { flex-direction: column; padding: 24px 16px 64px; }
  .tools-panel { position: static; width: 100%; }
  .canvas { padding: 20px; }
  .steps { grid-template-columns: 1fr; }
}

/* En pantallas angostas, las tablas se leen como fichas */
@media (max-width: 720px) {
  .table-wrap { overflow: visible; border: 0; background: transparent; }
  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tbody tr {
    margin-bottom: 10px;
    padding: 10px 14px;
    background: var(--sheet);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
  }
  .table-wrap td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 1px solid var(--rule-soft);
    text-align: right;
  }
  .table-wrap td::before {
    content: attr(data-label);
    flex: none;
    color: var(--ink-3);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: left;
  }
  .table-wrap tr td:last-child { border-bottom: 0; }
  .table-wrap td[data-label="Acción"] { flex-direction: column; align-items: stretch; gap: 8px; }
}

@media (max-width: 640px) {
  body { font-size: 0.97rem; }
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.18rem; }

  .container, .admin-container, .page { padding: 26px 16px 60px; }
  .sheet, .card { padding: 20px; border-radius: var(--radius); }
  .sheet-head { flex-direction: column; gap: 12px; }

  .navbar { flex-wrap: wrap; min-height: 0; padding: 10px 16px; gap: 8px; }
  .navbar .nav-links { width: 100%; justify-content: flex-start; overflow-x: auto; padding-bottom: 2px; }
  .navbar a.nav-link { white-space: nowrap; font-size: 0.88rem; }

  .login-card { padding: 28px 22px 24px; }
  .login-title { font-size: 1.65rem; }
  .login-actions { grid-template-columns: 1fr; }

  .grid-inputs { grid-template-columns: 1fr; }

  .form-panel .row > .btn { width: 100%; }
  .form-panel .row--end { justify-content: stretch; }

  .floating-panel { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 18px; text-align: center; }
  .floating-panel > div { justify-content: center; }
  .floating-panel .btn { width: 100%; }

  .resource-card { flex-direction: column; align-items: flex-start; }

  .practice-list li {
    flex-direction: column;
    align-items: stretch;
  }

  .practice-list li .btn {
    width: 100%;
  }

  .firma-realizador, .firma-verificador { justify-content: flex-start !important; }
  .firma-realizador select, .firma-verificador select { min-width: 0; width: 100%; }

  .status-firmas {
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
  }

  .status-firmas span + span::before { content: none; }

  .xls-wrap { max-height: 420px; }
  .xls { font-size: 0.82rem; }
  .xls-celda input { min-height: 34px; padding: 7px 8px; }
  .xls thead th { padding: 7px 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* -------------------------------------------------------------------------
   Impresión: la bitácora sale como documento
   ------------------------------------------------------------------------- */
@media print {
  body { background: #fff; }
  .navbar, .floating-panel, .btn, .btn-save, .btn-submit, .firma-realizador,
  .firma-verificador, #btn-borrador, #btn-entregar { display: none !important; }
  .sheet, .section-block, .card { border-color: #bbb; box-shadow: none; break-inside: avoid; }
  .container { max-width: none; padding: 0; }
  .xls-wrap { max-height: none; overflow: visible; }
  .xls thead th { position: static; }
}
