/* =========================================================
   Fasset — Components
   ========================================================= */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-md);
  font-size: 13.5px; font-weight: 700;
  border: 1px solid transparent;
  transition: all var(--transition);
  position: relative; overflow: hidden;
  white-space: nowrap;
}
.btn i { font-size: 12.5px; }
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--brand-900); color: #fff; box-shadow: 0 1px 2px rgba(6,32,24,0.08), 0 4px 10px rgba(6,32,24,0.16); }
.btn-primary:hover { background: var(--brand-800); transform: translateY(-1px); box-shadow: 0 1px 2px rgba(6,32,24,0.1), 0 8px 18px rgba(6,32,24,0.2); }

.btn-secondary { background: var(--surface); color: var(--text-primary); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-muted); transform: translateY(-1px); }

.btn-outline { background: transparent; color: var(--brand-700); border-color: var(--brand-300); }
.btn-outline:hover { background: var(--brand-50); border-color: var(--brand-500); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--neutral-bg); color: var(--text-primary); }

.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #fddedb; }

.btn-sm { padding: 7px 14px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 26px; font-size: 14.5px; border-radius: var(--radius-md); }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--radius-md); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Ripple */
.btn .ripple { position: absolute; border-radius: 50%; transform: scale(0); animation: rippleAnim 0.6s var(--ease); background: rgba(255,255,255,0.5); pointer-events: none; }
.btn-secondary .ripple, .btn-outline .ripple, .btn-ghost .ripple { background: rgba(0,179,120,0.18); }
@keyframes rippleAnim { to { transform: scale(3); opacity: 0; } }

.fab {
  position: fixed; bottom: 28px; right: 28px; z-index: 45;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--gradient-brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-brand); font-size: 20px;
  transition: all var(--transition);
}
.fab:hover { transform: scale(1.06) translateY(-2px); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.card.hoverable:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--surface); }
.card-body { padding: 24px; }
.card-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card-header h3 { font-size: 15.5px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); }

.card-pad-lg .card-body { padding: 32px; }

/* ---------- Stat Cards ---------- */
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px 24px; box-shadow: var(--shadow-xs); transition: all var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--surface); }
.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.stat-card .stat-icon {
  width: 42px; height: 42px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
  background: var(--brand-50); color: var(--brand-600); font-size: 16px;
}
.stat-card .stat-label { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 27px; font-weight: 800; font-family: 'Manrope', sans-serif; letter-spacing: -0.02em; }

.trend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: var(--radius-pill); }
.trend-up { color: var(--success); background: var(--success-bg); }
.trend-down { color: var(--danger); background: var(--danger-bg); }
.trend-flat { color: var(--text-muted); background: var(--neutral-bg); }

/* ---------- Balance Hero ---------- */
.balance-hero {
  background: var(--gradient-brand);
  border-radius: var(--radius-xl);
  padding: 40px 40px 42px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(6,32,24,0.25);
}
.balance-hero::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 85% -10%, rgba(255,255,255,0.18), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(23,212,148,0.4), transparent 50%);
}
.balance-hero::after {
  content: ''; position: absolute; width: 260px; height: 260px; border-radius: 50%;
  background: rgba(94,230,184,0.16); filter: blur(10px); top: -120px; right: 8%;
}
.balance-hero .hero-row { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 24px; }
.balance-hero .label { color: rgba(255,255,255,0.68); font-size: 13.5px; font-weight: 600; margin-bottom: 12px; }
.balance-hero .value { font-size: 48px; font-weight: 800; font-family: 'Manrope', sans-serif; letter-spacing: -0.03em; line-height: 1; }
.balance-hero .sub-value { color: rgba(255,255,255,0.72); font-size: 13.5px; margin-top: 12px; }
@media (max-width: 640px) { .balance-hero { padding: 28px 24px 30px; } .balance-hero .value { font-size: 34px; } }
@media (max-width: 400px) { .balance-hero .value { font-size: 28px; } }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 700; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.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-neutral { background: var(--neutral-bg); color: var(--text-secondary); }

