:root {
  --bg: #f1f4f9;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #e6e9f1;
  --border-soft: #edf0f6;
  --text: #171b2e;
  --text-soft: #475069;
  --muted: #6b7290;

  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;

  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef9c3;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --info: #0891b2;
  --info-bg: #cffafe;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-full: 999px;

  --shadow-xs: 0 1px 2px rgba(23, 27, 46, .04);
  --shadow-sm: 0 1px 3px rgba(23, 27, 46, .06), 0 1px 2px rgba(23, 27, 46, .04);
  --shadow-md: 0 10px 28px -6px rgba(23, 27, 46, .12), 0 2px 6px rgba(23, 27, 46, .05);
  --shadow-lg: 0 28px 56px -16px rgba(23, 27, 46, .22);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.icon { display: inline-block; vertical-align: -3px; flex: 0 0 auto; }

.wrap { max-width: 100%; margin: 0 auto; padding: 0 28px; }

/* ===== Topbar ===== */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow-xs);
}
.topbar-inner { display: flex; align-items: center; gap: 28px; height: 64px; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; white-space: nowrap; }
.brand-mark {
  width: 32px; height: 32px; flex: 0 0 auto;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.brand-text { font-weight: 700; color: var(--text); font-size: 16px; letter-spacing: -.01em; }

.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--muted);
  text-decoration: none;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: var(--surface-muted); color: var(--text); }
.nav a.active { color: var(--primary); background: var(--primary-50); font-weight: 600; }

