/* ================================================================
   SISTEMA DE TIPIFICACIONES - GEA PERÚ
   Estilos principales
   ================================================================ */

:root {
  --navy:        #1e2a4a;
  --navy-dark:   #1a2444;
  --navy-light:  #2d52a0;
  --accent:      #3b82f6;
  --accent-dark: #1d4ed8;
  --accent-glow: rgba(59,130,246,.25);
  --success:     #10b981;
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --light-bg:    #f0f4ff;
  --card-bg:     #ffffff;
  --border:      #d1d9f0;
  --text-main:   #1e2a4a;
  --text-muted:  #64748b;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(30,42,74,.10);
  --shadow-md:   0 8px 40px rgba(30,42,74,.18);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(150deg, #dbeafe 0%, #eff6ff 50%, #e0e7ff 100%);
  min-height: 100vh;
  color: var(--text-main);
}

.dashboard-page {
  background: linear-gradient(180deg, #e8f0fe 0%, #f0f4ff 100%);
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--light-bg); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

/* ================================================================
   LOGIN
   ================================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: linear-gradient(135deg, #1a2444 0%, #1d4ed8 55%, #3b82f6 100%);
}

.login-card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35), 0 4px 16px rgba(59,130,246,.2);
  width: 100%;
  max-width: 430px;
  overflow: hidden;
  animation: slideUp .4s ease;
}

.login-header {
  background: linear-gradient(135deg, #1e2a4a 0%, #1e40af 60%, #2d52a0 100%);
  padding: 2.8rem 2rem 2rem;
  text-align: center;
  position: relative;
}

.login-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #60a5fa, #3b82f6, #818cf8);
}

.login-logo {
  max-width: 210px;
  max-height: 100px;
  object-fit: contain;
  margin-bottom: 1rem;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.25));
}

.login-logo-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: .04em;
  margin-bottom: .5rem;
}

.login-logo-placeholder span {
  font-size: .85rem;
  opacity: .8;
  font-weight: 400;
}

.login-title {
  color: rgba(255,255,255,.95);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-top: .2rem;
}

.login-body { padding: 2rem; }

.form-group { margin-bottom: 1.2rem; }

label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .4rem;
}

input, select, textarea {
  width: 100%;
  padding: .7rem .95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  color: var(--text-main);
  background: var(--card-bg);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder { color: #aab; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .72rem 1.4rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 3px 12px rgba(59,130,246,.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-dark), #1e40af);
  box-shadow: 0 5px 18px rgba(59,130,246,.45);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: #fff;
  box-shadow: 0 3px 12px rgba(16,185,129,.35);
}

.btn-success:hover { filter: brightness(1.08); transform: translateY(-1px); }

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #fff;
}

.btn-danger:hover { filter: brightness(1.08); }

.btn-warning {
  background: linear-gradient(135deg, var(--warning), #d97706);
  color: #fff;
}

.btn-secondary {
  background: var(--light-bg);
  color: var(--navy);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

.btn-sm { padding: .45rem .9rem; font-size: .82rem; }

.btn-block { width: 100%; }

.btn:disabled { opacity: .6; cursor: not-allowed; transform: none !important; }

.login-btn { width: 100%; padding: .85rem; font-size: 1rem; margin-top: .5rem; }

.login-footer {
  padding: 1rem 2rem;
  background: var(--light-bg);
  text-align: center;
  font-size: .78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ================================================================
   DASHBOARD LAYOUT
   ================================================================ */
.dashboard-page { min-height: 100vh; display: flex; flex-direction: column; }

/* Header */
.app-header {
  background: linear-gradient(90deg, #1e2a4a 0%, #1e40af 55%, #2d52a0 100%);
  padding: 0 1.5rem;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(30,42,74,.45);
  border-bottom: 2px solid rgba(255,255,255,.1);
}

.header-logo {
  max-height: 50px;
  max-width: 140px;
  object-fit: contain;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.3));
}

.header-logo-text {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: .04em;
}

.header-title {
  flex: 1;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  display: block;
  text-shadow: 0 1px 4px rgba(0,0,0,.2);
}

@media (max-width: 640px) { .header-title { display: none; } }

.header-info {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  color: rgba(255,255,255,.85);
  font-size: .82rem;
}

.header-user {
  display: flex;
  flex-direction: column;
  text-align: right;
  line-height: 1.3;
}

.header-user strong { color: #fff; font-size: .9rem; }

.header-clock {
  display: flex;
  flex-direction: column;
  text-align: center;
  font-size: .78rem;
  gap: 1px;
}

.clock-time {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.clock-timer {
  font-size: .72rem;
  color: var(--warning);
  font-weight: 600;
}

.clock-date {
  font-size: .7rem;
  color: rgba(255,255,255,.75);
  font-weight: 500;
  letter-spacing: .02em;
}

.btn-logout {
  background: #e74c3c;
  border: none;
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .03em;
  padding: .48rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background .18s, box-shadow .18s, transform .12s;
  box-shadow: 0 2px 8px rgba(231,76,60,.45);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  white-space: nowrap;
}

.btn-logout:hover {
  background: #c0392b;
  box-shadow: 0 4px 14px rgba(192,57,43,.55);
  transform: translateY(-1px);
}

.btn-logout:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(192,57,43,.4);
}

/* Nav Tabs (admin) */
.app-nav {
  background: var(--navy);
  padding: 0 1.5rem;
  display: flex;
  gap: .2rem;
  border-bottom: 3px solid rgba(255,255,255,.08);
}

.nav-tab {
  padding: .75rem 1.3rem;
  color: rgba(255,255,255,.6);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  transition: all .2s;
  border-top: none;
  border-left: none;
  border-right: none;
  background: none;
  letter-spacing: .03em;
}

.nav-tab:hover { color: rgba(255,255,255,.9); }
.nav-tab.active { color: #fff; border-bottom-color: var(--accent); }

/* Main content */
.app-main {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.app-main.full-width { max-width: none; }

/* ================================================================
   CARDS
   ================================================================ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-light) 100%);
  padding: 1rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
}

.card-title {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
  letter-spacing: .02em;
}

.card-body { padding: 1.4rem; }

/* ================================================================
   TIPIFICACIÓN FORM
   ================================================================ */
.form-col { width: 380px; min-width: 320px; flex-shrink: 0; }

.siac-msg {
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  border: 1.5px solid var(--warning);
  border-left: 5px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  font-size: .88rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.fide-info {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1.5px solid #93c5fd;
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
  display: none;
}

.fide-info.visible { display: block; animation: fadeIn .25s ease; }

.fide-info h4 {
  font-size: .82rem;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .75rem;
  border-bottom: 1.5px solid #bfdbfe;
  padding-bottom: .4rem;
}

.fide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
}

.fide-item label { font-size: .75rem; margin-bottom: .2rem; }

.fide-item .fide-value {
  background: #fff;
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: .45rem .7rem;
  font-size: .9rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.fide-desc { grid-column: 1/-1; }
.fide-desc .fide-value { font-size: .82rem; font-weight: 500; color: var(--text-main); }

/* Bono display */
.bono-display {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: linear-gradient(90deg, #ecfdf5, #d1fae5);
  border: 1.5px solid #6ee7b7;
  border-radius: var(--radius-sm);
  padding: .65rem 1rem;
}

.bono-label { font-size: .78rem; color: #065f46; font-weight: 600; }
.bono-amount { font-size: 1.3rem; font-weight: 800; color: #065f46; margin-left: auto; }

/* Custom searchable select */
.search-select-wrapper { position: relative; }

.search-select-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .8rem center;
  padding-right: 2.2rem;
}

.search-select-dropdown {
  position: fixed;
  background: #fff;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 280px;
  overflow-y: auto;
  z-index: 9999;
  display: none;
}

.search-select-dropdown.open { display: block; animation: fadeIn .15s ease; }

.search-select-search {
  padding: .6rem .8rem;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}

.search-select-search:focus { box-shadow: none; border-color: var(--border); }

.search-select-list { list-style: none; }

.search-select-list li {
  padding: .6rem .95rem;
  cursor: pointer;
  font-size: .9rem;
  transition: background .1s;
}

.search-select-list li:hover,
.search-select-list li.highlighted { background: var(--light-bg); color: var(--accent-dark); }

.search-select-list .no-results {
  padding: .8rem;
  color: var(--text-muted);
  text-align: center;
  font-size: .85rem;
  cursor: default;
}

.search-select-list .no-results:hover { background: none; }

/* ================================================================
   SUMMARY TABLE (producción del día)
   ================================================================ */
.summary-col { flex: 1; min-width: 0; }

.summary-table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  background: #1e2a4a;
  color: #fff;
  padding: .7rem 1rem;
  text-align: left;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

th:last-child, td:last-child { text-align: right; }

td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: var(--light-bg); }
tr:hover td { background: #e8eeff; }

.tfoot-row td {
  border-top: 2px solid #a0b8cc;
  background: #dce6f0 !important;
  font-weight: 700;
  color: #1e2a4a;
}

/* ── Tabla de producción del día ─────────────────────────── */
.summary-tipo-row td {
  font-weight: 700;
  font-size: .85rem;
  color: #fff !important;
  border-bottom: none;
}
.summary-tipo-contencion  td { background: #5b9bd5 !important; }
.summary-tipo-fidelizacion td { background: #4caf7d !important; }
.summary-tipo-retencion    td { background: #e8943a !important; color: #fff; font-weight: 700; }
.summary-tipo-row:hover td { filter: brightness(1.08); }

.summary-bono-row td {
  font-size: .79rem;
  color: #2d3748;
  background: #f5f7fa !important;
  padding-top: .35rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid #e2e8f0;
}
.summary-bono-row td:first-child { padding-left: 2.2rem; }
.summary-bono-row:hover td { background: #edf0f5 !important; }

.badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-contencion  { background: #dbeafe; color: #1e40af; }
.badge-fidelizacion { background: #d1fae5; color: #065f46; }
.badge-retencion   { background: #fce7f3; color: #9d174d; }
.badge-activo      { background: #d1fae5; color: #065f46; }
.badge-cesado      { background: #fee2e2; color: #991b1b; }
.badge-agente      { background: #e0e7ff; color: #3730a3; }
.badge-admin       { background: #fef3c7; color: #92400e; }
.badge-back        { background: #f3e8ff; color: #6b21a8; }
.badge-supervisor  { background: #d1fae5; color: #065f46; }

.total-count {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  border-radius: var(--radius-sm);
  padding: .9rem 1.2rem;
  margin-top: 1rem;
  color: #fff;
}

.total-count .tc-label { font-size: .85rem; opacity: .85; }
.total-count .tc-value { font-size: 2rem; font-weight: 800; margin-left: auto; }

/* ================================================================
   BACK PROFILE
   ================================================================ */
.report-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.report-filters .form-group { margin-bottom: 0; flex: 1; min-width: 160px; }

.report-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }

.results-info {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
}

/* ================================================================
   USER FILTER BAR
   ================================================================ */
.users-filter-bar {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--light-bg);
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
}

.users-filter-bar input[type="text"] {
  flex: 1;
  min-width: 220px;
  margin-bottom: 0;
  font-size: .88rem;
}

.users-filter-bar select {
  width: auto;
  min-width: 148px;
  margin-bottom: 0;
  font-size: .88rem;
}

.users-count-badge {
  font-size: .82rem;
  color: var(--text-muted);
  white-space: nowrap;
  padding: .42rem .85rem;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-left: auto;
}

.users-count-badge strong { color: var(--navy); font-weight: 700; }

@media (max-width: 640px) {
  .users-filter-bar input[type="text"] { min-width: 0; }
  .users-count-badge { margin-left: 0; }
}

/* ================================================================
   USER MANAGEMENT (modal)
   ================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn .2s ease;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp .25s ease;
}

.modal-header {
  background: linear-gradient(90deg, var(--navy), var(--navy-light));
  padding: 1.1rem 1.4rem;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { color: #fff; font-size: 1rem; font-weight: 700; }

.modal-close {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}

.modal-close:hover { background: rgba(239,68,68,.7); }

.modal-body { padding: 1.5rem; overflow-y: auto; }

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: .8rem;
  justify-content: flex-end;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ================================================================
   ALERTS / TOASTS
   ================================================================ */
.toast-container {
  position: fixed;
  top: 1.2rem;
  right: 1.2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  pointer-events: none;
}

.toast {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: .85rem 1.2rem;
  min-width: 280px;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .9rem;
  pointer-events: all;
  animation: slideRight .3s ease;
  border-left: 4px solid var(--accent);
}

.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }

.toast-icon { font-size: 1.2rem; }
.toast-msg  { flex: 1; font-weight: 500; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}

/* ================================================================
   EMPTY STATE
   ================================================================ */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .4; }
.empty-state p { font-size: .9rem; }

/* ================================================================
   UTILS
   ================================================================ */
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.gap-1 { gap: .5rem; }
.flex { display: flex; }
.items-center { align-items: center; }

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp  { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideRight { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin     { to { transform: rotate(360deg); } }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 960px) {
  .app-main { flex-direction: column; }
  .form-col { width: 100%; min-width: 0; }
}

@media (max-width: 640px) {
  .app-header { height: auto; flex-wrap: wrap; padding: .75rem 1rem; gap: .6rem; }
  .header-clock { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .card-body { padding: 1rem; }
  .app-main { padding: 1rem; }
}

/* ================================================================
   BACK: SUB-NAV TABS
   ================================================================ */
.back-nav-bar {
  display: flex;
  gap: .4rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .4rem;
  width: fit-content;
}

.back-tab {
  padding: .6rem 1.3rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-muted);
  transition: all .2s;
  letter-spacing: .02em;
}

.back-tab:hover { color: var(--navy); background: var(--light-bg); }

.back-tab.active {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: #fff;
  box-shadow: 0 2px 10px rgba(30,42,74,.28);
}

/* ================================================================
   BACK: CONTADOR DE REGISTROS
   ================================================================ */
.report-count-banner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  padding: .6rem 1.4rem;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.12);
  flex-wrap: wrap;
  gap: 0;
}

.rcb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .12rem;
  padding: .4rem 1rem;
  text-align: center;
}

.rcb-divider {
  width: 1px;
  height: 2.4rem;
  background: rgba(255,255,255,.25);
  flex-shrink: 0;
}

.rcb-label {
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .03em;
  opacity: .9;
  white-space: nowrap;
}

.rcb-num {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.02em;
}

/* ================================================================
   BACK: DASHBOARD
   ================================================================ */
.dash-refresh-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 0 1.2rem;
  flex-wrap: wrap;
}

.dash-refresh-bar > span:first-child {
  font-size: .82rem;
  color: var(--text-muted);
  font-weight: 500;
}

#dash-last-update {
  font-size: .78rem;
  color: var(--text-muted);
  margin-left: auto;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dash-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.3rem 1.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  text-align: center;
  border-top: 4px solid transparent;
  transition: transform .2s, box-shadow .2s;
}

.dash-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.dash-card-total       { border-top-color: var(--accent); }
.dash-card-contencion  { border-top-color: #5b9bd5; }
.dash-card-fidelizacion { border-top-color: #4caf7d; }
.dash-card-retencion   { border-top-color: #e07070; }

.dash-card-label {
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}

.dash-card-value {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}

.dash-card-total .dash-card-value        { color: var(--accent-dark); }
.dash-card-contencion .dash-card-value   { color: #1e4d91; }
.dash-card-fidelizacion .dash-card-value { color: #1a6b3c; }
.dash-card-retencion .dash-card-value    { color: #9b1c1c; }

@media (max-width: 960px) { .dash-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .dash-grid { grid-template-columns: 1fr 1fr; } }

/* ================================================================
   BACK: FILTRO DASHBOARD
   ================================================================ */
.dash-filter-bar {
  padding: 1rem 1.4rem;
}

.dash-filter-bar .form-group label {
  font-size: .75rem;
}

.dash-filter-bar input[type="date"],
.dash-filter-bar select {
  font-size: .92rem;
  padding: .55rem .8rem;
}

.dash-empty-notice {
  display: flex;
  align-items: center;
  gap: .8rem;
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  border: 1.5px solid #f59e0b;
  border-left: 5px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: .9rem 1.2rem;
  font-size: .9rem;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 1.2rem;
}

/* ── Auditoría: leyenda de gráfico de dona ───────────────────── */
.audit-chart-legend {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-top: .85rem;
  padding: 0 .4rem;
}
.audit-legend-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .78rem;
}
.audit-legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}
.audit-legend-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  flex: 1;
  color: var(--text-muted);
}
.audit-legend-value {
  font-weight: 800;
  color: var(--navy);
}
.audit-legend-pct {
  font-size: .72rem;
  color: var(--text-muted);
  min-width: 36px;
  text-align: right;
}

/* ── Auditoría: barras de progreso en Consulta ───────────────── */
.audit-progress-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem 2rem;
  padding: .9rem 1.5rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
@media (max-width: 700px) {
  .audit-progress-panel { grid-template-columns: 1fr; }
}
.audit-bar-row {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.audit-bar-label {
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  min-width: 84px;
}
.audit-bar-track {
  flex: 1;
  height: 9px;
  background: #e2e8f0;
  border-radius: 5px;
  overflow: hidden;
}
.audit-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width .45s ease;
  min-width: 0;
}
.audit-bar-green { background: #4caf50; }
.audit-bar-gray  { background: #90a4ae; }
.audit-bar-blue  { background: #42a5f5; }
.audit-bar-red   { background: #ef5350; }
.audit-bar-info {
  font-size: .73rem;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  min-width: 140px;
  text-align: right;
}

/* ── Tipificación: barra de progreso ─────────────────────────── */
.tip-progress {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: .55rem;
  padding: .65rem .9rem .7rem;
  margin-bottom: 1rem;
}
.tip-progress-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .38rem;
}
#tip-progress-msg {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: color .3s;
}
#tip-progress-msg.ready {
  color: var(--success);
  font-weight: 700;
}
.tip-progress-count {
  font-size: .78rem;
  font-weight: 700;
  color: var(--navy);
}
.tip-progress-track {
  height: 5px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.tip-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--navy);
  border-radius: 999px;
  transition: width .35s ease, background .35s ease;
}
.tip-progress-fill.ready { background: var(--success); }

/* ── Tipificación: iconos de estado en label ─────────────────── */
.fsi {
  display: inline-block;
  margin-left: .3rem;
  font-size: .78rem;
  font-weight: 700;
  vertical-align: middle;
  transition: color .2s;
  line-height: 1;
}
.fsi.fsi-pending { color: #cbd5e1; }
.fsi.fsi-done    { color: var(--success); }

/* ── Tipificación: campos bloqueados ─────────────────────────── */
.tip-locked-hint {
  display: none;
  font-size: .72rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: .18rem;
}
.tip-input-wrap.tip-locked .tip-locked-hint { display: block; }
.tip-input-wrap.tip-locked .search-select-input,
.tip-input-wrap.tip-locked select {
  pointer-events: none;
  background: #f1f5f9 !important;
  color: #94a3b8 !important;
  border-color: #e2e8f0 !important;
  cursor: not-allowed;
}

/* ── Tipificación: botón registrar ───────────────────────────── */
#btn-registrar { transition: background .35s ease, opacity .25s ease, box-shadow .3s ease; }
#btn-registrar:not(:disabled) { animation: tip-btn-pulse .55s ease-out; }
@keyframes tip-btn-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,.55); }
  60%  { box-shadow: 0 0 0 9px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
