/* ============================================================
   STYLES.CSS — Collie Platform Design System
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --bg-base:        #060c1a;
  --bg-surface:     #0b1525;
  --bg-card:        #0f1d32;
  --bg-card-hover:  #132240;
  --bg-modal:       #0d1a2e;
  --accent:         #00d4a8;
  --accent-dim:     rgba(0, 212, 168, 0.15);
  --accent-glow:    rgba(0, 212, 168, 0.35);
  --accent-dark:    #00a886;
  --text-primary:   #ffffff;
  --text-secondary: #8b9bb4;
  --text-muted:     #4d5e78;
  --border:         rgba(255, 255, 255, 0.07);
  --border-accent:  rgba(0, 212, 168, 0.3);
  --success:        #00d4a8;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --pending:        #a78bfa;
  --inactive:       #4d5e78;
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;
  --radius-xl:      24px;
  --shadow-card:    0 4px 24px rgba(0,0,0,0.35);
  --shadow-glow:    0 0 30px rgba(0, 212, 168, 0.12);
  --sidebar-width:  260px;
  --topbar-height:  64px;
  --transition:     0.2s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.8; }

ul { list-style: none; }

img { max-width: 100%; }

canvas { display: block; max-width: 100%; }

button { cursor: pointer; font-family: inherit; border: none; outline: none; }

input, select, textarea {
  font-family: inherit;
  outline: none;
}

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

/* ── Typography ─────────────────────────────────────────────── */
h1 { font-size: 2rem;   font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 1.2rem; font-weight: 600; }
h4 { font-size: 1rem;   font-weight: 600; }
p  { color: var(--text-secondary); }

.text-accent   { color: var(--accent); }
.text-muted    { color: var(--text-muted); }
.text-secondary{ color: var(--text-secondary); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }
.font-bold     { font-weight: 700; }
.font-medium   { font-weight: 500; }
.text-sm       { font-size: 0.875rem; }
.text-xs       { font-size: 0.75rem; }

/* ── Background Pattern ─────────────────────────────────────── */
.bg-pattern {
  position: relative;
  overflow: hidden;
}
.bg-pattern::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ── Logo ─────────────────────────────────────────────────── */
.collie-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.collie-logo-img {
  height: 30px;
  width: auto;
  display: block;
}
.login-header .collie-logo-img {
  height: 48px;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  border: 1px solid transparent;
}
.btn-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-card);
  border-color: var(--border-accent);
}

.btn-danger {
  background: rgba(239,68,68,0.1);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover {
  background: rgba(239,68,68,0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  padding: 8px 14px;
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  line-height: 1;
}
.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-accent);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.card-sm { padding: 16px; border-radius: var(--radius-md); }

/* ── Badges / Status ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-active {
  background: rgba(0, 212, 168, 0.12);
  color: var(--success);
  border: 1px solid rgba(0, 212, 168, 0.2);
}
.badge-inactive {
  background: rgba(77, 94, 120, 0.2);
  color: var(--inactive);
  border: 1px solid rgba(77, 94, 120, 0.3);
}
.badge-pending {
  background: rgba(167, 139, 250, 0.12);
  color: var(--pending);
  border: 1px solid rgba(167, 139, 250, 0.2);
}
.badge-superadmin {
  background: rgba(245,158,11,0.12);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,0.2);
}

/* ── Toggle Switch ─────────────────────────────────────────── */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toggle {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.25s ease;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.25s ease;
}
.toggle input:checked + .toggle-slider {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.toggle input:checked + .toggle-slider::after {
  left: calc(100% - 21px);
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.toggle input:disabled + .toggle-slider {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Form Elements ─────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
.form-label .required { color: var(--danger); margin-left: 3px; }

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 0.9rem;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-select option { background: var(--bg-card); color: var(--text-primary); }
.form-textarea { resize: vertical; min-height: 90px; }

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

.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 4px;
}

/* ── Table ─────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.025); }
tbody td {
  padding: 14px 16px;
  vertical-align: middle;
  color: var(--text-primary);
}
.td-actions { display: flex; gap: 6px; align-items: center; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  transform: translateY(12px);
  transition: transform 0.2s ease;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-lg { max-width: 700px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

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

/* ── Toast ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  transform: translateX(110%);
  transition: transform 0.3s ease;
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
}
.toast.show { transform: translateX(0); }
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger);  }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info    { border-left: 3px solid var(--accent);  }
.toast-icon    { font-size: 1.1rem; flex-shrink: 0; }

/* ── Divider ─────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--text-muted);
  text-align: center;
  gap: 12px;
}
.empty-state svg { opacity: 0.4; }
.empty-state p { font-size: 0.9rem; }

/* ── Utilities ─────────────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-6  { gap: 24px; }
.mt-4   { margin-top: 16px; }
.mt-6   { margin-top: 24px; }
.mb-4   { margin-bottom: 16px; }
.mb-6   { margin-bottom: 24px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── Section Header ─────────────────────────────────────────── */
.section-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--border-accent);
  background: var(--accent-dim);
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 12px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 50px 50px;
}
.login-page::after {
  content: '';
  position: absolute;
  top: -30%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0,212,168,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}
.login-header .collie-logo {
  justify-content: center;
  margin-bottom: 20px;
}
.login-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.login-header p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.login-alert {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--danger);
  margin-bottom: 20px;
  display: none;
}
.login-alert.visible { display: block; }

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #000;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
  border: none;
  cursor: pointer;
  margin-top: 8px;
}
.login-btn:hover {
  background: var(--accent-dark);
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.demo-hint {
  margin-top: 24px;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 0.82rem;
}
.demo-hint p { color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.demo-hint .demo-credential {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  margin: 4px 0;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
}
.demo-hint .demo-credential strong { color: var(--text-primary); }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

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

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 8px 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2px;
  border: 1px solid transparent;
}
.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--border-accent);
}
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-avatar {
  width: 34px;
  height: 34px;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.sidebar-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition);
}
.sidebar-logout:hover { color: var(--danger); }