.user-box { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto;
  background: var(--primary-50); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta strong { font-size: 13.5px; font-weight: 600; }
.role-pill {
  align-self: flex-start;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 1px 7px; border-radius: var(--radius-full);
  background: var(--border-soft); color: var(--muted);
}
.role-pill.is-admin { background: var(--primary-50); color: var(--primary-dark); }
.user-box .logout {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 13.5px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  transition: background .15s ease, color .15s ease;
}
.user-box .logout:hover { background: var(--danger-bg); color: var(--danger); }

.topbar-alert {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  padding: 7px 12px; border-radius: var(--radius-full);
  background: var(--danger-bg); color: var(--danger);
  text-decoration: none; font-weight: 600; font-size: 13px;
  transition: background .15s ease;
}
.topbar-alert:hover { background: #fde2e2; }
.topbar-alert-count { font-weight: 700; }
.topbar-alert.is-aviso { background: var(--warning-bg); color: #b45309; }
.topbar-alert.is-aviso:hover { background: #fde68a; }
.chip-num { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: var(--radius-full); background: var(--warning-bg); color: #92400e; font-size: 11.5px; text-align: center; }
.chip.is-active .chip-num { background: rgba(255,255,255,.25); color: #fff; }

main.wrap { padding: 28px 28px 64px; }

/* ===== Page header ===== */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-head h2 {
  display: flex; align-items: center; gap: 10px;
  margin: 0; font-size: 22px; letter-spacing: -.01em;
}
.page-head h2 .icon { color: var(--primary); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.col-toggle { position: relative; }
.col-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 12px 14px;
  min-width: 190px;
  display: none;
  z-index: 20;
}
.col-menu.open { display: block; }
.col-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}
.col-menu label:last-child { margin-bottom: 0; }
.col-menu input[type="checkbox"] { width: auto; margin: 0; }
.hidden-col { display: none !important; }

/* ===== Stat cards ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s ease, transform .15s ease;
}
.stat-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.stat-icon {
  width: 38px; height: 38px; flex: 0 0 auto;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-50); color: var(--primary-dark);
}
.stat-icon.is-warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon.is-success { background: var(--success-bg); color: var(--success); }
.stat-icon.is-danger { background: var(--danger-bg); color: var(--danger); }
.stat-icon.is-info { background: var(--info-bg); color: var(--info); }
.stat-body { min-width: 0; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }

/* ===== Cards & layout ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 24px;
  margin-bottom: 20px;
}
.card h2, .card h3 {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 16px; font-size: 16px; font-weight: 600;
}
.card h2 .icon, .card h3 .icon { color: var(--muted); }
.card h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 12px; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2, .card-head h3 { margin: 0; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.tight { gap: 10px; }
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 0; }
}

/* ===== Forms ===== */
label { display: block; font-weight: 500; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input[type="text"], input[type="password"], input[type="file"], input[type="date"], input[type="datetime-local"], select, textarea {
  width: 100%;
  padding: 9px 12px;
  margin-top: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
select:disabled { opacity: .6; cursor: not-allowed; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  line-height: 1.2;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-sm); }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text-soft); }
.btn-outline:hover { background: var(--surface-muted); border-color: var(--border); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: var(--shadow-xs); }
.btn-danger:hover { background: #b91c1c; box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; pointer-events: none; }
.btn-block { width: 100%; justify-content: center; }
.btn-small { padding: 6px 11px; font-size: 13px; }

.alert { display: flex; align-items: center; gap: 9px; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid transparent; font-size: 14px; }
.alert-success { background: var(--success-bg); color: #166534; border-color: #bbf7d0; }
.alert-error { background: var(--danger-bg); color: #991b1b; border-color: #fecaca; }

/* ===== Quick filters ===== */
.quick-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: var(--radius-full);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.chip:hover { background: var(--surface-muted); color: var(--text); }
.chip.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== Filters ===== */
.filters { padding: 16px 18px; }
.filters-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.filters-row .field { flex: 1 1 140px; min-width: 140px; display: flex; flex-direction: column; gap: 3px; }
.filters-row .field label { margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.filters-row .field input,
.filters-row .field select { width: 100%; margin-top: 0; padding: 8px 10px; }
.filters-actions { display: flex; gap: 8px; align-items: flex-end; margin: 0; }

.filters-compact { padding: 12px 16px; }
.filters-compact .filters-row .field { flex: 0 1 180px; min-width: 150px; }

.batch-inline { display: flex; align-items: center; gap: 8px; margin: 0; flex-wrap: wrap; }
.batch-inline select { width: auto; min-width: 150px; margin: 0; padding: 6px 10px; font-size: 13px; }
.batch-count { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }

/* ===== Listado: barra superior compacta + barra de la tabla ===== */
.page-head:has(.quick-filters) { margin-bottom: 14px; }
.page-head .quick-filters { margin-bottom: 0; }
.filters { margin-bottom: 14px; }
.filters-row .field { flex-basis: 120px; min-width: 120px; }

.table-card { padding: 0; overflow: hidden; }
.table-card .table-wrap { padding: 0 6px; }
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap;
  padding: 10px 18px; border-bottom: 1px solid var(--border-soft); background: var(--surface-muted);
}
.table-toolbar-left { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; }
.table-total { font-size: 14px; white-space: nowrap; }
.inline-field {
  display: inline-flex; align-items: center; gap: 8px; margin: 0;
  font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.inline-field select { width: auto; margin: 0; padding: 6px 10px; font-size: 13px; }

/* ===== Table ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 18px; border-bottom: 1px solid var(--border-soft); font-size: 14px; vertical-align: middle; }
th {
  color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  background: var(--surface-muted);
}
.th-sort a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.th-sort a:hover { color: var(--primary); }
.th-sort .sort-ind { font-size: 10px; opacity: .35; }
.th-sort a:hover .sort-ind { opacity: .7; }
.th-sort.is-active a { color: var(--primary-dark); }
.th-sort.is-active .sort-ind { opacity: 1; }
th:first-child { border-radius: var(--radius) 0 0 0; }
th:last-child { border-radius: 0 var(--radius) 0 0; }
tbody tr { transition: background .1s ease; }
tbody tr:hover td { background: var(--surface-muted); }
.empty { padding: 0; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 24px; color: var(--muted); }
.empty-state .icon { color: var(--border); width: 32px; height: 32px; }
.muted { color: var(--muted); }
.odoo-link { display: inline-flex; align-items: center; gap: 5px; color: var(--primary); text-decoration: none; font-weight: 500; }
.odoo-link:hover { color: var(--primary-dark); text-decoration: underline; }
.odoo-link .icon { flex: 0 0 auto; color: var(--muted); }
code { background: var(--surface-muted); border: 1px solid var(--border-soft); padding: 1px 6px; border-radius: 5px; font-size: 13px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 11px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
.badge-pendiente { background: var(--warning-bg); color: #854d0e; }
.badge-asignada { background: var(--primary-100); color: #1e40af; }
.badge-en-gestión { background: #e0e7ff; color: #3730a3; }
.badge-con-novedad { background: #ffedd5; color: #9a3412; }
.badge-facturada { background: #cffafe; color: #155e75; }
.badge-entregada { background: var(--success-bg); color: #166534; }
.badge-rechazada { background: var(--danger-bg); color: #991b1b; }
.badge-anulada { background: var(--border-soft); color: var(--text-soft); }
.badge-generada { background: var(--success-bg); color: #166534; }
.badge-emitida { background: var(--success-bg); color: #166534; }
.badge-light { background: var(--surface-muted); color: var(--text-soft); }

.flag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
  background: var(--border-soft);
  color: var(--text-soft);
}
.flag-tutela { background: var(--danger-bg); color: #991b1b; }

.estado-form { margin: 0; display: flex; align-items: center; gap: 6px; }
.estado-fallback { width: 26px; height: 26px; }
.js .estado-fallback { display: none; }

.asignado-form { margin: 0; display: flex; align-items: center; gap: 6px; }
.asignado-select { width: auto; min-width: 130px; margin: 0; padding: 6px 9px; font-size: 13px; }
.asignado-fallback { width: 26px; height: 26px; }
.js .asignado-fallback { display: none; }
.estado-select {
  width: auto;
  margin: 0;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(0, 0, 0, .08);
  cursor: pointer;
}

.sla { display: flex; align-items: center; gap: 8px; }
.sla-track { position: relative; width: 90px; flex: 0 0 auto; height: 7px; background: var(--border-soft); border-radius: var(--radius-full); overflow: hidden; }
.sla-marca { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); }
.entrega-fallida { color: var(--danger); font-weight: 600; }
.recorrido { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 18px 0 6px; }
.recorrido-paso { position: relative; padding-top: 20px; font-size: 13px; }
.recorrido-paso::before { content: ""; position: absolute; top: 5px; left: 0; right: 0; height: 3px; background: var(--border); }
.recorrido-paso:last-child::before { right: auto; width: 12px; }
.recorrido-paso.is-hecho::before { background: var(--primary); }
.recorrido-paso:last-child.is-hecho::before { background: var(--primary); }
.recorrido-punto { position: absolute; top: 0; left: 0; width: 13px; height: 13px; border-radius: 50%; background: var(--surface); border: 3px solid var(--border); }
.recorrido-paso.is-hecho .recorrido-punto { background: var(--primary); border-color: var(--primary); }
.recorrido-paso.is-fallo .recorrido-punto { background: var(--danger); border-color: var(--danger); }
.recorrido-paso strong { display: block; }
.recorrido-paso small { color: var(--muted); }
.recorrido-nota { margin: 4px 0 0; font-size: 12.5px; }
@media (max-width: 560px) {
  .recorrido { grid-template-columns: 1fr; gap: 10px; }
  .recorrido-paso::before { display: none; }
}
.sla-fill { height: 100%; border-radius: var(--radius-full); transition: width .3s; }
.sla-label { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
/* Plazo de autorizaciones ya gestionadas: barra quieta y sin rojo. */
.sla-cerrada .sla-fill { transition: none; }
.sla-cerrada.is-ok .sla-fill { background: #86efac; }
.sla-cerrada.is-ok .sla-label { color: #15803d; }
.sla-cerrada.is-tarde .sla-fill { background: #fcd34d; }
.sla-cerrada.is-tarde .sla-label { color: #b45309; }
.sla-cerrada.is-cerrada .sla-fill { background: var(--border); }
/* ===== Novedades: barras horizontales dentro de tablas ===== */
.hbar-table td, .hbar-table th { padding-top: 9px; padding-bottom: 9px; }
.hbar-col { width: 45%; }
.hbar { position: relative; display: flex; align-items: center; gap: 8px; min-height: 18px; }
.hbar-fill { display: block; height: 10px; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--primary); opacity: .85; }
.hbar-fill.is-alerta { background: var(--danger); }
.hbar-fill.is-ok { background: #22c55e; }
.hbar-stack { display: flex; gap: 2px; min-width: 2px; }
.hbar-stack .hbar-fill { min-width: 0; border-radius: 0; }
.hbar-stack .hbar-fill:last-child { border-radius: 0 4px 4px 0; }
.leyenda { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-left: 8px; }
.leyenda.is-ok { background: #22c55e; margin-left: 0; }
.leyenda.is-tarde { background: #f59e0b; }
.flag.flag-plazo { background: var(--warning-bg); color: #92400e; }
.plazo-conteo { display: block; margin-top: 6px; font-size: 12.5px; }
.sync-estado { padding: 10px 14px; margin: 0 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-soft); background: var(--surface-muted); font-size: 13.5px; line-height: 1.6; }
.sync-estado.is-ok { border-color: #bbf7d0; background: var(--success-bg); }
.sync-estado.is-error { border-color: #fecaca; background: var(--danger-bg); }
.comando { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: #0f172a; color: #e2e8f0; font-size: 13px; overflow-x: auto; white-space: pre; }

/* ===== Inducción y ayuda ===== */
.induccion-aviso { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--primary-100); background: var(--primary-50); border-radius: var(--radius-sm); font-size: 14px; color: var(--text); }
.induccion-aviso[hidden] { display: none; }
.induccion-aviso > .icon { color: var(--primary); flex: none; }
.induccion-aviso > span { flex: 1 1 280px; }
.ayuda { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 20px; align-items: start; }
.ayuda-indice { position: sticky; top: 84px; padding: 18px; }
.ayuda-indice strong { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.ayuda-indice ol { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.ayuda-indice a { color: var(--text-soft); text-decoration: none; }
.ayuda-indice a:hover { color: var(--primary); }
.ayuda-contenido .card { scroll-margin-top: 84px; }
.ayuda-contenido p, .ayuda-lista { font-size: 14px; line-height: 1.65; color: var(--text-soft); max-width: 85ch; }
.ayuda-lista { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 6px; }
.ayuda-lista ul { margin: 6px 0; padding-left: 18px; }
.ayuda-pasos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 14px 0; }
.ayuda-pasos > div { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface-muted); }
.ayuda-pasos span { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 13px; }
.ayuda-pasos p { margin: 0; font-size: 13.5px; }
.ayuda-tabla { margin: 4px 0 14px; }
.ayuda-tabla td { font-size: 13.5px; }
.ayuda-ok { color: #15803d; font-weight: 600; }
.ayuda-tarde { color: #b45309; font-weight: 600; }
.ayuda-faq dt { font-weight: 600; margin-top: 12px; font-size: 14px; }
.ayuda-faq dd { margin: 4px 0 0; font-size: 14px; color: var(--text-soft); line-height: 1.6; }
@media (max-width: 900px) {
  .ayuda { grid-template-columns: 1fr; }
  .ayuda-indice { position: static; }
}
.hbar-fill.is-tarde { background: #f59e0b; }
.doc-link { color: var(--primary-dark); text-decoration: none; border-bottom: 1px dashed var(--primary-100); }
.doc-link:hover { color: var(--primary); border-bottom-color: var(--primary); }
.filtro-activo { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: var(--radius-full); background: var(--primary-50); border: 1px solid var(--primary-100); font-size: 13px; color: var(--text-soft); }
.ficha-asesores { margin: 6px 0 0; font-size: 13px; }
.filtro-activo a { display: inline-flex; padding: 2px; border-radius: 50%; color: var(--muted); }
.filtro-activo a:hover { background: var(--primary-100); color: var(--primary-dark); }
.carga-filtro { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.chip-check { cursor: pointer; margin: 0; }
.chip-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-check:focus-within { outline: 2px solid var(--primary-100); outline-offset: 1px; }
.chart-hit { fill: transparent; }
.chart-hit:hover { fill: var(--primary); fill-opacity: .06; }
.check-inline { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 14px; font-size: 13px; color: var(--text-soft); font-weight: 500; }
.check-inline input { width: auto; margin: 2px 0 0; }
.reparto-opciones { margin: 4px 0 14px; }
.reparto-opciones > .check-inline { margin-bottom: 6px; }
.reparto-asesores { border: 1px solid var(--border-soft); border-radius: var(--radius-sm); margin: 0; padding: 8px 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 14px; }
.reparto-asesores .check-inline { margin: 2px 0; }
.reparto-criterio { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 2px 18px; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--border-soft); }
.reparto-asesores:disabled { opacity: .5; }
.tomar-cell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tomar-cell form { margin: 0; }
.stats .stat-card { min-width: 0; }
.stats .stat-label { white-space: normal; }
.hbar-num { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.hbar-nota { margin: 12px 0 0; }
.hbar-table tr.is-selected td { background: var(--primary-50); }
.stat-sub { font-size: 13px; font-weight: 600; color: var(--muted); }
@media (max-width: 560px) {
  .stat-label { white-space: normal; }
}
.novedad-cell .flag { margin: 0 4px 3px 0; }
.novedad-texto { font-size: 12px; margin-top: 2px; }
#detalle .card-head { flex-wrap: wrap; }
#detalle .card-head h3 { margin: 0; }

.plazo-nota { display: block; margin-top: 4px; font-size: 12px; font-weight: 600; }
.plazo-nota.is-ok { color: #15803d; }
.plazo-nota.is-tarde { color: #b45309; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 18px; flex-wrap: wrap; }
.pagination .inline-field { margin-left: 12px; }
.pagination a {
  color: var(--text-soft); text-decoration: none; font-weight: 500; font-size: 13.5px;
  padding: 7px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); transition: background .15s ease, color .15s ease;
}
.pagination a:hover { background: var(--primary-50); color: var(--primary-dark); border-color: var(--primary-100); }
.pagination span { color: var(--muted); font-size: 13.5px; padding: 0 6px; }

.datos-form { margin-bottom: 16px; }
.datos-acciones { display: flex; gap: 8px; margin-top: 16px; }

.note-actions { margin: 10px 0 18px; }
.notes { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.notes li { background: var(--surface-muted); border-left: 3px solid var(--primary); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 10px 14px; }
.notes p { font-weight: 500; margin: 0 0 4px; }

.timeline { list-style: none; padding: 0 0 0 18px; position: relative; margin: 0; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding: 0 0 18px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -18px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--primary); }
.timeline p { font-weight: 500; margin: 0 0 4px; }
.timeline .detail { color: var(--muted); font-weight: 400; word-break: break-word; }
.meta { font-size: 12px; color: var(--muted); }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 6px; background: var(--surface-muted); color: var(--text-soft); margin-right: 6px; }

.summary { margin: 0; padding-left: 20px; }
.summary li { padding: 4px 0; }
.summary.errors li { color: var(--danger); }
.summary.warnings li { color: var(--warning); }

/* ===== Login ===== */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 16px;
  background: radial-gradient(circle at 15% 15%, var(--primary-50), transparent 45%),
              radial-gradient(circle at 85% 85%, var(--primary-50), transparent 45%),
              var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-mark {
  width: 48px; height: 48px; margin: 0 auto 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
}
.login-card h1 { margin: 0 0 22px; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.login-card form { display: grid; gap: 14px; text-align: left; }

.demo-accesos { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--border); display: grid; gap: 8px; }
.demo-accesos form { display: block; }
.demo-titulo { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.demo-acceso {
  width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-muted); cursor: pointer; font: inherit; text-align: left;
}
.demo-acceso:hover { border-color: var(--primary); background: var(--primary-50); }
.demo-nombre { font-size: 13.5px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.demo-cred { font-size: 12.5px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }

/* ===== Detalle de autorización ===== */
.detalle-hero { padding: 24px; }
.detalle-hero-row { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title h1 { font-size: 25px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.person { margin-top: 10px; font-size: 15px; font-weight: 600; }
.person span { color: var(--muted); font-weight: 400; margin-left: 6px; }
.company { color: var(--muted); margin-top: 2px; }

.deadline { min-width: 320px; text-align: right; display: grid; gap: 10px; justify-items: end; }
.deadline-row { display: flex; gap: 10px; width: 100%; }
.deadline-row .deadline-box { flex: 1 1 150px; min-width: 0; }
.deadline-box { width: 100%; background: var(--surface-muted); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 11px 15px; text-align: left; }
.deadline-box small { color: var(--muted); display: flex; align-items: center; gap: 5px; font-size: 12px; }
.deadline-box strong { display: block; margin-top: 2px; font-size: 20px; color: var(--text); }
.bar { height: 6px; background: var(--border-soft); border-radius: var(--radius-full); margin-top: 7px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: var(--radius-full); }

.detalle-datos { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-soft); }

.datos-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px 32px; align-items: start; }
#datos-vista, #datos-vista .data, .state-row { display: contents; }

.data dt { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; font-weight: 500; }
.data dd { font-weight: 600; font-size: 14.5px; margin: 0; }

.state-row label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.state-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.state-row select { width: auto; flex: 1 1 150px; min-width: 120px; margin-top: 0; }
.state-row .motivo-reapertura { margin: 8px 0 0; }
.state-row .motivo-reapertura textarea { margin-top: 4px; min-height: 0; font-size: 13px; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

/* ===== Dashboard: gráfico de líneas ===== */
.chart-wrap { width: 100%; overflow-x: auto; }
.line-chart { width: 100%; height: auto; min-width: 560px; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; }
.chart-legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-soft); text-decoration: none; }
.chart-legend-item:hover { color: var(--primary); }
.chart-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

@media (max-width: 860px) {
  .two { grid-template-columns: 1fr; }
  .deadline { text-align: left; justify-items: start; width: 100%; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  main.wrap { padding: 20px 16px 48px; }
}

/* ===== Configuración / usuarios ===== */
.settings-page { max-width: 100%; }
.odoo-help { color: var(--muted); margin: 0 0 18px; max-width: 70ch; font-size: 13.5px; line-height: 1.6; }

.who strong { display: block; font-weight: 600; font-size: 14px; }
.who span { color: var(--muted); font-size: 12.5px; }

.row-form { display: flex; gap: 6px; align-items: center; margin: 0; flex-wrap: wrap; }
.row-form select { margin-top: 0; width: auto; min-width: 112px; padding: 7px 8px; font-size: 13px; }
.row-form input[type="password"] { margin-top: 0; width: 148px; padding: 7px 10px; font-size: 13px; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; flex: 0 0 auto; }

/* ===== Modal ===== */
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 100; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, .5);
  animation: modal-fade .15s ease;
}
.modal-dialog {
  position: relative;
  margin: 8vh auto 0;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  animation: modal-pop .18s ease;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--border-soft); flex: 0 0 auto;
}
.modal-head h3 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 16px; font-weight: 600; }
.modal-head h3 .icon { color: var(--muted); }
.modal-close {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex: 0 0 auto;
  border: none; background: transparent; color: var(--muted); border-radius: var(--radius-sm);
  cursor: pointer; transition: background .15s ease, color .15s ease;
}
.modal-close:hover { background: var(--surface-muted); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-body form { display: grid; gap: 4px; }
.modal-result { margin-top: 14px; }
.modal-result .alert { margin-bottom: 12px; }

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 560px) {
  .modal-dialog { margin: 0; max-height: 100vh; height: 100%; border-radius: 0; }
}
