/* =============================================
   PulsoVecinal — Estilos Principales
   ============================================= */

:root {
  --primary:       #1a1222;
  --primary-dark:  #120d18;
  --primary-light: #34213d;
  --accent:        #8c5bff;
  --accent-light:  #b18dff;
  --accent-soft:   #f3e8ff;
  --gold:          #d7b06d;
  --gold-soft:     #f6ebd9;
  --success:       #1ea97c;
  --danger:        #df5b5b;
  --warning:       #d39a2d;
  --info:          #4a7ef7;
  --muted:         #7f8898;
  --text:          #1d2433;
  --text-light:    #5d677a;
  --bg:            #f6f3f8;
  --bg-soft:       #f0ebf5;
  --card-bg:       rgba(255,255,255,0.92);
  --border:        rgba(116,129,153,0.17);
  --sidebar-w:     260px;
  --header-h:      72px;
  --radius:        14px;
  --radius-lg:     20px;
  --shadow:        0 18px 40px rgba(17,12,20,.08);
  --shadow-md:     0 26px 58px rgba(28,24,38,.12);
}

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

html { font-size: 15px; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(140,91,255,0.10), transparent 18%),
    radial-gradient(circle at top right, rgba(215,176,109,0.12), transparent 18%),
    linear-gradient(180deg, #f9f7fb 0%, #f3f0f7 100%);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--primary); }

/* =============================================
   LAYOUT — Sidebar + Content
   ============================================= */

.pv-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.pv-sidebar {
  width: var(--sidebar-w);
  background:
    linear-gradient(180deg, rgba(24,15,30,0.98), rgba(15,12,18,0.98)),
    radial-gradient(circle at top right, rgba(215,176,109,0.12), transparent 28%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform .3s ease;
  overflow-y: auto;
  border-right: 1px solid rgba(215,176,109,0.18);
  box-shadow: 18px 0 40px rgba(15,23,42,0.12);
}

.pv-sidebar .sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.pv-sidebar .brand-logo {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--gold) 0%, #f2d8a5 100%);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; font-weight: 800; color: #17111d;
  flex-shrink: 0;
  box-shadow: 0 12px 24px rgba(215,176,109,.35);
}

.pv-sidebar .brand-name {
  font-size: .92rem; font-weight: 700; color: #fff;
  line-height: 1.2;
}

.pv-sidebar .brand-sub {
  font-size: .72rem; color: rgba(255,255,255,.55);
}

.pv-sidebar .sidebar-nav {
  padding: 12px 12px;
  flex: 1;
}

.pv-sidebar .nav-section-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.38);
  padding: 10px 10px 6px;
}

.pv-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  color: rgba(255,255,255,.78);
  font-size: .88rem;
  font-weight: 600;
  border-radius: 12px;
  transition: all .2s ease;
  position: relative;
  margin-bottom: 6px;
}

.pv-sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.04);
  transform: translateX(2px);
}

.pv-sidebar .nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(140,91,255,0.28), rgba(215,176,109,0.10));
  border: 1px solid rgba(215,176,109,0.22);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
}

.pv-sidebar .nav-link .nav-icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.pv-sidebar .nav-link .nav-badge {
  margin-left: auto;
  background: linear-gradient(135deg, #8a3bd6, #d7b06d);
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.pv-sidebar .sidebar-footer {
  padding: 16px 16px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.pv-sidebar .user-info {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}

.pv-sidebar .user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: #fff;
  flex-shrink: 0;
}

.pv-sidebar .user-avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.pv-sidebar .user-avatar-link:hover .user-avatar {
  box-shadow: 0 0 0 2px var(--accent);
}

.pv-sidebar .user-name {
  font-size: .85rem; font-weight: 600; color: #fff;
  line-height: 1.2;
}

.pv-sidebar .user-role {
  font-size: .7rem; color: rgba(255,255,255,.5);
}

/* Main content area */
.pv-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top header */
.pv-topbar {
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(116,129,153,0.15);
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 12px 28px rgba(17,12,20,.03);
}

.pv-topbar .topbar-toggle {
  display: none;
  background: linear-gradient(135deg, rgba(140,91,255,0.10), rgba(215,176,109,0.12));
  border: 1px solid rgba(140,91,255,0.12);
  cursor: pointer;
  padding: 8px 10px;
  color: var(--primary);
  font-size: 1.2rem;
  border-radius: 10px;
}

.pv-topbar .topbar-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
  flex: 1;
  letter-spacing: -0.02em;
}

.pv-topbar .topbar-actions {
  display: flex; align-items: center; gap: 10px;
}

/* Content */
.pv-content {
  padding: 24px;
  flex: 1;
}

/* =============================================
   CARDS
   ============================================= */

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(250,247,252,0.96));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(113,123,148,0.14);
  overflow: hidden;
  position: relative;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold), var(--accent), var(--gold));
  opacity: .95;
}

