/* =========================================================
   ON SOLUTION TECH — Agency Management System
   Core Design System
   ========================================================= */

:root {
  --primary: #00A1DC;
  --primary-hover: #0089BB;
  --secondary: #04313D;
  --sidebar: #052835;
  --bg: #071A22;
  --card-bg: #0D2A36;
  --accent: #39C4F0;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --purple: #8B5CF6;
  --gold: #F2B33D;
  --text: #FFFFFF;
  --text-secondary: #C7D6DB;
  --text-muted: #94A3B8;
  --border: rgba(0,161,220,0.18);
  --gradient: linear-gradient(135deg, #00A1DC 0%, #0089BB 50%, #39C4F0 100%);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-soft: 0 8px 30px rgba(0,0,0,0.35);
  --shadow-glow: 0 0 0 1px var(--border), 0 12px 40px rgba(0,161,220,0.12);
  --sidebar-w: 272px;
  --sidebar-w-collapsed: 84px;
  --topnav-h: 72px;
  --transition: all .25s cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(circle at 10% 0%, rgba(0,161,220,0.10), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(139,92,246,0.08), transparent 35%);
  background-attachment: fixed;
}

.mono, .metric-value, .data-num { font-family: 'JetBrains Mono', monospace; }

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,161,220,0.35); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ---------- Glass utility ---------- */
.glass {
  background: rgba(13,42,54,0.55);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  z-index: 40;
}
.sidebar.collapsed { width: var(--sidebar-w-collapsed); min-width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-group-title,
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .nav-link { justify-content: center; }

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px; border-bottom: 1px solid var(--border);
  min-height: var(--topnav-h);
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; color: #fff; flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0,161,220,0.4);
}
.brand-text { font-weight: 700; font-size: 15px; letter-spacing: .3px; white-space: nowrap; }
.brand-text small { display: block; font-size: 10.5px; color: var(--text-muted); font-weight: 500; letter-spacing: .5px; }

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 14px 12px 20px; }
.sidebar-group { margin-bottom: 6px; }
.sidebar-group-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-muted); padding: 16px 12px 6px; font-weight: 700;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 13.5px; font-weight: 500;
  transition: var(--transition); position: relative; margin-bottom: 2px;
}
.nav-link svg { flex-shrink: 0; width: 18px; height: 18px; }
.nav-link:hover { background: rgba(0,161,220,0.1); color: var(--text); transform: translateX(2px); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(0,161,220,0.22), rgba(0,161,220,0.02));
  color: var(--accent); font-weight: 700;
  box-shadow: inset 3px 0 0 var(--primary);
}
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
}
.sidebar-toggle {
  margin: 10px 14px 16px; padding: 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); color: var(--text-muted); display: flex;
  align-items: center; justify-content: center; transition: var(--transition);
}
.sidebar-toggle:hover { color: var(--accent); border-color: var(--primary); }

/* ---------- Main / Topnav ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topnav {
  height: var(--topnav-h); position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; border-bottom: 1px solid var(--border);
  background: rgba(7,26,34,0.7); backdrop-filter: blur(16px);
}
.breadcrumb { font-size: 13px; color: var(--text-muted); display: flex; gap: 6px; align-items: center; }
.breadcrumb b { color: var(--text); font-weight: 600; }
.search-box {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 9px 14px; transition: var(--transition);
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,161,220,0.15); }
.search-box input { background: none; border: none; outline: none; color: var(--text); font-size: 13.5px; width: 100%; }
.search-box svg { color: var(--text-muted); flex-shrink: 0; width: 16px; }
kbd { font-size: 10.5px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; }

.topnav-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; color: var(--text-secondary); position: relative; transition: var(--transition);
}
.icon-btn:hover { background: rgba(0,161,220,0.1); color: var(--accent); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--sidebar);
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border); cursor: pointer;
}
.avatar-fallback {
  width: 38px; height: 38px; border-radius: 50%; background: var(--gradient);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; cursor: pointer;
}

/* ---------- Content ---------- */
.content { padding: 24px; max-width: 1600px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.page-head p { color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px;
  border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; transition: var(--transition);
}
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 6px 18px rgba(0,161,220,0.35); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0,161,220,0.45); }
.btn-outline { border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--primary); color: var(--accent); background: rgba(0,161,220,0.08); }
.btn-danger { background: rgba(239,68,68,0.14); color: #FCA5A5; border: 1px solid rgba(239,68,68,0.35); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ---------- Grid / Cards ---------- */
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2,1fr);} }
@media (max-width: 640px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow-glow); transition: var(--transition);
}
.card:hover { border-color: rgba(0,161,220,0.32); transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(0,161,220,0.3), 0 16px 36px rgba(0,0,0,0.28); }

