/* ═══════════════════════════════════════════════════════════════
   FORJA · Copiloto Industrial de Conocimiento — Design System
   Paleta de datos: instancia de referencia validada (CVD ΔE ≥ 12)
   ═══════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;
  /* Superficies e tinta */
  --page:        #f4f4f1;
  --surface:     #fcfcfb;
  --surface-2:   #f7f7f4;
  --ink:         #0b0b0b;
  --ink-2:       #52514e;
  --ink-3:       #898781;
  --grid:        #e1e0d9;
  --baseline:    #c3c2b7;
  --border:      rgba(11, 11, 11, 0.10);
  --border-soft: rgba(11, 11, 11, 0.06);

  /* Marca */
  --brand:       #1a1a19;
  --brand-ink:   #f5f4ef;
  --accent:      #eda100;      /* ámbar industrial (marca, no dato) */
  --accent-deep: #c98500;

  /* Series de datos (categórica validada, orden fijo) */
  --s1: #2a78d6;  /* azul  */
  --s2: #1baf7a;  /* aqua  */
  --s3: #eda100;  /* amarillo */
  --s4: #008300;  /* verde */
  --s5: #4a3aa7;  /* violeta */

  /* Rampa secuencial azul (ordinal: niveles de competencia) */
  --seq-250: #86b6ef;
  --seq-350: #5598e7;
  --seq-450: #2a78d6;
  --seq-550: #1c5cab;

  /* Estado (reservados, siempre con icono + texto) */
  --ok:       #0ca30c;
  --ok-text:  #006300;
  --warn:     #fab219;
  --warn-text:#8a5800;
  --danger:   #d03b3b;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 15, 14, .05), 0 4px 16px rgba(15, 15, 14, .06);
  --shadow-lg: 0 4px 12px rgba(15, 15, 14, .08), 0 16px 40px rgba(15, 15, 14, .12);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { height: 100%; }

body {
  font-family: var(--font);
  background: var(--page);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  height: 100%;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; }

/* ═══ Layout ═══ */
.app { display: flex; height: 100vh; overflow: hidden; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.content {
  flex: 1; overflow-y: auto; padding: 28px 32px 60px;
  scroll-behavior: smooth; outline: none;
}

/* ═══ Sidebar ═══ */
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--brand); color: var(--brand-ink);
  display: flex; flex-direction: column; padding: 20px 14px 16px;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 20px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 9px; background: linear-gradient(135deg, #f4b73f, var(--accent-deep));
  color: #1a1a19; display: grid; place-items: center;
  font-weight: 800; font-size: 21px; letter-spacing: -.5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: 2.5px; }
.brand-sub { font-size: 11px; color: rgba(245,244,239,.55); letter-spacing: .3px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px;
  color: rgba(245,244,239,.42); padding: 14px 10px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px;
  border-radius: 8px; text-decoration: none; font-weight: 500; font-size: 13.5px;
  color: rgba(245,244,239,.78); transition: background .15s, color .15s;
}
.nav-link svg { width: 18px; height: 18px; fill: currentColor; opacity: .8; flex-shrink: 0; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active { background: rgba(237,161,0,.14); color: #ffce6b; }
.nav-link.active svg { opacity: 1; }
.nav-step {
  margin-left: auto; font-size: 10px; font-weight: 700; color: rgba(245,244,239,.4);
  border: 1px solid rgba(245,244,239,.18); border-radius: 20px; padding: 1px 7px;
}
.nav-link.active .nav-step { color: #ffce6b; border-color: rgba(255,206,107,.4); }

.sidebar-foot { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; }
.plant-chip {
  display: flex; gap: 9px; align-items: flex-start; background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.09); border-radius: 10px; padding: 10px 12px;
  font-size: 12px; line-height: 1.35;
}
.plant-chip strong { display: block; font-size: 12.5px; }
.plant-chip span:last-child { color: rgba(245,244,239,.55); }
.plant-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  margin-top: 5px; flex-shrink: 0; box-shadow: 0 0 0 3px rgba(12,163,12,.25);
}
.demo-badge {
  text-align: center; font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase;
  color: rgba(245,244,239,.45); border: 1px dashed rgba(245,244,239,.25);
  border-radius: 8px; padding: 5px;
}

/* ═══ Topbar ═══ */
.topbar {
  height: 62px; flex-shrink: 0; background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between; padding: 0 32px;
}
.topbar-title { font-size: 16.5px; font-weight: 700; letter-spacing: -.2px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.searchbox {
  display: flex; align-items: center; gap: 8px; background: var(--surface-2);
  border: 1px solid var(--border-soft); border-radius: 9px; padding: 7px 12px; width: 320px;
}
.searchbox svg { width: 16px; height: 16px; fill: var(--ink-3); flex-shrink: 0; }
.searchbox input { border: none; outline: none; background: transparent; width: 100%; font-size: 13px; }
.searchbox input::placeholder { color: var(--ink-3); }

.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--border-soft);
  background: var(--surface); display: grid; place-items: center; transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 19px; height: 19px; fill: var(--ink-2); }
