/* ============================================================
   MyConnect — Design System v2
   Inspired by myconnect-redesign-v2.html
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --brand-700:#0b4f6c; --brand-600:#0e6e8e; --brand-500:#1287a8; --brand-400:#5eb6cc;
  --accent-600:#0d9488; --accent-500:#14b8a6;
  --indigo-500:#4f46e5; --violet-500:#8b5cf6;
  --green-50:#ecfdf5; --green-500:#10b981; --green-600:#059669; --green-700:#047857;
  --amber-50:#fffbeb; --amber-500:#f59e0b; --amber-600:#d97706;
  --red-50:#fef2f2; --red-500:#ef4444; --red-600:#dc2626;
  --blue-50:#eff6ff; --blue-500:#3b82f6; --blue-600:#2563eb;
  --violet-50:#f5f3ff;
  --ink-900:#0f172a; --ink-800:#1e293b; --ink-700:#334155; --ink-600:#475569;
  --ink-500:#64748b; --ink-400:#94a3b8; --ink-300:#cbd5e1; --ink-200:#e2e8f0;
  --ink-100:#f1f5f9; --ink-50:#f8fafc;
  --surface:#ffffff; --bg:#f4f7fb; --brand-50:#f0f9fb;
  --topbar:rgba(244,247,251,.9);
  --grid:#f1f5f9;
  --radius:14px; --radius-sm:9px; --radius-lg:20px;
  --shadow-xs:0 1px 2px rgba(15,23,42,.06);
  --shadow-sm:0 2px 8px rgba(15,23,42,.07);
  --shadow-md:0 8px 24px -6px rgba(15,23,42,.12);
  --shadow-lg:0 20px 48px -12px rgba(15,23,42,.22);
  --ring:0 0 0 3px rgba(18,135,168,.18);
  --sidebar-w:240px; --sidebar-w-collapsed:68px;
  --topnav-height:60px;
  --font:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  --tr:.22s cubic-bezier(.4,0,.2,1);
  /* Legacy compat */
  --primary-color:#1287a8; --primary-hover:#0e6e8e; --primary-light:#f0f9fb;
  --success-color:#059669; --success-light:#ecfdf5;
  --warning-color:#d97706; --warning-light:#fffbeb;
  --error-color:#dc2626; --error-light:#fef2f2;
  --text-primary:#1e293b; --text-secondary:#64748b; --text-muted:#94a3b8;
  --border-color:#e2e8f0; --hover-bg:#f8fafc;
  --background:#f4f7fb; --surface-hover:#f8fafc;
  --shadow-1:0 1px 3px rgba(15,23,42,.08),0 1px 2px rgba(15,23,42,.05);
  --shadow-2:0 4px 12px rgba(15,23,42,.1);
  --shadow-3:0 10px 30px rgba(15,23,42,.15);
  --font-google:'Inter',-apple-system,sans-serif;
  --sidebar-width:240px; --sidebar-mini-width:68px;
  --primary:#1287a8;
}

[data-theme="dark"] {
  --brand-400:#3a9fbb;
  --green-50:rgba(16,185,129,.15); --green-600:#34d399; --green-700:#6ee7b7;
  --amber-50:rgba(245,158,11,.15); --amber-600:#fbbf24;
  --red-50:rgba(239,68,68,.15); --red-600:#f87171;
  --blue-50:rgba(59,130,246,.18); --blue-600:#60a5fa;
  --violet-50:rgba(139,92,246,.18); --violet-500:#a78bfa;
  --ink-900:#f5f7fb; --ink-800:#e4e9f2; --ink-700:#cdd6e4; --ink-600:#b4c0d4;
  --ink-500:#9aa8c0; --ink-400:#8595b0; --ink-300:#3b4a66; --ink-200:#2a3650;
  --ink-100:#1e2940; --ink-50:#161f33;
  --surface:#0f1626; --bg:#070b15; --brand-50:rgba(18,135,168,.12);
  --topbar:rgba(7,11,21,.88);
  --shadow-xs:0 1px 2px rgba(0,0,0,.35);
  --shadow-sm:0 2px 10px rgba(0,0,0,.4);
  --shadow-md:0 10px 28px -6px rgba(0,0,0,.55);
  --shadow-lg:0 24px 56px -12px rgba(0,0,0,.7);
  --ring:0 0 0 3px rgba(20,184,166,.25);
  --text-primary:#e4e9f2; --text-secondary:#9aa8c0; --text-muted:#8595b0;
  --border-color:#2a3650; --hover-bg:#1e2940;
  --background:#070b15; --surface-hover:#1e2940;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink-800);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
  transition: background .3s, color .3s;
}
::selection { background: rgba(18,135,168,.22); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-400); background-clip: content-box; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }
svg { display: block; }
img { max-width: 100%; }

/* ===== Impersonation Banner ===== */
#impersonationBanner,
.imp-banner {
  position: sticky;
  top: 0;
  z-index: 1100;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: linear-gradient(100deg,#0b4f6c,#0d9488);
  color: #fff;
  font-size: 12.5px;
  box-shadow: 0 2px 12px rgba(11,79,108,.3);
  font-family: var(--font);
}
.imp-pulse { width: 8px; height: 8px; border-radius: 50%; background: #a7f3d0; flex: none; animation: impPulse 2s infinite; }
@keyframes impPulse { 0%{box-shadow:0 0 0 0 rgba(167,243,208,.6)} 70%{box-shadow:0 0 0 8px rgba(167,243,208,0)} 100%{box-shadow:0 0 0 0 rgba(167,243,208,0)} }

/* ===== Top Navigation ===== */
.top-nav {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topnav-height);
  background: var(--topbar);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--ink-200);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  z-index: 1000;
  transition: background .3s, left var(--tr);
}
body.has-imp-banner .top-nav { top: 44px; }
body.sidebar-mini .top-nav { left: var(--sidebar-mini-width); }

.nav-left { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.nav-center { flex: 1; max-width: 520px; display: flex; align-items: center; }
.nav-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }

/* Search bar */
.global-search {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: 11px;
  padding: 0 14px;
  height: 40px;
  transition: var(--tr);
  box-shadow: var(--shadow-xs);
}
.global-search:focus-within { border-color: var(--brand-500); box-shadow: var(--ring); }
.global-search svg { width: 17px; height: 17px; color: var(--ink-400); flex: none; }
.global-search input { border: none; outline: none; background: none; flex: 1; color: var(--ink-800); font-size: 13.5px; }
.global-search input::placeholder { color: var(--ink-400); }
.global-search kbd { font-family: var(--font); font-size: 11px; color: var(--ink-400); font-weight: 600; background: var(--ink-100); border: 1px solid var(--ink-200); border-radius: 5px; padding: 1px 6px; }

/* Menu toggle */
.menu-toggle {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-500); transition: var(--tr); cursor: pointer;
  background: none; border: none;
}
.menu-toggle:hover { background: var(--ink-100); color: var(--ink-800); }
.menu-toggle .material-icons { font-size: 22px; }
@media (min-width: 768px) {
  .menu-toggle { display: none; }
}

/* Topbar icon buttons */
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-500); transition: var(--tr);
  border: 1px solid transparent; position: relative; background: none;
}
.icon-btn:hover { background: var(--surface); color: var(--ink-800); box-shadow: var(--shadow-xs); border-color: var(--ink-200); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .material-icons { font-size: 20px; }
.icon-btn .notif-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--red-500); border: 2px solid var(--bg); }

/* Status pill */
.pill-status {
  display: flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 13px; border-radius: 9px;
  background: var(--green-50); color: var(--green-700);
  font-weight: 600; font-size: 12px;
  border: 1px solid rgba(16,185,129,.3);
  white-space: nowrap;
}
.pill-status .d { width: 7px; height: 7px; border-radius: 50%; background: var(--green-500); box-shadow: 0 0 0 3px rgba(16,185,129,.18); }

/* Theme toggle */
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

/* Logo area */
.logo { display: flex; align-items: center; gap: 8px; }
.logo-text { font-size: 18px; font-weight: 800; color: var(--ink-900); letter-spacing: -.02em; }
.logo-text span { color: var(--accent-500); }
.logo-icon {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg,var(--brand-600),var(--accent-500));
  display: grid; place-items: center;
  box-shadow: 0 4px 12px -3px rgba(18,135,168,.45);
}
.logo-icon svg { width: 20px; height: 20px; }

/* Dynamic logos in topbar */
#dynamicLogo { height: 44px; max-height: 44px; object-fit: contain; }

/* User profile */
.user-profile {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 5px; border-radius: 11px;
  cursor: pointer; transition: var(--tr);
  border: 1px solid transparent;
}
.user-profile:hover { background: var(--ink-100); border-color: var(--ink-200); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
  background: linear-gradient(135deg,var(--indigo-500),var(--violet-500));
}
.user-name { font-weight: 600; font-size: 13px; color: var(--ink-800); }
.user-type-badge {
  padding: 2px 7px; border-radius: 8px; font-size: 10.5px; font-weight: 700;
  background: var(--brand-50); color: var(--brand-500);
  text-transform: uppercase; letter-spacing: .04em;
}

/* User dropdown */
#userDropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 290px; background: var(--surface);
  border: 1px solid var(--ink-200); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); z-index: 9999; overflow: hidden;
  font-family: var(--font);
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  left: 0;
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--ink-200);
  display: flex;
  flex-direction: column;
  z-index: 999;
  transition: width var(--tr), transform var(--tr), background .3s;
  overflow: hidden;
}
body.has-imp-banner .sidebar { top: 44px; height: calc(100vh - 44px); }
body:not(.has-imp-banner) .sidebar { top: 0; height: 100vh; }

.sidebar.mini { width: var(--sidebar-mini-width); }

/* Sidebar brand */
.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--ink-100);
  flex-shrink: 0;
}
.sidebar-brand .brand-logo {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg,var(--brand-600),var(--accent-500));
  display: grid; place-items: center;
  box-shadow: 0 4px 12px -3px rgba(18,135,168,.4);
}
.sidebar-brand .brand-logo svg { width: 20px; height: 20px; }
.sidebar-brand .brand-txt .brand-name { font-weight: 800; font-size: 16px; color: var(--ink-900); letter-spacing: -.02em; white-space: nowrap; }
.sidebar-brand .brand-txt .brand-name span { color: var(--accent-500); }
.sidebar-brand .brand-txt .brand-sub { font-size: 10px; color: var(--ink-400); font-weight: 500; white-space: nowrap; }
.sidebar.mini .brand-txt { display: none; }

/* Sidebar nav */
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 10px 16px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: 4px; }

.nav-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-400); padding: 12px 10px 5px; white-space: nowrap;
  transition: opacity var(--tr);
}
.sidebar.mini .nav-section-label { opacity: 0; height: 6px; padding: 0; overflow: hidden; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--ink-600); font-weight: 500; font-size: 13px;
  transition: var(--tr); position: relative; white-space: nowrap;
  cursor: pointer; text-decoration: none;
}
.nav-item .material-icons { font-size: 20px; flex-shrink: 0; color: var(--ink-400); transition: var(--tr); }
.nav-item:hover { background: var(--ink-50); color: var(--ink-900); }
.nav-item:hover .material-icons { color: var(--brand-500); }
.nav-item.active { background: linear-gradient(100deg,rgba(18,135,168,.11),rgba(20,184,166,.09)); color: var(--brand-500); font-weight: 600; }
.nav-item.active .material-icons { color: var(--brand-500); }
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 50%;
  transform: translateY(-50%); width: 3px; height: 20px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(var(--brand-500),var(--accent-500));
}
.nav-item .nav-label { flex: 1; }
.nav-item .nav-chev { width: 15px; height: 15px; color: var(--ink-300); transition: transform var(--tr); flex-shrink: 0; }
.nav-item.open .nav-chev { transform: rotate(180deg); }
.nav-item .nav-badge {
  background: var(--red-500); color: #fff;
  font-size: 10px; font-weight: 700; min-width: 17px; height: 17px;
  border-radius: 8px; display: grid; place-items: center; padding: 0 4px;
}

.sidebar.mini .nav-item .nav-label,
.sidebar.mini .nav-item .nav-chev,
.sidebar.mini .nav-item .nav-badge { display: none; }
.sidebar.mini .nav-item { justify-content: center; padding: 10px; }
.sidebar.mini .nav-item.active::before { left: -10px; }

