/* ── Tokens de marca Hablandis ─────────────────────────────────────────────── */
:root {
  --navy:        #0d1b2a;
  --navy-mid:    #1a2e42;
  --navy-light:  #2a4460;
  --yellow:      #f5c800;
  --yellow-dark: #d4a900;
  --white:       #ffffff;
  --gray-100:    #f4f5f7;
  --gray-200:    #e8eaed;
  --gray-400:    #9aa0a6;
  --gray-700:    #444950;
  --error:       #d93025;
  --font-mono:   'Aglet Mono', 'Courier New', monospace;
  --font-sans:   system-ui, -apple-system, sans-serif;
  --radius:      6px;
  --shadow:      0 2px 8px rgba(0,0,0,.18);
}

/* ── Reset mínimo ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: var(--font-sans);
  background: var(--gray-100);
  color: var(--navy);
  min-height: 100dvh;
}

/* ── Pantalla de login ─────────────────────────────────────────────────────── */
#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 1.5rem;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  background: var(--navy);
  color: var(--yellow);
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card h1 {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  color: var(--navy);
}

.login-subtitle {
  font-size: .875rem;
  color: var(--gray-400);
  margin-top: -.25rem;
}

.login-error {
  font-size: .875rem;
  color: var(--error);
  background: #fce8e6;
  border-radius: var(--radius);
  padding: .5rem .75rem;
  width: 100%;
  text-align: left;
}

/* ── Formulario email/contraseña ───────────────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  width: 100%;
}

.field-label {
  font-size: .8125rem;
  font-weight: 500;
  color: var(--navy);
  text-align: left;
}

input[type="email"],
input[type="password"] {
  width: 100%;
  padding: .5rem .75rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .9375rem;
  color: var(--navy);
  background: var(--white);
  transition: border-color .15s;
}
input[type="email"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--navy);
}

.btn-login {
  width: 100%;
  padding: .625rem 1.25rem;
  background: var(--navy);
  color: var(--yellow);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: .9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  margin-top: .25rem;
}
.btn-login:hover  { background: var(--navy-light); }
.btn-login:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

/* ── Header ────────────────────────────────────────────────────────────────── */
.app-header {
  background: var(--navy);
  color: var(--white);
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: .625rem;
}

.header-logo {
  width: 32px;
  height: 32px;
  background: var(--yellow);
  color: var(--navy);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-title {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
}

.header-user {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.user-email {
  font-size: .8125rem;
  color: var(--gray-400);
  display: none;
}
@media (min-width: 480px) { .user-email { display: block; } }

.btn-signout {
  background: transparent;
  border: 1px solid var(--navy-light);
  color: var(--white);
  font-size: .8125rem;
  padding: .375rem .75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.btn-signout:hover  { background: var(--navy-light); }
.btn-signout:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

/* ── Main ──────────────────────────────────────────────────────────────────── */
.app-main {
  padding: 1.5rem 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
}

.leads-header {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: 1rem;
}

.leads-header h2 {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  color: var(--navy);
}

.leads-count {
  font-size: .8125rem;
  color: var(--gray-400);
}

.leads-status {
  color: var(--gray-700);
  font-size: .9375rem;
  padding: .75rem 0;
}

/* ── Tabla ─────────────────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--white);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

thead {
  background: var(--navy);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: .8125rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

th {
  padding: .75rem 1rem;
  text-align: left;
  white-space: nowrap;
  font-weight: 600;
}

td {
  padding: .625rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr {
  cursor: pointer;
  transition: background .1s;
}
tbody tr:hover { background: var(--gray-100); }

td a {
  color: var(--navy);
  text-decoration: none;
}
td a:hover { text-decoration: underline; color: var(--navy-light); }

.badge-taller {
  display: inline-block;
  background: var(--yellow);
  color: var(--navy);
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 600;
  padding: .125rem .5rem;
  border-radius: 3px;
  white-space: nowrap;
}

/* ── Badges de vía (listado por persona) ────────────────────────────────────── */
.badge-via {
  display: inline-block;
  background: var(--gray-200);
  color: var(--navy);
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 600;
  padding: .125rem .4375rem;
  border-radius: 3px;
  white-space: nowrap;
}
.badge-via.auto {
  background: var(--yellow);
}
.via-none { color: var(--gray-400); }

/* ── Vía de entrada (chips en la ficha) ─────────────────────────────────────── */
.panel-vias-group { grid-column: 1 / -1; }
.vias-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
}
.via-toggle {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: .3125rem .5625rem;
  cursor: pointer;
  font-size: .8125rem;
  color: var(--navy);
  transition: background .15s, border-color .15s;
}
.via-toggle:hover { border-color: var(--gray-400); }
.via-toggle:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.via-toggle.active {
  background: #f0fdf4;
  border-color: #16a34a;
}
.via-toggle.is-auto {
  cursor: default;
  opacity: .9;
}
.via-toggle-check {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--gray-400);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 700;
  color: var(--white);
  background: var(--white);
}
.via-toggle.active .via-toggle-check {
  background: #16a34a;
  border-color: #16a34a;
}

/* ── Badges de cualificación ────────────────────────────────────────────────── */
.badge-cal {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: .125rem .5rem;
  border-radius: 3px;
  white-space: nowrap;
}
.badge-cal.frio        { background: #dbeafe; color: #1e40af; }
.badge-cal.templado    { background: #fef3c7; color: #92400e; }
.badge-cal.caliente    { background: #fee2e2; color: #991b1b; }
.badge-cal.enfriandose { background: var(--gray-200); color: var(--gray-700); }
.badge-cal.vacio       { color: var(--gray-400); font-family: var(--font-sans);
                         font-weight: 400; font-size: .875rem; }

/* ── Overlay ─────────────────────────────────────────────────────────────────  */
#panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  z-index: 99;
}

/* ── Panel lateral ───────────────────────────────────────────────────────────  */
#lead-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(480px, 100vw);
  background: var(--white);
  box-shadow: -4px 0 24px rgba(0, 0, 0, .18);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform .25s ease, visibility 0s linear .25s;
}
#lead-panel.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform .25s ease, visibility 0s linear 0s;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.panel-supertitle {
  font-size: .75rem;
  color: var(--gray-400);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .2rem;
}
.panel-header h3 {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--navy);
}
.panel-close-btn {
  background: none;
  border: none;
  font-size: 1.125rem;
  color: var(--gray-400);
  cursor: pointer;
  padding: .25rem .5rem;
  border-radius: var(--radius);
  flex-shrink: 0;
  line-height: 1;
  transition: color .15s, background .15s;
}
.panel-close-btn:hover { color: var(--navy); background: var(--gray-100); }
.panel-close-btn:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