.notif-dot {
  position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); border: 1.5px solid var(--surface);
}

.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0;
}
.avatar-rp { background: var(--seq-550); }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 13px; }
.user-meta span { font-size: 11px; color: var(--ink-3); }

/* ═══ Bloques comunes ═══ */
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.page-head p { color: var(--ink-2); margin-top: 4px; max-width: 760px; }

.card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px;
}
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.card-sub { font-size: 12.5px; color: var(--ink-3); margin-bottom: 14px; }

.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-1-1 { grid-template-columns: 1fr 1fr; }
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-2-1, .grid-1-1, .grid-2 { grid-template-columns: 1fr; }
}

.mt { margin-top: 16px; }
.mt-lg { margin-top: 24px; }

/* Stat tiles */
.stat-tile { display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.5px; line-height: 1.15; }
.stat-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.stat-delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.stat-delta.up { color: var(--ok-text); }
.stat-delta.down { color: var(--danger); }
.stat-delta .vs { color: var(--ink-3); font-weight: 400; }
.sparkline { flex-shrink: 0; }

/* Pipeline */
.pipeline { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 4px 0; }
.pipe-stage {
  flex: 1; min-width: 118px; position: relative; padding: 14px 14px 12px 22px;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 14px 50%);
  display: flex; flex-direction: column; gap: 1px; transition: background .15s;
}
.pipe-stage:first-child { clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%); padding-left: 16px; border-radius: 8px 0 0 8px; }
.pipe-stage:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 14px 50%); border-radius: 0 8px 8px 0; }
.pipe-stage:hover { background: #efefe9; }
.pipe-num { font-size: 10px; font-weight: 700; color: var(--ink-3); letter-spacing: .8px; }
.pipe-name { font-weight: 700; font-size: 13px; }
.pipe-value { font-size: 12px; color: var(--ink-2); }

/* Botones */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 9px; font-weight: 600;
  padding: 9px 16px; font-size: 13.5px; border: 1px solid transparent; transition: all .15s;
}
.btn svg { width: 16px; height: 16px; fill: currentColor; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: #333330; }
.btn-accent { background: var(--accent); color: #231a02; }
.btn-accent:hover { background: #ffb70e; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Chips y badges */
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  border-radius: 20px; padding: 3px 10px; white-space: nowrap;
}
.chip svg { width: 12px; height: 12px; fill: currentColor; }
.chip-ok { background: rgba(12,163,12,.1); color: var(--ok-text); }
.chip-warn { background: rgba(250,178,25,.15); color: var(--warn-text); }
.chip-danger { background: rgba(208,59,59,.1); color: var(--danger); }
.chip-info { background: rgba(42,120,214,.1); color: var(--seq-550); }
.chip-neutral { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border-soft); }

/* Tablas */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--ink-3); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--grid);
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Persona en tabla */
.person { display: flex; align-items: center; gap: 10px; }
.person .avatar { width: 30px; height: 30px; font-size: 11px; }
.person-meta { line-height: 1.25; }
.person-meta strong { display: block; font-size: 13px; }
.person-meta span { font-size: 11.5px; color: var(--ink-3); }