.stat-card { display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.stat-card::before {
  content: ""; position: absolute; top: -30%; right: -20%; width: 120px; height: 120px;
  background: var(--gradient); opacity: .1; border-radius: 50%; filter: blur(14px);
  transition: opacity .25s ease;
}
.stat-card:hover::before { opacity: .18; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px rgba(0,161,220,0.18); }
.stat-icon svg { width: 20px; height: 20px; }
.stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.metric-value { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }

/* ---------- Growth banner ---------- */
.growth-banner {
  display: flex; align-items: flex-start; gap: 14px; padding: 18px 20px;
  border-color: rgba(245,158,11,0.4);
  background: linear-gradient(90deg, rgba(245,158,11,0.12), rgba(239,68,68,0.05));
  animation: growthPulse 2.4s ease infinite;
}
@keyframes growthPulse { 0%,100% { box-shadow: 0 0 0 1px rgba(245,158,11,0.25), 0 10px 30px rgba(0,0,0,0.2); } 50% { box-shadow: 0 0 0 1px rgba(245,158,11,0.5), 0 10px 30px rgba(0,0,0,0.2); } }
.growth-banner-icon {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px;
  background: rgba(245,158,11,0.18); color: var(--warning);
  display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.growth-banner-body b { font-size: 14.5px; color: var(--text); }
.growth-banner-body p { margin-top: 4px; }
.stat-trend { font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

.chart-card { padding: 20px 20px 10px; position: relative; overflow: hidden; }
.chart-card::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--gradient); opacity: .55;
}
.chart-card h3 { font-size: 14.5px; font-weight: 700; margin-bottom: 2px; }
.chart-card .sub { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.chart-wrap { position: relative; height: 280px; }
.chart-wrap.sm { height: 220px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--text-muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
tr:hover td { background: rgba(0,161,220,0.04); }

.badge { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: rgba(34,197,94,0.14); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.14); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.14); color: var(--danger); }
.badge-info { background: rgba(59,130,246,0.14); color: var(--info); }
.badge-muted { background: rgba(148,163,184,0.14); color: var(--text-muted); }

/* ---------- Places grid ---------- */
.places-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.places-region { margin-bottom: 22px; }
.places-region-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; cursor: pointer; user-select: none; }
.places-region-head h4 { font-size: 13.5px; font-weight: 700; }
.places-region-head .chev { transition: var(--transition); color: var(--text-muted); }
.places-region-head.collapsed .chev { transform: rotate(-90deg); }
.places-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.place-card { padding: 16px; border-radius: var(--radius-md); }
.place-pin { width: 34px; height: 34px; border-radius: 10px; background: rgba(0,161,220,0.14); color: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.place-name { font-weight: 700; font-size: 13.5px; margin-bottom: 3px; }
.place-meta { font-size: 11.5px; color: var(--text-muted); }
.place-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }

/* ---------- Skeletons / spinners / states ---------- */
.skeleton { background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.09) 37%, rgba(255,255,255,0.04) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.sk-line { height: 12px; margin-bottom: 8px; border-radius: 6px; }
.sk-card { height: 110px; border-radius: var(--radius-lg); }

