/* ============================================================
   DebitHub — Design System & Global Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800;1,14..32,400&display=swap');

/* ── CSS Variables (Dark Mode – Default) ── */
:root {
  --bg:           #09090f;
  --surface:      #111118;
  --surface-2:    #18181f;
  --surface-3:    #22222e;
  --surface-4:    #2a2a3a;
  --border:       rgba(108, 99, 255, 0.18);
  --border-soft:  rgba(255, 255, 255, 0.06);
  --accent:       #6c63ff;
  --accent-2:     #9b8fff;
  --accent-hover: #7c74ff;
  --accent-dim:   rgba(108, 99, 255, 0.14);
  --accent-glow:  rgba(108, 99, 255, 0.35);
  --text:         #f0f0ff;
  --text-2:       #c0c0e0;
  --text-muted:   #7070a0;
  --success:      #00d4aa;
  --success-dim:  rgba(0, 212, 170, 0.14);
  --warning:      #ffb347;
  --warning-dim:  rgba(255, 179, 71, 0.14);
  --danger:       #ff6b6b;
  --danger-dim:   rgba(255, 107, 107, 0.14);
  --info:         #60a5fa;
  --info-dim:     rgba(96, 165, 250, 0.14);

  --radius-sm:    6px;
  --radius:       12px;
  --radius-lg:    18px;
  --radius-xl:    28px;
  --radius-full:  9999px;

  --transition:   0.28s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.14s ease;

  --shadow:       0 4px 20px rgba(0, 0, 0, 0.45);
  --shadow-lg:    0 12px 48px rgba(0, 0, 0, 0.65);
  --shadow-glow:  0 0 24px rgba(108, 99, 255, 0.3);

  --font: 'Inter', system-ui, -apple-system, sans-serif;

  --header-h: 68px;
  --sidebar-w: 260px;
}

/* ── Light Mode ── */
[data-theme="light"] {
  --bg:          #f0f0ff;
  --surface:     #ffffff;
  --surface-2:   #f5f5fc;
  --surface-3:   #eeeef8;
  --surface-4:   #e6e6f4;
  --border:      rgba(108, 99, 255, 0.2);
  --border-soft: rgba(0, 0, 0, 0.06);
  --accent-dim:  rgba(108, 99, 255, 0.1);
  --text:        #0a0a1e;
  --text-2:      #3a3a6a;
  --text-muted:  #8a8ab0;
  --shadow:      0 4px 20px rgba(0, 0, 0, 0.1);
  --shadow-lg:   0 12px 48px rgba(0, 0, 0, 0.18);
  --shadow-glow: 0 0 24px rgba(108, 99, 255, 0.2);
}

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

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  line-height: 1.6;
  font-size: 15px;
}

img, svg { display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }
ul { list-style: none; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface-2); }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 { line-height: 1.25; font-weight: 700; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.825rem; }
.text-xs    { font-size: 0.75rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

/* ── Utility ── */
.hidden   { display: none !important; }
.flex     { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1 { gap: 0.4rem; }
.gap-2 { gap: 0.8rem; }
.gap-3 { gap: 1.2rem; }
.gap-4 { gap: 1.6rem; }
.mt-1 { margin-top: 0.4rem; }
.mt-2 { margin-top: 0.8rem; }
.mt-4 { margin-top: 1.6rem; }
.mb-1 { margin-bottom: 0.4rem; }
.mb-2 { margin-bottom: 0.8rem; }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.06);
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(108, 99, 255, 0.4);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-glow); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-soft);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(255, 107, 107, 0.25);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-success {
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(0, 212, 170, 0.25);
}
.btn-success:hover { background: var(--success); color: #0a0a0f; }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 0.85rem 1.8rem; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius); background: var(--surface-3); border: 1px solid var(--border-soft); color: var(--text-2); }
.btn-icon:hover { background: var(--accent-dim); color: var(--accent); border-color: var(--border); }

/* ── Form Elements ── */
.form-group { display: flex; flex-direction: column; gap: 0.45rem; }
.form-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.04em; text-transform: uppercase; }

.form-input,
.form-select,
.form-textarea {
  background: var(--surface-3);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  padding: 0.7rem 1rem;
  width: 100%;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition);
  outline: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237070a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.8rem center; padding-right: 2.4rem; cursor: pointer; }