.panel-body {
  flex: 1;
  overflow-y: auto;
}

.panel-section {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
}
.panel-section-title {
  font-family: var(--font-mono);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-400);
  margin-bottom: .75rem;
}

/* Datos del formulario (solo lectura) */
.panel-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .3rem .75rem;
  font-size: .875rem;
}
.panel-dl dt { color: var(--gray-400); white-space: nowrap; }
.panel-dl dd { color: var(--navy); word-break: break-word; }
.panel-dl a  { color: var(--navy); }
.panel-dl .dd-mensaje { white-space: pre-wrap; font-style: italic; color: var(--gray-700); }

/* Hint de enfriándose */
.panel-cooling {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem 1.25rem;
  background: #fefce8;
  border-bottom: 1px solid #fde047;
  font-size: .8125rem;
}
.cooling-text { color: #713f12; flex: 1; }
.btn-enfriar {
  background: none;
  border: 1px solid #ca8a04;
  color: #92400e;
  font-size: .75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: .25rem .625rem;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.btn-enfriar:hover { background: #fef9c3; }
.btn-enfriar:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

/* Formulario de gestión */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .625rem .75rem;
}
@media (max-width: 420px) { .form-grid { grid-template-columns: 1fr; } }

.panel-textarea-group { margin-top: .75rem; }

.panel-section select,
.panel-section input[type="text"],
.panel-section input[type="date"],
.panel-section textarea {
  width: 100%;
  padding: .4375rem .625rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .875rem;
  color: var(--navy);
  background: var(--white);
  font-family: inherit;
  transition: border-color .15s;
}
.panel-section select:focus,
.panel-section input:focus,
.panel-section textarea:focus {
  outline: none;
  border-color: var(--navy);
}
.panel-section textarea { resize: vertical; }

/* Historial */
.panel-historial {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.panel-historial li {
  font-size: .8125rem;
  color: var(--navy);
  display: flex;
  align-items: baseline;
  gap: .5rem;
  flex-wrap: wrap;
}
.historial-badge {
  background: var(--gray-200);
  color: var(--navy);
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 600;
  padding: .1rem .375rem;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}
.historial-date { color: var(--gray-400); }

/* Panel footer */
.panel-footer {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1.25rem;
  border-top: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.btn-panel-save {
  background: var(--navy);
  color: var(--yellow);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: .875rem;
  font-weight: 700;
  padding: .5rem 1.125rem;
  cursor: pointer;
  transition: background .15s;
}
.btn-panel-save:hover    { background: var(--navy-light); }
.btn-panel-save:disabled { opacity: .5; cursor: not-allowed; }
.btn-panel-save:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

.btn-panel-cancel {
  background: none;
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  border-radius: var(--radius);
  font-size: .875rem;
  padding: .5rem .875rem;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-panel-cancel:hover { background: var(--gray-100); border-color: var(--gray-400); }

/* ── Zona de peligro: eliminar contacto (solo admin) ────────────────────────── */
.panel-danger {
  border-top: 1px solid var(--gray-200);
  padding-top: 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.btn-panel-delete {
  background: none;
  border: 1px solid #dc2626;
  color: #dc2626;
  border-radius: var(--radius);
  font-size: .8125rem;
  font-weight: 600;
  padding: .4375rem .875rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-panel-delete:hover    { background: #dc2626; color: var(--white); }
.btn-panel-delete:disabled { opacity: .5; cursor: not-allowed; }
.btn-panel-delete:focus-visible { outline: 2px solid #dc2626; outline-offset: 2px; }

.panel-status { font-size: .8125rem; flex: 1; text-align: right; }
.panel-status.ok  { color: #15803d; }
.panel-status.err { color: var(--error); }

/* ── Fase 4: stats + filtros + export ───────────────────────────────────── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  margin-bottom: 1rem;
}
@media (max-width: 560px) { .stats-bar { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .125rem;
  border: 2px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.stat-card:hover    { border-color: var(--gray-200); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.stat-card.active   { border-color: var(--navy); }

.stat-num {
  font-family: var(--font-mono);
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}
.stat-label {
  font-size: .6875rem;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: .25rem;
}
.stat-card.is-caliente .stat-num { color: #991b1b; }
.stat-card.is-warning  .stat-num { color: #92400e; }
.stat-card.is-hoy      .stat-num { color: #166534; }

.filters-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-select {
  padding: .375rem .625rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .8125rem;
  color: var(--navy);
  background: var(--white);
  cursor: pointer;
  transition: border-color .15s;
}
.filter-select:focus  { outline: none; border-color: var(--navy); }
.filter-select.active { border-color: var(--navy); font-weight: 600; }

.btn-clear-filters {
  background: none;
  border: 1px solid var(--gray-200);
  color: var(--gray-400);
  font-size: .75rem;
  padding: .375rem .625rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.btn-clear-filters:hover { color: var(--navy); border-color: var(--gray-400); }

.btn-export {
  margin-left: auto;
  background: none;
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  font-size: .8125rem;
  padding: .375rem .875rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 600;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn-export:hover { background: var(--gray-100); border-color: var(--gray-400); }
.btn-export:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

/* ── Fase 3: controles del header ────────────────────────────────────────── */
.header-controls {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-header {
  background: transparent;
  border: 1px solid var(--navy-light);
  color: var(--white);
  font-size: .8125rem;
  padding: .375rem .75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.btn-header:hover { background: var(--navy-light); }
.btn-header:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

.btn-modo {
  background: transparent;
  border: 1px solid var(--navy-light);
  color: var(--white);
  font-size: .8125rem;
  padding: .375rem .75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-weight: 600;
}
.btn-modo:hover   { background: var(--navy-light); }
.btn-modo.active  { background: var(--yellow); color: var(--navy); border-color: var(--yellow); }
.btn-modo.active:hover { background: var(--yellow-dark); border-color: var(--yellow-dark); }
.btn-modo:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

@keyframes pulse-sync {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}
.sync-indicator {
  font-size: .75rem;
  font-family: var(--font-mono);
  color: var(--yellow);
  background: rgba(245,200,0,.12);
  border: 1px solid rgba(245,200,0,.35);
  padding: .25rem .625rem;
  border-radius: var(--radius);
  white-space: nowrap;
  animation: pulse-sync 1.8s ease-in-out infinite;
}

/* ── Barra de modo evento ────────────────────────────────────────────────── */
.evento-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
  padding: .75rem 1rem;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.evento-select {
  flex: 1;
  min-width: 200px;
  padding: .4375rem .625rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .875rem;
  color: var(--navy);
  background: var(--white);
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s;
}
.evento-select:focus { outline: none; border-color: var(--navy); }

.btn-nuevo-lead {
  background: var(--navy);
  color: var(--yellow);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: .875rem;
  font-weight: 700;
  padding: .4375rem 1rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.btn-nuevo-lead:hover { background: var(--navy-light); }
.btn-nuevo-lead:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

/* ── Estado vacío de tabla en modo evento ────────────────────────────────── */
.table-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--gray-400);
  font-size: .875rem;
}
.table-empty strong { color: var(--navy); }

/* ── Quick panel (modo evento) ───────────────────────────────────────────── */
#quick-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(420px, 100vw);
  background: var(--white);
  box-shadow: -4px 0 24px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform .25s ease, visibility 0s linear .25s;
}
#quick-panel.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform .25s ease, visibility 0s linear 0s;
}

.qp-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.qp-info {
  padding: .5rem 1.25rem .25rem;
  border-bottom: 1px solid var(--gray-200);
}
.qp-email-text {
  font-size: .8125rem;
  color: var(--gray-400);
}
.qp-email-text a { color: var(--gray-400); text-decoration: none; }
.qp-email-text a:hover { text-decoration: underline; }

.qp-section {
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}

/* Botones grandes de cualificación */
.qual-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
}

.qual-btn {
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: .875rem;
  font-weight: 600;
  padding: .625rem .375rem;
  cursor: pointer;
  transition: opacity .15s, border-color .15s, transform .1s;
  text-align: center;
  white-space: nowrap;
}
.qual-btn:active { transform: scale(.96); }
.qual-btn:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

.qual-btn.frio     { background: #dbeafe; color: #1e40af; }
.qual-btn.templado { background: #fef3c7; color: #92400e; }
.qual-btn.caliente { background: #fee2e2; color: #991b1b; }

.qual-btn.frio.selected     { border-color: #1e40af; }
.qual-btn.templado.selected { border-color: #92400e; }
.qual-btn.caliente.selected { border-color: #991b1b; }

.qual-btn:not(.selected) { opacity: .55; }
.qual-btn:hover { opacity: 1; }

/* Sección de notas del quick panel — crece para llenar el espacio */
.qp-notas-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: .875rem 1.25rem;
  min-height: 160px;
}

#qp-nota {
  flex: 1;
  width: 100%;
  min-height: 140px;
  padding: .5rem .625rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .9375rem;
  color: var(--navy);
  background: var(--white);
  font-family: inherit;
  resize: none;
  transition: border-color .15s;
  line-height: 1.5;
}
#qp-nota:focus { outline: none; border-color: var(--navy); }

/* ── Overlay de modales ──────────────────────────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 110;
}

/* ── Modal centrado ──────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.97);
  width: min(560px, calc(100vw - 2rem));
  max-height: calc(100dvh - 3rem);
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.22);
  z-index: 120;
  display: flex;
  flex-direction: column;
  visibility: hidden;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}
.modal.is-open {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  transition: opacity .2s ease, transform .2s ease, visibility 0s linear 0s;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.modal-header h3 {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--navy);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.modal-divider {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 1rem 0;
}

/* Inputs dentro de los modales */
.modal-body select,
.modal-body input[type="text"],
.modal-body input[type="date"],
.modal-body input[type="email"],
.modal-body textarea {
  width: 100%;
  padding: .4375rem .625rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .875rem;
  color: var(--navy);
  background: var(--white);
  font-family: inherit;
  transition: border-color .15s;
}
.modal-body select:focus,
.modal-body input:focus,
.modal-body textarea:focus {
  outline: none;
  border-color: var(--navy);
}
.modal-body textarea { resize: vertical; }

/* ── Lista de eventos en el modal ────────────────────────────────────────── */
.em-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .375rem;
  margin-bottom: .5rem;
}

.em-list li {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: .5rem .625rem;
  border-radius: var(--radius);
  background: var(--gray-100);
  font-size: .875rem;
  gap: .375rem;
}

.em-evento-slug {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.em-slug-label {
  font-size: .7rem;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.em-evento-slug code {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--navy);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 3px;
  padding: .125rem .375rem;
  word-break: break-all;
}
.em-copy-btn {
  background: none;
  border: 1px solid var(--navy);
  color: var(--navy);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 700;
  padding: .1875rem .5rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.em-copy-btn:hover { background: var(--navy); color: var(--yellow); }
.em-copy-btn:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

.em-evento-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex: 1;
  min-width: 0;
}

.em-evento-actions {
  display: flex;
  gap: .25rem;
  flex-shrink: 0;
}

.em-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: .25rem .375rem;
  font-size: 1rem;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  transition: background .2s;
}
.em-btn:hover {
  background: var(--gray-200);
}
.em-btn:active {
  background: var(--navy-light);
}

.em-empty {
  color: var(--gray-400);
  font-style: italic;
  font-size: .875rem;
  padding: .25rem 0 !important;
  background: transparent !important;
}

.em-evento-nombre {
  font-weight: 600;
  color: var(--navy);
  display: block;
}
.em-evento-meta {
  font-size: .75rem;
  color: var(--gray-400);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ── Etiqueta del evento en "Nuevo lead" ─────────────────────────────────── */
.nl-evento-label {
  font-family: var(--font-mono);
  font-size: .8125rem;
  color: var(--navy-light);
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: .375rem .625rem;
  margin-bottom: .875rem;
}

/* ── Capa A · badge de rango de urgencia ─────────────────────────────────── */
.badge-rango {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 700;
  padding: .125rem .5rem;
  border-radius: 3px;
  white-space: nowrap;
}
.badge-rango.n0 { background: var(--gray-200); color: var(--gray-400);
                  font-weight: 400; font-family: var(--font-sans); }
.badge-rango.n1 { background: #eef2f7; color: #475569; }
.badge-rango.n2 { background: #e0e7ff; color: #3730a3; }
.badge-rango.n3 { background: #ffedd5; color: #9a3412; }
.badge-rango.n4 { background: #fee2e2; color: #991b1b; }

/* ── Capa A · sección de comportamiento en el panel ──────────────────────── */
.comp-rango-line {
  font-size: .8125rem;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .875rem;
}
.comp-grupos {
  display: flex;
  flex-direction: column;
  gap: .875rem;
}
.comp-grupo-title {
  font-family: var(--font-mono);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gray-400);
  margin-bottom: .375rem;
}
.comp-grupo-toggles {
  display: flex;
  flex-direction: column;
  gap: .375rem;
}
.comp-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  text-align: left;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: .4375rem .625rem;
  cursor: pointer;
  font-size: .8125rem;
  color: var(--navy);
  transition: background .15s, border-color .15s;
}
.comp-toggle:hover { border-color: var(--gray-400); }
.comp-toggle:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.comp-toggle.active {
  background: #f0fdf4;
  border-color: #16a34a;
}
.comp-toggle-check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--gray-400);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: var(--white);
  background: var(--white);
}
.comp-toggle.active .comp-toggle-check {
  background: #16a34a;
  border-color: #16a34a;
}
.comp-toggle-label { flex: 1; }
.comp-sello {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--gray-400);
  margin-top: .75rem;
}
.comp-status { display: block; text-align: left; margin-top: .375rem; }

/* ── Fase 2.5 · botón analizar + tarjeta de sugerencia ───────────────────── */
.analizar-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: .5rem;
}
.btn-analizar {
  background: none;
  border: 1px solid var(--navy);
  color: var(--navy);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: .8125rem;
  font-weight: 700;
  padding: .4rem .875rem;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.btn-analizar:hover    { background: var(--navy); color: var(--yellow); }
.btn-analizar:disabled { opacity: .5; cursor: not-allowed; }
.btn-analizar:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

.sug-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-100);
  padding: .875rem 1rem;
}
.sug-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .5rem;
}
.sug-conf {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--gray-700);
}
.sug-just {
  font-size: .8125rem;
  color: var(--gray-700);
  margin-bottom: .5rem;
  line-height: 1.45;
}
.sug-accion {
  font-size: .8125rem;
  color: var(--gray-700);
  margin-bottom: .5rem;
  line-height: 1.45;
}
.sug-aviso {
  font-size: .78rem;
  border-radius: var(--radius);
  padding: .4rem .6rem;
  margin-bottom: .5rem;
  line-height: 1.4;
}
.sug-aviso.desactualizada { background: #fef3c7; color: #92400e; }
.sug-aviso.manual         { background: var(--gray-200); color: var(--gray-700); }
.sug-botones {
  display: flex;
  gap: .625rem;
  margin-top: .25rem;
}

/* ── Capa A · vista de cola de contacto ──────────────────────────────────── */
.cola-view {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  align-items: start;
}
@media (max-width: 820px) { .cola-view { grid-template-columns: 1fr; } }

.cola-bucket {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border-top: 3px solid var(--gray-200);
}
.cola-semana    { border-top-color: #991b1b; }
.cola-triage    { border-top-color: var(--yellow-dark); }
.cola-madurando { border-top-color: var(--navy-light); }

.cola-bucket-head {
  padding: .875rem 1rem .625rem;
  border-bottom: 1px solid var(--gray-200);
}
.cola-bucket-title {
  font-family: var(--font-mono);
  font-size: .9375rem;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.cola-bucket-count {
  font-size: .75rem;
  background: var(--gray-100);
  color: var(--gray-700);
  border-radius: 999px;
  padding: .0625rem .5rem;
  font-weight: 700;
}
.cola-bucket-sub {
  font-size: .7rem;
  color: var(--gray-400);
  margin-top: .25rem;
}

.cola-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}
.cola-empty {
  padding: 1rem;
  color: var(--gray-400);
  font-size: .8125rem;
  font-style: italic;
}
.cola-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .625rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  cursor: pointer;
  transition: background .1s;
}
.cola-item:last-child { border-bottom: none; }
.cola-item:hover { background: var(--gray-100); }
.cola-item-main { min-width: 0; }
.cola-nombre {
  display: block;
  font-weight: 600;
  font-size: .875rem;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cola-eventos {
  display: block;
  font-size: .7rem;
  color: var(--gray-400);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cola-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .25rem;
  flex-shrink: 0;
}
.cola-fecha {
  font-size: .7rem;
  color: var(--gray-700);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Oportunidades (viajes), actividad y tablero — 9 sep 2026
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Badges de etapa (listado, cola, ficha) ─────────────────────────────── */
.badge-etapa {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 700;
  padding: .125rem .5rem;
  border-radius: 3px;
  white-space: nowrap;
  background: var(--gray-200);
  color: var(--gray-700);
}
.badge-etapa.vacio        { background: none; color: var(--gray-400); font-weight: 400; }
.badge-etapa.e-interes    { background: #eef2f7; color: #475569; }
.badge-etapa.e-definiendo { background: #e0e7ff; color: #3730a3; }
.badge-etapa.e-propuesta  { background: #fef3c7; color: #92400e; }
.badge-etapa.e-aprobacion { background: #ffedd5; color: #9a3412; }
.badge-etapa.e-confirmado { background: #dcfce7; color: #166534; }
.badge-etapa.e-realizado  { background: #0d1b2a; color: var(--yellow); }
.badge-etapa.e-aplazado   { background: var(--gray-200); color: var(--gray-700); }
.badge-etapa.e-perdido    { background: #fee2e2; color: #991b1b; }

/* ── Ficha: cabecera con enlace, acciones de contacto, botones mini ──────── */
.panel-header-actions { display: flex; align-items: center; gap: .25rem; }
.panel-link-btn {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: .25rem .4rem;
  border-radius: var(--radius);
  color: var(--gray-700);
}
.panel-link-btn:hover { background: var(--gray-100); }
.panel-link-btn:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

.contacto-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .75rem;
}
.btn-contacto {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--white);
  border: 1px solid var(--navy);
  color: var(--navy);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 700;
  padding: .35rem .7rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.btn-contacto:hover { background: var(--navy); color: var(--yellow); text-decoration: none; }
.btn-contacto:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

.section-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .5rem;
}
.section-head-row .panel-section-title { margin-bottom: 0; }

.btn-mini {
  background: var(--white);
  border: 1px solid var(--gray-400);
  color: var(--navy);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 700;
  padding: .3rem .6rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-mini:hover  { background: var(--navy); color: var(--yellow); border-color: var(--navy); }
.btn-mini.active { background: var(--yellow); color: var(--navy); border-color: var(--yellow); }
.btn-mini:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

/* ── Ficha: lista de viajes ─────────────────────────────────────────────── */
.viajes-list { list-style: none; display: flex; flex-direction: column; gap: .375rem; }
.viaje-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: .5rem .625rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.viaje-item:hover { border-color: var(--gray-400); background: var(--white); }
.viaje-item-main { display: flex; align-items: center; gap: .5rem; min-width: 0; flex-wrap: wrap; }
.viaje-item-meta {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--gray-700);
}
.viaje-dias {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--gray-400);
  white-space: nowrap;
}
.viaje-dias.warn { color: #9a3412; font-weight: 700; }
.viaje-empty {
  color: var(--gray-400);
  font-size: .8125rem;
  font-style: italic;
  padding: .25rem 0;
}

/* ── Ficha: actividad ───────────────────────────────────────────────────── */
.act-quick { display: flex; flex-wrap: wrap; gap: .375rem; margin-bottom: .625rem; }
.act-form {
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: .625rem;
  margin-bottom: .75rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.act-form-title {
  font-family: var(--font-mono);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gray-700);
}
.act-form-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.act-form-row input[type="date"], .act-form-row select { flex: 1; min-width: 140px; }
.actividad-list { list-style: none; display: flex; flex-direction: column; }
.act-item {
  display: flex;
  gap: .625rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--gray-200);
}
.act-item:last-child { border-bottom: none; }
.act-icono { flex-shrink: 0; width: 1.5rem; text-align: center; font-size: .95rem; }
.act-etapa .act-icono { color: var(--navy); font-weight: 700; }
.act-main { min-width: 0; flex: 1; }
.act-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.act-tipo { font-size: .8125rem; font-weight: 600; color: var(--navy); }
.act-fecha { font-family: var(--font-mono); font-size: .7rem; color: var(--gray-400); }
.act-texto { font-size: .8125rem; color: var(--gray-700); white-space: pre-wrap; margin-top: .125rem; line-height: 1.4; }

/* ── Alta manual: aviso de duplicado ────────────────────────────────────── */
.nl-dup {
  margin-top: .75rem;
  background: #fef3c7;
  color: #92400e;
  border-radius: var(--radius);
  padding: .5rem .75rem;
  font-size: .8125rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}

/* ── Modal de viaje ─────────────────────────────────────────────────────── */
.modal-wide { width: min(720px, calc(100vw - 2rem)); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { .form-grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .form-grid-3 { grid-template-columns: 1fr; } .form-grid-3 [style*="span"] { grid-column: auto !important; } }
.modal-body input[type="number"] {
  width: 100%;
  padding: .5rem .75rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .9375rem;
  color: var(--navy);
  background: var(--white);
}
.modal-body input[type="number"]:focus { outline: none; border-color: var(--navy); }
.op-group-title {
  font-family: var(--font-mono);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gray-400);
  margin: 1rem 0 .5rem;
  padding-top: .75rem;
  border-top: 1px solid var(--gray-200);
}
.op-meta { font-family: var(--font-mono); font-size: .7rem; color: var(--gray-400); margin-top: .375rem; line-height: 1.5; }
.op-meta:empty { display: none; }
.op-footer {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: .625rem;
  flex-wrap: wrap;
}
.op-footer .panel-status { text-align: left; flex-basis: 100%; }
.btn-op-delete {
  margin-left: auto;
  background: none;
  border: 1px solid #dc2626;
  color: #dc2626;
  border-radius: var(--radius);
  font-size: .78rem;
  padding: .35rem .7rem;
  cursor: pointer;
}
.btn-op-delete:hover { background: #dc2626; color: var(--white); }

/* ── Barra de herramientas de vistas (cola y tablero) ───────────────────── */
.vista-toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .25rem;
}
.vista-toolbar-label {
  font-family: var(--font-mono);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gray-400);
}
.vista-toolbar-resumen { font-size: .8125rem; color: var(--gray-700); margin-left: .5rem; }
.vista-toolbar-hint { font-size: .75rem; color: var(--gray-400); margin-left: auto; }
@media (max-width: 640px) { .vista-toolbar-hint { display: none; } }

.cola-badges { display: flex; gap: .25rem; flex-wrap: wrap; justify-content: flex-end; }

/* ── Tablero ────────────────────────────────────────────────────────────── */
.tablero-view { display: flex; flex-direction: column; gap: .75rem; }
.tab-board {
  display: flex;
  gap: .75rem;
  overflow-x: auto;
  padding: .25rem .25rem 1rem;
  align-items: flex-start;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.tab-col {
  flex: 0 0 236px;
  background: var(--gray-200);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 240px);
  min-height: 120px;
  scroll-snap-align: start;
  transition: box-shadow .15s, background .15s;
}
.tab-col.key { box-shadow: inset 0 0 0 2px var(--yellow); }
.tab-col.cerrada { background: #e3e6ea; }
.tab-col.drop-target { background: #fef9c3; box-shadow: inset 0 0 0 2px var(--yellow-dark); }
.tab-side { flex-basis: 200px; background: transparent; border: 1.5px dashed var(--gray-400); }
.tab-side.open { flex-basis: 236px; background: var(--gray-100); border-style: solid; }
.tab-col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  padding: .625rem .75rem .5rem;
  flex-shrink: 0;
}
.tab-side-toggle {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  border-radius: var(--radius);
}
.tab-side-toggle:hover { background: rgba(0,0,0,.04); }
.tab-side-toggle:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.tab-col-title {
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 700;
  color: var(--navy);
}
.tab-col-meta {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--gray-700);
  white-space: nowrap;
}
.tab-col-body {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 0 .5rem .625rem;
  overflow-y: auto;
  min-height: 60px;
}
.tab-col-empty {
  font-size: .75rem;
  color: var(--gray-400);
  font-style: italic;
  padding: .5rem .25rem;
}

.tab-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
  border-left: 4px solid var(--gray-200);
  padding: .5rem .625rem .5rem .625rem;
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  position: relative;
  transition: box-shadow .15s, transform .15s;
}
.tab-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.16); }
.tab-card.dragging { opacity: .5; }
.tab-card.cual-caliente { border-left-color: #b91c1c; }
.tab-card.cual-templado { border-left-color: #d97706; }
.tab-card.cual-frio     { border-left-color: #2563eb; }
.tab-card-sinviaje { cursor: default; }
.tab-card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.tab-card-nombre {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tab-own {
  flex-shrink: 0;
  min-width: 22px;
  height: 22px;
  padding: 0 .3rem;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--navy);
  font-family: var(--font-mono);
  font-size: .65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tab-own.vacio { background: var(--gray-200); color: var(--gray-400); }
.tab-card-inst {
  font-size: .72rem;
  color: var(--gray-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tab-card-row {
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--gray-700);
  display: flex;
  flex-wrap: wrap;
  gap: .125rem .25rem;
}
.tab-card-flags { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .125rem; }
.tab-flag {
  font-family: var(--font-mono);
  font-size: .64rem;
  padding: .1rem .4rem;
  border-radius: 3px;
  background: var(--gray-100);
  color: var(--gray-700);
}
.tab-flag.warn { background: #ffedd5; color: #9a3412; font-weight: 700; }
.tab-card-actions { display: flex; gap: .375rem; align-items: center; margin-top: .25rem; }
.tab-card-ficha {
  align-self: flex-end;
  background: none;
  border: none;
  color: var(--gray-400);
  font-family: var(--font-mono);
  font-size: .66rem;
  cursor: pointer;
  padding: .1rem .25rem;
  text-decoration: underline;
}
.tab-card-ficha:hover { color: var(--navy); }
.tab-card-actions .tab-card-ficha { align-self: center; margin-left: auto; }

/* ── Previsión (solo admin) ─────────────────────────────────────────────── */
.prevision {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.prevision-title {
  font-family: var(--font-mono);
  font-size: .9375rem;
  color: var(--navy);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5rem;
}
.prevision-sub { font-family: var(--font-sans); font-size: .72rem; color: var(--gray-400); font-weight: 400; }
.prevision-table { box-shadow: none; border: 1px solid var(--gray-200); }
.prevision-table table { font-size: .8125rem; }
.prevision-table thead { font-size: .7rem; }
.prevision-table th, .prevision-table td { padding: .5rem .75rem; }
.prevision-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prevision-table tbody tr { cursor: default; }
.prevision-table tbody tr:hover { background: none; }
.prevision-grid { display: grid; grid-template-columns: 1fr 2fr; gap: .75rem; align-items: start; }
@media (max-width: 720px) { .prevision-grid { grid-template-columns: 1fr; } }

/* ── Ayuda / manual rápido ──────────────────────────────────────────────── */
.ayuda { font-size: .875rem; line-height: 1.5; color: var(--navy); }
.ayuda-intro { color: var(--gray-700); margin-bottom: .75rem; }
.ayuda details {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: .5rem;
  background: var(--white);
}
.ayuda details[open] { background: var(--gray-100); }
.ayuda summary {
  cursor: pointer;
  padding: .625rem .875rem;
  font-family: var(--font-mono);
  font-size: .8125rem;
  font-weight: 700;
  color: var(--navy);
  list-style: none;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.ayuda summary::-webkit-details-marker { display: none; }
.ayuda summary::before { content: '▸'; color: var(--yellow-dark); font-size: .75rem; }
.ayuda details[open] summary::before { content: '▾'; }
.ayuda summary:focus-visible { outline: 2px solid var(--navy); outline-offset: -2px; border-radius: var(--radius); }
.ayuda details > :not(summary) { margin: 0 .875rem .75rem 1.75rem; }
.ayuda ul, .ayuda ol { padding-left: 1.1rem; display: flex; flex-direction: column; gap: .3rem; }
.ayuda p { margin-top: .5rem; color: var(--gray-700); }
.ayuda strong { color: var(--navy); }

/* ── Agencias, enlace al presupuesto, URLs de QR por evento (18 sep 2026) ── */
.badge-agencia {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .64rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 3px;
  background: var(--navy);
  color: var(--yellow);
  white-space: nowrap;
}
.enlace-presupuesto {
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 700;
  color: var(--navy);
  text-decoration: underline;
  white-space: nowrap;
}
.enlace-presupuesto:hover { color: var(--navy-light); }
.field-label .enlace-presupuesto { margin-left: .375rem; }
.tipo-aviso { font-size: .72rem; color: var(--gray-700); }
.tab-card > .tab-card-actions { margin-top: .125rem; flex-wrap: wrap; }
.em-evento-urls { flex-wrap: wrap; row-gap: .25rem; }

/* ── Agenda de los QR (gestor de eventos) ───────────────────────────────── */
.em-agenda {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: .75rem .875rem;
  margin-bottom: .875rem;
  display: flex;
  flex-direction: column;
  gap: .375rem;
}
.em-agenda-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.em-agenda-head input[type="date"] { width: auto; padding: .25rem .5rem; font-size: .8125rem; margin-left: auto; }
.em-agenda-list { list-style: none; display: flex; flex-direction: column; gap: .2rem; font-size: .8125rem; }
.em-agenda-qr { display: inline-block; min-width: 6.5rem; font-family: var(--font-mono); font-size: .75rem; font-weight: 700; color: var(--navy); }
.em-agenda-ok { color: #166534; font-weight: 600; }
.em-agenda-no { color: var(--gray-700); }
.em-agenda-estado { margin-top: .125rem; }
.em-capturas-txt { font-size: .75rem; color: var(--gray-700); }

/* ── QR disponibles (lista ampliable) ───────────────────────────────────── */
.em-paginas { margin-top: .375rem; border-top: 1px solid var(--gray-200); padding-top: .5rem; }
.em-paginas summary { cursor: pointer; font-family: var(--font-mono); font-size: .75rem; font-weight: 700; color: var(--navy); }
.em-paginas-list { list-style: none; display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; margin: .5rem 0; }
.em-paginas-list code { font-family: var(--font-mono); font-size: .7rem; background: var(--white); border: 1px solid var(--gray-200); border-radius: 3px; padding: 0 .3rem; }
.em-paginas-url { color: var(--gray-400); font-size: .7rem; word-break: break-all; }
.em-paginas-form { display: flex; gap: .375rem; flex-wrap: wrap; margin-bottom: .375rem; }
.em-paginas-form input { flex: 1; min-width: 150px; padding: .3rem .5rem; font-size: .8125rem; }

/* Ayuda: listas anidadas (instalación por dispositivo) */
.ayuda li > ul { margin-top: .3rem; list-style: disc; }
.ayuda li > ul > li { color: var(--gray-700); }

/* ── Login: "He olvidado mi contraseña" ─────────────────────────────────── */
.btn-link {
  background: none;
  border: none;
  color: var(--gray-700);
  font-size: .8125rem;
  text-decoration: underline;
  cursor: pointer;
  margin-top: .75rem;
  padding: .25rem;
}
.btn-link:hover { color: var(--navy); }
.btn-link:disabled { opacity: .5; cursor: wait; }
.btn-link:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; border-radius: 3px; }
.login-info {
  margin-top: .75rem;
  font-size: .8125rem;
  line-height: 1.45;
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: .5rem .75rem;
  text-align: left;
}