.card-header {
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  background: linear-gradient(180deg, rgba(248,245,252,0.88), rgba(255,255,255,0.40));
}

.card-header h2, .card-header h3 {
  font-size: 1rem; font-weight: 800; color: var(--primary);
  margin: 0;
  letter-spacing: -0.02em;
}

.card-body { padding: 20px; }

/* Stat cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.92));
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(148,163,184,0.16);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform .2s, box-shadow .2s;
}

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

.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.stat-card .stat-icon.purple { background: rgba(138,59,214,.12); color: var(--accent); }
.stat-card .stat-icon.green  { background: rgba(34,197,94,.12);  color: var(--success); }
.stat-card .stat-icon.blue   { background: rgba(59,130,246,.12); color: var(--info); }
.stat-card .stat-icon.orange { background: rgba(245,158,11,.12); color: var(--warning); }
.stat-card .stat-icon.red    { background: rgba(239,68,68,.12);  color: var(--danger); }
.stat-card .stat-icon.pink   { background: rgba(236,72,153,.12); color: #ec4899; }

.stat-card .stat-label {
  font-size: .8rem; color: var(--text-light); font-weight: 500;
}

.stat-card .stat-value {
  font-size: 1.6rem; font-weight: 800; color: var(--primary); line-height: 1;
}

.stat-card .stat-meta {
  font-size: .75rem; color: var(--success);
}

.stat-card .stat-meta.down { color: var(--danger); }

/* =============================================
   TABLES
   ============================================= */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}

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

