/* ==========================================
   styles.css — Sistema Sociedad
   Demo Prototipo v1.0
   ========================================== */

/* === 1. CSS VARIABLES (Design Tokens) === */
:root {
  /* Brand */
  --primary:        #4f46e5;
  --primary-dark:   #3730a3;
  --primary-light:  #818cf8;
  --primary-bg:     #eef2ff;

  /* Sidebar */
  --sidebar-bg:     #1e1b4b;
  --sidebar-text:   #a5b4fc;
  --sidebar-muted:  #6d72a8;
  --sidebar-hover:  rgba(99,102,241,0.15);
  --sidebar-active: #4f46e5;
  --sidebar-width:  260px;

  /* Status colours */
  --success:        #10b981;
  --success-bg:     #d1fae5;
  --warning:        #f59e0b;
  --warning-bg:     #fef3c7;
  --danger:         #ef4444;
  --danger-bg:      #fee2e2;
  --info:           #3b82f6;
  --info-bg:        #dbeafe;
  --secondary:      #6b7280;
  --secondary-bg:   #f3f4f6;

  /* Page */
  --bg:             #f1f5f9;
  --bg-card:        #ffffff;
  --bg-input:       #ffffff;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --text-light:     #94a3b8;
  --border:         #e2e8f0;
  --border-focus:   #818cf8;

  /* Layout */
  --topbar-height:  64px;
  --radius:         8px;
  --radius-lg:      12px;
  --shadow-sm:      0 1px 2px rgba(0,0,0,0.06);
  --shadow:         0 1px 4px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:      0 8px 24px rgba(0,0,0,0.12);
  --transition:     0.2s ease;

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}

/* === DARK MODE === */
[data-theme="dark"] {
  --bg:         #0f172a;
  --bg-card:    #1e293b;
  --bg-input:   #1e293b;
  --text:       #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border:     #334155;
  --border-focus:#818cf8;
  --sidebar-bg: #0f172a;
  --primary-bg: #1e1b4b;
  --success-bg: #022c22;
  --warning-bg: #1c1300;
  --danger-bg:  #200;
  --info-bg:    #0c1a3a;
  --secondary-bg:#1e293b;
}

/* === 2. RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === 3. LAYOUT === */
#app {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
#sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition), width var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

#sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-width))); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  min-height: var(--topbar-height);
}

.brand-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; color: #fff;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.brand-sub {
  font-size: 0.65rem;
  color: var(--sidebar-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-muted);
  padding: 12px 20px 4px;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 20px;
  color: var(--sidebar-text);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  border-radius: 0;
  white-space: nowrap;
  text-decoration: none;
}

.nav-link svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
}

.nav-link:hover svg { opacity: 1; }

.nav-link.active {
  background: var(--primary);
  color: #ffffff;
}

.nav-link.active svg { opacity: 1; }

/* Sidebar footer */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-footer-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sidebar-text);
  font-size: 0.8rem;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  padding: 6px 0;
  transition: color var(--transition);
}
.sidebar-footer-btn:hover { color: #fff; }
.sidebar-footer-btn svg { width: 16px; height: 16px; }

/* Overlay (mobile) */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
}

/* ---- MAIN WRAPPER ---- */
#main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}

#main-wrapper.sidebar-collapsed {
  margin-left: 0;
}

/* ---- TOPBAR ---- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.sidebar-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--transition);
}
.sidebar-toggle:hover { background: var(--bg); }
.sidebar-toggle svg { width: 18px; height: 18px; }

#breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
#breadcrumb a { color: var(--text-muted); }
#breadcrumb a:hover { color: var(--primary); text-decoration: none; }
.breadcrumb-sep { color: var(--text-light); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-search {
  position: relative;
}
.topbar-search input {
  padding: 7px 12px 7px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  width: 200px;
  transition: border-color var(--transition), width var(--transition);
}
.topbar-search input:focus {
  outline: none;
  border-color: var(--primary);
  width: 260px;
}
.topbar-search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 14px; height: 14px;
  pointer-events: none;
}

.topbar-badge {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}

/* ---- MAIN CONTENT ---- */
#main-content {
  flex: 1;
  padding: 28px 28px 48px;
  min-height: calc(100vh - var(--topbar-height));
  max-width: 1400px;
}

/* === 4. PAGE COMPONENTS === */

.page-header {
  margin-bottom: 24px;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}
.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Page header with action button */
.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header-row .page-header { margin-bottom: 0; }