/* Sub nav */
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-items {
  display: flex; flex-direction: column; gap: 1px;
  overflow: hidden; max-height: 0; transition: max-height var(--tr);
  padding-left: 16px;
}
.nav-group-items.open,
.nav-group.expanded .nav-group-items { max-height: 320px; }
.sidebar.mini .nav-group-items { display: none; }

.nav-sub-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 8px;
  color: var(--ink-500); font-size: 12.5px; font-weight: 500;
  transition: var(--tr); cursor: pointer; white-space: nowrap;
  text-decoration: none;
}
.nav-sub-item::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--ink-300); flex: none; transition: var(--tr);
}
.nav-sub-item:hover { background: var(--ink-50); color: var(--ink-800); }
.nav-sub-item.active { color: var(--brand-500); font-weight: 600; }
.nav-sub-item.active::before { background: var(--accent-500); box-shadow: 0 0 0 3px rgba(20,184,166,.15); }

/* Legacy nav classes */
.nav-group-header {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--ink-600); font-weight: 500; font-size: 13px;
  transition: var(--tr); cursor: pointer; white-space: nowrap;
}
.nav-group-header .material-icons { font-size: 20px; flex-shrink: 0; color: var(--ink-400); transition: var(--tr); }
.nav-group-header:hover { background: var(--ink-50); color: var(--ink-900); }
.nav-group-header:hover .material-icons { color: var(--brand-500); }
.nav-group-header .expand-icon { margin-left: auto; font-size: 18px; transition: transform .25s; flex-shrink: 0; }
.nav-group.expanded .expand-icon { transform: rotate(180deg); }
.sidebar.mini .nav-group-header { justify-content: center; padding: 10px; }
.sidebar.mini .nav-group-header span:not(.material-icons) { display: none; }

