/* Road24 Analytics — design tokens */
:root {
  --bg: #0f1419;
  --bg-2: #131a21;
  --card: #172029;
  --card-2: #1d2832;
  --border: #1c2530;
  --border-2: #2a3744;
  --text: #e8eef2;
  --text-2: #7a8a94;
  --text-3: #56646d;
  --cyan: #2dd4bf;
  --cyan-glow: rgba(45, 212, 191, 0.30);
  --cyan-dim: rgba(45, 212, 191, 0.12);
  --green: #4ade80;
  --green-glow: rgba(74, 222, 128, 0.28);
  --green-dim: rgba(74, 222, 128, 0.12);
  --warn: #fbbf24;
  --warn-dim: rgba(251, 191, 36, 0.14);
  --danger: #fb7185;
  --danger-dim: rgba(251, 113, 133, 0.14);
  --violet: #a78bfa;
  --violet-dim: rgba(167, 139, 250, 0.14);
  --r-card: 12px;
  --r-btn: 8px;
  --r-pill: 999px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 56px;
}

/* Theme B — Warm Amber */
html.theme-amber {
  --bg: #1a1410;
  --bg-2: #1f1813;
  --card: #241c15;
  --card-2: #2c231a;
  --border: #2a2018;
  --border-2: #3a2d20;
  --text: #f0e9e2;
  --text-2: #9a8a78;
  --text-3: #6e6052;
  --cyan: #f5a524;
  --cyan-glow: rgba(245, 165, 36, 0.30);
  --cyan-dim: rgba(245, 165, 36, 0.12);
  --green: #84cc16;
  --green-glow: rgba(132, 204, 22, 0.28);
  --green-dim: rgba(132, 204, 22, 0.12);
  --warn: #fb923c;
  --warn-dim: rgba(251, 146, 60, 0.14);
  --danger: #f43f5e;
  --danger-dim: rgba(244, 63, 94, 0.14);
  --violet: #c084fc;
  --violet-dim: rgba(192, 132, 252, 0.14);
}

/* Theme C — Light Clean */
html.theme-light {
  --bg: #f8fafc;
  --bg-2: #f1f5f9;
  --card: #ffffff;
  --card-2: #f1f5f9;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --text: #0f172a;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --cyan: #2563eb;
  --cyan-glow: rgba(37, 99, 235, 0.25);
  --cyan-dim: rgba(37, 99, 235, 0.10);
  --green: #16a34a;
  --green-glow: rgba(22, 163, 74, 0.22);
  --green-dim: rgba(22, 163, 74, 0.10);
  --warn: #d97706;
  --warn-dim: rgba(217, 119, 6, 0.10);
  --danger: #dc2626;
  --danger-dim: rgba(220, 38, 38, 0.10);
  --violet: #7c3aed;
  --violet-dim: rgba(124, 58, 237, 0.10);
}

html.theme-light ::-webkit-scrollbar-thumb { background: #cbd5e1; }
html.theme-light ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-gutter: stable;
}

.mono {
  font-family: 'JetBrains Mono', 'Menlo', monospace;
  font-feature-settings: 'tnum' 1;
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #2a2a3e;
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: #353550;
}

/* App shell — horizontal nav */
.app-h {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topnav {
  background: rgba(18, 18, 26, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topnav-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 32px;
}

/* Grouped nav — DROPDOWN style */
.topnav-groups {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.topnav-dropdown {
  position: relative;
}

.topnav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 140ms, color 140ms, border-color 140ms;
  white-space: nowrap;
}
.topnav-link:hover {
  color: var(--text);
  background: var(--card);
  border-color: var(--border);
}
.topnav-link.active {
  color: var(--cyan);
  background: var(--cyan-dim);
  border-color: rgba(0, 212, 255, 0.25);
}
.topnav-link.open {
  background: var(--card);
  color: var(--text);
  border-color: var(--border-2);
}

/* Dropdown menu */
@keyframes navpop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
.topnav-menu-pop {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 280px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,212,255,0.04);
  z-index: 80;
  animation: navpop 140ms ease;
}
.topnav-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  border: 0;
  width: 100%;
  cursor: pointer;
  transition: background 120ms;
  color: var(--text);
}
.topnav-menu-item:hover { background: var(--card); }
.topnav-menu-item.active { background: var(--cyan-dim); }
.topnav-menu-item .ico {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: var(--card);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--text-2);
  flex-shrink: 0;
}
.topnav-menu-item.active .ico {
  background: rgba(0,212,255,0.15);
  color: var(--cyan);
  border-color: rgba(0,212,255,0.3);
}
.topnav-menu-item .lbl {
  font-size: 13.5px;
  font-weight: 500;
}
.topnav-menu-item.active .lbl { color: var(--cyan); }
.topnav-menu-item .sub {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 1px;
}
.topnav-menu-foot {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding: 6px;
  display: flex;
}
.topnav-menu-foot .btn { flex: 1; justify-content: center; }

/* Big prominent search trigger */
.topnav-search {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 16px;
  color: var(--text-3);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 140ms, color 140ms, background 140ms;
  min-width: 340px;
  flex-shrink: 0;
}
.topnav-search:hover {
  border-color: var(--cyan);
  color: var(--text-2);
  background: var(--card-2);
}
.topnav-search > span:not(.topnav-kbd) {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topnav-kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-3);
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 4px;
}

.app-h .main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.app-h .page {
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 28px 64px;
}

@media (max-width: 1100px) {
  .topnav-inner { flex-wrap: wrap; }
  .topnav-search { min-width: 100%; }
}

.notif-shade {
  position: fixed;
  inset: 64px 0 0 0;
  z-index: 50;
}
.notif-pop {
  position: fixed;
  top: 72px;
  right: 28px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-2);
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background 160ms, color 160ms, border-color 160ms;
  font-size: 13.5px;
  white-space: nowrap;
}
.nav-item:hover {
  background: var(--card);
  color: var(--text);
}
.nav-item.active {
  background: var(--cyan-dim);
  color: var(--cyan);
  border-left-color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.08);
}
.nav-item .ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.collapsed .sidebar .brand-name,
.collapsed .sidebar .brand-sub,
.collapsed .sidebar .nav-item span.lbl {
  display: none;
}
.collapsed .sidebar .nav-item {
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.collapse-btn {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
}
.collapse-btn:hover { background: var(--card); color: var(--text); }

/* Main */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: 60px;
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(18, 18, 26, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}
.topbar .crumb {
  color: var(--text-3);
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 1px;
}
.topbar .grow { flex: 1; }
.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  width: 280px;
  color: var(--text-2);
}
.topbar-search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 13px;
}
.topbar .user {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a2a3e, #1c1c2e);
  border: 1px solid var(--border-2);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
}
.bell {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  position: relative;
}
.bell:hover { background: var(--card); color: var(--text); }
.bell::after {
  content: '';
  position: absolute;
  top: 8px; right: 9px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan-glow);
}

