/* Wiremi CRM — Premium Dark Design System v3 */

:root {
  /* Backgrounds — deeper layering with blue-shifted darks */
  --bg-base: #030305;
  --bg-primary: #080810;
  --bg-secondary: #0c0c18;
  --bg-card: rgba(14, 14, 24, 0.85);
  --bg-card-solid: #0e0e1a;
  --bg-card-hover: rgba(22, 22, 38, 0.92);
  --bg-input: rgba(12, 12, 22, 0.95);
  --bg-muted: #141428;
  --bg-elevated: rgba(18, 18, 32, 0.97);
  --bg-tertiary: #1a1a2e;
  --bg-surface: rgba(255,255,255,0.02);

  /* Borders */
  --border: rgba(255,255,255,0.07);
  --border-light: rgba(255,255,255,0.12);
  --border-accent: rgba(16,185,129,0.25);
  --border-subtle: rgba(255,255,255,0.04);

  /* Text — better hierarchy */
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0bc;
  --text-muted: #64648a;
  --text-bright: #ffffff;
  --text-dim: #4a4a68;

  /* Accent palette */
  --accent: #10b981;
  --accent-hover: #0ea472;
  --accent-glow: rgba(16,185,129,0.12);
  --accent-subtle: rgba(16,185,129,0.06);
  --accent-blue: #6366f1;
  --accent-blue-glow: rgba(99,102,241,0.12);
  --accent-purple: #a855f7;
  --accent-purple-glow: rgba(168,85,247,0.12);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245,158,11,0.12);
  --accent-red: #ef4444;
  --accent-red-glow: rgba(239,68,68,0.12);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6,182,212,0.12);
  --accent-pink: #ec4899;

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 68px;
  --topbar-height: 64px;

  /* Radii */
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* Shadows — deeper, more sophisticated */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow: 0 2px 8px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-xl: 0 16px 64px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 24px rgba(16,185,129,0.08);
  --shadow-inset: inset 0 1px 2px rgba(0,0,0,0.3);

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

::selection { background: var(--accent); color: #fff; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ===== SCREENS ===== */
.screen { width: 100%; height: 100vh; }

/* ===== LOGIN ===== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}
.login-screen::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16,185,129,0.08) 0%, transparent 70%);
  top: -200px; right: -100px;
  pointer-events: none;
}
.login-screen::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.06) 0%, transparent 70%);
  bottom: -200px; left: -100px;
  pointer-events: none;
}
.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg), 0 0 80px rgba(16,185,129,0.03);
  position: relative;
  z-index: 1;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}
.login-logo h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.login-subtitle { color: var(--text-muted); margin-bottom: 36px; font-size: 14px; }

.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input::placeholder { color: var(--text-muted); }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235c5c7a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.error-text { color: var(--accent-red); font-size: 13px; margin-top: 12px; text-align: center; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0d9668);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #12c98e, var(--accent));
  box-shadow: 0 4px 16px rgba(16,185,129,0.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary { background: var(--bg-muted); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-light); }
.btn-danger {
  background: linear-gradient(135deg, var(--accent-red), #dc2626);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239,68,68,0.2);
}
.btn-danger:hover { box-shadow: 0 4px 16px rgba(239,68,68,0.3); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-muted); color: var(--text-primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-outline:hover { background: var(--accent-glow); }

/* ===== APP LAYOUT ===== */
#app-shell { display: flex; }

/* ===== SIDEBAR ===== */
#sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
  transition: width var(--transition-slow);
  overflow: hidden;
}
#sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  min-height: 60px;
}
.sidebar-logo span {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
#sidebar.collapsed .sidebar-logo span { display: none; }

.sidebar-nav {
  flex: 1;
  padding: 8px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section {
  padding: 16px 12px 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}
#sidebar.collapsed .nav-section { visibility: hidden; height: 12px; padding: 6px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  margin-bottom: 1px;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}
.nav-item.active {
  background: linear-gradient(90deg, var(--accent-glow), transparent);
  color: var(--accent);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-item svg { flex-shrink: 0; width: 18px; height: 18px; opacity: 0.7; }
.nav-item:hover svg, .nav-item.active svg { opacity: 1; }
.nav-item span { font-size: 13px; font-weight: 500; }
#sidebar.collapsed .nav-item span { display: none; }
#sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
#sidebar.collapsed .nav-item::before { display: none; }

.sidebar-toggle {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}
.sidebar-toggle button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
  transition: all var(--transition);
}
.sidebar-toggle button:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-slow), width var(--transition-slow);
  background: var(--bg-primary);
}
#sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed);
  width: calc(100% - var(--sidebar-collapsed));
}

/* ===== TOPBAR ===== */
#topbar {
  height: var(--topbar-height);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(14, 14, 20, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-left h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 6px 10px 6px 6px;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.topbar-user:hover { background: rgba(255,255,255,0.04); }
.topbar-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #0d9668);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
}

/* ===== PAGE CONTAINER ===== */
#page-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

