/* GMAO EXTRUPOL — estetica Apple + cientifica empresarial
   Hereda paleta y tipografia de los otros proyectos (tuneles-europa, aditivos-hormigon). */

:root {
  --ink-900:#0a0a0a; --ink-800:#171717; --ink-700:#262626; --ink-600:#404040;
  --ink-500:#525252; --ink-400:#737373; --ink-300:#a3a3a3; --ink-200:#d4d4d4;
  --ink-100:#e7e5e4; --ink-50:#f5f5f4;
  --navy:#0f1a4d; --navy-2:#1e3a8a; --navy-light:#1e40af;
  --paper:#ffffff; --paper-tint:#fafaf9; --paper-cool:#f8fafc;
  --ok:#15803d; --ok-bg:#f0fdf4; --ok-border:#bbf7d0;
  --warn:#a16207; --warn-bg:#fefce8; --warn-border:#fde68a;
  --bad:#991b1b; --bad-bg:#fef2f2; --bad-border:#fecaca;
  --info:#1e40af; --info-bg:#eff6ff; --info-border:#bfdbfe;
  --orange:#c2410c; --orange-bg:#fff7ed; --orange-border:#fed7aa;
  --teal:#0d9488; --teal-bg:#f0fdfa;
  --purple:#7c3aed; --purple-bg:#f5f3ff;
  font-family:'Inter var','Inter',system-ui,-apple-system,sans-serif;
  font-feature-settings:'cv11','ss01','cv02';
}
* { box-sizing: border-box; }
body { background: linear-gradient(180deg, var(--paper-cool) 0%, var(--paper-tint) 240px); color: var(--ink-900); -webkit-font-smoothing: antialiased; margin:0; min-height:100vh; }
h1,h2,h3,h4 { letter-spacing:-0.018em; margin:0; }
.mono,.num { font-family:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-variant-numeric: tabular-nums; }
a { text-decoration:none; color: var(--navy-light); }
a:hover { text-decoration: underline; }

/* ────────── Navbar ────────── */
.navbar { background: var(--paper); border-bottom: 1px solid var(--ink-100); position: sticky; top:0; z-index:100; box-shadow: 0 1px 0 rgba(0,0,0,.02); }
.navbar-inner { max-width:1400px; margin:0 auto; padding: 0 1rem; display:flex; align-items:center; justify-content: space-between; }
.navbar-brand { display:flex; align-items:center; gap:.7rem; padding:.65rem 0; color: var(--ink-900); }
.navbar-brand:hover { text-decoration: none; }
.navbar-logo { width:30px; height:30px; border-radius:7px; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); color:#fff; display:grid; place-items:center; font-size:11px; font-weight:700; letter-spacing:-.02em; }
.navbar-title { font-size:15px; font-weight:600; letter-spacing:-.01em; line-height:1.1; }
.navbar-sub { font-size:11px; color: var(--ink-500); margin-top:1px; }
.navbar-nav { display:flex; align-items:center; gap:.15rem; flex-wrap:wrap; }
.navbar-link { display:inline-flex; align-items:center; gap:.35rem; padding:.5rem .85rem; font-size:.83rem; color:var(--ink-600); border-radius:8px; transition: all .15s; }
.navbar-link:hover { color: var(--ink-900); background: var(--ink-50); text-decoration: none; }
.navbar-link.active { color: var(--navy); background: var(--info-bg); font-weight:600; }
.navbar-user { font-size:.78rem; color: var(--ink-600); padding:.4rem .65rem; border-left:1px solid var(--ink-100); margin-left:.4rem; display:flex; align-items:center; gap:.5rem; }
.role-badge { display:inline-block; font-size:.62rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; padding:.12rem .4rem; border-radius:4px; }
.role-superuser { background:#eef2ff; color: var(--navy); }
.role-mecanico  { background: var(--ok-bg); color: var(--ok); }
.role-invitado  { background: var(--ink-50); color: var(--ink-600); }

main { max-width: 1400px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }

.page-head { display:flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.45rem; font-weight: 700; letter-spacing:-.018em; }
.page-head .sub { font-size:.82rem; color: var(--ink-500); margin-top:.15rem; }

/* ────────── Metricas top ────────── */
.metric-bar { display:grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 1.2rem; }
.metric { background:#fff; padding: 1rem 1.1rem; border-radius: 12px; border:1px solid var(--ink-100); box-shadow: 0 1px 2px rgba(0,0,0,.02); position:relative; overflow:hidden; transition: transform .12s, box-shadow .15s; }
.metric:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.05); }
.metric-label { font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.1em; color: var(--ink-500); margin-bottom:.35rem; }
.metric-value { font-family:'JetBrains Mono',monospace; font-variant-numeric: tabular-nums; font-size:1.75rem; font-weight:600; color: var(--ink-900); line-height:1; }
.metric-sub { font-size:.7rem; color: var(--ink-500); margin-top:.4rem; }
.metric::before { content:''; position:absolute; top:0; left:0; width:3px; height:100%; background: var(--ink-200); }
.metric.warn::before { background: var(--warn); } .metric.warn .metric-value { color: var(--warn); }
.metric.ok::before   { background: var(--ok);   } .metric.ok   .metric-value { color: var(--ok); }
.metric.bad::before  { background: var(--bad);  } .metric.bad  .metric-value { color: var(--bad); }
.metric.info::before { background: var(--info); } .metric.info .metric-value { color: var(--info); }
.metric.orange::before { background: var(--orange); } .metric.orange .metric-value { color: var(--orange); }