.page {
  padding: 24px 28px 64px 28px;
  animation: fadein 280ms ease;
}
@keyframes fadein {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 18px;
}
.card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-h h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
  letter-spacing: 0.2px;
}
.card-h .sub {
  color: var(--text-2);
  font-size: 11.5px;
}

/* Grid helpers */
.grid { display: grid; gap: 16px; }
.g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-2-asym-30-70 { grid-template-columns: 30% 1fr; }

/* Metric card */
.metric {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: border-color 160ms, transform 160ms;
}
.metric:hover {
  border-color: var(--border-2);
}
.metric.clickable {
  cursor: pointer;
}
.metric.clickable:hover {
  border-color: var(--cyan);
  transform: translateY(-1px);
}
.metric.clickable .metric-arrow {
  position: absolute;
  right: 14px;
  top: 14px;
  color: var(--text-3);
  opacity: 0;
  transition: opacity 140ms, transform 140ms;
}
.metric.clickable:hover .metric-arrow {
  opacity: 1;
  color: var(--cyan);
  transform: translateX(2px);
}

/* Anomaly banner */
.anomaly-banner {
  background: linear-gradient(90deg, rgba(255, 140, 0, 0.10), rgba(255, 140, 0, 0.02));
  border: 1px solid rgba(255, 140, 0, 0.25);
  border-radius: var(--r-card);
  padding: 14px 18px;
}
.metric .label {
  font-size: 11.5px;
  color: var(--text-2);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}
.metric .value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.5px;
  font-family: 'JetBrains Mono', monospace;
}
.metric .delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
}
.delta.up { color: var(--green); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--text-2); }

/* Pulse dot */
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
  position: relative;
}
.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--green);
  opacity: 0.6;
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(2); opacity: 0; }
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.cyan { background: var(--cyan-dim); color: var(--cyan); border-color: rgba(0, 212, 255, 0.25); }
.badge.green { background: var(--green-dim); color: var(--green); border-color: rgba(0, 255, 136, 0.25); }
.badge.warn { background: var(--warn-dim); color: var(--warn); border-color: rgba(255, 140, 0, 0.3); }
.badge.danger { background: var(--danger-dim); color: var(--danger); border-color: rgba(255, 71, 87, 0.3); }
.badge.violet { background: var(--violet-dim); color: var(--violet); border-color: rgba(167, 139, 250, 0.3); }
.badge.gray { background: rgba(255,255,255,0.04); color: var(--text-2); border-color: var(--border-2); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-btn);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-2);
  background: var(--card);
  color: var(--text);
  transition: background 140ms, border-color 140ms, box-shadow 140ms;
}
.btn:hover { background: var(--card-2); border-color: var(--border-2); }
.btn.primary {
  background: var(--cyan);
  color: #001821;
  border-color: var(--cyan);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.18);
}
.btn.primary:hover { background: #1de0ff; box-shadow: 0 0 12px var(--cyan-glow); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.icon { padding: 6px; min-width: 30px; justify-content: center; }

/* Pill / chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  font-size: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all 140ms;
}
.chip:hover { border-color: var(--border-2); }
.chip.active { background: var(--cyan-dim); color: var(--cyan); border-color: rgba(0, 212, 255, 0.4); }
.chip .x { color: var(--text-3); font-size: 10px; margin-left: 2px; }
.chip.tag {
  font-size: 11px;
  padding: 2px 8px;
  border: 0;
}

/* Select / input */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 11.5px;
  color: var(--text-2);
  letter-spacing: 0.3px;
}
.input, .select {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 140ms, box-shadow 140ms;
  min-width: 0;
}
.input:focus, .select:focus {
  border-color: var(--border-2);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.03);
}
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 14px) 13px, calc(100% - 9px) 13px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

/* Table */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--card);
  overflow: hidden;
}
table.t {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.t th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-2);
  font-weight: 500;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.012);
  white-space: nowrap;
}
table.t td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr {
  transition: background 140ms, box-shadow 140ms;
  cursor: pointer;
}
table.t tbody tr:hover {
  background: rgba(0, 212, 255, 0.04);
  box-shadow: inset 2px 0 0 var(--cyan);
}
table.t tbody tr.selected {
  background: rgba(0, 212, 255, 0.06);
  box-shadow: inset 2px 0 0 var(--cyan);
}
table.t th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 140ms;
}
table.t th.sortable:hover {
  color: var(--cyan);
}

input[type="checkbox"].ck {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--border-2);
  background: var(--card);
  cursor: pointer;
  position: relative;
  transition: all 140ms;
  margin: 0;
  display: inline-block;
  vertical-align: middle;
}
input[type="checkbox"].ck:hover { border-color: var(--cyan); }
input[type="checkbox"].ck:checked {
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 6px rgba(0,212,255,0.4);
}
/* Sidebar — tooltip in collapsed mode */
.nav-wrap {
  position: relative;
}
.collapsed .nav-tip {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 8px 12px;
  white-space: nowrap;
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms;
  z-index: 100;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
.collapsed .nav-tip::before {
  content: '';
  position: absolute;
  left: -5px; top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 8px; height: 8px;
  background: var(--bg-2);
  border-left: 1px solid var(--border-2);
  border-bottom: 1px solid var(--border-2);
}
.collapsed .nav-wrap:hover .nav-tip {
  opacity: 1;
}

/* Topbar search button */
.topbar-search-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  width: 320px;
  color: var(--text-3);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms, color 140ms;
}
.topbar-search-btn:hover {
  border-color: var(--border-2);
  color: var(--text-2);
}
.topbar-search-btn span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Bell with badge */
.bell-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg);
  font-family: 'JetBrains Mono', monospace;
}
.bell[data-unread="true"]::after {
  display: none;
}