/* ===== STAT CARDS ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--card-accent, var(--accent));
  opacity: 0;
  transition: opacity var(--transition);
}
.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.stat-card:hover::before { opacity: 1; }

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.stat-card-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-card-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-card-icon svg { width: 20px; height: 20px; }
.stat-card-value {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
/* Gradient overlay on stat cards */
.stat-card::after {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, var(--card-accent, var(--accent)), transparent 70%);
  opacity: 0.06;
  pointer-events: none;
  transition: opacity var(--transition);
}
.stat-card:hover::after { opacity: 0.1; }
.stat-card-trend { font-size: 12px; color: var(--text-muted); }
.stat-card-trend.up { color: var(--accent); }
.stat-card-trend.down { color: var(--accent-red); }

/* ===== CARDS / PANELS ===== */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-light); }
.card-flush { padding: 0; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-subtitle { font-size: 12px; color: var(--text-muted); }
.card-body { padding: 4px 0; }
.chart-container { position: relative; height: 280px; width: 100%; }
.card-body canvas { width: 100% !important; max-height: 280px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ===== DATA TABLE ===== */
.table-container {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.table-toolbar-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.table-toolbar-right { display: flex; align-items: center; gap: 8px; }

.table-search {
  padding: 8px 14px 8px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  width: 280px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235c5c7a' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}
.table-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  width: 320px;
}

table { width: 100%; border-collapse: collapse; }

thead th {
  padding: 12px 18px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,15,0.5);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color var(--transition);
}
thead th:hover { color: var(--text-secondary); }
thead th.sorted { color: var(--accent); }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
  cursor: pointer;
}
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody tr:last-child { border-bottom: none; }

td {
  padding: 13px 18px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
td:first-child { color: var(--text-primary); font-weight: 500; }

.table-empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--text-muted);
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.table-pagination-controls { display: flex; align-items: center; gap: 4px; }

.page-btn {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}
.page-btn:hover { background: rgba(255,255,255,0.04); border-color: var(--border-light); color: var(--text-primary); }
.page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(16,185,129,0.25);
}
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  gap: 5px;
}
.badge-success { background: var(--accent-glow); color: var(--accent); }
.badge-warning { background: var(--accent-amber-glow); color: var(--accent-amber); }
.badge-danger { background: var(--accent-red-glow); color: var(--accent-red); }
.badge-info { background: var(--accent-blue-glow); color: var(--accent-blue); }
.badge-purple { background: var(--accent-purple-glow); color: var(--accent-purple); }
.badge-muted { background: rgba(255,255,255,0.05); color: var(--text-muted); }

/* Pulsing dot for live badges */
.badge-live::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  width: fit-content;
}
.tab {
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  font-family: inherit;
}
.tab:hover { color: var(--text-secondary); }
.tab.active {
  background: var(--bg-card-solid);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ===== MODAL / SLIDE-OVER ===== */
.modal-overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  justify-content: flex-end;
}
.modal-panel {
  width: 620px;
  max-width: 92vw;
  height: 100vh;
  background: var(--bg-card-solid);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -8px 0 40px rgba(0,0,0,0.3);
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: all var(--transition);
  line-height: 1;
}
.modal-close:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.modal-content { flex: 1; overflow-y: auto; padding: 24px; }

/* Detail rows */
.detail-section { margin-bottom: 28px; }
.detail-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); font-size: 13px; }
.detail-value { color: var(--text-primary); font-size: 13px; font-weight: 500; text-align: right; }

/* ===== FILTERS ===== */
.filters-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-select, .filter-date {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: all var(--transition);
}
.filter-select:focus, .filter-date:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ===== TABS ===== */
.tab-btn {
  padding: 8px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  padding: 12px 20px;
  background: var(--bg-elevated);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-color: rgba(239,68,68,0.4); }
.toast.success { border-color: rgba(16,185,129,0.4); }