/* ---------- Avatars ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--gradient-brand); color: #fff;
  font-weight: 700; font-family: 'Manrope', sans-serif; flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 42px; height: 42px; font-size: 14px; }
.avatar-lg { width: 64px; height: 64px; font-size: 20px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
table.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table thead th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); font-weight: 700; padding: 12px 18px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.data-table thead th:first-child { border-top-left-radius: var(--radius-lg); }
.data-table thead th:last-child { border-top-right-radius: var(--radius-lg); }
.data-table tbody td { padding: 15px 18px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--brand-50); }
.data-table tbody tr:last-child td { border-bottom: none; }
.cell-primary { font-weight: 700; }
.cell-name { display: flex; align-items: center; gap: 10px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-primary); margin-bottom: 7px; }
.form-label .optional { color: var(--text-muted); font-weight: 500; }
.form-control, select.form-control {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 13.5px; color: var(--text-primary); transition: all var(--transition);
}
.form-control:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 4px var(--brand-100); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.input-group { position: relative; }
.input-group .form-control { padding-right: 44px; }
.input-group-icon { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); cursor: pointer; background: none; border: none; }
.input-prefix { position: relative; }
.input-prefix .prefix-text { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-weight: 600; font-size: 13.5px; }
.input-prefix .form-control { padding-left: 40px; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .row-2, .row-3 { grid-template-columns: 1fr; } }

.checkbox-row { display: flex; align-items: center; gap: 9px; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: var(--border-strong); border-radius: 999px; transition: var(--transition); }
.switch .slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: var(--transition); box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.switch input:checked + .slider { background: var(--brand-500); }
.switch input:checked + .slider::before { transform: translateX(18px); }

.select-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 10px; }
.select-card {
  border: 1.5px solid var(--border); border-radius: var(--radius-md); padding: 12px; text-align: center;
  cursor: pointer; transition: all var(--transition); background: var(--surface);
}
.select-card:hover { border-color: var(--brand-300); }
.select-card.selected { border-color: var(--brand-500); background: var(--brand-50); box-shadow: 0 0 0 3px var(--brand-100); }

/* ---------- Steps ---------- */
.steps { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 12.5px; font-weight: 700; }
.step .step-circle { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-strong); display: flex; align-items: center; justify-content: center; font-size: 12px; transition: all var(--transition); }
.step.active { color: var(--brand-700); }
.step.active .step-circle { border-color: var(--brand-500); background: var(--brand-500); color: #fff; }
.step.done .step-circle { border-color: var(--brand-500); background: var(--brand-50); color: var(--brand-500); }
.step-line { flex: 1; height: 2px; background: var(--border-strong); min-width: 24px; }
@media (max-width: 560px) { .step { font-size: 0; gap: 6px; } .step .step-circle { font-size: 12px; } }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; }
.tab-btn { padding: 11px 18px; font-size: 13px; font-weight: 700; color: var(--text-secondary); border-bottom: 2px solid transparent; white-space: nowrap; transition: all var(--transition); }
.tab-btn:hover { color: var(--brand-600); }
.tab-btn.active { color: var(--brand-700); border-bottom-color: var(--brand-500); }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.3s var(--ease); }

