/* =====================================================================
   CMG Salud Laboral · estilos compartidos (estructura, menú y componentes)
   ===================================================================== */
:root {
  --navy: #1f3a66;
  --navy-800: #1a3157;
  --navy-600: #2a4a7d;
  --yellow: #f9c300;
  --yellow-soft: #fff6d6;
  --cream: #fdf7e4;
  --ink: #1f2a3c;
  --ink-soft: #4a5260;
  --muted: #7b8290;
  --line: #e6e8eb;
  --line-soft: #f0f1f3;
  --surface: #f6f7f9;
  --card: #ffffff;
  --radius: 10px;
  --font: "Mukta", "Segoe UI", system-ui, sans-serif;

  /* Gráficas (validadas: banda de luminosidad, croma y daltonismo) */
  --series-1: #d99a00;
  --series-2: #2f5fa8;

  /* Estados (reservados, siempre con icono + texto) */
  --good: #1f8a4c;
  --good-bg: #e7f5ec;
  --warn: #a86400;
  --warn-bg: #fdf1dc;
  --crit: #c0392b;
  --crit-bg: #fbe9e7;
  --info: #2f5fa8;
  --info-bg: #e9f0fa;
  --neutral: #5d6573;
  --neutral-bg: #eef0f3;

  --sidebar-w: 248px;
  --rail-w: 72px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  overflow-x: clip;
  transition: grid-template-columns .25s ease;
}

/* ================= Barra lateral ================= */
.sidebar {
  position: sticky;
  top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--navy);
  color: #fff;
  padding: 18px 14px 14px;
}
.sb-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 16px; text-decoration: none; }
.sb-brand img { width: 52px; height: auto; }
.sb-brand b { display: block; font-size: 20px; font-weight: 700; letter-spacing: 0.12em; line-height: 1.1; }
.sb-brand span { font-size: 15px; color: rgba(255, 255, 255, 0.85); }
.sb-collapse {
  align-self: flex-start;
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: rgba(255, 255, 255, 0.7);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.sb-collapse:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.sb-sede {
  display: flex;
  gap: 10px;
  padding: 14px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 14px;
  line-height: 1.45;
}
.sb-sede .avatar-sq {
  flex: none;
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12px; font-weight: 600;
}
.sb-sede small { display: block; color: rgba(255, 255, 255, 0.7); font-size: 13px; }

.sb-search { position: relative; display: block; margin: 14px 0 10px; }
.sb-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: rgba(255, 255, 255, 0.6); }
.sb-search input {
  width: 100%;
  height: 36px;
  padding: 0 10px 0 34px;
  font-size: 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}
.sb-search input::placeholder { color: rgba(255, 255, 255, 0.55); }
.sb-search input:focus { outline: none; border-color: var(--yellow); background: rgba(255, 255, 255, 0.12); }
.sb-search-btn { display: none; }

.sb-label { margin: 10px 8px 6px; font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.6); }