/* === 5. CARDS === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.card-body { padding: 20px; }

/* === 6. STATS GRID (Dashboard) === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon-primary { background: var(--primary-bg); color: var(--primary); }
.stat-icon-success { background: var(--success-bg); color: var(--success); }
.stat-icon-warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon-danger  { background: var(--danger-bg);  color: var(--danger); }
.stat-icon-info    { background: var(--info-bg);    color: var(--info); }

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.3;
}

/* === 7. QUICK ACTIONS === */
.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.quick-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  text-decoration: none;
}
.quick-action-btn:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
  text-decoration: none;
}

/* === 8. TABLES === */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table thead { position: sticky; top: 0; z-index: 1; }

.table th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--bg); }

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

/* === 9. BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); text-decoration: none; color: #fff; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg); text-decoration: none; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { background: #dc2626; text-decoration: none; color: #fff; }

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover { background: #059669; text-decoration: none; color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); text-decoration: none; }

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-icon {
  padding: 6px;
  border-radius: 6px;
}
.btn-icon svg { width: 16px; height: 16px; }

/* === 10. FORMS === */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.875rem;
  font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 4px;
}

.form-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 4px;
}

/* Inline filter/search row */
.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-row .form-control { width: auto; flex: 1; min-width: 160px; }

/* === 11. BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-primary   { background: var(--primary-bg);   color: var(--primary); }
.badge-success   { background: var(--success-bg);   color: var(--success); }
.badge-warning   { background: var(--warning-bg);   color: var(--warning); }
.badge-danger    { background: var(--danger-bg);    color: var(--danger); }
.badge-info      { background: var(--info-bg);      color: var(--info); }
.badge-secondary { background: var(--secondary-bg); color: var(--secondary); }

/* === 12. MODALS === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
  backdrop-filter: blur(2px);
}

.modal-overlay.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-dialog {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
  border: 1px solid var(--border);
}

.modal-sm  { max-width: 420px; }
.modal-md  { max-width: 580px; }
.modal-lg  { max-width: 780px; }
.modal-xl  { max-width: 1000px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

body.modal-open { overflow: hidden; }

/* === 13. TOASTS === */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  font-size: 0.875rem;
  animation: slideInRight 0.25s ease;
  border-left: 3px solid;
  min-width: 260px;
}

@keyframes slideInRight { from { opacity:0; transform: translateX(40px); } to { opacity:1; transform: translateX(0); } }

.toast-leaving { animation: slideOutRight 0.25s ease forwards; }
@keyframes slideOutRight { to { opacity:0; transform: translateX(40px); } }

.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info    { border-left-color: var(--info); }

.toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--success); }
.toast-error   .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info    .toast-icon { color: var(--info); }

.toast-message { flex: 1; color: var(--text); line-height: 1.4; }

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  flex-shrink: 0;
  line-height: 1;
}

/* === 14. LOADING === */
.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* === 15. EMPTY STATES === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
  color: var(--text-muted);
}

.empty-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.empty-icon svg { width: 26px; height: 26px; color: var(--text-light); }

.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text); }
.empty-state p  { font-size: 0.875rem; max-width: 320px; }

/* === 16. DETAIL PANELS === */
.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.detail-avatar {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  flex-shrink: 0;
}

.detail-info h1 { font-size: 1.3rem; font-weight: 700; }
.detail-info p  { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.meta-item svg { width: 14px; height: 14px; }

.detail-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-shrink: 0;
}

/* Info grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.info-item label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  display: block;
  margin-bottom: 3px;
}

.info-item span {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}

/* === 17. PROGRESS & PAYMENT === */
.payment-bar {
  background: var(--border);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
  margin-top: 4px;
}
.payment-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--success);
  transition: width 0.4s ease;
}

.payment-summary {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.payment-sum-item label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  display: block;
}
.payment-sum-item span {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.payment-sum-item.pending span { color: var(--warning); }
.payment-sum-item.overdue span { color: var(--danger); }

/* Quota row */
.quota-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.quota-row:last-child { border-bottom: none; }
.quota-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}
.quota-row.paid .quota-num { background: var(--success-bg); color: var(--success); }
.quota-info { flex: 1; }
.quota-amount { font-weight: 600; color: var(--text); }
.quota-due { font-size: 0.75rem; color: var(--text-muted); }
.quota-row.overdue .quota-due { color: var(--danger); }

