:root {

  --navy: #1B4B7A;

  --navy2: #163E66;

  --fondo: #F4F6F8;

  --card: #FFFFFF;

  --borde: #E2E6EC;

  --ok: #1B7A3D;

  --aviso: #C2410C;

  --error: #B91C1C;

}

* { box-sizing: border-box; }

body {

  margin: 0;

  font-family: "Segoe UI", sans-serif;

  background: var(--fondo);

  color: var(--navy);

  font-size: 13px;

  line-height: 1.2;

}

a { color: var(--navy); }

body.app {

  display: grid;

  grid-template-columns: 188px 1fr;

  min-height: 100vh;

}

body.app.modo-prueba {
  grid-template-rows: auto 1fr;
}

.barra-prueba {
  grid-column: 1 / -1;
  background: #C2410C;
  color: #fff;
  font-weight: 800;
  text-align: center;
  padding: 7px 10px;
  font-size: 13px;
}

.menu {

  background: var(--navy);

  color: #fff;

  padding: 8px 6px 12px;

  position: sticky;

  top: 0;

  align-self: start;

  min-height: 100vh;

}

.menu-marca {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px 8px 8px;
  gap: 6px;
}
.menu-logo {
  display: block;
  height: 64px;
  width: auto;
  max-width: 168px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 4px 6px;
  margin: 0 auto;
}

.menu-nota {

  font-size: 10px;

  opacity: .8;

  margin: 0 8px 8px;

}
.ver-aritec {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  color: #fff;
}
body.login-pag .ver-aritec {
  color: var(--navy);
  margin: 0 0 10px;
}

.menu nav a {

  display: block;

  color: #fff;

  text-decoration: none;

  font-weight: 700;

  padding: 4px 8px;

  border-radius: 5px;

  margin-bottom: 1px;

  border: 2px solid transparent;

  font-size: 12px;

}