/* ────────── Panels y cards ────────── */
.panel { background:#fff; border:1px solid var(--ink-100); border-radius:12px; box-shadow: 0 1px 2px rgba(0,0,0,.02); padding: 1.1rem 1.15rem; }
.panel + .panel { margin-top: 1rem; }
.panel-head { display:flex; align-items:center; justify-content: space-between; margin-bottom:.85rem; gap: .65rem; flex-wrap:wrap; }
.panel-head h2 { font-size: 1rem; font-weight: 700; }
.panel-soft { background: var(--paper-tint); border:1px solid var(--ink-100); border-radius:12px; padding: 1rem; }
.card { background:#fff; border:1px solid var(--ink-100); border-radius:12px; box-shadow: 0 1px 2px rgba(0,0,0,.02); padding: 1rem 1.1rem; transition: transform .12s, box-shadow .15s; }
.card:hover { box-shadow: 0 5px 14px rgba(0,0,0,.05); transform: translateY(-1px); }
.grid { display:grid; gap: 12px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.eyebrow { font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:.12em; color: var(--ink-500); }
.muted { color: var(--ink-500); }
.muted-2 { color: var(--ink-400); }

/* ────────── Tags / chips ────────── */
.tag { display:inline-flex; align-items:center; gap:.3rem; padding:.18rem .55rem; border-radius:5px; font-size:.7rem; font-weight:600; line-height:1.2; }
.tag-default { background: var(--ink-50); color: var(--ink-700); border:1px solid var(--ink-100); }
.tag-ok   { background: var(--ok-bg);   color: var(--ok);   border:1px solid var(--ok-border); }
.tag-warn { background: var(--warn-bg); color: var(--warn); border:1px solid var(--warn-border); }
.tag-bad  { background: var(--bad-bg);  color: var(--bad);  border:1px solid var(--bad-border); }
.tag-info { background: var(--info-bg); color: var(--info); border:1px solid var(--info-border); }
.tag-orange { background: var(--orange-bg); color: var(--orange); border:1px solid var(--orange-border); }
.tag-purple { background: var(--purple-bg); color: var(--purple); border:1px solid #ddd6fe; }

.crit-alta  { background: var(--bad-bg); color: var(--bad); border:1px solid var(--bad-border); }
.crit-media { background: var(--warn-bg); color: var(--warn); border:1px solid var(--warn-border); }
.crit-baja  { background: var(--ok-bg); color: var(--ok); border:1px solid var(--ok-border); }

.estado-pendiente  { background: var(--warn-bg);  color: var(--warn);  border:1px solid var(--warn-border); }
.estado-en_proceso { background: var(--info-bg);  color: var(--info);  border:1px solid var(--info-border); }
.estado-completada { background: var(--ok-bg);    color: var(--ok);    border:1px solid var(--ok-border); }
.estado-cancelada  { background: var(--ink-50);   color: var(--ink-500); border:1px solid var(--ink-100); }

.sev-bad  { background: var(--bad-bg);  color: var(--bad);  border-left: 3px solid var(--bad); }
.sev-warn { background: var(--warn-bg); color: var(--warn); border-left: 3px solid var(--warn); }
.sev-info { background: var(--info-bg); color: var(--info); border-left: 3px solid var(--info); }

/* ────────── Botones ────────── */
.button { display:inline-flex; align-items:center; gap:.4rem; padding:.5rem .95rem; border-radius:8px; font-size:.82rem; font-weight:500; transition: all .12s ease; white-space:nowrap; line-height:1; cursor:pointer; border:1px solid transparent; }
.button-primary { background: var(--navy); color:#fff; }
.button-primary:hover { background: var(--ink-900); transform: translateY(-1px); text-decoration:none; color:#fff; }
.button-soft { background:#fff; color: var(--ink-900); border:1px solid var(--ink-200); }
.button-soft:hover { background: var(--ink-50); border-color: var(--ink-300); text-decoration:none; color: var(--ink-900); }
.button-ghost { background:transparent; color: var(--ink-700); }
.button-ghost:hover { background: var(--ink-50); text-decoration:none; }
.button-ok { background: var(--ok); color:#fff; }
.button-ok:hover { background:#166534; color:#fff; text-decoration:none; }
.button-bad { background: var(--bad); color:#fff; }
.button-bad:hover { background:#7f1d1d; color:#fff; text-decoration:none; }
.button-xs { padding:.32rem .65rem; font-size:.72rem; }
.button-lg { padding:.7rem 1.2rem; font-size:.95rem; }
.button:disabled { opacity:.55; cursor: not-allowed; }

/* ────────── Form ────────── */
.field { display:flex; flex-direction: column; gap:.3rem; margin-bottom: .85rem; }
.field label { font-size:.75rem; font-weight:600; color: var(--ink-700); text-transform: uppercase; letter-spacing:.06em; }
.field .hint { font-size:.7rem; color: var(--ink-500); }
.input, .select, textarea.input { font-size:.88rem; padding:.55rem .7rem; border:1px solid var(--ink-200); border-radius:7px; background:#fff; color: var(--ink-900); outline:none; transition: all .12s; width:100%; font-family: inherit; }
textarea.input { min-height: 90px; resize: vertical; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(15,26,77,.08); }
.field-row { display:grid; gap:.75rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-actions { display:flex; gap:.5rem; flex-wrap:wrap; margin-top: 1rem; padding-top: .85rem; border-top: 1px solid var(--ink-100); }

/* ────────── Toolbar ────────── */
.toolbar { display:flex; align-items:center; gap:.55rem; flex-wrap:wrap; padding:.7rem .85rem; background:#fff; border:1px solid var(--ink-100); border-radius:12px; margin-bottom: .75rem; box-shadow: 0 1px 2px rgba(0,0,0,.02); }
.toolbar .toolbar-count { margin-left:auto; font-size:.78rem; color: var(--ink-500); font-family:'JetBrains Mono',monospace; }
.toolbar form { display:flex; gap:.5rem; align-items:center; flex-wrap:wrap; }

/* ────────── Tabla densa ────────── */
.tbl-wrap { overflow-x:auto; border:1px solid var(--ink-100); border-radius:12px; background:#fff; box-shadow: 0 1px 2px rgba(0,0,0,.02); }
.tbl { width:100%; border-collapse: collapse; font-size:.82rem; background:#fff; }
.tbl th { text-align:left; font-weight:700; color: var(--ink-700); font-size:.66rem; text-transform:uppercase; letter-spacing:.07em; padding:.55rem .65rem; border-bottom:2px solid var(--ink-200); background: var(--paper-tint); white-space: nowrap; }
.tbl td { padding:.55rem .65rem; border-bottom:1px solid var(--ink-100); vertical-align: top; }
.tbl tbody tr:hover td { background:#fffbeb; }
.tbl .col-num { text-align:right; font-family:'JetBrains Mono',monospace; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .col-mono { font-family:'JetBrains Mono',monospace; font-size:.72rem; white-space: nowrap; }
.tbl-empty { padding: 2.5rem 1rem; text-align: center; color: var(--ink-500); font-size:.85rem; }

/* ────────── Login ────────── */
.login-wrap { min-height: 100vh; display:flex; align-items:center; justify-content:center; padding: 1.5rem; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 60%, var(--ink-900) 100%); }
.login-card { width: 100%; max-width: 420px; background:#fff; border-radius:18px; padding: 2.2rem 2rem; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.login-card .logo { width: 56px; height:56px; border-radius:14px; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); color:#fff; display:grid; place-items:center; font-weight:700; font-size: 16px; margin-bottom: 1rem; }
.login-card h1 { font-size: 1.5rem; font-weight: 700; letter-spacing:-.02em; }
.login-card .sub { color: var(--ink-500); font-size:.88rem; margin-top:.25rem; margin-bottom: 1.5rem; }
.login-card .error { background: var(--bad-bg); color: var(--bad); border:1px solid var(--bad-border); padding:.55rem .75rem; border-radius:8px; font-size:.78rem; margin-bottom: .9rem; }
.login-demo { margin-top: 1.2rem; padding-top: 1rem; border-top:1px solid var(--ink-100); font-size:.74rem; color: var(--ink-500); }
.login-demo .mono { color: var(--ink-700); }

/* ────────── Arbol componentes ────────── */
.tree { font-size: .85rem; }
.tree ul { list-style: none; padding-left: 1.2rem; margin: .25rem 0; border-left:1px dashed var(--ink-200); }
.tree li { padding: .3rem 0; position: relative; }
.tree-node { display:flex; align-items:center; gap:.5rem; }
.tree-bullet { display:inline-block; width:8px; height:8px; border-radius:50%; background: var(--ink-300); }
.tree-bullet.crit-alta  { background: var(--bad); }
.tree-bullet.crit-media { background: var(--warn); }
.tree-bullet.crit-baja  { background: var(--ok); }
.tree-name { font-weight: 500; color: var(--ink-900); }
.tree-code { font-family:'JetBrains Mono',monospace; font-size:.72rem; color: var(--ink-500); }

/* ────────── Alertas ────────── */
.alerta { display:flex; align-items: flex-start; gap:.6rem; padding:.7rem .85rem; border-radius:8px; margin-bottom:.45rem; background:#fff; border:1px solid var(--ink-100); font-size:.85rem; }
.alerta.sev-bad  { background: var(--bad-bg);  border-color: var(--bad-border); }
.alerta.sev-warn { background: var(--warn-bg); border-color: var(--warn-border); }
.alerta.sev-info { background: var(--info-bg); border-color: var(--info-border); }
.alerta .icon { font-weight: 700; font-size: 1rem; line-height: 1; padding-top: 2px; }
.alerta.sev-bad .icon  { color: var(--bad); }
.alerta.sev-warn .icon { color: var(--warn); }
.alerta.sev-info .icon { color: var(--info); }
.alerta .body { flex:1; }
.alerta .meta { font-size:.7rem; color: var(--ink-500); margin-top: .15rem; font-family:'JetBrains Mono',monospace; }

/* ────────── QR ────────── */
.qr-block { display:flex; flex-direction: column; align-items:center; padding: 1rem; background:#fff; border:1px solid var(--ink-100); border-radius:12px; }
.qr-block img { width: 220px; height: 220px; }
.qr-block .codigo { font-family:'JetBrains Mono',monospace; font-size:.85rem; margin-top:.55rem; color: var(--ink-700); }

.qr-scanner-wrap { max-width: 560px; margin: 0 auto; }
#qr-reader { width: 100%; border-radius: 12px; overflow: hidden; border:1px solid var(--ink-100); }

/* ────────── Layouts ────────── */
.split { display:grid; gap: 1rem; grid-template-columns: 2fr 1fr; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

/* ────────── Movil ────────── */
@media (max-width: 700px) {
  main { padding: .9rem .7rem 4rem; }
  .navbar-inner { padding: 0 .7rem; }
  .navbar-brand { padding:.55rem 0; }
  .navbar-title { font-size: 13px; }
  .navbar-sub { display: none; }
  .page-head h1 { font-size: 1.18rem; }
  .metric { padding: .8rem .9rem; }
  .metric-value { font-size: 1.35rem; }
  .panel { padding: .85rem .9rem; }
  .tbl { font-size: .76rem; }
  .navbar-user { font-size: .72rem; padding:.3rem .45rem; }
  .navbar-link { padding:.4rem .55rem; font-size:.78rem; }
  /* FAB escaneo */
  .fab-scan { position: fixed; bottom: 18px; right: 18px; z-index: 200; background: var(--navy); color:#fff; border-radius: 50%; width: 60px; height: 60px; display:grid; place-items:center; font-size: 26px; box-shadow: 0 10px 24px rgba(15,26,77,.35); }
  .fab-scan:hover { color:#fff; text-decoration:none; }
}

.fab-scan { display:none; }
@media (max-width: 700px) { .fab-scan { display:grid; } }

/* Footer */
.app-footer { max-width: 1400px; margin: 0 auto; padding: 1.5rem 1rem 2rem; font-size: .72rem; color: var(--ink-500); border-top: 1px solid var(--ink-100); margin-top: 2rem; display:flex; justify-content: space-between; flex-wrap: wrap; gap:.5rem; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display:flex; gap:.55rem; align-items: center; padding:.4rem .55rem; border-radius: 7px; }
.checklist li:hover { background: var(--ink-50); }
.checklist input[type=checkbox] { accent-color: var(--navy); width: 16px; height: 16px; }

.kv { display:grid; grid-template-columns: 130px 1fr; gap: .35rem .8rem; font-size: .85rem; }
.kv dt { color: var(--ink-500); font-size: .78rem; }
.kv dd { margin: 0; color: var(--ink-900); }

/* ─── Quick links del dashboard ──────────────────────────────────── */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 1.4rem;
}
@media (max-width: 500px) {
  .quick-links { grid-template-columns: 1fr 1fr; gap: 8px; }
  .quick-link { padding: .75rem .8rem; gap: .55rem; }
  .quick-link-icon { width: 36px; height: 36px; }
  .quick-link-title { font-size: .85rem; }
  .quick-link-sub { display: none; }
}
.quick-link {
  display: flex; align-items: center; gap: .85rem;
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  color: var(--ink-900);
  transition: all .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,.02);
}
.quick-link:hover {
  transform: translateY(-1px);
  border-color: var(--navy);
  box-shadow: 0 6px 16px rgba(15,26,77,.08);
  text-decoration: none;
  color: var(--ink-900);
}
.quick-link-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--info-bg);
  color: var(--navy);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.quick-link-title { font-weight: 600; font-size: .95rem; }
.quick-link-sub { font-size: .76rem; color: var(--ink-500); margin-top: .15rem; }

.notif-row {
  display: flex; align-items: center; gap: .55rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--ink-100);
  font-size: .85rem;
}
.notif-row:last-child { border-bottom: none; }
.notif-meta {
  margin-left: auto;
  font-size: .72rem;
  text-align: right;
  white-space: nowrap;
}

/* ─── Perfil del mecánico: KPIs por periodo ───────────────────────── */
.kpi-periodos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 1.5rem;
}
@media (max-width: 900px) { .kpi-periodos { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .kpi-periodos { grid-template-columns: 1fr 1fr; gap: 8px; } }

.kpi-periodo {
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.kpi-periodo::before {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 3px;
  background: var(--info);
}
.kpi-periodo-strong { background: linear-gradient(180deg, #fff 0%, var(--info-bg) 100%); }
.kpi-periodo-strong::before {
  background: linear-gradient(90deg, var(--info), #60a5fa, var(--info));
  background-size: 200% 100%;
  animation: cr-shimmer 3s linear infinite;
}
.kpi-periodo-label {
  font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-500);
}
.kpi-periodo-num {
  font-size: 2rem; font-weight: 800;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  line-height: 1;
  margin-top: .35rem;
}
.kpi-periodo-strong .kpi-periodo-num { color: var(--info); }
.kpi-periodo-unit {
  font-size: .85rem; font-weight: 500;
  color: var(--ink-500);
  margin-left: .15rem;
}
.kpi-periodo-sub {
  font-size: .72rem;
  color: var(--ink-500);
  margin-top: .35rem;
}

/* ─── Split de 3 columnas para análisis ───────────────────────────── */
.split-3 {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 1.4rem;
}
@media (max-width: 1100px) { .split-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px)  { .split-3 { grid-template-columns: 1fr; } }

/* ─── Bars list (tiempo por máquina) ──────────────────────────────── */
.bars-list { display: flex; flex-direction: column; gap: .75rem; }
.bar-row {}
.bar-row-head {
  display: flex; align-items: baseline; gap: .25rem; flex-wrap: wrap;
  font-size: .82rem; color: var(--ink-700);
  margin-bottom: .3rem;
}
.bar-row-num {
  margin-left: auto;
  font-size: .75rem;
  font-weight: 600;
  color: var(--ink-900);
}
.bar-track {
  height: 12px;
  background: var(--ink-50);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--ink-100);
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-light) 60%, #60a5fa 100%);
  border-radius: 5px;
  box-shadow: 0 0 8px rgba(30,64,175,.2);
  transition: width .4s ease;
}

/* ─── Distribución preventiva/correctiva ──────────────────────────── */
.dist-bar { margin-bottom: 1rem; }
.dist-bar-track {
  display: flex;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--ink-50);
  border: 1px solid var(--ink-100);
}
.dist-bar-prev { background: linear-gradient(90deg, #1e40af, #3b82f6); }
.dist-bar-corr { background: linear-gradient(90deg, #dc2626, #ef4444); }
.dist-bar-legend {
  display: flex; flex-wrap: wrap; gap: 1rem;
  margin-top: .55rem;
  font-size: .82rem;
  color: var(--ink-700);
}
.dist-bar-legend strong { color: var(--ink-900); }
.dist-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  vertical-align: middle; margin-right: .3rem;
}
.dist-dot-prev { background: #3b82f6; }
.dist-dot-corr { background: #ef4444; }

/* Comparativa */
.comparativa {
  padding-top: .9rem;
  margin-top: .9rem;
  border-top: 1px solid var(--ink-100);
}
.comparativa-label {
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-500);
  margin-bottom: .55rem;
}
.comparativa-vals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
}
.comparativa-vals > div {
  display: flex; flex-direction: column;
  gap: .15rem;
  padding: .55rem .65rem;
  background: var(--paper-tint);
  border-radius: 8px;
  border: 1px solid var(--ink-100);
}
.comparativa-titulo {
  font-size: .58rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-500);
}
.comparativa-vals strong { font-size: 1.1rem; color: var(--ink-900); }
.comparativa-diff-ok { color: var(--ok); }
.comparativa-diff-bad { color: var(--bad); }

/* ─── Sugerencias ─────────────────────────────────────────────────── */
.sugerencias { display: flex; flex-direction: column; gap: .55rem; }
.sugerencia {
  display: flex; gap: .65rem;
  padding: .7rem .85rem;
  border-radius: 8px;
  border-left: 3px solid var(--ink-200);
  background: var(--paper-tint);
}
.sugerencia-positivo { border-left-color: var(--ok); background: var(--ok-bg); }
.sugerencia-atencion { border-left-color: var(--warn); background: var(--warn-bg); }
.sugerencia-info     { border-left-color: var(--info); background: var(--info-bg); }
.sugerencia-icon { flex-shrink: 0; padding-top: 1px; }
.sugerencia-positivo .sugerencia-icon { color: var(--ok); }
.sugerencia-atencion .sugerencia-icon { color: var(--warn); }
.sugerencia-info     .sugerencia-icon { color: var(--info); }
.sugerencia-titulo {
  font-size: .85rem;
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: .2rem;
}
.sugerencia-texto {
  font-size: .82rem;
  color: var(--ink-700);
  line-height: 1.4;
}

/* ═══ ANÁLISIS DE COSTES — rediseño ═══ */

/* Hero */
.costes-hero {
  background: linear-gradient(135deg, #0B2545 0%, #1E3A8A 50%, #0B2545 100%);
  color: #fff;
  padding: 2rem 2rem 1.8rem;
  border-radius: 16px;
  margin-bottom: 1.4rem;
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 1.5rem;
  flex-wrap: wrap;
  box-shadow: 0 10px 30px rgba(11, 37, 69, 0.25);
  position: relative;
  overflow: hidden;
}
.costes-hero::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 50%; height: 100%;
  background: radial-gradient(circle at top right, rgba(217, 119, 6, 0.15) 0%, transparent 60%);
  pointer-events: none;
}
.costes-hero > div { position: relative; z-index: 1; }
.costes-hero-eyebrow {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em;
  color: rgba(255,255,255,.7);
}
.costes-hero-num {
  font-size: 3.8rem; font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.025em;
  line-height: 1;
  color: #fff;
  margin-top: .5rem;
}
.costes-hero-unit { font-size: 1.6rem; font-weight: 500; color: rgba(255,255,255,.7); }
.costes-hero-sub {
  font-size: .9rem;
  color: rgba(255,255,255,.85);
  margin-top: .55rem;
}
.costes-hero-actions {
  display: flex; flex-direction: column; gap: .55rem;
  align-items: flex-end;
}
.costes-periodo {
  display: flex; gap: 2px;
  background: rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 3px;
}
.costes-periodo-btn {
  padding: .4rem .85rem;
  font-size: .8rem; font-weight: 600;
  color: rgba(255,255,255,.85);
  border-radius: 6px;
  transition: all .12s;
}
.costes-periodo-btn:hover { background: rgba(255,255,255,.15); text-decoration: none; color: #fff; }
.costes-periodo-btn.active { background: #fff; color: #0B2545; }

@media (max-width: 700px) {
  .costes-hero { padding: 1.4rem 1.3rem; }
  .costes-hero-num { font-size: 2.8rem; }
  .costes-hero-actions { width: 100%; align-items: flex-start; }
}

/* Hipótesis */
.costes-hipotesis {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  margin-bottom: 1.4rem;
  overflow: hidden;
}
.costes-hipotesis > summary {
  list-style: none;
  cursor: pointer;
  padding: .8rem 1.1rem;
  display: flex; align-items: center; gap: .55rem;
  color: #92400e;
}
.costes-hipotesis > summary::-webkit-details-marker { display: none; }
.costes-hipotesis > summary::after {
  content: '⌄'; margin-left: auto; font-size: 1rem; color: #92400e;
  transition: transform .15s;
}
.costes-hipotesis[open] > summary::after { transform: rotate(180deg); }
.costes-hipotesis-body {
  padding: 0 1.1rem 1.1rem;
  border-top: 1px solid #fde68a;
  padding-top: .85rem;
  background: #fff;
}
.costes-hipotesis-body p { font-size: .9rem; color: var(--ink-700); margin: 0 0 .65rem; }
.costes-formula {
  display: flex; align-items: center; gap: .35rem;
  flex-wrap: wrap;
  padding: .55rem; margin: .65rem 0;
  background: var(--paper-tint);
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .85rem;
}
.costes-formula-chunk {
  padding: .22rem .55rem; border-radius: 5px; font-weight: 600;
}
.costes-formula-chunk.repuestos  { background: #dbeafe; color: #1d4ed8; }
.costes-formula-chunk.mano-obra  { background: #fef3c7; color: #b45309; }
.costes-formula-chunk.paro       { background: #fee2e2; color: #b91c1c; }
.costes-formula-chunk.total      { background: #0B2545; color: #fff; }
.costes-formula-op { color: var(--ink-500); font-weight: 700; }
.costes-hipotesis-aviso {
  display: flex; align-items: center; gap: .45rem;
  margin-top: .7rem; padding: .65rem .85rem;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  font-size: .85rem;
  color: #991b1b;
  flex-wrap: wrap;
}

/* Composición */
.costes-section { margin-bottom: 1.4rem; }
.costes-section-title {
  display: flex; align-items: center; gap: .4rem;
  font-size: 1.05rem; font-weight: 700;
  color: var(--ink-900);
  margin-bottom: .85rem;
}
.costes-comp { margin-bottom: 1.4rem; }
.costes-comp-bar {
  display: flex;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--ink-200);
  margin-bottom: .9rem;
}
.costes-comp-seg {
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: .82rem; font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  transition: width .4s;
}
.seg-rep  { background: linear-gradient(90deg, #1e40af, #3b82f6); }
.seg-mano { background: linear-gradient(90deg, #d97706, #f59e0b); }
.seg-paro { background: linear-gradient(90deg, #b91c1c, #dc2626); }

.costes-comp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 700px) { .costes-comp-grid { grid-template-columns: 1fr; } }
.costes-comp-card {
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  position: relative;
  overflow: hidden;
}
.costes-comp-card::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 100%; height: 4px;
}
.seg-rep-card::before  { background: linear-gradient(90deg, #1e40af, #3b82f6); }
.seg-mano-card::before { background: linear-gradient(90deg, #d97706, #f59e0b); }
.seg-paro-card::before { background: linear-gradient(90deg, #b91c1c, #dc2626); }
.costes-comp-card-label {
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-500);
}
.costes-comp-card-num {
  font-size: 2rem; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  color: var(--ink-900);
  margin-top: .35rem;
}
.seg-rep-card  .costes-comp-card-num { color: #1d4ed8; }
.seg-mano-card .costes-comp-card-num { color: #b45309; }
.seg-paro-card .costes-comp-card-num { color: #b91c1c; }
.costes-comp-card-num span { font-size: .9rem; font-weight: 500; color: var(--ink-500); }
.costes-comp-card-sub { font-size: .76rem; color: var(--ink-500); margin-top: .35rem; }

.costes-treemap-panel { padding: 1.1rem 1.2rem 1rem; }

/* Top 5 máquinas */
.costes-top-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.costes-top-card {
  display: flex; gap: .8rem;
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
  transition: all .15s;
}
.costes-top-card:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.06); border-color: var(--navy); }
.costes-top-rank {
  position: absolute; top: .55rem; right: .8rem;
  font-size: 1.4rem; font-weight: 800;
  color: var(--ink-200);
  font-family: 'JetBrains Mono', monospace;
}
.costes-top-svg { flex-shrink: 0; padding-top: .15rem; }
.costes-top-codigo { font-size: .9rem; font-weight: 700; color: var(--ink-900); }
.costes-top-nombre { font-size: .8rem; color: var(--ink-500); margin-top: .15rem; }
.costes-top-coste {
  font-size: 1.6rem; font-weight: 800;
  color: #0B2545;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  margin-top: .55rem;
  line-height: 1;
}
.costes-top-pct { font-size: .72rem; color: var(--ink-500); margin-top: .35rem; }
.costes-top-mini {
  display: flex;
  margin-top: .65rem;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}
.mini-rep  { background: linear-gradient(90deg, #1e40af, #3b82f6); }
.mini-mano { background: linear-gradient(90deg, #d97706, #f59e0b); }
.mini-paro { background: linear-gradient(90deg, #b91c1c, #dc2626); }
.costes-top-warn {
  margin-top: .55rem; padding: .3rem .55rem;
  background: #fef2f2; border: 1px solid #fca5a5;
  border-radius: 5px;
  font-size: .7rem; color: #b91c1c; font-weight: 600;
  display: inline-flex; align-items: center; gap: .25rem;
}

/* Comparativa por familia */
.costes-fam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 14px;
}
.costes-fam-card {
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.costes-fam-card.fam-atencion { border-left: 4px solid #B91C1C; }
.costes-fam-card.fam-info     { border-left: 4px solid #0B2545; }
.costes-fam-card.fam-positivo { border-left: 4px solid #15803D; }
.costes-fam-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: .85rem;
}
.costes-fam-codigo { font-weight: 700; font-size: 1rem; color: var(--ink-900); }
.costes-fam-subtitle { font-size: .76rem; color: var(--ink-500); margin-top: .1rem; }
.costes-fam-ratio {
  font-size: 1.5rem; font-weight: 800;
  color: var(--ink-700);
  font-variant-numeric: tabular-nums;
}
.fam-atencion .costes-fam-ratio { color: #B91C1C; }
.fam-positivo .costes-fam-ratio { color: #15803D; }

.costes-vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: .55rem;
  align-items: stretch;
  margin-bottom: .9rem;
}
.costes-vs-side {
  padding: .65rem .8rem;
  border-radius: 8px;
  text-align: center;
}
.costes-vs-good { background: #f0fdf4; border: 1px solid #bbf7d0; }
.costes-vs-bad  { background: #fef2f2; border: 1px solid #fca5a5; }
.costes-vs-label {
  font-size: .58rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  display: inline-flex; align-items: center; gap: .25rem;
}
.costes-vs-good .costes-vs-label { color: #15803D; }
.costes-vs-bad  .costes-vs-label { color: #B91C1C; }
.costes-vs-codigo {
  display: block; margin-top: .25rem;
  font-weight: 700; font-size: .88rem;
}
.costes-vs-good .costes-vs-codigo { color: #15803D; }
.costes-vs-bad  .costes-vs-codigo { color: #B91C1C; }
.costes-vs-num {
  font-size: 1.35rem; font-weight: 700; margin-top: .25rem;
  font-variant-numeric: tabular-nums;
}
.costes-vs-sub { font-size: .68rem; color: var(--ink-500); margin-top: .15rem; }
.costes-vs-arrow {
  display: grid; place-items: center;
  font-size: .65rem; font-weight: 700;
  color: var(--ink-400);
  text-transform: uppercase;
  letter-spacing: .12em;
}

.costes-fam-reco {
  display: flex; gap: .55rem;
  padding: .65rem .8rem;
  border-radius: 8px;
}
.reco-atencion { background: #fef3c7; border: 1px solid #fde68a; }
.reco-info     { background: #eff6ff; border: 1px solid #bfdbfe; }
.reco-positivo { background: #f0fdf4; border: 1px solid #bbf7d0; }
.costes-fam-reco-icon { flex-shrink: 0; padding-top: 1px; }
.reco-atencion .costes-fam-reco-icon { color: #b45309; }
.reco-info     .costes-fam-reco-icon { color: var(--navy); }
.reco-positivo .costes-fam-reco-icon { color: #15803D; }
.costes-fam-reco-titulo { font-weight: 700; font-size: .82rem; color: var(--ink-900); margin-bottom: .15rem; }
.costes-fam-reco-texto { font-size: .8rem; color: var(--ink-700); line-height: 1.4; }

.costes-fam-detalle {
  margin-top: .8rem;
  padding-top: .8rem;
  border-top: 1px solid var(--ink-100);
}
.costes-fam-detalle > summary {
  cursor: pointer;
  font-size: .78rem;
  color: var(--ink-600);
  list-style: none;
  padding: .25rem 0;
}
.costes-fam-detalle > summary::after {
  content: ' ▾'; color: var(--ink-400);
}
.costes-fam-detalle[open] > summary::after { content: ' ▴'; }
.costes-fam-list { margin-top: .55rem; }
.costes-fam-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: .6rem;
  align-items: center;
  padding: .35rem .55rem;
  border-radius: 5px;
}
.costes-fam-row.row-caro { background: #fef2f2; }
.costes-fam-row.row-barato { background: #f0fdf4; }

/* Formulario admin parametros */
.form-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 700px) { .form-2col { grid-template-columns: 1fr; } }
.familia-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}
.familia-form {
  display: grid;
  grid-template-columns: 80px 1fr auto auto;
  gap: .35rem;
  align-items: center;
  padding: .4rem .55rem;
  background: var(--paper-tint);
  border-radius: 6px;
}
.familia-codigo { font-weight: 700; font-size: .82rem; color: var(--ink-900); }

/* Caja fórmula admin */
.formula-box {
  display: flex; flex-direction: column;
  gap: .35rem;
  padding: .85rem 1rem;
  background: #fff;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
}
.formula-row { display: flex; gap: .85rem; padding: .25rem 0; }
.formula-label {
  flex: 0 0 200px;
  font-weight: 600; color: var(--ink-700);
  font-family: 'Inter', sans-serif;
}
.formula-formula { font-size: .85rem; color: var(--ink-900); }
.formula-total { border-top: 1px solid var(--ink-100); margin-top: .35rem; padding-top: .65rem; font-weight: 700; }
.formula-total .formula-formula { color: #0B2545; font-weight: 700; }

/* ─── KPIs de costes (paleta EXTRUPOL) — legacy, mantenido por si se usa en otras vistas ─ */
.kpi-costes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 1.4rem;
}
@media (max-width: 900px) { .kpi-costes { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .kpi-costes { grid-template-columns: 1fr 1fr; gap: 8px; } }

.kpi-coste {
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.kpi-coste::before {
  content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
}
.kpi-coste-total::before     { background: #0B2545; }
.kpi-coste-repuestos::before { background: #0B2545; }
.kpi-coste-mano::before      { background: #D97706; }
.kpi-coste-paro::before      { background: #B91C1C; }

.kpi-coste-label {
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-500);
}
.kpi-coste-num {
  font-size: 1.85rem; font-weight: 800;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  line-height: 1;
  margin-top: .4rem;
}
.kpi-coste-total .kpi-coste-num     { color: #0B2545; }
.kpi-coste-repuestos .kpi-coste-num { color: #0B2545; }
.kpi-coste-mano .kpi-coste-num      { color: #D97706; }
.kpi-coste-paro .kpi-coste-num      { color: #B91C1C; }
.kpi-coste-unit { font-size: .9rem; font-weight: 600; color: var(--ink-500); }
.kpi-coste-sub {
  font-size: .74rem;
  color: var(--ink-500);
  margin-top: .4rem;
}

/* ─── Comparativa entre máquinas (familia) ────────────────────────── */
.comp-fam {
  border: 1px solid var(--ink-100);
  border-radius: 10px;
  padding: .85rem 1rem 1rem;
  margin-bottom: 1rem;
  background: var(--paper-tint);
}
.comp-fam-head { margin-bottom: .55rem; }
.comp-fam-head h3 {
  font-size: 1rem; font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink-900);
}

.comp-table {
  display: flex; flex-direction: column;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--ink-100);
}
.comp-row {
  display: grid;
  grid-template-columns: 2fr .7fr 1fr 1fr 1fr 1fr 1fr 1.1fr;
  gap: .55rem;
  padding: .55rem .7rem;
  font-size: .82rem;
  align-items: center;
  border-bottom: 1px solid var(--ink-100);
}
.comp-row:last-child { border-bottom: none; }
.comp-row-head {
  background: var(--paper-tint);
  font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-500);
}
.comp-row-caro { background: #fff5f5; border-left: 3px solid #B91C1C; }
.comp-row-barato { background: #f0fdf4; border-left: 3px solid #15803D; }
.comp-row .mono { text-align: right; font-variant-numeric: tabular-nums; }
.comp-row > div:first-child .mono { text-align: left; }
.comp-total { font-weight: 700; color: var(--ink-900); }
.comp-row-caro .comp-total   { color: #B91C1C; }
.comp-row-barato .comp-total { color: #15803D; }

/* ─── Workflows: listado de mecánicos ─────────────────────────────── */
.wf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.wf-card {
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  display: flex; flex-direction: column;
  gap: .65rem;
  color: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
  transition: all .15s;
}
.wf-card:hover {
  transform: translateY(-2px);
  border-color: #0B2545;
  box-shadow: 0 8px 20px rgba(11,37,69,.08);
  text-decoration: none;
}
.wf-card-head { display: flex; align-items: center; gap: .65rem; }
.wf-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0B2545 0%, #1e3a8a 100%);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
}
.wf-name { font-weight: 700; font-size: 1rem; color: var(--ink-900); }
.wf-username { font-size: .72rem; color: var(--ink-500); margin-top: .05rem; }
.wf-status {
  margin-left: auto;
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .25rem .5rem;
  border-radius: 12px;
  display: inline-flex; align-items: center; gap: .25rem;
}
.wf-status-active { background: #fef2f2; color: #b91c1c; border: 1px solid #fca5a5; }
.wf-status-idle   { background: var(--ink-50); color: var(--ink-500); border: 1px solid var(--ink-200); }

.wf-card-now {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: .55rem .7rem;
}

.wf-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .35rem;
  padding: .55rem 0;
  border-top: 1px solid var(--ink-100);
  border-bottom: 1px solid var(--ink-100);
}
.wf-card-stats > div { text-align: center; }
.wf-stat-num {
  font-size: 1.4rem; font-weight: 700;
  color: var(--ink-900);
  line-height: 1;
}
.wf-stat-label {
  font-size: .6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-500);
  margin-top: .25rem;
}

.wf-card-alerts {
  display: flex; align-items: center; gap: .35rem;
  font-size: .8rem;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: .35rem .55rem;
  font-weight: 600;
}
.wf-card-ok {
  display: flex; align-items: center; gap: .35rem;
  font-size: .8rem; color: var(--ok);
}

.wf-card-cta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .75rem;
  text-transform: uppercase; letter-spacing: .07em; font-weight: 700;
  color: var(--navy-light);
  padding-top: .35rem;
}

/* ─── Workflow detalle: alertas ───────────────────────────────────── */
.wf-alert {
  display: flex; gap: .65rem;
  padding: .55rem .7rem;
  background: #fff;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  margin-bottom: .35rem;
}
.wf-alert-no_vista     { border-left: 3px solid #B91C1C; }
.wf-alert-no_empezada  { border-left: 3px solid #D97706; }
.wf-alert-preventiva_vencida { border-left: 3px solid #B91C1C; }
.wf-alert-icon { color: #B91C1C; flex-shrink: 0; padding-top: 1px; }
.wf-alert-text { font-size: .9rem; color: var(--ink-900); font-weight: 500; }
.wf-alert-link { color: var(--navy-light); font-weight: 600; }

/* ─── Workflow detalle: timeline ──────────────────────────────────── */
.wf-timeline {
  position: relative;
  padding-left: 0;
}
.wf-timeline-section {
  margin: 1rem 0 .4rem;
  padding: .55rem .7rem;
  background: var(--paper-tint);
  border-radius: 8px;
  font-size: .88rem;
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  border-left: 3px solid #0B2545;
}
.wf-event {
  display: grid;
  grid-template-columns: 90px 14px 1fr;
  gap: .55rem;
  align-items: center;
  padding: .4rem 0 .4rem 1rem;
  position: relative;
}
.wf-event::before {
  content: '';
  position: absolute;
  left: 105px;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--ink-100);
}
.wf-event-ts {
  font-size: .76rem;
  color: var(--ink-500);
  text-align: right;
  white-space: nowrap;
}
.wf-event-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--ink-300);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--ink-200);
  z-index: 1;
}
.wf-event-vista     .wf-event-dot { background: #64748b; }
.wf-event-empezada  .wf-event-dot { background: #D97706; box-shadow: 0 0 0 3px #fef3c7; }
.wf-event-checklist .wf-event-dot { background: #15803D; }
.wf-event-consumo   .wf-event-dot { background: #6366F1; }
.wf-event-firmada   .wf-event-dot { background: #a855f7; }
.wf-event-cerrada   .wf-event-dot { background: #15803D; box-shadow: 0 0 0 3px #dcfce7; }
.wf-event-titulo {
  font-size: .85rem;
  color: var(--ink-700);
  display: flex; align-items: center; gap: .4rem;
}

.mermaid-wrap {
  background: var(--paper-tint);
  padding: 1rem;
  border-radius: 10px;
  overflow-x: auto;
  border: 1px solid var(--ink-100);
}
.mermaid { font-family: 'Inter', sans-serif; }

/* ─── Workflow: resumen narrativo ─────────────────────────────────── */
.wf-summary {
  display: flex; gap: 1rem;
  background: linear-gradient(135deg, #fff 0%, var(--paper-tint) 100%);
  border: 1px solid var(--ink-100);
  border-radius: 14px;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.03);
}
.wf-summary-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0B2545 0%, #1E3A8A 100%);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 1.3rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(11,37,69,.2);
}
.wf-summary-body { flex: 1; min-width: 0; }
.wf-summary-text {
  font-size: 1.05rem;
  color: var(--ink-700);
  line-height: 1.5;
  margin: 0;
}
.wf-summary-text strong { color: var(--ink-900); font-weight: 700; }
.wf-summary-now {
  display: flex; align-items: center; gap: .55rem;
  margin-top: .75rem;
  padding: .65rem .85rem;
  border-radius: 8px;
  font-size: .88rem;
  flex-wrap: wrap;
}
.wf-summary-now-activo {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}
.wf-summary-now-activo .ico { color: #B91C1C; }
.wf-summary-now-pausa {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}
.wf-summary-now-pausa .ico { color: #D97706; }

@media (max-width: 600px) {
  .wf-summary { flex-direction: column; }
  .wf-summary-avatar { width: 48px; height: 48px; font-size: 1.15rem; }
  .wf-summary-text { font-size: .95rem; }
}

/* Workflow alerts panel */
.wf-alerts-panel {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.2rem;
  border-left: 4px solid #B91C1C;
}
.wf-alerts-title {
  display: flex; align-items: center; gap: .4rem;
  font-size: 1rem; font-weight: 700;
  color: #991b1b;
  margin-bottom: .65rem;
}

@media (max-width: 700px) {
  .wf-event { grid-template-columns: 70px 14px 1fr; padding-left: .5rem; }
  .wf-event::before { left: 85px; }
  .wf-event-ts { font-size: .68rem; }
}

@media (max-width: 900px) {
  .comp-row { grid-template-columns: 1fr 1fr; }
  .comp-row-head { display: none; }
  .comp-row > div::before {
    content: attr(data-label); display: block;
    font-size: .58rem; font-weight: 700; color: var(--ink-500);
    text-transform: uppercase; letter-spacing: .06em;
    margin-bottom: .1rem;
  }
}


/* ╔══════════════════════════════════════════════════════════════════════════╗
   ║  VISTA MECANICO — tile-based, gigante, friendly al movil                ║
   ╚══════════════════════════════════════════════════════════════════════════╝ */

.m-body { background: linear-gradient(180deg, #f1f5f9 0%, #fafaf9 320px); min-height: 100vh; padding-bottom: 5rem; }

/* ─── Navbar mecanico ─── */
.m-navbar { position: sticky; top: 0; z-index: 100; background: #fff; border-bottom: 1px solid var(--ink-100);
  display: flex; align-items: center; justify-content: space-between; padding: .55rem 1rem;
  box-shadow: 0 1px 0 rgba(0,0,0,.02); }
.m-navbar-brand { display:flex; align-items:center; gap:.65rem; color: var(--ink-900); }
.m-navbar-brand:hover { text-decoration: none; }
.m-navbar-logo { width: 38px; height: 38px; border-radius: 9px; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 800; letter-spacing: -.02em; }
.m-navbar-title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.m-navbar-sub { font-size: 12px; color: var(--ink-500); margin-top: 1px; }
.m-navbar-actions { display: flex; align-items: center; gap: .25rem; }
.m-navbar-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: transparent; color: var(--ink-700); font-size: 18px; border: 1px solid transparent; cursor: pointer; transition: all .12s; }
.m-navbar-btn:hover { background: var(--ink-50); border-color: var(--ink-100); text-decoration: none; }

.m-main { max-width: 980px; margin: 0 auto; padding: 1rem 1rem 2rem; }

/* ─── Crumb ─── */
.m-crumb { display: flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--ink-600); margin-bottom: 1rem; flex-wrap: wrap; }
.m-crumb a { color: var(--navy-light); }
.m-crumb strong { color: var(--ink-900); }
.m-crumb span { color: var(--ink-400); }

.m-section { margin-bottom: 1.5rem; }
.m-section-head { display: flex; align-items: center; justify-content: space-between; padding: 0 .25rem .55rem; }
.m-section-head h2 { font-size: .95rem; font-weight: 700; color: var(--ink-700); letter-spacing: -.01em; }

/* ─── Banner machine/nave ─── */
.m-banner { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem; background: #fff; border-radius: 14px; border: 1px solid var(--ink-100); box-shadow: 0 2px 6px rgba(0,0,0,.03); position: relative; overflow: hidden; margin-bottom: 1.2rem; }
.m-banner::before { content: ''; position: absolute; top: 0; left: 0; width: 5px; height: 100%; background: var(--tile-color, var(--navy)); }
.m-banner-icon { font-size: 2.5rem; line-height: 1; flex-shrink: 0; width: 60px; height: 60px; display: grid; place-items: center; background: color-mix(in srgb, var(--tile-color, var(--navy)) 12%, white); border-radius: 14px; }
.m-banner-title { font-size: 1.15rem; font-weight: 700; color: var(--ink-900); letter-spacing: -.01em; line-height: 1.2; }
.m-banner-sub { font-size: .82rem; color: var(--ink-500); margin-top: .2rem; }

/* ─── Tiles (grid de cajas) ─── */
.m-grid { display: grid; gap: 14px; }
.m-grid-3 { grid-template-columns: repeat(3, 1fr); }
.m-grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 700px) {
  .m-grid-3 { grid-template-columns: 1fr; }
  .m-grid-2 { grid-template-columns: 1fr; }
}

.m-tile { position: relative; background: #fff; border: 1px solid var(--ink-100); border-radius: 16px;
  padding: 1.2rem 1.1rem 1rem; box-shadow: 0 1px 2px rgba(0,0,0,.03);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  display: flex; flex-direction: column; color: inherit; overflow: hidden; }
.m-tile:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.07); text-decoration: none; border-color: color-mix(in srgb, var(--tile-color, var(--ink-300)) 40%, var(--ink-200)); }
.m-tile::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: var(--tile-color, var(--ink-300)); }

.m-tile-icon { font-size: 2.4rem; line-height: 1; }
.m-tile-icon-xl { font-size: 3.6rem; line-height: 1; margin-bottom: .55rem; }
.m-tile-code { font-family: 'JetBrains Mono', monospace; font-size: .8rem; color: var(--tile-color, var(--ink-500)); font-weight: 700; margin-top: .55rem; }
.m-tile-num { font-family: 'JetBrains Mono', monospace; font-size: 1.6rem; font-weight: 700; color: var(--tile-color, var(--ink-900)); line-height: 1; margin-top: .25rem; }
.m-tile-title { font-size: 1rem; font-weight: 700; color: var(--ink-900); letter-spacing: -.01em; margin-top: .25rem; line-height: 1.2; }
.m-tile-title-big { font-size: 1.3rem; }
.m-tile-sub { font-size: .8rem; color: var(--ink-500); margin-top: .2rem; }
.m-tile-foot { margin-top: auto; padding-top: .8rem; display: flex; flex-wrap: wrap; gap: .3rem; }
.m-tile-badge { margin-top: .9rem; align-self: flex-start; padding: .35rem .65rem; border-radius: 6px; font-size: .78rem; font-weight: 600; }
.m-tile-badge-ok   { background: var(--ok-bg);   color: var(--ok);   border: 1px solid var(--ok-border); }
.m-tile-badge-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.m-tile-badge-bad  { background: var(--bad-bg);  color: var(--bad);  border: 1px solid var(--bad-border); }

.m-tile-xl { min-height: 220px; padding: 1.6rem 1.4rem 1.3rem; align-items: flex-start; }
.m-tile-action { min-height: 200px; align-items: center; text-align: center; padding: 1.4rem 1rem; }
.m-tile-action .m-tile-icon-xl { font-size: 4.5rem; }
.m-tile-blue { --tile-color: #1e40af; }
.m-tile-blue .m-tile-icon-xl { color: #1e40af; }
.m-tile-red  { --tile-color: #dc2626; }
.m-tile-red  .m-tile-icon-xl { color: #dc2626; }

.m-tile-machine { min-height: 175px; width: 220px; flex: 0 0 220px; }
.m-tile-mine { box-shadow: 0 0 0 2px rgba(15,128,61,.18), 0 1px 2px rgba(0,0,0,.04); }

/* ─── Flow horizontal (causalidad: maquinas en línea de produccion) ─── */
.m-flow { display: flex; gap: 8px; align-items: center; overflow-x: auto; padding: .5rem .25rem 1rem; }
.m-flow > .m-tile { flex-shrink: 0; }
.m-flow-arrow { font-size: 1.8rem; color: var(--ink-300); flex-shrink: 0; padding: 0 .15rem; line-height: 1; user-select: none; }
@media (max-width: 700px) {
  .m-flow { flex-direction: column; align-items: stretch; }
  .m-flow > .m-tile { width: 100%; flex: 1; }
  .m-flow-arrow { transform: rotate(90deg); }
}

/* ─── Pills (badges pequeñas) ─── */
.m-pill { display: inline-flex; align-items: center; gap: .25rem; padding: .2rem .55rem; border-radius: 5px; font-size: .72rem; font-weight: 600; }
.m-pill-ok   { background: var(--ok-bg);   color: var(--ok);   border: 1px solid var(--ok-border); }
.m-pill-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.m-pill-bad  { background: var(--bad-bg);  color: var(--bad);  border: 1px solid var(--bad-border); }
.m-pill-info { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); }
.m-pill-crit-alta  { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-border); }
.m-pill-crit-media { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.m-pill-crit-baja  { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-border); }

/* ─── Listas (OTs, repuestos) ─── */
.m-list { display: flex; flex-direction: column; gap: 8px; }
.m-list-item { display: flex; align-items: center; gap: .85rem; background: #fff; border: 1px solid var(--ink-100); border-radius: 12px; padding: .85rem 1rem; color: inherit; transition: all .12s; box-shadow: 0 1px 2px rgba(0,0,0,.02); }
.m-list-item:hover { border-color: var(--ink-200); transform: translateX(2px); box-shadow: 0 3px 8px rgba(0,0,0,.04); text-decoration: none; }
.m-list-item-lg { padding: 1rem 1.1rem; }
.m-list-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; color: #fff; background: var(--ink-500); flex-shrink: 0; }
.m-list-icon-info { background: var(--info); }
.m-list-icon-warn { background: var(--warn); }
.m-list-icon-bad  { background: var(--bad); }
.m-list-body { flex: 1; min-width: 0; }
.m-list-title { font-size: .95rem; font-weight: 600; color: var(--ink-900); line-height: 1.25; }
.m-list-sub { font-size: .78rem; color: var(--ink-500); margin-top: .2rem; }
.m-list-meta { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; }
.m-list-arrow { color: var(--ink-300); font-size: 1.6rem; line-height: 1; padding-left: .25rem; }
.m-list-more { justify-content: center; color: var(--navy-light); font-weight: 600; padding: .75rem; background: var(--info-bg); border-color: var(--info-border); }

/* ─── Cards ─── */
.m-card { background: #fff; border: 1px solid var(--ink-100); border-radius: 14px; padding: 1.1rem 1.2rem; box-shadow: 0 1px 2px rgba(0,0,0,.02); }
.m-card-summary { display: flex; align-items: center; cursor: pointer; padding: .85rem 1rem; list-style: none; user-select: none; }
.m-card-summary::-webkit-details-marker { display: none; }
.m-card-summary::after { content: '⌄'; margin-left: auto; font-size: 1.4rem; color: var(--ink-400); transition: transform .15s; }
details[open] .m-card-summary::after { transform: rotate(180deg); }
details.m-card { padding: 0; overflow: hidden; }
details.m-card[open] .m-form { padding: 0 1.2rem 1.2rem; }
details.m-card:not([open]) .m-form { padding: 0 1.2rem; }

/* ─── Form (campos, inputs, textarea, select) ─── */
.m-form { display: flex; flex-direction: column; gap: .85rem; }
.m-field { display: flex; flex-direction: column; gap: .4rem; }
.m-field > span { font-size: .78rem; font-weight: 700; color: var(--ink-700); text-transform: uppercase; letter-spacing: .06em; }
.m-field textarea, .m-input, .m-select { font: inherit; font-size: 1rem; padding: .75rem .85rem; border: 1.5px solid var(--ink-200); border-radius: 10px; background: #fff; color: var(--ink-900); outline: none; transition: all .12s; width: 100%; }
.m-field textarea { resize: vertical; min-height: 100px; line-height: 1.4; }
.m-field textarea:focus, .m-input:focus, .m-select:focus { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(15,26,77,.1); }
.m-hint { font-size: .72rem; color: var(--ink-500); }
.m-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 500px) { .m-field-row { grid-template-columns: 1fr; } }

/* ─── Botones gigantes ─── */
.m-btn { display: flex; align-items: center; justify-content: center; gap: .55rem; padding: .85rem 1.2rem; border-radius: 12px; font-size: 1rem; font-weight: 600; border: 1.5px solid transparent; cursor: pointer; transition: all .15s; line-height: 1.2; text-align: center; flex-direction: column; }
.m-btn:hover { transform: translateY(-2px); text-decoration: none; }
.m-btn-lg { padding: 1rem 1.4rem; font-size: 1.05rem; width: 100%; }
.m-btn-huge { padding: 1.7rem 1.5rem; font-size: 1.3rem; width: 100%; min-height: 130px; gap: .35rem; box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.m-btn-huge:hover { box-shadow: 0 10px 28px rgba(0,0,0,.15); }
.m-btn-sub { font-size: .72rem; font-weight: 500; opacity: .85; letter-spacing: .02em; }
.m-btn-blue  { background: #1e40af; color: #fff; }
.m-btn-blue:hover  { background: #1e3a8a; color: #fff; }
.m-btn-red   { background: #dc2626; color: #fff; }
.m-btn-red:hover   { background: #991b1b; color: #fff; }
.m-btn-green { background: #15803d; color: #fff; }
.m-btn-green:hover { background: #14532d; color: #fff; }
.m-btn-soft  { background: #fff; color: var(--ink-900); border: 1.5px solid var(--ink-200); }
.m-btn-soft:hover { background: var(--ink-50); border-color: var(--ink-300); color: var(--ink-900); }
.m-btn-icon { background: transparent; border: 1px solid var(--ink-200); border-radius: 8px; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; color: var(--ink-500); transition: all .12s; }
.m-btn-icon:hover { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad); }

/* ─── Timer ─── */
.m-timer { text-align: center; padding: 1.5rem 1rem; }
.m-timer-label { font-size: .8rem; font-weight: 700; color: var(--info); text-transform: uppercase; letter-spacing: .08em; }
.m-timer-since { font-size: .9rem; color: var(--ink-500); margin-top: .25rem; }
.m-timer-elapsed { font-family: 'JetBrains Mono', monospace; font-size: 3rem; font-weight: 700; color: var(--info); margin-top: .55rem; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

/* ─── Summary final (OT completada) ─── */
.m-summary-head { display: flex; align-items: center; gap: .85rem; }
.m-summary-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; font-size: 1.75rem; border: 1px solid var(--ok-border); }
.m-summary-title { font-size: 1.15rem; font-weight: 700; color: var(--ink-900); }
.m-summary-sub { font-size: .82rem; color: var(--ink-500); margin-top: .15rem; }
.m-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .65rem; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--ink-100); }
.m-kv > div { display: flex; flex-direction: column; gap: .15rem; padding: .35rem .15rem; }
.m-kv span { font-size: .68rem; color: var(--ink-500); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.m-kv strong { font-weight: 600; font-size: .9rem; }

/* ─── Empty ─── */
.m-empty { text-align: center; padding: 3rem 1rem; background: #fff; border-radius: 14px; border: 1px solid var(--ink-100); }
.m-empty-soft { padding: 1.2rem .75rem; }
.m-empty-icon { font-size: 3.5rem; line-height: 1; margin-bottom: .55rem; color: var(--ok); }
.m-empty-title { font-size: 1.1rem; font-weight: 700; color: var(--ink-900); }
.m-empty-sub { font-size: .85rem; color: var(--ink-500); margin-top: .2rem; }

/* ─── Checklist ─── */
.m-checklist { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-direction: column; gap: 4px; }
.m-checklist li { display: flex; align-items: center; gap: .65rem; padding: .55rem .65rem; border-radius: 8px; border: 1px solid var(--ink-100); background: #fff; }
.m-checklist li:hover { background: var(--ink-50); }
.m-checklist input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--ok); flex-shrink: 0; }
.m-checklist input[type=checkbox]:checked + label { color: var(--ink-400); text-decoration: line-through; }
.m-checklist label { cursor: pointer; font-size: .92rem; flex: 1; }

/* ─── FAB escaneo ─── */
.m-fab { position: fixed; right: 18px; bottom: 22px; z-index: 90; width: 64px; height: 64px; border-radius: 50%; background: var(--navy); color: #fff !important; display: grid; place-items: center; font-size: 28px; box-shadow: 0 12px 28px rgba(15,26,77,.4); transition: transform .15s; }
.m-fab:hover { transform: scale(1.08); text-decoration: none; }

/* ─── Badge stand-alone ─── */
.m-badge { display: inline-block; padding: .15rem .55rem; border-radius: 12px; font-size: .75rem; font-weight: 700; }
.m-badge-warn { background: var(--warn); color: #fff; }
.m-badge-bad  { background: var(--bad); color: #fff; }


/* ╔═══════════════════════════════════════════════════════════════════╗
   ║  EXPLORADOR (arbol desplegable + busqueda)                       ║
   ╚═══════════════════════════════════════════════════════════════════╝ */

.tree-toolbar { display: flex; align-items: center; gap: .5rem; padding: .7rem .85rem; background: #fff; border:1px solid var(--ink-100); border-radius:12px; margin-bottom:.85rem; box-shadow: 0 1px 2px rgba(0,0,0,.02); }
.tree-toolbar #tree-search { flex: 1; font-size: .95rem; padding: .65rem .85rem; border-radius: 9px; border: 1.5px solid var(--ink-200); }
.tree-toolbar #tree-search:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(15,26,77,.1); outline: none; }

.tree-explarar, .tree-explorar { font-size: .85rem; }
.tree-row, .tree-row > summary { font-family: inherit; }
.tree-row { display: block; }
.tree-row > summary { list-style: none; cursor: pointer; padding: .35rem .55rem; border-radius: 7px; display: flex; align-items: center; gap: .45rem; line-height: 1.3; user-select: none; flex-wrap: wrap; transition: background .12s; }
.tree-row > summary::-webkit-details-marker { display: none; }
.tree-row > summary:hover { background: var(--ink-50); }
.tree-row[open] > summary { background: var(--paper-tint); }

/* Caret */
.tree-caret { display: inline-block; width: 14px; text-align: center; font-size: .65rem; color: var(--ink-400); flex-shrink: 0; transition: transform .15s; }
.tree-caret::before { content: "▶"; }
.tree-row[open] > summary > .tree-caret { transform: rotate(90deg); }
.tree-row-leaf .tree-caret::before { content: ""; }
.tree-caret-empty::before { content: ""; }

.tree-icon { font-size: 1rem; flex-shrink: 0; line-height: 1; width: 18px; text-align: center; }
.tree-text { font-weight: 500; color: var(--ink-900); }
.tree-text .muted-dot { color: var(--ink-300); margin: 0 .3rem; }
.tree-row-section > summary > .tree-text { font-weight: 600; color: var(--ink-700); font-size: .8rem; }
.tree-row-section > summary > .tree-text .muted { font-weight: 400; }

.tree-row-nave    { border: 1px solid var(--ink-100); border-radius: 10px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.02); margin-bottom: .55rem; }
.tree-row-nave > summary { padding: .7rem .85rem; font-size: .95rem; background: linear-gradient(180deg, #ffffff 0%, var(--paper-tint) 100%); border-radius: 10px; }
.tree-row-nave > summary > .tree-text strong { font-size: 1.02rem; }
.tree-row-nave[open] > summary { border-bottom: 1px solid var(--ink-100); border-radius: 10px 10px 0 0; }
.tree-row-nave > .tree-children { padding: .55rem .85rem .85rem; }

.tree-row-maquina { margin: .3rem 0; }
.tree-row-maquina > summary { padding: .45rem .65rem; background: var(--paper); border: 1px solid var(--ink-100); border-radius: 8px; }
.tree-row-maquina[open] > summary { border-color: var(--ink-200); background: #fff; }
.tree-row-maquina > .tree-children { padding: .25rem .35rem .35rem 1.7rem; }

.tree-row-section { margin: .15rem 0; }
.tree-row-section > summary { padding: .3rem .55rem; }
.tree-row-section > .tree-list { margin: .15rem 0 .35rem 1.55rem; }

.tree-list { list-style: none; padding-left: 1.4rem; margin: .15rem 0; border-left: 1px dashed var(--ink-200); }
.tree-list li { padding: .25rem .15rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; line-height: 1.35; }
.tree-list li:hover { background: var(--ink-50); border-radius: 5px; }
.tree-list .tree-row { display: block; flex: 1; }
.tree-link { color: inherit; display: inline-flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.tree-link:hover { text-decoration: none; color: var(--navy); }

.tree-action { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; color: var(--ink-400); font-size: 13px; line-height: 1; margin-left: auto; }
.tree-action:hover { background: var(--ink-100); color: var(--navy); text-decoration: none; }

.tree-bullet { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-300); flex-shrink: 0; }
.tree-bullet.crit-alta  { background: var(--bad); }
.tree-bullet.crit-media { background: var(--warn); }
.tree-bullet.crit-baja  { background: var(--ok); }

.tree-svg { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex-shrink: 0; }
.tree-svg svg { display: block; }

.tree-row-comp > summary { padding: .25rem .45rem; }

.tree-row-preventiva { margin: .15rem 0; }
.tree-row-preventiva > summary { padding: .4rem .55rem; background: var(--paper-tint); border: 1px solid var(--ink-100); border-radius: 7px; }

.checklist-display { list-style: decimal inside; padding-left: 1.7rem; margin: .35rem 0; font-size: .85rem; }
.checklist-display li { padding: .2rem 0; color: var(--ink-700); }

/* ─── Checklist persistente (clicable) ──────────────────────────────── */
.m-checklist-row {
  display: flex; align-items: center; gap: .65rem;
  width: 100%;
  padding: .65rem .75rem;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  margin-bottom: .4rem;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: .92rem;
  /* iOS Safari renderiza buttons con color del sistema por defecto.
     Forzamos color oscuro explícito para que NO sea texto blanco invisible. */
  color: var(--ink-900) !important;
  -webkit-appearance: none;
  appearance: none;
  transition: all .12s;
}
.m-checklist-row:hover, .m-checklist-row:active {
  background: var(--ink-50);
  border-color: var(--ink-300);
}
.m-checklist-row.m-checklist-done {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.m-checklist-row.m-checklist-done .m-checklist-text {
  color: var(--ink-500) !important;
  text-decoration: line-through;
}
.m-checklist-box {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  border: 2px solid var(--ink-300);
  border-radius: 7px;
  background: #fff;
  font-size: 1.1rem;
  color: #15803D;
  flex-shrink: 0;
  font-weight: 700;
}
.m-checklist-row.m-checklist-done .m-checklist-box {
  background: #15803D;
  border-color: #15803D;
  color: #fff;
}
.m-checklist-text {
  flex: 1; min-width: 0;
  font-size: .94rem;
  color: var(--ink-900) !important;  /* fuerza visible en iOS */
  line-height: 1.4;
}

/* ─── Repuestos sugeridos (indispensables) ─────────────────────────── */
.m-suggested-row { display: flex; align-items: center; gap: .65rem; padding: .55rem .55rem; border-bottom: 1px solid var(--ink-100); }
.m-suggested-row:last-child { border-bottom: none; }

/* ─── Firma (canvas) ─────────────────────────────────────────────── */
.signature-wrap { border: 2px dashed var(--ink-200); border-radius: 10px; background: #fff; overflow: hidden; }
#firma-canvas { width: 100%; height: 160px; display: block; touch-action: none; cursor: crosshair; }

/* ─── Fotos adjuntas al parte de trabajo ─────────────────────────── */
.m-fotos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .55rem;
}
.m-foto-card {
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.m-foto-card img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
  background: var(--ink-50);
}
.m-foto-desc {
  font-size: .76rem;
  padding: .4rem .55rem;
  color: var(--ink-700);
  border-top: 1px solid var(--ink-100);
}
.m-foto-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding: .35rem .5rem;
  font-size: .68rem;
  color: var(--ink-500);
  border-top: 1px solid var(--ink-100);
  background: var(--paper-tint);
}
.m-foto-meta form { margin: 0; }
.m-foto-meta .m-btn-icon { width: 24px; height: 24px; font-size: .8rem; }

.tree-empty { font-size: .78rem; padding: .2rem .55rem; }

/* Filtrado por busqueda */
.tree-hidden { display: none !important; }
.tree-match { background: #fef3c7 !important; }
.tree-match.tree-row > summary,
.tree-list li.tree-match { background: #fef3c7 !important; border-radius: 6px; }

@media (max-width: 700px) {
  .tree-row-nave > summary { padding: .55rem .65rem; flex-wrap: wrap; }
  .tree-row-maquina > summary { padding: .4rem .5rem; flex-wrap: wrap; }
  .tree-list { padding-left: .9rem; }
  .tree-text { font-size: .82rem; }
}


/* ╔═══════════════════════════════════════════════════════════════════╗
   ║  PLANTILLA EN VIVO (superuser)                                   ║
   ╚═══════════════════════════════════════════════════════════════════╝ */

.plantilla-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.plantilla-card {
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 14px;
  padding: 1.05rem 1.15rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
  position: relative;
  overflow: hidden;
  transition: transform .12s, box-shadow .15s;
}
.plantilla-card:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.06); }
.plantilla-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 5px;
  background: var(--ink-300);
}
.plantilla-trabajando::before { background: var(--ok); }
.plantilla-pendiente::before  { background: var(--warn); }
.plantilla-parado::before     { background: var(--ink-300); }

.plantilla-head {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding-top: .3rem;
}
.plantilla-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  display: grid; place-items: center;
  font-size: 1.2rem; font-weight: 700;
  flex-shrink: 0;
}
.plantilla-name {
  font-size: 1.02rem; font-weight: 700;
  color: var(--ink-900);
  line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plantilla-username { font-size: .74rem; color: var(--ink-500); margin-top: .1rem; }
.plantilla-status-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(0,0,0,.04);
}
.plantilla-status-dot-trabajando {
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent);
  animation: pulse-ok 2s ease-in-out infinite;
}
.plantilla-status-dot-pendiente { background: var(--warn); }
.plantilla-status-dot-parado    { background: var(--ink-300); }

@keyframes pulse-ok {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
  50%      { box-shadow: 0 0 0 8px color-mix(in srgb, var(--ok) 8%,  transparent); }
}

.plantilla-now {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  border-radius: 10px;
  padding: .7rem .85rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.plantilla-task {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
}
.plantilla-task-code { font-weight: 700; color: var(--ok); }
.plantilla-task-where {
  font-size: .82rem;
  color: var(--ink-700);
}
.plantilla-task-desc {
  font-size: .78rem;
  color: var(--ink-600);
  margin-top: .2rem;
  line-height: 1.35;
}
.plantilla-timer {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--ok);
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  margin-top: .15rem;
}
.plantilla-timer.plantilla-timer-medium { color: var(--warn); }
.plantilla-timer.plantilla-timer-long   { color: var(--bad); }
.plantilla-timer-label { font-size: .7rem; }

.plantilla-pending-info {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 10px;
  padding: .7rem .85rem;
}
.plantilla-pending-count {
  font-size: 1.8rem; font-weight: 700; color: var(--warn);
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-top: .15rem;
}

.plantilla-idle-info {
  background: var(--ink-50);
  border: 1px solid var(--ink-100);
  border-radius: 10px;
  padding: .7rem .85rem;
}

.plantilla-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .4rem;
  padding-top: .55rem;
  border-top: 1px solid var(--ink-100);
}
.plantilla-metrics > div {
  display: flex; flex-direction: column;
  gap: .12rem;
  text-align: center;
}
.plantilla-metrics span {
  font-size: .62rem;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}
.plantilla-metrics strong {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink-900);
}

.plantilla-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: .35rem;
  padding-top: .35rem;
  border-top: 1px solid var(--ink-100);
}

/* ─── Feed de actividad ───────────────────────────────────────────── */
.feed {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.feed-row {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .55rem;
  border-radius: 7px;
  font-size: .85rem;
  border-left: 3px solid var(--ink-200);
  background: #fff;
}
.feed-row:hover { background: var(--ink-50); }
.feed-row.feed-empezada { border-left-color: var(--info); }
.feed-row.feed-cerrada  { border-left-color: var(--ok); }
.feed-row.feed-vista    { border-left-color: var(--ink-400); }
.feed-row.feed-firmada  { border-left-color: var(--purple); }
.feed-icon { font-size: 1.05rem; width: 22px; text-align: center; flex-shrink: 0; }
.feed-ts { font-size: .72rem; color: var(--ink-500); white-space: nowrap; flex-shrink: 0; min-width: 130px; }
.feed-body { font-size: .85rem; }
.feed-body a { color: var(--navy-light); }

@media (max-width: 700px) {
  .plantilla-grid { grid-template-columns: 1fr; }
  .feed-row { flex-wrap: wrap; }
  .feed-ts { min-width: auto; }
}


/* ╔══════════════════════════════════════════════════════════════════════╗
   ║  ICONOS SVG GENÉRICOS (biblioteca app/icons.py)                     ║
   ╚══════════════════════════════════════════════════════════════════════╝ */
.ico { display:inline-block; vertical-align: text-bottom; flex-shrink: 0; }
.ind-svg { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ╔══════════════════════════════════════════════════════════════════════╗
   ║  NAVBAR — dropdowns                                                  ║
   ╚══════════════════════════════════════════════════════════════════════╝ */
.navbar-link { display: inline-flex; align-items: center; gap: .4rem; }
.navbar-link .ico { color: currentColor; opacity: .85; }
.navbar-link:hover .ico { opacity: 1; }
.navbar-icon-only { padding: .5rem .65rem !important; }

.navbar-dropdown { position: relative; display: inline-block; }
.navbar-dropdown > .navbar-link {
  background: transparent;
  border: none;
  font: inherit;
  cursor: pointer;
  font-family: inherit;
}
.navbar-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 230px;
  max-width: calc(100vw - 1.5rem);
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  padding: .35rem;
  display: none;
  z-index: 1000;
  flex-direction: column;
  gap: 2px;
}
.navbar-dropdown:hover > .navbar-menu,
.navbar-dropdown:focus-within > .navbar-menu { display: flex; }

.navbar-menu-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .55rem .7rem;
  border-radius: 6px;
  color: var(--ink-700);
  font-size: .85rem;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.navbar-menu-item:hover { background: var(--ink-50); color: var(--ink-900); text-decoration: none; }
.navbar-menu-item.active { background: var(--info-bg); color: var(--navy); font-weight: 600; }
.navbar-menu-item .ico { opacity: .7; }

@media (max-width: 1024px) {
  .navbar-link { padding: .45rem .7rem; font-size: .8rem; }
  .navbar-link span { display: inline; }
}
@media (max-width: 768px) {
  .navbar-inner { padding: 0 .7rem; }
  .navbar-sub { display: none; }
  .navbar-link { padding: .42rem .55rem; font-size: .78rem; gap: .3rem; }
  .navbar-link span { display: none; }   /* solo el icono en móvil */
  .navbar-dropdown > .navbar-link span:last-child { display: none; }  /* esconder texto y chevron */
  .navbar-link[href="/"] span,
  .navbar-link[href="/escanear"] { padding: .42rem .55rem; }
  .navbar-user { font-size: .72rem; padding: .25rem .4rem; }
  .navbar-user span:first-child { display: none; }
  .navbar-menu { left: auto; right: 0; min-width: 200px; }
}


/* ╔══════════════════════════════════════════════════════════════════════╗
   ║  CONTROL ROOM (/plantilla)                                          ║
   ║  Modo claro, alta densidad visual, glows y barras animadas          ║
   ╚══════════════════════════════════════════════════════════════════════╝ */
body.cr-body {
  /* Fondo claro con halos sutiles de color para dar energía */
  background:
    radial-gradient(circle at 15% 0%, rgba(239,68,68,.05) 0, transparent 50%),
    radial-gradient(circle at 85% 100%, rgba(245,158,11,.04) 0, transparent 50%),
    linear-gradient(180deg, var(--paper-cool) 0%, var(--paper-tint) 220px);
}

.cr-wrap {
  max-width: 1500px;
  margin: 0 auto;
  padding: 1.2rem 1.2rem 3rem;
}

.cr-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
  margin-bottom: 1.2rem;
}
.cr-eyebrow {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .7rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.cr-title {
  font-size: 1.75rem; font-weight: 800; color: var(--ink-900);
  letter-spacing: -.02em;
  margin-top: .35rem;
}
.cr-sub { color: var(--ink-500); font-size: .85rem; margin-top: .2rem; }

.cr-clock {
  text-align: right;
  padding: .65rem 1rem;
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.cr-clock-label {
  font-size: .58rem; color: var(--ink-500);
  text-transform: uppercase; letter-spacing: .1em; font-weight: 600;
}
.cr-clock-time {
  font-size: 1.1rem; color: var(--ink-900); font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: .2rem;
}

/* ─── Barra de estados arriba ───────────────────────────────────── */
.cr-states {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 1.5rem;
}
@media (max-width: 1000px) { .cr-states { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px)  { .cr-states { grid-template-columns: repeat(2, 1fr); gap: 8px; } }

.cr-state {
  position: relative;
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.cr-state-num {
  font-size: 2.2rem; font-weight: 800; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--ink-900);
}
.cr-state-label {
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-500);
  margin-top: .55rem;
}
.cr-state::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 100%; height: 3px; background: var(--ink-200);
}
.cr-state-trabajando::before {
  background: linear-gradient(90deg, #fca5a5, #ef4444, #b91c1c, #ef4444, #fca5a5);
  background-size: 200% 100%;
  animation: cr-shimmer 2.2s linear infinite;
}
.cr-state-trabajando .cr-state-num { color: #dc2626; }
.cr-state-pausa::before { background: linear-gradient(90deg, #fde68a, #f59e0b, #fde68a); background-size: 200% 100%; animation: cr-shimmer 3.5s linear infinite; }
.cr-state-pausa .cr-state-num { color: #d97706; }
.cr-state-asignado::before { background: #3b82f6; }
.cr-state-asignado .cr-state-num { color: #2563eb; }
.cr-state-disponible::before { background: #22c55e; }
.cr-state-disponible .cr-state-num { color: #16a34a; }
.cr-state-inactivo::before { background: var(--ink-300); }
.cr-state-inactivo .cr-state-num { color: var(--ink-400); }
.cr-state-total::before { background: #a855f7; }

.cr-state-pulse {
  position: absolute; top: 12px; right: 12px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239,68,68,.6);
  animation: cr-pulse-red 1.6s ease-out infinite;
}
@keyframes cr-pulse-red {
  0%   { box-shadow: 0 0 0 0   rgba(239,68,68,.55); }
  70%  { box-shadow: 0 0 0 14px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0   rgba(239,68,68,0); }
}
@keyframes cr-shimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ─── Cards de mecánico ─────────────────────────────────────────── */
.cr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}
@media (max-width: 600px) {
  .cr-grid { grid-template-columns: 1fr; gap: 12px; }
}

.cr-card {
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 14px;
  padding: 0;
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: transform .15s, box-shadow .2s, border-color .2s;
}
.cr-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.07); }

/* Bandas de color y glows por estado (modo claro vibrante) */
.cr-TRABAJANDO {
  border-color: #fca5a5;
  box-shadow: 0 0 32px rgba(239,68,68,.14), 0 2px 4px rgba(0,0,0,.04);
  background: linear-gradient(180deg, #fff 0%, #fff5f5 100%);
}
.cr-TRABAJANDO::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, #fca5a5, #ef4444, #b91c1c, #ef4444, #fca5a5);
  background-size: 200% 100%;
  animation: cr-shimmer 2s linear infinite;
  z-index: 2;
}
.cr-EN_PAUSA {
  border-color: #fcd34d;
  box-shadow: 0 0 26px rgba(245,158,11,.12), 0 2px 4px rgba(0,0,0,.04);
  background: linear-gradient(180deg, #fff 0%, #fffbeb 100%);
}
.cr-EN_PAUSA::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, #fde68a, #f59e0b, #fde68a);
  background-size: 200% 100%;
  animation: cr-shimmer 3s linear infinite;
  z-index: 2;
}
.cr-ASIGNADO {
  border-color: #93c5fd;
  box-shadow: 0 2px 4px rgba(0,0,0,.04);
}
.cr-ASIGNADO::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: #3b82f6; z-index: 2;
}
.cr-DISPONIBLE {
  border-color: #86efac;
  box-shadow: 0 2px 4px rgba(0,0,0,.04);
}
.cr-DISPONIBLE::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: #22c55e; z-index: 2;
}
.cr-INACTIVO {
  background: var(--paper-tint);
  border-color: var(--ink-100);
  opacity: .82;
}
.cr-FIN_JORNADA {
  background: linear-gradient(180deg, #fff 0%, #f5f3ff 100%);
  border-color: #c4b5fd;
  box-shadow: 0 2px 4px rgba(0,0,0,.04);
}
.cr-FIN_JORNADA::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: #7c3aed; z-index: 2;
}
.cr-FIN_JORNADA .cr-badge {
  background: #ede9fe; color: #6d28d9;
  border: 1px solid #c4b5fd;
}
.cr-FIN_JORNADA .cr-avatar {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  opacity: .8;
}

.cr-finjornada-block {
  margin: .35rem 1.1rem 0;
  padding: 1.1rem;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 10px;
  text-align: center;
}
.cr-finjornada-icon { color: #7c3aed; margin-bottom: .25rem; }
.cr-finjornada-label { font-weight: 700; font-size: 1rem; color: #6d28d9; }
.cr-finjornada-sub { color: #7c3aed; font-size: .75rem; margin-top: .25rem; opacity: .8; }

.cr-state-finjornada::before { background: #7c3aed; }
.cr-state-finjornada .cr-state-num { color: #7c3aed; }

/* Badge encima del nombre */
.cr-badge {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: .35rem;
  margin: 1.05rem 1.1rem 0;
  padding: .38rem .75rem;
  border-radius: 999px;
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
  align-self: flex-start;
  width: fit-content;
}
.cr-TRABAJANDO .cr-badge {
  background: #fee2e2; color: #b91c1c;
  border: 1px solid #fca5a5;
  box-shadow: 0 0 16px rgba(239,68,68,.18);
}
.cr-EN_PAUSA .cr-badge {
  background: #fef3c7; color: #b45309;
  border: 1px solid #fcd34d;
}
.cr-ASIGNADO .cr-badge {
  background: #dbeafe; color: #1d4ed8;
  border: 1px solid #93c5fd;
}
.cr-DISPONIBLE .cr-badge {
  background: #dcfce7; color: #15803d;
  border: 1px solid #86efac;
}
.cr-INACTIVO .cr-badge {
  background: var(--ink-50); color: var(--ink-500);
  border: 1px solid var(--ink-100);
}
.cr-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444; box-shadow: 0 0 10px rgba(239,68,68,.7);
  animation: cr-dot-blink 1.2s ease-in-out infinite;
}
@keyframes cr-dot-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

/* Identidad */
.cr-identity {
  display: flex; align-items: center; gap: .7rem;
  padding: .65rem 1.1rem .35rem;
}
.cr-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  font-weight: 700; font-size: 1rem;
  letter-spacing: .04em;
  flex-shrink: 0;
}
.cr-TRABAJANDO .cr-avatar {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 0 14px rgba(239,68,68,.3);
}
.cr-EN_PAUSA .cr-avatar {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}
.cr-ASIGNADO .cr-avatar {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}
.cr-DISPONIBLE .cr-avatar {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}
.cr-INACTIVO .cr-avatar {
  background: linear-gradient(135deg, var(--ink-400) 0%, var(--ink-500) 100%);
  opacity: .6;
}
.cr-name { color: var(--ink-900); font-weight: 700; font-size: 1.02rem; line-height: 1.15; }
.cr-username { color: var(--ink-500); font-size: .74rem; margin-top: .1rem; }

/* Bloque cronómetro */
.cr-timer-block {
  margin: .35rem 1.1rem 0;
  padding: .95rem 1.1rem .85rem;
  background: #fef2f2;
  border-radius: 10px;
  border: 1px solid #fecaca;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cr-timer-block::after {
  /* línea brillante encima del bloque cronómetro para efecto "en vivo" */
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #ef4444, transparent);
  background-size: 200% 100%;
  animation: cr-shimmer 1.8s linear infinite;
}
.cr-EN_PAUSA .cr-timer-block {
  background: #fffbeb;
  border-color: #fde68a;
}
.cr-EN_PAUSA .cr-timer-block::after {
  background: linear-gradient(90deg, transparent, #f59e0b, transparent);
  background-size: 200% 100%;
  animation: cr-shimmer 3s linear infinite;
}
.cr-timer-label {
  font-size: .58rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em;
  color: #dc2626;
}
.cr-EN_PAUSA .cr-timer-label { color: #d97706; }
.cr-timer {
  font-size: 2.6rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  color: #dc2626;
  text-shadow: 0 2px 18px rgba(239,68,68,.25);
  margin: .3rem 0 .2rem;
  line-height: 1;
}
.cr-EN_PAUSA .cr-timer {
  color: #d97706;
  text-shadow: 0 2px 16px rgba(245,158,11,.25);
}
.cr-timer-since { font-size: .72rem; color: var(--ink-500); }
@media (max-width: 500px) {
  .cr-timer { font-size: 2.1rem; }
}

/* Bloque de tarea actual */
.cr-task {
  padding: .65rem 1.1rem .75rem;
  font-size: .85rem;
}
.cr-task-head {
  display: flex; align-items: center; gap: .35rem;
  flex-wrap: wrap;
  margin-bottom: .35rem;
}
.cr-task-code { color: var(--ink-900); font-weight: 700; }
.cr-task-type {
  font-size: .58rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  padding: .14rem .42rem; border-radius: 4px;
}
.cr-type-correctiva { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.cr-type-preventiva { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.cr-task-prio {
  font-size: .58rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  padding: .14rem .42rem; border-radius: 4px;
}
.cr-prio-alta  { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.cr-prio-media { background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }
.cr-prio-baja  { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.cr-task-machine { color: var(--ink-700); font-size: .82rem; }
.cr-task-desc {
  color: var(--ink-500); font-size: .8rem;
  margin-top: .35rem;
  line-height: 1.4;
}

/* Barra de progreso */
.cr-progress { margin-top: .7rem; }
.cr-progress-head {
  display: flex; justify-content: space-between;
  font-size: .68rem; color: var(--ink-500);
  margin-bottom: .3rem;
  text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
}
.cr-progress-bar {
  height: 10px;
  background: #fee2e2;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
  border: 1px solid #fecaca;
}
.cr-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #dc2626 0%, #ef4444 30%, #f87171 60%, #ef4444 100%);
  background-size: 200% 100%;
  border-radius: 4px;
  position: relative;
  transition: width .4s ease;
  animation: cr-progress-shimmer 2s linear infinite;
  box-shadow: 0 0 10px rgba(239,68,68,.4);
}
@keyframes cr-progress-shimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* Bloques alternativos por estado */
.cr-pending-block {
  margin: .35rem 1.1rem 0;
  padding: 1rem 1.1rem;
  background: #eff6ff;
  border-radius: 10px;
  border: 1px solid #bfdbfe;
  text-align: center;
}
.cr-pending-num {
  font-size: 2.4rem; color: #1d4ed8; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cr-pending-label { color: var(--ink-600); font-size: .78rem; margin-top: .25rem; }
.cr-pending-next {
  margin-top: .75rem; padding-top: .65rem;
  border-top: 1px solid #bfdbfe;
  text-align: left;
  font-size: .82rem;
  color: var(--ink-700);
}
.cr-pending-next-label {
  display: block;
  font-size: .58rem; color: var(--ink-500);
  text-transform: uppercase; letter-spacing: .1em; font-weight: 600;
  margin-bottom: .2rem;
}
.cr-pending-next-code { color: #1d4ed8; font-weight: 700; }
.cr-pending-next-machine { color: var(--ink-500); font-size: .75rem; margin-top: .2rem; }

.cr-idle-block, .cr-inactive-block {
  margin: .35rem 1.1rem 0;
  padding: 1.1rem;
  border-radius: 10px;
  text-align: center;
}
.cr-idle-block {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}
.cr-idle-icon { color: #16a34a; margin-bottom: .25rem; }
.cr-idle-label { font-weight: 700; font-size: 1rem; }
.cr-idle-sub { color: #16a34a; font-size: .75rem; margin-top: .15rem; opacity: .75; }

.cr-inactive-block {
  background: var(--paper-tint);
  border: 1px solid var(--ink-100);
}
.cr-inactive-label { color: var(--ink-600); font-weight: 600; font-size: .9rem; }
.cr-inactive-sub { color: var(--ink-500); font-size: .72rem; margin-top: .25rem; }

/* Stats inferior */
.cr-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: .35rem;
  padding: .85rem 1.1rem;
  margin-top: auto;
  border-top: 1px solid var(--ink-100);
  background: var(--paper-tint);
}
.cr-stat { text-align: center; }
.cr-stat-num {
  font-size: 1.25rem; color: var(--ink-900); font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cr-stat-unit { font-size: .72rem; font-weight: 500; color: var(--ink-500); margin-left: .15rem; }
.cr-stat-label {
  font-size: .6rem; color: var(--ink-700);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
  margin-top: .3rem;
}
.cr-stat-sub {
  font-size: .58rem; color: var(--ink-500);
  margin-top: .15rem;
}

.cr-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.1rem;
  background: var(--paper-tint);
  color: var(--ink-600);
  font-size: .75rem; font-weight: 600;
  border-top: 1px solid var(--ink-100);
  text-transform: uppercase; letter-spacing: .06em;
  transition: background .12s, color .12s;
}
.cr-link:hover { background: var(--info-bg); color: var(--navy); text-decoration: none; }
.cr-link .ico { opacity: .55; }
.cr-link:hover .ico { opacity: 1; }

/* ─── Feed de eventos ────────────────────────────────────────────── */
.cr-feed {
  margin-top: 1.5rem;
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.02);
}
.cr-feed-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .65rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--ink-100);
}

.cr-feed-row {
  display: flex; align-items: center; gap: .65rem;
  padding: .5rem .65rem;
  font-size: .85rem;
  color: var(--ink-700);
  border-radius: 7px;
  border-left: 3px solid var(--ink-200);
  background: var(--paper-tint);
  margin-bottom: 4px;
}
.cr-feed-row:hover { background: var(--ink-50); }
.cr-feed-empezada { border-left-color: #3b82f6; }
.cr-feed-cerrada  { border-left-color: #22c55e; }
.cr-feed-firmada  { border-left-color: #a855f7; }
.cr-feed-ts { font-size: .72rem; color: var(--ink-500); min-width: 130px; }
.cr-feed-icon { color: var(--ink-500); display: inline-flex; }
.cr-feed-empezada .cr-feed-icon { color: #2563eb; }
.cr-feed-cerrada  .cr-feed-icon { color: #16a34a; }
.cr-feed-firmada  .cr-feed-icon { color: #9333ea; }
.cr-feed-code { color: var(--ink-900); font-weight: 600; }
.cr-feed-machine { color: var(--ink-500); }
.cr-feed-body strong { color: var(--ink-900); }
.cr-feed-body a { color: var(--navy-light); }

/* ─── Responsive específico de Control Room ──────────────────────── */
@media (max-width: 900px) {
  .cr-wrap { padding: .9rem .8rem 2.5rem; }
  .cr-title { font-size: 1.4rem; }
  .cr-states { gap: 8px; }
  .cr-state { padding: .8rem .85rem; }
  .cr-state-num { font-size: 1.7rem; }
  .cr-state-label { font-size: .62rem; }
}
@media (max-width: 700px) {
  .cr-header { gap: .6rem; }
  .cr-clock { padding: .5rem .8rem; align-self: flex-start; }
  .cr-clock-time { font-size: .95rem; }
  .cr-timer { font-size: 2.2rem; }
  .cr-feed-row { flex-wrap: wrap; gap: .35rem; }
  .cr-feed-ts { min-width: auto; }
  .cr-pending-num { font-size: 2rem; }
}
@media (max-width: 500px) {
  .cr-wrap { padding: .75rem .6rem 2rem; }
  .cr-title { font-size: 1.2rem; }
  .cr-state { padding: .7rem .75rem; }
  .cr-state-num { font-size: 1.5rem; }
  .cr-timer { font-size: 2rem; }
  .cr-card .cr-badge { margin-top: .85rem; padding: .3rem .65rem; font-size: .62rem; }
  .cr-identity { padding: .55rem .85rem .25rem; }
  .cr-avatar { width: 40px; height: 40px; font-size: .88rem; }
  .cr-name { font-size: .95rem; }
  .cr-timer-block, .cr-pending-block, .cr-idle-block, .cr-inactive-block,
  .cr-task { padding-left: .85rem; padding-right: .85rem; }
  .cr-stats { padding: .7rem .85rem; }
  .cr-stat-num { font-size: 1.1rem; }
}

/* ═══ Badge para el navbar (solicitudes pendientes) ═══════════════════════ */
.navbar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 .35rem;
  margin-left: .25rem;
  border-radius: 9px;
  background: #B91C1C;
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}
.navbar-badge-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 .35rem;
  margin-left: auto;
  border-radius: 9px;
  background: #B91C1C;
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

/* ═══ Lista de solicitudes (página /solicitudes) ═══════════════════════════ */
.solic-tabs {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.solic-tab {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .42rem .85rem;
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  color: var(--ink-700);
  border-radius: 8px;
  font-size: .82rem;
  text-decoration: none;
  transition: all .15s;
}
.solic-tab:hover { background: var(--ink-100); }
.solic-tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.solic-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 .35rem;
  border-radius: 9px;
  background: rgba(0,0,0,.1);
  font-size: .68rem; font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.solic-tab.active .solic-tab-count { background: rgba(255,255,255,.25); }

.solic-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: start;
  padding: 1rem 1.1rem;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 12px;
  margin-bottom: .75rem;
}
.solic-card-pendiente { border-left: 4px solid #D97706; }
.solic-card-aprobada  { border-left: 4px solid #15803D; background: #f0fdf4; }
.solic-card-rechazada { border-left: 4px solid #B91C1C; background: #fef2f2; opacity: .85; }
.solic-card-recibida  { border-left: 4px solid #0B2545; background: #f8fafc; opacity: .75; }
.solic-card-cancelada { border-left: 4px solid var(--ink-300); opacity: .6; }
.solic-urg-alta  { background-color: #fef2f2 !important; }

.solic-card-urgency {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: .5rem .35rem;
  border-radius: 10px;
  background: var(--ink-50);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
}
.solic-card-urgency.solic-urg-alta { background: #fee2e2; color: #B91C1C; }
.solic-card-urgency.solic-urg-media { background: #fef3c7; color: #92400e; }
.solic-card-urgency.solic-urg-baja  { background: #dbeafe; color: #1e40af; }

.solic-card-body { min-width: 0; }
.solic-card-title { font-size: 1.02rem; font-weight: 600; margin-bottom: .15rem; }
.solic-card-meta {
  display: flex; flex-wrap: wrap; gap: .65rem .9rem;
  font-size: .78rem; color: var(--ink-500);
  margin-top: .35rem;
}
.solic-card-motivo {
  font-size: .88rem; color: var(--ink-700);
  background: var(--ink-50); padding: .55rem .75rem;
  border-radius: 8px; margin-top: .55rem;
  white-space: pre-wrap;
}
.solic-card-respuesta {
  font-size: .85rem; color: var(--ink-700);
  background: #ecfdf5; border: 1px solid #a7f3d0;
  padding: .55rem .75rem; border-radius: 8px;
  margin-top: .55rem;
}
.solic-card-actions { display: flex; flex-direction: column; gap: .4rem; min-width: 130px; }

@media (max-width: 720px) {
  .solic-card { grid-template-columns: 1fr; }
  .solic-card-urgency { flex-direction: row; min-width: 0; gap: .5rem; }
  .solic-card-actions { flex-direction: row; flex-wrap: wrap; min-width: 0; }
}

/* ═══ Documentos / manuales en repuesto_detalle ════════════════════════════ */
.doc-list { display: flex; flex-direction: column; gap: .55rem; margin-top: .5rem; }
.doc-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .8rem;
  align-items: center;
  padding: .65rem .85rem;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  transition: border-color .15s;
}
.doc-item:hover { border-color: var(--navy); }
.doc-icon {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: #fef3c7;
  color: #92400e;
  flex-shrink: 0;
}
.doc-icon.doc-icon-pdf { background: #fee2e2; color: #B91C1C; }
.doc-icon.doc-icon-img { background: #dbeafe; color: #1e40af; }
.doc-title { font-weight: 600; font-size: .92rem; }
.doc-meta  { font-size: .72rem; color: var(--ink-500); margin-top: .15rem; }
.doc-actions { display: flex; gap: .35rem; align-items: center; }

/* ═══ Timeline visual del workflow (sustituye Mermaid) ═══════════════════════ */
.wf-vtimeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: .5rem 0;
  position: relative;
}
.wf-vtimeline::before {
  content: "";
  position: absolute;
  left: 64px;
  top: 1rem;
  bottom: 1rem;
  width: 2px;
  background: linear-gradient(180deg, var(--ink-200) 0%, var(--ink-300) 50%, var(--ink-200) 100%);
  z-index: 0;
}
.wf-vtimeline-block {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 1rem;
  padding: .6rem 0;
  position: relative;
  z-index: 1;
}
.wf-vtimeline-hour {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink-700);
  position: relative;
}
.wf-vtimeline-hour .mono { color: var(--navy); }
.wf-vtimeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #0B2545;
  flex-shrink: 0;
  margin-left: auto;
  margin-right: -7px;
  box-shadow: 0 0 0 4px #fff, 0 2px 6px rgba(11, 37, 69, 0.15);
}
.wf-vtimeline-events {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.wf-vtimeline-event {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .5rem .75rem;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  font-size: .85rem;
  transition: border-color .15s, transform .15s;
}
.wf-vtimeline-event:hover {
  border-color: var(--navy);
  transform: translateX(2px);
}
.wf-vte-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink-50);
  color: var(--ink-700);
  flex-shrink: 0;
}
.wf-vte-text {
  flex: 1;
  min-width: 0;
  color: var(--ink-800);
}
.wf-vte-link {
  font-size: .75rem;
  padding: .15rem .45rem;
  background: var(--ink-50);
  border-radius: 4px;
  color: var(--ink-700);
  text-decoration: none;
  transition: background .15s;
}
.wf-vte-link:hover { background: var(--navy); color: #fff; }
.wf-vtimeline-more {
  font-size: .78rem;
  color: var(--ink-500);
  font-style: italic;
  padding: .25rem .75rem;
}
/* Tonos por tipo de evento — fondo del icono */
.wf-vte-vista .wf-vte-icon     { background: #dbeafe; color: #1e40af; }
.wf-vte-empezada .wf-vte-icon  { background: #d1fae5; color: #15803D; }
.wf-vte-checklist .wf-vte-icon { background: #ede9fe; color: #6366F1; }
.wf-vte-consumo .wf-vte-icon   { background: #fef3c7; color: #D97706; }
.wf-vte-firmada .wf-vte-icon   { background: #fce7f3; color: #be185d; }
.wf-vte-cerrada .wf-vte-icon   { background: #0B2545; color: #fff; }

@media (max-width: 720px) {
  .wf-vtimeline::before { left: 50px; }
  .wf-vtimeline-block { grid-template-columns: 60px 1fr; gap: .75rem; }
  .wf-vtimeline-hour { font-size: .78rem; }
  .wf-vtimeline-event { padding: .42rem .55rem; font-size: .8rem; }
  .wf-vte-link { font-size: .7rem; }
}

/* ═══ Bloque resumen automático del manual ═════════════════════════════════ */
.doc-resumen { margin-top: .55rem; }
.doc-resumen-state {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .76rem;
  padding: .35rem .6rem;
  border-radius: 6px;
  font-weight: 500;
}
.doc-resumen-pendiente { background: #fef3c7; color: #92400e; }
.doc-resumen-warn      { background: #fef3c7; color: #92400e; }
.doc-resumen-error     { background: #fee2e2; color: #B91C1C; }

.doc-resumen-box {
  background: var(--paper-tint, #f8fafc);
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  padding: .5rem .7rem;
  margin-top: .35rem;
}
.doc-resumen-box[open] { background: #fff; border-color: #cbd5e1; }
.doc-resumen-box summary {
  display: flex; align-items: center; gap: .5rem;
  cursor: pointer;
  font-weight: 500;
  font-size: .82rem;
  user-select: none;
  flex-wrap: wrap;
}
.doc-resumen-box summary::marker { content: ""; }
.doc-resumen-box summary::before {
  content: "▸";
  font-size: .7rem;
  color: var(--ink-500);
  transition: transform .15s;
}
.doc-resumen-box[open] summary::before { transform: rotate(90deg); display: inline-block; }
.doc-resumen-tag {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.doc-resumen-tag-heur { background: #dbeafe; color: #1e40af; }
.doc-resumen-tag-ia   { background: linear-gradient(135deg, #15803D, #0891B2); color: #fff; }

.doc-resumen-texto {
  margin-top: .55rem;
  font-size: .87rem;
  line-height: 1.5;
  color: var(--ink-800);
  white-space: pre-wrap;
  padding: .55rem .75rem;
  background: var(--paper-tint, #f8fafc);
  border-left: 3px solid #0B2545;
  border-radius: 0 6px 6px 0;
  max-height: 320px;
  overflow-y: auto;
}

/* En el móvil del mecánico — versión compacta dentro del parte */
.m-doc-resumen {
  margin-top: .35rem;
  background: #f0fdf4;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: .6rem .75rem;
  font-size: .82rem;
  line-height: 1.45;
  color: var(--ink-800);
  white-space: pre-wrap;
  max-height: 220px;
  overflow-y: auto;
}
.m-doc-resumen-head {
  display: flex; align-items: center; gap: .35rem;
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em;
  color: #065f46;
  margin-bottom: .25rem;
}

/* ═══ Markdown del resumen IA ═══════════════════════════════════════════════ */
.doc-resumen-texto h2,
.m-doc-resumen-body h2 {
  font-size: .92rem;
  font-weight: 700;
  color: #0B2545;
  margin: .65rem 0 .25rem 0;
  letter-spacing: -.01em;
}
.doc-resumen-texto h2:first-child,
.m-doc-resumen-body h2:first-child { margin-top: 0; }
.doc-resumen-texto h3,
.m-doc-resumen-body h3 {
  font-size: .82rem;
  font-weight: 600;
  color: #334155;
  margin: .55rem 0 .2rem 0;
}
.doc-resumen-texto p,
.m-doc-resumen-body p {
  margin: .25rem 0;
  line-height: 1.5;
}
.doc-resumen-texto strong,
.m-doc-resumen-body strong { color: #0B2545; font-weight: 600; }
.doc-resumen-texto ul, .doc-resumen-texto ol,
.m-doc-resumen-body ul, .m-doc-resumen-body ol {
  margin: .2rem 0 .5rem 0;
  padding-left: 1.1rem;
}
.doc-resumen-texto li,
.m-doc-resumen-body li {
  margin: .15rem 0;
  line-height: 1.45;
}
.doc-resumen-texto code,
.m-doc-resumen-body code {
  background: rgba(11, 37, 69, 0.08);
  padding: .05rem .35rem;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .85em;
}
.m-doc-resumen-body { font-size: .82rem; line-height: 1.5; }

/* ═══ Expediente OT — vista certificada ════════════════════════════════════ */
.ot-cert-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 0 1rem 0;
  margin-bottom: 1rem;
  border-bottom: 3px solid #0B2545;
  flex-wrap: wrap;
}
.ot-cert-head h1 {
  margin: .2rem 0;
  display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
  font-size: 1.8rem;
}
.ot-cert-codigo { color: #0B2545; }
.ot-cert-meta {
  font-size: .92rem;
  color: var(--ink-700);
}
.ot-cert-head-right { display: flex; gap: .5rem; }

.ot-cert-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .7rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ot-cert-pill-pendiente   { background: #fef3c7; color: #92400e; }
.ot-cert-pill-en_proceso  { background: #dbeafe; color: #1e40af; }
.ot-cert-pill-completada  { background: #d1fae5; color: #065f46; }
.ot-cert-pill-cancelada   { background: #fee2e2; color: #B91C1C; }

.ot-cert-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1.2rem;
}
.ot-cert-strip-cell {
  padding: .65rem .9rem;
  border-right: 1px solid var(--ink-100);
  border-bottom: 1px solid var(--ink-100);
}
.ot-cert-strip-cell:last-child { border-right: 0; }
.ot-cert-strip-label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-500);
  font-weight: 600;
  margin-bottom: .25rem;
}
.ot-cert-strip-value {
  font-size: .92rem;
  font-weight: 600;
  color: var(--ink-900);
}

.ot-cert-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.ot-cert-section { margin-bottom: 0; }
.ot-cert-text {
  white-space: pre-wrap;
  font-size: .95rem;
  line-height: 1.55;
  color: var(--ink-800);
}
.ot-cert-solucion {
  background: #f0fdf4;
  border-left: 3px solid #15803D;
  padding: .8rem 1rem;
  border-radius: 0 6px 6px 0;
}

.ot-cert-checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ot-cert-checklist li {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: .6rem;
  align-items: center;
  padding: .55rem 0;
  border-bottom: 1px solid var(--ink-100);
  font-size: .92rem;
}
.ot-cert-checklist li:last-child { border-bottom: 0; }
.ot-cert-cb {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1.5px solid var(--ink-300);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
}
.ot-cert-checklist li.done .ot-cert-cb {
  background: #15803D;
  border-color: #15803D;
  color: #fff;
}
.ot-cert-checklist li.done .ot-cert-cb-text {
  color: var(--ink-500);
  text-decoration: line-through;
}
.ot-cert-cb-ts {
  font-size: .7rem;
  color: var(--ink-500);
}

.ot-cert-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.ot-cert-tbl th {
  text-align: left;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-500);
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--ink-200);
}
.ot-cert-tbl td {
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--ink-100);
}
.ot-cert-tbl .num { text-align: right; }
.ot-cert-tbl-total {
  font-weight: 700;
  background: var(--ink-50);
}
.ot-cert-tbl-total td { border-bottom: 0; }

.ot-cert-fotos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.ot-cert-foto {
  margin: 0;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.ot-cert-foto:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(11, 37, 69, 0.12);
}
.ot-cert-foto img {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--ink-50);
}
.ot-cert-foto figcaption {
  padding: .55rem .7rem;
  font-size: .78rem;
}
.ot-cert-foto-desc {
  font-weight: 600;
  color: var(--ink-800);
  margin-bottom: .2rem;
}
.ot-cert-foto-meta {
  font-size: .7rem;
  color: var(--ink-500);
  font-family: 'JetBrains Mono', monospace;
}

.ot-cert-firma-panel {
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}
.ot-cert-firma {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: center;
}
.ot-cert-firma-img {
  background: #fff;
  border: 2px dashed var(--ink-200);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}
.ot-cert-firma-img img {
  max-width: 100%;
  max-height: 140px;
}
.ot-cert-firma-info {
  padding: 1rem 0;
}
.ot-cert-firma-nombre {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0B2545;
  margin-bottom: .25rem;
}

.ot-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .85rem;
}
.ot-actions-card {
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  padding: .75rem .85rem;
}
.ot-actions-card-link {
  display: block;
  text-decoration: none;
  color: var(--ink-900);
  background: #fff;
  border: 1.5px solid #0B2545;
  transition: background .15s;
}
.ot-actions-card-link:hover {
  background: #f0f7ff;
}
.ot-actions-danger { color: #B91C1C !important; }

@media (max-width: 720px) {
  .ot-cert-firma { grid-template-columns: 1fr; }
  .ot-cert-head h1 { font-size: 1.4rem; }
}

/* ═══ Libro de partes firmados (rediseño) ════════════════════════════════════ */
.libro-filtros {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.2rem;
}
.libro-filtros-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) auto;
  gap: .75rem;
  align-items: end;
}
.libro-filtros-field {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.libro-filtros-field span {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-500);
}
.libro-filtros-actions {
  display: flex;
  gap: .4rem;
  align-self: end;
  padding-bottom: .05rem;
}

.libro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1rem;
}
.libro-parte {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.libro-parte:hover {
  border-color: #0B2545;
  box-shadow: 0 8px 22px rgba(11, 37, 69, 0.10);
  transform: translateY(-2px);
}

.libro-parte-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1rem .5rem 1rem;
  border-bottom: 1px solid var(--ink-100);
}
.libro-parte-codigo {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-weight: 700;
  font-size: 1rem;
  color: #0B2545;
  margin-bottom: .25rem;
}
.libro-parte-codigo a { color: inherit; text-decoration: none; }
.libro-parte-maquina {
  font-size: .82rem;
  color: var(--ink-700);
}
.libro-parte-fecha {
  text-align: center;
  background: linear-gradient(135deg, #0B2545 0%, #1e3a5f 100%);
  color: #fff;
  padding: .4rem .7rem;
  border-radius: 8px;
  min-width: 58px;
}
.libro-parte-fecha-day {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  font-family: 'JetBrains Mono', monospace;
}
.libro-parte-fecha-mon {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: .15rem;
  opacity: .85;
}

.libro-parte-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .25rem;
  padding: .65rem 1rem;
  background: var(--ink-50);
  border-bottom: 1px solid var(--ink-100);
}
.libro-parte-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: .68rem;
  color: var(--ink-600);
}
.libro-parte-stat strong {
  font-size: .92rem;
  font-weight: 700;
  color: #0B2545;
  font-family: 'JetBrains Mono', monospace;
  margin: .15rem 0 0 0;
}
.libro-parte-stat em {
  font-style: normal;
  font-size: .65rem;
  color: var(--ink-500);
}

.libro-parte-fotos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 2px;
  background: var(--ink-100);
}
.libro-parte-foto {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--ink-100);
}
.libro-parte-foto img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
  transition: transform .2s;
}
.libro-parte-foto:hover img { transform: scale(1.08); }
.libro-parte-foto-more {
  display: flex; align-items: center; justify-content: center;
  background: #0B2545;
  color: #fff;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  font-size: .9rem;
}

.libro-parte-text {
  padding: .75rem 1rem;
  flex: 1;
  border-bottom: 1px solid var(--ink-100);
}
.libro-parte-text .eyebrow { font-size: .62rem; }
.libro-parte-text p {
  font-size: .85rem;
  line-height: 1.45;
  color: var(--ink-700);
  margin: .35rem 0 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.libro-parte-foot {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: .65rem;
  padding: .65rem 1rem;
  align-items: center;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
.libro-parte-firma {
  width: 64px;
  height: 36px;
  background: #fff;
  border: 1px dashed var(--ink-200);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.libro-parte-firma img { max-width: 100%; max-height: 100%; }
.libro-parte-firma-info { min-width: 0; }
.libro-parte-firma-quien {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 720px) {
  .libro-grid { grid-template-columns: 1fr; }
}

/* ═══ Dashboard /costes — rediseño ═════════════════════════════════════════ */
.costes-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .85rem;
  margin: 1rem 0 1.3rem 0;
}
.costes-kpi {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-left: 4px solid #0B2545;
  border-radius: 10px;
  padding: .9rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  transition: border-color .15s, box-shadow .15s;
}
.costes-kpi:hover { box-shadow: 0 4px 12px rgba(11, 37, 69, .08); }
.costes-kpi-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-500);
}
.costes-kpi-value {
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
  color: #0B2545;
  font-family: 'JetBrains Mono', monospace;
}
.costes-kpi-value span { font-size: 1.1rem; font-weight: 400; color: var(--ink-500); margin-left: .15rem; }
.costes-kpi-value .costes-kpi-divider { margin: 0 .25rem; color: var(--ink-300); }
.costes-kpi-foot {
  font-size: .72rem;
  color: var(--ink-600);
  display: flex; align-items: center; gap: .25rem;
}
.costes-kpi.kpi-ok    { border-left-color: #15803D; }
.costes-kpi.kpi-ok    .costes-kpi-value { color: #15803D; }
.costes-kpi.kpi-warn  { border-left-color: #D97706; }
.costes-kpi.kpi-warn  .costes-kpi-value { color: #D97706; }
.costes-kpi.kpi-bad   { border-left-color: #B91C1C; background: linear-gradient(135deg, #fff 0%, #fef2f2 100%); }
.costes-kpi.kpi-bad   .costes-kpi-value { color: #B91C1C; }
.costes-kpi.kpi-info  { border-left-color: #0891B2; }

.costes-dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}
@media (max-width: 960px) {
  .costes-dash-grid { grid-template-columns: 1fr; }
}
.costes-chart-card {
  margin: 0;
  display: flex;
  flex-direction: column;
}
.costes-chart-card .panel-head { padding-bottom: .25rem; }

.costes-treemap-panel {
  margin: 1rem 0;
}

/* ═══ Centro de notificaciones ════════════════════════════════════════════ */
.notif-center {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 14px;
  padding: 1.1rem 1.3rem;
  margin: 1rem 0 1.4rem 0;
  box-shadow: 0 2px 6px rgba(11, 37, 69, 0.04);
}
.notif-center-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--ink-100);
}
.notif-center-head h2 {
  display: flex; align-items: center; gap: .5rem;
  margin: 0;
  font-size: 1.1rem;
}
.notif-center-sub {
  font-size: .82rem;
  color: var(--ink-600);
  margin-top: .2rem;
}

.notif-groups {
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.notif-group {
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .15s;
}
.notif-group[open] { background: #fff; }
.notif-group-bad  { border-left: 4px solid #B91C1C; }
.notif-group-warn { border-left: 4px solid #D97706; }
.notif-group-info { border-left: 4px solid #0891B2; }
.notif-group-ok   { border-left: 4px solid #15803D; }

.notif-group-summary {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: .65rem;
  align-items: center;
  padding: .75rem 1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.notif-group-summary::-webkit-details-marker { display: none; }
.notif-group-icon {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: #fff;
  color: #0B2545;
}
.notif-group-bad .notif-group-icon  { background: #fee2e2; color: #B91C1C; }
.notif-group-warn .notif-group-icon { background: #fef3c7; color: #92400e; }
.notif-group-info .notif-group-icon { background: #dbeafe; color: #1e40af; }
.notif-group-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink-900);
}
.notif-group-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 22px;
  padding: 0 .5rem;
  border-radius: 11px;
  background: #0B2545;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.notif-group-bad  .notif-group-count { background: #B91C1C; }
.notif-group-warn .notif-group-count { background: #D97706; }
.notif-group-chevron {
  color: var(--ink-500);
  transition: transform .2s;
}
.notif-group[open] .notif-group-chevron { transform: rotate(180deg); }

.notif-group-body {
  padding: 0 .75rem .75rem .75rem;
  display: flex; flex-direction: column;
  gap: .35rem;
  border-top: 1px solid var(--ink-100);
  padding-top: .55rem;
}

.notif-item {
  display: flex;
  gap: .75rem;
  align-items: center;
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 8px;
  padding: .55rem .75rem;
  transition: border-color .15s;
}
.notif-item:hover { border-color: var(--ink-300); }
.notif-item.sev-bad { border-left: 3px solid #B91C1C; }
.notif-item.sev-warn { border-left: 3px solid #D97706; }
.notif-item.sev-info { border-left: 3px solid #0891B2; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-text {
  font-size: .88rem;
  color: var(--ink-800);
  line-height: 1.4;
}
.notif-item-meta {
  font-size: .7rem;
  color: var(--ink-500);
  margin-top: .15rem;
  font-family: 'JetBrains Mono', monospace;
}
.notif-item-actions {
  display: flex;
  gap: .3rem;
  align-items: center;
  flex-shrink: 0;
}

.notif-group-more {
  text-align: center;
  font-size: .78rem;
  color: var(--ink-500);
  font-style: italic;
  padding: .3rem;
}

.notif-empty {
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
  border: 1px solid #bbf7d0;
  border-radius: 14px;
  padding: 1.8rem 1.5rem;
  text-align: center;
  margin: 1rem 0 1.4rem 0;
}
.notif-empty-icon {
  color: #15803D;
  margin-bottom: .55rem;
}
.notif-empty-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #065f46;
}
.notif-empty-sub {
  font-size: .85rem;
  color: var(--ink-600);
  margin-top: .25rem;
}

/* Actividad reciente plegable */
.actividad-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 720px) {
  .actividad-grid { grid-template-columns: 1fr; }
}
.actividad-list {
  display: flex;
  flex-direction: column;
  margin-top: .5rem;
}
.actividad-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: .55rem;
  align-items: center;
  padding: .45rem .55rem;
  border-bottom: 1px solid var(--ink-100);
  font-size: .82rem;
  text-decoration: none;
  color: var(--ink-800);
  transition: background .15s;
}
.actividad-row:hover { background: var(--ink-50); }
.actividad-row .ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .78rem;
}
.actividad-row-by {
  font-size: .7rem;
  color: var(--ink-500);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

/* ═══ Importación masiva repuestos ═══════════════════════════════════════ */
.import-guide {
  display: flex; flex-direction: column; gap: .85rem;
  margin: 1rem 0 1.5rem 0;
}
.import-step {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 1rem;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 12px;
  padding: 1rem 1.2rem;
}
.import-step-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #0B2545; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-family: 'JetBrains Mono', monospace;
}
.import-step-title {
  font-size: 1rem; font-weight: 700; color: #0B2545;
  margin-bottom: .25rem;
}
.import-step-body p {
  margin: 0 0 .5rem 0;
  font-size: .88rem; line-height: 1.5; color: var(--ink-700);
}
.import-codes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: .5rem;
}
.import-codes-list {
  display: flex; flex-wrap: wrap; gap: .35rem;
  font-size: .75rem;
}
.import-codes-list span.mono {
  background: var(--ink-50);
  padding: .2rem .5rem;
  border-radius: 4px;
}

.import-form {
  margin-top: 1rem;
}
.import-form-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  background: var(--ink-50);
  border-radius: 8px;
  padding: 4px;
}
.import-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .55rem .85rem;
  cursor: pointer;
  border-radius: 6px;
  font-size: .85rem;
  transition: all .15s;
}
.import-tab:has(input:checked) {
  background: #fff;
  box-shadow: 0 1px 3px rgba(11, 37, 69, 0.1);
  font-weight: 600;
  color: #0B2545;
}
.import-tab input { display: none; }

.import-form-area {
  margin-bottom: 1rem;
}
.import-form-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ink-100);
  flex-wrap: wrap;
}
.import-dry {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  cursor: pointer;
  background: #fef3c7;
  padding: .55rem .85rem;
  border-radius: 8px;
  border: 1px solid #fde68a;
}

.import-result {
  background: #fff;
  border-radius: 12px;
  border: 2px solid #15803D;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.4rem;
}
.import-result.is-dry { border-color: #D97706; background: #fffbeb; }
.import-result.has-errors { border-color: #B91C1C; }
.import-result-head {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}
.import-result-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: #d1fae5;
  color: #15803D;
  flex-shrink: 0;
}
.import-result.is-dry .import-result-icon { background: #fef3c7; color: #92400e; }
.import-result.has-errors .import-result-icon { background: #fee2e2; color: #B91C1C; }
.import-result-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0B2545;
}
.import-result-sub {
  font-size: .88rem;
  color: var(--ink-700);
  margin-top: .15rem;
}
.import-errores {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ink-100);
}
.import-cambios { margin-top: 1rem; }
.import-cambios summary {
  cursor: pointer;
  font-weight: 600;
  padding: .55rem 0;
  color: #0B2545;
}

@media (max-width: 720px) {
  .import-codes-grid { grid-template-columns: 1fr; }
}

/* ═══ Vista detalle preventiva ═════════════════════════════════════════════ */
.prev-estado {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.2rem;
  align-items: center;
  padding: 1.1rem 1.3rem;
  border-radius: 12px;
  margin: 1rem 0 1.4rem 0;
  border-left: 5px solid;
}
.prev-estado-vencida {
  background: linear-gradient(135deg, #fee2e2 0%, #fff 70%);
  border-left-color: #B91C1C;
}
.prev-estado-proxima {
  background: linear-gradient(135deg, #fef3c7 0%, #fff 70%);
  border-left-color: #D97706;
}
.prev-estado-ok {
  background: linear-gradient(135deg, #d1fae5 0%, #fff 70%);
  border-left-color: #15803D;
}
.prev-estado-icon { flex-shrink: 0; }
.prev-estado-vencida .prev-estado-icon { color: #B91C1C; }
.prev-estado-proxima .prev-estado-icon { color: #D97706; }
.prev-estado-ok .prev-estado-icon { color: #15803D; }

.prev-estado-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0B2545;
  margin-bottom: .2rem;
}
.prev-estado-vencida .prev-estado-title { color: #B91C1C; }
.prev-estado-sub {
  font-size: .92rem;
  color: var(--ink-700);
}
.prev-estado-meta {
  font-size: .78rem;
  color: var(--ink-500);
  margin-top: .35rem;
}
.prev-estado-action {
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .prev-estado { grid-template-columns: 1fr; }
  .prev-estado-action { width: 100%; }
  .prev-estado-action .button { width: 100%; justify-content: center; }
}

.prev-checklist {
  padding-left: 1.4rem;
  margin: 0;
  font-size: .92rem;
  line-height: 1.6;
}
.prev-checklist li {
  padding: .35rem 0;
  border-bottom: 1px solid var(--ink-100);
}
.prev-checklist li:last-child { border-bottom: 0; }

.prev-stock-low {
  color: #B91C1C !important;
  font-weight: 700;
}

.prev-historial {
  display: flex;
  flex-direction: column;
}
.prev-historial-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: .65rem;
  align-items: center;
  padding: .55rem .65rem;
  border-bottom: 1px solid var(--ink-100);
  text-decoration: none;
  color: inherit;
  transition: background .15s;
}
.prev-historial-row:last-child { border-bottom: 0; }
.prev-historial-row:hover { background: var(--ink-50); }
.prev-historial-pill {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink-50);
  color: var(--ink-600);
}
.prev-historial-completada { background: #d1fae5; color: #15803D; }
.prev-historial-cancelada  { background: #fee2e2; color: #B91C1C; }
.prev-historial-en_proceso { background: #dbeafe; color: #1e40af; }
.prev-historial-pendiente  { background: #fef3c7; color: #92400e; }

.prev-historial-codigo {
  font-weight: 600;
  color: #0B2545;
}
.prev-historial-meta {
  font-size: .72rem;
  color: var(--ink-500);
}
.prev-historial-fecha {
  font-size: .72rem;
  color: var(--ink-500);
}

/* ═══ KPIs del dashboard como links clickeables ═══════════════════════════ */
a.metric {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  position: relative;
}
a.metric:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(11, 37, 69, 0.10);
}
a.metric::after {
  /* Mini icono flecha en la esquina, aparece al hover */
  content: "→";
  position: absolute;
  top: .65rem; right: .9rem;
  font-size: 1.1rem;
  color: var(--ink-300);
  font-weight: 700;
  transition: transform .15s, color .15s;
}
a.metric:hover::after {
  color: #0B2545;
  transform: translateX(3px);
}
a.metric.warn:hover::after { color: var(--warn); }
a.metric.bad:hover::after  { color: var(--bad); }
a.metric.ok:hover::after   { color: var(--ok); }

/* Scroll suave al ir a #notif-center */
html { scroll-behavior: smooth; }

/* ═══ Página de instalación PWA + push ═══════════════════════════════════ */
.install-status {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 1rem;
  align-items: center;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
}
.install-status-ok { background: linear-gradient(135deg, #f0fdf4, #fff 70%); border-color: #bbf7d0; }
.install-status-ok .install-status-icon { color: #15803D; }
.install-status-icon {
  width: 48px; height: 48px;
  background: var(--ink-50);
  color: var(--ink-700);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.install-status-title { font-size: 1.05rem; font-weight: 700; color: #0B2545; }
.install-status-sub { font-size: .9rem; color: var(--ink-600); margin-top: .15rem; }

.install-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin: 1.4rem 0;
}
.install-card {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.install-card[open] {
  border-color: #0B2545;
  box-shadow: 0 4px 12px rgba(11, 37, 69, 0.08);
}
.install-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.install-card-head::-webkit-details-marker { display: none; }
.install-card-head::marker { display: none; content: ''; }
.install-card:not([open]) .install-card-head:hover {
  background: var(--ink-50);
}
.install-card-platform {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0B2545;
}
.install-card-browser {
  font-size: .78rem;
  color: var(--ink-500);
  margin-top: .15rem;
}
.install-card-chevron {
  color: var(--ink-500);
  flex-shrink: 0;
  transition: transform .2s;
}
.install-card[open] .install-card-chevron {
  transform: rotate(180deg);
  color: #0B2545;
}
.install-card-body {
  padding: 0 1.3rem 1.3rem 1.3rem;
  border-top: 1px solid var(--ink-100);
  padding-top: 1rem;
}
.install-steps {
  padding-left: 1.4rem;
  margin: 0;
  font-size: .92rem;
  line-height: 1.55;
}
.install-steps li { margin: .4rem 0; }
.install-tip {
  margin-top: .85rem;
  padding: .55rem .8rem;
  background: var(--paper-tint, #f8fafc);
  border-left: 3px solid #0B2545;
  border-radius: 0 6px 6px 0;
  font-size: .82rem;
  color: var(--ink-700);
}
.install-tip-warn {
  background: #fef3c7;
  border-left-color: #D97706;
  color: #92400e;
}

.push-panel {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 14px;
  padding: 1.2rem 1.4rem;
  margin: 1.4rem 0;
}
.push-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.push-panel-head h2 {
  display: flex; align-items: center; gap: .5rem;
  margin: 0;
  font-size: 1.05rem;
}
.push-estado {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .35rem .65rem;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.push-estado-ok   { background: #d1fae5; color: #065f46; }
.push-estado-warn { background: #fef3c7; color: #92400e; }
.push-estado-no   { background: #fee2e2; color: #B91C1C; }

.push-msg {
  padding: .85rem 1rem;
  border-radius: 8px;
  font-size: .92rem;
  line-height: 1.5;
}
.push-msg-ok   { background: #f0fdf4; border: 1px solid #bbf7d0; color: #065f46; }
.push-msg-warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.push-msg-bad  { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

.push-warn {
  display: flex; align-items: center; gap: .5rem;
  margin-top: 1rem;
  padding: .65rem .85rem;
  background: #fef3c7;
  border-left: 3px solid #D97706;
  border-radius: 0 6px 6px 0;
  font-size: .82rem;
  color: #92400e;
}

/* ═══ iOS PWA safe-area — respetar notch / dynamic island / home indicator ═══ */
/*
 * Cuando la PWA se instala con apple-mobile-web-app-status-bar-style="black-translucent",
 * iOS dibuja la status bar (hora/batería/wifi) TRANSPARENTE encima del contenido.
 *
 * El padding-top NO debe ir en body, porque elementos con position: sticky se
 * anclan al VIEWPORT (no al body) y acaban tapados por la status bar.
 * Lo correcto: padding directamente en el navbar (que es sticky).
 */

@supports (padding-top: env(safe-area-inset-top)) {

  /* ─── Navbar admin (sticky) absorbe el safe-area top ─── */
  .navbar {
    padding-top: env(safe-area-inset-top);
  }
  .navbar-inner {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  /* ─── Navbar móvil (sticky) absorbe el safe-area top ─── */
  .m-navbar {
    padding-top: calc(.7rem + env(safe-area-inset-top));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  /* ─── Footer / FAB respetan la home indicator del iPhone ─── */
  .app-footer {
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  .m-footer-credit {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
  .fab-scan, .m-fab {
    bottom: max(1.2rem, calc(1.2rem + env(safe-area-inset-bottom)));
    right: max(1.2rem, calc(1.2rem + env(safe-area-inset-right)));
  }

  /* ─── Páginas SIN navbar (login) — body asume el padding ─── */
  body.login-body {
    padding-top: max(2rem, env(safe-area-inset-top));
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }
}

/* Fix adicional: en standalone, fondo opaco al navbar para que el scroll
   no asome por encima del notch */
@media all and (display-mode: standalone) {
  .navbar { background: #fff; }
  .m-navbar { background: #fff; }
}

/* ═══ Control de Funnel (encender/apagar) ════════════════════════════════ */
.funnel-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: .85rem;
  margin-top: .65rem;
}
.funnel-control-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: .85rem;
  padding: .9rem 1rem;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  background: #fff;
}
.funnel-control-card.funnel-on { border-left: 4px solid #15803D; }
.funnel-control-card.funnel-off { border-left: 4px solid #B91C1C; }
.funnel-control-card.funnel-status { border-left: 4px solid #0891B2; }
.funnel-control-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--ink-50);
  font-size: 1.4rem;
}
.funnel-control-title {
  font-size: 1rem; font-weight: 700; color: #0B2545; margin-bottom: .25rem;
}
.funnel-control-sub { font-size: .82rem; color: var(--ink-700); }
.funnel-control-path {
  display: inline-block;
  background: var(--ink-50);
  padding: .2rem .45rem;
  border-radius: 4px;
  margin-top: .25rem;
  font-size: .75rem;
  word-break: break-all;
}
.funnel-control-result {
  font-size: .78rem;
  color: var(--ink-600);
  margin-top: .4rem;
}

/* ═══ Navbar admin — versión móvil con hamburguesa ═══════════════════════ */
.navbar-hamburguesa {
  display: none;
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  width: 42px; height: 42px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-700);
}
.navbar-hamburguesa:hover { background: var(--ink-100); }

.navbar-overlay { display: none; }

@media (max-width: 980px) {
  /* Mostrar hamburguesa y ocultar navbar normal */
  .navbar-hamburguesa { display: inline-flex; }
  .navbar-inner {
    flex-wrap: nowrap;
    gap: .75rem;
  }
  .navbar-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 85vw);
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    /* Sin padding-top — la banda de usuario (.navbar-user) lo absorbe */
    padding: 0 1rem max(1rem, env(safe-area-inset-bottom, 1rem)) 1rem;
    box-shadow: -4px 0 18px rgba(11, 37, 69, 0.15);
    transform: translateX(100%);
    transition: transform .25s ease;
    z-index: 200;
    overflow-y: auto;
    overscroll-behavior: contain;
    gap: .25rem !important;
  }
  body.navbar-open .navbar-nav {
    transform: translateX(0);
  }
  body.navbar-open .navbar-overlay {
    display: block;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 150;
    animation: fade-in .2s;
  }
  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

  /* Items dentro del drawer ocupan toda la línea, iconos visibles, texto visible */
  .navbar-nav .navbar-link {
    width: 100%;
    justify-content: flex-start;
    padding: .75rem 1rem;
    font-size: .92rem;
  }
  .navbar-nav .navbar-link span { display: inline !important; }

  /* Dropdowns: abrirlos siempre dentro del drawer */
  .navbar-dropdown {
    width: 100%;
  }
  .navbar-dropdown > .navbar-link {
    width: 100%;
    justify-content: space-between;
  }
  .navbar-menu {
    position: static !important;
    box-shadow: none !important;
    border: none !important;
    background: var(--ink-50) !important;
    padding: .25rem 0 .25rem 1rem !important;
    margin-top: .15rem !important;
    border-left: 2px solid var(--ink-200) !important;
    border-radius: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    display: none;
  }
  .navbar-dropdown:hover .navbar-menu,
  .navbar-dropdown:focus-within .navbar-menu {
    display: block !important;
  }
  /* En táctil, hover no funciona. Hacemos que click toggle. */
  .navbar-dropdown.is-open .navbar-menu {
    display: block !important;
  }
  .navbar-menu-item {
    padding: .55rem .75rem;
    font-size: .85rem;
  }

  /* Iconos sueltos (escanear / instalar) en línea propia */
  .navbar-link.navbar-icon-only {
    width: 100%;
    justify-content: flex-start;
  }
  .navbar-link.navbar-icon-only::after {
    content: attr(title);
    margin-left: .5rem;
    font-size: .9rem;
  }

  /* Usuario ARRIBA del drawer — visible y accesible al abrir.
     Esta banda absorbe el safe-area-top del iPhone (notch) en su padding-top
     para que se extienda hasta el borde superior físico del display. */
  .navbar-user {
    order: -1;                   /* primer hijo del drawer */
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: .65rem;
    margin: 0 -1rem 1rem -1rem;  /* full bleed lateral */
    padding: calc(1rem + env(safe-area-inset-top, 0px)) 1rem 1rem 1rem;
    background: linear-gradient(135deg, #0B2545 0%, #1e3a5f 100%);
    border-radius: 0 0 14px 14px;
    border-left: none;
    border-bottom: none;
  }
  .navbar-user > span:first-child {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
  .navbar-user .role-badge {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    margin-top: .15rem;
  }
  .navbar-user form {
    display: block !important;  /* override del inline style="display:inline" */
  }
  .navbar-user form button[type="submit"] {
    height: 48px;
    padding: 0 1rem 0 .85rem;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: rgba(255, 255, 255, 0.95);
    color: #B91C1C !important;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    font-size: .85rem;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all .15s;
    white-space: nowrap;
  }
  .navbar-user form button[type="submit"]:hover {
    background: #fff;
    transform: scale(1.03);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  }
  .navbar-user form button[type="submit"]::after {
    content: "Cerrar sesión";
  }
}

/* En móvil pequeño aún más compacto */
@media (max-width: 480px) {
  .navbar-title { font-size: 14px; }
  .navbar-sub { display: none; }
  .navbar-logo { width: 34px; height: 34px; font-size: 10px; }
}

/* ═══ Login estética metálica industrial — Extrusion Mecánicos ═══════════════ */
.login-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  font-family: 'Inter', sans-serif;
  position: relative;
  overflow: hidden;
  /* Fondo cosmos industrial: negro profundo + halo cromado azul central */
  background:
    radial-gradient(ellipse 60% 50% at center, #1a3a7a 0%, #0a1633 35%, #050A1A 70%, #000 100%),
    #000;
}

/* Capa 1: campo de partículas cromadas (estrellas) */
.login-body::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,0.7) 0.8px, transparent 1.5px),
    radial-gradient(circle at 87% 22%, rgba(180,210,255,0.6) 0.8px, transparent 1.5px),
    radial-gradient(circle at 23% 73%, rgba(255,255,255,0.5) 0.8px, transparent 1.5px),
    radial-gradient(circle at 68% 81%, rgba(180,210,255,0.55) 0.8px, transparent 1.5px),
    radial-gradient(circle at 47% 35%, rgba(255,255,255,0.4) 0.6px, transparent 1.2px),
    radial-gradient(circle at 92% 62%, rgba(160,200,255,0.5) 0.7px, transparent 1.3px),
    radial-gradient(circle at 8% 52%, rgba(255,255,255,0.6) 0.8px, transparent 1.5px),
    radial-gradient(circle at 34% 12%, rgba(180,210,255,0.45) 0.6px, transparent 1.2px),
    radial-gradient(circle at 76% 8%, rgba(255,255,255,0.5) 0.7px, transparent 1.3px),
    radial-gradient(circle at 55% 92%, rgba(180,210,255,0.55) 0.8px, transparent 1.5px),
    radial-gradient(circle at 18% 88%, rgba(255,255,255,0.5) 0.6px, transparent 1.2px),
    radial-gradient(circle at 82% 45%, rgba(160,200,255,0.4) 0.7px, transparent 1.3px),
    radial-gradient(circle at 41% 60%, rgba(255,255,255,0.35) 0.5px, transparent 1px),
    radial-gradient(circle at 60% 25%, rgba(180,210,255,0.5) 0.7px, transparent 1.3px);
  background-repeat: no-repeat;
}

/* Capa 2: halo azul cromado pulsante detrás del logo */
.login-body::after {
  content: "";
  position: absolute;
  width: 700px;
  height: 700px;
  max-width: 110vw;
  max-height: 110vw;
  border-radius: 50%;
  background:
    radial-gradient(circle,
      rgba(120, 170, 240, 0.28) 0%,
      rgba(40, 90, 200, 0.20) 25%,
      rgba(20, 50, 130, 0.10) 50%,
      transparent 75%);
  filter: blur(50px);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: login-halo-pulse 8s ease-in-out infinite;
}
@keyframes login-halo-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: .85; }
  50%      { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

.login-wrap {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.3rem;
  z-index: 2;
  position: relative;
}

/* Capa 3: rayos cromados emergiendo del centro (lentos) */
.login-wrap::before {
  content: "";
  position: fixed;
  width: 1400px;
  height: 1400px;
  max-width: 200vw;
  max-height: 200vh;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background:
    conic-gradient(from 0deg at 50% 50%,
      transparent 0deg, rgba(180, 215, 255, 0.07) 15deg, transparent 35deg,
      transparent 70deg, rgba(180, 215, 255, 0.05) 90deg, transparent 115deg,
      transparent 150deg, rgba(180, 215, 255, 0.06) 170deg, transparent 195deg,
      transparent 230deg, rgba(180, 215, 255, 0.05) 250deg, transparent 275deg,
      transparent 310deg, rgba(180, 215, 255, 0.07) 330deg, transparent 355deg);
  pointer-events: none;
  z-index: 1;
  animation: login-rays-rotate 80s linear infinite;
}
@keyframes login-rays-rotate {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Card glassmorphism cromado — fondo claro sobre cosmos azul */
.login-card {
  width: 100%;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(245,248,255,0.95) 100%);
  backdrop-filter: blur(25px) saturate(1.4);
  -webkit-backdrop-filter: blur(25px) saturate(1.4);
  border-radius: 24px;
  padding: 2.5rem 2rem 2rem;
  box-shadow:
    0 40px 100px -10px rgba(0, 20, 60, 0.6),
    0 16px 40px -10px rgba(40, 80, 180, 0.35),
    0 0 0 1px rgba(180, 210, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(180, 210, 255, 0.3);
  position: relative;
}

/* Borde cromado superior del card (gradiente azul plateado) */
.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 3px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(120, 170, 240, 0.4) 30%,
    rgba(180, 210, 255, 0.9) 50%,
    rgba(120, 170, 240, 0.4) 70%,
    transparent 100%);
  border-radius: 0 0 4px 4px;
}

.login-logo-wrap {
  text-align: center;
  margin-bottom: 1.6rem;
  position: relative;
}
/* Halo cromado detrás del logo */
.login-logo-wrap::before {
  content: "";
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(120, 170, 240, 0.35) 0%, transparent 70%);
  filter: blur(20px);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  animation: login-logo-pulse 4s ease-in-out infinite;
}
@keyframes login-logo-pulse {
  0%, 100% { opacity: .7; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 1;  transform: translate(-50%, -50%) scale(1.1); }
}
.login-logo-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 26px;
  background: #050a1a;
  padding: 2px;
  position: relative;
  z-index: 1;
  box-shadow:
    0 0 0 2px rgba(180, 210, 255, 0.3),
    0 0 30px rgba(120, 170, 240, 0.5),
    0 16px 40px rgba(0, 20, 60, 0.5),
    inset 0 -2px 8px rgba(0, 0, 0, 0.4);
}
.login-title {
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0 0 .4rem 0;
  text-align: center;
  letter-spacing: -.02em;
  background: linear-gradient(135deg, #0B2545 0%, #1e3a5f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-sub {
  text-align: center;
  font-size: .82rem;
  color: var(--ink-500);
  margin-bottom: 1.8rem;
  line-height: 1.5;
}
.login-msg {
  padding: .7rem .9rem;
  border-radius: 10px;
  font-size: .85rem;
  margin-bottom: 1.1rem;
  text-align: center;
  font-weight: 500;
}
.login-msg-bad { background: #fef2f2; color: #B91C1C; border: 1px solid #fecaca; }
.login-msg-ok  { background: #f0fdf4; color: #15803D; border: 1px solid #bbf7d0; }

.login-form .field { margin-bottom: 1.1rem; }
.login-form label {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-700);
  margin-bottom: .4rem;
}
.login-form .input {
  width: 100%;
  padding: .8rem .95rem;
  font-size: 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  transition: all .2s;
  font-family: inherit;
}
.login-form .input:hover {
  border-color: #cbd5e1;
  background: #fff;
}
.login-form .input:focus {
  background: #fff;
  border-color: #0B2545;
  outline: none;
  box-shadow:
    0 0 0 4px rgba(11, 37, 69, 0.10),
    0 4px 12px rgba(11, 37, 69, 0.08);
}

.login-btn {
  width: 100%;
  justify-content: center;
  margin-top: .75rem;
  padding: .9rem;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #0B2545 0%, #1e3a5f 50%, #0B2545 100%);
  background-size: 200% 100%;
  background-position: 0% 50%;
  transition: all .3s;
  box-shadow:
    0 8px 20px rgba(11, 37, 69, 0.30),
    0 2px 6px rgba(11, 37, 69, 0.15);
  border-radius: 10px;
  letter-spacing: .02em;
}
.login-btn:hover {
  background-position: 100% 50%;
  transform: translateY(-1px);
  box-shadow:
    0 12px 24px rgba(11, 37, 69, 0.35),
    0 4px 10px rgba(11, 37, 69, 0.20);
}
.login-btn:active {
  transform: translateY(0);
}

.login-help {
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(11, 37, 69, 0.08);
  font-size: .75rem;
  color: var(--ink-500);
  text-align: center;
  line-height: 1.6;
}

.login-footer {
  text-align: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: .78rem;
  line-height: 1.6;
  z-index: 1;
  position: relative;
}
.login-footer-line {
  margin-bottom: .25rem;
  letter-spacing: .02em;
}
.login-footer-credit {
  color: rgba(255, 255, 255, 0.85);
  font-size: .82rem;
}
.login-footer-credit strong {
  color: #fff;
  font-weight: 600;
  background: linear-gradient(90deg, #fff 0%, #fbbf24 50%, #fff 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: login-credit-shine 6s linear infinite;
}
@keyframes login-credit-shine {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ═══ Logo del navbar (sustituye al cuadrado "GMAO") ═══════════════════════ */
.navbar-logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  padding: 3px;
  box-shadow: 0 1px 3px rgba(11, 37, 69, 0.10);
}
.m-navbar-logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 9px;
  background: #fff;
  padding: 2px;
  box-shadow: 0 1px 3px rgba(11, 37, 69, 0.10);
}

/* ═══ Footer con crédito desarrollador ════════════════════════════════════ */
.app-footer-line {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}
.app-footer-credit {
  margin-top: .5rem;
  padding-top: .5rem;
  border-top: 1px dashed var(--ink-100);
  font-size: .7rem;
  text-align: center;
  color: var(--ink-500);
}
.app-footer-credit strong { color: #0B2545; font-weight: 600; }

.m-footer-credit {
  padding: 1rem;
  text-align: center;
  font-size: .7rem;
  color: var(--ink-500);
  border-top: 1px solid var(--ink-100);
  margin-top: 2rem;
}
.m-footer-credit strong { color: #0B2545; font-weight: 600; }

@media (max-width: 480px) {
  .login-card { padding: 1.5rem 1.2rem; }
  .login-logo-img { width: 90px; height: 90px; }
  .login-title { font-size: 1.3rem; }
}

/* ═══ Tablero "Tus tareas para hoy" — mecánicos ═══════════════════════════ */

.dia-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  background: linear-gradient(135deg, #0B2545 0%, #1e3a5f 100%);
  color: #fff;
  padding: 1.1rem 1.4rem;
  border-radius: 14px;
  margin: 1rem 0;
  box-shadow: 0 6px 20px rgba(11, 37, 69, 0.18);
}
.dia-hero-saludo {
  font-size: 1.2rem;
  font-weight: 500;
}
.dia-hero-saludo strong { font-weight: 700; }
.dia-hero-fecha {
  font-size: .82rem;
  opacity: .8;
  text-transform: capitalize;
  margin-top: .15rem;
}
.dia-hero-kpis {
  display: flex;
  gap: .8rem;
}
.dia-hero-kpi {
  text-align: center;
  background: rgba(255,255,255,0.10);
  padding: .55rem .85rem;
  border-radius: 10px;
  min-width: 70px;
}
.dia-hero-kpi-warn { background: rgba(217, 119, 6, 0.30); }
.dia-hero-kpi-num {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}
.dia-hero-kpi-num span { font-size: .9rem; font-weight: 400; opacity: .8; }
.dia-hero-kpi-lbl {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  opacity: .85;
  margin-top: .2rem;
}
@media (max-width: 480px) {
  .dia-hero { grid-template-columns: 1fr; }
  .dia-hero-kpis { justify-content: stretch; }
  .dia-hero-kpi { flex: 1; }
}

.dia-block {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 14px;
  padding: .95rem 1rem;
  margin-bottom: 1rem;
}
.dia-block-continuar { border-left: 5px solid #0891B2; background: linear-gradient(180deg, #f0fdf4 0%, #fff 50%); }
.dia-block-alta      { border-left: 5px solid #B91C1C; background: linear-gradient(180deg, #fef2f2 0%, #fff 50%); }
.dia-block-media     { border-left: 5px solid #D97706; }
.dia-block-baja      { border-left: 5px solid var(--ink-300); background: var(--ink-50); }

.dia-block-head {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin-bottom: .85rem;
}
.dia-block-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  border: 2px solid currentColor;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.dia-block-continuar .dia-block-icon { border-color: #0891B2; color: #0891B2; }
.dia-block-alta .dia-block-icon      { border-color: #B91C1C; color: #B91C1C; }
.dia-block-media .dia-block-icon     { border-color: #D97706; color: #D97706; }
.dia-block-baja .dia-block-icon      { border-color: var(--ink-400); color: var(--ink-600); }

.dia-block-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0B2545;
  line-height: 1.2;
}
.dia-block-sub {
  font-size: .82rem;
  color: var(--ink-600);
  margin-top: .15rem;
}

/* Cards de tareas */
.dia-tarea {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.1rem;
  background: #fff;
  border: 1.5px solid var(--ink-200);
  border-radius: 12px;
  margin-bottom: .65rem;
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: all .15s;
}
.dia-tarea:hover, .dia-tarea:active {
  border-color: #0B2545;
  box-shadow: 0 6px 14px rgba(11, 37, 69, 0.10);
  transform: translateY(-1px);
}
.dia-tarea-continuar {
  background: linear-gradient(135deg, #f0fdf4 0%, #fff 100%);
  border-color: #0891B2;
  border-width: 2px;
}
.dia-tarea-alta {
  border-color: #fca5a5;
  border-width: 2px;
}

.dia-tarea-tag {
  position: absolute;
  top: -8px;
  left: 1rem;
  background: #0891B2;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: .2rem .55rem;
  border-radius: 4px;
}
.dia-tarea-nueva {
  position: absolute;
  top: -8px;
  right: 1rem;
  background: #B91C1C;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: .2rem .55rem;
  border-radius: 4px;
}

.dia-tarea-cuerpo { min-width: 0; }
.dia-tarea-maquina {
  display: flex;
  gap: .65rem;
  align-items: center;
  margin-bottom: .5rem;
}
.dia-tarea-icon {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  font-size: 1.3rem;
  color: #fff;
  flex-shrink: 0;
}
.dia-tarea-codigo {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #0B2545;
  font-size: 1.05rem;
}
.dia-tarea-nombre {
  font-size: .82rem;
  color: var(--ink-600);
}
.dia-tarea-descripcion {
  font-size: .92rem;
  color: var(--ink-800);
  line-height: 1.4;
  margin-bottom: .5rem;
}
.dia-tarea-meta {
  display: flex;
  gap: .65rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: .72rem;
  color: var(--ink-500);
}
.dia-tarea-meta span { display: inline-flex; align-items: center; gap: .25rem; }
.dia-tarea-tipo {
  padding: .15rem .5rem;
  border-radius: 3px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .65rem;
}
.dia-tarea-correctiva { background: #fee2e2; color: #B91C1C; }
.dia-tarea-preventiva { background: #dbeafe; color: #1e40af; }

.dia-tarea-cta {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-weight: 600;
  color: #0B2545;
  white-space: nowrap;
}
.dia-tarea-alta .dia-tarea-cta { color: #B91C1C; }
.dia-tarea-continuar .dia-tarea-cta { color: #0891B2; }
.dia-tarea-cta-arrow {
  font-size: 1.4rem;
  transition: transform .15s;
}
.dia-tarea:hover .dia-tarea-cta-arrow { transform: translateX(4px); }
.dia-tarea-baja {
  padding: .75rem .85rem;
}
.dia-tarea-baja .dia-tarea-cuerpo { font-size: .9rem; }
.dia-tarea-baja .dia-tarea-icon { width: 30px; height: 30px; font-size: 1rem; }

.dia-vacio {
  background: linear-gradient(135deg, #f0fdf4 0%, #fff 100%);
  border: 2px dashed #86efac;
  border-radius: 14px;
  padding: 2rem 1.5rem;
  text-align: center;
  margin-bottom: 1rem;
}
.dia-vacio-icon {
  width: 64px;
  height: 64px;
  background: #15803D;
  color: #fff;
  border-radius: 50%;
  margin: 0 auto .65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
}
.dia-vacio-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #065f46;
  margin-bottom: .35rem;
}
.dia-vacio-sub {
  font-size: .88rem;
  color: var(--ink-600);
  margin-bottom: 1rem;
}
.dia-vacio-cta { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }

.dia-acciones {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .5rem;
  margin-top: 1rem;
}
.dia-accion-btn {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .75rem 1rem;
  background: #fff;
  border: 1.5px solid var(--ink-200);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink-700);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all .15s;
}
.dia-accion-btn:hover {
  border-color: #0B2545;
  background: #f0f7ff;
}
.dia-accion-icon {
  color: #0B2545;
}
.dia-accion-btn-end:hover {
  background: #fee2e2;
  border-color: #B91C1C;
}
.dia-accion-btn-end:hover .dia-accion-icon {
  color: #B91C1C;
}

/* ═══ Tips/sugerencias para mecánico ═══════════════════════════════════════ */
.tips-block {
  background: linear-gradient(135deg, #fffbeb 0%, #fff 100%);
  border: 1px solid #fde68a;
  border-radius: 14px;
  margin: 1rem 0;
  padding: 0;
  overflow: hidden;
}
.tips-block[open] {
  background: linear-gradient(135deg, #fffbeb 0%, #fff 60%);
}
.tips-block-head {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .95rem 1.1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.tips-block-head::-webkit-details-marker { display: none; }
.tips-block-head::marker { content: ''; }
.tips-block-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fef3c7;
  border-radius: 50%;
  font-size: 1.3rem;
}
.tips-block-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: #92400e;
}
.tips-block-sub {
  font-size: .76rem;
  color: var(--ink-600);
  margin-top: .15rem;
}
.tips-block-chev {
  margin-left: auto;
  color: var(--ink-500);
  transition: transform .2s;
}
.tips-block[open] .tips-block-chev {
  transform: rotate(180deg);
}

.tips-list {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: 0 1rem 1rem;
}
.tips-item {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: .7rem;
  padding: .75rem .9rem;
  background: #fff;
  border: 1px solid var(--ink-100);
  border-radius: 10px;
  border-left-width: 4px;
}
.tips-item-ok      { border-left-color: #15803D; background: linear-gradient(135deg, #f0fdf4, #fff 70%); }
.tips-item-mejora  { border-left-color: #D97706; background: linear-gradient(135deg, #fffbeb, #fff 70%); }
.tips-item-neutro  { border-left-color: #6366F1; }
.tips-item-alerta  { border-left-color: #B91C1C; background: linear-gradient(135deg, #fef2f2, #fff 70%); }
/* Compatibilidad con tipos legacy */
.tips-item-positivo    { border-left-color: #15803D; background: linear-gradient(135deg, #f0fdf4, #fff 70%); }
.tips-item-consejo     { border-left-color: #0891B2; background: linear-gradient(135deg, #ecfeff, #fff 70%); }
.tips-item-observacion { border-left-color: #6366F1; }
.tips-item-bienestar   { border-left-color: #D97706; background: linear-gradient(135deg, #fffbeb, #fff 70%); }

.tips-item-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: var(--ink-50);
  border-radius: 10px;
}
.tips-item-ok .tips-item-icon       { background: #d1fae5; }
.tips-item-mejora .tips-item-icon   { background: #fef3c7; }
.tips-item-neutro .tips-item-icon   { background: #ede9fe; }
.tips-item-alerta .tips-item-icon   { background: #fee2e2; }
.tips-item-positivo .tips-item-icon { background: #d1fae5; }
.tips-item-consejo .tips-item-icon  { background: #cffafe; }
.tips-item-observacion .tips-item-icon { background: #ede9fe; }
.tips-item-bienestar .tips-item-icon{ background: #fef3c7; }

.tips-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .55rem;
  margin-bottom: .3rem;
}
.tips-item-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink-900);
  line-height: 1.2;
  flex: 1;
}
.tips-item-metrica {
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .5rem;
  border-radius: 4px;
  background: rgba(11, 37, 69, 0.08);
  color: #0B2545;
  white-space: nowrap;
  flex-shrink: 0;
}
.tips-item-ok .tips-item-metrica     { background: #d1fae5; color: #065f46; }
.tips-item-mejora .tips-item-metrica { background: #fef3c7; color: #92400e; }
.tips-item-alerta .tips-item-metrica { background: #fee2e2; color: #991b1b; }

.tips-item-texto {
  font-size: .85rem;
  color: var(--ink-700);
  line-height: 1.45;
}
.tips-item-texto strong {
  color: var(--ink-900);
  font-weight: 600;
}
