:root {
  --navy: #3D4F5F;
  --accent: #7BA7BC;
  --bg: #F5F7FA;
  --border: #C5CDD3;
  --gris: #8C9DA6;
  --rojo: #C08B89;
  --verde: #7CAE7A;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: Arial, sans-serif; font-size: 14px;
  background: var(--bg); color: #2b3338;
}
header {
  background: var(--navy); color: #fff; padding: 10px 24px;
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
}
header .logo { font-size: 20px; font-weight: bold; letter-spacing: 1px; }
header nav a {
  color: #d9e2e8; text-decoration: none; padding: 6px 10px; border-radius: 4px;
  font-weight: bold; font-size: 13px;
}
header nav a:hover, header nav a.activa { background: rgba(255,255,255,.15); color: #fff; }
header .badge {
  background: var(--rojo); color: #fff; border-radius: 10px;
  padding: 1px 8px; font-size: 12px; margin-left: 4px;
}
main { padding: 20px 24px 60px; max-width: 1280px; margin: 0 auto; }
h1 { color: var(--navy); font-size: 22px; margin: 6px 0 16px; }
h2 { color: var(--navy); font-size: 16px; margin: 22px 0 8px; }

.kpis { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.kpi {
  background: #fff; border: 1px solid var(--border); border-top: 4px solid var(--accent);
  padding: 12px 18px; min-width: 190px; flex: 1;
}
.kpi .lab { color: var(--gris); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.kpi .val { font-size: 26px; font-weight: bold; color: var(--navy); margin-top: 2px; }

.estados-fila { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 6px; }
.estado-caja { flex: 1; min-width: 100px; text-align: center; color: #fff; padding: 8px 4px; }
.estado-caja .n { font-size: 22px; font-weight: bold; }
.estado-caja .t { font-size: 11px; }

table { border-collapse: collapse; width: 100%; background: #fff; margin-bottom: 18px; }
th {
  background: var(--navy); color: #fff; font-size: 12px; padding: 7px 9px;
  text-align: left; white-space: nowrap;
}
td { border: 1px solid #e2e7ea; padding: 6px 9px; font-size: 13px; }
tr:nth-child(even) td { background: #f8fafb; }
tr:hover td { background: #eef4f7; }
td.num, th.num { text-align: right; }
td.c, th.c { text-align: center; }
a.inc { color: var(--navy); font-weight: bold; text-decoration: none; }
a.inc:hover { text-decoration: underline; }

.seccion-titulo {
  color: #fff; font-weight: bold; font-size: 13px; padding: 7px 12px; margin-top: 18px;
}
.pill {
  display: inline-block; color: #fff; border-radius: 3px; padding: 2px 9px;
  font-size: 11px; font-weight: bold; white-space: nowrap;
}
.dias-mal { color: var(--rojo); font-weight: bold; }
.vacia { color: var(--gris); font-style: italic; padding: 10px; background: #fff;
  border: 1px solid #e2e7ea; margin-bottom: 18px; }

.filtros { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filtros select, .filtros input[type=text] {
  padding: 6px 8px; border: 1px solid var(--border); font-size: 13px; background: #fff;
}
button, .btn {
  background: var(--accent); border: none; color: #fff; font-weight: bold;
  padding: 7px 14px; cursor: pointer; font-size: 13px; text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: #6795aa; }
.btn-navy { background: var(--navy); }
.btn-rojo { background: var(--rojo); }
.btn-gris { background: var(--gris); }

.ficha-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tarjeta { background: #fff; border: 1px solid var(--border); padding: 14px 16px; }
.tarjeta h3 { margin: 0 0 10px; color: var(--navy); font-size: 14px;
  border-bottom: 2px solid var(--accent); padding-bottom: 6px; }
.dato { display: flex; margin: 4px 0; font-size: 13px; }
.dato .l { width: 150px; color: var(--gris); flex-shrink: 0; }
.dato .v { font-weight: bold; }
.problema { white-space: pre-wrap; background: #f8fafb; padding: 10px;
  border: 1px solid #e2e7ea; font-size: 13px; }
.bloqueo-aviso { background: #fdf0ef; border: 1px solid var(--rojo);
  color: #8c4a48; padding: 10px 14px; margin-bottom: 14px; font-weight: bold; }
.acciones-estado { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.hist { font-size: 12px; color: #555; }
.hist td { padding: 4px 8px; }
@media (max-width: 900px) { .ficha-grid { grid-template-columns: 1fr; } }

/* ---------- Movil ---------- */
@media (max-width: 760px) {
  main { padding: 12px 10px 50px; }
  h1 { font-size: 18px; }
  header { padding: 10px 12px; gap: 10px; }
  header nav a { padding: 5px 7px; font-size: 12px; }
  .kpis { gap: 8px; }
  .kpi { min-width: 44%; padding: 10px 12px; }
  .kpi .val { font-size: 19px; }
  .estados-fila { gap: 5px; }
  .estado-caja { min-width: 30%; padding: 6px 2px; }
  .estado-caja .n { font-size: 18px; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  th { white-space: nowrap; }
  td { font-size: 12px; padding: 5px 7px; }
  .filtros select, .filtros input[type=text] { flex: 1; min-width: 140px !important; }
  .ficha-grid { grid-template-columns: 1fr; gap: 12px; }
  .dato .l { width: 120px; font-size: 12px; }
  .acciones-estado { gap: 6px; }
  button, .btn { padding: 8px 10px; font-size: 12px; }
}

/* Bandeja: dos contadores de días y seguimiento en línea */
.dias-ok { color: var(--gris); }
table.bandeja td.ult-mov { font-size: 11px; color: #5C6B73; max-width: 260px; }
table.bandeja td.seg form { display: flex; gap: 4px; margin: 0; }
table.bandeja td.seg input[type=text] {
  width: 150px; padding: 4px 6px; border: 1px solid var(--border); font-size: 12px;
}
table.bandeja td.seg button { padding: 3px 9px; font-size: 12px; background: #7CAE7A; }
.seguimiento-ficha {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  background: #eef5ee; border: 1px solid #c9dcc9; border-radius: 4px;
  padding: 8px 12px; margin-bottom: 14px; max-width: 860px;
}
.seguimiento-ficha input[type=text] { flex: 1; min-width: 240px; padding: 7px; border: 1px solid #c9dcc9; background: #f7fbf7; font-size: 13px; }
.seguimiento-ficha button { background: #7CAE7A; padding: 6px 14px; }

/* Ruta guiada (static/guia.js) */
.guia-foco { outline: 3px solid #7BA7BC; outline-offset: 4px; box-shadow: 0 0 0 6px rgba(123,167,188,.25); border-radius: 4px; scroll-margin: 120px; }
.guia-tarjeta {
  position: fixed; right: 18px; bottom: 18px; z-index: 1000; width: 360px; max-width: calc(100vw - 36px);
  background: #fff; border: 1px solid #C5CDD3; border-top: 5px solid #7BA7BC; box-shadow: 0 8px 28px rgba(0,0,0,.18);
  padding: 14px 16px 12px; font-size: 14px; line-height: 1.45; color: #22303a;
}
.guia-paso { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #5C6B73; font-weight: bold; }
.guia-titulo { font-size: 17px; font-weight: bold; color: var(--navy); margin: 4px 0 6px; }
.guia-texto { margin-bottom: 10px; }
.guia-nota { font-size: 12px; color: #8C9DA6; font-style: italic; margin-bottom: 8px; }
.guia-botones { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.guia-botones button { padding: 7px 14px; font-size: 13px; }
.guia-botones .guia-salir { margin-left: auto; background: none; color: #8C9DA6; font-weight: normal; padding: 6px 4px; }
.guia-botones .guia-salir:hover { color: var(--rojo); text-decoration: underline; }
.guia-banner {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: #eaf2f6; border: 1px solid #b9d2de; border-left: 5px solid #7BA7BC; padding: 10px 14px; margin: 0 0 16px; font-size: 14px;
}
.guia-banner button { padding: 6px 14px; font-size: 13px; }
header nav a.guia-nav { color: #d9e2e8; }
@media (max-width: 520px) { .guia-tarjeta { right: 8px; left: 8px; bottom: 8px; width: auto; max-width: none; } }

/* Agenda semanal */
table.agenda { table-layout: fixed; min-width: 980px; }
table.agenda th, table.agenda td { vertical-align: top; }
table.agenda .ag-eq { width: 130px; font-weight: bold; white-space: nowrap; }
table.agenda td { min-height: 54px; height: 54px; padding: 5px; }
table.agenda .ag-hoy { background: #eef5f8; }
table.agenda .ag-finde { background: #f6f5f2; }
table.agenda .ag-conflicto { background: #fbeeed; outline: 2px solid var(--rojo); outline-offset: -2px; }
.ag-item { background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 3px; padding: 4px 6px; margin-bottom: 4px; font-size: 12px; line-height: 1.3; }
.ag-item.ag-urg { border-color: #e0b0ae; }
.ag-com { color: #5C6B73; font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.ag-papel { color: #8C9DA6; font-size: 10.5px; font-style: italic; }
