/* Clark Dashboard — Dodo Payments inspired design */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Light theme (Dodo-style) */
  --bg: #f7f8fa;
  --bg-alt: #ffffff;
  --card: #ffffff;
  --card-border: #e5e7eb;
  --text: #374151;
  --heading: #111827;
  --muted: #6b7280;
  --soft: #9ca3af;
  --line: #e5e7eb;
  --line-light: #f3f4f6;
  --brand: #4f46e5;
  --brand-light: #eef2ff;
  --brand-bg: rgba(79, 70, 229, 0.08);
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --sidebar-bg: #ffffff;
  --sidebar-hover: #f9fafb;
  --sidebar-active-bg: #eef2ff;
  --sidebar-active-text: #4f46e5;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
  --bg: #0f1117;
  --bg-alt: #1a1b23;
  --card: #1e1f2b;
  --card-border: #2d2e3a;
  --text: #d1d5db;
  --heading: #f3f4f6;
  --muted: #9ca3af;
  --soft: #6b7280;
  --line: #2d2e3a;
  --line-light: #252631;
  --brand: #818cf8;
  --brand-light: rgba(129,140,248,0.1);
  --brand-bg: rgba(129,140,248,0.08);
  --sidebar-bg: #1a1b23;
  --sidebar-hover: #252631;
  --sidebar-active-bg: rgba(129,140,248,0.1);
  --sidebar-active-text: #818cf8;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

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

/* ═══ Sidebar — Dodo style ═══ */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  padding: 0;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.sidebar-logo img { width: 28px; height: 28px; }
.sidebar-logo span { font-weight: 800; font-size: 17px; color: var(--heading); letter-spacing: -0.02em; }

.nav-section {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft);
  padding: 20px 20px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  border-radius: 0;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--heading);
}
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-left-color: var(--brand);
  font-weight: 600;
}
.nav-item .nav-icon {
  width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-item .nav-icon svg { display: block; }

/* ═══ Main content ═══ */
.main {
  flex: 1;
  margin-left: 240px;
  padding: 28px 40px;
  max-width: 1200px;
}

/* ═══ Auth screen ═══ */
.auth-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; background: var(--bg); }
.auth-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.auth-card h2 { font-size: 22px; font-weight: 800; color: var(--heading); margin-bottom: 8px; letter-spacing: -0.02em; }
.auth-card p { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.auth-input {
  width: 100%;
  padding: 11px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--heading);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s;
}
.auth-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }
.auth-input::placeholder { color: var(--soft); }

/* ═══ Page header ═══ */
.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--heading);
  margin-bottom: 4px;
  letter-spacing: -0.03em;
}
.page-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
}

/* ═══ Cards — Dodo style ═══ */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.01em;
}

/* ═══ Stats grid ═══ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}
.stat-card.brand .stat-value { color: var(--brand); }
.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.success .stat-value { color: var(--success); }

/* ═══ Table ═══ */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--soft);
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--line-light);
}
.table td { padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--line-light); }
.table tr:hover td { background: var(--sidebar-hover); }

/* ═══ Badge ═══ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-brand { background: var(--brand-light); color: var(--brand); }
.badge-success { background: rgba(16,185,129,0.1); color: var(--success); }
.badge-accent { background: rgba(245,158,11,0.1); color: var(--accent); }
.badge-danger { background: rgba(239,68,68,0.1); color: var(--danger); }

/* ═══ Progress bar ═══ */
.progress-wrap { background: var(--line-light); border-radius: var(--radius-sm); height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--radius-sm); transition: width 0.5s ease; background: var(--brand); }

/* ═══ Buttons — Dodo style ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: 'Inter', sans-serif;
  text-decoration: none;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(79,70,229,0.25); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }

/* ═══ Info rows ═══ */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-light);
  font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--muted); font-weight: 500; }
.info-value { color: var(--heading); font-weight: 600; }

/* ═══ Tab content ═══ */
.tab-page { display: none; }
.tab-page.active { display: block; }

/* ═══ List items — Dodo style ═══ */
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-light);
  transition: background 0.15s;
  cursor: default;
}
.list-item:hover { background: var(--sidebar-hover); }
.list-item:last-child { border-bottom: none; }
.list-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.list-body { flex: 1; min-width: 0; }
.list-title { font-size: 14px; font-weight: 600; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-meta { font-size: 12px; color: var(--soft); margin-top: 2px; }

/* ═══ Empty state ═══ */
.empty-state { text-align: center; padding: 48px 20px; color: var(--soft); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; display: block; }

/* ═══ User bar (sidebar bottom) ═══ */
.user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  margin-top: auto;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--sidebar-bg);
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
}
.user-info { flex: 1; }
.user-name { font-size: 13px; font-weight: 700; color: var(--heading); }
.user-role { font-size: 11px; color: var(--muted); }

/* ═══ Toggle switch (Dodo style) ═══ */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
  outline: none;
}
.toggle-switch:checked { background: var(--brand); }
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-switch:checked::after { transform: translateX(20px); }

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px; }
  .mobile-nav { display: flex !important; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--sidebar-bg);
  border-top: 1px solid var(--line);
  z-index: 50;
  padding: 6px 0;
}
.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  font-size: 10px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s;
}
.mobile-nav-item.active { color: var(--brand); }
.mobile-nav-item .mnav-icon { display: flex; align-items: center; justify-content: center; }
.mobile-nav-item .mnav-icon svg { display: block; }

/* ═══ Sub-tabs (horizontal, Dodo style) ═══ */
.sub-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.sub-tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.sub-tab:hover { color: var(--heading); }
.sub-tab.active {
  color: var(--heading);
  font-weight: 600;
  border-bottom-color: var(--brand);
}

/* ═══ Settings row (Dodo style — toggle with description) ═══ */
.setting-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--line-light);
}
.setting-row:last-child { border-bottom: none; }
.setting-info { flex: 1; margin-right: 24px; }
.setting-title { font-size: 14px; font-weight: 600; color: var(--heading); margin-bottom: 4px; }
.setting-desc { font-size: 13px; color: var(--muted); line-height: 1.5; }