/* Progreso */
.progress { height: 7px; background: #e9e8e2; border-radius: 20px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 20px; background: var(--seq-450); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.progress-fill.amber { background: var(--accent); }
.progress-fill.green { background: var(--ok); }

/* ═══ Gráficos ═══ */
.chart-wrap { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; }
.chart-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 6px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.legend-swatch { width: 14px; height: 4px; border-radius: 2px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }

.chart-tooltip {
  position: absolute; pointer-events: none; background: var(--ink); color: #fff;
  border-radius: 8px; padding: 8px 11px; font-size: 12px; line-height: 1.45;
  box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .12s; z-index: 30;
  white-space: nowrap; transform: translate(-50%, calc(-100% - 12px));
}
.chart-tooltip.show { opacity: 1; }
.chart-tooltip .tt-title { font-weight: 700; margin-bottom: 2px; }
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 6px; }
.chart-tooltip .tt-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ═══ Capturar ═══ */
.capture-source { display: flex; flex-direction: column; gap: 12px; }
.capture-tabs { display: flex; gap: 6px; }
.capture-tab {
  border: 1px solid var(--border-soft); background: var(--surface-2); border-radius: 8px;
  padding: 7px 13px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  display: inline-flex; gap: 7px; align-items: center;
}
.capture-tab svg { width: 14px; height: 14px; fill: currentColor; }
.capture-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

textarea.transcript {
  width: 100%; min-height: 220px; resize: vertical; border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; font-size: 13.5px; line-height: 1.6;
  background: var(--surface); outline: none; color: var(--ink-2);
}
textarea.transcript:focus { border-color: var(--seq-450); box-shadow: 0 0 0 3px rgba(42,120,214,.12); }

