/* ════════════════════════════════════════════════════════════════════
   editor.css — Editor de ficha clínica (F6) · LUZOcrm V2 / TRANSED ONG
   Portado del mockup aprobado (FC2 Preview · SmartView v5 · strip corregido).
   Tokens canónicos LUZOkit con fallbacks → hereda light/dark/midnight.
   Scope: .fce-* (Ficha Clínica Editor)
   ════════════════════════════════════════════════════════════════════ */

.fce-root { display: flex; flex-direction: column; min-height: 0; height: 100%; position: relative; }

/* paciente strip */
.fce-pac-strip {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; margin-bottom: 16px;
  background: var(--bg-surface, var(--bg-card)); border: 0.5px solid var(--border-soft, var(--border));
  border-radius: 10px;
}
.fce-pac-av {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: var(--c-brand-muted, rgba(127,119,221,.18)); color: var(--c-brand-soft, #a78bfa);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; position: relative;
}
.fce-pac-av::before {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  background: radial-gradient(circle, var(--c-brand-muted, rgba(127,119,221,.18)) 0%, transparent 70%);
  z-index: -1;
}
.fce-pac-info { flex: 1; min-width: 0; }
.fce-pac-name { font-size: 13.5px; font-weight: 500; color: var(--tx-base); line-height: 1.2; }
.fce-pac-meta { font-size: 11.5px; color: var(--tx-muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.fce-pac-pixd { font-family: ui-monospace, monospace; color: var(--c-brand-soft, #a78bfa); }
.fce-pac-rut { font-family: ui-monospace, monospace; color: var(--tx-muted); }
.fce-pac-cie10 { font-family: ui-monospace, monospace; color: var(--c-brand-soft, #a78bfa); font-weight: 500; }
.fce-pac-cie10-name { color: var(--tx-base); }
.fce-pac-tipo {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px;
  background: var(--c-brand-muted, rgba(127,119,221,.18)); color: var(--c-brand-soft, #a78bfa);
  border: 0.5px solid var(--c-brand, #6d28d9); font-size: 10.5px; font-weight: 500; flex-shrink: 0;
}
.fce-pac-tipo svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* stepper */
.fce-stepper { display: flex; align-items: center; gap: 0; margin: 0 18px 18px; padding: 2px 8px; }
.fce-step { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.fce-step-num {
  width: 22px; height: 22px; border-radius: 50%; background: var(--bg-surface, var(--bg-card));
  border: 0.5px solid var(--border); color: var(--tx-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 600; transition: all .18s ease;
}
.fce-step-num svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 3; }
.fce-step-lbl { font-size: 11px; color: var(--tx-muted); }
.fce-step.is-done .fce-step-num { background: var(--green-base, #5dcaa5); color: #fff; border-color: var(--green-base, #5dcaa5); }
.fce-step.is-done .fce-step-lbl { color: var(--tx-base); }
.fce-step.is-active .fce-step-num { background: var(--c-brand, #6d28d9); color: #fff; border-color: var(--c-brand, #6d28d9); }
.fce-step.is-active .fce-step-lbl { color: var(--c-brand-soft, #a78bfa); font-weight: 500; }
.fce-step-bar { flex: 1; height: 1px; background: var(--border); margin: 0 14px; }
.fce-step-bar.is-done { background: var(--green-base, #5dcaa5); }

/* body scroll */
.fce-body { flex: 1; min-height: 0; overflow-y: auto; padding-right: 2px; }

/* section */
.fce-section { margin-bottom: 18px; }
.fce-section-title { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--tx-base); margin-bottom: 10px; }
.fce-section-ico { width: 20px; height: 20px; border-radius: 5px; background: var(--c-brand-muted, rgba(127,119,221,.18)); color: var(--c-brand-soft, #a78bfa); display: flex; align-items: center; justify-content: center; }
.fce-section-ico svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.fce-section-req { font-size: 9.5px; color: var(--red-soft, var(--red-base)); margin-left: auto; letter-spacing: .05em; text-transform: uppercase; }

/* fields */
.fce-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fce-field-grid.full { grid-template-columns: 1fr; }
@media (max-width: 720px) { .fce-field-grid { grid-template-columns: 1fr; } }
.fce-field { display: flex; flex-direction: column; gap: 5px; }
.fce-field-lbl { font-size: 10.5px; color: var(--tx-muted); font-weight: 500; }
.fce-field-lbl .req { color: var(--red-soft, var(--red-base)); }
.fce-field input, .fce-field textarea {
  width: 100%; background: var(--bg-surface, var(--bg-card)); border: 0.5px solid var(--border);
  border-radius: 7px; padding: 10px 12px; color: var(--tx-base); font-size: 12.5px; font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.fce-field input:focus, .fce-field textarea:focus { outline: none; border-color: var(--c-brand-soft, #a78bfa); box-shadow: 0 0 0 2px var(--c-brand-muted, rgba(127,119,221,.18)); }
.fce-field textarea { resize: vertical; min-height: 110px; line-height: 1.55; }
.fce-field textarea.tall { min-height: 150px; }
.fce-field input.is-invalid, .fce-field textarea.is-invalid { border-color: var(--red-base, #e24b4a); box-shadow: 0 0 0 2px var(--red-bg, rgba(226,75,74,.1)); }

/* lk-select (sin <select> nativo) */
.fce-select { position: relative; width: 100%; }
.fce-select-trigger { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 10px 12px; background: var(--bg-surface, var(--bg-card)); border: 0.5px solid var(--border); border-radius: 7px; color: var(--tx-base); font-size: 12.5px; font-family: inherit; cursor: pointer; text-align: left; transition: border-color .15s ease; }
.fce-select-trigger:hover { border-color: var(--tx-muted); }
.fce-select.is-open .fce-select-trigger { border-color: var(--c-brand-soft, #a78bfa); box-shadow: 0 0 0 2px var(--c-brand-muted, rgba(127,119,221,.18)); }
.fce-select-value { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fce-select-value.is-placeholder { color: var(--tx-soft); }
.fce-select-chev { color: var(--tx-muted); transition: transform .18s ease; flex-shrink: 0; }
.fce-select-chev svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2.2; }
.fce-select.is-open .fce-select-chev { transform: rotate(180deg); color: var(--c-brand-soft, #a78bfa); }
.fce-select-menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--bg-surface, var(--bg-card)); border: 0.5px solid var(--border); border-radius: 8px; padding: 4px; box-shadow: 0 10px 28px rgba(0,0,0,.35); z-index: 100; max-height: 220px; overflow-y: auto; display: none; }
.fce-select.is-open .fce-select-menu { display: block; }
.fce-select-option { padding: 8px 10px; border-radius: 5px; font-size: 12.5px; color: var(--tx-base); cursor: pointer; transition: background .12s ease; }
.fce-select-option:hover { background: var(--bg-hover, rgba(127,127,127,.06)); }
.fce-select-option.is-selected { background: var(--c-brand-muted, rgba(127,119,221,.18)); color: var(--c-brand-soft, #a78bfa); }

/* CIE-11 search */
.fce-cie { position: relative; }
.fce-cie-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--bg-surface, var(--bg-card)); border: 0.5px solid var(--border); border-radius: 8px; padding: 4px; box-shadow: 0 10px 28px rgba(0,0,0,.35); z-index: 100; max-height: 240px; overflow-y: auto; display: none; }
.fce-cie-results.is-open { display: block; }
.fce-cie-opt { padding: 8px 10px; border-radius: 5px; cursor: pointer; transition: background .12s ease; }
.fce-cie-opt:hover { background: var(--bg-hover, rgba(127,127,127,.06)); }
.fce-cie-opt-code { font-family: ui-monospace, monospace; font-size: 11px; font-weight: 600; color: var(--sky-base, #4a90d9); }
.fce-cie-opt-desc { font-size: 12px; color: var(--tx-base); margin-top: 1px; }
.fce-cie-empty { padding: 10px; font-size: 11.5px; color: var(--tx-soft); text-align: center; }
.fce-cie-chip { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 6px 10px; background: var(--c-brand-muted, rgba(127,119,221,.18)); border: 0.5px solid var(--c-brand, #6d28d9); border-radius: 8px; }
.fce-cie-chip-code { font-family: ui-monospace, monospace; font-size: 11px; font-weight: 600; color: var(--c-brand-soft, #a78bfa); }
.fce-cie-chip-desc { font-size: 12px; color: var(--tx-base); }
.fce-cie-chip-x { margin-left: 4px; width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; border-radius: 4px; cursor: pointer; color: var(--tx-muted); }
.fce-cie-chip-x:hover { background: var(--bg-hover, rgba(127,127,127,.08)); color: var(--tx-base); }
.fce-cie-chip-x svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2.2; }
.fce-cie-ges { font-size: 9px; font-weight: 600; color: var(--green-base, #1d9e75); background: var(--green-bg, rgba(29,158,117,.1)); border-radius: 5px; padding: 1px 6px; }

/* tamizaje */
.fce-tam { display: flex; flex-direction: column; gap: 6px; }
.fce-tam-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-surface, var(--bg-card)); border: 0.5px solid var(--border-soft, var(--border)); border-radius: 8px; font-size: 11.5px; }
.fce-tam-item.is-high { background: var(--red-bg, rgba(226,75,74,.08)); border-color: var(--red-bd, rgba(226,75,74,.3)); }
.fce-tam-item.is-medium { background: var(--amber-bg, rgba(186,117,23,.1)); border-color: var(--amber-bd, rgba(186,117,23,.28)); }
.fce-tam-item.is-low { background: var(--green-bg, rgba(29,158,117,.1)); border-color: var(--green-bd, rgba(29,158,117,.28)); }
.fce-tam-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.fce-tam-item.is-high .fce-tam-dot { background: var(--red-base, #e24b4a); }
.fce-tam-item.is-medium .fce-tam-dot { background: var(--amber-base, #ef9f27); }
.fce-tam-item.is-low .fce-tam-dot { background: var(--green-base, #5dcaa5); }
.fce-tam-tipo { flex: 1; font-weight: 500; color: var(--tx-base); }
.fce-tam-nivel { padding: 2px 8px; border-radius: 20px; font-size: 9.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: #fff; }
.fce-tam-item.is-high .fce-tam-nivel { background: var(--red-base, #e24b4a); }
.fce-tam-item.is-medium .fce-tam-nivel { background: var(--amber-base, #ef9f27); }
.fce-tam-item.is-low .fce-tam-nivel { background: var(--green-base, #5dcaa5); }
.fce-tam-x { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; border-radius: 4px; cursor: pointer; color: var(--tx-muted); flex-shrink: 0; }
.fce-tam-x:hover { background: var(--bg-hover, rgba(127,127,127,.08)); color: var(--red-base, #e24b4a); }
.fce-tam-x svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; }
.fce-tam-add { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: transparent; border: 0.5px dashed var(--border); border-radius: 8px; color: var(--tx-muted); font-size: 11.5px; cursor: pointer; font-family: inherit; transition: all .15s ease; }
.fce-tam-add:hover { border-color: var(--c-brand-soft, #a78bfa); color: var(--c-brand-soft, #a78bfa); }
.fce-tam-add svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; }

/* footer */
.fce-foot { display: flex; align-items: center; gap: 14px; padding: 12px 16px; margin-top: 8px; background: var(--bg-card); border-top: 0.5px solid var(--border); flex-shrink: 0; }
.fce-foot-info { display: flex; align-items: center; gap: 8px; flex: 1; font-size: 11.5px; color: var(--tx-muted); min-width: 0; }
.fce-autosave { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--green-base, #1d9e75); }
.fce-autosave.is-saving { color: var(--tx-muted); }
.fce-autosave.is-error { color: var(--red-base, #e24b4a); }
.fce-autosave svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2.5; }
.fce-foot-actions { display: flex; gap: 8px; flex-shrink: 0; }
.fce-foot-btn-ghost { padding: 8px 14px; background: transparent; border: 0.5px solid var(--border); border-radius: 7px; color: var(--tx-base); font-size: 12px; font-family: inherit; cursor: pointer; transition: all .15s ease; }
.fce-foot-btn-ghost:hover { background: var(--bg-hover, rgba(127,127,127,.06)); border-color: var(--tx-muted); }
.fce-foot-btn-cta { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; background: var(--c-brand, #6d28d9); border: 0.5px solid var(--c-brand, #6d28d9); border-radius: 7px; color: #fff; font-size: 12px; font-weight: 500; font-family: inherit; cursor: pointer; transition: all .15s ease; }
.fce-foot-btn-cta:hover { filter: brightness(1.08); box-shadow: 0 6px 16px var(--c-brand-muted, rgba(124,58,237,.35)); }
.fce-foot-btn-cta:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.fce-foot-btn-cta svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; }

/* lock banner */
.fce-lock-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 14px; border-radius: 8px; background: var(--amber-bg, rgba(186,117,23,.1)); border: 0.5px solid var(--amber-bd, rgba(186,117,23,.28)); color: var(--amber-base, #ba7517); font-size: 11.5px; }
.fce-lock-banner svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; flex-shrink: 0; }

/* states */
.fce-loading, .fce-error { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 60px 20px; color: var(--tx-muted); font-size: 13px; }
.fce-loading svg { width: 30px !important; height: 30px !important; stroke: var(--c-brand-soft, #a78bfa); fill: none; stroke-width: 1.6; }
.fce-error svg { width: 28px !important; height: 28px !important; stroke: var(--red-base, #e24b4a); fill: none; stroke-width: 1.6; }
/* salvaguarda: ningún SVG del editor puede crecer sin límite dentro del blade */
.fce-root svg { max-width: 28px; max-height: 28px; }

@media (prefers-reduced-motion: reduce){
  .fce-step-num, .fce-foot-btn-cta, .fce-foot-btn-ghost, .fce-select-chev { transition: none !important; }
}

/* ════════════════════════════════════════════════════════════════════
   El editor vive dentro de un proceso LUZODesk (ldBladeHost): taskbar real
   + persistencia entre módulos. El .ld-blade-body del sistema contiene
   nuestro .fce-root, que debe ocupar todo el alto del blade.
   ════════════════════════════════════════════════════════════════════ */
.ld-blade .ld-blade-body { padding: 0 !important; display: flex; flex-direction: column; min-height: 0; }
.fce-root { height: 100%; display: flex; flex-direction: column; min-height: 0; }

/* cabecera del mockup: folio + controles de ventana */
.fce-blade-header { position: relative; padding: 10px 16px 0; background: transparent; flex-shrink: 0; z-index: 1; }
.fce-folio { display: flex; flex-direction: column; line-height: 1.05; }
.fce-folio-lbl { font-size: 9px; color: var(--tx-soft); letter-spacing: .10em; text-transform: uppercase; font-weight: 500; }
.fce-folio-val { font-family: ui-monospace, monospace; font-size: 13px; color: var(--c-brand-soft, #a78bfa); font-weight: 500; letter-spacing: -0.3px; margin-top: 3px; }
.fce-win-controls { position: absolute; top: 8px; right: 12px; display: flex; gap: 4px; z-index: 20; }
.fce-win-btn { width: 28px; height: 28px; border-radius: 7px; border: 0.5px solid var(--border); background: var(--bg-surface, var(--bg-card)); color: var(--tx-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .18s ease; }
.fce-win-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.fce-win-btn:hover { background: var(--bg-hover, rgba(127,127,127,.06)); color: var(--tx-base); transform: translateY(-1px); }
.fce-win-btn.fce-win-close:hover { background: var(--red-bg, rgba(226,75,74,.18)); color: var(--red-base, #e24b4a); border-color: var(--red-bd, rgba(226,75,74,.30)); }

/* body scrolleable entre header y footer */
.fce-blade-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px 16px; }
.fce-blade-body .fce-body { overflow: visible; }

/* footer pegado al pie del blade */
.fce-root > .fce-foot { margin-top: 0; }

/* ════════════════════════════════════════════════════════════════════
   SmartView bar — VARIANTE EXCLUSIVA ficha clínica (no es el LK.sv estándar).
   Portada del mockup aprobado. Folio arriba → esta barra → strip paciente.
   ════════════════════════════════════════════════════════════════════ */
.fce-sv-bar {
  display: flex; align-items: center;
  gap: 14px;                         /* MENOS aire horizontal: KPIs más juntos */
  padding: 8px 16px 16px;            /* menos aire arriba (cerca de botones), aire abajo */
  margin-top: 2px;
  background: transparent;           /* el degradé del headzone se ve a través */
  border-bottom: 0.5px solid var(--border);
  position: relative; overflow: visible; white-space: nowrap; flex-shrink: 0;
  transition: padding .4s cubic-bezier(.34,1.1,.64,1);
}
.fce-sv-trigger {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 6px 0 12px; border-radius: 8px;
  background: var(--c-brand-muted, rgba(127,119,221,.18)); border: 0.5px solid var(--c-brand, #6d28d9);
  color: var(--c-brand-soft, #a78bfa); font-size: 11.5px; font-weight: 500;
  flex-shrink: 0; margin-right: 4px;
  transition: background .4s ease, border-color .4s ease, color .4s ease;
}
.fce-sv-trigger svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.fce-sv-trigger-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 5px; border: none; cursor: pointer;
  background: transparent; color: currentColor; opacity: .7; transition: all .15s ease;
}
.fce-sv-trigger-x:hover { opacity: 1; background: rgba(226,75,74,.18); color: var(--red-base, #e24b4a); }
.fce-sv-trigger-x svg { width: 11px; height: 11px; stroke-width: 2.2; }
.fce-sv-trigger svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.fce-sv-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--tx-soft); opacity: .4; flex-shrink: 0; }
.fce-sv-kpi { display: inline-flex; align-items: baseline; gap: 5px; flex-shrink: 0; }
.fce-sv-kpi-lbl { font-size: 9px; color: var(--tx-soft); letter-spacing: .09em; text-transform: uppercase; font-weight: 600; }
.fce-sv-kpi-val { font-size: 11.5px; color: var(--tx-base); font-weight: 500; font-variant-numeric: tabular-nums; }
.fce-sv-kpi-val.good { color: var(--green-base, #1d9e75); }
.fce-sv-kpi-val.warn { color: var(--amber-base, #ba7517); }
.fce-sv-spacer { flex: 1; min-width: 16px; }
.fce-sv-pac { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; color: var(--tx-muted); }
.fce-sv-pac svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.fce-sv-pac-name { font-size: 11.5px; color: var(--tx-base); font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fce-sv-divider { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; margin: 0 4px; }
.fce-sv-clock { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; }
.fce-sv-clock-ico { color: var(--c-brand-soft, #a78bfa); display: inline-flex; transition: color .4s ease; }
.fce-sv-clock-ico svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; }
/* cronómetro: UN SOLO COLOR (violeta de marca) */
.fce-sv-clock-time { font-family: ui-monospace, monospace; font-size: 17px; font-weight: 500; color: var(--c-brand-soft, #a78bfa); font-variant-numeric: tabular-nums; letter-spacing: -0.4px; line-height: 1; display: inline-flex; align-items: baseline; gap: 1px; transition: color .4s ease; }
.fce-sv-clock-secs { color: var(--c-brand-soft, #a78bfa); transition: color .4s ease; }
.fce-sv-clock-tag { font-family: ui-monospace, monospace; font-size: 9px; color: var(--c-brand-soft, #a78bfa); opacity: .78; letter-spacing: .10em; text-transform: uppercase; font-weight: 600; margin-left: 1px; transition: color .4s ease; }
.fce-sv-progress { position: absolute; bottom: 0; left: 0; width: 100%; height: 3px; background: var(--bg-hover, rgba(127,127,127,.06)); overflow: hidden; pointer-events: none; }
.fce-sv-progress-fill {
  display: block; height: 100%; width: 2%;
  background: linear-gradient(90deg,
    #7f77dd 0%, #a78bfa 20%, #5dcaa5 40%, #378add 60%, #a78bfa 80%, #7f77dd 100%);
  background-size: 300% 100%;
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 10px rgba(127,119,221,.55), 0 0 4px rgba(127,119,221,.85);
  transition: width .9s cubic-bezier(.34,1.2,.64,1), background .5s ease;
  animation: fce-sv-hue 4.5s linear infinite, fce-sv-glow 2.4s ease-in-out infinite;
}
@keyframes fce-sv-hue { from { background-position: 0% 0; } to { background-position: 300% 0; } }
@keyframes fce-sv-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(127,119,221,.45), 0 0 3px rgba(127,119,221,.7); }
  50%      { box-shadow: 0 0 18px rgba(93,202,165,.8), 0 0 7px rgba(167,139,250,1); }
}

/* la cabecera del folio ya no necesita su padding-bottom: la barra sigue debajo */
.fce-blade-header { padding-bottom: 0; }

/* iconos sutiles (sin fondo) en los KPI */
.fce-sv-kpi-ico { display: inline-flex; align-items: center; align-self: center; color: var(--tx-soft); margin-right: 1px; }
.fce-sv-kpi-ico svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 1.7; }

/* paciente y reloj clicables (cursor + foco) */
.fce-sv-pac, .fce-sv-clock { position: relative; cursor: default; outline: none; }
.fce-sv-pac { cursor: pointer; }

/* ════════════════════════════════════════════════════════════════════
   ZONA SUPERIOR (cabecera + barra) — degradé continuo estilo wizard
   + estados de color por tiempo: normal(violeta) / amber / red / over
   ════════════════════════════════════════════════════════════════════ */
.fce-headzone { position: relative; isolation: isolate; background: var(--bg-card); }
.fce-headzone::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(115deg, var(--hz-c1) 0%, var(--hz-c2) 30%, transparent 64%);
  transition: background .5s ease;
  --hz-c1: rgba(127,119,221,.32); --hz-c2: rgba(167,139,250,.18);
}
/* el contenido (folio, barra) va por encima del degradé; NO tocar win-controls (absolute) */
.fce-headzone > .fce-blade-header,
.fce-headzone > .fce-sv-bar { position: relative; z-index: 1; }
@keyframes fce-hz-shift {
  0%, 100% { background-position: 0% 0%, 100% 0%, 50% 100%; }
  50%      { background-position: 25% 12%, 75% 12%, 50% 88%; }
}
/* estado ámbar (≤ 10 min) */
.fce-headzone.is-amber::before { --hz-c1: rgba(224,164,74,.34); --hz-c2: rgba(224,164,74,.18); }
.fce-headzone.is-amber .fce-folio-val,
.fce-headzone.is-amber .fce-sv-clock-ico,
.fce-headzone.is-amber .fce-sv-clock-time,
.fce-headzone.is-amber .fce-sv-clock-secs,
.fce-headzone.is-amber .fce-sv-clock-tag { color: var(--amber-base, #e0a44a); }
.fce-headzone.is-amber .fce-sv-trigger { background: rgba(224,164,74,.16); border-color: var(--amber-base, #e0a44a); color: var(--amber-base, #e0a44a); }
.fce-headzone.is-amber .fce-sv-progress-fill {
  background: linear-gradient(90deg, #e0a44a, #f0c074, #e0a44a); background-size: 200% 100%;
  animation: fce-sv-hue 4.5s linear infinite, fce-sv-glow-a 2.4s ease-in-out infinite;
}
@keyframes fce-sv-glow-a { 0%,100% { box-shadow: 0 0 8px rgba(224,164,74,.5); } 50% { box-shadow: 0 0 16px rgba(224,164,74,.85); } }
/* estado rojo (≤ 3 min) + overtime */
.fce-headzone.is-red::before, .fce-headzone.is-over::before { --hz-c1: rgba(226,75,74,.38); --hz-c2: rgba(226,75,74,.20); }
.fce-headzone.is-red .fce-folio-val,
.fce-headzone.is-red .fce-sv-clock-ico,
.fce-headzone.is-red .fce-sv-clock-time,
.fce-headzone.is-red .fce-sv-clock-secs,
.fce-headzone.is-red .fce-sv-clock-tag,
.fce-headzone.is-over .fce-folio-val,
.fce-headzone.is-over .fce-sv-clock-ico,
.fce-headzone.is-over .fce-sv-clock-time,
.fce-headzone.is-over .fce-sv-clock-secs,
.fce-headzone.is-over .fce-sv-clock-tag { color: var(--red-base, #e24b4a); }
.fce-headzone.is-red .fce-sv-trigger, .fce-headzone.is-over .fce-sv-trigger { background: rgba(226,75,74,.16); border-color: var(--red-base, #e24b4a); color: var(--red-base, #e24b4a); }
.fce-headzone.is-red .fce-sv-progress-fill, .fce-headzone.is-over .fce-sv-progress-fill {
  background: linear-gradient(90deg, #e24b4a, #f07a79, #e24b4a); background-size: 200% 100%;
  animation: fce-sv-hue 3s linear infinite, fce-sv-glow-r 1.4s ease-in-out infinite;
}
@keyframes fce-sv-glow-r { 0%,100% { box-shadow: 0 0 8px rgba(226,75,74,.55); } 50% { box-shadow: 0 0 18px rgba(226,75,74,.95); } }
/* overtime: pulso sutil de la zona */
.fce-headzone.is-over::before { animation: fce-hz-pulse 1.6s ease-in-out infinite; }
@keyframes fce-hz-pulse { 0%,100% { opacity: 1; } 50% { opacity: .72; } }

/* estado FINALIZADA (sesión terminada · borrador reabierto) → verde tenue, barra completa */
.fce-headzone.is-done::before { --hz-c1: rgba(93,202,165,.26); --hz-c2: rgba(93,202,165,.15); }
.fce-headzone.is-done .fce-sv-clock-ico,
.fce-headzone.is-done .fce-sv-clock-time,
.fce-headzone.is-done .fce-sv-clock-secs,
.fce-headzone.is-done .fce-sv-clock-tag { color: var(--green-base, #1d9e75); }
.fce-headzone.is-done .fce-sv-trigger { background: rgba(93,202,165,.14); border-color: var(--green-base, #1d9e75); color: var(--green-base, #1d9e75); }
.fce-headzone.is-done .fce-sv-progress-fill {
  background: linear-gradient(90deg, #1d9e75, #5dcaa5, #1d9e75); background-size: 200% 100%;
  animation: fce-sv-hue 6s linear infinite; box-shadow: 0 0 8px rgba(93,202,165,.45);
}

/* ── tooltips ───────────────────────────────────────────────────────── */
.fce-tip {
  position: absolute; top: calc(100% + 12px); right: 0; z-index: 80;
  min-width: 220px; padding: 12px 13px;
  background: var(--bg-card); border: 0.5px solid var(--border);
  border-radius: 10px; box-shadow: 0 14px 38px rgba(0,0,0,.42);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
  pointer-events: none; white-space: normal;
}
.fce-sv-pac:hover .fce-tip, .fce-sv-pac:focus-within .fce-tip,
.fce-sv-clock:hover .fce-tip, .fce-sv-clock:focus-within .fce-tip {
  opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto;
}
.fce-tip::before { content: ''; position: absolute; top: -12px; left: 0; right: 0; height: 12px; }
.fce-tip-hd { font-size: 12px; font-weight: 500; color: var(--tx-base); margin-bottom: 8px; }
.fce-tip-body { display: flex; flex-direction: column; gap: 5px; }
.fce-tip-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 11px; }
.fce-tip-row span { color: var(--tx-soft); }
.fce-tip-row b { color: var(--tx-base); font-weight: 500; font-variant-numeric: tabular-nums; }
.fce-tip-row b.fce-tip-over { color: var(--red-base, #e24b4a); }
.fce-mono { font-family: ui-monospace, monospace; letter-spacing: -0.2px; }
.fce-tip-note { font-size: 10px; color: var(--tx-soft); margin-top: 6px; font-style: italic; }
.fce-tip-cta {
  margin-top: 11px; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 32px; border-radius: 8px; cursor: pointer;
  background: var(--c-brand-muted, rgba(127,119,221,.18)); border: 0.5px solid var(--c-brand, #6d28d9);
  color: var(--c-brand-soft, #a78bfa); font-size: 11.5px; font-weight: 500;
  transition: all .15s ease;
}
.fce-tip-cta:hover { background: var(--c-brand, #6d28d9); color: #fff; }
.fce-tip-cta svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* ════════════════════════════════════════════════════════════════════
   Iconos "cambiar" en KPIs (tipo / programa / sesión)
   ════════════════════════════════════════════════════════════════════ */
.fce-sv-kpi-edit {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin-left: 1px; border: none; border-radius: 5px;
  background: transparent; color: var(--tx-soft); cursor: pointer; transition: all .15s ease;
}
.fce-sv-kpi-edit:hover { background: var(--c-brand-muted, rgba(127,119,221,.18)); color: var(--c-brand-soft, #a78bfa); }
.fce-sv-kpi-edit svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* ════════════════════════════════════════════════════════════════════
   Modales SmartView (cambiar tipo / programa / sesión)
   ════════════════════════════════════════════════════════════════════ */
.fce-modal-bg {
  position: absolute; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center; padding: 24px;
  background: rgba(0,0,0,.5);
}
.fce-modal-bg.is-open { display: flex; }
.fce-modal {
  width: 100%; max-width: 440px; background: var(--bg-card); border: 0.5px solid var(--border);
  border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.5); overflow: hidden;
}
.fce-modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 0.5px solid var(--border); }
.fce-modal-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--c-brand-muted, rgba(127,119,221,.18)); color: var(--c-brand-soft, #a78bfa); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.fce-modal-ico svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.fce-modal-t { font-size: 15px; font-weight: 500; color: var(--tx-base); }
.fce-modal-s { font-size: 11.5px; color: var(--tx-muted); margin-top: 1px; }
.fce-modal-x { margin-left: auto; width: 30px; height: 30px; border-radius: 7px; border: 0.5px solid var(--border); background: var(--bg-surface, var(--bg-card)); color: var(--tx-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.fce-modal-x svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.fce-modal-b { padding: 16px 18px; max-height: 56vh; overflow: auto; }
.fce-modal-f { padding: 13px 18px; border-top: 0.5px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.fce-optcard { display: flex; align-items: flex-start; gap: 12px; padding: 13px; border: 0.5px solid var(--border); border-radius: 10px; cursor: pointer; margin-bottom: 9px; transition: all .15s ease; }
.fce-optcard:hover { background: var(--bg-hover, rgba(127,127,127,.05)); }
.fce-optcard.is-sel { border-color: var(--c-brand, #6d28d9); background: var(--c-brand-muted, rgba(127,119,221,.18)); }
.fce-optcard-r { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border); flex-shrink: 0; margin-top: 1px; display: flex; align-items: center; justify-content: center; }
.fce-optcard.is-sel .fce-optcard-r { border-color: var(--c-brand, #6d28d9); }
.fce-optcard.is-sel .fce-optcard-r::after { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--c-brand, #6d28d9); }
.fce-optcard-t { font-size: 13.5px; font-weight: 500; color: var(--tx-base); }
.fce-optcard-d { font-size: 11.5px; color: var(--tx-muted); margin-top: 2px; line-height: 1.4; }
.fce-optcard-badge { display: inline-block; font-size: 9.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; margin-top: 6px; background: rgba(93,202,165,.14); color: var(--green-base, #1d9e75); }
.fce-optcard-badge.amber { background: rgba(224,164,74,.14); color: var(--amber-base, #e0a44a); }
.fce-modal-field { display: flex; flex-direction: column; gap: 7px; }
.fce-modal-field label { font-size: 12px; color: var(--tx-muted); }
.fce-modal-field input { background: var(--bg-surface, var(--bg-card)); border: 0.5px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--tx-base); font-size: 14px; font-family: inherit; }
.fce-modal-hint { font-size: 10.5px; color: var(--tx-soft); }
.fce-modal-hint.warn { color: var(--amber-base, #e0a44a); }
.fce-btn-ghost { height: 36px; padding: 0 16px; border-radius: 9px; font-size: 13px; font-weight: 500; cursor: pointer; border: 0.5px solid var(--border); background: transparent; color: var(--tx-base); }
.fce-btn-ghost:hover { background: var(--bg-hover, rgba(127,127,127,.05)); }
.fce-btn-primary { height: 36px; padding: 0 18px; border-radius: 9px; font-size: 13px; font-weight: 500; cursor: pointer; border: 0.5px solid var(--c-brand, #6d28d9); background: var(--c-brand, #6d28d9); color: #fff; display: inline-flex; align-items: center; gap: 8px; }
.fce-btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.fce-btn-primary svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* ════════════════════════════════════════════════════════════════════
   Paso obligatorio · datos del paciente (evaluación inicial)
   ════════════════════════════════════════════════════════════════════ */
.fce-pac-banner { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 10px; background: rgba(224,164,74,.10); border: 0.5px solid rgba(224,164,74,.32); margin-bottom: 22px; }
.fce-pac-banner-ico { width: 32px; height: 32px; border-radius: 8px; background: rgba(224,164,74,.18); color: var(--amber-base, #e0a44a); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.fce-pac-banner-ico svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.fce-pac-banner-t { font-size: 13.5px; font-weight: 500; color: var(--tx-base); margin-bottom: 3px; }
.fce-pac-banner-d { font-size: 12px; color: var(--tx-muted); line-height: 1.5; }
.fce-pac-banner-c { margin-left: auto; flex-shrink: 0; font-size: 11px; font-weight: 500; color: var(--amber-base, #e0a44a); background: rgba(224,164,74,.14); padding: 5px 10px; border-radius: 6px; white-space: nowrap; }
.fce-sec { margin-bottom: 24px; }
.fce-sec-h { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.fce-sec-ico { width: 30px; height: 30px; border-radius: 8px; background: var(--c-brand-muted, rgba(127,119,221,.18)); color: var(--c-brand-soft, #a78bfa); display: flex; align-items: center; justify-content: center; }
.fce-sec-ico svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.fce-sec-t { font-size: 15px; font-weight: 500; color: var(--tx-base); }
.fce-sec-req { margin-left: auto; font-size: 9px; letter-spacing: .10em; text-transform: uppercase; color: var(--tx-soft); font-weight: 600; }
.fce-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fce-fld { display: flex; flex-direction: column; gap: 6px; }
.fce-fld label { font-size: 12px; color: var(--tx-muted); display: flex; align-items: center; }
.fce-req { color: var(--red-base, #e24b4a); margin-left: 2px; }
.fce-fld input { background: var(--bg-surface, var(--bg-card)); border: 0.5px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--tx-base); font-size: 13px; font-family: inherit; width: 100%; }
.fce-fld input::placeholder { color: var(--tx-soft); }
.fce-fld.is-missing input { border-color: var(--amber-base, #e0a44a); background: rgba(224,164,74,.06); }
.fce-fld-hint { font-size: 10.5px; color: var(--tx-soft); }
.fce-fld-hint.warn { color: var(--amber-base, #e0a44a); }
.fce-crm-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 9.5px; color: var(--green-base, #1d9e75); background: rgba(93,202,165,.12); padding: 2px 7px; border-radius: 5px; margin-left: 6px; }
.fce-crm-tag svg { width: 10px; height: 10px; stroke: currentColor; fill: none; stroke-width: 2; }
.fce-foot-err { color: var(--red-base, #e24b4a); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.fce-foot-err svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.fce-foot-sp { flex: 1; }

/* ════════════════════════════════════════════════════════════════════
   Paso paciente · dropdowns custom (sin <select> nativo) + validación
   ════════════════════════════════════════════════════════════════════ */
.fce-pacstep .fce-grid2 { gap: 16px 20px; }
.fce-pacsel {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-surface, var(--bg-card)); border: 0.5px solid var(--border); border-radius: 8px;
  padding: 10px 12px; color: var(--tx-base); font-size: 13px; cursor: pointer; user-select: none;
  transition: border-color .15s ease;
}
.fce-pacsel:hover { border-color: var(--c-brand-soft, #a78bfa); }
.fce-pacsel.is-open { border-color: var(--c-brand, #6d28d9); }
.fce-pacsel.is-disabled { opacity: .55; cursor: not-allowed; }
.fce-pacsel-val.is-ph { color: var(--tx-soft); }
.fce-pacsel > svg { width: 14px; height: 14px; stroke: var(--tx-soft); fill: none; stroke-width: 1.8; flex-shrink: 0; transition: transform .15s ease; }
.fce-pacsel.is-open > svg { transform: rotate(180deg); }
.fce-pacsel-menu {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
  background: var(--bg-card); border: 0.5px solid var(--border); border-radius: 9px;
  box-shadow: 0 14px 38px rgba(0,0,0,.32); max-height: 240px; overflow-y: auto;
  padding: 5px; display: none;
}
.fce-pacsel.is-open .fce-pacsel-menu { display: block; }
.fce-pacsel-opt { padding: 9px 11px; border-radius: 6px; font-size: 13px; color: var(--tx-base); cursor: pointer; transition: background .12s ease; }
.fce-pacsel-opt:hover { background: var(--bg-hover, rgba(127,127,127,.06)); }
.fce-pacsel-opt.is-sel { background: var(--c-brand-muted, rgba(127,119,221,.18)); color: var(--c-brand-soft, #a78bfa); }
/* campo inválido (validación fallida) */
.fce-fld.is-invalid input,
.fce-fld.is-invalid .fce-pacsel { border-color: var(--red-base, #e24b4a); background: rgba(226,75,74,.06); }
.fce-fld-hint.err { color: var(--red-base, #e24b4a); }