.form-hint { font-size: 0.775rem; color: var(--text-muted); }
.form-error { font-size: 0.775rem; color: var(--danger); }

.input-group { position: relative; }
.input-group .form-input { padding-right: 2.8rem; }
.input-group .input-action { position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0.2rem; border-radius: var(--radius-sm); transition: color var(--transition-fast); }
.input-group .input-action:hover { color: var(--text); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all var(--transition);
}
.card-hover:hover { border-color: var(--border); box-shadow: var(--shadow); transform: translateY(-2px); }

/* ── Stat Cards ── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-color, var(--accent));
  border-radius: var(--radius-full) var(--radius-full) 0 0;
}
.stat-card .stat-icon { font-size: 1.8rem; margin-bottom: 0.75rem; }
.stat-card .stat-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.4rem; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-card .stat-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.4rem; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge-active   { background: var(--success-dim); color: var(--success); }
.badge-paid     { background: var(--info-dim);    color: var(--info); }
.badge-partial  { background: var(--warning-dim); color: var(--warning); }
.badge-overdue  { background: var(--danger-dim);  color: var(--danger); }
.badge-accent   { background: var(--accent-dim);  color: var(--accent); }

/* ── Table ── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border-soft); }
.table { width: 100%; border-collapse: collapse; }
.table th { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding: 0.85rem 1rem; text-align: left; background: var(--surface-2); border-bottom: 1px solid var(--border-soft); }
.table td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border-soft); font-size: 0.875rem; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition-fast); }
.table tbody tr:hover { background: var(--surface-2); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition);
  position: relative;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-sm .modal { max-width: 380px; }
.modal-lg .modal { max-width: 660px; }

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: var(--surface-3); border: none; color: var(--text-muted); width: 32px; height: 32px; border-radius: var(--radius); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1rem; transition: all var(--transition-fast); }
.modal-close:hover { background: var(--danger-dim); color: var(--danger); }

.modal-body { display: flex; flex-direction: column; gap: 1rem; }
.modal-footer { margin-top: 1.5rem; display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ── Toast ── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 0.5rem;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.2rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: toastIn 0.3s ease forwards;
  max-width: 340px;
}
.toast.removing { animation: toastOut 0.3s ease forwards; }
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--info); }
.toast-warning { border-left: 3px solid var(--warning); }

@keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); }    to { opacity: 0; transform: translateX(20px); } }

/* ── Progress Bar ── */
.progress { background: var(--surface-3); border-radius: var(--radius-full); height: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--radius-full); background: var(--accent); transition: width 0.6s ease; }
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger); }

/* ── Divider ── */
.divider { height: 1px; background: var(--border-soft); margin: 1rem 0; }
.divider-text { display: flex; align-items: center; gap: 0.75rem; color: var(--text-muted); font-size: 0.8rem; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--border-soft); }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 3rem 2rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h3 { font-size: 1rem; color: var(--text-2); margin-bottom: 0.4rem; }
.empty-state p { font-size: 0.85rem; }

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

/* ════════════════════════════════════════
   LOGIN PAGE
   ════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: fixed; inset: 0; z-index: 0;
  background: var(--bg);
}

.login-bg::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108,99,255,0.18) 0%, transparent 70%);
  top: -200px; left: -200px;
  animation: bgFloat 8s ease-in-out infinite;
}
.login-bg::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(155,143,255,0.12) 0%, transparent 70%);
  bottom: -150px; right: -150px;
  animation: bgFloat 10s ease-in-out infinite reverse;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%       { transform: translate(30px, 30px) scale(1.05); }
}

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

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: var(--radius-lg);
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-glow);
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(108,99,255,0.35); }
  50%       { box-shadow: 0 0 40px rgba(108,99,255,0.55); }
}

.login-brand h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.03em; }
.login-brand h1 span { color: var(--accent); }
.login-brand p   { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* Sanfona Tabs */
.tab-accordion { }
.tab-item { border-bottom: 1px solid var(--border-soft); }
.tab-item:last-child { border-bottom: none; }

.tab-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.75rem;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
  gap: 1rem;
}
.tab-header:hover { background: var(--surface-2); }
.tab-header.active { background: var(--accent-dim); }

