/* ==========================================================================
   Components
   ========================================================================== */

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 10px var(--sp-5);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-weight: 600; font-size: var(--fs-sm);
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:hover { text-decoration: none; }
.btn-sm { padding: 7px var(--sp-3); font-size: var(--fs-xs); }

.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-strong); box-shadow: var(--shadow-md); }

.btn-accent { background: var(--accent); color: #241a02; }
.btn-accent:hover { background: var(--accent-strong); }

.btn-secondary { background: var(--surface-2); color: var(--text-primary); border-color: var(--border-soft); }
.btn-secondary:hover { background: var(--border-soft); }

.btn-outline { background: transparent; color: var(--brand-strong); border-color: var(--brand); }
.btn-outline:hover { background: var(--brand-soft); }

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

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

.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 50%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-block { width: 100%; }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-med) var(--ease), transform var(--dur-med) var(--ease);
}
.card--hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.card--glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}

/* Stat / KPI card */
.stat-card { display: flex; flex-direction: column; gap: var(--sp-2); }
.stat-card__top { display: flex; align-items: center; justify-content: space-between; }
.stat-card__icon {
  width: 40px; height: 40px; border-radius: var(--r-md);
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-strong);
}
.stat-card__icon svg { width: 20px; height: 20px; }
.stat-card__label { font-size: var(--fs-sm); color: var(--text-muted); font-weight: 500; }
.stat-card__value { font-family: var(--font-mono); font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.02em; }
.stat-card__delta { font-size: var(--fs-xs); font-weight: 650; display: inline-flex; align-items: center; gap: 4px; width: fit-content; padding: 2px 8px; border-radius: var(--r-pill); }
.stat-card__delta.up { color: var(--success); background: var(--success-soft); }
.stat-card__delta.down { color: var(--danger); background: var(--danger-soft); }

/* Wallet balance card — receipt-stub signature */
.wallet-card {
  position: relative;
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  color: #fff;
  background: linear-gradient(135deg, var(--naira-700) 0%, var(--naira-600) 55%, var(--indigo-600) 130%);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.wallet-card::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 85% -10%, rgba(255,255,255,.18), transparent 55%);
}
.wallet-card .label { font-size: var(--fs-xs); opacity: .85; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.wallet-card .balance { font-family: var(--font-mono); font-size: var(--fs-3xl); font-weight: 700; margin: var(--sp-2) 0; }
.wallet-card .meta { display: flex; gap: var(--sp-6); position: relative; z-index: 1; }
.wallet-card .meta div span { display: block; }
.wallet-card .meta .k { font-size: 11px; opacity: .75; }
.wallet-card .meta .v { font-family: var(--font-mono); font-weight: 650; }
.wallet-layout{
    display:grid;
    grid-template-columns:1.1fr 1fr;
    gap:var(--sp-5);
}

@media (max-width:768px){

    .wallet-layout{
        grid-template-columns:1fr;
    }

}

/* ---- Badges / status pills ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 650; letter-spacing: .02em;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-info    { background: var(--link-soft); color: var(--link); }
.badge-neutral { background: var(--surface-2); color: var(--text-secondary); }

/* ---- Table ---- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.table-toolbar__search {
  display: flex; align-items: center; gap: var(--sp-2);
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); padding: 8px 12px; min-width: 240px;
}
.table-toolbar__search input { background: transparent; border: 0; outline: none; width: 100%; }
.table-toolbar__search svg { width: 15px; height: 15px; color: var(--text-muted); flex: none; }
.table-toolbar__filters { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.select {
  padding: 8px 30px 8px 12px; border-radius: var(--r-md);
  border: 1px solid var(--border-soft); background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238993AC'/%3E%3C/svg%3E") no-repeat right 12px center;
  appearance: none; -webkit-appearance: none; font-size: var(--fs-xs); color: var(--text-primary); font-weight: 500;
}

.t9-table { width: 100%; border-collapse: collapse; }
.t9-table thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); font-weight: 700;
  padding: var(--sp-3) var(--sp-5); border-bottom: 1px solid var(--border-soft);
  background: var(--bg-subtle);
  white-space: nowrap;
  user-select: none;
}
.t9-table th.sortable { cursor: pointer; }
.t9-table th.sortable .arrow { display: inline-block; margin-left: 4px; opacity: .4; }
.t9-table th.sorted .arrow { opacity: 1; color: var(--brand); }
.t9-table td { padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border-soft); font-size: var(--fs-sm); vertical-align: middle; }
.t9-table tbody tr { transition: background var(--dur-fast) var(--ease); }
.t9-table tbody tr:hover { background: var(--bg-subtle); }
.t9-table tbody tr:last-child td { border-bottom: none; }
.t9-table td.num { text-align: right; }
.t9-table .cell-primary { font-weight: 600; color: var(--text-primary); }
.t9-table .cell-secondary { font-size: 12px; color: var(--text-muted); }

.row-actions { display: flex; gap: var(--sp-1); justify-content: flex-end; }

/* ---- Pagination ---- */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5); flex-wrap: wrap; gap: var(--sp-3);
}
.pagination__pages { display: flex; gap: 4px; }
.page-btn {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 600;
  color: var(--text-secondary); border: 1px solid transparent;
}
.page-btn:hover { background: var(--surface-2); }
.page-btn.active { background: var(--brand); color: #fff; }
.page-btn[disabled] { opacity: .4; pointer-events: none; }

/* ---- Forms ---- */
.field { margin-bottom: var(--sp-4); }
.field label { display: block; font-size: var(--fs-xs); font-weight: 650; margin-bottom: 6px; color: var(--text-secondary); }
.input, .select, textarea.input {
  width: 100%; padding: 11px var(--sp-4);
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); color: var(--text-primary); outline: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.input-group { position: relative; }
.input-group .input { padding-left: 40px; }
.input-group svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); }
.field-hint { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.field-error { font-size: 11px; color: var(--danger); margin-top: 5px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--text-secondary); }
.checkbox-row input { accent-color: var(--brand); width: 16px; height: 16px; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(11, 17, 32, .5);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: var(--sp-4);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-med) var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto;
  transform: translateY(16px) scale(.98); opacity: 0;
  transition: transform var(--dur-med) var(--ease), opacity var(--dur-med) var(--ease);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); opacity: 1; }
.modal--lg { max-width: 640px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-5); border-bottom: 1px solid var(--border-soft); }
.modal__body { padding: var(--sp-5); }
.modal__foot { display: flex; justify-content: flex-end; gap: var(--sp-3); padding: var(--sp-5); border-top: 1px solid var(--border-soft); }
.modal--confirm .modal__icon {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin-bottom: var(--sp-4);
}

/* ---- Toasts ---- */
.toast-stack {
  position: fixed; top: var(--sp-5); right: var(--sp-5); z-index: 200;
  display: flex; flex-direction: column; gap: var(--sp-2); width: min(360px, 90vw);
}
.toast {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  background: var(--surface); border: 1px solid var(--border-soft);
  border-left: 4px solid var(--brand);
  border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-md);
  animation: toast-in var(--dur-med) var(--ease);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast .icon { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.toast .title { font-weight: 650; font-size: var(--fs-sm); }
.toast .msg { font-size: 12.5px; color: var(--text-muted); }
.toast .close { margin-left: auto; color: var(--text-muted); flex: none; }
.toast.leaving { animation: toast-out var(--dur-fast) var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }

/* ---- Skeleton loaders ---- */
.skeleton {
  position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-sm);
}
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: shimmer 1.4s infinite;
}
[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-line { height: 12px; margin-bottom: 8px; border-radius: 4px; }
.sk-title { height: 20px; width: 40%; margin-bottom: var(--sp-3); }
.sk-row { height: 44px; margin-bottom: 6px; border-radius: var(--r-sm); }
.sk-card { height: 110px; border-radius: var(--r-lg); }
.sk-avatar { width: 40px; height: 40px; border-radius: 50%; }

/* ---- Empty states ---- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: var(--sp-9) var(--sp-5);
}
.empty-state__icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--surface-2); display: grid; place-items: center; margin-bottom: var(--sp-4);
  color: var(--text-muted);
}
.empty-state__icon svg { width: 28px; height: 28px; }
.empty-state h4 { margin-bottom: 4px; }
.empty-state p { max-width: 320px; margin-bottom: var(--sp-4); }

/* ---- Tabs ---- */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border-soft); margin-bottom: var(--sp-5); }
.tab { padding: 10px var(--sp-4); font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--brand-strong); border-color: var(--brand); }

/* ---- Dropdown menu ---- */
.dropdown { position: relative; }
.dropdown__menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); box-shadow: var(--shadow-md);
  min-width: 200px; padding: 6px; z-index: 60;
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: all var(--dur-fast) var(--ease);
}
.dropdown.open .dropdown__menu { opacity: 1; transform: translateY(0); pointer-events: auto; }
.dropdown__item {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 9px 10px; border-radius: var(--r-sm); font-size: var(--fs-sm); color: var(--text-secondary);
}
.dropdown__item:hover { background: var(--surface-2); color: var(--text-primary); }
.dropdown__item svg { width: 16px; height: 16px; }
.dropdown__divider { height: 1px; background: var(--border-soft); margin: 6px 0; }

/* ---- Theme toggle ---- */
.theme-toggle {
  width: 44px; height: 26px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--border-soft);
  position: relative; flex: none;
}
.theme-toggle .knob {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand); transition: transform var(--dur-med) var(--ease);
  display: grid; place-items: center; color: #fff;
}
.theme-toggle .knob svg { width: 12px; height: 12px; }
[data-theme="dark"] .theme-toggle .knob { transform: translateX(18px); }
