/* ==========================================================================
   reparabien — sistema de diseño del panel técnico
   Paleta extraída del isotipo real de la marca (azul #005DE5).
   Tipografía: Space Grotesk (títulos/números) + Inter (texto/datos).
   ========================================================================== */

/* Tipografías cargadas vía <link> en el layout (ver Views/layouts) para
   poder usar preconnect y no bloquear el primer render con un @import. */

:root {
  --rb-blue: #005de5;
  --rb-blue-dark: #0047b3;
  --rb-blue-tint: #eaf1ff;
  --rb-blue-tint-2: #d7e6ff;
  --rb-ink: #10182b;
  --rb-ink-muted: #5b6472;
  --rb-border: #e3e8f0;
  --rb-bg: #f5f7fb;
  --rb-surface: #ffffff;
  --rb-urgente: #ff5630;
  --rb-urgente-tint: #ffe6e0;
  --rb-success: #1ba672;
  --rb-success-tint: #e2f7ef;
  --rb-warning: #f5a623;
  --rb-warning-tint: #fef2e0;

  --rb-radius-sm: 8px;
  --rb-radius-md: 12px;
  --rb-radius-lg: 18px;
  --rb-shadow: 0 2px 10px rgba(16, 24, 43, 0.06);
  --rb-shadow-md: 0 8px 24px rgba(16, 24, 43, 0.10);

  /* Reskin de variables de Bootstrap 5.3 */
  --bs-primary: var(--rb-blue);
  --bs-primary-rgb: 0, 93, 229;
  --bs-body-font-family: 'Inter', system-ui, sans-serif;
  --bs-body-color: var(--rb-ink);
  --bs-border-color: var(--rb-border);
  --bs-border-radius: var(--rb-radius-sm);
  --bs-border-radius-lg: var(--rb-radius-md);
}

body {
  background: var(--rb-bg);
  color: var(--rb-ink);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, .rb-display {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  letter-spacing: -0.01em;
  color: var(--rb-ink);
}

a { color: var(--rb-blue); }

/* Marca de agua: "." como acento, guiño al isotipo .r */
.rb-dot::before {
  content: '.';
  color: var(--rb-blue);
  font-weight: 700;
}

.btn-primary {
  background-color: var(--rb-blue);
  border-color: var(--rb-blue);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background-color: var(--rb-blue-dark) !important;
  border-color: var(--rb-blue-dark) !important;
}
.btn:focus-visible, .form-control:focus-visible, a:focus-visible, .form-select:focus-visible {
  outline: 3px solid var(--rb-blue-tint-2);
  outline-offset: 1px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--rb-blue);
  box-shadow: 0 0 0 0.2rem rgba(0, 93, 229, 0.15);
}

/* ---------------------------------------------------------------------- */
/* Layout de app: sidebar + navbar + contenido                             */
/* ---------------------------------------------------------------------- */
.rb-shell { min-height: 100vh; display: flex; }

.rb-sidebar {
  width: 264px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #001a4d 0%, var(--rb-blue) 120%);
  color: #fff;
  padding: 1.5rem 1rem;
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  z-index: 1040;
  transition: transform .25s ease;
}
.rb-sidebar .rb-brand { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem 1.5rem; }
.rb-sidebar .rb-brand img { height: 32px; width: 32px; border-radius: 8px; }
.rb-sidebar .rb-brand span { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.15rem; color: #fff; }

.rb-nav-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .9rem; border-radius: var(--rb-radius-sm);
  color: rgba(255,255,255,.78); text-decoration: none; font-weight: 500;
  margin-bottom: .2rem; font-size: .93rem;
}
.rb-nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.rb-nav-link.active { background: rgba(255,255,255,.16); color: #fff; }
.rb-nav-link i { width: 20px; text-align: center; }

.rb-main {
  margin-left: 264px;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.rb-topbar {
  background: var(--rb-surface);
  border-bottom: 1px solid var(--rb-border);
  padding: .75rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  position: sticky; top: 0; z-index: 1020;
}

.rb-saldo-chip {
  background: var(--rb-blue-tint);
  color: var(--rb-blue-dark);
  border-radius: 999px;
  padding: .35rem .9rem;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  font-size: .95rem;
  white-space: nowrap;
}

.rb-content { padding: 1.5rem; flex: 1; }

.rb-sidebar-toggle { display: none; }

@media (max-width: 991.98px) {
  .rb-sidebar { transform: translateX(-100%); }
  .rb-sidebar.show { transform: translateX(0); box-shadow: var(--rb-shadow-md); }
  .rb-main { margin-left: 0; }
  .rb-sidebar-toggle { display: inline-flex; }
  .rb-sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(16,24,43,.45); z-index: 1030;
  }
  .rb-sidebar-backdrop.show { display: block; }
}

/* ---------------------------------------------------------------------- */
/* Tarjetas de estadística (dashboard)                                     */
/* ---------------------------------------------------------------------- */
.rb-stat {
  background: var(--rb-surface);
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-md);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--rb-shadow);
  height: 100%;
}
.rb-stat .rb-stat-label {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--rb-ink-muted); font-weight: 600; margin-bottom: .4rem;
}
.rb-stat .rb-stat-value {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 2rem; line-height: 1;
}
.rb-stat.rb-stat-hero {
  background: linear-gradient(135deg, var(--rb-blue) 0%, #0038a8 100%);
  color: #fff; border: none;
}
.rb-stat.rb-stat-hero .rb-stat-label { color: rgba(255,255,255,.75); }
.rb-stat.rb-stat-hero .rb-stat-value { color: #fff; }

/* ---------------------------------------------------------------------- */
/* Tarjetas de solicitudes (marketplace)                                   */
/* ---------------------------------------------------------------------- */
.rb-lead-card {
  background: var(--rb-surface);
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-md);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--rb-shadow);
  height: 100%;
  display: flex; flex-direction: column; gap: .6rem;
  transition: box-shadow .15s ease, transform .15s ease;
}
.rb-lead-card:hover { box-shadow: var(--rb-shadow-md); transform: translateY(-2px); }
.rb-lead-card.is-urgente { border-left: 4px solid var(--rb-urgente); }