/* ---------- Pills / Filters ---------- */
.filter-pill {
  padding: 8px 14px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong);
  font-size: 12.5px; font-weight: 700; color: var(--text-secondary); background: var(--surface); transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
}
.filter-pill:hover { border-color: var(--brand-400); color: var(--brand-700); }
.filter-pill.active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(6,32,24,0.45); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.show { display: flex; animation: fadeIn 0.2s var(--ease); }
.modal {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  animation: modalIn 0.28s var(--ease);
}
.modal.modal-lg { max-width: 680px; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.94) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16.5px; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: all var(--transition); }
.modal-close:hover { background: var(--neutral-bg); color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer { padding: 18px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; top: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); padding: 14px 16px; display: flex; align-items: flex-start; gap: 12px;
  min-width: 300px; max-width: 360px; animation: toastIn 0.35s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
.toast.hide { animation: toastOut 0.3s var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
@media (max-width: 480px) {
  .toast-stack { left: 12px; right: 12px; top: 12px; }
  .toast { min-width: 0; max-width: none; width: 100%; }
}
.toast .toast-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.toast.success .toast-icon { background: var(--success-bg); color: var(--success); }
.toast.error .toast-icon { background: var(--danger-bg); color: var(--danger); }
.toast.info .toast-icon { background: var(--info-bg); color: var(--info); }
.toast .toast-title { font-weight: 700; font-size: 13.5px; }
.toast .toast-msg { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.toast .toast-close { margin-left: auto; color: var(--text-muted); }

/* ---------- Tooltip ---------- */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px);
  background: var(--brand-900); color: #fff; padding: 6px 10px; border-radius: 7px; font-size: 11.5px; font-weight: 600;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: all var(--transition); z-index: 60;
}
[data-tooltip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Copy button ---------- */
.copy-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.copy-field .cf-label { font-size: 11.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 3px; }
.copy-field .cf-value { font-weight: 700; font-size: 14px; font-family: 'Manrope', sans-serif; }
.copy-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); flex-shrink: 0; transition: all var(--transition); }
.copy-btn:hover { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }
.copy-btn.copied { background: var(--success); border-color: var(--success); color: #fff; }

/* ---------- Progress ---------- */
.progress { height: 8px; border-radius: 999px; background: var(--neutral-bg); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: var(--gradient-brand); transition: width 0.6s var(--ease); }

/* ---------- Empty States ---------- */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state .icon { width: 72px; height: 72px; border-radius: 50%; background: var(--brand-50); color: var(--brand-400); display: flex; align-items: center; justify-content: center; font-size: 28px; margin: 0 auto 18px; }
.empty-state h4 { margin-bottom: 6px; }
.empty-state p { color: var(--text-secondary); font-size: 13.5px; max-width: 340px; margin: 0 auto; }

/* ---------- Skeleton ---------- */
.skeleton { background: linear-gradient(90deg, #eef2f0 25%, #f7faf9 37%, #eef2f0 63%); background-size: 800px 100%; animation: shimmer 1.4s linear infinite; border-radius: 8px; }
.sk-text { height: 12px; margin-bottom: 8px; }
.sk-title { height: 20px; width: 60%; margin-bottom: 14px; }
.sk-card { height: 100px; border-radius: var(--radius-lg); }

/* ---------- Loader / Spinner ---------- */
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,0.4); border-top-color: #fff; animation: spin 0.7s linear infinite; }
.spinner-brand { border: 2.5px solid var(--brand-100); border-top-color: var(--brand-500); }
.page-loader { position: fixed; inset: 0; background: var(--bg); z-index: 500; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; }

/* ---------- Chart container ---------- */
.chart-box { position: relative; width: 100%; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 16px; justify-content: center; }
.chart-legend .leg-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-secondary); font-weight: 600; }
.chart-legend .leg-dot { width: 9px; height: 9px; border-radius: 3px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; }
.page-btn { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; color: var(--text-secondary); border: 1px solid var(--border); background: var(--surface); transition: all var(--transition); }
.page-btn:hover { border-color: var(--brand-400); color: var(--brand-700); }
.page-btn.active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

/* ---------- Quick Actions ---------- */
.quick-actions { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
@media (max-width: 992px) { .quick-actions { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .quick-actions { grid-template-columns: repeat(2, 1fr); } }
.quick-action {
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  padding: 18px 10px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--border);
  transition: all var(--transition); cursor: pointer;
}
.quick-action:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--brand-300); }
.quick-action .qa-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--brand-50); color: var(--brand-600); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.quick-action span.label { font-size: 12px; font-weight: 700; color: var(--text-primary); }

/* ---------- Grid helpers ---------- */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media (max-width: 1180px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid-4, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr 1fr; } }

.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title h3 { font-size: 16.5px; }
.section-title .link { font-size: 12.5px; font-weight: 700; color: var(--brand-600); }
.section-title .link:hover { text-decoration: underline; }