.spinner { width: 22px; height: 22px; border: 3px solid rgba(0,161,220,0.2); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 0; }

.empty-state, .error-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state svg, .error-state svg { margin-bottom: 14px; opacity: .5; }
.empty-state h4, .error-state h4 { color: var(--text-secondary); font-size: 14.5px; margin-bottom: 4px; }
.error-state svg { color: var(--danger); }

.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 14px 18px; border-radius: var(--radius-md); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 10px; min-width: 260px; animation: toastIn .3s ease; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast-success { background: rgba(34,197,94,0.16); border: 1px solid rgba(34,197,94,0.4); color: #86EFAC; }
.toast-error { background: rgba(239,68,68,0.16); border: 1px solid rgba(239,68,68,0.4); color: #FCA5A5; }
.toast-info { background: rgba(59,130,246,0.16); border: 1px solid rgba(59,130,246,0.4); color: #93C5FD; }

.success-burst { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 30px; }
.success-circle { width: 62px; height: 62px; border-radius: 50%; background: rgba(34,197,94,0.14); display: flex; align-items: center; justify-content: center; color: var(--success); animation: pop .4s cubic-bezier(.34,1.56,.64,1); }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(3,12,16,0.7); backdrop-filter: blur(4px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 520px; border-radius: var(--radius-lg); padding: 24px; animation: modalIn .25s cubic-bezier(.34,1.56,.64,1); max-height: 88vh; overflow-y: auto; }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal h3 { font-size: 16.5px; font-weight: 800; margin-bottom: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text); font-size: 13.5px; outline: none; transition: var(--transition);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,161,220,0.15); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; position: relative; overflow: hidden; }
.login-orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .35; }
.login-orb.o1 { width: 400px; height: 400px; background: var(--primary); top: -120px; left: -100px; }
.login-orb.o2 { width: 340px; height: 340px; background: var(--purple); bottom: -100px; right: -80px; }
.login-card { width: 100%; max-width: 400px; padding: 36px 32px; border-radius: var(--radius-lg); position: relative; z-index: 2; animation: modalIn .4s cubic-bezier(.34,1.56,.64,1); }
.login-logo { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-logo .brand-mark { width: 54px; height: 54px; font-size: 20px; border-radius: 16px; }
.login-logo h2 { font-size: 18px; font-weight: 800; }
.login-logo span { font-size: 12px; color: var(--text-muted); letter-spacing: .5px; }
.login-error { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.35); color: #FCA5A5; font-size: 12.5px; padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; display: none; }
.login-btn { width: 100%; justify-content: center; padding: 12px; font-size: 14px; margin-top: 6px; }
.login-foot { text-align: center; font-size: 11.5px; color: var(--text-muted); margin-top: 22px; }

/* ---------- Progress bar ---------- */
.progress-track { height: 6px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--gradient); transition: width .6s cubic-bezier(.4,0,.2,1); }