/* Sidebar footer */
.sidebar-footer { padding: 12px; border-top: 1px solid var(--ink-100); flex-shrink: 0; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 9px; border-radius: 10px;
  transition: var(--tr); cursor: pointer;
}
.user-chip:hover { background: var(--ink-50); }
.user-chip .chip-avatar {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg,var(--indigo-500),var(--violet-500));
  color: #fff; font-weight: 700; font-size: 13px;
}
.user-chip .chip-meta { flex: 1; min-width: 0; }
.user-chip .chip-name { font-weight: 600; font-size: 12.5px; color: var(--ink-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .chip-email { font-size: 11px; color: var(--ink-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .chip-more { width: 15px; height: 15px; color: var(--ink-300); }
.sidebar.mini .chip-meta, .sidebar.mini .chip-more { display: none; }
.sidebar.mini .user-chip { justify-content: center; }

/* Sidebar overlay */
.sidebar-overlay {
  display: none; position: fixed;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(2px); z-index: 998;
}
body.has-imp-banner .sidebar-overlay { top: calc(44px + var(--topnav-height)); left: 0; right: 0; bottom: 0; }
body:not(.has-imp-banner) .sidebar-overlay { top: var(--topnav-height); left: 0; right: 0; bottom: 0; }
.sidebar-overlay.show { display: block; }

/* ===== Main Content ===== */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 24px 24px 32px;
  min-height: 100vh;
  transition: margin-left var(--tr);
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
body.has-imp-banner .main-content { padding-top: calc(44px + var(--topnav-height) + 24px); }
body:not(.has-imp-banner) .main-content { padding-top: calc(var(--topnav-height) + 24px); }
.main-content.sidebar-mini { margin-left: var(--sidebar-mini-width); }

/* ===== Page Elements ===== */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 2px; flex-wrap: wrap; }
.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-400);  }
.breadcrumb a { color: var(--ink-500); font-weight: 500; transition: var(--tr); }
.breadcrumb a:hover { color: var(--brand-500); }
.breadcrumb svg { width: 13px; height: 13px; }
.breadcrumb .cur { color: var(--brand-500); font-weight: 600; }
.page-title { font-size: 18px; font-weight: 800; color: var(--ink-900); letter-spacing: -.025em; }
.page-subtitle { color: var(--ink-500); font-size: 11px; }
.head-actions { display: flex; align-items: center; gap: 9px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 16px; border-radius: 10px;
  font-weight: 600; font-size: 13px; transition: var(--tr);
  white-space: nowrap; border: none; cursor: pointer; font-family: var(--font);
}
.btn svg, .btn .material-icons { width: 16px; height: 16px; font-size: 16px; }
.btn-primary {
  background: linear-gradient(120deg,var(--brand-600),var(--accent-600));
  color: #fff; box-shadow: 0 6px 16px -4px rgba(13,148,136,.45);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -4px rgba(13,148,136,.5); }
.btn-secondary, .btn-light {
  background: var(--surface); color: var(--ink-700);
  border: 1px solid var(--ink-200); box-shadow: var(--shadow-xs);
}
.btn-secondary:hover, .btn-light:hover { background: var(--ink-50); border-color: var(--ink-300); }
.btn-danger { background: var(--red-50); color: var(--red-600); border: 1px solid rgba(239,68,68,.28); }
.btn-danger:hover { background: rgba(239,68,68,.15); }
.btn-sm { height: 33px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { padding: 0; width: 38px; height: 38px; justify-content: center; }

/* ===== Cards ===== */
.card {
  background: var(--surface); border: 1px solid var(--ink-200);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: background .3s, border-color .3s; margin-bottom: 18px;
}
.card-pad { padding: 20px; }
.card-header, .card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--ink-100);
}
.card-header h3, .card-head h3 {
  font-size: 14.5px; font-weight: 700; color: var(--ink-900);
  display: flex; align-items: center; gap: 8px; margin: 0;
}
.card-body { padding: 20px; }
.ic-badge { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.ic-badge svg, .ic-badge .material-icons { width: 15px; height: 15px; font-size: 15px; }
.card-link {
  font-size: 12px; font-weight: 600; color: var(--brand-500);
  display: flex; align-items: center; gap: 4px; transition: var(--tr); cursor: pointer;
}
.card-link:hover { gap: 7px; }
.card-link svg { width: 13px; height: 13px; }
.card-title { font-size: 14.5px; font-weight: 700; color: var(--ink-900); }
.card-subtitle { font-size: 12px; color: var(--ink-500); margin-top: 2px; }

/* ===== Stats Grid ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--ink-200);
  border-radius: var(--radius); padding: 18px; position: relative;
  overflow: hidden; box-shadow: var(--shadow-sm); transition: var(--tr);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::after {
  content: ""; position: absolute; right: -24px; top: -24px;
  width: 100px; height: 100px; border-radius: 50%; opacity: .08;
}
.stat-card.b1::after { background: var(--blue-500); }
.stat-card.b2::after { background: var(--green-500); }
.stat-card.b3::after { background: var(--amber-500); }
.stat-card.b4::after { background: var(--accent-500); }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.stat-icon-box {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; color: #fff; flex-shrink: 0;
}
.stat-icon-box svg, .stat-icon-box .material-icons { width: 22px; height: 22px; font-size: 22px; }
.stat-card.b1 .stat-icon-box { background: linear-gradient(135deg,#3b82f6,#2563eb); }
.stat-card.b2 .stat-icon-box { background: linear-gradient(135deg,#10b981,#059669); }
.stat-card.b3 .stat-icon-box { background: linear-gradient(135deg,#f59e0b,#d97706); }
.stat-card.b4 .stat-icon-box { background: linear-gradient(135deg,#14b8a6,#0d9488); }
.stat-trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 7px;
}
.stat-trend.up { background: var(--green-50); color: var(--green-600); }
.stat-trend.warn { background: var(--amber-50); color: var(--amber-600); }
.stat-trend.flat { background: var(--ink-100); color: var(--ink-500); }
.stat-trend svg { width: 12px; height: 12px; }
.stat-val { font-size: 28px; font-weight: 800; color: var(--ink-900); letter-spacing: -.03em; line-height: 1; }
.stat-lbl { font-size: 12.5px; color: var(--ink-500); font-weight: 500; margin-top: 5px; }
/* Legacy */
.dash-stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 20px; }
.dash-stat-card {
  background: var(--surface); border: 1px solid var(--ink-200);
  border-radius: var(--radius); padding: 18px; position: relative;
  overflow: hidden; box-shadow: var(--shadow-sm); transition: var(--tr);
  display: flex; align-items: center; gap: 14px;
}
.dash-stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.dash-stat-icon-wrapper {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; flex-shrink: 0;
}
.dash-stat-icon-wrapper .material-icons { font-size: 22px; color: #fff; }
.dash-stat-icon-wrapper.blue { background: linear-gradient(135deg,#3b82f6,#2563eb); }
.dash-stat-icon-wrapper.green { background: linear-gradient(135deg,#10b981,#059669); }
.dash-stat-icon-wrapper.orange { background: linear-gradient(135deg,#f59e0b,#d97706); }
.dash-stat-icon-wrapper.teal { background: linear-gradient(135deg,#14b8a6,#0d9488); }
.dash-stat-icon-wrapper.purple { background: linear-gradient(135deg,#a78bfa,#8b5cf6); }
.dash-stat-number { font-size: 26px; font-weight: 800; color: var(--ink-900); letter-spacing: -.02em; line-height: 1; }
.dash-stat-label { font-size: 12px; color: var(--ink-500); font-weight: 500; margin-top: 3px; }
.dash-stat-badge { position: absolute; top: 11px; right: 11px; font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 5px; }
.dash-stat-badge.positive { background: var(--green-50); color: var(--green-600); }
.dash-stat-badge.warning { background: var(--amber-50); color: var(--amber-600); }

/* ===== Grid Layouts ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 18px; }
.dash-analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.dash-content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-table-card { background: var(--surface); border: 1px solid var(--ink-200); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.dash-chart-card { background: var(--surface); border: 1px solid var(--ink-200); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; font-size: 11px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; color: var(--ink-400);
  padding: 3px 5px; border-bottom: 1px solid var(--ink-200);
  background: var(--ink-50); white-space: nowrap;
}
tbody td { padding: 3px 5px; border-bottom: 1px solid var(--ink-100); color: var(--ink-700); vertical-align: middle; }
tbody tr { transition: background var(--tr); }
tbody tr.clickable { cursor: pointer; }
tbody tr:hover { background: var(--brand-50); }
tbody tr:last-child td { border-bottom: none; }
.cell-id { font-weight: 700; color: var(--brand-500); }
.cell-id:hover { text-decoration: underline; }
.cell-strong { font-weight: 600; color: var(--ink-800); }
.cell-muted { color: var(--ink-400); }
.table-checkbox { width: 15px; height: 15px; border-radius: 4px; accent-color: var(--brand-500); cursor: pointer; }
/* dash table */
.dash-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dash-table th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-400); padding: 3px 5px; border-bottom: 1px solid var(--ink-200); background: var(--ink-50); }
.dash-table td { padding: 3px 5px; border-bottom: 1px solid var(--ink-100); font-size: 13px; color: var(--ink-700); vertical-align: middle; }
.dash-table tr:hover { background: var(--brand-50); }
.dash-table tr:last-child td { border-bottom: none; }

/* ===== Compact table toolbar ===== */
.tbl-toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; flex-wrap: wrap; }
.tbl-toolbar .grow { flex: 1; }
.field-input {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--ink-200);
  border-radius: 9px; padding: 0 12px; height: 36px; transition: var(--tr);
}
.field-input:focus-within { border-color: var(--brand-500); box-shadow: var(--ring); }
.field-input svg, .field-input .material-icons { width: 16px; height: 16px; color: var(--ink-400); flex-shrink: 0; font-size: 16px; }
.field-input input, .field-input select { border: none; outline: none; background: none; color: var(--ink-800); font-size: 13px; width: 100%; box-shadow: none; }
.field-input input:focus, .field-input select:focus { outline: none !important; box-shadow: none !important; border: none !important; }
.chip-select {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 12px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--ink-200);
  color: var(--ink-600); font-weight: 500; font-size: 12.5px; transition: var(--tr);
}
.chip-select:hover { border-color: var(--ink-300); background: var(--ink-50); }
.chip-select svg, .chip-select .material-icons { width: 15px; height: 15px; color: var(--ink-400); font-size: 15px; }

/* Legacy toolbar */
.search-box { position: relative; }
.search-box input { padding-left: 34px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-400); font-size: 18px; }
.toolbar-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-600); }
.filter-item-wrapper { position: relative; }
.filter-item-icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--ink-400); pointer-events: none; }
.filter-select { padding-left: 30px !important; }

/* ===== Pills / Badges ===== */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.pill .d { width: 6px; height: 6px; border-radius: 50%; }
.pill.green { background: var(--green-50); color: var(--green-700); }
.pill.green .d { background: var(--green-500); }
.pill.red { background: var(--red-50); color: var(--red-600); }
.pill.red .d { background: var(--red-500); }
.pill.amber { background: var(--amber-50); color: var(--amber-600); }
.pill.amber .d { background: var(--amber-500); }
.pill.blue { background: var(--blue-50); color: var(--blue-600); }
.pill.blue .d { background: var(--blue-500); }
.pill.violet { background: var(--violet-50); color: var(--violet-500); }
.pill.violet .d { background: var(--violet-500); }
.pill.gray { background: var(--ink-100); color: var(--ink-500); }
.pill.gray .d { background: var(--ink-400); }

/* Legacy badge */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 8px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge.active { background: var(--green-50); color: var(--green-700); }
.badge.disconnected { background: var(--red-50); color: var(--red-600); }
.badge.inactive { background: var(--ink-100); color: var(--ink-500); }
.badge.barred { background: var(--violet-50); color: var(--violet-500); }
.badge.pending { background: var(--amber-50); color: var(--amber-600); }
.badge.open { background: var(--amber-50); color: var(--amber-600); }
.badge.resolved, .badge.closed { background: var(--green-50); color: var(--green-700); }
.badge.in.progress { background: var(--blue-50); color: var(--blue-600); }

/* Priority */
.prio { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 12px; }
.prio svg { width: 13px; height: 13px; }
.prio.high { color: var(--red-600); }
.prio.med { color: var(--amber-600); }
.prio.low { color: var(--ink-500); }

/* dot-badge legacy */
.dot-badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 12.5px; }
.dot-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-400); }
.dot-badge.open::before { background: var(--amber-500); }
.dot-badge.resolved::before, .dot-badge.closed::before { background: var(--green-500); }
.dot-badge.in-progress::before { background: var(--blue-500); }
.dot-badge.pending::before { background: var(--violet-500); }