.rb-badge-urgente {
  background: var(--rb-urgente-tint); color: var(--rb-urgente);
  font-weight: 700; font-size: .72rem; letter-spacing: .03em;
  padding: .3rem .55rem; border-radius: 999px; text-transform: uppercase;
}
.rb-badge-especialidad {
  background: var(--rb-blue-tint); color: var(--rb-blue-dark);
  font-weight: 600; font-size: .78rem; padding: .3rem .6rem; border-radius: 999px;
}
.rb-badge-cupo {
  background: #f1f3f8; color: var(--rb-ink-muted);
  font-size: .75rem; padding: .25rem .55rem; border-radius: 999px;
}

.rb-lead-card .rb-lead-meta { font-size: .8rem; color: var(--rb-ink-muted); }
.rb-lead-card .rb-lead-desc { font-size: .92rem; color: var(--rb-ink); flex: 1; }
.rb-lead-card .rb-lead-id { font-family: 'Space Grotesk', sans-serif; font-weight: 700; color: var(--rb-ink-muted); font-size: .8rem; }

.rb-btn-comprar {
  background: var(--rb-blue); color: #fff; border: none;
  font-weight: 700; padding: .65rem 1rem; border-radius: var(--rb-radius-sm);
  font-size: 1rem; width: 100%;
}
.rb-btn-comprar:hover { background: var(--rb-blue-dark); color: #fff; }
.rb-btn-comprar:disabled { opacity: .6; }

.rb-refresh-indicator {
  font-size: .82rem; color: var(--rb-ink-muted); display: flex; align-items: center; gap: .5rem;
}
.rb-refresh-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--rb-success);
  display: inline-block; animation: rb-pulse 1.8s infinite;
}
@keyframes rb-pulse {
  0% { box-shadow: 0 0 0 0 rgba(27,166,114,.5); }
  70% { box-shadow: 0 0 0 6px rgba(27,166,114,0); }
  100% { box-shadow: 0 0 0 0 rgba(27,166,114,0); }
}

/* ---------------------------------------------------------------------- */
/* Estados / badges genéricos                                              */
/* ---------------------------------------------------------------------- */
.rb-badge-estado { font-weight: 600; font-size: .78rem; padding: .3rem .6rem; border-radius: 999px; }
.rb-badge-pendiente { background: var(--rb-warning-tint); color: #a3670c; }
.rb-badge-contactado { background: var(--rb-blue-tint); color: var(--rb-blue-dark); }
.rb-badge-presupuesto { background: #f1e6ff; color: #6a3bb5; }
.rb-badge-trabajo_realizado { background: var(--rb-success-tint); color: #0e7a52; }

/* ---------------------------------------------------------------------- */
/* Filtros                                                                  */
/* ---------------------------------------------------------------------- */
.rb-filter-bar {
  background: var(--rb-surface);
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-md);
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--rb-shadow);
}
.rb-filter-bar label { font-size: .78rem; font-weight: 600; color: var(--rb-ink-muted); margin-bottom: .25rem; }

/* ---------------------------------------------------------------------- */
/* Login                                                                    */
/* ---------------------------------------------------------------------- */
.rb-auth-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, #0038a8 0%, #001a4d 55%, #000d29 100%);
  padding: 1.5rem;
}
.rb-auth-card {
  background: var(--rb-surface); border-radius: var(--rb-radius-lg);
  box-shadow: var(--rb-shadow-md); padding: 2.5rem 2.25rem; width: 100%; max-width: 420px;
}
.rb-auth-card img { height: 44px; margin-bottom: 1rem; }

/* ---------------------------------------------------------------------- */
/* Tablas                                                                   */
/* ---------------------------------------------------------------------- */
.rb-table-card {
  background: var(--rb-surface); border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-md); box-shadow: var(--rb-shadow); overflow: hidden;
}
.rb-table-card table { margin-bottom: 0; }
.rb-table-card thead th {
  background: #f8f9fc; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--rb-ink-muted); font-weight: 700; border-bottom: 1px solid var(--rb-border);
}
.rb-table-card td { vertical-align: middle; font-size: .9rem; }

.rb-empty-state {
  text-align: center; padding: 3rem 1.5rem; color: var(--rb-ink-muted);
}
.rb-empty-state i { font-size: 2.2rem; color: var(--rb-blue-tint-2); margin-bottom: .75rem; }

.rb-skeleton {
  background: linear-gradient(90deg, #eef1f6 25%, #e4e9f2 37%, #eef1f6 63%);
  background-size: 400% 100%; animation: rb-shimmer 1.4s ease infinite;
  border-radius: var(--rb-radius-md);
}
@keyframes rb-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.rb-toast-stack { position: fixed; top: 1rem; right: 1rem; z-index: 1080; }