/* ---------- Utility ---------- */
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .wrap { flex-wrap: wrap; }
.text-muted { color: var(--text-muted); } .text-sm { font-size: 12.5px; }
.mt-8{margin-top:8px;} .mt-16{margin-top:16px;} .mb-16{margin-bottom:16px;}
.hidden { display: none !important; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .search-box { display: none; }
  .hide-on-mobile { display: none; }
  .content { padding: 16px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head .btn { width: 100%; justify-content: center; }
  .modal { max-width: 100%; }
}
@media (max-width: 480px) {
  .topnav { padding: 0 14px; gap: 10px; }
  .brand { padding: 16px; }
  .stat-card .metric-value { font-size: 21px; }
}

.dropdown-item { color: var(--text-secondary); transition: var(--transition); cursor: pointer; }
.dropdown-item:hover { background: rgba(0,161,220,0.1); color: var(--accent); }

.badge-overdue { background: rgba(239,68,68,0.18); color: #FCA5A5; animation: pulseOverdue 1.6s ease infinite; }
@keyframes pulseOverdue { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------------- Light mode ---------------- */
html.light-mode {
  --secondary: #E7F3F9;
  --sidebar: #FFFFFF;
  --bg: #F3F7F9;
  --card-bg: #FFFFFF;
  --text: #0B2530;
  --text-secondary: #3E5C67;
  --text-muted: #7A8F97;
  --border: rgba(0,89,122,0.14);
  --shadow-soft: 0 8px 24px rgba(15,60,80,0.08);
  --shadow-glow: 0 0 0 1px var(--border), 0 10px 30px rgba(0,120,160,0.06);
}
html.light-mode body {
  background-image:
    radial-gradient(circle at 10% 0%, rgba(0,161,220,0.06), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(139,92,246,0.05), transparent 35%);
}
html.light-mode .glass { background: rgba(255,255,255,0.75); }
html.light-mode .skeleton { background: linear-gradient(90deg, rgba(0,0,0,0.04) 25%, rgba(0,0,0,0.08) 37%, rgba(0,0,0,0.04) 63%); background-size: 400% 100%; }
html.light-mode .search-box, html.light-mode .field input, html.light-mode .field select, html.light-mode .field textarea { background: rgba(0,60,80,0.04); }

/* =========================================================
   Premium enterprise polish pass — Linear/Stripe/Vercel-inspired
   refinements layered on top of the base design system above.
   Adds every class referenced in the app that was previously
   missing (filter-select, scroll-grid, scroll-list, city-chip,
   health monitor, member commission views) plus general depth,
   spacing, and motion upgrades.
   ========================================================= */

/* ---------- Refined elevation + card depth ---------- */
.card {
  position: relative;
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, var(--shadow-glow);
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(135deg, rgba(0,161,220,0.14), transparent 40%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none; opacity: 0; transition: opacity .25s ease;
}
.card:hover::before { opacity: 1; }
.card:hover { border-color: rgba(0,161,220,0.30); transform: translateY(-3px); box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 0 0 1px rgba(0,161,220,0.28), 0 20px 44px rgba(0,0,0,0.32); }

/* ---------- Typography refinements ---------- */
.page-head h1 { letter-spacing: -.6px; background: linear-gradient(180deg, var(--text), var(--text-secondary)); -webkit-background-clip: text; background-clip: text; }
h3 { letter-spacing: -.2px; }
.metric-value { letter-spacing: -.7px; }

/* ---------- Filter / select controls (Clients, Groups, Members, Places toolbars) ---------- */
.filter-select {
  background: rgba(255,255,255,0.04); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 14px; font-size: 13px; font-weight: 500;
  outline: none; transition: var(--transition); cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 15px;
  padding-right: 32px;
}
.filter-select:hover { border-color: rgba(0,161,220,0.4); }
.filter-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,161,220,0.15); }

/* ---------- Scrollable regions (long grids/lists inside a fixed page) ---------- */
.scroll-list, .scroll-list-lg { max-height: 560px; overflow-y: auto; padding-right: 4px; }
.scroll-list-lg { max-height: 640px; }
.scroll-grid, .scroll-grid-sm { max-height: 560px; overflow-y: auto; padding-right: 6px; }
.scroll-grid-sm { max-height: 340px; }
.scroll-list-sm { max-height: 180px; overflow-y: auto; }

/* ---------- City summary chips (Clients page) ---------- */
.city-chip { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.city-chip .stat-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Task cards (Tasks page) ---------- */
.task-card { display: flex; flex-direction: column; }
.task-desc { overflow-wrap: anywhere; word-break: break-word; white-space: pre-line; }
.task-desc.clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.task-desc-toggle {
  color: var(--accent); font-size: 12px; font-weight: 700; padding: 0 0 12px; align-self: flex-start;
}
.task-desc-toggle:hover { text-decoration: underline; }
.task-thumb {
  width: 100%; max-height: 220px; overflow: hidden; border-radius: 10px; margin-bottom: 10px;
  background: rgba(255,255,255,0.03);
}
.task-thumb img { width: 100%; height: 220px; object-fit: cover; display: block; }

/* ---------- Buttons: refined focus + active states ---------- */
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary:active { box-shadow: 0 3px 10px rgba(0,161,220,0.4); }
.btn[disabled] { opacity: .55; cursor: not-allowed; pointer-events: none; }

/* ---------- Tables: sticky header + refined rows ---------- */
.table-wrap table thead th { position: sticky; top: 0; background: var(--card-bg); z-index: 2; }
tr td:first-child, tr th:first-child { padding-left: 4px; }
tbody tr { transition: background .15s ease; }

/* ---------- Business Health Monitor ---------- */
.health-banner {
  display: flex; align-items: center; gap: 16px; padding: 18px 20px; cursor: pointer;
  text-decoration: none; color: inherit;
}
.health-banner-emoji { font-size: 26px; flex-shrink: 0; }
.health-banner-body { flex: 1; }
.health-banner-body b { font-size: 14.5px; }
.health-banner-body p { margin-top: 3px; }
.health-banner-cta { font-size: 12.5px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.health-healthy { border-color: rgba(34,197,94,0.35); background: linear-gradient(90deg, rgba(34,197,94,0.10), transparent); }
.health-warning { border-color: rgba(245,158,11,0.4); background: linear-gradient(90deg, rgba(245,158,11,0.12), rgba(239,68,68,0.03)); }
.health-critical { border-color: rgba(239,68,68,0.45); background: linear-gradient(90deg, rgba(239,68,68,0.14), rgba(239,68,68,0.03)); animation: growthPulse 2.4s ease infinite; }

.health-hero { display: flex; align-items: center; gap: 18px; padding: 24px; }
.health-hero-emoji { font-size: 40px; flex-shrink: 0; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; border-radius: 18px; background: rgba(255,255,255,0.04); }
.health-hero-label { font-size: 21px; font-weight: 800; letter-spacing: -.4px; margin-bottom: 2px; }

.health-reasons { display: flex; flex-direction: column; gap: 12px; }
.health-reason { display: flex; gap: 12px; padding: 14px; border-radius: var(--radius-md); background: rgba(255,255,255,0.02); border: 1px solid var(--border); }
.health-reason-icon { font-size: 18px; flex-shrink: 0; line-height: 1; margin-top: 2px; }
.health-reason p { font-size: 13.5px; line-height: 1.5; }
.health-reason-critical { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.05); }
.health-reason-warning { border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.05); }
.health-reason-info { border-color: rgba(34,197,94,0.25); background: rgba(34,197,94,0.04); }

/* ---------- Member commission breakdown ---------- */
.commission-summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.commission-summary-item { background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.commission-summary-item .stat-label { display: block; margin-bottom: 6px; }
.commission-summary-item b { font-size: 17px; font-family: 'JetBrains Mono', monospace; }
.commission-mini-table { width: 100%; font-size: 12.5px; margin-top: 6px; }
.commission-mini-table th { font-size: 10.5px; padding: 6px 8px; }
.commission-mini-table td { padding: 8px; }

/* ---------- Misc polish ---------- */
.badge { box-shadow: inset 0 0 0 1px currentColor; }
.badge-success { box-shadow: inset 0 0 0 1px rgba(34,197,94,0.25); }
.badge-warning { box-shadow: inset 0 0 0 1px rgba(245,158,11,0.25); }
.badge-danger { box-shadow: inset 0 0 0 1px rgba(239,68,68,0.25); }
.badge-info { box-shadow: inset 0 0 0 1px rgba(59,130,246,0.25); }
.badge-muted { box-shadow: inset 0 0 0 1px rgba(148,163,184,0.2); }

.chart-card { transition: var(--transition); }
.chart-card:hover { border-color: rgba(0,161,220,0.28); }

@media (max-width: 900px) {
  .commission-summary-grid { grid-template-columns: 1fr; }
  .health-hero { flex-direction: column; align-items: flex-start; text-align: left; }
}