/* Command Palette */
@keyframes cmdfade {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: none; }
}
.cmd-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: grid;
  align-items: start;
  justify-items: center;
  padding-top: 12vh;
  animation: cmdfade 180ms ease;
}
.cmd {
  width: min(640px, 92vw);
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,212,255,0.08);
}
.cmd-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.cmd-search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 15px;
}
.cmd-kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-3);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
}
.cmd-list {
  max-height: 50vh;
  overflow-y: auto;
  padding: 6px;
}
.cmd-section {
  font-size: 10px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 12px 4px;
}
.cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms;
}
.cmd-item.sel {
  background: var(--cyan-dim);
}
.cmd-ico {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.cmd-item.sel .cmd-ico {
  background: rgba(0,212,255,0.15);
  border-color: rgba(0,212,255,0.35);
}
.cmd-label {
  font-size: 13.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmd-sub {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmd-empty {
  padding: 32px 12px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.cmd-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-3);
}
.cmd-foot kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 3px;
}

/* Notifications dropdown */
.notif-shade {
  position: fixed;
  inset: 60px 0 0 var(--sidebar-w, 232px);
  z-index: 50;
}
.collapsed .notif-shade { left: 68px; }
.notif-pop {
  position: absolute;
  top: 56px;
  right: 64px;
  width: 380px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.45);
  z-index: 51;
  overflow: hidden;
  animation: cmdfade 160ms ease;
}
.notif-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.notif-list {
  max-height: 50vh;
  overflow-y: auto;
}
.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 140ms;
  cursor: pointer;
}
.notif-item:hover { background: rgba(255,255,255,0.02); }
.notif-item.read { opacity: 0.65; }
.notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}
.notif-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

/* Skeleton */
@keyframes skel {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Density */
body[data-density="compact"] table.t td { padding: 7px 12px; font-size: 12px; }
body[data-density="compact"] table.t th { padding: 8px 12px; }
body[data-density="spacious"] table.t td { padding: 18px 14px; }
body[data-density="spacious"] table.t th { padding: 16px 14px; }

/* Settings page — clean sub-nav */
.settings-page {
  padding-top: 32px !important;
}
.settings-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.settings-nav {
  position: sticky;
  top: 110px;
  display: flex;
  flex-direction: column;
  width: 240px;
  flex-shrink: 0;
}
.settings-nav-title {
  padding: 0 4px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.settings-nav-group {
  margin-bottom: 18px;
}
.settings-nav-group-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 12px;
  margin-bottom: 4px;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  transition: background 140ms, color 140ms;
  position: relative;
}
.settings-nav-item:hover {
  background: var(--card);
  color: var(--text);
}
.settings-nav-item.active {
  background: var(--cyan-dim);
  color: var(--cyan);
}
.settings-nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 6px; bottom: 6px;
  width: 2px;
  background: var(--cyan);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--cyan-glow);
}
.settings-nav-item.locked {
  opacity: 0.45;
  cursor: not-allowed;
}
.settings-nav-item .lbl {
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-nav-item .ct {
  font-size: 10px;
  background: var(--bg-2);
  color: var(--text-2);
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
}
.settings-nav-item.active .ct {
  background: rgba(0,212,255,0.18);
  color: var(--cyan);
  border-color: rgba(0,212,255,0.3);
}
.settings-nav-footer {
  margin-top: auto;
  padding: 14px 12px 0;
  border-top: 1px solid var(--border);
}
.settings-content {
  min-width: 0;
}
.settings-content .card {
  padding: 28px;
}
.settings-content .card + .card,
.settings-content .col > .card + .card {
  margin-top: 0;
}

/* Announcement actions */
.ann-actions {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  opacity: 0;
  transition: opacity 140ms;
}
.announcement:hover .ann-actions { opacity: 1; }
.announcement.pinned .ann-actions { opacity: 1; }
.ann-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: 11px;
  cursor: pointer;
  transition: all 140ms;
}
.ann-action:hover { color: var(--text); border-color: var(--border-2); background: var(--card); }
.ann-action.active { color: var(--cyan); border-color: rgba(0,212,255,0.3); background: var(--cyan-dim); }

/* Improved perm-legend (no colored backgrounds) */
.perm-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-top: 16px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}
.perm-legend .legend-sep { display: none; }
.perm-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
}
.perm-legend .legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 140ms;
}
.session-card:hover { border-color: var(--border-2); }

/* Role switcher in settings nav */
.role-switcher {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 18px;
}
.role-switcher-pills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}
.role-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11.5px;
  cursor: pointer;
  transition: all 140ms;
  white-space: nowrap;
}
.role-pill:hover {
  color: var(--text);
  background: var(--card-2);
}
.role-pill.active {
  color: var(--cyan);
  background: var(--cyan-dim);
  border-color: rgba(0, 212, 255, 0.3);
}

/* Role card */
.role-card {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 140ms;
}
.role-card:hover { border-color: var(--border-2); }

/* Permission matrix legend */
.perm-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-top: 14px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}
.perm-legend .legend-sep {
  width: 1px;
  height: 14px;
  background: var(--border);
  margin: 0 4px;
}

/* Permission matrix */
.perm-matrix th { background: var(--card-2); }
.perm-matrix .perm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid;
}
.perm.full { background: var(--cyan-dim); color: var(--cyan); border-color: rgba(0,212,255,0.3); }
.perm.view { background: rgba(167,139,250,0.12); color: var(--violet); border-color: rgba(167,139,250,0.3); }
.perm.none { background: rgba(255,255,255,0.03); color: var(--text-3); border-color: var(--border); }

/* SMS tabs */
.sms-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.sms-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-2);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background 140ms, color 140ms;
  position: relative;
}
.sms-tab:hover { color: var(--text); }
.sms-tab.active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.sms-tab .ct {
  font-size: 10px;
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-3);
}
.sms-tab.active .ct {
  background: var(--cyan-dim);
  color: var(--cyan);
}

/* Device link in SMS */
.device-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11.5px;
  color: var(--cyan);
  cursor: pointer;
  transition: all 140ms;
  font-family: 'JetBrains Mono', monospace;
}
.device-link:hover {
  background: var(--cyan-dim);
  border-color: rgba(0,212,255,0.3);
}

/* SMS rows */
@keyframes sms-in {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: none; }
}
.sms-row:hover {
  background: rgba(0, 212, 255, 0.04);
}
/* Unread indicator is now only a left dot in the message, no full-row tint */

/* SMS archive button — clear column */
.sms-archive-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 28px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-3);
  cursor: pointer;
  transition: all 140ms;
}
.sms-archive-btn:hover {
  color: var(--cyan);
  background: var(--cyan-dim);
  border-color: rgba(0, 212, 255, 0.3);
}

