/* ==========================================================================
   Projects Hub — hoja de estilos
   --------------------------------------------------------------------------
   Principios:
   - Todo local: sin fuentes ni recursos externos (pila tipográfica del sistema).
   - Tokens en :root; el tema oscuro solo redefine tokens, nunca componentes.
   - Claro/oscuro siguen la preferencia del sistema (prefers-color-scheme).
   - Las cuatro lecturas del proyecto tienen gramática visual propia y fija:
     fase = pastilla neutra · salud = punto de color · avance = barra de hitos ·
     atención = bandera con borde lateral.
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f4f4ef;
  --surface: #ffffff;
  --surface-2: #f0f1e9;
  --surface-3: #e6e8dd;
  --ink: #1c2620;
  --muted: #5d685f;
  --line: #dee0d3;
  --line-strong: #c2c8b6;
  --accent: #d7ff72;
  --accent-ink: #33500f;
  --focus: #3f6ae0;

  --green: #2f8a5c;
  --green-bg: #ddf0e2;
  --green-ink: #20603d;
  --amber: #c98a12;
  --amber-bg: #faedc6;
  --amber-ink: #755200;
  --red: #cf4542;
  --red-bg: #fbdfdc;
  --red-ink: #8f2724;
  --blue: #4e75ff;
  --blue-bg: #e2e8fb;
  --blue-ink: #2e4ca8;
  --slate-bg: #e8eae4;
  --slate-ink: #4d5750;

  --shadow: 0 18px 48px rgb(28 38 32 / 12%);
  --radius: 14px;
  --radius-lg: 18px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, system-ui, sans-serif;
  --topbar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111613;
    --surface: #1a211c;
    --surface-2: #222a24;
    --surface-3: #2c362e;
    --ink: #e9ede8;
    --muted: #9da89e;
    --line: #2b342d;
    --line-strong: #3d4840;
    --accent: #c8f169;
    --accent-ink: #22350c;
    --focus: #8fabf5;

    --green: #55bd85;
    --green-bg: #1d3326;
    --green-ink: #86d3ab;
    --amber: #e0a83e;
    --amber-bg: #3a2f13;
    --amber-ink: #e7bd6a;
    --red: #e06c68;
    --red-bg: #3d2320;
    --red-ink: #ef9a95;
    --blue: #8fabf5;
    --blue-bg: #222c4c;
    --blue-ink: #aec2f8;
    --slate-bg: #2a332d;
    --slate-ink: #a7b3aa;

    --shadow: 0 18px 48px rgb(0 0 0 / 45%);
  }
}

/* ---------- Base ------------------------------------------------------- */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); }

/* Cinturón de seguridad contra desbordes horizontales (Safari iOS):
   `clip` no crea contenedor de scroll, así que `position: sticky` sigue
   funcionando; los navegadores sin `clip` se apoyan en max-width. */
html, body { max-width: 100%; }
@supports (overflow: clip) {
  html, body { overflow-x: clip; }
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; color: inherit; }

/* Safari de iOS amplía la página al enfocar cualquier control por debajo de
   16 px y NO deshace el zoom al salir. Regla global: ningún control baja de
   16 px, así ningún filtro o buscador puede dejar la interfaz ampliada.
   (No usar user-scalable=no ni maximum-scale: Safari los ignora y perjudican
   la accesibilidad.) */
input, select, textarea { font-size: 16px; }
button, select { cursor: pointer; }
a { color: inherit; }

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

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(26px, 3.4vw, 38px); line-height: 1.02; letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 17px; line-height: 1.2; letter-spacing: -.02em; }
h3 { margin-bottom: 4px; font-size: 14px; line-height: 1.3; }

.eyebrow {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.view-subtitle { margin: 10px 0 0; max-width: 640px; color: var(--muted); font-size: 13px; }
.view-subtitle strong { color: var(--ink); font-weight: 700; }

/* ---------- Estructura ------------------------------------------------- */

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--topbar-h);
  padding: 0 20px 0 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.brand img { border-radius: 10px; }
.brand span { display: grid; line-height: 1.05; }
.brand strong { font-size: 14.5px; letter-spacing: -.02em; }
.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.topbar-actions, .button-row { display: flex; align-items: center; gap: 9px; }
.topbar-actions form { margin: 0; }

.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 200px;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface);
  text-align: left;
}

.search-trigger-label { flex: 1; font-size: 13px; }

kbd {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  font-size: 11px;
}

.user-chip {
  max-width: 180px;
  overflow: hidden;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button, .dialog-close, .drawer-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 18px;
}

/* ---------- Selector de ámbito (sociedad + persona) -----------------------
   Persistente entre secciones y sesiones. Con filtro activo, el select se
   tiñe de acento y aparece «Quitar filtros»: un filtro que no se ve es peor
   que no tener filtro. */

.topbar-scope {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

.scope-field { display: flex; align-items: center; min-width: 0; }

.scope-select {
  min-height: 38px;
  max-width: 235px;
  padding: 0 28px 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 650;
  text-overflow: ellipsis;
}

.scope-select.is-active {
  border-color: color-mix(in srgb, var(--accent) 65%, var(--line-strong));
  background: color-mix(in srgb, var(--accent) 26%, var(--surface));
  color: var(--accent-ink);
}

.scope-reset {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 750;
  white-space: nowrap;
}

.scope-reset:hover { color: var(--ink); border-color: var(--line-strong); }

/* ---------- Navegación --------------------------------------------------
   Cada .nav-item es independiente: quitar uno (futuro rol con acceso
   parcial) no afecta al resto ni deja huecos rotos. */

.primary-nav {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  padding: 18px 10px;
  border-right: 1px solid var(--line);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  margin-bottom: 4px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 13.5px;
  font-weight: 700;
  text-align: left;
}

.nav-icon { width: 20px; color: var(--ink); font-size: 17px; text-align: center; }
.nav-label-mobile { display: none; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.is-active { background: var(--ink); color: var(--bg); }
.nav-item.is-active .nav-icon { color: var(--accent); }

/* ---------- Contenido --------------------------------------------------- */

main { min-width: 0; padding: 34px clamp(18px, 3.5vw, 56px) 64px; }
.view { display: none; max-width: 1280px; margin: 0 auto; }
.view.is-active { display: block; animation: enter .18s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } }

.view-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

/* ---------- Botones ------------------------------------------------------ */

.primary-button, .secondary-button, .text-button {
  border-radius: 10px;
  font-weight: 700;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}

.primary-button {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 4px 12px rgb(28 38 32 / 16%);
  font-size: 13.5px;
  white-space: nowrap;
}

.primary-button:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgb(28 38 32 / 20%); }
.primary-button:disabled { cursor: wait; opacity: .6; transform: none; }

.secondary-button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 13px;
}

.secondary-button:hover { background: var(--surface-2); }
.text-button { padding: 5px; border: 0; color: var(--muted); background: transparent; font-size: 12.5px; white-space: nowrap; }
.text-button:hover { color: var(--ink); }

/* ---------- Tira de estado (inicio) -------------------------------------- */

.stat-strip {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.stat-strip::-webkit-scrollbar { display: none; }

.stat-chip {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  white-space: nowrap;
}

.stat-chip strong { font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.stat-chip span { color: var(--muted); font-size: 11.5px; font-weight: 650; }
.stat-chip[data-tone="alert"] { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); background: var(--red-bg); }
.stat-chip[data-tone="alert"] strong, .stat-chip[data-tone="alert"] span { color: var(--red-ink); }
.stat-chip[data-tone="warn"] { background: var(--amber-bg); border-color: color-mix(in srgb, var(--amber) 40%, var(--line)); }
.stat-chip[data-tone="warn"] strong, .stat-chip[data-tone="warn"] span { color: var(--amber-ink); }

/* ---------- Paneles del inicio ------------------------------------------- */

.dashboard-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; align-items: start; }

.panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-heading .eyebrow { margin-bottom: 4px; }

/* ---------- Filas de lista genéricas -------------------------------------- */

.stack-list { display: grid; gap: 6px; }
.stack-list.compact { gap: 5px; }

.list-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--surface-2);
  text-align: left;
}

.list-row:hover { border-color: var(--line-strong); background: var(--surface); }

.row-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
}

.row-copy { min-width: 0; }
.row-copy strong, .row-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-copy strong { font-size: 13px; }
.row-copy small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.row-date { color: var(--muted); font-size: 11px; font-weight: 750; white-space: nowrap; }
.row-date.is-overdue { color: var(--red-ink); }
.row-time { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 800; white-space: nowrap; }
.row-time small { display: block; color: var(--muted); font-size: 10px; font-weight: 650; text-align: right; }

/* Fila de proyecto dentro de «Requiere atención»: nombre + motivos */
.attention-item { grid-template-columns: minmax(0, 1fr) auto; }
.attention-item .reasons { margin-top: 3px; color: var(--muted); font-size: 11px; }

/* ---------- Gramática de las cuatro lecturas ------------------------------
   Fase = pastilla neutra. Salud = punto de color. Avance = barra de hitos.
   Atención = bandera con borde lateral. No comparten forma ni color. */

.phase-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--slate-ink);
  background: transparent;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.health { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.health .dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--surface-3); }
.health[data-health="green"] { color: var(--green-ink); }
.health[data-health="green"] .dot { background: var(--green); }
.health[data-health="amber"] { color: var(--amber-ink); }
.health[data-health="amber"] .dot { background: var(--amber); }
.health[data-health="red"] { color: var(--red-ink); }
.health[data-health="red"] .dot { background: var(--red); }
.health[data-health="unknown"] { color: var(--muted); }

.progress { display: grid; gap: 4px; min-width: 0; }
.progress-bar {
  display: block;
  width: 100%;
  height: 5px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-3);
  appearance: none;
  -webkit-appearance: none;
}
.progress-bar::-webkit-progress-bar { border-radius: 999px; background: var(--surface-3); }
.progress-bar::-webkit-progress-value { border-radius: 999px; background: var(--green); }
.progress-bar::-moz-progress-bar { border-radius: 999px; background: var(--green); }
.progress-copy { color: var(--muted); font-size: 10.5px; font-weight: 650; white-space: nowrap; }