/* Status links */
.sr-link { color: var(--brand-500); text-decoration: none; font-weight: 600; }
.sr-link:hover { text-decoration: underline; }

/* ===== Pagination ===== */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px; border-top: 1px solid var(--ink-100); flex-wrap: wrap; gap: 10px; position: sticky; bottom: 0; background: var(--surface); z-index: 10; }
.pagination .info { font-size: 12px; color: var(--ink-500); }
.pagination-footer { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px; border-top: 1px solid var(--ink-200); background: var(--surface); position: sticky; bottom: 0; z-index: 10; }
.pagination-info { font-size: 12.5px; color: var(--ink-500); }
.pager { display: flex; align-items: center; gap: 4px; }
.pager button, .page-btn {
  min-width: 33px; height: 33px; border-radius: 8px;
  border: 1px solid var(--ink-200); background: var(--surface);
  color: var(--ink-600); font-weight: 600; font-size: 12.5px;
  transition: var(--tr); display: grid; place-items: center; padding: 0 5px;
  cursor: pointer;
}
.pager button:hover:not(:disabled), .page-btn:hover:not(:disabled) { border-color: var(--brand-400); color: var(--brand-500); }
.pager button.active, .page-btn.active {
  background: linear-gradient(120deg,var(--brand-600),var(--accent-600));
  color: #fff; border-color: transparent;
}
.pager button:disabled, .page-btn:disabled { opacity: .4; cursor: not-allowed; }
.pager svg { width: 15px; height: 15px; }
.pagination-controls { display: flex; gap: 4px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-label, .form-field label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--ink-700); margin-bottom: 6px;
}
.form-label .req, .form-field label .req { color: var(--red-500); }
.form-input, .input, .textarea, .select-el, .form-select {
  width: 100%; background: var(--ink-50);
  border: 1.5px solid var(--ink-200); border-radius: 9px;
  padding: 9px 12px; color: var(--ink-800);
  transition: var(--tr); outline: none; font-size: 13.5px; font-family: var(--font);
}
.form-input:focus, .input:focus, .textarea:focus, .select-el:focus, .form-select:focus {
  background: var(--surface); border-color: var(--brand-500); box-shadow: var(--ring);
}
.form-input::placeholder, .input::placeholder, .textarea::placeholder { color: var(--ink-400); }
.textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
.select-el, .form-select {
  appearance: none;
  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='%2394a3b8' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; cursor: pointer;
}
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: repeat(3,1fr); }
.form-grid-4 { grid-template-columns: repeat(4,1fr); }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.span-2 { grid-column: span 2; }
.form-field.span-full { grid-column: 1/-1; }
.field-hint { font-size: 11px; color: var(--ink-400); margin-top: 1px; }
.input-with-icon { position: relative; }
.input-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-400); font-size: 18px; pointer-events: none; }
.input-with-icon .form-input { padding-left: 36px; }
/* Section label form */
.section-label-form {
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--brand-500); display: flex; align-items: center; gap: 7px; margin: 10px 0 4px;
}
.section-label-form svg { width: 14px; height: 14px; }
.section-label-form .line { flex: 1; height: 1px; background: var(--ink-200); }

/* Smart selector */
.smart-selector { position: relative; }
.selector-display {
  display: flex; align-items: center; gap: 9px;
  background: var(--ink-50); border: 1.5px solid var(--ink-200);
  border-radius: 9px; padding: 9px 12px; cursor: pointer; transition: var(--tr);
  color: var(--ink-500); font-size: 13.5px;
}
.selector-display:hover { border-color: var(--ink-300); }
.selector-display .material-icons { font-size: 18px; color: var(--ink-400); }
.selector-text { flex: 1; }
.selector-dropdown {
  position: absolute; top: calc(100%+5px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--ink-200);
  border-radius: 11px; box-shadow: var(--shadow-md); z-index: 50;
  padding: 8px; max-height: 260px; overflow-y: auto;
}
.selector-search {
  display: flex; align-items: center; gap: 7px;
  background: var(--ink-50); border: 1px solid var(--ink-200);
  border-radius: 8px; padding: 0 10px; height: 36px; margin-bottom: 6px;
}
.selector-search .material-icons { font-size: 16px; color: var(--ink-400); }
.selector-search input { border: none; outline: none; background: none; width: 100%; font-size: 13px; color: var(--ink-800); }
.selector-results { display: flex; flex-direction: column; gap: 2px; }