/* Density toggle (segmented icon group) */
.density-toggle {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.density-toggle button {
  padding: 6px 9px;
  color: var(--text-3);
  background: transparent;
  border: 0;
  cursor: pointer;
  border-right: 1px solid var(--border);
  transition: background 140ms, color 140ms;
}
.density-toggle button:last-child { border-right: 0; }
.density-toggle button:hover { color: var(--text-2); }
.density-toggle button.active {
  background: var(--cyan-dim);
  color: var(--cyan);
}

/* Saved views row */
.saved-views {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Toggle disabled */
.toggle.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.primary.danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 0 12px rgba(255, 71, 87, 0.35);
}
.btn.primary.danger:hover { background: #ff6c79; }

/* ============================ HOME PAGE ============================ */
.home-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 12px 0 24px;
  border-bottom: 1px solid var(--border);
}
.home-shortcuts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.home-shortcut {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 140ms, transform 140ms, background 140ms, box-shadow 240ms;
  min-width: 150px;
  position: relative;
}
.home-shortcut:hover {
  border-color: var(--cyan);
  background: var(--card-2);
  transform: translateY(-1px);
}
.home-shortcut.flash {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.25), 0 0 18px rgba(0, 212, 255, 0.15);
}
.shortcut-delta {
  display: inline-flex;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  vertical-align: middle;
  font-family: 'JetBrains Mono', monospace;
  animation: navpop 220ms ease;
}
.shortcut-delta.up { background: var(--green-dim); color: var(--green); border: 1px solid rgba(0,255,136,0.3); }
.shortcut-delta.down { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(255,71,87,0.3); }
.home-shortcut > svg { color: var(--cyan); flex-shrink: 0; }
.home-shortcut .lbl { font-size: 13px; font-weight: 500; }
.home-shortcut .sub { font-size: 11px; color: var(--text-3); margin-top: 1px; font-family: 'JetBrains Mono', monospace; }

/* Announcement */
.announcement {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  position: relative;
  transition: border-color 140ms;
}
.announcement:hover { border-color: var(--border-2); }
.announcement.pinned {
  border-color: rgba(0, 212, 255, 0.3);
  background: linear-gradient(180deg, var(--cyan-dim) 0%, var(--card-2) 100%);
}
.pin-marker {
  position: absolute;
  top: -10px;
  left: 16px;
  background: var(--bg-2);
  border: 1px solid rgba(0, 212, 255, 0.4);
  color: var(--cyan);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
}

/* Changelog */
.changelog-row {
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}
.changelog-row:last-child { border-bottom: 0; padding-bottom: 0; }
.changelog-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
}
.changelog-list li::marker { color: var(--cyan); }

.changelog-form {
  background: var(--card-2);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
  animation: navpop 180ms ease;
}
.changelog-textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  min-height: 100px;
}
/* Announcement form */
.ann-form {
  background: var(--card-2);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
  animation: navpop 180ms ease;
}
.ann-form-h {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.ann-cats {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 12px;
  transition: all 140ms;
}
.cat-chip:not(.cat-add):not(.active):hover { border-color: var(--border-2); }
.cat-chip.active {
  border-color: var(--cat-color, var(--cyan));
  background: rgba(0, 212, 255, 0.08);
  color: var(--text);
}
.cat-chip-main {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 10px;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: inherit;
  font-size: 12px;
}
.cat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cat-edit {
  display: grid; place-items: center;
  width: 18px; height: 18px;
  background: transparent;
  border: 0;
  color: var(--text-3);
  cursor: pointer;
  border-radius: 50%;
  transition: all 140ms;
  opacity: 0;
}
.cat-chip:hover .cat-edit { opacity: 1; }
.cat-edit:hover { background: var(--card); color: var(--cyan); }
.cat-x {
  display: grid; place-items: center;
  width: 18px; height: 18px;
  background: transparent;
  border: 0;
  color: var(--text-3);
  cursor: pointer;
  margin-right: 4px;
  border-radius: 50%;
  transition: all 140ms;
  opacity: 0;
}
.cat-chip:hover .cat-x { opacity: 1; }
.cat-x:hover { background: rgba(255,71,87,0.15); color: var(--danger); }
.cat-chip.cat-add {
  border-style: dashed;
  color: var(--text-3);
  padding: 5px 12px 5px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
}
.cat-chip.cat-add:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  border-style: solid;
}
.cat-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}
.cat-colors {
  display: flex;
  gap: 4px;
}
.cat-colors button {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 120ms;
}
.cat-colors button:hover { transform: scale(1.1); }
.cat-colors button.sel { border-color: var(--text); }

/* Notes */
.note-input {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
.note-input textarea {
  width: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 13px;
  resize: none;
  min-height: 50px;
  font-family: inherit;
  line-height: 1.5;
}
.note-colors {
  display: flex;
  gap: 6px;
}
.note-colors .nc {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 120ms;
  padding: 0;
}
.note-colors .nc:hover { transform: scale(1.15); }
.note-colors .nc.sel { border-color: var(--text); }

.note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  transition: opacity 140ms;
}
.note.done { opacity: 0.55; }
.note.done .note-text { text-decoration: line-through; color: var(--text-3); }
.note-check {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  display: grid;
  place-items: center;
  padding: 0;
}
.note-text {
  flex: 1;
  color: var(--text);
}
.note-x {
  background: transparent;
  border: 0;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 140ms, color 140ms;
}
.note:hover .note-x { opacity: 1; }
.note-x:hover { color: var(--danger); }

/* Fixed-height scrollable notes area */
.notes-scroll {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
  margin-right: -4px;
  scrollbar-gutter: stable;
}

@media (max-width: 1100px) {
  .home-hero { grid-template-columns: 1fr; }
  .home-shortcuts { grid-template-columns: repeat(2, 1fr); }
}

/* ============================ DEVICES PAGE ============================ */

/* Drill banner */
.drill-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--cyan-dim);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
}

/* Header row */
.dev-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.dev-bulk {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  background: var(--card);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 10px;
  animation: navpop 180ms ease;
}

/* Toolbar */
.dev-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.dev-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  min-width: 200px;
  flex: 1;
}
.dev-search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 13px;
  min-width: 0;
}
.dev-search-clear {
  background: transparent;
  border: 0;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: grid;
  place-items: center;
}
.dev-search-clear:hover { color: var(--text); background: var(--card); }

.dev-select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 30px 7px 12px;
  color: var(--text);
  font-size: 12.5px;
  outline: none;
  cursor: pointer;
  transition: border-color 140ms;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 14px) 13px, calc(100% - 9px) 13px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.dev-select:hover { border-color: var(--border-2); }
.dev-select:focus { border-color: var(--cyan); }

/* Saved views dropdown */
.views-dd { position: relative; }
.views-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 260px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.5);
  z-index: 60;
  animation: navpop 140ms ease;
}
.views-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  color: var(--text);
  transition: background 120ms;
}
.views-item:hover { background: var(--card); }
.views-item.active { background: var(--cyan-dim); color: var(--cyan); }
.views-item.add { color: var(--text-2); justify-content: center; padding: 8px; }
.views-item.add:disabled { opacity: 0.4; cursor: not-allowed; }
.views-item .x {
  background: transparent;
  border: 0;
  color: var(--text-3);
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  display: grid; place-items: center;
}
.views-item:hover .x { color: var(--text); }
.views-item .x:hover { color: var(--danger); background: rgba(255,71,87,0.1); }

/* Anomaly cause block */
.anomaly-cause {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.anomaly-cause .ac-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.anomaly-cause .ac-row:last-child { border-bottom: 0; }
.anomaly-cause .ac-label {
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  flex: 1;
  min-width: 0;
}

/* Color swatch in modals */
.color-swatch {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 120ms;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.sel { border-color: var(--text); box-shadow: 0 0 0 3px var(--bg-2); }

/* Permission matrix — clickable cells */
.perm-btn {
  cursor: pointer;
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  transition: all 140ms;
}
.perm-btn:not(.locked):hover {
  filter: brightness(1.2);
  transform: scale(1.05);
}
.perm-btn.locked { cursor: not-allowed; opacity: 0.85; }

/* Filter applied toast */
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.filter-toast {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--bg-2);
  border: 1px solid rgba(0, 255, 136, 0.35);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 0 0 1px rgba(0,255,136,0.1);
  animation: toast-in 200ms ease;
}

/* Spinner */
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid var(--border-2);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Topbar role switcher */
.topnav-role { position: relative; }
.topnav-role-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 140ms, background 140ms;
  white-space: nowrap;
}
.topnav-role-btn:hover { border-color: var(--border-2); }
.topnav-role-btn.preview {
  border-color: var(--warn);
  background: var(--warn-dim);
  color: var(--warn);
}

/* Role preview banner (sub-topbar) */
.role-preview-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 28px;
  background: var(--warn-dim);
  border-bottom: 1px solid rgba(255, 140, 0, 0.3);
  font-size: 12.5px;
  color: var(--text);
  position: sticky;
  top: 60px;
  z-index: 49;
  animation: navpop 200ms ease;
}
.role-picker { position: relative; min-width: 160px; }
.role-picker-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  width: 100%;
  transition: border-color 140ms, background 140ms;
}
.role-picker-btn:hover { border-color: var(--border-2); }
.role-picker-btn.open { border-color: var(--cyan); background: var(--card); }
.role-picker-btn.disabled {
  opacity: 0.7;
  cursor: not-allowed;
  border-style: dashed;
}
.role-picker-btn > svg { margin-left: auto; }
.rp-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.role-picker-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 280px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.5);
  z-index: 80;
  animation: navpop 140ms ease;
}
.role-picker-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: var(--text);
  transition: background 120ms;
}
.role-picker-item:hover { background: var(--card); }
.role-picker-item.active { background: var(--cyan-dim); }
.role-picker-item:disabled { opacity: 0.4; cursor: not-allowed; }
.role-picker-item .rp-dot { margin-top: 5px; }
.rp-name { font-size: 13px; font-weight: 500; }
.rp-desc { font-size: 11.5px; color: var(--text-3); margin-top: 2px; line-height: 1.45; }

/* Invite role grid */
.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.role-card-btn {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 140ms;
}
.role-card-btn:hover { border-color: var(--border-2); }
.role-card-btn.active {
  border-color: var(--cyan);
  background: var(--cyan-dim);
}

/* Invite preview */
.invite-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.invite-preview-h {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.invite-preview-body {
  padding: 16px;
}
.invite-preview-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.invite-preview-form .input {
  background: var(--card-2);
  border-style: dashed;
}
.funnel-v3 {
  padding: 4px 0;
}
.funnel-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(0,212,255,0.08) 0%, rgba(167,139,250,0.05) 100%);
  border: 1px solid rgba(0, 212, 255, 0.18);
  border-radius: 12px;
  margin-bottom: 20px;
}
.fh-left {
  display: flex;
  align-items: center;
  gap: 18px;
}
.fh-from, .fh-to {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text);
}
.fh-from { opacity: 0.7; }
.fh-arc {
  text-align: right;
}
.fh-arc-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 36px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: -1px;
  line-height: 1;
}
.fh-arc-lbl {
  font-size: 10px;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: 4px;
}

/* Horizontal flow */
.funnel-flow {
  display: flex;
  align-items: stretch;
  gap: 12px;
  height: 96px;
  margin-bottom: 16px;
  padding-right: 28px;
}
.ff-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 110px;
  transition: filter 200ms;
}
.ff-stage:hover { filter: brightness(1.15); }
.ff-bar {
  height: 44px;
  background: var(--stage-color);
  border-radius: 6px;
  box-shadow: 0 0 10px var(--stage-color), inset 0 1px 0 rgba(255,255,255,0.15);
  opacity: 0.85;
  transition: opacity 140ms;
}
.ff-stage:hover .ff-bar { opacity: 1; }
.ff-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 2px 0;
  min-width: 0;
}
.ff-name {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ff-stats {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.ff-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}
.ff-pct {
  font-size: 11px;
  color: var(--stage-color);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}
.ff-drop {
  position: absolute;
  top: -12px;
  right: -10px;
  z-index: 2;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.ff-drop.worst {
  border-color: rgba(255, 71, 87, 0.4);
  color: var(--danger);
  background: var(--danger-dim);
}
.ff-stage.worst .ff-bar {
  box-shadow: 0 0 12px var(--stage-color), inset 0 1px 0 rgba(255,255,255,0.15), 0 0 0 2px rgba(255,71,87,0.35);
}

.funnel-callout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--danger-dim);
  border: 1px solid rgba(255, 71, 87, 0.25);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
}
.funnel-callout strong { color: var(--text); font-weight: 500; }

@media (max-width: 900px) {
  .funnel-hero { flex-direction: column; align-items: flex-start; gap: 12px; }
  .funnel-flow { flex-direction: column; height: auto; }
  .ff-stage { min-width: 100%; }
  .ff-bar { width: var(--stage-w, 100%); }
  .ff-drop { position: static; align-self: flex-end; margin-top: 4px; }
}
.funnel-v2 {
  padding: 4px 0;
}
.funnel-summary {
  display: flex;
  align-items: stretch;
  gap: 20px;
  padding: 16px 20px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 20px;
}
.fs-item {
  flex: 1;
  min-width: 0;
}
.fs-item .fs-label {
  font-size: 10.5px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}
.fs-item .fs-value {
  font-size: 22px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.4px;
  color: var(--text);
}
.fs-divider {
  width: 1px;
  background: var(--border);
}