/* ===== LOADING ===== */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.03) 25%,
    rgba(255,255,255,0.06) 50%,
    rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.spinner {
  width: 22px; height: 22px;
  border: 2px solid rgba(255,255,255,0.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-12px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 400px;
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #06b6d4);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state svg { margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ===== SPARKLINE (inside stat cards) ===== */
.stat-sparkline {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 40px;
  opacity: 0.35;
  pointer-events: none;
}
.stat-sparkline canvas { width: 100% !important; height: 40px !important; }

/* ===== METRIC CARDS (dashboard money flow) ===== */
.metric-card {
  padding: 18px 20px;
  background: var(--bg-muted);
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--card-accent, var(--accent));
  transition: all var(--transition);
}
.metric-card:hover { background: var(--bg-card-hover); transform: translateY(-1px); }
.metric-card-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.metric-card-value { font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.metric-card-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== PROFILE HEADER (user detail) ===== */
.profile-header { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 24px; }
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #059669);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; color: white; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(16,185,129,0.2);
}
.profile-info { flex: 1; min-width: 200px; }
.profile-name { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.profile-email { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.profile-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.profile-stats { display: flex; gap: 12px; flex-wrap: wrap; }

/* Mini stat boxes */
.mini-stat {
  text-align: center;
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  min-width: 90px;
}
.mini-stat-value { font-size: 16px; font-weight: 700; }
.mini-stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Action button bar */
.action-bar {
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.action-divider { width: 1px; height: 24px; background: var(--border); }

/* ===== WALLET / CARD GRID ITEMS ===== */
.wallet-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--border-subtle);
  transition: all var(--transition);
}
.wallet-card:hover { border-color: var(--border-light); background: var(--bg-card-hover); }

/* ===== SORT INDICATORS ===== */
thead th.sortable { cursor: pointer; user-select: none; position: relative; }
thead th.sortable::after {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  margin-left: 6px;
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 4px solid var(--text-dim);
  opacity: 0.4;
}
thead th.sorted-asc::after { border-bottom: 4px solid var(--accent); opacity: 1; }
thead th.sorted-desc::after { border-bottom: none; border-top: 4px solid var(--accent); opacity: 1; }

/* ===== BULK SELECTION ===== */
.table-checkbox { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; padding: 0; }
.bulk-actions {
  display: none; align-items: center; gap: 10px;
  padding: 10px 20px;
  background: var(--accent-subtle);
  border-bottom: 1px solid var(--border-accent);
}
.bulk-actions.visible { display: flex; }
.bulk-count { font-size: 13px; font-weight: 600; color: var(--accent); }

/* ===== GLOBAL SEARCH DROPDOWN ===== */
.global-search-input {
  width: 220px; padding: 8px 12px 8px 32px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: 13px; font-family: inherit; outline: none;
  transition: width 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.global-search-input:focus { width: 300px; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 6px;
  width: 420px; max-height: 400px; overflow-y: auto;
  background: var(--bg-card-solid); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); z-index: 100;
}
.search-section-label {
  padding: 10px 16px 6px; font-size: 10px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em;
}
.search-section-label + .search-section-label { border-top: 1px solid var(--border); }
.search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; color: var(--text-primary);
  cursor: pointer; text-decoration: none;
  transition: background var(--transition);
}
.search-result-item:hover { background: var(--bg-card-hover); }
.search-result-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: white; font-weight: 600; flex-shrink: 0;
}
.search-result-info { flex: 1; min-width: 0; }
.search-result-name { font-size: 13px; font-weight: 500; }
.search-result-sub { font-size: 11px; color: var(--text-muted); }

/* ===== DATE RANGE GROUP ===== */
.date-range-group {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2px 4px;
}
.date-range-group input[type="date"] {
  border: none; background: transparent;
  padding: 6px 8px; font-size: 12px; width: auto; min-width: 120px;
}
.date-range-group input[type="date"]:focus { box-shadow: none; border: none; }
.date-range-sep { color: var(--text-muted); font-size: 12px; padding: 0 2px; }

/* ===== NOTES COMPONENT ===== */
.note-item {
  margin-bottom: 8px; padding: 10px 12px;
  background: var(--bg-muted); border-radius: var(--radius);
  border-left: 3px solid var(--accent-purple);
}
.note-meta { display: flex; justify-content: space-between; margin-bottom: 4px; }
.note-author { font-size: 11px; font-weight: 600; color: var(--accent-purple); }
.note-time { font-size: 11px; color: var(--text-muted); }
.note-text { font-size: 12px; color: var(--text-secondary); margin: 0; line-height: 1.5; }

/* ===== TIER / CURRENCY BADGES ===== */
.tier-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-tertiary); border-radius: var(--radius); padding: 8px 14px;
}
.tier-badge-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tier-badge-label { font-size: 12px; color: var(--text-muted); }
.tier-badge-value { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-left: auto; }

.currency-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; background: var(--bg-muted);
  border-radius: var(--radius); font-size: 13px;
  border: 1px solid var(--border-subtle);
}
.currency-chip strong { color: var(--text-primary); }

/* ===== CONFIRMATION DIALOG ===== */
.confirm-modal { text-align: center; padding: 16px 0; }
.confirm-icon {
  width: 56px; height: 56px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px; font-size: 28px;
}
.confirm-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.confirm-desc { font-size: 13px; color: var(--text-muted); }
.confirm-actions { display: flex; gap: 10px; justify-content: center; margin-top: 24px; }

/* ===== PAGE SIZE SELECTOR ===== */
.page-size-select {
  padding: 4px 8px; font-size: 12px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-secondary);
  cursor: pointer; font-family: inherit;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  #sidebar { width: var(--sidebar-collapsed); }
  #sidebar .nav-item span, #sidebar .sidebar-logo span, #sidebar .nav-section { display: none; }
  .main-content {
    margin-left: var(--sidebar-collapsed);
    width: calc(100% - var(--sidebar-collapsed));
  }
  .stats-row { grid-template-columns: 1fr; }
  .modal-panel { width: 100vw; }
  #page-container { padding: 16px; }
  .table-search { width: 180px; }
  .table-search:focus { width: 220px; }
}