.ai-steps { display: flex; flex-direction: column; gap: 0; }
.ai-step { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; opacity: .35; transition: opacity .3s; }
.ai-step.active, .ai-step.done { opacity: 1; }
.ai-step-icon {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: var(--surface-2); border: 1.5px solid var(--grid); font-size: 12px; transition: all .3s;
}
.ai-step.active .ai-step-icon { border-color: var(--accent); background: rgba(237,161,0,.12); }
.ai-step.done .ai-step-icon { border-color: var(--ok); background: rgba(12,163,12,.1); color: var(--ok-text); }
.ai-step-icon svg { width: 13px; height: 13px; fill: currentColor; }
.ai-step-txt strong { display: block; font-size: 13px; }
.ai-step-txt span { font-size: 12px; color: var(--ink-3); }
.spinner {
  width: 13px; height: 13px; border: 2px solid rgba(237,161,0,.3); border-top-color: var(--accent-deep);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* SOP generada */
.sop { border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; animation: rise .5s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.sop-head { background: var(--brand); color: #fff; padding: 18px 22px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.sop-head h3 { font-size: 16px; }
.sop-head .sop-code { font-family: var(--mono); font-size: 11px; color: rgba(255,255,255,.55); }
.sop-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.sop-body { padding: 20px 22px; background: var(--surface); }
.sop-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-3); font-weight: 700; margin: 18px 0 8px; }
.sop-section-title:first-child { margin-top: 0; }
.sop-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.sop-step { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.sop-step:last-child { border-bottom: none; }
.sop-step-num {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: 8px; background: var(--surface-2);
  border: 1px solid var(--border-soft); display: grid; place-items: center; font-weight: 700; font-size: 12.5px;
}
.sop-step-body strong { display: block; font-size: 13.5px; }
.sop-step-body p { font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }
.sop-alert {
  display: flex; gap: 7px; align-items: flex-start; margin-top: 6px; font-size: 12px;
  background: rgba(250,178,25,.12); border: 1px solid rgba(250,178,25,.35);
  color: var(--warn-text); border-radius: 8px; padding: 6px 10px; font-weight: 500;
}
.sop-alert.crit { background: rgba(208,59,59,.07); border-color: rgba(208,59,59,.3); color: var(--danger); }
.sop-alert svg { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; margin-top: 1px; }

/* Lista de activos de conocimiento */
.asset { display: flex; align-items: center; gap: 13px; padding: 11px 4px; border-bottom: 1px solid var(--border-soft); }
.asset:last-child { border-bottom: none; }
.asset-icon {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0;
}
.asset-icon svg { width: 17px; height: 17px; }
.asset-icon.video { background: rgba(74,58,167,.1); } .asset-icon.video svg { fill: var(--s5); }
.asset-icon.audio { background: rgba(42,120,214,.1); } .asset-icon.audio svg { fill: var(--seq-550); }
.asset-icon.doc { background: rgba(27,175,122,.12); } .asset-icon.doc svg { fill: #0e7a54; }
.asset-body { flex: 1; min-width: 0; line-height: 1.3; }
.asset-body strong { font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-body span { font-size: 11.5px; color: var(--ink-3); }

/* ═══ Formar ═══ */
.itinerary-card { display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.itinerary-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.itinerary-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.itinerary-title { font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.itinerary-meta { font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; flex-wrap: wrap; }

.module-row { display: flex; gap: 13px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.module-row:last-child { border-bottom: none; }
.module-status {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; border: 1.5px solid var(--grid); background: var(--surface-2); color: var(--ink-3);
}
.module-status.done { background: rgba(12,163,12,.1); border-color: var(--ok); color: var(--ok-text); }
.module-status.current { background: rgba(237,161,0,.13); border-color: var(--accent); color: var(--warn-text); }
.module-status svg { width: 13px; height: 13px; fill: currentColor; }
.module-body { flex: 1; }
.module-body strong { font-size: 13.5px; display: block; }
.module-body span { font-size: 12px; color: var(--ink-3); }
.module-kind { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; font-weight: 700; color: var(--ink-3); }

/* Quiz */
.quiz-q { font-size: 15px; font-weight: 700; margin-bottom: 14px; line-height: 1.4; }
.quiz-opt {
  display: flex; gap: 11px; align-items: flex-start; width: 100%; text-align: left;
  border: 1.5px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 9px; font-size: 13.5px; transition: all .15s; line-height: 1.4;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--seq-450); background: rgba(42,120,214,.04); }
.quiz-opt .opt-key {
  width: 22px; height: 22px; flex-shrink: 0; border-radius: 6px; background: var(--surface-2);
  border: 1px solid var(--border-soft); display: grid; place-items: center; font-weight: 700; font-size: 11.5px;
}
.quiz-opt.correct { border-color: var(--ok); background: rgba(12,163,12,.07); }
.quiz-opt.correct .opt-key { background: var(--ok); border-color: var(--ok); color: #fff; }
.quiz-opt.wrong { border-color: var(--danger); background: rgba(208,59,59,.06); }
.quiz-opt.wrong .opt-key { background: var(--danger); border-color: var(--danger); color: #fff; }
.quiz-opt:disabled { cursor: default; }
.quiz-feedback {
  border-radius: 10px; padding: 12px 15px; font-size: 13px; margin-top: 4px; line-height: 1.5;
  animation: rise .35s cubic-bezier(.2,.8,.2,1);
}
.quiz-feedback.ok { background: rgba(12,163,12,.08); border: 1px solid rgba(12,163,12,.25); color: var(--ok-text); }
.quiz-feedback.ko { background: rgba(208,59,59,.06); border: 1px solid rgba(208,59,59,.22); color: #8c2626; }
.quiz-dots { display: flex; gap: 6px; }
.quiz-dot { width: 26px; height: 5px; border-radius: 4px; background: #e5e4dd; }
.quiz-dot.done { background: var(--ok); }
.quiz-dot.now { background: var(--accent); }

/* ═══ Copiloto ═══ */
.device {
  background: var(--brand); border-radius: 26px; padding: 12px; box-shadow: var(--shadow-lg);
  max-width: 400px; margin: 0 auto;
}
.device-screen { background: var(--page); border-radius: 17px; overflow: hidden; display: flex; flex-direction: column; height: 620px; }
.device-bar {
  background: var(--brand); color: #fff; padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 8px;
}
.device-bar-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: rgba(255,255,255,.7); }
.device-task { font-weight: 700; font-size: 14.5px; line-height: 1.3; color: #fff; }
.device-task span { display: block; font-weight: 400; font-size: 11.5px; color: rgba(255,255,255,.6); margin-top: 1px; }
.device-progress { height: 5px; border-radius: 4px; background: rgba(255,255,255,.18); overflow: hidden; }
.device-progress i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.device-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }

.guide-step {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 13px; padding: 13px 15px;
  display: flex; flex-direction: column; gap: 8px; transition: all .2s;
}
.guide-step.locked { opacity: .5; }
.guide-step.current { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(237,161,0,.14); }
.guide-step-head { display: flex; gap: 10px; align-items: center; }
.guide-step-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); border: 1.5px solid var(--grid);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; flex-shrink: 0; color: var(--ink-2);
}
.guide-step.done .guide-step-num { background: var(--ok); border-color: var(--ok); color: #fff; }
.guide-step.current .guide-step-num { border-color: var(--accent); background: rgba(237,161,0,.14); }
.guide-step-head strong { font-size: 13px; line-height: 1.3; }
.guide-step p { font-size: 12px; color: var(--ink-2); line-height: 1.45; }
.guide-check {
  display: flex; align-items: center; gap: 8px; width: 100%; justify-content: center;
  background: var(--brand); color: #fff; border: none; border-radius: 9px; padding: 9px; font-weight: 600; font-size: 12.5px;
}
.guide-check svg { width: 14px; height: 14px; fill: currentColor; }
.guide-verify {
  font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px;
}
.guide-verify svg { width: 13px; height: 13px; fill: var(--seq-450); flex-shrink: 0; }
.guide-done-banner {
  background: rgba(12,163,12,.09); border: 1px solid rgba(12,163,12,.3); color: var(--ok-text);
  border-radius: 13px; padding: 16px; text-align: center; font-weight: 600; font-size: 13px;
  animation: rise .4s cubic-bezier(.2,.8,.2,1);
}
.guide-done-banner span { display: block; font-weight: 400; font-size: 12px; margin-top: 3px; }

/* Chat copiloto */
.chat { display: flex; flex-direction: column; height: 620px; }
.chat-head { display: flex; align-items: center; gap: 11px; padding-bottom: 14px; border-bottom: 1px solid var(--border-soft); }
.chat-avatar {
  width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, #f4b73f, var(--accent-deep));
  display: grid; place-items: center; flex-shrink: 0;
}
.chat-avatar svg { width: 20px; height: 20px; fill: #231a02; }
.chat-head strong { display: block; font-size: 14px; }
.chat-head span { font-size: 11.5px; color: var(--ok-text); display: inline-flex; align-items: center; gap: 5px; }
.chat-head span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.chat-body { flex: 1; overflow-y: auto; padding: 16px 4px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 85%; border-radius: 14px; padding: 10px 14px; font-size: 13px; line-height: 1.55; animation: rise .3s cubic-bezier(.2,.8,.2,1); }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border-soft); border-bottom-left-radius: 4px; }
.msg.bot strong { font-weight: 700; }
.msg .msg-src {
  display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--grid);
}
.msg-src-chip {
  font-size: 10.5px; font-weight: 600; color: var(--seq-550); background: rgba(42,120,214,.08);
  border-radius: 6px; padding: 2px 8px; display: inline-flex; align-items: center; gap: 4px;
}
.msg-src-chip svg { width: 10px; height: 10px; fill: currentColor; }
.msg.typing { display: inline-flex; gap: 4px; align-items: center; padding: 13px 16px; }
.msg.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.msg.typing i:nth-child(2) { animation-delay: .2s; } .msg.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 0; }
.chat-suggestion {
  border: 1px solid var(--border); background: var(--surface); border-radius: 20px;
  font-size: 12px; padding: 6px 12px; color: var(--ink-2); transition: all .15s;
}
.chat-suggestion:hover { border-color: var(--seq-450); color: var(--seq-550); background: rgba(42,120,214,.05); }
.chat-input-row { display: flex; gap: 9px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.chat-input {
  flex: 1; border: 1px solid var(--border); border-radius: 11px; padding: 11px 14px;
  outline: none; font-size: 13.5px; background: var(--surface);
}
.chat-input:focus { border-color: var(--seq-450); box-shadow: 0 0 0 3px rgba(42,120,214,.12); }
.chat-send {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 11px; border: none; background: var(--brand);
  color: #fff; display: grid; place-items: center;
}
.chat-send svg { width: 17px; height: 17px; fill: currentColor; }
.chat-send:hover { background: #333330; }
.mic-btn { background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); }
.mic-btn:hover { background: var(--surface-2); }

/* ═══ Evaluar ═══ */
.matrix { overflow-x: auto; }
.matrix table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.matrix th {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-3);
  font-weight: 600; padding: 8px 6px; text-align: center; max-width: 86px; line-height: 1.3; vertical-align: bottom;
}
.matrix th:first-child { text-align: left; padding-left: 4px; }
.matrix td { padding: 6px; text-align: center; border-top: 1px solid var(--border-soft); }
.matrix td:first-child { text-align: left; padding-left: 4px; }
.matrix tbody tr { cursor: pointer; transition: background .12s; }
.matrix tbody tr:hover { background: var(--surface-2); }
.matrix tbody tr.selected { background: rgba(42,120,214,.07); }
.level-cell {
  width: 34px; height: 26px; border-radius: 6px; display: inline-grid; place-items: center;
  font-weight: 700; font-size: 11.5px; color: #fff;
}
.level-0 { background: var(--surface-2); border: 1px dashed var(--baseline); color: var(--ink-3); }
.level-1 { background: var(--seq-250); color: var(--ink); }
.level-2 { background: var(--seq-350); color: #fff; }
.level-3 { background: var(--seq-450); }
.level-4 { background: var(--seq-550); }
.matrix-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; font-size: 11.5px; color: var(--ink-2); align-items: center; }
.matrix-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.matrix-legend .sw { width: 16px; height: 12px; border-radius: 4px; display: inline-block; }

/* ═══ Certificar ═══ */
.passport-head {
  display: flex; gap: 18px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--border-soft); margin-bottom: 16px;
}
.passport-head .avatar { width: 54px; height: 54px; font-size: 18px; }
.passport-id { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }

.cert-row { display: flex; align-items: center; gap: 13px; padding: 12px 4px; border-bottom: 1px solid var(--border-soft); }
.cert-row:last-child { border-bottom: none; }
.cert-icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.cert-icon svg { width: 18px; height: 18px; }
.cert-icon.ok { background: rgba(12,163,12,.1); } .cert-icon.ok svg { fill: var(--ok-text); }
.cert-icon.warn { background: rgba(250,178,25,.16); } .cert-icon.warn svg { fill: var(--warn-text); }
.cert-icon.off { background: var(--surface-2); } .cert-icon.off svg { fill: var(--ink-3); }
.cert-body { flex: 1; min-width: 0; line-height: 1.3; }
.cert-body strong { font-size: 13px; display: block; }
.cert-body span { font-size: 11.5px; color: var(--ink-3); }

/* Certificado (documento) */
.certificate {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 26px 28px; position: relative; overflow: hidden;
}
.certificate::before {
  content: ""; position: absolute; inset: 8px; border: 1.5px solid rgba(237,161,0,.35); border-radius: 8px; pointer-events: none;
}
.cert-brand { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.cert-title { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: var(--ink-3); font-weight: 700; }
.cert-name { font-size: 21px; font-weight: 800; margin: 4px 0 2px; }
.cert-detail { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.cert-footer { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 22px; gap: 14px; }
.cert-sign { font-size: 11px; color: var(--ink-3); line-height: 1.5; }
.cert-sign strong { display: block; color: var(--ink); font-size: 12px; }
.cert-hash { font-family: var(--mono); font-size: 10px; color: var(--ink-3); margin-top: 10px; }
.qr { image-rendering: pixelated; border-radius: 6px; }

/* Timeline auditoría */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--grid); border-radius: 2px; }
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--surface); border: 2.5px solid var(--seq-450);
}
.tl-item.ok::before { border-color: var(--ok); }
.tl-item.warn::before { border-color: var(--warn); }
.tl-when { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tl-what { font-size: 13px; font-weight: 600; }
.tl-detail { font-size: 12px; color: var(--ink-2); }
.tl-hash { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }

/* ═══ Cobertura del reto ═══ */
.coverage-block { display: flex; gap: 16px; align-items: flex-start; padding: 16px 0; border-bottom: 1px solid var(--border-soft); }
.coverage-block:last-child { border-bottom: none; }
.coverage-num {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; background: var(--brand); color: var(--accent);
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.coverage-body { flex: 1; }
.coverage-body h3 { font-size: 14px; margin-bottom: 3px; }
.coverage-body p { font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.coverage-items { display: flex; flex-wrap: wrap; gap: 6px; }
.cov-item {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500;
  background: rgba(12,163,12,.07); color: var(--ok-text); border: 1px solid rgba(12,163,12,.2);
  border-radius: 7px; padding: 3px 9px;
}
.cov-item svg { width: 11px; height: 11px; fill: currentColor; }
.cov-link { font-size: 12px; font-weight: 600; color: var(--seq-550); text-decoration: none; }
.cov-link:hover { text-decoration: underline; }

.criteria-bar { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.criteria-name { width: 300px; flex-shrink: 0; font-size: 12.5px; font-weight: 600; }
.criteria-track { flex: 1; height: 18px; background: var(--surface-2); border-radius: 5px; position: relative; overflow: hidden; }
.criteria-fill { height: 100%; background: var(--seq-450); border-radius: 5px 4px 4px 5px; }
.criteria-pct { width: 42px; text-align: right; font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ═══ Toasts ═══ */
.toast-region { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  background: var(--brand); color: #fff; border-radius: 11px; padding: 13px 17px; font-size: 13px;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; max-width: 360px;
  animation: toastIn .35s cubic-bezier(.2,.8,.2,1);
}
.toast svg { width: 17px; height: 17px; fill: var(--accent); flex-shrink: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.toast.leaving { opacity: 0; transition: opacity .3s; }

/* Actividad */
.activity-row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); align-items: flex-start; }
.activity-row:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.activity-body { flex: 1; font-size: 13px; line-height: 1.4; }
.activity-body span { display: block; font-size: 11.5px; color: var(--ink-3); }

/* Empty state / hint */
.hint {
  background: rgba(42,120,214,.06); border: 1px solid rgba(42,120,214,.18);
  border-radius: 10px; padding: 12px 15px; font-size: 12.5px; color: var(--seq-550);
  display: flex; gap: 9px; align-items: flex-start; line-height: 1.5;
}
.hint svg { width: 15px; height: 15px; fill: currentColor; flex-shrink: 0; margin-top: 1px; }

.section-title { font-size: 16px; font-weight: 800; letter-spacing: -.2px; margin: 26px 0 12px; }
.section-title:first-child { margin-top: 0; }

/* Scrollbars sutiles */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d4d3cb; border-radius: 6px; border: 2.5px solid var(--page); }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .searchbox { display: none; }
  .content { padding: 20px 16px 48px; }
}