.tab-header-left { display: flex; align-items: center; gap: 0.75rem; }
.tab-header-icon { font-size: 1.2rem; }
.tab-header-title { font-weight: 600; font-size: 0.95rem; }
.tab-header-subtitle { font-size: 0.78rem; color: var(--text-muted); }
.tab-chevron { color: var(--text-muted); font-size: 0.9rem; transition: transform var(--transition); flex-shrink: 0; }
.tab-header.active .tab-chevron { transform: rotate(180deg); color: var(--accent); }

.tab-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.tab-body.open { max-height: 1000px; }

.tab-content { padding: 1.5rem 1.75rem; display: flex; flex-direction: column; gap: 1.1rem; }

/* Login helpers */
.login-controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  margin-top: -0.25rem;
}

.login-page-toolbar {
  display: flex; align-items: center; justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.toolbar-select {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font);
  outline: none;
}
.toolbar-select:hover { border-color: var(--border); color: var(--text); }
.toolbar-select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }

.toggle-theme-btn {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 1rem;
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}
.toggle-theme-btn:hover { border-color: var(--border); background: var(--surface-3); color: var(--text); }

.forgot-link { font-size: 0.82rem; color: var(--accent); cursor: pointer; white-space: nowrap; }
.forgot-link:hover { text-decoration: underline; }

.security-code-hint {
  background: var(--accent-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  color: var(--text-2);
  line-height: 1.5;
}

.login-footer { padding: 1.25rem 1.75rem; text-align: center; font-size: 0.78rem; color: var(--text-muted); border-top: 1px solid var(--border-soft); }
.login-footer a { color: var(--accent); }

/* ════════════════════════════════════════
   DASHBOARD LAYOUT
   ════════════════════════════════════════ */
.app-layout { display: flex; min-height: 100vh; }

/* Header */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  backdrop-filter: blur(12px);
}
.header-brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.header-logo  { width: 34px; height: 34px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.header-brand-name { font-size: 1rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.header-brand-name span { color: var(--accent); }

.header-spacer { flex: 1; }

.header-controls { display: flex; align-items: center; gap: 0.5rem; }
.header-user { display: flex; align-items: center; gap: 0.6rem; }
.user-avatar { width: 34px; height: 34px; background: var(--accent-dim); border: 2px solid var(--border); border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; color: var(--accent); cursor: pointer; transition: all var(--transition-fast); }
.user-avatar:hover { border-color: var(--accent); background: var(--accent); color: #fff; }

/* Sidebar */
.app-sidebar {
  position: fixed; left: 0; top: var(--header-h); bottom: 0; z-index: 100;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column;
  padding: 1.25rem 0.75rem;
  gap: 0.25rem;
  overflow-y: auto;
  transition: transform var(--transition);
}

.nav-section-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 0.5rem 0.75rem; margin-top: 0.5rem; }
.nav-section-label:first-child { margin-top: 0; }

.nav-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }

/* Main content */
.app-main {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  flex: 1;
  padding: 2rem;
  min-height: calc(100vh - var(--header-h));
}

/* Page header */
.page-header { margin-bottom: 2rem; }
.page-title   { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.page-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.25rem; }
.page-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

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

/* Filter Bar */
.filter-bar {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
}
.filter-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.filter-btn { padding: 0.35rem 0.85rem; border-radius: var(--radius-full); font-size: 0.8rem; font-weight: 500; border: 1.5px solid var(--border-soft); background: none; color: var(--text-2); cursor: pointer; transition: all var(--transition-fast); white-space: nowrap; }
.filter-btn:hover  { border-color: var(--border); color: var(--text); background: var(--surface-3); }
.filter-btn.active { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.filter-date-range { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.filter-date-range input[type="date"] { background: var(--surface-3); border: 1.5px solid var(--border-soft); border-radius: var(--radius); color: var(--text); font-size: 0.8rem; padding: 0.3rem 0.6rem; font-family: var(--font); outline: none; cursor: pointer; }
.filter-date-range input[type="date"]:focus { border-color: var(--accent); }

/* Credores Grid */
.credores-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }

/* Credor Card */
.credor-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.credor-card::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius-lg); border: 1px solid transparent; transition: border-color var(--transition-fast); pointer-events: none; }
.credor-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.credor-card:hover::after { border-color: var(--accent); }

.credor-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.25rem; }
.credor-avatar { width: 48px; height: 48px; border-radius: var(--radius); background: var(--accent-dim); border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; font-weight: 700; color: var(--accent); flex-shrink: 0; }
.credor-info { flex: 1; margin-left: 0.85rem; }
.credor-name { font-weight: 700; font-size: 0.95rem; }
.credor-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }
.credor-actions { display: flex; gap: 0.3rem; }