/* ── Main Content ─────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  overflow-x: hidden;
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
  gap: 16px;
}

.topbar-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
}
.topbar-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.period-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

.page-body {
  flex: 1;
  padding: 28px;
  max-width: 1400px;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

/* ── Stats Grid ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  font-size: 1.2rem;
}
.icon-teal  { background: rgba(0,212,168,0.12);   color: #00d4a8; }
.icon-blue  { background: rgba(59,130,246,0.12);  color: #3b82f6; }
.icon-purple{ background: rgba(167,139,250,0.12); color: #a78bfa; }
.icon-amber { background: rgba(245,158,11,0.12);  color: #f59e0b; }
.icon-green { background: rgba(34,197,94,0.12);   color: #22c55e; }

.stat-card-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}
.stat-card-period {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Assistant Cards (Mis Asistentes) ─────────────────────────── */
.assistants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.assistant-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
}
.assistant-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.assistant-card.selected {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-glow);
}
.assistant-card.selected::before {
  content: '✓ Seleccionado';
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  padding: 2px 8px;
  border-radius: 100px;
}

.assistant-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}
.assistant-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.assistant-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 2px;
}
.assistant-phone {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
}
.assistant-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ── Reports ─────────────────────────────────────────────────── */
.reports-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.report-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition);
  gap: 12px;
}
.report-item:hover { border-color: var(--border-accent); }