/* Dropzone */
.dropzone {
  grid-column: 1/-1; border: 2px dashed var(--ink-300);
  border-radius: 12px; padding: 28px; text-align: center;
  background: var(--ink-50); transition: var(--tr); cursor: pointer;
}
.dropzone:hover { border-color: var(--accent-500); background: var(--green-50); }
.dz-ic {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  display: grid; place-items: center; margin: 0 auto 10px; color: var(--accent-500);
}
.dz-ic svg { width: 24px; height: 24px; }

/* ===== Tabs ===== */
.tabs {
  display: flex; gap: 3px; border-bottom: 1px solid var(--ink-200);
  margin-bottom: 20px; overflow-x: auto;
}
.tab {
  padding: 10px 16px; font-weight: 600; font-size: 13px;
  color: var(--ink-500); position: relative; transition: var(--tr);
  cursor: pointer; border-radius: 8px 8px 0 0; white-space: nowrap;
}
.tab:hover { color: var(--ink-800); background: var(--ink-50); }
.tab.active { color: var(--brand-500); }
.tab.active::after {
  content: ""; position: absolute; left: 12px; right: 12px;
  bottom: -1px; height: 2.5px; border-radius: 3px;
  background: linear-gradient(90deg,var(--brand-500),var(--accent-500));
}
.tab .cnt { margin-left: 6px; background: var(--ink-100); color: var(--ink-500); font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 7px; }
.tab.active .cnt { background: rgba(18,135,168,.15); color: var(--brand-500); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp .28s ease; }

/* ===== Chart containers ===== */
.chart-container { height: 260px; position: relative; }
.donut-wrap { display: flex; align-items: center; gap: 22px; padding: 8px; }
.donut-canvas { position: relative; width: 180px; height: 180px; flex: none; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center .big { font-size: 26px; font-weight: 800; color: var(--ink-900); line-height: 1; }
.donut-center .sm { font-size: 10.5px; color: var(--ink-400); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.legend { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.legend-row { display: flex; align-items: center; gap: 10px; }
.legend-row .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-row .t { flex: 1; font-size: 12.5px; color: var(--ink-600); font-weight: 500; }
.legend-row .v { font-size: 13px; font-weight: 700; color: var(--ink-900); }

/* ===== Monitoring / Grafana ===== */
.gf-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
  margin-bottom: 16px; padding: 11px 13px;
  background: var(--surface); border: 1px solid var(--ink-200);
  border-radius: 11px; box-shadow: var(--shadow-sm);
}
.gf-var { display: flex; align-items: stretch; border: 1px solid var(--ink-200); border-radius: 8px; overflow: hidden; }
.gf-var .vk {
  display: flex; align-items: center; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--ink-400);
  background: var(--ink-50); padding: 0 10px;
}
.gf-var select {
  border: none; outline: none; background: var(--surface); color: var(--ink-800);
  font-weight: 600; padding: 8px 28px 8px 10px; cursor: pointer; appearance: none;
  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='%2394a3b8' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.gf-var.wide select { min-width: 200px; }
.gf-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--accent-600);
  background: var(--green-50); border: 1px solid rgba(20,184,166,.25);
  padding: 6px 10px; border-radius: 8px;
}
.gf-tag svg { width: 13px; height: 13px; }
.gf-tag .live { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-500); animation: impPulse 2s infinite; }
.gf-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 14px; }
.gf-grid.charts { grid-template-columns: repeat(2,1fr); }
.gf-panel { background: var(--surface); border: 1px solid var(--ink-200); border-radius: 12px; box-shadow: var(--shadow-sm); overflow: hidden; }
.gf-panel .pt { display: flex; align-items: center; justify-content: space-between; padding: 10px 13px; border-bottom: 1px solid var(--ink-100); font-size: 12px; font-weight: 600; color: var(--ink-600); }
.gf-panel .pb { padding: 14px; }
.gf-stat .num { font-size: 27px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.gf-stat .sub { font-size: 11px; color: var(--ink-400); margin-top: 5px; display: flex; align-items: center; gap: 4px; }
.gf-stat.g .num { color: var(--green-600); }
.gf-stat.a .num { color: var(--amber-600); }
.gf-stat.r .num { color: var(--red-600); }
.gf-stat.b .num { color: var(--blue-600); }
.gf-up { display: inline-flex; align-items: center; gap: 6px; font-size: 17px; font-weight: 800; }
.gf-up .d { width: 10px; height: 10px; border-radius: 50%; }
.gf-up.up { color: var(--green-600); }
.gf-up.up .d { background: var(--green-500); box-shadow: 0 0 0 4px rgba(16,185,129,.15); }
.gf-up.down { color: var(--red-600); }
.gf-up.down .d { background: var(--red-500); }

/* ===== Drawer ===== */
.scrim-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.48);
  backdrop-filter: blur(3px); z-index: 1200;
  opacity: 0; visibility: hidden; transition: .28s;
}
.scrim-overlay.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 94vw;
  background: var(--surface); z-index: 1201;
  transform: translateX(105%); transition: transform .32s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; gap: 11px; padding: 18px 20px; border-bottom: 1px solid var(--ink-100); }