.credor-card-body { }
.credor-amount-row { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 0.75rem; }
.credor-total { }
.credor-total-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.credor-total-value { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; color: var(--danger); }
.credor-paid { text-align: right; }
.credor-paid-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.credor-paid-value { font-size: 1rem; font-weight: 700; color: var(--success); }
.credor-link { font-size: 0.75rem; color: var(--accent); display: flex; align-items: center; gap: 0.3rem; margin-top: 0.85rem; cursor: pointer; padding: 0.5rem 0.75rem; background: var(--accent-dim); border-radius: var(--radius-sm); border: 1px solid var(--border); width: fit-content; transition: all var(--transition-fast); }
.credor-link:hover { background: var(--accent); color: #fff; }

/* Debit List Item */
.debit-item {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  transition: all var(--transition-fast);
  cursor: pointer;
}
.debit-item:hover { background: var(--surface-2); border-color: var(--border); }
.debit-item-icon { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.debit-item-body { flex: 1; min-width: 0; }
.debit-item-desc { font-weight: 600; font-size: 0.875rem; }
.debit-item-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }
.debit-item-right { text-align: right; flex-shrink: 0; }
.debit-item-amount { font-weight: 700; font-size: 0.95rem; }
.debit-item-date   { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }

/* Payment item */
.payment-item { display: flex; align-items: center; gap: 0.85rem; padding: 0.75rem 1rem; border-radius: var(--radius); border: 1px solid var(--border-soft); background: var(--success-dim); }
.payment-icon { font-size: 1.1rem; }
.payment-body { flex: 1; }
.payment-desc { font-size: 0.85rem; font-weight: 500; }
.payment-date { font-size: 0.75rem; color: var(--text-muted); }
.payment-amount { font-weight: 700; color: var(--success); font-size: 0.95rem; }

/* Detail panel (slide-in) */
.detail-panel {
  position: fixed; right: 0; top: var(--header-h); bottom: 0; z-index: 150;
  width: min(480px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border-soft);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition);
  overflow-y: auto;
  box-shadow: -8px 0 32px rgba(0,0,0,0.3);
}
.detail-panel.open { transform: translateX(0); }

.detail-panel-header { display: flex; align-items: center; gap: 1rem; padding: 1.5rem; border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.detail-panel-back { background: var(--surface-3); border: none; color: var(--text-2); width: 32px; height: 32px; border-radius: var(--radius); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; transition: all var(--transition-fast); flex-shrink: 0; }
.detail-panel-back:hover { background: var(--accent-dim); color: var(--accent); }
.detail-panel-title { font-weight: 700; font-size: 1.05rem; flex: 1; }
.detail-panel-body  { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; gap: 1.5rem; }

/* Overlay for panel */
.panel-overlay { position: fixed; inset: 0; z-index: 140; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity var(--transition); }
.panel-overlay.open { opacity: 1; pointer-events: all; }

/* ── User dropdown ── */
.user-dropdown {
  position: absolute; top: calc(var(--header-h) + 8px); right: 1rem; z-index: 300;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transform: translateY(-8px);
  transition: all var(--transition);
}
.user-dropdown.open { opacity: 1; pointer-events: all; transform: translateY(0); }
.user-dropdown-header { padding: 0.75rem 0.85rem; }
.user-dropdown-name { font-weight: 700; font-size: 0.9rem; }
.user-dropdown-email { font-size: 0.75rem; color: var(--text-muted); }
.user-dropdown-divider { height: 1px; background: var(--border-soft); margin: 0.35rem 0; }
.dropdown-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.85rem; border-radius: var(--radius-sm); font-size: 0.875rem; color: var(--text-2); cursor: pointer; transition: all var(--transition-fast); border: none; background: none; width: 100%; text-align: left; font-family: var(--font); }
.dropdown-item:hover { background: var(--surface-3); color: var(--text); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-dim); }

/* ════════════════════════════════════════
   CREDOR PUBLIC PAGE
   ════════════════════════════════════════ */
.credor-page { min-height: 100vh; display: flex; flex-direction: column; }

.credor-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  padding: 1.25rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
}