.funnel-stages {
  display: grid;
  grid-template-columns: 1fr 80px 1fr 80px 1fr 80px 1fr;
  align-items: stretch;
  gap: 0;
}
.funnel-stage {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-top: 3px solid var(--stage-color, var(--cyan));
  border-radius: 10px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 200ms, border-color 200ms, box-shadow 200ms;
  cursor: default;
}
.funnel-stage:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.funnel-stage .fs-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.funnel-stage .fs-num {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--stage-color);
  color: #001016;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.25);
  flex-shrink: 0;
}
.funnel-stage .fs-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.funnel-stage .fs-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text);
}
.funnel-stage .fs-bar-wrap {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.funnel-stage .fs-bar {
  height: 100%;
  background: var(--stage-color);
  border-radius: 2px;
  box-shadow: 0 0 6px var(--stage-color);
  transition: width 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.funnel-stage .fs-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11.5px;
}
.funnel-stage .fs-meta-pct {
  color: var(--stage-color);
  font-weight: 600;
  font-size: 13px;
}

/* Connector arrow */
.funnel-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  padding: 0 4px;
  gap: 8px;
}
.funnel-connector svg {
  opacity: 0.5;
  transition: opacity 140ms, color 140ms;
}
.funnel-connector .fc-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.funnel-connector .fc-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.funnel-connector .fc-lost {
  font-size: 9.5px;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}
.funnel-connector.worst {
  color: var(--danger);
}
.funnel-connector.worst svg { opacity: 1; }
.funnel-connector.worst .fc-pct { color: var(--danger); }
.funnel-connector.worst .fc-lost { color: rgba(255, 71, 87, 0.7); }

@media (max-width: 1100px) {
  .funnel-stages {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .funnel-connector {
    flex-direction: row;
    justify-content: center;
    padding: 4px 0;
  }
  .funnel-connector svg { transform: rotate(90deg); }
  .funnel-summary {
    flex-wrap: wrap;
    gap: 14px;
  }
  .fs-divider { display: none; }
}
.styled-select { position: relative; flex: 1; min-width: 0; }
.styled-select-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 140ms, background 140ms;
  white-space: nowrap;
}
.styled-select-btn:hover { border-color: var(--border-2); }
.styled-select-btn.open {
  border-color: var(--cyan);
  background: var(--card);
}
.styled-select-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.5);
  z-index: 60;
  animation: navpop 140ms ease;
  max-height: 320px;
  overflow-y: auto;
}
.styled-select-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  color: var(--text);
  transition: background 120ms;
  white-space: nowrap;
}
.styled-select-item:hover { background: var(--card); }
.styled-select-item.active { background: var(--cyan-dim); color: var(--cyan); }
.styled-select-item .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* USSD templates inside action modal */
.ussd-tpl-form {
  background: var(--bg-2);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
  animation: navpop 160ms ease;
}
.ussd-tpl {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-top: 4px;
}
.ussd-tpl-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
  margin-right: -4px;
  scrollbar-gutter: stable;
}
.ussd-tpl-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background 140ms, border-color 140ms;
}
.ussd-tpl-item:hover { background: var(--card); }
.ussd-tpl-item.active {
  background: var(--cyan-dim);
  border-color: rgba(0, 212, 255, 0.3);
}
.ussd-tpl-apply {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
  text-align: left;
  color: var(--text);
  min-width: 0;
}
.ussd-tpl-code {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cyan);
  min-width: 60px;
  letter-spacing: 0.2px;
}
.ussd-tpl-name {
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ussd-tpl-author {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #001016;
  font-weight: 700;
  font-size: 9.5px;
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
}
.ussd-tpl-del {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--text-3);
  cursor: pointer;
  opacity: 0;
  transition: opacity 140ms, color 140ms, background 140ms;
}
.ussd-tpl-item:hover .ussd-tpl-del { opacity: 1; }
.ussd-tpl-del:hover { color: var(--danger); background: rgba(255,71,87,0.12); }

/* Success modal */
@keyframes success-pop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes success-ring {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(2.4); opacity: 0; }
}
.success-modal {
  padding: 32px 28px 24px;
  text-align: center;
}
.success-burst {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00ff88, #00cc6c);
  display: grid;
  place-items: center;
  margin: 0 auto 4px;
  box-shadow: 0 0 24px rgba(0, 255, 136, 0.45);
  animation: success-pop 360ms cubic-bezier(0.2, 0.9, 0.3, 1.4);
}
.success-burst::before,
.success-burst::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(0, 255, 136, 0.7);
  animation: success-ring 900ms ease-out forwards;
}
.success-burst::after {
  animation-delay: 180ms;
}

.archive-info {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 16px;
  text-align: left;
}
.archive-info .ar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.archive-info .ar-row:last-child { border-bottom: 0; }
.ussd-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
  margin-right: -4px;
  scrollbar-gutter: stable;
}

.sim-history-scroll {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
  margin-right: -4px;
  scrollbar-gutter: stable;
}
.ussd-item {
  background: rgba(0,0,0,0.22);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ussd-cmd, .ussd-resp {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ussd-arrow {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.ussd-arrow.out { background: var(--violet-dim); color: var(--violet); border: 1px solid rgba(167,139,250,0.3); }
.ussd-arrow.in { background: var(--green-dim); color: var(--green); border: 1px solid rgba(0,255,136,0.3); }
.ussd-cmd-body { flex: 1; min-width: 0; }
.ussd-cmd-label {
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 1px;
}
.ussd-cmd-code {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.ussd-resp-text {
  font-size: 13px;
  color: var(--text);
}
.ussd-cmd-tag {
  padding: 2px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.apps-hero {
  display: flex;
  align-items: stretch;
  gap: 20px;
  padding: 16px 22px;
  background: linear-gradient(135deg, rgba(0,212,255,0.05) 0%, rgba(167,139,250,0.03) 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.apps-hero-item { flex: 1; min-width: 0; }
.apps-hero-item .muted.tiny { font-size: 10.5px; letter-spacing: 0.5px; text-transform: uppercase; }
.apps-hero-v {
  font-family: 'JetBrains Mono', monospace;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text);
  margin: 4px 0 2px;
  line-height: 1;
}
.apps-hero-divider { width: 1px; background: var(--border); }

.apps-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.apps-group { }
.apps-group-h {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 0 4px;
}
.apps-group-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text-3);
}
.apps-group-ct {
  font-size: 10px;
  color: var(--text-3);
  background: var(--card-2);
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.app-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 140ms, transform 140ms;
}
.app-card:hover {
  border-color: var(--border-2);
  transform: translateY(-1px);
}
.app-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}
.app-info {
  flex: 1;
  min-width: 0;
}
.app-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.app-match {
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-match-bar {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.04);
  border-radius: 2px;
  overflow: hidden;
}
.app-match-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 240ms;
}
.tl-hero {
  display: flex;
  align-items: stretch;
  gap: 20px;
  padding: 18px 22px;
  background: linear-gradient(135deg, rgba(0,212,255,0.05) 0%, rgba(0,255,136,0.03) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 18px;
}
.tl-hero-item { flex: 1; min-width: 0; }
.tl-hero-item .muted.tiny { font-size: 10.5px; letter-spacing: 0.5px; text-transform: uppercase; }
.tl-hero-v {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text);
  margin: 4px 0 2px;
  line-height: 1;
}
.tl-hero-divider {
  width: 1px;
  background: var(--border);
}

.tl-chart-card {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  overflow: hidden;
}
.tl-chart-card svg {
  width: 100%;
  height: auto;
}

.tl-detail {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}
.tl-ticks-row,
.tl-row {
  display: grid;
  grid-template-columns: 56px 1fr 64px;
  align-items: center;
  gap: 14px;
  padding: 6px 0;
}
.tl-ticks-row {
  padding: 0 4px 8px;
  color: var(--text-3);
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.tl-row {
  padding: 10px 4px;
  border-top: 1px solid var(--border);
}
.tl-row:first-of-type { border-top: 0; }
.tl-day-col { font-size: 13px; font-weight: 600; color: var(--text); padding-left: 4px; }
.tl-day-col .tl-day-name { padding-left: 0; }
.tl-pct-col { text-align: right; padding-right: 4px; font-size: 13px; }
.tl-track-col {
  position: relative;
  height: 22px;
  background: rgba(255,255,255,0.02);
  border-radius: 5px;
  overflow: hidden;
}
.tl-ticks-row .tl-track-col {
  background: transparent;
  height: 14px;
  overflow: visible;
}
.tl-ticks-row .tl-pct-col,
.tl-ticks-row .tl-day-col { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-3); font-weight: 400; }
.tl-tick {
  position: absolute; top: 0;
  transform: translateX(-50%);
}
.tl-tick-label { font-size: 9.5px; }
.tl-grid {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: rgba(255,255,255,0.04);
}
.tl-night {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(0,0,0,0.18);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.tl-session {
  position: absolute;
  top: 3px; bottom: 3px;
  background: linear-gradient(180deg, #00ff88 0%, #00cc6c 100%);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(0,255,136,0.35), inset 0 1px 0 rgba(255,255,255,0.18);
  min-width: 3px;
  cursor: pointer;
  transition: transform 140ms, box-shadow 140ms, filter 140ms;
}
.tl-session:hover {
  transform: scaleY(1.15);
  filter: brightness(1.1);
  box-shadow: 0 0 14px rgba(0,255,136,0.55), inset 0 1px 0 rgba(255,255,255,0.25);
  z-index: 2;
}
.tl-legend {
  display: flex;
  gap: 16px;
  padding-top: 14px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

@media (max-width: 800px) {
  .tl-hero { flex-direction: column; gap: 12px; padding: 14px; }
  .tl-hero-divider { display: none; }
}
.timeline-v2 {
  display: flex;
  flex-direction: column;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.timeline-v2-ticks {
  display: grid;
  grid-template-columns: 60px 1fr 70px;
  align-items: center;
  padding: 0 4px 8px;
  font-size: 10px;
  color: var(--text-3);
  gap: 12px;
}
.timeline-v2-ticks .tlv-uptime-col {
  text-align: right;
  font-size: 10px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-3);
  padding-right: 14px;
  font-weight: 400;
}
.tlv-row {
  display: grid;
  grid-template-columns: 60px 1fr 70px;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.tlv-row:last-child { border-bottom: 0; }
.tlv-day-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 14px;
}
.tlv-day-label .day {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.tlv-track {
  position: relative;
  height: 28px;
  background: rgba(255, 255, 255, 0.025);
  border-radius: 6px;
  overflow: hidden;
}
.tlv-grid-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.04);
}
.tlv-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
}
.tlv-tick-label {
  font-size: 9.5px;
  color: var(--text-3);
}
.tlv-session {
  position: absolute;
  top: 4px; bottom: 4px;
  background: linear-gradient(180deg, #00ff88, #00cc6c);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 140ms;
  min-width: 3px;
}
.tlv-session:hover {
  transform: scaleY(1.1);
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  z-index: 2;
}
.tlv-uptime-col {
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  padding-right: 14px;
}

.tlv-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tlv-stat-v {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.4px;
  margin-top: 2px;
}

/* ============================ PERMISSIONS LIST ============================ */
.perm-group {
  margin-bottom: 16px;
}
.perm-group:last-child { margin-bottom: 0; }
.perm-group-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
}
.perm-row:last-child { border-bottom: 0; }
.perm-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.perm-name {
  font-size: 12.5px;
  color: var(--text);
}
.perm-key {
  font-size: 10.5px;
  color: var(--text-3);
  letter-spacing: 0.2px;
}

.comment-btn {
  position: relative;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 9px;
  color: var(--text-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 140ms;
  min-width: 32px;
  line-height: 1;
}
.comment-btn:hover {
  color: var(--text);
  border-color: var(--border-2);
}
.comment-btn.has {
  color: var(--cyan);
  background: var(--cyan-dim);
  border-color: rgba(0, 212, 255, 0.3);
}
.comment-btn .ct {
  font-size: 10.5px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}

.comment-pop {
  position: absolute;
  width: 360px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.5);
  z-index: 90;
  display: flex;
  flex-direction: column;
  max-height: 480px;
  animation: navpop 140ms ease;
}
.comment-pop-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.comment-pop-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
  max-height: 260px;
}
.comment-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.comment-item:last-child { border-bottom: 0; }
.comment-pop-foot {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
}
.comment-pop-foot textarea {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  resize: none;
  min-height: 60px;
  outline: none;
}
.comment-pop-foot textarea:focus { border-color: var(--cyan); }

/* Comment edit/delete actions */
.comment-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 140ms;
}
.comment-item:hover .comment-actions { opacity: 1; }
.comment-action-btn {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text-3);
  cursor: pointer;
  transition: all 140ms;
}
.comment-action-btn:hover {
  color: var(--cyan);
  background: var(--cyan-dim);
  border-color: rgba(0, 212, 255, 0.3);
}
.comment-action-btn.danger:hover {
  color: var(--danger);
  background: rgba(255, 71, 87, 0.1);
  border-color: rgba(255, 71, 87, 0.3);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: cmdfade 160ms ease;
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  overflow: hidden;
}
.modal-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
}
.modal-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.online { background: var(--green); box-shadow: 0 0 8px var(--green-glow); }
.status-dot.offline { background: var(--text-3); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 8px rgba(255, 140, 0, 0.4); }

.health-bar {
  width: 36px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  position: relative;
  overflow: hidden;
}
.health-bar .fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
}

.copy-btn {
  margin-left: 6px;
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--text-3);
  font-size: 11px;
  border: 1px solid transparent;
  background: transparent;
  transition: all 140ms;
}
.copy-btn:hover {
  color: var(--cyan);
  background: var(--cyan-dim);
}