.drawer-head .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.drawer-head .ic svg { width: 18px; height: 18px; }
.drawer-head h3 { flex: 1; font-size: 15px; font-weight: 700; color: var(--ink-900); }
.drawer-head .sub { font-size: 11.5px; color: var(--ink-400); font-weight: 500; margin-top: 2px; }
.drawer-close { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--ink-400); transition: var(--tr); }
.drawer-close:hover { background: var(--ink-100); color: var(--ink-800); }
.drawer-close svg { width: 17px; height: 17px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--ink-100); display: flex; gap: 9px; justify-content: flex-end; }
.detail-block { margin-bottom: 20px; }
.detail-block .bh { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand-500); margin-bottom: 7px; display: flex; align-items: center; gap: 6px; }
.detail-row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--ink-100); }
.detail-row:last-child { border-bottom: none; }
.detail-row .k { color: var(--ink-400); font-size: 12px; font-weight: 500; flex: none; }
.detail-row .v { color: var(--ink-800); font-weight: 600; font-size: 12.5px; text-align: right; }
.thread { display: flex; flex-direction: column; gap: 12px; }
.thread-item { display: flex; gap: 10px; }
.thread-item .av { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; background: linear-gradient(135deg,var(--brand-500),var(--accent-500)); color: #fff; font-weight: 700; font-size: 11px; }
.thread-item .body { flex: 1; min-width: 0; }
.thread-item .meta { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.thread-item .meta .nm { font-weight: 600; font-size: 12px; color: var(--ink-800); }
.thread-item .meta .tm { font-size: 10.5px; color: var(--ink-400); }
.thread-item .bubble { background: var(--ink-50); border: 1px solid var(--ink-100); border-radius: 10px; padding: 9px 11px; font-size: 12px; color: var(--ink-600); line-height: 1.55; }

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; z-index: 1300; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal .back { position: absolute; inset: 0; background: rgba(15,23,42,.48); backdrop-filter: blur(3px); animation: fadeUp .22s; }
.modal .box { position: relative; width: 480px; max-width: 100%; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: popIn .28s cubic-bezier(.34,1.4,.5,1); overflow: hidden; }
@keyframes popIn { from{opacity:0;transform:scale(.94) translateY(8px)} to{opacity:1;transform:scale(1) translateY(0)} }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--ink-100); }
.modal-head h3 { font-size: 15px; font-weight: 700; color: var(--ink-900); }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--ink-100); display: flex; gap: 9px; justify-content: flex-end; }

/* ===== Toast ===== */
.toast-container, .toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 1400; display: flex; flex-direction: column; gap: 9px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--ink-200);
  border-left: 3px solid var(--green-500); border-radius: 11px;
  padding: 12px 14px; box-shadow: var(--shadow-lg); font-size: 12.5px;
  font-weight: 500; color: var(--ink-800); animation: slideInRight .3s cubic-bezier(.34,1.4,.5,1); min-width: 240px;
}
.toast svg { width: 16px; height: 16px; color: var(--green-500); flex: none; }
.toast .toast-icon { font-size: 18px; }
.toast.success .toast-icon, .toast.success svg { color: var(--green-500); }
.toast.error { border-left-color: var(--red-500); }
.toast.error .toast-icon, .toast.error svg { color: var(--red-500); }
.toast.warning { border-left-color: var(--amber-500); }
.toast.warning .toast-icon, .toast.warning svg { color: var(--amber-500); }
.toast-content { flex: 1; }
.toast-title { font-weight: 700; font-size: 13px; color: var(--ink-900); }
.toast-message { font-size: 12px; color: var(--ink-500); margin-top: 2px; }
.toast-close { color: var(--ink-400); padding: 3px; border-radius: 5px; transition: var(--tr); }
.toast-close:hover { background: var(--ink-100); color: var(--ink-700); }

/* ===== CoLo ===== */
.split-form { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 20px; align-items: start; }
.map-prev {
  position: relative; height: 140px; border-radius: 11px; overflow: hidden;
  border: 1px solid var(--ink-200);
  background: linear-gradient(rgba(18,135,168,.06),rgba(20,184,166,.06)),
    repeating-linear-gradient(0deg,transparent,transparent 21px,var(--ink-100) 21px,var(--ink-100) 22px),
    repeating-linear-gradient(90deg,transparent,transparent 21px,var(--ink-100) 21px,var(--ink-100) 22px),
    var(--ink-50);
}
.map-prev .pin { position: absolute; left: 50%; top: 46%; transform: translate(-50%,-100%); color: var(--red-500); }
.map-prev .pin svg { width: 28px; height: 28px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.22)); }
.map-prev .coords { position: absolute; left: 9px; bottom: 9px; right: 9px; background: var(--surface); border: 1px solid var(--ink-200); border-radius: 7px; padding: 6px 9px; font-size: 11px; font-weight: 600; color: var(--ink-700); display: flex; justify-content: space-between; }
.rail-card { background: var(--surface); border: 1px solid var(--ink-200); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.rail-card .rh { display: flex; align-items: center; gap: 8px; padding: 13px 16px; border-bottom: 1px solid var(--ink-100); font-weight: 700; font-size: 13.5px; color: var(--ink-900); }
.rail-card .rb { padding: 16px; }
.steps { display: flex; flex-direction: column; }
.step { display: flex; gap: 11px; position: relative; padding-bottom: 18px; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--ink-200); }
.step:last-child::before { display: none; }
.step.done::before { background: var(--accent-500); }
.step .num { width: 27px; height: 27px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--ink-100); color: var(--ink-500); z-index: 1; }
.step.done .num { background: linear-gradient(135deg,var(--brand-500),var(--accent-500)); color: #fff; }
.step.active .num { background: var(--brand-50); color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-50); }
.step .st { font-weight: 600; font-size: 12.5px; color: var(--ink-800); }
.step .sd { font-size: 11px; color: var(--ink-400); margin-top: 2px; line-height: 1.5; }
.support-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.support-row .si { width: 32px; height: 32px; border-radius: 8px; background: var(--ink-50); display: grid; place-items: center; color: var(--brand-500); flex: none; }
.support-row .si svg { width: 16px; height: 16px; }
.support-row .sl { font-size: 10.5px; color: var(--ink-400); font-weight: 500; }
.support-row .sv { font-size: 12.5px; color: var(--ink-800); font-weight: 600; }
.input-grp { display: flex; align-items: stretch; }
.input-grp .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-grp .suffix { display: flex; align-items: center; padding: 0 12px; background: var(--ink-100); border: 1.5px solid var(--ink-200); border-left: none; border-radius: 0 9px 9px 0; font-size: 12px; font-weight: 600; color: var(--ink-500); }