/* === 18. TABS === */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  gap: 0;
}
.tab-btn {
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover:not(.active) { color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* === 19. GRADE DISPLAY === */
.grade-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
}
.grade-pass { background: var(--success-bg); color: var(--success); }
.grade-fail { background: var(--danger-bg);  color: var(--danger); }
.grade-pending { background: var(--secondary-bg); color: var(--secondary); }

/* Note card (leads) */
.note-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
  border-left: 3px solid var(--primary-light);
}
.note-date { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.note-text { font-size: 0.85rem; color: var(--text); line-height: 1.5; }

/* === 20. ALERTS / CALLOUTS === */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 16px;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-warning { background: var(--warning-bg); color: #92400e; border: 1px solid #fde68a; }
.alert-danger  { background: var(--danger-bg);  color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: var(--info-bg);    color: #1e40af; border: 1px solid #bfdbfe; }

/* === 21. CONFIRM === */
.confirm-content {
  text-align: center;
  padding: 8px 0;
}
.confirm-icon { font-size: 2.5rem; margin-bottom: 12px; }
.confirm-content p { font-size: 0.95rem; color: var(--text-muted); line-height: 1.5; }

/* === 22. PRINT AREA === */
#print-area { display: none; }

/* === 23. FICHA VIRTUAL === */
.ficha {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.ficha-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--primary);
}
.ficha-logo { font-size: 1.4rem; font-weight: 800; color: var(--primary); }
.ficha-title { font-size: 1rem; font-weight: 700; text-align: right; }
.ficha-sub { font-size: 0.75rem; color: var(--text-muted); }
.ficha-section { margin-bottom: 20px; }
.ficha-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--primary-bg);
  padding-bottom: 4px;
}
.ficha-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
}
.ficha-field label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; display: block; }
.ficha-field span  { font-size: 0.9rem; color: var(--text); }
.ficha-signature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 40px;
}
.sig-line { border-top: 1px solid var(--text); padding-top: 6px; font-size: 0.75rem; color: var(--text-muted); text-align: center; }

/* === 24. DOCUMENTATION PAGE === */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.doc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: box-shadow var(--transition);
}
.doc-card:hover { box-shadow: var(--shadow-md); }
.doc-card-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.doc-card-icon svg { width: 22px; height: 22px; }
.doc-card h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 4px; }
.doc-card p  { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 14px; line-height: 1.4; }
.doc-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* === 25. SETTINGS PAGE === */
.settings-section { margin-bottom: 28px; }
.settings-section h3 { font-size: 0.9rem; font-weight: 700; margin-bottom: 12px; }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.settings-row-info p { font-size: 0.875rem; font-weight: 600; }
.settings-row-info small { font-size: 0.78rem; color: var(--text-muted); }

/* Toggle switch */
.toggle { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  width: 44px; height: 24px;
  background: var(--border);
  border-radius: 24px;
  transition: background var(--transition);
  position: relative;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: white;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::after { transform: translateX(20px); }

/* === 26. COMPROBANTE === */
.comprobante {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.comprobante-header { text-align: center; margin-bottom: 20px; }
.comprobante-logo { font-size: 1.2rem; font-weight: 800; color: var(--primary); }
.comprobante-num { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.comprobante-divider { border: none; border-top: 1px dashed var(--border); margin: 16px 0; }
.comprobante-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.875rem; }
.comprobante-row label { color: var(--text-muted); }
.comprobante-total { font-size: 1.1rem; font-weight: 700; }
.comprobante-footer { text-align: center; font-size: 0.75rem; color: var(--text-muted); margin-top: 16px; }

/* === 27. PRINT STYLES === */
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area {
    display: block !important;
    position: fixed;
    inset: 0;
    background: #fff;
    padding: 20mm;
    font-family: var(--font);
    font-size: 11pt;
    color: #000;
  }
  .print-document h1 { font-size: 16pt; margin-bottom: 8mm; }
  .print-document table { width: 100%; border-collapse: collapse; }
  .print-document th, .print-document td {
    border: 0.5px solid #ccc;
    padding: 5px 8px;
    font-size: 9pt;
    text-align: left;
  }
  .print-document th { background: #f0f0f0; font-weight: 700; }
  .no-print { display: none !important; }
  .print-header { display: flex; justify-content: space-between; margin-bottom: 6mm; }
  .print-meta { font-size: 9pt; color: #666; }
}

/* === 28. RESPONSIVE === */
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
    box-shadow: var(--shadow-lg);
  }
  #sidebar.mobile-open {
    transform: translateX(0);
  }
  #sidebar-overlay.active { display: block; }

  #main-wrapper { margin-left: 0 !important; }

  #topbar { padding: 0 16px; }
  #main-content { padding: 16px; }

  .topbar-search input { width: 140px; }
  .topbar-search input:focus { width: 180px; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .modal-dialog { max-width: 100%; margin: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .ficha-grid { grid-template-columns: 1fr; }
  .ficha-signature { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .page-header-row { flex-direction: column; }
  .topbar-search { display: none; }
}

/* === 29. UTILITIES === */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* Scrollbar (WebKit) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }
