/* =========================================================================
   dockpay-4party admin - minimal custom styles
   - dark sidebar, light content
   - layout: fixed 240px sidebar + flex topbar + scrollable main
   ========================================================================= */

:root {
  --sidebar-bg: #0f172a;
  --sidebar-fg: #cbd5e1;
  --sidebar-fg-active: #ffffff;
  --sidebar-hover: #1e293b;
  --sidebar-active-bg: #4f46e5;
  --content-bg: #f8fafc;
  --topbar-bg: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--content-bg);
}

/* --------------------- LOGIN PAGE --------------------- */
body.login-page {
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}
.login-card .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.login-card .brand img { width: 44px; height: 44px; }
.login-card .brand-text h1 { font-size: 1.25rem; margin: 0; font-weight: 700; }
.login-card .brand-text small { color: var(--muted); }

/* --------------------- APP LAYOUT --------------------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar .brand img { width: 32px; height: 32px; }
.sidebar .brand span { color: #fff; font-weight: 700; font-size: 1.05rem; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 1rem 0; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1.25rem;
  color: var(--sidebar-fg);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}
.sidebar nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar nav a.active {
  background: var(--sidebar-hover);
  color: var(--sidebar-fg-active);
  border-left-color: var(--sidebar-active-bg);
}
.sidebar nav a .badge { margin-left: auto; }
.sidebar .role-tag {
  padding: 0.75rem 1.25rem;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid rgba(255,255,255,0.08);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sidebar .role-tag b { color: #fff; display: block; font-size: 0.95rem; text-transform: none; letter-spacing: 0; }

.main {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 500;
}
.topbar h2 { font-size: 1.05rem; font-weight: 600; margin: 0; }
.topbar .topbar-spacer { flex: 1; }
.topbar .user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.topbar .user-chip .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.8rem;
}
.content {
  padding: 1.5rem;
  flex: 1;
}

/* --------------------- COMMON UI --------------------- */
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  height: 100%;
}
.stat-card .label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; margin: 0.25rem 0 0; }
.stat-card .delta { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }
.stat-card.primary { border-left: 4px solid var(--primary); }
.stat-card.success { border-left: 4px solid var(--success); }
.stat-card.warning { border-left: 4px solid var(--warning); }
.stat-card.danger  { border-left: 4px solid var(--danger); }
.stat-card.info    { border-left: 4px solid var(--info); }

.card-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}
.card-panel h5 { font-size: 1rem; font-weight: 600; margin: 0 0 1rem; }

.table-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.table-card .table-toolbar {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
}
.table-card .table-toolbar .form-control,
.table-card .table-toolbar .form-select { max-width: 200px; }
.table-card table { margin: 0; }
.table-card table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.table-card table td { vertical-align: middle; font-size: 0.88rem; }

.status-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-pill.pending   { background: #fef3c7; color: #92400e; }
.status-pill.paid      { background: #d1fae5; color: #065f46; }
.status-pill.failed    { background: #fee2e2; color: #991b1b; }
.status-pill.cancelled { background: #e5e7eb; color: #374151; }
.status-pill.active    { background: #d1fae5; color: #065f46; }
.status-pill.disabled  { background: #fee2e2; color: #991b1b; }
.status-pill.approved  { background: #d1fae5; color: #065f46; }
.status-pill.rejected  { background: #fee2e2; color: #991b1b; }
.status-pill.processing { background: #dbeafe; color: #1e40af; }

.kyc-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kyc-pill.pending  { background: #fef3c7; color: #92400e; }
.kyc-pill.approved { background: #d1fae5; color: #065f46; }
.kyc-pill.rejected { background: #fee2e2; color: #991b1b; }

/* pie chart */
.pie-wrap { display: flex; align-items: center; gap: 1.5rem; }
.pie-chart {
  width: 160px; height: 160px;
  border-radius: 50%;
  background: conic-gradient(
    var(--c0, #4f46e5) 0 var(--p0, 0%),
    var(--c1, #06b6d4) var(--p0, 0%) var(--p1, 0%),
    var(--c2, #10b981) var(--p1, 0%) var(--p2, 0%),
    var(--c3, #f59e0b) var(--p2, 0%) var(--p3, 0%),
    var(--c4, #ef4444) var(--p3, 0%) var(--p4, 0%),
    var(--c5, #8b5cf6) var(--p4, 0%) var(--p5, 0%),
    #e5e7eb var(--p5, 0%) 100%
  );
  flex-shrink: 0;
}
.pie-legend { flex: 1; }
.pie-legend .item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; padding: 0.2rem 0; }
.pie-legend .swatch { width: 12px; height: 12px; border-radius: 2px; }
.pie-legend .item .val { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }

/* empty / loading */
.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 0.5rem; opacity: 0.4; }

/* toast */
.toast-container { z-index: 9999; }
.toast { min-width: 280px; }

/* responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: inline-flex !important; }
}
.menu-btn { display: none; }

/* x-cloak - prevent Alpine flicker */
[x-cloak] { display: none !important; }