/* ===== Empty State ===== */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 54px 20px; text-align: center; }
.empty .ic { width: 64px; height: 64px; border-radius: 18px; background: var(--ink-100); display: grid; place-items: center; color: var(--ink-300); margin-bottom: 16px; }
.empty .ic svg { width: 30px; height: 30px; }
.empty h4 { font-size: 15px; font-weight: 700; color: var(--ink-700); }
.empty p { font-size: 12.5px; color: var(--ink-400); margin-top: 5px; max-width: 320px; }
.empty-state { text-align: center; padding: 36px !important; color: var(--ink-400); }

/* ===== Spinner ===== */
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid var(--ink-200); border-top-color: var(--brand-500);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Callout ===== */
.callout { display: flex; gap: 13px; padding: 16px; border-radius: 12px; background: var(--amber-50); border: 1px solid rgba(245,158,11,.28); }
.callout .ic { width: 38px; height: 38px; border-radius: 10px; background: var(--amber-500); color: #fff; display: grid; place-items: center; flex: none; }
.callout .ic svg { width: 19px; height: 19px; }
.callout h4 { font-size: 13.5px; font-weight: 700; color: var(--ink-900); margin-bottom: 4px; }
.callout p { font-size: 12.5px; color: var(--ink-600); line-height: 1.6; }

/* ===== Misc ===== */
.rag { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 12px; white-space: nowrap; }
.rag .d { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.rag.g .d { background: var(--green-500); box-shadow: 0 0 0 3px rgba(16,185,129,.15); }
.rag.a .d { background: var(--amber-500); }
.rag.r .d { background: var(--red-500); }
.rag.g { color: var(--green-600); }
.rag.a { color: var(--amber-600); }
.rag.r { color: var(--red-600); }
.view-all-btn { font-size: 12px; font-weight: 600; color: var(--brand-500); text-decoration: none; padding: 5px 10px; border-radius: 7px; transition: var(--tr); }
.view-all-btn:hover { background: var(--brand-50); }
.premium-card { background: var(--surface); border: 1px solid var(--ink-200); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px; }

/* Progress panel */
.progress-panel { position: fixed; bottom: 24px; right: 24px; width: 320px; background: var(--surface); border: 1px solid var(--ink-200); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 1000; overflow: hidden; }
.progress-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--ink-100); background: var(--ink-50); }
.progress-panel-body { padding: 14px; }
.progress-item-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.progress-bar-container { height: 4px; background: var(--ink-200); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg,var(--brand-500),var(--accent-500)); border-radius: 4px; transition: width .3s; }
.progress-status { font-size: 11px; color: var(--ink-400); margin-top: 5px; }
.action-icon { cursor: pointer; font-size: 19px; color: var(--ink-400); transition: color var(--tr); }
.action-icon:hover { color: var(--ink-700); }
.filename { font-size: 12.5px; font-weight: 600; color: var(--ink-800); }
.percent { font-size: 12px; font-weight: 700; color: var(--brand-500); }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 6px); right: 0; background: var(--surface); border: 1px solid var(--ink-200); border-radius: 11px; box-shadow: var(--shadow-md); z-index: 200; min-width: 180px; overflow: hidden; display: none; }
.dropdown-menu.open { display: block; animation: fadeUp .22s ease; }
.dropdown-header { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-400); padding: 9px 14px 7px; border-bottom: 1px solid var(--ink-100); }
.dropdown-item { padding: 9px 14px; font-size: 13px; color: var(--ink-700); cursor: pointer; transition: var(--tr); font-weight: 500; }
.dropdown-item:hover { background: var(--brand-50); color: var(--brand-500); }
.dropdown-item.active { color: var(--brand-500); font-weight: 600; }

/* ===== Animations ===== */
@keyframes fadeUp { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
@keyframes slideInRight { from{opacity:0;transform:translateX(36px)} to{opacity:1;transform:translateX(0)} }

/* ===== Responsive ===== */
@media(max-width:1200px) {
  .stats-grid, .dash-stats-grid { grid-template-columns: repeat(2,1fr); }
  .grid-2, .dash-analytics-grid, .dash-content-grid { grid-template-columns: 1fr; }
  .gf-grid { grid-template-columns: 1fr 1fr; }
  .gf-grid.charts { grid-template-columns: 1fr; }
  .split-form { grid-template-columns: 1fr; }
}
@media(max-width:900px) {
  .form-grid-4 { grid-template-columns: 1fr 1fr; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media(max-width:768px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-width) !important; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .top-nav { left: 0 !important; }
  .main-content { margin-left: 0 !important; padding: 16px; }
  body.has-imp-banner .main-content { padding-top: calc(44px + var(--topnav-height) + 16px); }
  body:not(.has-imp-banner) .main-content { padding-top: calc(var(--topnav-height) + 16px); }
  .stats-grid, .dash-stats-grid { grid-template-columns: 1fr 1fr; }
  .gf-grid { grid-template-columns: 1fr; }
  .nav-center { display: none; }
  .pill-status { display: none; }
  .tbl-toolbar { padding: 10px 14px; }
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
}
@media(max-width:480px) {
  .stats-grid, .dash-stats-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 18px; }
  .top-nav { padding: 0 14px; }
  #dynamicLogo { height: 36px; }
}

/* Theme Toggle Icons */
html[data-theme="light"] .theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .moon { display: none; }

/* ===== Offcanvas ===== */
.offcanvas-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.4); z-index: 1040;
  opacity: 0; visibility: hidden; transition: 0.3s;
}
.offcanvas-overlay.show { opacity: 1; visibility: visible; }

.offcanvas-panel {
  position: fixed; top: 0; right: 0; width: 400px; height: 100vh;
  background: var(--surface); z-index: 1050;
  transform: translateX(100%); transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.offcanvas-panel.show { transform: translateX(0); }
.offcanvas-header { padding: 16px 20px; border-bottom: 1px solid var(--ink-200); display: flex; justify-content: space-between; align-items: center; }
.offcanvas-title { font-size: 16px; font-weight: 700; color: var(--ink-900); margin: 0; }
.offcanvas-body { padding: 20px; overflow-y: auto; flex: 1; }
.detail-row { display: flex; justify-content: space-between; align-items: flex-start; }
.detail-label { font-size: 12.5px; font-weight: 600; color: var(--ink-500); width: 120px; flex-shrink: 0; }
.detail-value { font-size: 13.5px; color: var(--ink-800); flex-grow: 1; font-weight: 500; }