.attention-flag {
  display: inline-grid;
  gap: 1px;
  max-width: 100%;
  padding: 5px 9px;
  border-left: 3px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface-2);
  line-height: 1.25;
}

.attention-flag strong { font-size: 11px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.attention-flag small { color: var(--muted); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attention-flag[data-tone="critical"] { border-color: var(--red); background: var(--red-bg); }
.attention-flag[data-tone="critical"] strong { color: var(--red-ink); }
.attention-flag[data-tone="high"] { border-color: var(--amber); background: var(--amber-bg); }
.attention-flag[data-tone="high"] strong { color: var(--amber-ink); }
.attention-flag[data-tone="upcoming"] { border-color: var(--blue); background: var(--blue-bg); }
.attention-flag[data-tone="upcoming"] strong { color: var(--blue-ink); }
.attention-flag[data-tone="review"] { border-color: var(--slate-ink); background: var(--slate-bg); }
.attention-flag[data-tone="review"] strong { color: var(--slate-ink); }
.attention-flag[data-tone="stable"] { border-color: var(--green); }
.attention-flag[data-tone="stable"] strong { color: var(--green-ink); }
.attention-flag[data-tone="closed"] { opacity: .75; }
.attention-flag[data-tone="closed"] strong { color: var(--muted); }

/* ---------- Tabla de proyectos --------------------------------------------
   Escritorio: fila tipo tabla con las cuatro lecturas en columnas fijas.
   Móvil: la misma fila se repliega en tarjeta compacta (ver media query). */

.project-table { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }

.project-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1.7fr) 112px 104px minmax(120px, .8fr) 128px;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.project-row:last-child { border-bottom: 0; }
button.project-row:hover { background: var(--surface-2); }

.project-row-head {
  min-height: 0;
  padding: 9px 16px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.project-name { min-width: 0; }
.project-name strong { display: block; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.project-name small { display: block; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.project-next { min-width: 0; font-size: 12px; font-weight: 700; }
.project-next small { display: block; color: var(--muted); font-size: 10px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-next.is-overdue { color: var(--red-ink); }

/* Solo visible en móvil: agrupa fase + salud + avance en la tarjeta replegada */
.project-mobile-meta { display: none; }

/* ---------- Filtros -------------------------------------------------------- */

.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }

.filterbar select, .search-field {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.filterbar select { max-width: 200px; padding: 0 32px 0 11px; color: var(--muted); }
.search-field { display: flex; align-items: center; flex: 1; min-width: 170px; padding: 0 11px; }
.search-field:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.search-field span { margin-right: 8px; color: var(--muted); }
.search-field input { width: 100%; border: 0; outline: none; background: transparent; }

/* ---------- Agenda ---------------------------------------------------------- */

.agenda-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 14px; align-items: start; }
.agenda-aside { position: sticky; top: calc(var(--topbar-h) + 16px); }

.timeline { display: grid; gap: 8px; }
.timeline-group {
  margin: 12px 0 2px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.timeline-group:first-child { margin-top: 0; }
.timeline-group.is-today { color: var(--blue-ink); }
.timeline-group.is-overdue { color: var(--red-ink); }

.timeline-item {
  display: grid;
  grid-template-columns: 92px 8px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  text-align: left;
}

.timeline-item:hover { border-color: var(--line-strong); }
.timeline-item.is-done { opacity: .62; }

.timeline-when { color: var(--muted); font-size: 10.5px; font-weight: 700; line-height: 1.4; font-variant-numeric: tabular-nums; }
.timeline-marker { width: 8px; height: 40px; border-radius: 999px; background: var(--blue); }
.timeline-marker[data-kind="task"] { background: var(--ink); }
.timeline-marker[data-kind="milestone"] { background: var(--green); }
.timeline-marker[data-kind="waiting"] { background: repeating-linear-gradient(180deg, var(--amber) 0 5px, transparent 5px 9px); border-radius: 3px; }
.timeline-marker[data-kind="call"], .timeline-marker[data-kind="email"] { background: var(--red); }
.timeline-copy { min-width: 0; }
.timeline-copy strong { display: block; overflow: hidden; font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.timeline-copy p { margin: 3px 0 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.agenda-stat { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.agenda-stat:last-child { border: 0; }
.agenda-stat strong { font-size: 17px; font-weight: 800; }

/* ---------- Pastillas de estado genéricas (agenda, presupuestos, drawer) --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--slate-bg);
  color: var(--slate-ink);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge[data-status="blocked"], .badge[data-status="rejected"], .badge[data-status="expired"] { background: var(--red-bg); color: var(--red-ink); }
.badge[data-status="waiting"], .badge[data-status="negotiating"] { background: var(--amber-bg); color: var(--amber-ink); }
.badge[data-status="sent"] { background: var(--blue-bg); color: var(--blue-ink); }
.badge[data-status="done"], .badge[data-status="approved"] { background: var(--green-bg); color: var(--green-ink); }
.badge[data-status="cancelled"] { opacity: .7; }

/* ---------- CRM -------------------------------------------------------------- */

.contacts-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.contact-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}

.contact-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.contact-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 12px;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 850;
}
.contact-card h2 { font-size: 15px; }
.contact-role { min-height: 32px; margin: 4px 0 12px; color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.contact-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10.5px; }
.contact-footer span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-footer strong { flex: none; }

/* ---------- Presupuestos ------------------------------------------------------- */

.budgets-list { display: grid; gap: 8px; }

.budget-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1.5fr) minmax(120px, .6fr) 110px 110px auto;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  text-align: left;
}

.budget-row:hover { border-color: var(--line-strong); }
.budget-number strong, .budget-number small { display: block; }
.budget-number strong { font-size: 16px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.budget-number small { margin-top: 2px; color: var(--muted); font-size: 9.5px; font-weight: 700; }
.budget-title strong, .budget-title small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.budget-title strong { font-size: 13px; }
.budget-title small, .budget-cell small { margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.budget-cell { font-size: 12px; font-variant-numeric: tabular-nums; }
.budget-cell.is-overdue strong { color: var(--red-ink); }
.budget-amount { text-align: right; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Suscripciones y renovaciones ----------------------------------- */

.subscription-filters .search-field { flex: 1 1 260px; }
.subscription-filter-options { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: 8px; }
.subscription-filter-toggle { display: none; }
.subscriptions-list { display: grid; gap: 8px; }

.subscription-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) minmax(110px, .7fr) 150px 135px minmax(150px, auto);
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  text-align: left;
}

.subscription-row:hover { border-color: var(--line-strong); }
.subscription-provider, .subscription-cell, .subscription-amount { display: grid; gap: 3px; min-width: 0; }
.subscription-provider strong, .subscription-provider small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subscription-provider strong { font-size: 13.5px; }
.subscription-provider small, .subscription-cell small, .subscription-amount small { color: var(--muted); font-size: 10.5px; }
.subscription-cell strong { overflow-wrap: anywhere; font-size: 12px; }
.subscription-cell.is-overdue strong, .subscription-cell.is-overdue small { color: var(--red-ink); }
.subscription-amount { text-align: right; }
.subscription-amount strong { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.subscription-hidden { position: absolute; top: 5px; right: 7px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }

.badge[data-status="active"] { background: var(--green-bg); color: var(--green-ink); }
.badge[data-status="trial"], .badge[data-status="paused"] { background: var(--amber-bg); color: var(--amber-ink); }
.badge[data-status="free"] { background: var(--blue-bg); color: var(--blue-ink); }
.badge[data-status="cancelled_pending"] { background: var(--red-bg); color: var(--red-ink); }
.badge[data-status="closed"], .badge[data-status="archived"] { background: var(--slate-bg); color: var(--slate-ink); }

.subscription-history { display: grid; gap: 8px; }
.subscription-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
}
.subscription-history-row > div { display: grid; gap: 2px; }
.subscription-history-row strong { font-size: 12.5px; }
.subscription-history-row span { font-size: 11.5px; }
.subscription-history-row.is-released { opacity: 0.6; }
.subscription-history-row .text-button { align-self: start; }
.subscription-history-row small { color: var(--muted); font-size: 10px; }
.subscription-history-row p { grid-column: 1 / -1; margin: 2px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; white-space: pre-line; }

/* ---------- Cajón de detalle ---------------------------------------------------- */

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  width: min(620px, 96vw);
  height: 100vh;
  height: 100dvh;
  padding: 18px 30px 34px;
  overflow: auto;
  overscroll-behavior: contain;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -22px 0 64px rgb(0 0 0 / 22%);
  transform: translateX(105%);
  transition: transform .22s ease;
}

.detail-drawer.is-open { transform: translateX(0); }
.drawer-scrim { position: fixed; inset: 0; z-index: 50; visibility: hidden; background: rgb(10 14 11 / 42%); opacity: 0; transition: opacity .18s; }
.drawer-scrim.is-open { visibility: visible; opacity: 1; }
.drawer-close { position: sticky; top: 0; z-index: 2; float: right; }

.drawer-hero { padding: 26px 0 18px; border-bottom: 1px solid var(--line); }
.drawer-hero h1 { max-width: 460px; font-size: 28px; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* Las cuatro lecturas del proyecto, ampliadas, en la ficha */
.reading-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.reading { padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.reading > small { display: block; margin-bottom: 6px; color: var(--muted); font-size: 9.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.reading .progress { margin-top: 2px; }
.reading-reasons { margin: 7px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 11px; line-height: 1.5; }

.drawer-section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.drawer-section:last-child { border: 0; }
.drawer-section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 11px; }
.drawer-subhead { margin-top: 16px; }
.drawer-badges { margin-top: 12px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail-field { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.detail-field small, .detail-field strong { display: block; }
.detail-field small { margin-bottom: 4px; color: var(--muted); font-size: 9.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.detail-field strong { font-size: 12.5px; line-height: 1.4; overflow-wrap: anywhere; }
.drawer-text { margin-bottom: 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; white-space: pre-line; }
.document-link { display: inline-flex; margin-top: 8px; padding: 10px 13px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); font-size: 12.5px; font-weight: 700; text-decoration: none; }
.document-link:hover { background: var(--surface-2); }
.document-warning { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; color: var(--amber-ink); background: var(--amber-bg); font-size: 11.5px; line-height: 1.5; }
.local-copy { margin: 8px 0 0; overflow-wrap: anywhere; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.document-versions { display: grid; gap: 8px; }
.document-version {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
}
.document-version-main strong, .document-version-main span, .document-version-main small { display: block; }
.document-version-main strong { font-size: 12.5px; }
.document-version-main span { margin-top: 2px; overflow-wrap: anywhere; font-size: 11.5px; }
.document-version-main small, .document-version-actions small { margin-top: 4px; color: var(--muted); font-size: 9.5px; }
.document-version-actions { display: grid; align-content: start; justify-items: end; gap: 4px; text-align: right; }
.document-version-link { font-size: 11px; font-weight: 750; text-decoration: none; }
.document-version-link:hover { text-decoration: underline; }
.document-version-pending { color: var(--amber-ink); font-size: 10.5px; font-weight: 750; }
.document-version-notes { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.5; white-space: pre-line; }

/* ---------- Diálogos y formularios ---------------------------------------------- */

dialog { color: var(--ink); }
dialog::backdrop { background: rgb(10 14 11 / 55%); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

.editor-dialog {
  width: min(740px, calc(100% - 24px));
  max-height: calc(100vh - 30px);
  max-height: calc(100dvh - 30px);
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 28px 84px rgb(0 0 0 / 35%);
}

.editor-dialog form { padding: 24px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.dialog-heading h2 { font-size: 23px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid label { display: grid; gap: 5px; color: var(--muted); font-size: 10.5px; font-weight: 800; letter-spacing: .02em; }

.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
  background: var(--bg);
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0;
}

.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent);
}

.form-grid textarea { min-height: 84px; resize: vertical; }
.form-grid select[multiple] { min-height: 108px; }
.form-span-2 { grid-column: 1 / -1; }
.checkbox-label { display: flex !important; grid-column: 1 / -1; align-items: center; gap: 9px !important; min-height: 44px; }
.checkbox-label input { width: 20px; min-height: 20px; }
.field-help { color: color-mix(in srgb, var(--ink) 70%, var(--surface)); font-size: 11px; font-weight: 520; line-height: 1.4; }
.required-marker { margin-left: 2px; color: var(--red-ink); font-weight: 800; }
.form-required-note { margin: -2px 0 2px; color: var(--muted); font-size: 11px; }

.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.form-error { padding: 10px 12px; border-radius: 10px; background: var(--red-bg); color: var(--red-ink); font-size: 12.5px; }

/* ---------- Búsqueda global ------------------------------------------------------ */

.search-dialog {
  width: min(640px, calc(100% - 24px));
  margin-top: 8vh;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 26px 84px rgb(0 0 0 / 35%);
}

.global-search-box { display: flex; align-items: center; gap: 9px; padding: 6px 8px 11px; border-bottom: 1px solid var(--line); border-radius: 8px; }
.global-search-box:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.global-search-box input { flex: 1; border: 0; outline: none; background: transparent; font-size: 17px; }
.global-search-box button { border: 0; background: transparent; font-size: 19px; }
.search-results { max-height: 55vh; max-height: 55dvh; padding-top: 6px; overflow: auto; overscroll-behavior: contain; }
.search-result { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 10px; align-items: center; width: 100%; min-height: 44px; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; text-align: left; }
.search-result:hover, .search-result.is-selected { background: var(--surface-2); }
.search-result small { color: var(--muted); font-size: 9.5px; font-weight: 800; text-transform: uppercase; }
.search-result strong { overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Avisos, carga y vacíos ------------------------------------------------ */

.toast {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  max-width: 380px;
  padding: 12px 15px;
  border-radius: 11px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow);
  font-size: 12.5px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .18s, transform .18s;
}

.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: var(--red-ink); color: #fff; }

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: var(--bg);
  transition: opacity .22s;
}

.loading-screen img { width: 50px; animation: pulse 1.2s infinite alternate; }
.loading-screen p { color: var(--muted); font-size: 12px; }
.loading-screen.is-hidden { opacity: 0; pointer-events: none; }
.loading-screen.is-hidden img { animation: none; } /* detener el compositor al ocultar */
@keyframes pulse { to { transform: translateY(-4px) rotate(-2deg); } }

.empty-state {
  padding: 30px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.empty-state strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 13.5px; }

/* ---------- Login -------------------------------------------------------------------- */

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #16211b; /* fondo de marca, fijo en ambos temas */
}

.login-card {
  width: min(400px, 100%);
  padding: 34px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 32px 90px rgb(0 0 0 / 30%);
}

.login-logo { width: 52px; height: 52px; margin-bottom: 22px; border-radius: 13px; }
.login-card h1 { font-size: 30px; }
.login-copy { margin: 9px 0 24px; color: var(--muted); font-size: 13px; }
.login-form { display: grid; gap: 14px; }
.login-form label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.login-form input {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  background: var(--bg);
}
.login-form input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.login-form .primary-button { margin-top: 4px; }
.login-page .form-error { margin: 0 0 14px; }

/* Ver la contraseña mientras se teclea. El botón va dentro del campo, con
   altura suficiente para el pulgar (44 px es el mínimo recomendado). */
.password-field { position: relative; display: block; }
.password-field input { width: 100%; padding-right: 84px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.password-toggle:hover { color: var(--ink); background: var(--surface-2); }
.password-toggle:focus-visible {
  outline: none;
  color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent);
}

/* ---------- Entrevista asíncrona ------------------------------------------- */

.interview-focus-bar { display: none; }

.interview-total {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 750;
  white-space: nowrap;
}

.interview-honesty {
  margin-bottom: 18px;
  padding: 13px 15px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 13px;
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  font-size: 12.5px;
  line-height: 1.55;
}

.interview-honesty strong { color: var(--accent-ink); }

.interview-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.interview-sidebar { display: grid; gap: 12px; }

.interview-note-card {
  position: sticky;
  top: calc(var(--topbar-h) + 14px);
  z-index: 3;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.interview-note-card label { display: grid; gap: 3px; margin-bottom: 9px; }
.interview-note-card label strong { font-size: 13px; }
.interview-note-card label span { color: var(--muted); font-size: 10.5px; }

.interview-note-card textarea,
.interview-round-note textarea,
.interview-answer,
.interview-ranking select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  background: var(--bg);
  color: var(--ink);
}

.interview-note-card textarea,
.interview-round-note textarea,
.interview-answer {
  min-height: 108px;
  padding: 11px 12px;
  resize: vertical;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
}

.interview-note-card textarea:focus,
.interview-round-note textarea:focus,
.interview-answer:focus,
.interview-ranking select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent);
}

.interview-rounds { display: grid; gap: 6px; }

.interview-round-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.interview-round-button span { display: grid; gap: 2px; min-width: 0; }
.interview-round-button small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.interview-round-button strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.interview-round-button em { color: var(--muted); font-size: 10px; font-style: normal; font-weight: 750; }
.interview-round-button:hover { border-color: var(--line-strong); }
.interview-round-button.is-active { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.interview-round-button.is-active small, .interview-round-button.is-active em { color: color-mix(in srgb, var(--bg) 68%, var(--accent)); }

.interview-stage { min-width: 0; }
.interview-round-heading { margin-bottom: 14px; }
.interview-round-heading h2 { font-size: 24px; }
.interview-round-heading > p:last-child { max-width: 760px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }

.interview-questions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.interview-question {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.interview-question-number { margin-bottom: 9px; color: var(--muted); font-size: 9.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.interview-question h3 { font-size: 16px; line-height: 1.4; }
.interview-question > p { min-height: 38px; margin: 5px 0 13px; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.interview-question .interview-answer { flex: 1; min-height: 144px; }

.interview-options { display: grid; gap: 6px; }
.interview-options label { display: flex; align-items: flex-start; gap: 9px; min-height: 40px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); font-size: 11.5px; line-height: 1.35; }
.interview-options input { flex: none; width: 18px; height: 18px; margin-top: 1px; accent-color: var(--ink); }

.interview-ranking { display: grid; gap: 7px; }
.interview-ranking label { display: grid; grid-template-columns: 25px minmax(0, 1fr); align-items: center; gap: 7px; }
.interview-ranking label > span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 10px; font-weight: 800; }
.interview-ranking select { min-height: 44px; padding: 8px 28px 8px 9px; font-size: 16px; }

.interview-scale { display: flex; gap: 8px; }
.interview-scale label { flex: 1; }
.interview-scale input { position: absolute; opacity: 0; }
.interview-scale span { display: grid; place-items: center; min-height: 44px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); font-weight: 800; }
.interview-scale input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--bg); }

.interview-answer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); }
.interview-answer-actions .secondary-button { min-height: 38px; padding: 7px 10px; font-size: 10.5px; }
.interview-answer-actions .text-button { min-height: 38px; padding: 7px 8px; font-size: 10.5px; }
.interview-answer-actions button.is-active { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.interview-save-state { margin-left: auto; color: var(--muted); font-size: 9.5px; white-space: nowrap; }
.interview-save-state.is-error { color: var(--red-ink); font-weight: 750; }

.interview-round-complete { grid-column: 1 / -1; display: grid; gap: 2px; padding: 13px 15px; border-radius: 12px; background: var(--green-bg); color: var(--green-ink); }
.interview-round-complete strong { font-size: 12.5px; }
.interview-round-complete span { font-size: 11px; }
.interview-round-note {
  grid-column: 1 / -1;
  display: grid;
  gap: 9px;
  padding: 17px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 15px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  box-shadow: var(--shadow);
}
.interview-round-note label { display: grid; gap: 3px; }
.interview-round-note label strong { font-size: 14px; }
.interview-round-note label span { color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.interview-round-note textarea { min-height: 118px; }
.interview-round-note .interview-save-state { justify-self: end; }
.interview-mobile-nav { display: none; }

body.interview-focus-only .topbar,
body.interview-focus-only .primary-nav { display: none; }
body.interview-focus-only .app-shell { display: block; }
body.interview-focus-only main { min-height: 100vh; min-height: 100dvh; padding-top: 20px; }
body.interview-focus-only .view:not(.interview-view) { display: none; }
body.interview-focus-only .interview-focus-bar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 28px; }
.interview-focus-brand { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.interview-focus-brand img { border-radius: 9px; }
body.interview-focus-only .interview-note-card { top: 14px; }

/* ---------- Estado de Lumina -----------------------------------------------------------
   Vista densa pero comprobable: cada bloque conserva fuente, cobertura y
   estado textual además del color. */

.lumina-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.lumina-block {
  min-width: 0;
  padding: clamp(15px, 2.2vw, 22px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.lumina-block-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.lumina-block-heading .eyebrow { margin: 0; }
.lumina-block-heading h2 { order: -1; }

.lumina-freshness {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.lumina-freshness.is-fresh { border-left-color: var(--green); background: var(--green-bg); }
.lumina-freshness.is-stale { border-left-color: var(--amber); background: var(--amber-bg); }
.lumina-freshness.is-unknown { border-left-color: var(--red); background: var(--red-bg); }

.lumina-freshness-copy { display: grid; gap: 3px; min-width: 0; }
.lumina-freshness-copy strong { font-size: 20px; letter-spacing: -.025em; }
.lumina-freshness-copy span { overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }

.lumina-cut-meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  margin: 0;
  font-size: 11px;
}

.lumina-cut-meta dt { color: var(--muted); }
.lumina-cut-meta dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.lumina-sources {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.lumina-source {
  display: grid;
  grid-template-columns: minmax(100px, .42fr) minmax(0, 1fr);
  gap: 2px 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.lumina-source strong { overflow-wrap: anywhere; font-size: 12px; }
.lumina-source code { min-width: 0; overflow-wrap: anywhere; word-break: break-all; color: var(--muted); font-size: 10px; }
.lumina-source span, .lumina-source small { grid-column: 1 / -1; color: var(--muted); font-size: 10.5px; }

.lumina-cut-label, .lumina-coverage {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.lumina-summary-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 19px;
}

.lumina-summary-list li { padding-left: 4px; }

.lumina-ladder { display: grid; gap: 8px; }

.lumina-hito {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
}

.lumina-hito header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.lumina-hito header > div:first-child { display: flex; gap: 9px; min-width: 0; }
.lumina-hito header strong { color: var(--accent-ink); }
.lumina-hito header span { font-weight: 750; }
.lumina-hito p { margin: 7px 0; color: var(--muted); font-size: 12px; }
.lumina-hito small { display: block; margin-top: 7px; color: var(--muted); font-size: 10.5px; }

.lumina-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.lumina-badge, .lumina-status-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--slate-bg);
  color: var(--slate-ink);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.lumina-progress { height: 5px; overflow: hidden; border-radius: 999px; background: var(--line); }
.lumina-progress span { display: block; height: 100%; border-radius: inherit; background: var(--green); }

.lumina-clock-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.lumina-clock {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface-2);
}

.lumina-clock.is-ok { border-top-color: var(--green); }
.lumina-clock.is-late { border-top-color: var(--amber); }
.lumina-clock.is-failed { border-top-color: var(--red); }
.lumina-clock header { display: flex; align-items: start; justify-content: space-between; gap: 7px; }
.lumina-clock strong { overflow-wrap: anywhere; font-size: 12px; }
.lumina-clock p { margin: 8px 0; font-size: 11.5px; }
.lumina-clock small { display: block; color: var(--muted); font-size: 10.5px; }

.lumina-counts {
  display: flex;
  gap: 7px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.lumina-counts::-webkit-scrollbar { display: none; }
.lumina-counts > span {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: max-content;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.lumina-counts strong { font-size: 15px; }
.lumina-counts small { color: var(--muted); font-size: 10px; }

.lumina-execution-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.lumina-subpanel {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.lumina-subpanel h3 { margin-bottom: 9px; }
.lumina-execution-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.lumina-execution-row:first-of-type { border-top: 0; }
.lumina-execution-row strong { overflow-wrap: anywhere; font-size: 11.5px; }
.lumina-execution-row small { grid-column: 1 / -1; color: var(--muted); font-size: 10.5px; }
.lumina-empty-copy { margin: 8px 0 0; color: var(--muted); font-size: 11.5px; }

.lumina-supervisor {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 9px;
  align-items: center;
  margin-top: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
}
.lumina-supervisor small { grid-column: 2; color: var(--muted); font-size: 10.5px; }

.lumina-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.lumina-chart {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
}
.lumina-chart h3 { text-transform: capitalize; }
.lumina-chart svg { display: block; width: 100%; height: 116px; margin-top: 7px; }
.lumina-chart-axis { stroke: var(--line-strong); stroke-width: 1; }
.lumina-chart-legend { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 10px; }
.lumina-chart-legend span::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--series-color);
}
.lumina-chart-window { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }

.lumina-warnings {
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--line));
  border-radius: var(--radius);
  background: var(--amber-bg);
  color: var(--amber-ink);
}
.lumina-warnings ul { margin: 8px 0 0; padding-left: 18px; }
.lumina-warnings li { margin-top: 4px; font-size: 11.5px; }

/* ---------- Centro de mando de proyecto (Fases 0 y 1) ---------------------
   Vista SPA propia, sin añadir una novena entrada a la navegación móvil. La
   semántica viene del read model: ciclo, fase, salud y métricas no se mezclan;
   memoria, señales y borradores conservan estado y procedencia explícitos. */

.cockpit-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.cockpit-model-meta {
  min-width: 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  overflow-wrap: anywhere;
  text-align: right;
}

.cockpit-state {
  display: grid;
  justify-items: start;
  gap: 7px;
  max-width: 620px;
  color: var(--muted);
  font-size: 13px;
}

.cockpit-state strong { color: var(--ink); font-size: 16px; }
.cockpit-state.is-error { border-color: color-mix(in srgb, var(--red) 52%, var(--line)); background: var(--red-bg); }
.cockpit-state.is-error strong, .cockpit-state.is-error > span { color: var(--red-ink); }
.cockpit-state .secondary-button { margin-top: 5px; }

.cockpit-header { margin-bottom: 14px; }
.cockpit-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.cockpit-heading > div:first-child { min-width: 0; }
.cockpit-actions { display: flex; flex: none; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.cockpit-jump-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 0 0 14px;
}
.cockpit-jump-nav a {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}
.cockpit-jump-nav a:hover { border-color: var(--line-strong); background: var(--surface-2); }
.cockpit-jump-nav a:focus-visible,
.cockpit-disclosure-summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 72%, transparent);
  outline-offset: 2px;
}

.cockpit-disclosure { min-width: 0; }
.cockpit-disclosure-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
}
.cockpit-disclosure-summary::-webkit-details-marker { display: none; }
.cockpit-disclosure-summary > span:first-child { display: grid; min-width: 0; gap: 2px; }
.cockpit-disclosure-summary strong { font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.cockpit-disclosure-summary small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.cockpit-disclosure-summary .eyebrow { margin: 0; font-size: 8.5px; }
.cockpit-disclosure-state {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
}
.cockpit-disclosure-state::before { content: "+"; font-size: 18px; line-height: 1; }
.cockpit-disclosure[open] > .cockpit-disclosure-summary .cockpit-disclosure-state::before { content: "−"; }
.cockpit-disclosure-body { min-width: 0; padding-top: 14px; }
.cockpit-disclosure[open] > .cockpit-disclosure-summary { border-bottom-color: var(--line); }
.cockpit-structure { margin-top: 14px; }

.cockpit-readings {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.cockpit-reading {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  min-height: 100px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
}

.cockpit-reading > small {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.cockpit-reading > strong { font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.cockpit-reading > .health { font-size: 14px; }
.cockpit-reading-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.cockpit-reading-reason { flex-basis: 100%; color: var(--ink); overflow-wrap: anywhere; }

.authority-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--slate-bg);
  color: var(--slate-ink);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1.25;
  text-transform: uppercase;
}

.authority-badge[data-authority="human_declaration"],
.authority-badge[data-authority="human_confirmed"],
.authority-badge[data-authority="human"] { background: var(--green-bg); color: var(--green-ink); }
.authority-badge[data-authority="legacy_unverified"],
.authority-badge[data-authority="legacy_project_status"],
.authority-badge[data-authority="legacy"] { background: var(--amber-bg); color: var(--amber-ink); }

.cockpit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr);
  align-items: start;
  gap: 14px;
}

.cockpit-main-column, .cockpit-side-column { display: grid; min-width: 0; gap: 14px; }
.cockpit-section { min-width: 0; }
.cockpit-section .empty-state { padding: 20px 12px; }

.cockpit-visit-control { display: grid; flex: none; justify-items: end; gap: 5px; text-align: right; }
.cockpit-visit-control > span { max-width: 260px; min-height: 15px; color: var(--muted); font-size: 10.5px; line-height: 1.35; overflow-wrap: anywhere; }
.cockpit-visit-control > span[data-state="confirmed"] { color: var(--green-ink); }
.cockpit-visit-control > span[data-state="error"] { color: var(--red-ink); }
.cockpit-visit-control .secondary-button { min-height: 44px; }

.dossier-essential-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dossier-secondary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cockpit-dossier-more { margin-top: 12px; padding: 0 2px; }
.cockpit-mobile-health { display: none; }

@media (min-width: 761px) {
  .cockpit-disclosure-summary { display: none; }
  .cockpit-disclosure-body { padding-top: 0; }
  .cockpit-structure { margin-top: 0; }
  .cockpit-dossier-more { padding: 0; }
}

.cockpit-fact {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.cockpit-fact h3 { margin-bottom: 7px; }
.cockpit-fact p { margin-bottom: 9px; color: var(--ink); font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }
.cockpit-fact small { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; color: var(--muted); font-size: 10.5px; line-height: 1.4; }
.cockpit-fact[data-tone="missing"], .cockpit-fact[data-tone="unavailable"] { border-style: dashed; }
.cockpit-fact[data-tone="legacy"] { border-color: color-mix(in srgb, var(--amber) 36%, var(--line)); }
.cockpit-fact[data-tone="attention"] { border-color: color-mix(in srgb, var(--amber) 50%, var(--line)); background: var(--amber-bg); }
.cockpit-fact[data-tone="confirmed"] { border-color: color-mix(in srgb, var(--green) 38%, var(--line)); }
.cockpit-fact[data-tone="clear"] { background: transparent; }

.cockpit-delta { align-content: start; }
.delta-event-list { display: grid; gap: 7px; margin: 3px 0 10px; padding: 0; list-style: none; }
.delta-event-list li { display: grid; gap: 1px; padding-left: 9px; border-left: 2px solid var(--blue); }
.delta-event-list strong { color: var(--ink); font-size: 11.5px; line-height: 1.4; overflow-wrap: anywhere; }
.delta-event-list small { color: var(--muted); font-size: 9.5px; }

.context-capsule { margin-top: 12px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 14px; }
.context-capsule.is-missing { border-style: dashed; }
.context-capsule > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.context-capsule > header > div { min-width: 0; }
.context-capsule > header h3 { overflow-wrap: anywhere; }
.capsule-meta { display: flex; flex: none; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px 8px; max-width: 58%; color: var(--muted); font-size: 9.5px; line-height: 1.35; text-align: right; }
.capsule-sections { display: grid; margin: 0; padding: 0; list-style: none; }
.capsule-sections li { display: grid; grid-template-columns: 27px minmax(0, 1fr); gap: 10px; min-width: 0; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.capsule-sections li:last-child { border-bottom: 0; }
.capsule-sections li > div { min-width: 0; }
.capsule-index { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--slate-bg); color: var(--slate-ink); font-size: 9px; font-weight: 900; }
.capsule-sections h4 { margin: 0 0 3px; font-size: 11.5px; }
.capsule-sections p { margin: 0; color: var(--ink); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.capsule-sections small { display: block; margin-top: 4px; color: var(--muted); font-size: 9.5px; overflow-wrap: anywhere; }

.memory-status, .memory-mine, .signal-severity {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--slate-bg);
  color: var(--slate-ink);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .035em;
  line-height: 1.25;
  text-transform: uppercase;
}
.memory-status[data-status="current"], .memory-status[data-status="confirmed"],
.memory-status[data-status="acknowledged"] { background: var(--green-bg); color: var(--green-ink); }
.memory-status[data-status="open"], .memory-status[data-status="active"],
.memory-status[data-status="pending"], .memory-status[data-status="stale"] { background: var(--amber-bg); color: var(--amber-ink); }
.memory-status[data-status="missing"], .memory-status[data-status="legacy"],
.memory-status[data-status="silenced"] { opacity: .78; }
.memory-mine { margin-left: 5px; background: var(--blue-bg); color: var(--blue-ink); }

.unblocking-groups { display: grid; gap: 16px; }
.cockpit-inline-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 13px; }
.memory-group { min-width: 0; }
.memory-group-heading, .draft-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.memory-group-heading h3, .draft-list-heading h3 { margin: 0; }
.memory-group-heading > span, .draft-list-heading > span { display: grid; place-items: center; min-width: 23px; height: 23px; padding: 0 6px; border-radius: 999px; background: var(--slate-bg); color: var(--slate-ink); font-size: 9px; font-weight: 800; }
.memory-card-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 8px; }
.memory-action-item { display: grid; align-content: start; gap: 7px; min-width: 0; }
.memory-card { display: grid; align-content: start; gap: 7px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.memory-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.memory-card-actions .primary-button, .memory-card-actions .secondary-button,
.cockpit-inline-actions .primary-button, .cockpit-inline-actions .secondary-button { padding: 7px 9px; font-size: 10.5px; }
.memory-card > header, .memory-card > header > div { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 5px 8px; }
.memory-card > header > small { color: var(--muted); font-size: 9.5px; overflow-wrap: anywhere; }
.memory-card h4 { margin: 0; font-size: 12.5px; line-height: 1.4; overflow-wrap: anywhere; }
.memory-card p { margin: 0; font-size: 11.5px; line-height: 1.45; overflow-wrap: anywhere; }
.memory-card footer { color: var(--muted); font-size: 9.5px; line-height: 1.4; }
.memory-card footer span { display: inline; }
.memory-card footer span + span::before { content: " · "; }
.memory-option-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.memory-option-list li { display: grid; gap: 1px; padding: 6px 8px; border-radius: 7px; background: var(--surface); }
.memory-option-list strong { font-size: 10.5px; overflow-wrap: anywhere; }
.memory-option-list small, .memory-muted { color: var(--muted); font-size: 9.5px; overflow-wrap: anywhere; }

.cockpit-capture { border-color: color-mix(in srgb, var(--blue) 36%, var(--line)); }
.draft-capture-state { max-width: 300px; color: var(--muted); font-size: 10.5px; line-height: 1.35; text-align: right; overflow-wrap: anywhere; }
.draft-capture-state[data-state="confirmed"] { color: var(--green-ink); }
.draft-capture-state[data-state="error"] { color: var(--red-ink); }
.draft-capture-state[data-state="pending"] { color: var(--blue-ink); }
.cockpit-draft-form { display: grid; gap: 10px; margin-bottom: 15px; }
.cockpit-draft-form label { display: grid; gap: 6px; font-size: 11.5px; font-weight: 800; }
.cockpit-draft-form textarea { width: 100%; min-height: 112px; padding: 11px 12px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); line-height: 1.45; }
.cockpit-draft-form textarea:focus { border-color: var(--focus); outline: 2px solid color-mix(in srgb, var(--focus) 20%, transparent); outline-offset: 1px; }
.cockpit-draft-submit { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.cockpit-draft-submit p { max-width: 610px; margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.cockpit-draft-submit .primary-button { flex: none; min-height: 44px; }
.cockpit-drafts { min-width: 0; }
.draft-list { display: grid; gap: 8px; padding-top: 13px; border-top: 1px solid var(--line); }
.draft-card { display: grid; gap: 7px; min-width: 0; padding: 11px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface-2); }
.draft-card > header, .draft-card > footer { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 5px 10px; }
.draft-card > header small, .draft-card > footer { color: var(--muted); font-size: 9.5px; }
.draft-card p { margin: 0; font-size: 11.5px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.draft-card > footer span:first-child { color: var(--green-ink); font-weight: 700; }

.draft-conflict-panel { display: grid; gap: 8px; grid-column: 1 / -1; padding: 12px; border: 1px solid color-mix(in srgb, var(--amber) 55%, var(--line)); border-radius: 11px; background: var(--amber-bg); color: var(--amber-ink); }
.draft-conflict-panel > p { margin: 0; font-size: 11px; line-height: 1.45; }
.draft-conflict-panel > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.draft-conflict-panel article { min-width: 0; padding: 8px; border-radius: 8px; background: rgb(255 255 255 / 42%); }
.draft-conflict-panel small { display: block; margin-bottom: 4px; font-weight: 800; text-transform: uppercase; }
.draft-conflict-panel article p { margin: 0; color: var(--ink); font-size: 10.5px; line-height: 1.4; overflow-wrap: anywhere; white-space: pre-wrap; }

.cockpit-honesty {
  margin-bottom: 10px;
  padding: 10px 11px;
  border-left: 3px solid var(--amber);
  border-radius: 8px;
  background: var(--amber-bg);
  color: var(--amber-ink);
  font-size: 11.5px;
}

.cockpit-metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.cockpit-metric { display: grid; gap: 5px; min-width: 0; padding: 11px; border-radius: 10px; background: var(--surface-2); }
.cockpit-metric small { color: var(--muted); font-size: 9.5px; font-weight: 800; text-transform: uppercase; }
.cockpit-metric strong { font-size: 12px; overflow-wrap: anywhere; }
.cockpit-metric[data-state="sin_plan"] strong { color: var(--amber-ink); }
.cockpit-source { margin: 10px 0 0; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }

.workstream-list, .cockpit-signal-list, .evidence-list { display: grid; gap: 7px; }
.workstream-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 9px; padding: 10px; border-radius: 11px; background: var(--surface-2); }
.workstream-row > div { display: grid; min-width: 0; gap: 2px; }
.workstream-row strong { font-size: 12.5px; overflow-wrap: anywhere; }
.workstream-row small { color: var(--muted); font-size: 10.5px; overflow-wrap: anywhere; }
.workstream-status { padding: 3px 6px; border-radius: 999px; background: var(--slate-bg); color: var(--slate-ink); font-size: 8.5px; font-weight: 800; text-transform: uppercase; }
.workstream-status[data-status="active"] { background: var(--green-bg); color: var(--green-ink); }
.workstream-status[data-status="waiting"] { background: var(--amber-bg); color: var(--amber-ink); }
.workstream-status[data-status="cancelled"] { opacity: .68; }

.cockpit-signal { display: grid; gap: 7px; min-width: 0; padding: 11px; border-left: 3px solid var(--blue); border-radius: 9px; background: var(--blue-bg); }
.cockpit-signal[data-severity="critical"], .cockpit-signal[data-severity="high"] { border-left-color: var(--red); background: var(--red-bg); }
.cockpit-signal[data-severity="warning"], .cockpit-signal[data-severity="medium"] { border-left-color: var(--amber); background: var(--amber-bg); }
.cockpit-signal > header, .evidence-card > header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 5px 8px; }
.cockpit-signal h4 { margin: 0; font-size: 12.5px; overflow-wrap: anywhere; }
.cockpit-signal > p { margin: 0; font-size: 11.5px; line-height: 1.45; overflow-wrap: anywhere; }
.signal-severity { background: rgb(255 255 255 / 34%); color: currentColor; }
.signal-action { padding: 7px 8px; border-radius: 7px; background: rgb(255 255 255 / 38%); }
.signal-evidence { display: grid; gap: 2px; padding-top: 7px; border-top: 1px solid color-mix(in srgb, currentColor 16%, transparent); }
.signal-evidence strong { font-size: 9.5px; text-transform: uppercase; }
.signal-evidence span { font-size: 10.5px; line-height: 1.4; overflow-wrap: anywhere; }
.signal-evidence small, .cockpit-signal footer { color: var(--muted); font-size: 9.5px; line-height: 1.4; overflow-wrap: anywhere; }
.cockpit-signal footer span + span::before, .evidence-card footer span + span::before { content: " · "; }

.evidence-card { display: grid; gap: 6px; min-width: 0; padding: 10px; border-radius: 9px; background: var(--surface-2); }
.evidence-card > header small { color: var(--muted); font-size: 9.5px; }
.evidence-card p { margin: 0; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.evidence-card footer { color: var(--muted); font-size: 9px; line-height: 1.4; overflow-wrap: anywhere; }

.capability-list { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; }
.capability-list li { display: grid; gap: 1px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.capability-list li:last-child { border-bottom: 0; }
.capability-list strong { font-size: 11.5px; }
.capability-list code { color: var(--muted); font-size: 9.5px; overflow-wrap: anywhere; }

.data-quality { display: grid; gap: 3px; margin-top: 12px; padding: 10px; border-radius: 10px; background: var(--green-bg); color: var(--green-ink); }
.data-quality[data-tone="warn"] { background: var(--amber-bg); color: var(--amber-ink); }
.data-quality strong { font-size: 11.5px; }
.data-quality span { font-size: 10px; overflow-wrap: anywhere; }

.cockpit-timeline { position: relative; display: grid; gap: 0; }
.cockpit-timeline-event { position: relative; display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 10px; min-width: 0; padding: 0 0 15px; }
.cockpit-timeline-event:not(:last-child)::before { content: ""; position: absolute; top: 11px; bottom: -1px; left: 5px; width: 1px; background: var(--line-strong); }
.timeline-event-marker { position: relative; z-index: 1; width: 11px; height: 11px; margin-top: 4px; border: 2px solid var(--surface); border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.timeline-event-copy { display: grid; min-width: 0; gap: 4px; }
.timeline-event-copy > div { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 6px 8px; }
.timeline-event-copy strong { font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; }
.timeline-event-copy small { color: var(--muted); font-size: 10.5px; overflow-wrap: anywhere; }
.cockpit-timeline-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 4px; color: var(--muted); font-size: 10.5px; }
.cockpit-inline-error { display: grid; justify-items: start; gap: 6px; padding: 13px; border-radius: 10px; background: var(--red-bg); color: var(--red-ink); font-size: 11.5px; }
.cockpit-inline-error .secondary-button { margin-top: 2px; }

/* ---------- Tablet ---------------------------------------------------------------------- */

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 72px minmax(0, 1fr); }
  .primary-nav { padding-inline: 8px; }
  .nav-item { justify-content: center; padding: 12px 8px; }
  .nav-label { display: none; }
  .nav-icon { width: auto; font-size: 18px; }
  .contacts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-row { grid-template-columns: 140px minmax(0, 1.6fr) 100px 96px minmax(110px, .7fr) 110px; gap: 10px; }
  .budget-row { grid-template-columns: 88px minmax(0, 1fr) 110px 100px; }
  .budget-row .budget-cell:nth-of-type(4), .budget-row .budget-cell:nth-of-type(5) { display: none; }
  .subscription-row { grid-template-columns: minmax(180px, 1fr) 145px 125px minmax(140px, auto); }
  .subscription-row .is-payer { display: none; }
  /* Cabecera estrecha: los selects de ámbito se reparten el hueco */
  .scope-select { max-width: 175px; }
  .interview-questions { grid-template-columns: 1fr; }
  .cockpit-layout { grid-template-columns: 1fr; }
  .cockpit-side-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lumina-clock-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Móvil (iPhone) ----------------------------------------------------------------
   No es el escritorio encogido: navegación inferior al pulgar, objetivos
   táctiles ≥ 44 px, cajón a pantalla casi completa, sin scroll horizontal. */

@media (max-width: 760px) {
  .app-shell { display: block; padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }

  .topbar {
    min-height: 56px;
    padding: 6px max(12px, env(safe-area-inset-right, 0px)) 6px max(12px, env(safe-area-inset-left, 0px));
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .brand { min-height: 44px; }
  .brand img { width: 32px; height: 32px; }
  .brand small, .search-trigger-label, .search-trigger kbd, .user-chip { display: none; }
  .search-trigger { min-width: 44px; width: 44px; height: 44px; justify-content: center; padding: 0; }
  .icon-button, .dialog-close, .drawer-close { width: 44px; height: 44px; }

  /* El ámbito baja a una segunda fila de la cabecera, a ancho completo.
     min-width: 0 es la clave: sin él, el <select> no encoge por debajo de
     su opción más larga y los dos selects se solapan (medido a 388 px). */
  .topbar-scope { order: 3; flex-basis: 100%; justify-content: stretch; }
  .scope-field { flex: 1 1 0; min-width: 0; }
  .scope-field .scope-select { flex: 1 1 0; min-width: 0; max-width: none; min-height: 44px; padding-right: 23px; font-size: 16px; }
  .scope-reset { flex: none; width: 44px; min-width: 44px; min-height: 44px; padding: 0; font-size: 0; }
  .scope-reset::after { content: "×"; font-size: 17px; }

  .primary-nav {
    position: fixed;
    top: auto;
    right: max(10px, env(safe-area-inset-right, 0px));
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    left: max(10px, env(safe-area-inset-left, 0px));
    z-index: 40;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(44px, 1fr);
    height: 58px;
    padding: 5px;
    border: 1px solid rgb(255 255 255 / 12%);
    border-radius: 16px;
    background: rgb(22 28 24 / 96%); /* barra oscura de marca en ambos temas */
    box-shadow: 0 14px 36px rgb(0 0 0 / 30%);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }
  .primary-nav::-webkit-scrollbar { display: none; }

  .nav-item { flex-direction: column; gap: 3px; min-width: 48px; margin: 0; padding: 7px 4px; color: #9aa79d; font-size: 9px; scroll-snap-align: center; }
  .nav-item .nav-label-full { display: none; }
  .nav-item .nav-label-mobile { display: block; }
  .nav-label { display: block; font-weight: 700; }
  .nav-icon { font-size: 16px; color: inherit; }
  .nav-item:hover { background: transparent; }
  .nav-item.is-active { background: rgb(255 255 255 / 13%); color: #eef2ee; }

  main { padding: 22px max(13px, env(safe-area-inset-right, 0px)) 30px max(13px, env(safe-area-inset-left, 0px)); }
  .view-heading { align-items: flex-start; margin-bottom: 18px; }
  .view-heading h1 { font-size: 28px; }
  .view-heading > .primary-button { min-height: 44px; padding: 9px 12px; font-size: 12.5px; }
  .button-row { align-items: flex-end; flex-direction: column-reverse; gap: 6px; }
  .button-row button { min-height: 44px; padding: 8px 10px; font-size: 11.5px; }

  .cockpit-toolbar { align-items: flex-start; }
  .cockpit-back { min-height: 44px; }
  .cockpit-model-meta { padding-top: 5px; font-size: 8.5px; }
  .cockpit-header { padding: 14px; }
  .cockpit-heading { display: grid; gap: 14px; }
  .cockpit-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .cockpit-actions button { min-height: 44px; white-space: normal; }
  .cockpit-jump-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 9px; }
  .cockpit-jump-nav a { padding-inline: 7px; font-size: 10px; }
  .cockpit-structure { margin-top: 10px; padding-top: 2px; border-top: 1px solid var(--line); }
  .cockpit-readings { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 15px; }
  .cockpit-reading { min-height: 108px; padding: 11px; }
  .cockpit-layout, .cockpit-main-column, .cockpit-side-column { gap: 9px; }
  .cockpit-side-column { grid-template-columns: 1fr; }
  .cockpit-view button { min-height: 44px; }
  .cockpit-disclosure-summary { min-height: 48px; }
  .cockpit-disclosure-body { padding-top: 11px; }
  .cockpit-disclosure:not([open]) { padding-block: 8px; }
  .cockpit-dossier-more { padding: 8px 0 0; border-top: 1px solid var(--line); }
  .cockpit-mobile-health { display: block; }
  #cockpitDossierTitle, #cockpitUnblockingTitle, #cockpitTimelineTitle,
  #cockpitProgressTitle { scroll-margin-top: 12px; }
  .cockpit-main-column .panel-heading { align-items: flex-start; flex-wrap: wrap; }
  .cockpit-visit-control { width: 100%; justify-items: stretch; text-align: left; }
  .cockpit-visit-control > span { max-width: none; }
  .cockpit-visit-control .secondary-button { width: 100%; }
  .dossier-essential-grid, .dossier-secondary-grid { grid-template-columns: 1fr; }
  .context-capsule > header { display: grid; gap: 9px; }
  .capsule-meta { justify-content: flex-start; max-width: none; text-align: left; }
  .capsule-sections li { padding-inline: 11px; }
  .cockpit-capture { padding-inline: 14px; }
  .draft-capture-state { max-width: none; text-align: left; }
  .cockpit-draft-submit { align-items: stretch; flex-direction: column; }
  .cockpit-draft-submit .primary-button { width: 100%; }
  .memory-card-list { grid-template-columns: 1fr; }
  .cockpit-inline-actions, .memory-card-actions { display: grid; grid-template-columns: 1fr; }
  .draft-conflict-panel > div { grid-template-columns: 1fr; }
  .cockpit-metric-grid { grid-template-columns: 1fr; }
  .cockpit-timeline-controls { align-items: stretch; flex-direction: column; }
  .cockpit-timeline-controls .secondary-button { align-self: stretch; min-height: 44px; }

  .dashboard-grid { grid-template-columns: 1fr; }
  .lumina-block-heading { display: block; }
  .lumina-block-heading .eyebrow { margin: 5px 0 0; }
  .lumina-freshness { grid-template-columns: 1fr; }
  .lumina-cut-meta { grid-template-columns: auto minmax(0, 1fr); }
  .lumina-sources, .lumina-clock-grid, .lumina-execution-grid, .lumina-chart-grid { grid-template-columns: 1fr; }
  .lumina-hito header { display: block; }
  .lumina-badges { justify-content: flex-start; margin-top: 8px; }
  .lumina-supervisor { grid-template-columns: auto minmax(0, 1fr); }

  .project-table { border: 0; background: transparent; overflow: visible; }
  .project-row-head { display: none; }
  .project-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name flag"
      "meta meta"
      "next next";
    gap: 8px 12px;
    margin-bottom: 8px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }
  .project-row .attention-flag { grid-area: flag; align-self: start; max-width: 132px; }
  .project-row .project-name { grid-area: name; align-self: center; }
  .project-row .project-name strong { white-space: normal; }
  .project-row .project-mobile-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
  .project-row .project-next { grid-area: next; }
  .project-row > .phase-chip, .project-row > .health, .project-row > .progress { display: none; }

  .filterbar select { flex: 1; max-width: none; min-width: 120px; min-height: 44px; }
  .search-field { flex-basis: 100%; min-height: 44px; }

  .agenda-layout { display: block; }
  .agenda-aside { position: static; margin-top: 12px; }
  .timeline-item { grid-template-columns: 64px 6px minmax(0, 1fr); gap: 9px; padding: 11px 12px; }
  .timeline-item > .badge { display: none; }
  .timeline-marker { height: 36px; }

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

  .budget-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "number amount" "title title" "meta meta";
    gap: 8px 12px;
    padding: 13px 14px;
  }
  .budget-number { grid-area: number; }
  .budget-title { grid-area: title; }
  .budget-amount { grid-area: amount; align-self: start; }
  .budget-row .budget-cell { display: none; }
  .budget-row .budget-cell.is-status { display: block; grid-area: meta; }

  .subscription-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "provider amount" "status renewal" "payer payer";
    gap: 9px 12px;
    padding: 13px 14px;
  }
  .subscription-provider { grid-area: provider; }
  .subscription-provider strong, .subscription-provider small { white-space: normal; }
  .subscription-row .is-status { grid-area: status; }
  .subscription-row .is-renewal { grid-area: renewal; text-align: right; }
  .subscription-row .is-payer { display: grid; grid-area: payer; }
  .subscription-amount { grid-area: amount; align-self: start; }
  .subscription-history-row { grid-template-columns: 1fr; }

  #subscriptionSummary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }
  #subscriptionSummary .stat-chip {
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    padding: 8px 10px;
    border-radius: 12px;
    white-space: normal;
  }
  #subscriptionSummary .stat-chip strong,
  #subscriptionSummary .stat-chip span { overflow-wrap: anywhere; }

  .subscription-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .subscription-filters .search-field { min-width: 0; }
  .subscription-filter-toggle {
    display: block;
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font-size: 12px;
    font-weight: 750;
  }
  .subscription-filter-options {
    display: none;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .subscription-filter-options.is-open { display: grid; }
  .subscription-filter-options select { min-width: 0; width: 100%; }
  .subscription-history-row > .text-button { justify-self: start; min-height: 44px; }

  .detail-drawer {
    width: 100%; /* 100vw desborda en Safari iOS: no descuenta barras ni safe areas */
    max-width: 100%;
    border-left: 0;
    padding: 14px max(18px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  }
  .drawer-hero h1 { font-size: 24px; }

  .form-grid { grid-template-columns: 1fr; }
  .form-span-2, .checkbox-label { grid-column: auto; }
  .editor-dialog { width: 100%; max-width: 100%; max-height: 100vh; max-height: 100dvh; border-radius: 0; }
  .editor-dialog form { padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }

  .toast { right: 12px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); left: 12px; max-width: none; }

  /* Enlaces de navegación entre paneles: mínimo táctil de 44 px */
  .panel-heading .text-button { min-height: 44px; padding: 10px 8px; }

  /* Títulos largos (p. ej. ingestas de reuniones): dos líneas antes de truncar */
  .row-copy strong, .timeline-copy strong {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}

/* ---------- Movimiento reducido ------------------------------------------------------------- */

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

/* ---------- Archivo (unidades compartidas) ------------------------------- */
.archive-list { display: grid; gap: 8px; }
.archive-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.3fr) minmax(220px, 1.6fr) 120px minmax(96px, .7fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-1);
}
.archive-name { display: grid; gap: 2px; min-width: 0; }
.archive-name strong { font-size: 13.5px; overflow-wrap: anywhere; }
.archive-name small { color: var(--muted); font-size: 11px; }
.archive-cell { display: grid; gap: 2px; }
.archive-cell strong { font-size: 13px; }
.archive-cell small { color: var(--muted); font-size: 10.5px; }
.badge[data-status="lleno"], .badge[data-status="casi_lleno"] { background: var(--red-bg); color: var(--red-ink); }
.badge[data-status="poco_margen"] { background: var(--amber-bg); color: var(--amber-ink); }
.badge[data-status="libre"] { background: var(--green-bg); color: var(--green-ink); }
.badge[data-status="sin_datos"] { opacity: .65; }
@media (max-width: 760px) {
  .archive-row { grid-template-columns: 1fr; gap: 8px; }
  .archive-row > .archive-cell, .archive-row > .text-button { justify-self: start; }
}