.menu nav a:hover { background: #163E66; }

.menu nav a.on { background: #fff; color: var(--navy); }
.menu nav a.hay-msg { color: #fecaca; }
.menu nav a .msg-n { margin-left: 4px; }

.menu .lbl { color: #9ec0e0; font-size: 10px; padding: 8px 8px 2px; letter-spacing: .04em; }

.menu nav a.sub { font-size: 11px; padding: 3px 8px 3px 14px; font-weight: 600; }

.principal { min-width: 0; }

.wrap { max-width: 1400px; margin: 6px auto 12px; padding: 0 10px; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 6px; }

.stat { background: #fff; border: 1px solid var(--borde); border-radius: 6px; padding: 6px 8px; }

.stat b { display: block; font-size: 16px; line-height: 1.15; }

.stat span { font-size: 11px; }

.barra { height: 6px; background: #E2E6EC; border-radius: 4px; overflow: hidden; }

.barra i { display: block; height: 100%; background: var(--navy); }

.tag { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; }

.tag.ven { background: #f8d7da; }

.tag.mes { background: #fff3cd; }

.tag.disc { background: #e7f1ff; }

.chk-lista label { font-weight: 500; display: flex; gap: 6px; align-items: center; }

.chk-lista input { width: auto; }

.chk-vend { max-height: 220px; overflow: auto; border: 1px solid #d5dbe3; padding: 8px 10px; border-radius: 6px; margin: 8px 0; }

.menu-nota small { display: block; margin-top: 2px; }

.cab {

  display: grid;

  grid-template-columns: minmax(130px, auto) auto 1fr auto;

  gap: 6px;

  align-items: center;

  background: #fff;

  border-bottom: 1px solid var(--borde);

  padding: 4px 10px;

}

.user-verde {
  background: #1b7a3d;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 8px;
  text-align: center;
  line-height: 1;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.msg-ico {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #1B4B7A;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  line-height: 1;
}
.msg-ico svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
}
.msg-ico.hay { background: #b91c1c; }
.msg-ico.mini {
  padding: 6px 9px;
  vertical-align: middle;
  margin-left: 10px;
  border: 0;
  cursor: pointer;
  font: inherit;
}
.msg-ico.mini svg {
  width: 22px;
  height: 22px;
}
.msg-ico.mini span { display: none; }
h1 .msg-ico.mini { position: relative; top: -2px; }
.chat-dlg {
  width: min(640px, 94vw);
  max-height: 90vh;
  overflow: auto;
  border: 0;
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--navy);
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 30, 50, 0.28);
}
.chat-dlg::backdrop { background: rgba(15, 30, 50, 0.45); }
.chat-dlg-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.chat-dlg-top h2 { margin: 0; font-size: 16px; }
.chat-dlg-ficha {
  background: #F4F7FA;
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0 0 8px;
}
.chat-dlg-ficha p { margin: 0 0 3px; font-size: 13px; }
.chat-dlg-ficha p:last-child { margin-bottom: 0; }
.chat-dlg-items {
  margin: 6px 0 0;
  padding-left: 18px;
  max-height: 78px;
  overflow: auto;
  font-size: 12px;
}
.chat-dlg-items span { color: #5B6573; }
.chat-dlg .chat-hilo { max-height: 168px; }
.chat-cc-box { margin: 0; }
.chat-cc-tit {
  display: block;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}
.chat-todos {
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto;
  margin: 0 0 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--borde);
  font-weight: 700;
  font-size: 14px;
}
.chat-todos input { width: auto; margin: 0; }
.msg-fila {
  margin-left: 8px;
  text-decoration: none;
  font-size: 15px;
  color: var(--navy);
}
.msg-fila:hover { color: #b91c1c; }
.msg-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  background: #fff;
  color: #b91c1c;
  border: 2px solid #b91c1c;
  font-size: 11px;
  line-height: 14px;
  text-align: center;
}
.msg-cab {
  display: none;
}
.chat-orden { margin-top: 10px; }
.chat-hilo {
  max-height: 420px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0;
}
.chat-msg {
  max-width: 85%;
  padding: 6px 8px;
  border-radius: 6px;
  background: #EEF2F6;
}
.chat-msg.mio { align-self: flex-end; background: #DCE8F5; }
.chat-msg.suyo { align-self: flex-start; }
.chat-msg.enterado {
  max-width: 70%;
  padding: 4px 8px;
  background: #E7F6EC;
}
.chat-msg.enterado.mio { background: #D8F0E0; }
.chat-up { font-size: 16px; }
.chat-up-form { display: inline; margin-left: 8px; }
.chat-up-form.grande { display: block; margin: 0 0 8px; }
.chat-up-btn {
  border: 1px solid var(--borde);
  background: #fff;
  border-radius: 6px;
  padding: 1px 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1.2;
}
.chat-up-btn.grande {
  font-size: 14px;
  font-weight: 700;
  padding: 4px 10px;
}
.chat-up-btn:hover { background: #E7F6EC; }
.chat-del-form { display: inline; margin-left: 8px; }
.chat-del-btn {
  border: 0;
  background: transparent;
  color: #8B1E1E;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  padding: 0;
}
.chat-del-btn:hover { text-decoration: underline; }
.chat-del-hilo { display: inline; margin: 0; }
.chat-cab {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 4px;
}
.chat-cab h2 { margin: 0; }
.chat-cab-acc {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.chat-acciones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 8px; }
.chat-meta { font-size: 11px; color: #5B6573; }
.chat-meta span { font-weight: 400; }
.chat-msg p { margin: 3px 0 0; white-space: pre-wrap; }
.chat-enviar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.chat-enviar select,
.chat-enviar textarea { width: 100%; margin: 0; }
.chat-enviar textarea { min-height: 130px; resize: vertical; }
.chat-adj-lab {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin: 10px 0 4px;
  padding: 10px 12px;
  border: 1px dashed #2B5A8C;
  background: #F4F8FC;
  border-radius: 8px;
}
.chat-adj-lab input { display: block; margin-top: 6px; }
.chat-adjs { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.chat-adj-img-a { display: block; max-width: 220px; }
.chat-adj-img-a img {
  display: block;
  max-width: 100%;
  max-height: 180px;
  border-radius: 6px;
  border: 1px solid var(--borde);
}
.chat-adj-doc {
  font-size: 12px;
  font-weight: 700;
}
.chat-adj-bajar, .chat-adj-zip {
  font-size: 12px;
  font-weight: 600;
}
.chat-adj-zip { margin-top: 2px; }
.chat-btn-env {
  align-self: flex-start;
  margin-top: 10px;
  padding: 3px 10px !important;
  font-size: 12px !important;
  line-height: 1.2;
}
.chat-cc {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 4px;
}
.chat-cc label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto;
  margin: 0;
  font-weight: 600;
  font-size: 12px;
}
.chat-cc input { width: auto; margin: 0; }
.chat-enviar.chat-nuevo { grid-template-columns: none; }
.chat-enviar .chat-texto { grid-column: auto; }
.msg-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(280px, 1.2fr);
  gap: 8px;
  align-items: start;
}
#chat { min-height: 320px; }
.chat-busca {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0 0 8px;
}
.chat-busca input[type="search"] { flex: 1; min-width: 140px; margin: 0; }
.chat-msg.hallado { outline: 2px solid #C9A227; background: #FFF8E1; }
.tab-msg td { vertical-align: top; }
.tab-msg tr[data-href] { cursor: pointer; }
.tab-msg tr.on { background: #DCE8F5; }
.tab-msg a.msg-abir { display: block; }
.tab-msg a { font-weight: 700; }
.tab-msg .hint { display: block; }
.tab-msg tr.on a { color: var(--navy); }
.msg-nuevo { background: #FFF4E5; }
.msg-n {
  display: inline-block;
  min-width: 16px;
  padding: 0 5px;
  border-radius: 8px;
  background: #b91c1c;
  color: #fff;
  font-size: 11px;
}

.kpis { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }

.kpi {

  display: flex;

  align-items: center;

  gap: 6px;

  background: #fff;

  border: 1px solid #C5CCD3;

  border-radius: 6px;

  padding: 4px 8px;

  font-size: 12px;

}

.kpi b { margin-right: 2px; }

.kpi-cerrar { margin-left: 8px; padding: 2px 8px; font-size: 11px; white-space: nowrap; }

.kpi .c {

  color: #fff;

  font-weight: 700;

  padding: 2px 6px;

  border-radius: 4px;

}

.kpi .ord { background: #B91C1C; }

.kpi .ven { background: #1B7A3D; }

.kpi .pct { background: #1B4B7A; }

.imp { font-size: 12px; text-align: right; max-width: 220px; line-height: 1.25; }

.tabs { display: flex; flex-wrap: wrap; gap: 3px; margin: 2px 0 6px; }

.tabs button {

  background: #fff;

  color: var(--navy);

  border: 2px solid var(--navy);

  border-radius: 5px;

  padding: 2px 7px;

  font-weight: 700;

  cursor: pointer;

  font-size: 11px;

}

.tabs button.on { background: var(--navy); color: #fff; }

.panel { display: none; }

.panel.on { display: block; }

.oculto { display: none !important; }

.buscando .panel { display: none; }

.buscando .panel.tiene { display: block; margin-top: 4px; }

.buscando .tit-cat { display: block; }

.tit-cat { display: none; margin: 2px 0 4px; font-size: 13px; font-weight: 700; }

#buscar_cat { font-size: 14px; }

.grad { width: 100%; }

.grad th, .grad td { text-align: center; padding: 2px 4px; }

.grad input { width: 80px; text-align: center; margin: 0 auto; display: block; padding: 2px 4px; }

.grad.vista th, .grad.vista td {
  border: 1px solid var(--borde);
  padding: 6px 8px;
  font-size: 13px;
}
.grad.vista td { font-weight: 700; background: #fff; }
.grad.vista tbody th { text-align: left; font-size: 11px; background: #F4F6F8; }
.receta-vista h2 { margin: 0 0 6px; }
.receta-vista h3 { margin: 12px 0 4px; font-size: 14px; }

.filtros { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px 6px; }

/* Barra móvil: oculta en escritorio */
.movil-top,
.menu-fondo {
  display: none;
}

@media (max-width: 900px) {

  .cab, .filtros { grid-template-columns: 1fr; }

  body.app {
    grid-template-columns: 1fr;
    padding-top: 52px;
  }

  body.app.modo-prueba { padding-top: 0; }
  body.app.modo-prueba .movil-top { top: 36px; }

  .movil-top {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
    background: var(--navy);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }

  .movil-menu-btn {
    appearance: none;
    border: 2px solid #fff;
    background: transparent;
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    padding: 10px 14px;
    border-radius: 8px;
    min-height: 44px;
    cursor: pointer;
  }

  .movil-titulo {
    flex: 1;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: 0.04em;
  }

  .movil-msg {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #fff;
    text-decoration: none;
    font-size: 22px;
    padding: 8px 10px;
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
    border-radius: 8px;
  }
  .movil-msg.hay { background: #b91c1c; }

  .menu-fondo {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(0, 0, 0, 0.45);
    border: 0;
    padding: 0;
    cursor: pointer;
  }
  .menu-fondo[hidden] { display: none !important; }

  .menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 80;
    width: min(280px, 86vw);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 10px 24px;
    padding-top: max(12px, env(safe-area-inset-top));
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
  }

  body.menu-abierto .menu { transform: translateX(0); }
  body.menu-abierto { overflow: hidden; }

  .menu nav a {
    font-size: 15px;
    padding: 12px 12px;
    margin-bottom: 4px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .menu nav a.sub {
    font-size: 14px;
    padding: 10px 12px 10px 20px;
  }
  .menu .lbl { font-size: 12px; padding: 14px 12px 4px; }

  .cab {
    padding: 8px 10px;
    gap: 8px;
  }
  .cab .msg-ico { display: none; }
  .cab .imp {
    font-size: 12px;
    line-height: 1.45;
  }
  .cab .imp a {
    display: inline-block;
    padding: 6px 2px;
    min-height: 36px;
  }
  .user-verde {
    font-size: 14px;
    padding: 8px 12px;
  }

  .wrap { padding: 0 10px 20px; margin-top: 8px; }

  .btn {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 14px;
  }
  .btn.espera { min-height: 44px; }

  input, select, textarea {
    font-size: 16px !important;
    min-height: 44px;
    padding: 10px 12px;
  }
  textarea { min-height: 88px; }
  input[type="checkbox"], input[type="radio"] {
    min-height: 22px;
    width: 22px;
    min-width: 22px;
  }

  th, td { padding: 10px 8px; font-size: 13px; }
  table { font-size: 13px; }

  .chat-enviar {
    gap: 8px;
  }
  .chat-enviar textarea,
  .chat-texto textarea {
    min-height: 96px;
  }
  .chat-cc label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 14px;
    min-height: 40px;
  }

  .tab-msg td { padding: 12px 8px; }
  .tab-msg a { font-size: 14px; }

  h1 { font-size: 18px; margin-bottom: 8px; }
  h2 { font-size: 15px; }

  .barra-paso {
    left: 0;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    min-height: 64px;
  }
  .barra-paso .btn { flex: 1 1 auto; }
}



.card {

  background: var(--card);

  border: 1px solid var(--borde);

  border-radius: 6px;

  padding: 6px 8px;

  margin-bottom: 6px;

}

h1 { margin: 0 0 4px; font-size: 15px; }
.tit-seg { margin: 0 0 8px; gap: 10px; }
.tit-seg h1 { margin: 0; }

h2 { margin: 0 0 4px; font-size: 13px; }

p { margin: 0 0 4px; }

label { display: block; font-weight: 700; font-size: 10px; margin: 2px 0 1px; }

input, select, textarea {

  width: 100%;

  padding: 3px 6px;

  border: 1px solid var(--borde);

  border-radius: 4px;

  font: 12px "Segoe UI", sans-serif;

  color: var(--navy);

  background: #fff;

  line-height: 1.2;

}

.fila { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 6px; }

.fila3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px 6px; }

.btn {

  background: var(--navy);

  color: #fff;

  border: 0;

  border-radius: 5px;

  padding: 4px 8px;

  font-weight: 700;

  cursor: pointer;

  font-size: 12px;

}

.btn.sec { background: #fff; color: var(--navy); border: 2px solid var(--navy); }

.btn:disabled { opacity: .5; }
.btn.espera { background: #c2410c; }
.btn.sec.espera { background: #fff7ed; color: #c2410c; border-color: #c2410c; }

.ok { background: #E8F5EC; border: 1px solid #1B7A3D; padding: 4px 7px; border-radius: 5px; margin-bottom: 6px; }

.err { background: #FDE8EA; border: 1px solid var(--error); padding: 4px 7px; border-radius: 5px; margin-bottom: 6px; }

.hint { font-size: 11px; margin: 0 0 4px; line-height: 1.25; }

table { width: 100%; border-collapse: collapse; font-size: 12px; }

th, td { text-align: left; padding: 2px 5px; border-bottom: 1px solid var(--borde); line-height: 1.15; vertical-align: middle; }

th { background: #EEF1F4; font-size: 11px; }
table:not(.grad) thead th.ord-ok { cursor: pointer; user-select: none; white-space: nowrap; }
table:not(.grad) thead th.ord-ok:hover { color: var(--navy); text-decoration: underline; }
table:not(.grad) thead th.asc::after { content: " ▲"; font-size: 10px; }
table:not(.grad) thead th.desc::after { content: " ▼"; font-size: 10px; }

.avance { max-width: 280px; font-size: 11px; }
td.est { font-weight: 700; white-space: nowrap; color: #1B4B7A; }

.item {
  display: grid;
  grid-template-columns: 18px 1fr 110px 100px;
  gap: 3px;
  align-items: center;
  padding: 2px 4px;
  border-bottom: 1px solid var(--borde);
  font-size: 12px;
  line-height: 1.15;
  min-height: 22px;
  border-radius: 3px;
}
.item select { padding: 1px 3px; font-size: 11px; }
.item input[type="checkbox"] { width: auto; margin: 0; }
.item.marcado {
  background: #B4CCE6;
  box-shadow: inset 3px 0 0 #2A5F8F;
}
.item.marcado select {
  background: #E4EEF8;
  border-color: #7BA3C9;
  font-weight: 600;
}

.cat { margin-top: 4px; font-size: 12px; font-weight: 700; }

.acciones { display: flex; flex-wrap: wrap; gap: 3px; margin: 4px 0; align-items: center; }

.acciones form { display: inline-flex; gap: 3px; align-items: center; margin: 0; }

.acciones form input[name="motivo"] { width: 180px; }

/* Mismo aire que Entrar: no pegar Guardar / Enviar al campo o caja de arriba */
p:has(> .btn),
p.acciones:has(.btn[type="submit"]),
.acciones:has(> button.btn[type="submit"]) {
  margin-top: 18px !important;
}

.login-box {
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
  background: #FBFBFB;
  border-color: #E8E8E8;
}
.login-logo {
  display: block;
  width: min(280px, 100%);
  height: auto;
  margin: 4px auto 8px;
}
.login-box form { text-align: left; }
.login-box form p {
  text-align: center;
  margin: 18px 0 6px;
}
.login-box h1 { display: none; }
body.login-pag {
  background: #153A6E;
  min-height: 100vh;
}
body.login-pag .wrap {
  max-width: none;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 12px;
}
body.login-pag .wrap .ok,
body.login-pag .wrap .err {
  max-width: 420px;
  width: 100%;
  text-align: center;
  margin: 0;
}
body.login-pag .login-box .hint { color: #4a5d73; }

.meta { font-size: 12px; margin: 0 0 4px; }

.fila-item {

  display: grid;

  grid-template-columns: minmax(140px, 1.4fr) 130px 110px 140px minmax(90px, 1fr) 120px;

  gap: 4px;

  align-items: end;

  padding: 3px 0;

  border-bottom: 1px solid var(--borde);

}

.fila-item .nom { font-weight: 700; font-size: 12px; line-height: 1.15; }

.fila-item .nom small { display: block; font-weight: 500; color: #5a6b7a; font-size: 10px; }

.fila-item .btn { padding: 3px 7px; }

input[readonly] { background: #F4F6F8; }

.por-imp td { background: #fff8dc; }
.lista-pac {
  margin: 8px 0 0;
  border: 1px solid var(--borde);
  border-radius: 6px;
  background: #fff;
  max-height: 280px;
  overflow: auto;
}
.lista-pac > .hint { padding: 6px 8px 2px; margin: 0; }
.lista-pac table { width: 100%; border-collapse: collapse; }
.lista-pac th, .lista-pac td { padding: 5px 8px; text-align: left; font-size: 12px; border-bottom: 1px solid var(--borde); }
.lista-pac th { background: #F4F6F8; position: sticky; top: 0; }
.lista-pac tbody tr { cursor: pointer; }
.lista-pac tbody tr:hover, .lista-pac tbody tr.on { background: #E8F0FA; }
.caja-pedido {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--fondo);
  margin: 8px 0 0;
  padding: 6px 0 2px;
}
.pedido {
  background: #f4f8fc;
  border: 1px solid var(--navy);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  max-height: 72px;
  overflow: auto;
  margin: 0;
}
.caja-pedido .acciones { margin: 18px 0 0; }
.mix { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #E2E6EC; min-width: 80px; }
.mix i { display: block; height: 100%; }
.okb { background: #28a745; }
.ordb { background: #ffc107; }
.prb { background: #17a2b8; }
.canb { background: #dc3545; }
body.app.dash-fit { height: 100vh; overflow: hidden; }
body.app.dash-fit .principal {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.app.dash-fit .cab { flex: 0 0 auto; }
.dash-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  max-width: none;
  width: auto;
  margin: 4px 8px 6px !important;
  padding: 0 6px !important;
}
.dash {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 5px;
}
.dash-top {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}
.dash-periodo {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 6px;
  padding: 4px 8px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.dash-periodo label {
  display: inline !important;
  margin: 0;
  font-size: 10px;
  width: auto;
}
.dash-periodo select {
  width: auto !important;
  min-width: 72px;
  display: inline-block;
}
.dash-periodo .sel-dia { min-width: 46px; width: 50px !important; }
.dash-periodo .per-box { display: inline-flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.dash-kpis { flex: 1 1 auto; min-width: 0; margin: 0; }
.dash-kpis.cards { gap: 5px; }
.est-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0;
  flex: 0 0 auto;
}
.est-cols .est {
  border-radius: 6px;
  padding: 10px 8px 8px;
  text-align: center;
  color: #fff;
  min-width: 0;
  overflow: hidden;
}
.est-cols .est b {
  display: block;
  font-size: 15px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.est-cols .est em {
  display: block;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.est-cols .est span { font-size: 11px; font-weight: 700; display: block; margin-bottom: 2px; }
.est-cols .est.hecho { background: #28a745; }
.est-cols .est.no { background: #e6b800; color: #222; }
.est-cols .est.proc { background: #17a2b8; }
.est-cols .est.resto { background: #dc3545; }
.c-hecho { color: #1b7a3d; font-weight: 700; }
.c-no { color: #b8860b; font-weight: 700; }
.c-proc { color: #0d6f82; font-weight: 700; }
.c-resto { color: #b91c1c; font-weight: 700; }
.dash-kpis .stat { padding: 5px 7px; min-width: 0; }
.dash-kpis .stat span, .dash-kpis .stat b { white-space: nowrap; }
.dash-kpis .stat b { font-size: 13px; line-height: 1.2; }
.st-ord { border-top: 3px solid #1B4B7A; }
.st-ok { border-top: 3px solid #28a745; }
.st-pen { border-top: 3px solid #17a2b8; }
.st-can { border-top: 3px solid #dc3545; }
.dash-cats {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 5px;
  min-height: 0;
}
.cat-card {
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 6px;
  padding: 4px 6px 5px;
  min-width: 0;
}
.cat-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 4px; }
.cat-tit { flex: 1 1 auto; min-width: 0; }
.cat-nom {
  display: block;
  font-size: 11px;
  line-height: 1.2;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
}
.cat-meta {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  font-weight: 700;
  color: #1B4B7A;
  line-height: 1.2;
}
.cat-top > span { display: inline-flex; gap: 2px; flex: 0 0 auto; }
.cat-top form { margin: 0; }
.mini {
  background: #fff;
  border: 1px solid var(--navy);
  color: var(--navy);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.3;
}
.cat-card small {
  display: flex;
  justify-content: space-between;
  gap: 3px;
  font-size: 9px;
  color: #5a6b7a;
  margin-top: 2px;
  white-space: nowrap;
}
.cat-card .mix { height: 7px; margin: 3px 0 2px; }
.dash-body {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.9fr) minmax(0, 1.45fr);
  gap: 6px;
  min-height: 0;
  align-items: stretch;
}
.dash-body .card {
  margin: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.dash-body table { font-size: 11px; }
.dash-body th, .dash-body td { padding: 1px 4px; }
.dash-col-der {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.75fr);
  gap: 6px;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}
.dash-col-der .card {
  overflow: auto;
}
.dash-col-der .card:first-child,
.dash-col-der .card:last-child {
  flex: none;
}
.dash-usr-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.dash-usr-col .card { flex: 1 1 50%; min-height: 0; overflow: auto; }
.usr-nota { margin: 0 0 2px; font-size: 10px; color: #5a6b7a; }
.tab-usr { width: 100%; table-layout: fixed; }
.tab-usr th, .tab-usr td { padding: 2px 4px; }
.tab-usr th.nom, .tab-usr td.nom { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-usr th.num, .tab-usr td.num {
  text-align: right;
  width: 42px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.tab-usr th.bar, .tab-usr td.bar { width: 42%; }
.tab-usr td.bar i {
  display: block;
  height: 8px;
  border-radius: 4px;
  min-width: 2px;
}
.tab-usr tbody tr:nth-child(even) { background: #f7f9fb; }
.tab-met { width: 100%; }
.tab-met th.nom, .tab-met td.nom { text-align: left; }
.tab-met th.num, .tab-met td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tab-met td.conv { font-weight: 700; color: #1b7a3d; }
.tab-met tbody tr:nth-child(even) { background: #f7f9fb; }
.tab-met tbody tr.on td { background: #e8f1fa; }
.tab-usr-admin { width: 100%; }
.tab-usr-admin th.nom, .tab-usr-admin td.nom { text-align: left; font-weight: 700; white-space: nowrap; }
.tab-usr-admin th.num, .tab-usr-admin td.num { text-align: center; width: 70px; }
.tab-usr-admin td form { margin: 0; display: block; }
.tab-usr-admin .acc-clave {
  display: flex;
  gap: 6px;
  align-items: center;
  max-width: 260px;
}
.tab-usr-admin .acc-clave input { width: 140px; margin: 0; }
.tab-usr-admin tbody tr:nth-child(even) { background: #f7f9fb; }
.tab-usr-admin tr.on-edit td { background: #E8F0FA; }
.btn.peligro { color: #b91c1c; border-color: #b91c1c; }
.dash-graf-top { flex: 0 0 auto; min-width: 0; }
.dash-graf .graf-row {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}
#cv_barras {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.dash-body .card.dash-graf {
  overflow: hidden;
  justify-content: flex-start;
  gap: 6px;
}
.dona-caja { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.dona {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  position: relative;
}
.dona::after {
  content: "";
  position: absolute;
  inset: 22px;
  background: #fff;
  border-radius: 50%;
}
.dona-ley { font-size: 10px; line-height: 1.35; }
.dona-ley span { display: flex; align-items: center; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.okb, .dot.ordb, .dot.prb, .dot.canb { width: 8px; height: 8px; }

.stat small { display: block; font-size: 10px; color: #5a6b7a; }
.rep-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.met-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 8px;
  align-items: start;
}
.met-izq, .met-der { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.met-izq .card canvas,
#cv_embudo, #cv_antig, #cv_mix {
  width: 100%;
  display: block;
}
#cv_embudo { height: 188px; }
#cv_antig { height: 128px; }
.met-kpi-fila {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.met-kpi-fila .btn { margin-left: auto; }
.chip {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
}
.chip-sol { background: #e6ecf2; color: #003366; }
.chip-ok { background: #d4edda; color: #155724; }
.chip-age { background: #cce5ff; color: #004085; }
.chip-can { background: #f8d7da; color: #721c24; }
.chip-med { background: #fff3cd; color: #856404; }
.met-filtro-det {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.met-filtro-det label { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.met-filtro-det select { min-width: 180px; }
td.estuds { max-width: 260px; font-size: 11px; vertical-align: top; }
td.estuds details { margin: 0; }
td.estuds summary { cursor: pointer; color: var(--navy); font-weight: 600; list-style: none; }
td.estuds summary::-webkit-details-marker { display: none; }
td.estuds summary::before { content: "▸ "; }
td.estuds details[open] summary::before { content: "▾ "; }
td.estuds ul { margin: 4px 0 0; padding-left: 16px; }

body.app:has(.barra-paso) .wrap { padding-bottom: 72px; }
.barra-paso {
  position: fixed;
  left: 188px;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 56px;
  padding: 8px 16px;
  background: #fff;
  border-top: 2px solid var(--navy);
  box-shadow: 0 -2px 10px rgba(13, 59, 102, 0.12);
}
.barra-paso > :first-child { margin-right: auto; }
.barra-paso .hint { margin-right: auto; }

@media (max-width: 800px) {

  .fila, .fila3, .item, .cards, .fila-item, .rep-kpis, .met-layout, .msg-layout { grid-template-columns: 1fr; }
  .barra-paso { left: 0; }

  .msg-layout { gap: 12px; }
  #chat { min-height: 240px; max-height: 50vh; overflow-y: auto; }

  .kpis { flex-direction: column; align-items: stretch; }
  .kpi { flex-wrap: wrap; padding: 8px 10px; font-size: 13px; }
  .kpi-cerrar { margin-left: 0; margin-top: 4px; }

  .stat { padding: 10px 12px; }
  .stat b { font-size: 20px; }

  .grad input { width: 100%; min-height: 40px; }

  /* Tablas anchas: scroll horizontal en vez de aplastar */
  .wrap,
  .card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .wrap table,
  .card table {
    min-width: 280px;
  }
}