.credor-hero {
  background: linear-gradient(135deg, var(--accent-dim), transparent 60%);
  border-bottom: 1px solid var(--border-soft);
  padding: 2.5rem 1.5rem;
  text-align: center;
}
.credor-hero-avatar { width: 72px; height: 72px; border-radius: var(--radius-lg); background: var(--accent-dim); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 800; color: var(--accent); margin: 0 auto 1rem; }
.credor-hero-name { font-size: 1.5rem; font-weight: 800; }
.credor-hero-sub  { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.25rem; }

.credor-main { flex: 1; max-width: 720px; margin: 0 auto; width: 100%; padding: 2rem 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; }

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */
@media (max-width: 900px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.mobile-open { transform: translateX(0); }
  .app-main { margin-left: 0; }

  .sidebar-overlay { position: fixed; inset: 0; z-index: 99; background: rgba(0,0,0,0.5); display: none; }
  .sidebar-overlay.show { display: block; }
}

@media (max-width: 640px) {
  .app-main { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .credores-grid { grid-template-columns: 1fr; }
  .modal { padding: 1.25rem; }
  .filter-bar { gap: 0.5rem; }
  h1 { font-size: 1.5rem; }
}

/* ── Animations ── */
@keyframes fadeIn   { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp  { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.animate-in  { animation: fadeIn  0.3s ease forwards; }
.animate-up  { animation: slideUp 0.4s ease forwards; }

/* ── Skeleton Loading ── */
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-4) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Switch ── */
.switch { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; }
.switch-input { display: none; }
.switch-track { width: 40px; height: 22px; background: var(--surface-3); border-radius: var(--radius-full); position: relative; transition: background var(--transition-fast); border: 1.5px solid var(--border-soft); }
.switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-muted); transition: all var(--transition-fast); }
.switch-input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch-input:checked + .switch-track::after { left: calc(100% - 16px); background: #fff; }
.switch-label { font-size: 0.85rem; color: var(--text-2); }

/* ── Section ── */
.section { margin-bottom: 2rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-title { font-size: 1rem; font-weight: 700; }

/* ── Chip ── */
.chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.7rem; background: var(--surface-3); border: 1px solid var(--border-soft); border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 500; color: var(--text-2); }

/* ── Installment indicator ── */
.installment-bar { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.5rem; }
.installment-dots { display: flex; gap: 3px; flex-wrap: wrap; }
.installment-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-4); transition: background var(--transition-fast); }
.installment-dot.paid { background: var(--success); }
.installment-dot.current { background: var(--warning); }

/* ── Search ── */
.search-wrapper { position: relative; }
.search-wrapper .search-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.9rem; pointer-events: none; }
.search-input { padding-left: 2.2rem; }

/* ── Footer ── */
.app-footer { text-align: center; padding: 1.5rem; font-size: 0.78rem; color: var(--text-muted); border-top: 1px solid var(--border-soft); margin-top: auto; }
.app-footer a { color: var(--text-muted); text-decoration: none; transition: color var(--transition-fast); }
.app-footer a:hover { color: var(--accent); }

/* ── Password strength ── */
.password-strength { margin-top: 0.35rem; }
.password-strength-bar { height: 3px; border-radius: var(--radius-full); background: var(--surface-4); overflow: hidden; }
.password-strength-fill { height: 100%; border-radius: var(--radius-full); transition: width 0.3s ease, background 0.3s ease; width: 0; }
.strength-0 { width: 0; }
.strength-1 { width: 25%; background: var(--danger); }
.strength-2 { width: 50%; background: var(--warning); }
.strength-3 { width: 75%; background: var(--info); }
.strength-4 { width: 100%; background: var(--success); }
.password-strength-text { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }

/* Tabs (horizontal, inside panels) */
.htabs { display: flex; gap: 0.25rem; background: var(--surface-2); padding: 0.25rem; border-radius: var(--radius); margin-bottom: 1.25rem; }
.htab { flex: 1; padding: 0.5rem; text-align: center; font-size: 0.825rem; font-weight: 600; border-radius: var(--radius-sm); border: none; background: none; color: var(--text-muted); cursor: pointer; transition: all var(--transition-fast); font-family: var(--font); }
.htab.active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,0.2); }

/* Copy button */
.copy-btn { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 0.2rem 0.4rem; border-radius: var(--radius-sm); transition: all var(--transition-fast); font-family: var(--font); }
.copy-btn:hover { color: var(--accent); background: var(--accent-dim); }