/* ---------- Awareness Archivado dentro de Backup ------------------------ */

.archive-panel-switch {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
}

.archive-panel-button {
  min-height: 42px;
  padding: 8px 14px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.archive-panel-button.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 2px 10px rgb(28 38 32 / 8%);
}

.archive-context {
  max-width: 870px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Evolución Backup: proyectos, incorporaciones y estudio ------ */
.backup-panel-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-1);
  font-size: 13px;
}
.backup-strip-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.backup-strip-dot.is-ok { background: var(--green-ink, #2c7a3f); }
.backup-strip-dot.is-warn { background: var(--amber-ink, #9a6a00); }
.backup-strip-dot.is-off { background: var(--muted); }
.coverage-note { color: var(--muted); font-size: 10.5px; }
.muted { color: var(--muted); font-size: 12.5px; }
.backup-actions { display: grid; gap: 6px; justify-items: start; }
.backup-note {
  max-width: 870px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.backup-project-row { grid-template-columns: minmax(190px, 1.4fr) repeat(3, minmax(130px, 1fr)) auto; }
.backup-live-summary { overflow-wrap: anywhere; font-size: 14px; }
.backup-live-source { color: var(--muted); font-size: 12px; }
.backup-live-axes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.backup-live-axes > div { padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.backup-live-axes small, .backup-live-axes strong { display: block; }
.backup-live-axes small { color: var(--muted); margin-bottom: 6px; }
@media (max-width: 760px) { .backup-live-axes { grid-template-columns: 1fr; gap: 8px; } }
.compare-field { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.compare-field select { min-width: 220px; font-size: 14px; }
.compare-result { margin-top: 8px; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.compare-table caption { text-align: left; color: var(--muted); font-size: 12px; padding-bottom: 8px; }
.compare-table th, .compare-table td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}
.compare-table thead th { background: var(--surface-2); }
.compare-table td strong, .compare-table th strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.compare-table small { display: block; color: var(--muted); font-size: 11px; }
.compare-facts { display: grid; gap: 8px; margin: 14px 0 0; }
.compare-facts > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-1);
}
.compare-facts dt { color: var(--muted); font-size: 12.5px; }
.compare-facts dd { margin: 0; font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.compare-verdict {
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.compare-verdict strong { font-size: 14px; }
.compare-verdict p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
@media (max-width: 760px) {
  .backup-project-row { grid-template-columns: 1fr; }
  .compare-field select { min-width: 0; width: 100%; }
  .compare-table thead { display: none; }
  .compare-table caption { display: block; width: 100%; }
  .compare-table td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
  .compare-table, .compare-table tbody, .compare-table tr, .compare-table td, .compare-table th { display: block; width: 100%; }
  .compare-table tr { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  .compare-table td, .compare-table th { border: 0; border-bottom: 1px solid var(--line); }
}

.awareness-archive { display: grid; gap: 14px; }

.awareness-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: #f4fbf7;
  background:
    radial-gradient(circle at 86% 22%, rgb(78 117 255 / 24%), transparent 24rem),
    linear-gradient(132deg, #173128, #1f4c40 72%, #1d5f54);
  box-shadow: var(--shadow);
}

.awareness-heading .eyebrow { color: #a9e6c9; }
.awareness-heading h2 { margin: 3px 0 5px; font-size: clamp(25px, 4vw, 38px); }
.awareness-updated { margin: 0; color: #cfdfd7; font-size: 12px; }
.awareness-heading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.awareness-state {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--slate-ink);
  background: var(--slate-bg);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.awareness-state[data-state="in_progress"] { color: var(--blue-ink); background: var(--blue-bg); }
.awareness-state[data-state="attention"] { color: var(--amber-ink); background: var(--amber-bg); }
.awareness-state[data-state="blocked"] { color: var(--red-ink); background: var(--red-bg); }
.awareness-state[data-state="complete"] { color: var(--green-ink); background: var(--green-bg); }

.awareness-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.awareness-stat {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.awareness-stat strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: clamp(22px, 3vw, 31px);
  line-height: 1;
}

.awareness-stat span { display: block; margin-top: 6px; color: var(--muted); font-size: 10.5px; }

.awareness-attention,
.awareness-focus {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--amber);
  border-radius: 13px;
  background: var(--amber-bg);
}

.awareness-attention[data-level="none"] { border-left-color: var(--green); background: var(--green-bg); }
.awareness-attention[data-level="action_required"],
.awareness-attention[data-level="decision_pending"] { border-left-color: var(--amber); }
.awareness-attention strong { display: block; color: var(--amber-ink); }
.awareness-attention p { margin: 4px 0 0; color: var(--ink); font-size: 12.5px; }

.awareness-focus { border-left-color: var(--blue); background: var(--blue-bg); }
.awareness-focus h3 { margin: 2px 0 4px; }
.awareness-focus p:last-child { margin: 0; color: var(--blue-ink); }

.awareness-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.awareness-map-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--muted);
  border-radius: 14px;
  background: var(--surface);
}

.awareness-map-card.is-done { border-top-color: var(--green); }
.awareness-map-card.is-pending { border-top-color: var(--amber); }
.awareness-map-card.is-analysis { border-top-color: var(--blue); }
.awareness-map-card h3 { margin: 2px 0 10px; }
.awareness-map-card ul { display: grid; gap: 8px; margin: 0; padding-left: 18px; }
.awareness-map-card li { color: var(--muted); font-size: 12px; }

.awareness-disclosure {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.awareness-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.awareness-disclosure > summary::-webkit-details-marker { display: none; }
.awareness-disclosure > summary::after { content: "+"; color: var(--green); font-size: 20px; }
.awareness-disclosure[open] > summary::after { content: "−"; }
.awareness-disclosure > summary span:last-of-type {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.awareness-disclosure > .filterbar,
.awareness-disclosure > .awareness-task-groups,
.awareness-disclosure > .awareness-software-grid,
.awareness-disclosure > .awareness-sequences,
.awareness-disclosure > .awareness-evidence,
.awareness-disclosure > .awareness-update-policy,
.awareness-disclosure > .awareness-source,
.awareness-disclosure > .awareness-explanation {
  margin-right: 14px;
  margin-left: 14px;
}

.awareness-explanation { margin-top: 0; color: var(--muted); font-size: 12px; }
.awareness-task-groups { display: grid; gap: 8px; margin-bottom: 14px; }

.awareness-task-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
}

.awareness-task-group > summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.awareness-task-group > summary span:last-child { color: var(--muted); font-weight: 650; }

.awareness-task {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.awareness-task input,
.awareness-sequence input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  opacity: 1;
  accent-color: var(--green);
}

.awareness-task-copy { min-width: 0; }
.awareness-task-id { color: var(--muted); font-size: 9.5px; font-weight: 850; }
.awareness-task-title { font-size: 12.5px; font-weight: 780; }
.awareness-task p { margin: 3px 0 0; color: var(--muted); font-size: 11.5px; }
.awareness-task[data-state="ok"] .awareness-task-title {
  color: var(--muted);
  text-decoration: line-through;
}

.awareness-task-state {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--slate-ink);
  background: var(--slate-bg);
  font-size: 9px;
  font-weight: 850;
  white-space: nowrap;
  text-transform: uppercase;
}

.awareness-task-state[data-state="ok"] { color: var(--green-ink); background: var(--green-bg); }
.awareness-task-state[data-state="progress"] { color: var(--blue-ink); background: var(--blue-bg); }
.awareness-task-state[data-state="decision"] { color: var(--amber-ink); background: var(--amber-bg); }
.awareness-task-state[data-state="blocked"] { color: var(--red-ink); background: var(--red-bg); }

.awareness-software-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.awareness-software-card,
.awareness-evidence-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
}

.awareness-software-card strong,
.awareness-evidence-card strong { display: block; font-size: 12px; }
.awareness-software-card code { display: block; margin-top: 3px; color: var(--blue-ink); font-size: 10.5px; }
.awareness-software-card p,
.awareness-evidence-card span { margin: 5px 0 0; color: var(--muted); font-size: 11px; }

.awareness-sequences { display: grid; gap: 6px; margin-bottom: 14px; }
.awareness-sequence {
  display: grid;
  grid-template-columns: 25px 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
}

.awareness-sequence-priority { color: var(--muted); font-size: 10px; }
.awareness-sequence-copy { min-width: 0; }
.awareness-sequence-copy strong { display: block; font-size: 12.5px; }
.awareness-sequence-copy span { color: var(--muted); font-size: 10.5px; }
.awareness-sequence-metrics { text-align: right; }
.awareness-sequence-metrics strong { display: block; font-size: 11px; }
.awareness-sequence-metrics span { color: var(--muted); font-size: 10px; }
.awareness-sequence[data-state="ok"] .awareness-sequence-copy strong {
  color: var(--muted);
  text-decoration: line-through;
}

.awareness-evidence {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.awareness-update-policy,
.awareness-source { color: var(--muted); font-size: 11px; }
.awareness-source { margin-bottom: 14px; overflow-wrap: anywhere; }

@media (max-width: 920px) {
  .awareness-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .awareness-map,
  .awareness-software-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .archive-panel-switch { display: flex; flex-wrap: wrap; width: 100%; }
  .archive-panel-button { flex: 1 1 auto; min-height: 44px; padding: 8px; }
  .awareness-heading { display: grid; padding: 17px; }
  .awareness-heading-actions { justify-content: flex-start; }
  .awareness-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .awareness-task { grid-template-columns: 23px minmax(0, 1fr); }
  .awareness-task-state { grid-column: 2; width: max-content; }
  .awareness-sequence { grid-template-columns: 23px 38px minmax(0, 1fr); }
  .awareness-sequence-metrics { grid-column: 3; text-align: left; }
  .awareness-evidence { grid-template-columns: 1fr; }
}

/* ---------- Ubicaciones de trabajo y copia en Drive ----------------------- */

.location-list { display: grid; gap: 6px; }

.location-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--surface-2);
}
.location-row:hover { border-color: var(--line-strong); background: var(--surface); }

.location-copy { display: grid; gap: 3px; min-width: 0; }
.location-copy strong { font-size: 12.5px; }
.location-copy small { color: var(--muted); font-size: 11px; }

.location-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.location-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px; }

.location-drive {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 11px;
  background: var(--surface-2);
}
.location-drive-status { font-size: 12.5px; font-weight: 700; }
.location-muted { color: var(--muted); font-size: 12.5px; }

@media (max-width: 560px) {
  .location-row { grid-template-columns: minmax(0, 1fr); }
  .location-actions { justify-content: flex-start; }
}

@media (max-width: 760px) {
  .interview-heading { align-items: flex-start; }
  .interview-heading .interview-total { margin-top: 2px; }
  .interview-honesty { font-size: 11.5px; }
  .interview-layout { display: block; }
  .interview-note-card { position: static; margin-bottom: 10px; }
  .interview-note-card textarea { min-height: 82px; }
  .interview-rounds {
    display: flex;
    gap: 7px;
    margin: 0 -13px 17px;
    padding: 0 13px 6px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }
  .interview-round-button { flex: 0 0 178px; scroll-snap-align: start; }
  .interview-round-heading h2 { font-size: 22px; }
  .interview-view { padding-bottom: 72px; }
  .interview-questions { display: block; }
  .interview-question { display: none; min-height: calc(100dvh - 255px); padding: 16px; }
  .interview-question.is-mobile-active { display: flex; }
  .interview-round-note { display: none; margin-top: 10px; padding: 16px; }
  .interview-round-note.is-mobile-active { display: grid; }
  .interview-round-note textarea { min-height: 150px; }
  .interview-question > p { min-height: 0; }
  .interview-question .interview-answer { min-height: 190px; }
  .interview-options label { min-height: 44px; }
  .interview-answer-actions { align-items: stretch; }
  .interview-answer-actions .secondary-button { flex: 1 1 190px; min-height: 44px; }
  .interview-answer-actions .text-button { min-height: 44px; }
  .interview-save-state { flex-basis: 100%; margin-left: 0; text-align: right; }
  .interview-round-complete { margin-top: 10px; }
  .interview-mobile-nav {
    position: fixed;
    right: max(13px, env(safe-area-inset-right, 0px));
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    left: max(13px, env(safe-area-inset-left, 0px));
    z-index: 35;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }
  .interview-mobile-nav button { min-height: 44px; padding: 8px; font-size: 11px; }
  .interview-mobile-nav span { color: var(--muted); font-size: 10px; font-weight: 750; }
  body.interview-focus-only main { padding: 12px max(13px, env(safe-area-inset-right, 0px)) calc(22px + env(safe-area-inset-bottom, 0px)) max(13px, env(safe-area-inset-left, 0px)); }
  body.interview-focus-only .interview-focus-bar { margin-bottom: 20px; }
  body.interview-focus-only .interview-mobile-nav { bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
}

/* Enlace de descarga del calendario, apagado cuando no hay nada marcado */

.view-heading-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

#calendarExport { text-decoration: none; }
#calendarExport.is-disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Una espera sin fecha de revisión se marca como lo que es: un cabo suelto */
.row-date.is-unset { color: var(--muted); font-style: italic; opacity: .8; }

/* Enlace de vuelta en las pantallas de cuenta */
.login-back {
  display: inline-block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: none;
}
.login-back:hover { color: var(--ink); text-decoration: underline; }

a.user-chip { text-decoration: none; }
a.user-chip:hover { border-color: var(--line-strong); }