.copy-phone {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 140ms;
  position: relative;
}
.copy-phone:hover {
  background: var(--cyan-dim);
  color: var(--cyan);
  border-color: rgba(0, 212, 255, 0.2);
}
.copy-phone.copied {
  background: var(--green-dim);
  color: var(--green);
  border-color: rgba(0, 255, 136, 0.3);
}
.copy-phone.copied::after {
  content: '✓ copied';
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  font-size: 10px;
  background: var(--card);
  color: var(--green);
  border: 1px solid rgba(0,255,136,0.3);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
  pointer-events: none;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 140ms, border-color 140ms;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.kv {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px 18px;
  font-size: 13px;
}
.kv .k { color: var(--text-2); }
.kv .v { color: var(--text); }

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-bar .field { min-width: 140px; }
.filter-bar .grow { flex: 1; }

/* Number counter */
.count {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* ============================ FUNNEL V4 (vertical) ============================ */
.funnel-v4 { padding: 4px 0; }

.funnel-vertical {
  display: flex;
  flex-direction: column;
  padding: 0 4px;
  margin-bottom: 18px;
}
.fv-step { display: flex; flex-direction: column; }

.fv-connector {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0 8px 234px;
  height: 32px;
}
.fv-conn-line {
  flex: 1;
  height: 1px;
  background: repeating-linear-gradient(to right, var(--border) 0 6px, transparent 6px 12px);
}
.fv-drop {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}
.fv-drop-pct { font-size: 12px; font-weight: 600; color: var(--text-2); }
.fv-drop-lost { font-size: 10.5px; color: var(--text-3); }
.fv-connector.worst .fv-drop {
  border-color: rgba(255, 71, 87, 0.4);
  background: var(--danger-dim);
}
.fv-connector.worst .fv-drop-pct { color: var(--danger); }
.fv-connector.worst .fv-drop-lost { color: rgba(255, 71, 87, 0.75); }

.fv-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  align-items: center;
  padding: 4px 0;
}
.fv-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.fv-num {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--stage-color);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.fv-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fv-sub {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 2px;
}
.fv-bar-wrap {
  height: 36px;
  background: rgba(255, 255, 255, 0.025);
  border-radius: 6px;
}
.fv-bar {
  height: 100%;
  background: var(--stage-color);
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 0 14px rgba(0, 212, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 14px;
  min-width: 80px;
  transition: filter 200ms;
}
.fv-bar:hover { filter: brightness(1.1); }
.fv-count {
  font-size: 13.5px;
  font-weight: 600;
  color: #001016;
}

/* Hide v3 horizontal flow when v4 is present (just in case both render) */
.funnel-v4 .funnel-flow { display: none; }
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
}
.funnel-bar {
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.6), rgba(0, 212, 255, 0.15));
  border: 1px solid rgba(0, 212, 255, 0.4);
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  position: relative;
}
.funnel-bar .pct {
  position: absolute;
  right: 14px;
  color: var(--cyan);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.funnel-drop {
  font-size: 11px;
  color: var(--danger);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}
.funnel-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--text);
  text-align: right;
  min-width: 100px;
}

/* Heatmap */
.heatmap {
  display: grid;
  grid-template-columns: 40px repeat(24, 1fr);
  gap: 3px;
}
.heatmap .lbl { font-size: 10px; color: var(--text-3); display: grid; place-items: center; }
.heatmap .cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: rgba(0, 212, 255, 0.06);
  transition: transform 120ms, box-shadow 120ms;
  cursor: pointer;
}
.heatmap .cell:hover { transform: scale(1.3); box-shadow: 0 0 8px var(--cyan-glow); z-index: 1; position: relative; }

/* Tag cloud */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-cloud .t {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  transition: all 140ms;
}
.tag-cloud .t:hover { border-color: var(--cyan); color: var(--cyan); }
.tag-cloud .t .n {
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  margin-left: 6px;
}

/* SMS log */
.sms-feed {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sms-feed .row {
  display: grid;
  grid-template-columns: 90px 130px 130px 1fr 80px;
  gap: 14px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  font-size: 12.5px;
  animation: slidein 280ms ease;
}
@keyframes slidein {
  from { opacity: 0; transform: translateY(-6px); background: var(--cyan-dim); }
  to { opacity: 1; transform: none; background: transparent; }
}
.sms-feed .row:hover { background: rgba(0, 212, 255, 0.03); }
.sms-feed .ts { color: var(--text-3); font-family: 'JetBrains Mono', monospace; font-size: 11.5px; }
.sms-feed .did { color: var(--cyan); font-family: 'JetBrains Mono', monospace; font-size: 11.5px; }
.sms-feed .sender { color: var(--text); font-weight: 500; }
.sms-feed .msg { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Big banner */
.banner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px 28px;
  border-radius: var(--r-card);
  margin-bottom: 24px;
}
.banner.ok {
  background: linear-gradient(90deg, rgba(0, 255, 136, 0.12), rgba(0, 255, 136, 0.02));
  border: 1px solid rgba(0, 255, 136, 0.3);
}
.banner.bad {
  background: linear-gradient(90deg, rgba(255, 71, 87, 0.14), rgba(255, 71, 87, 0.02));
  border: 1px solid rgba(255, 71, 87, 0.35);
}
.banner .big {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 700;
}
.banner.ok .big { background: rgba(0, 255, 136, 0.15); color: var(--green); box-shadow: 0 0 20px var(--green-glow); }
.banner.bad .big { background: rgba(255, 71, 87, 0.15); color: var(--danger); }
.banner h2 { margin: 0; font-size: 20px; font-weight: 600; }
.banner p { margin: 4px 0 0; color: var(--text-2); font-size: 13px; }

/* Settings form */
.form-section {
  border-top: 1px solid var(--border);
  padding: 22px 0;
}
.form-section:first-of-type { border-top: 0; }
.form-section h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.form-section p.desc { margin: 0 0 16px; color: var(--text-2); font-size: 12.5px; }

.toggle {
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 160ms;
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text);
  top: 2px; left: 2px;
  transition: left 160ms;
}
.toggle.on { background: var(--cyan); box-shadow: 0 0 10px var(--cyan-glow); }
.toggle.on::after { left: 18px; background: #001016; }

/* Misc utility */
.hbar {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--text-2); }
.tiny { font-size: 11px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.gap-3 { gap: 12px; }
.gap-2 { gap: 8px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 14, 0.6);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 100;
  animation: fadein 160ms ease;
}
.modal {
  width: 560px;
  max-width: calc(100vw - 40px);
  background: var(--card);
  border: 1px solid var(--border-2);
  border-radius: var(--r-card);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 212, 255, 0.06);
  animation: modal-in 200ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal-h {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-body { padding: 20px; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.012);
  border-radius: 0 0 var(--r-card) var(--r-card);
}