thead th {
  background: #faf8fd;
  color: var(--text-light);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: left;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

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

tbody tr:hover td { background: #faf8fd; }

/* =============================================
   BADGES / PILLS
   ============================================= */

.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: .72rem; font-weight: 600;
  line-height: 1.4;
}

.badge-success { background: rgba(34,197,94,.12); color: #16a34a; }
.badge-danger  { background: rgba(239,68,68,.12);  color: #dc2626; }
.badge-warning { background: rgba(245,158,11,.12); color: #d97706; }
.badge-info    { background: rgba(59,130,246,.12); color: #2563eb; }
.badge-purple  { background: rgba(138,59,214,.12); color: var(--accent); }
.badge-muted   { background: #f1f5f9; color: var(--text-light); }

/* =============================================
   BUTTONS
   ============================================= */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: .68rem 1.1rem;
  border-radius: 12px;
  font-size: .875rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all .18s ease;
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 10px 18px rgba(17,12,20,.04);
}

.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #2d1c35 100%);
  color: #fff;
  box-shadow: 0 14px 28px rgba(26,18,34,.20);
}
.btn-primary:hover { filter: brightness(1.04); color: #fff; }

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, var(--gold) 100%);
  color: #fff;
  box-shadow: 0 14px 28px rgba(140,91,255,.20);
}
.btn-accent:hover { filter: brightness(1.04); color: #fff; }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #16a34a; color: #fff; }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-light {
  background: #f1f5f9;
  color: var(--text);
}
.btn-light:hover { background: #e2e8f0; color: var(--text); }

.btn-sm {
  padding: .3rem .75rem;
  font-size: .8rem;
  border-radius: 8px;
}

.btn-lg {
  padding: .75rem 1.5rem;
  font-size: 1rem;
  border-radius: 12px;
}

.btn-block { width: 100%; }

.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  border-radius: 8px;
}

/* =============================================
   FORMS
   ============================================= */

.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-control {
  display: block;
  width: 100%;
  padding: .72rem .9rem;
  font-size: .9rem;
  border: 1.5px solid rgba(148,163,184,0.35);
  border-radius: 12px;
  background: rgba(255,255,255,0.9);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, transform .15s;
  line-height: 1.5;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: rgba(139,92,246,.9);
  box-shadow: 0 0 0 4px rgba(139,92,246,.10);
  transform: translateY(-1px);
}

.form-control::placeholder { color: #adb5bd; }

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2.2rem; }

textarea.form-control { resize: vertical; min-height: 90px; }

.form-text { font-size: .78rem; color: var(--text-light); margin-top: 4px; }

.form-row {
  display: grid;
  gap: 16px;
}

.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-check {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
}

.form-check input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* =============================================
   ALERTS / FLASH
   ============================================= */

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid transparent;
}

.alert-success { background: rgba(34,197,94,.1); color: #15803d; border-color: rgba(34,197,94,.2); }
.alert-danger  { background: rgba(239,68,68,.1);  color: #b91c1c; border-color: rgba(239,68,68,.2); }
.alert-warning { background: rgba(245,158,11,.1); color: #92400e; border-color: rgba(245,158,11,.2); }
.alert-info    { background: rgba(59,130,246,.1); color: #1d4ed8; border-color: rgba(59,130,246,.2); }

/* =============================================
   LOGIN
   ============================================= */

.login-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(140,91,255,0.18), transparent 26%),
    radial-gradient(circle at bottom right, rgba(215,176,109,0.20), transparent 24%),
    linear-gradient(135deg, #120d18 0%, #1a1222 36%, #22162b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 440px;
}

.login-card {
  background: rgba(255,255,255,0.97);
  border-radius: 26px;
  padding: 40px 36px;
  box-shadow: 0 30px 90px rgba(0,0,0,.28);
  border: 1px solid rgba(215,176,109,0.18);
  position: relative;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 84px;
  border-radius: 25px 25px 0 0;
  background: linear-gradient(135deg, rgba(140,91,255,.10), rgba(215,176,109,.08));
  pointer-events: none;
}

.login-logo {
  width: 76px; height: 76px;
  background: linear-gradient(135deg, var(--gold) 0%, #f8dfaf 100%);
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 12px 26px rgba(215,176,109,.26);
  font-size: 2rem;
  position: relative;
  z-index: 1;
  color: #1a1222;
}

.login-title {
  font-size: 1.8rem; font-weight: 900;
  color: var(--primary);
  text-align: center; margin-bottom: 4px;
  letter-spacing: -0.03em;
  position: relative;
  z-index: 1;
}

.login-subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: .9rem;
  margin-bottom: 28px;
  position: relative;
  z-index: 1;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: .82rem;
  color: var(--text-light);
}

/* =============================================
   MODALS
   ============================================= */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; visibility: hidden;
  transition: opacity .2s;
}

.modal-backdrop.show { opacity: 1; visibility: visible; }

.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%; max-width: 500px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  overflow: hidden;
  transform: scale(.95);
  transition: transform .2s;
}

.modal-backdrop.show .modal-box { transform: scale(1); }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

.modal-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--primary); }

.modal-body { padding: 20px 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* =============================================
   PAGINATION
   ============================================= */

.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 4px;
  padding: 16px 0 8px;
}

.page-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: .85rem; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  text-decoration: none;
}

.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* =============================================
   PAGE HEADER
   ============================================= */

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap; gap: 12px;
  padding: 22px 22px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(246,238,251,0.9));
  border: 1px solid rgba(140,91,255,0.08);
  box-shadow: 0 12px 28px rgba(28,24,38,0.04);
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: linear-gradient(180deg, var(--gold), var(--accent));
}

.page-header h1 {
  font-size: 1.55rem; font-weight: 900; color: var(--primary);
  margin: 0;
  letter-spacing: -0.03em;
}

.page-header .breadcrumb {
  font-size: .8rem; color: var(--text-light);
  margin-top: 2px;
}

/* =============================================
   SEARCH / FILTER BAR
   ============================================= */

.filter-bar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.search-input-wrap {
  position: relative;
  flex: 1; min-width: 200px;
}

.search-input-wrap .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  font-size: .95rem;
}

.search-input-wrap input {
  padding-left: 36px;
  width: 100%;
}

.commerce-filter-form {
  display: contents;
}

.comercios-table td:last-child .d-flex {
  flex-wrap: wrap;
}

.variant-row {
  align-items: center;
  margin-bottom: 8px;
}

.photo-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.photo-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  cursor: grab;
}

.photo-item:active {
  cursor: grabbing;
}

.photo-item.dragging {
  opacity: .45;
}

.photo-preview img {
  width: 76px;
  height: 62px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.photo-remove {
  border: 0;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 5px;
  width: 28px;
  height: 26px;
  padding: 0;
  font-size: .9rem;
  cursor: pointer;
}

/* =============================================
   CLIENTE FICHA
   ============================================= */

.cliente-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 800; color: #fff;
}

.puntos-display {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}

.puntos-display .puntos-num {
  font-size: 2.5rem; font-weight: 900; line-height: 1;
}

.puntos-display .puntos-label {
  font-size: .85rem; opacity: .8; margin-top: 4px;
}

/* =============================================
   EMPTY STATE
   ============================================= */

.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-light);
}

.empty-state .empty-icon {
  font-size: 3rem; margin-bottom: 12px; opacity: .5;
}

.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */

.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 340px;
}

.toast {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  display: flex; align-items: flex-start; gap: 12px;
  border-left: 4px solid var(--accent);
  animation: slideIn .3s ease;
}

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

.toast .toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast .toast-body { flex: 1; font-size: .875rem; }
.toast .toast-close { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 1rem; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* =============================================
   LOADER
   ============================================= */

.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================
   MISC
   ============================================= */

.text-primary { color: var(--primary) !important; }
.text-accent  { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted   { color: var(--text-light) !important; }

.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fs-sm  { font-size: .8rem; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 24px; }

.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 24px; }

.text-center { text-align: center; }
.text-right  { text-align: right; }

.w-100 { width: 100%; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }

.divider { height: 1px; background: var(--border); margin: 16px 0; }

hr { border: none; border-top: 1px solid var(--border); }

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 768px) {
  .pv-sidebar {
    width: min(82vw, 300px);
    transform: translateX(-105%);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
  }

  .pv-sidebar.open {
    transform: translateX(0);
  }

  .pv-main {
    margin-left: 0;
    width: 100%;
  }

  .pv-topbar {
    padding: 0 16px;
  }

  .pv-topbar .topbar-toggle {
    display: flex;
  }

  .pv-topbar .topbar-title {
    font-size: 1rem;
  }

  .form-row-2,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .stat-cards {
    grid-template-columns: 1fr 1fr;
  }

  .pv-content {
    padding: 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal-box { max-width: 100%; }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
}

@media (max-width: 640px) {
  .commerce-filter-form {
    display: flex;
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .commerce-filter-form .search-input-wrap {
    flex: 1 1 100%;
    min-width: 0;
  }

  .commerce-filter-form .btn {
    flex: 1;
  }

  .comercios-table,
  .comercios-table tbody,
  .comercios-table tr,
  .comercios-table td {
    display: block;
    width: 100%;
  }

  .comercios-table thead {
    display: none;
  }

  .comercios-table tbody tr {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
  }

  .comercios-table tbody tr:last-child {
    border-bottom: none;
  }

  .comercios-table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
    border: none;
    text-align: right;
    overflow-wrap: anywhere;
  }

  .comercios-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 82px;
    color: var(--text-light);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-align: left;
    text-transform: uppercase;
  }

  .comercios-table tbody td:nth-child(2) {
    color: var(--primary);
    font-size: 1rem;
  }

  .comercios-table tbody td:last-child {
    align-items: flex-start;
    padding-top: 12px;
  }

  .comercios-table td:last-child .d-flex {
    justify-content: flex-end;
    gap: 6px;
  }

  .comercios-table td:last-child .btn {
    white-space: normal;
    text-align: center;
  }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 150;
}

.sidebar-overlay.show { display: block; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ── Banner modo demo ────────────────────────────────────────────────── */
.demo-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: .88rem;
  color: #713f12;
  flex-wrap: wrap;
}
.demo-banner-icon { font-size: 1.2rem; flex-shrink: 0; }
.demo-banner > div { flex: 1; min-width: 200px; line-height: 1.5; }
.demo-banner strong { font-weight: 700; }
.demo-banner-exit {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #713f12;
  color: #fff;
  border-radius: 7px;
  padding: 6px 13px;
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s;
}
.demo-banner-exit:hover { background: #92400e; }