.sb-nav { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.nav-link, .nav-group > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
  transition: background .15s ease, color .15s ease;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-link:hover, .nav-group > summary:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-link.is-active, .nav-group.has-active > summary {
  position: relative;
  background: rgba(255, 255, 255, 0.1);
  color: var(--yellow);
  font-weight: 500;
}
.nav-link.is-active::after {
  content: "";
  position: absolute;
  right: 10px; top: 50%;
  width: 3px; height: 16px;
  transform: translateY(-50%);
  border-radius: 2px;
  background: var(--yellow);
}
.nav-group > summary .chev { margin-left: auto; width: 14px; height: 14px; opacity: .6; transition: transform .2s ease; }
.nav-group[open] > summary .chev { transform: rotate(90deg); }
.nav-group[open] > summary { color: #fff; }
.nav-group.has-active[open] > summary { color: var(--yellow); }
.nav-sub { margin: 2px 0 6px 21px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, 0.14); }
.nav-sub a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
}
.nav-sub a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-sub a.is-active { background: rgba(249, 195, 0, 0.14); color: var(--yellow); font-weight: 500; }
.nav-sub a mark { background: rgba(249, 195, 0, 0.35); color: #fff; border-radius: 2px; }
.pill {
  margin-left: auto;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
}
.pill--count { background: rgba(255, 255, 255, 0.16); color: #fff; }
.pill--new { background: var(--yellow); color: var(--navy); }
.sb-empty { padding: 8px 10px; font-size: 14px; color: rgba(255, 255, 255, 0.6); }

.sb-foot { padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}
.user-card .avatar {
  flex: none;
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--navy);
  font-size: 13px; font-weight: 700;
}
.user-card b { display: block; font-size: 14.5px; font-weight: 500; }
.user-card small { display: block; font-size: 13px; color: rgba(255, 255, 255, 0.7); }
.user-card a {
  margin-left: auto;
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.75);
}
.user-card a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.menu-btn {
  display: none;
  place-items: center;
  width: 40px; height: 40px;
  margin-bottom: 14px;
  color: var(--navy);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.scrim { display: none; }

/* Menú contraído en escritorio: solo iconos */
@media (min-width: 901px) {
  .sidebar { overflow-x: hidden; transition: width .25s ease, padding .25s ease; }
  html.sb-collapsed .app { grid-template-columns: var(--rail-w) 1fr; }
  html.sb-collapsed .sidebar { width: var(--rail-w); padding: 16px 12px 14px; }

  html.sb-collapsed .sb-brand-text,
  html.sb-collapsed .sb-sede-text,
  html.sb-collapsed .sb-search,
  html.sb-collapsed .sb-label,
  html.sb-collapsed .nav-text,
  html.sb-collapsed .nav-group > summary .chev,
  html.sb-collapsed .nav-sub,
  html.sb-collapsed .user-text { display: none; }

  html.sb-collapsed .sb-brand-row { flex-direction: column; gap: 10px; }
  html.sb-collapsed .sb-brand { padding: 4px 0 0; }
  html.sb-collapsed .sb-brand img { width: 44px; }
  html.sb-collapsed .sb-collapse { margin: 0 0 12px; align-self: center; }
  html.sb-collapsed .sb-collapse svg { transform: scaleX(-1); }
  html.sb-collapsed .sb-sede { justify-content: center; padding: 12px 0; }

  html.sb-collapsed .sb-search-btn {
    display: grid;
    place-items: center;
    width: 100%;
    height: 38px;
    margin: 14px 0 10px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: pointer;
  }
  html.sb-collapsed .sb-search-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }

  html.sb-collapsed .nav-link,
  html.sb-collapsed .nav-group > summary { position: relative; justify-content: center; padding: 10px 0; }
  html.sb-collapsed .nav-link.is-active::after { right: 3px; }
  html.sb-collapsed .nav-group > summary .pill {
    position: absolute;
    top: 3px;
    right: 6px;
    margin: 0;
    padding: 0 5px;
    font-size: 10px;
    line-height: 15px;
    background: var(--yellow);
    color: var(--navy);
  }
  html.sb-collapsed .nav-group.is-flyout > summary { background: rgba(255, 255, 255, 0.1); color: #fff; }

  html.sb-collapsed .user-card { flex-direction: column; gap: 6px; padding: 8px 0; }
  html.sb-collapsed .user-card a { margin-left: 0; }
}
.sb-brand-row { display: flex; align-items: flex-start; }

/* Submenú flotante del menú contraído */
.flyout {
  position: fixed;
  z-index: 40;
  left: calc(var(--rail-w) + 6px);
  min-width: 250px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  padding: 6px;
  font-family: var(--font);
  color: #fff;
  background: var(--navy-800);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 14px 40px rgba(6, 18, 40, 0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-4px);
  transition: opacity .12s ease, transform .12s ease, visibility 0s linear .12s;
}
.flyout.show { opacity: 1; visibility: visible; transform: none; transition: opacity .12s ease, transform .12s ease; }
.flyout-title { margin: 0; padding: 6px 10px 8px; font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.6); }
.flyout a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; font-size: 14px; color: rgba(255, 255, 255, 0.85); text-decoration: none; }
.flyout a:hover, .flyout a:focus-visible { background: rgba(255, 255, 255, 0.08); color: #fff; outline: none; }
.flyout a.is-active { color: var(--yellow); }
.flyout.is-tip { min-width: 0; padding: 4px; }
.flyout.is-tip .flyout-title { padding: 4px 10px; font-size: 14px; letter-spacing: 0; text-transform: none; color: #fff; }

/* ================= Contenido ================= */
.main { min-width: 0; padding: 28px 34px 48px; }

.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--navy); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.card-head h2 { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.25; }
.card-head p { margin: 4px 0 0; font-size: 14px; color: var(--ink-soft); }
.link { font-size: 15px; font-weight: 500; color: var(--navy); text-decoration: none; white-space: nowrap; }
.link:hover { text-decoration: underline; }
.divider { height: 1px; background: var(--line); }

/* Botones */
.btn, .btn-out, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.btn { color: var(--ink); background: var(--yellow); border: 0; }
.btn:hover { background: var(--navy); color: #fff; }
.btn-out { color: var(--ink); background: var(--card); border: 1px solid var(--line); font-weight: 500; }
.btn-out:hover { border-color: var(--navy); color: var(--navy); }
.btn-ghost { color: var(--ink-soft); background: none; border: 0; font-weight: 500; padding: 0 10px; }
.btn-ghost:hover { color: var(--navy); background: var(--info-bg); }
.btn-danger { color: var(--crit); }
.btn-danger:hover { color: #fff; background: var(--crit); border-color: var(--crit); }
.btn svg, .btn-out svg, .btn-ghost svg { width: 16px; height: 16px; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13.5px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px;
  color: var(--ink-soft);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.icon-btn:hover { background: var(--info-bg); color: var(--navy); }
.icon-btn svg { width: 16px; height: 16px; }

/* Estados */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px 2px 7px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.status svg { width: 13px; height: 13px; stroke-width: 2.2; }
.status--good { background: var(--good-bg); color: var(--good); }
.status--warn { background: var(--warn-bg); color: var(--warn); }
.status--crit { background: var(--crit-bg); color: var(--crit); }
.status--info { background: var(--info-bg); color: var(--info); }
.status--neutral { background: var(--neutral-bg); color: var(--neutral); }

.bar { height: 5px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--yellow); transition: width .8s cubic-bezier(.2,.7,.2,1); }
.bar--navy > i { background: var(--navy); }
.bar--warn > i { background: var(--warn); }

.reveal { animation: rise .45s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= Encabezado de módulo ================= */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { color: var(--navy); text-decoration: underline; }
.crumbs svg { width: 12px; height: 12px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.page-head .ph-icon {
  flex: none;
  display: grid; place-items: center;
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--yellow-soft);
  color: var(--navy);
}
.page-head .ph-icon svg { width: 24px; height: 24px; }
.page-title { display: flex; gap: 16px; align-items: flex-start; }
.page-title h1 { margin: 0; font-size: 30px; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; color: var(--navy); }
.page-title p { margin: 6px 0 0; max-width: 680px; font-size: 15.5px; color: var(--ink-soft); }
.page-title .help { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 14px; color: var(--navy); text-decoration: none; }
.page-title .help:hover { text-decoration: underline; }
.page-title .help svg { width: 15px; height: 15px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.more { position: relative; }
.more-menu {
  position: absolute;
  right: 0; top: calc(100% + 6px);
  z-index: 20;
  min-width: 200px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(20, 30, 50, 0.12);
}
.more-menu button {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  font-size: 14.5px;
  text-align: left;
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.more-menu button:hover { background: var(--surface); }
.more-menu button svg { width: 16px; height: 16px; color: var(--ink-soft); }

/* ================= Rejillas de contenido ================= */
.blocks { display: grid; gap: 20px; margin-top: 24px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.split--half { grid-template-columns: 1fr 1fr; }
.split--wide { grid-template-columns: minmax(0, 1fr) 420px; }
.split > div { display: grid; gap: 20px; min-width: 0; }

/* ================= Formularios ================= */
.form-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 16px 18px; margin-top: 18px; }
.field { min-width: 0; }
.field.span-2 { grid-column: span 2; }
.field.span-3 { grid-column: span 3; }
.field.span-full { grid-column: 1 / -1; }
.field > label, .field > .flabel { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--ink); }
.field .req { color: var(--crit); margin-left: 2px; }
.field .hint { display: block; margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.ctl { position: relative; }
.ctl > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.ctl.has-icon input { padding-left: 34px; }
.ctl input, .ctl select, .ctl textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ctl select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237b8290' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.ctl textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.ctl input::placeholder, .ctl textarea::placeholder { color: #9aa0aa; }
.ctl input:hover, .ctl select:hover, .ctl textarea:hover { border-color: #cfd3d9; }
.ctl input:focus, .ctl select:focus, .ctl textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(31, 58, 102, 0.12); }
.ctl input[readonly] { background: var(--surface); color: var(--ink-soft); }
.ctl .suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13.5px; color: var(--muted); }

/* Interruptor */
.switch, .field > .switch { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; margin: 0; font-size: 14.5px; font-weight: 400; color: var(--ink); cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { position: relative; flex: none; width: 36px; height: 20px; border-radius: 999px; background: #cfd3d9; transition: background .2s ease; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s ease; }
.switch input:checked + .track { background: var(--navy); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--navy); outline-offset: 2px; }

/* Fichas seleccionables (días, opciones) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { position: relative; cursor: pointer; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  font-size: 14px;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: all .15s ease;
}
.chips input:checked + span { color: var(--navy); background: var(--info-bg); border-color: var(--navy); font-weight: 500; }
.chips input:checked + span::before { content: "✓"; font-size: 12px; }
.chips input:focus-visible + span { outline: 2px solid var(--navy); outline-offset: 2px; }

/* Opciones de radio en tarjetas */
.radios { display: grid; gap: 8px; }
.radios label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 14px; }
.radios label:has(input:checked) { border-color: var(--navy); background: var(--info-bg); }
.radios input { margin-top: 3px; accent-color: var(--navy); }
.radios b { display: block; font-weight: 600; }
.radios small { color: var(--ink-soft); }

/* Cargar archivos */
.drop {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border: 1.5px dashed #c9d1de;
  border-radius: 10px;
  background: #fbfcfd;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.drop:hover { border-color: var(--navy); background: var(--info-bg); }
.drop .drop-ic { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; background: var(--info-bg); color: var(--navy); }
.drop b { display: block; font-size: 14.5px; font-weight: 500; }
.drop small { font-size: 13px; color: var(--muted); }
.drop input { display: none; }

/* Casillas en rejilla */
.check-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 4px 16px; margin-top: 14px; }
.check-grid label { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.check-grid label:hover { background: var(--surface); }
.check-grid input { width: 16px; height: 16px; accent-color: var(--navy); }
.check-tools { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.check-tools .ctl { flex: 1; max-width: 320px; }

/* Firma y foto */
.capture { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.capture-box { display: grid; place-items: center; height: 150px; border: 1.5px dashed #c9d1de; border-radius: 10px; background: #fbfcfd; color: var(--muted); font-size: 14px; text-align: center; }
.capture-box svg { width: 28px; height: 28px; margin: 0 auto 6px; display: block; }
.capture-actions { display: flex; gap: 8px; margin-top: 8px; }

/* Nota informativa */
.note {
  display: flex; gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--info-bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
}
.note svg { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--info); }
.note--warn { background: var(--warn-bg); }
.note--warn svg { color: var(--warn); }

/* ================= Filtros ================= */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; }
.filters .field { flex: 1 1 180px; max-width: 280px; }
.filters .field.grow { flex: 2 1 260px; max-width: none; }
.filters .f-actions { display: flex; gap: 8px; margin-left: auto; }

/* ================= Tablas ================= */
.table-wrap { margin-top: 14px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--muted);
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table th:first-child { border-top-left-radius: 8px; }
.table th:last-child { border-top-right-radius: 8px; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:hover td { background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .n { text-align: right; font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 500; color: var(--ink); }
.table .sub { display: block; font-size: 12.5px; color: var(--muted); }
.table .row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.table input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--navy); }
.table-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 13.5px; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 4px; }
.pager button { min-width: 32px; height: 32px; padding: 0 8px; font-size: 13.5px; color: var(--ink-soft); background: #fff; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.pager button[aria-current] { background: var(--navy); border-color: var(--navy); color: #fff; }
.per-page { display: flex; align-items: center; gap: 8px; }
.per-page select { height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); font-size: 14.5px; }
.empty svg { display: block; width: 34px; height: 34px; margin: 0 auto 10px; color: #b5bcc7; }
.table-search { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.table-search .ctl { flex: 1; max-width: 360px; }
.table-search .ctl input { height: 36px; }

/* Lista de registros (columna derecha) */
.records { margin: 12px 0 0; padding: 0; list-style: none; }
.records li { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 8px; cursor: pointer; }
.records li + li { border-top: 1px solid var(--line-soft); }
.records li:hover { background: var(--surface); }
.records li.is-selected { background: var(--info-bg); }
.records .av { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--neutral-bg); color: var(--navy); font-size: 12.5px; font-weight: 700; }
.records .tx { min-width: 0; flex: 1; }
.records .tx b { display: block; font-size: 14.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.records .tx small { display: block; font-size: 13px; color: var(--muted); }

/* Pestañas */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs button {
  position: relative;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--ink-soft);
  background: none;
  border: 0;
  white-space: nowrap;
  cursor: pointer;
}
.tabs button:hover { color: var(--navy); }
.tabs button[aria-selected="true"] { color: var(--navy); font-weight: 600; }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--yellow); }
.tab-panel { padding-top: 4px; }

/* Indicadores */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.kpi-mini { padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.kpi-mini span { font-size: 13.5px; color: var(--ink-soft); }
.kpi-mini b { display: block; margin-top: 6px; font-size: 26px; font-weight: 700; line-height: 1.1; color: var(--navy); font-variant-numeric: tabular-nums; }
.kpi-mini small { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); }

/* Pasos */
.steps { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 14px; margin-top: 16px; counter-reset: st; }
.step { position: relative; padding: 16px 16px 16px 56px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; color: var(--ink-soft); }
.step::before { counter-increment: st; content: counter(st); position: absolute; left: 16px; top: 16px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--neutral-bg); color: var(--navy); font-weight: 700; }
.step.done::before { content: "✓"; background: var(--good-bg); color: var(--good); }
.step.current { border-color: var(--navy); background: var(--info-bg); }
.step.current::before { background: var(--navy); color: #fff; }
.step b { display: block; margin-bottom: 2px; font-size: 15px; color: var(--ink); }

/* Barra fija de guardado */
.savebar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 24px -34px -48px;
  padding: 14px 34px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}
.savebar .actions { display: flex; gap: 8px; }

/* Aviso flotante */
.toast {
  position: fixed;
  left: 50%; bottom: 24px;
  z-index: 60;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  font-size: 14.5px;
  color: #fff;
  background: var(--navy-800);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(6, 18, 40, 0.3);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast svg { color: var(--yellow); }

/* ================= Responsive ================= */
@media (max-width: 1280px) {
  .split, .split--wide { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .form-grid { --cols: 2 !important; }
  .field.span-3 { grid-column: span 2; }
  .check-grid { --cols: 2 !important; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 30;
    left: 0;
    width: min(86vw, 300px);
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  body.nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 20; background: rgba(10, 20, 40, 0.45); }
  body.nav-open .scrim { display: block; }
  .main { padding: 18px 16px 40px; }
  .menu-btn { display: inline-grid; }
  .page-head { flex-direction: column; }
  .page-actions { justify-content: flex-start; }
  .page-title h1 { font-size: 26px; }
  .card-pad { padding: 18px 16px; }
  .split--half { grid-template-columns: 1fr; }
  .savebar { margin: 24px -16px -40px; padding: 12px 16px; }
}
@media (max-width: 600px) {
  .form-grid { --cols: 1 !important; }
  .field.span-2, .field.span-3 { grid-column: auto; }
  .check-grid { --cols: 1 !important; }
  .capture { grid-template-columns: 1fr; }
  .page-head .ph-icon { display: none; }
  .filters .field { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .sidebar, .menu-btn, .page-actions, .savebar, .flyout { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  .card { break-inside: avoid; }
}