.report-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.report-icon {
  width: 38px;
  height: 38px;
  background: rgba(239,68,68,0.1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
  flex-shrink: 0;
}
.report-period {
  font-size: 0.92rem;
  font-weight: 600;
}
.report-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ── Section Title ─────────────────────────────────────────── */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}
.section-title h2 {
  font-size: 1.15rem;
  font-weight: 700;
}
.section-title p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Assistant Selector Banner ─────────────────────────────── */
.selected-assistant-banner {
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sab-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #060c1a;
  flex-shrink: 0;
}
.sab-name { font-size: 0.95rem; font-weight: 700; color: var(--accent); }
.sab-phone { font-size: 0.8rem; color: var(--text-secondary); font-family: 'Courier New', monospace; }
.sab-hint {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-left: auto;
  text-align: right;
}

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.admin-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.admin-tab {
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  margin-bottom: -1px;
}
.admin-tab:hover { color: var(--text-primary); }
.admin-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.admin-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.admin-stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.admin-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.search-bar {
  position: relative;
  flex: 1;
  max-width: 320px;
}
.search-bar svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-bar input {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 9px 14px 9px 36px;
  font-size: 0.88rem;
  width: 100%;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar input:focus {
  border-color: var(--border-accent);
  outline: none;
}

/* User detail view */
.user-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.user-detail-avatar {
  width: 56px;
  height: 56px;
  background: var(--accent-dim);
  border: 2px solid var(--border-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

/* Plan badges */
.badge-plan-pro     { background: rgba(59,130,246,0.12); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.badge-plan-starter { background: rgba(167,139,250,0.12); color: var(--pending); border: 1px solid rgba(167,139,250,0.2); }
.badge-plan-admin   { background: rgba(245,158,11,0.12); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }

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

/* ── Hamburger button (hidden on desktop) ─────────────────── */
.topbar-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}
.topbar-menu-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

/* ── Sidebar overlay backdrop ─────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  z-index: 99;
  cursor: pointer;
}
.sidebar-overlay.visible { display: block; }

/* ── ≤ 900px (tablets / landscape phones) ─────────────────── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; min-width: 0; }

  .topbar { padding: 0 16px; gap: 10px; }
  .topbar-menu-btn { display: flex; }
  .topbar-left { flex: 1; min-width: 0; }
  .topbar-subtitle { display: none; }
  .topbar-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-body { padding: 16px; max-width: 100%; }

  .section-title { flex-wrap: wrap; gap: 10px; }
  .section-title > div:first-child { flex: 1; min-width: 0; }

  .charts-row-secondary,
  .charts-row-equal { grid-template-columns: 1fr; }

  .chart-card-header { flex-wrap: wrap; gap: 8px; }

  .admin-overview-row { grid-template-columns: 1fr !important; }

  .admin-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 1px;
  }
  .admin-tabs::-webkit-scrollbar { display: none; }
  .admin-tab { white-space: nowrap; }

  /* Prevent table from forcing viewport expansion */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── ≤ 640px (phones) ─────────────────────────────────────── */
@media (max-width: 640px) {
  .assistants-grid { grid-template-columns: 1fr; }

  .sab-hint { display: none; }
  .selected-assistant-banner { flex-wrap: wrap; }

  .topbar-right { gap: 8px; flex-shrink: 0; }
  .btn-text { display: none; }
  .period-badge { padding: 5px 9px; max-width: 120px; }
  .period-badge span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .report-item { flex-wrap: wrap; }
  .report-item > .btn { width: 100%; justify-content: center; }

  .modal-footer { flex-direction: column-reverse; gap: 8px; }
  .modal-footer .btn { width: 100%; justify-content: center; }

  .search-bar { max-width: 100%; width: 100%; }

  .user-detail-header { flex-wrap: wrap; }

  .charts-section-header { flex-wrap: wrap; }

  /* Stat card: smaller value on phones */
  .stat-card-value { font-size: 1.5rem; }
}

/* ── ≤ 480px (small phones) ───────────────────────────────── */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .admin-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .login-card { padding: 28px 20px; }
  .page-body { padding: 12px; }
  .topbar-title { font-size: 0.95rem; }
  .stat-card-value { font-size: 1.6rem; }
  .stat-card { padding: 16px; }
  .modal-body { padding: 20px 18px; }
  .modal-header { padding: 18px 18px 14px; }
  .modal-footer { padding: 14px 18px 18px; }
  .assistant-card { padding: 16px; }

  #toast-container { left: 12px; right: 12px; bottom: 16px; }
  .toast { min-width: unset; max-width: 100%; }
}

/* ============================================================
   CHARTS
   ============================================================ */
.charts-section { margin-bottom: 28px; }

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  transition: border-color var(--transition);
}
.chart-card:hover { border-color: rgba(255,255,255,0.1); }

.chart-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 8px;
}
.chart-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.chart-card-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
}

.charts-row-main {
  margin-bottom: 16px;
}

.charts-row-secondary {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.charts-row-equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chart-legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

/* Section label above charts */
.charts-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.charts-section-header h2 { font-size: 1.1rem; font-weight: 700; }
.charts-section-header p  { font-size: 0.8rem; color: var(--text-muted); }


/* ── Pulse animation for active status ─────────────────────── */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}
.badge-active::before {
  animation: pulse-dot 2s ease-in-out infinite;
}

/* ── Loading spinner ─────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Confirmation dialog ─────────────────────────────────────── */
.confirm-dialog {
  text-align: center;
  padding: 8px 0 16px;
}
.confirm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.confirm-dialog h3 { margin-bottom: 8px; }
.confirm-dialog p  { font-size: 0.9rem; }

/* ── File drop zone ──────────────────────────────────────────── */
.file-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.file-drop-zone:hover,
.file-drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}
.file-drop-zone.file-drop-has-file {
  border-color: var(--success);
  background: rgba(0,212,168,0.05);
  color: var(--text-primary);
}
.file-drop-zone p {
  font-size: 0.88rem;
  font-weight: 500;
  margin: 0;
}
.file-drop-zone span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── App footer ──────────────────────────────────────────────── */
.app-footer {
  margin-top: 48px;
  padding: 20px 0 4px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.app-footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-footer-logo {
  height: 20px;
  width: auto;
  opacity: 0.5;
}
.app-footer-copy {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.app-footer-links {
  display: flex;
  gap: 20px;
}
.app-footer-links a {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.app-footer-links a:hover {
  color: var(--accent);
}
