/* Zira Admin — design system (dark / light)
   Aligned with DESIGN.md: modern teal #0F766E, Cairo, soft gradients. */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --bg-accent: #0f172a;
  --surface: #151d2b;
  --surface-2: #1e293b;
  --surface-3: #243044;
  --border: #2a384c;
  --border-strong: #3a4d66;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --muted: #94a3b8;
  --primary: #2dd4bf;
  --primary-hover: #14b8a6;
  --primary-soft: rgba(15, 118, 110, 0.28);
  --primary-soft-text: #5eead4;
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.16);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.16);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.16);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.14);
  --accent: #14b8a6;
  --warm: #c2410c;
  --vpn: #7c3aed;
  --hover: rgba(255, 255, 255, 0.04);
  --row-hover: rgba(45, 212, 191, 0.06);
  --inset: rgba(0, 0, 0, 0.22);
  --overlay: rgba(4, 8, 16, 0.72);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 8px 18px rgba(0, 0, 0, 0.28);
  --glow: 0 0 0 3px rgba(45, 212, 191, 0.28);
  --hero-bg:
    linear-gradient(135deg, rgba(15, 118, 110, 0.28), rgba(11, 17, 32, 0.4) 52%),
    var(--surface);
  --hero-aside: rgba(8, 18, 20, 0.45);
  --page-bg:
    radial-gradient(ellipse 70% 50% at 100% 0%, rgba(15, 118, 110, 0.18), transparent 55%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(194, 65, 12, 0.06), transparent 50%),
    var(--bg);
  --login-bg:
    radial-gradient(circle at 18% 18%, rgba(45, 212, 191, 0.16), transparent 42%),
    radial-gradient(circle at 82% 78%, rgba(194, 65, 12, 0.08), transparent 38%),
    var(--bg);
  --alert-ok: #86efac;
  --alert-warn: #fcd34d;
  --alert-crit: #fca5a5;
  --alert-info: #67e8f9;
  --chat-bg: rgba(0, 0, 0, 0.14);
  --bubble-client: rgba(16, 185, 129, 0.14);
  --radius: 16px;
  --radius-sm: 12px;
  --font: "Cairo", system-ui, sans-serif;
  --sidebar-w: 272px;
  --sidebar-w-collapsed: 78px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --transition: 0.18s var(--ease-out);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --bg-accent: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f6;
  --border: #d1d5db;
  --border-strong: #9ca3af;
  --text: #0f172a;
  --text-muted: #64748b;
  --muted: #64748b;
  --primary: #0f766e;
  --primary-hover: #115e59;
  --primary-soft: rgba(15, 118, 110, 0.1);
  --primary-soft-text: #0f766e;
  --success: #059669;
  --success-soft: rgba(16, 185, 129, 0.12);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --info: #0284c7;
  --info-soft: rgba(2, 132, 199, 0.1);
  --accent: #14b8a6;
  --warm: #c2410c;
  --vpn: #7c3aed;
  --hover: rgba(15, 23, 42, 0.04);
  --row-hover: rgba(15, 118, 110, 0.05);
  --inset: rgba(15, 23, 42, 0.04);
  --overlay: rgba(15, 23, 42, 0.45);
  --shadow: 0 12px 36px rgba(15, 23, 42, 0.1);
  --shadow-sm: 0 8px 18px rgba(15, 23, 42, 0.06);
  --glow: 0 0 0 3px rgba(15, 118, 110, 0.22);
  --hero-bg:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(255, 255, 255, 0.88) 50%),
    var(--surface);
  --hero-aside: rgba(15, 118, 110, 0.06);
  --page-bg:
    radial-gradient(ellipse 70% 50% at 100% 0%, rgba(15, 118, 110, 0.1), transparent 55%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(194, 65, 12, 0.05), transparent 50%),
    var(--bg);
  --login-bg:
    radial-gradient(circle at 18% 18%, rgba(15, 118, 110, 0.12), transparent 42%),
    radial-gradient(circle at 82% 78%, rgba(194, 65, 12, 0.06), transparent 38%),
    var(--bg);
  --alert-ok: #166534;
  --alert-warn: #92400e;
  --alert-crit: #991b1b;
  --alert-info: #155e75;
  --chat-bg: #f1f5f9;
  --bubble-client: rgba(16, 185, 129, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--page-bg);
  background-attachment: fixed;
  color: var(--text);
  transition: background-color var(--transition), color var(--transition);
}

button,
input,
select,
textarea {
  font-family: inherit;
}

a {
  color: var(--primary);
}

#app-root {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.82rem;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.theme-toggle:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.theme-toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.theme-toggle-thumb {
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  transition: inset-inline-start var(--transition), inset-inline-end var(--transition);
}

[data-theme="light"] .theme-toggle-thumb {
  inset-inline-start: auto;
  inset-inline-end: 2px;
}

.theme-toggle-floating {
  position: absolute;
  top: 20px;
  inset-inline-start: 20px;
  z-index: 5;
}

.theme-toggle-nav {
  width: 100%;
  margin-bottom: 8px;
  justify-content: space-between;
}

.sidebar-collapsed .theme-toggle-label {
  display: none;
}

.sidebar-collapsed .theme-toggle-nav {
  justify-content: center;
  padding: 8px;
}

/* Login */
.login-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--login-bg);
}

.login-card {
  width: min(420px, 100%);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  padding: 36px 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  border: none;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 35%, transparent);
}

.login-brand h1 {
  margin: 0 0 8px;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.login-brand p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.field input,
.field select,
.field textarea,
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field textarea,
.form-grid textarea {
  min-height: 88px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--glow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn:not(:disabled):active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--accent)));
  color: white;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 35%, transparent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--hover);
  border-color: var(--border-strong);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: #111;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.82rem;
}

.btn-block {
  width: 100%;
}

.error-text {
  color: var(--danger);
  font-size: 0.88rem;
  margin-top: 8px;
}

.info-text {
  color: var(--info);
  font-size: 0.88rem;
  margin-top: 8px;
}

.login-links {
  margin: 16px 0 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
}

.link-btn:hover:not(:disabled) {
  text-decoration: underline;
}

.link-btn:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.recovery-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.recovery-tab {
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.recovery-tab.active {
  border-color: var(--primary);
  color: var(--text);
  background: var(--primary-soft);
}

/* Shell */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  background: var(--page-bg);
}

.layout.sidebar-collapsed {
  grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}

.sidebar {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-inline-start: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  backdrop-filter: blur(12px);
  box-shadow: inset -1px 0 0 color-mix(in srgb, var(--primary) 8%, transparent);
}

.sidebar-toggle {
  width: 36px;
  height: 36px;
  margin: 0 auto 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.sidebar-toggle:hover {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  color: var(--primary);
}

.sidebar-brand {
  padding: 4px 12px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.sidebar-brand h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--text), var(--primary-soft-text));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sidebar-brand span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.sidebar-brand-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-soft-text);
  font-size: 0.75rem;
  font-weight: 700;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  padding: 4px 12px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.85;
}

.nav-btn {
  width: 100%;
  position: relative;
  text-align: right;
  padding: 11px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.nav-icon {
  display: none;
  min-width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
}

.sidebar-collapsed .sidebar {
  padding-inline: 10px;
}

.sidebar-collapsed .sidebar-brand {
  padding-inline: 0;
  text-align: center;
}

.sidebar-collapsed .sidebar-brand h2,
.sidebar-collapsed .sidebar-brand span,
.sidebar-collapsed .sidebar-brand-badge,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-section-title {
  display: none;
}

.sidebar-collapsed .nav-btn {
  justify-content: center;
  padding-inline: 8px;
}

.sidebar-collapsed .nav-icon {
  display: inline-block;
}

.sidebar-collapsed .nav-badge {
  margin-inline-start: 0;
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 2px;
}

.nav-btn:hover {
  background: var(--hover);
}

.nav-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-btn.active::before {
  content: "";
  position: absolute;
  inset-block: 8px;
  inset-inline-start: 0;
  width: 3px;
  border-radius: 3px;
  background: var(--primary);
}

.nav-btn.active .nav-icon {
  background: color-mix(in srgb, var(--primary) 20%, transparent);
  color: var(--primary);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.main {
  padding: 24px 28px 40px;
  overflow-x: auto;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px 18px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.topbar h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.topbar-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
  line-height: 1.45;
}

.topbar-meta.full {
  margin-top: 0;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), transparent);
  opacity: 0.85;
}

.stat-card.success::before { background: linear-gradient(90deg, var(--success), transparent); }
.stat-card.warning::before { background: linear-gradient(90deg, var(--warning), transparent); }
.stat-card.info::before { background: linear-gradient(90deg, var(--info), transparent); }
.stat-card.danger::before { background: linear-gradient(90deg, var(--danger), transparent); }

.stat-card .label {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
  font-weight: 600;
}

.stat-card .value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat-card.primary .value { color: var(--primary); }
.stat-card.success .value { color: var(--success); }
.stat-card.warning .value { color: var(--warning); }
.stat-card.info .value { color: var(--info); }
.stat-card.danger .value { color: var(--danger); }

.stat-card-clickable {
  cursor: pointer;
  text-align: inherit;
  width: 100%;
  font: inherit;
  color: inherit;
}

.stat-card-clickable:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm), 0 8px 24px color-mix(in srgb, var(--primary) 18%, transparent);
}

.stat-card-clickable:disabled {
  cursor: default;
  opacity: 0.85;
}

.stat-card-clickable.success .value { color: var(--success); }
.stat-card-clickable.info .value { color: var(--info); }

.stat-card-hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel-note {
  margin-bottom: 14px;
}

.online-panel {
  border-color: color-mix(in srgb, var(--success) 40%, var(--border));
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}

.panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.panel-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.dashboard-hero {
  background: var(--hero-bg);
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.85fr);
  gap: 18px;
  align-items: stretch;
}

.dashboard-hero-copy {
  display: grid;
  gap: 14px;
}

.hero-eyebrow {
  color: var(--primary-soft-text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-hero h2 {
  margin: 0;
  font-size: clamp(1.55rem, 2.2vw, 2.15rem);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.dashboard-hero p {
  margin: 0;
  color: var(--muted);
  max-width: 62ch;
  line-height: 1.65;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.hero-metric {
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.hero-metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 6px;
}

.hero-metric strong {
  font-size: 1.2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions-stacked {
  flex-direction: column;
}

.dashboard-hero-aside {
  min-width: 0;
}

.hero-status-card {
  height: 100%;
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: calc(var(--radius) + 2px);
  background: var(--hero-aside);
  border: 1px solid var(--border);
}

.hero-status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-status-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.hero-status-card strong {
  font-size: 2.4rem;
  line-height: 1;
  font-weight: 800;
}

.hero-status-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.hero-status-list {
  display: grid;
  gap: 10px;
}

.hero-status-list div,
.insight-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-status-list span,
.insight-item span {
  color: var(--muted);
  font-size: 0.88rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 340px);
  gap: 20px;
  align-items: start;
}

.dashboard-main,
.dashboard-side {
  min-width: 0;
}

.dashboard-side-panel {
  position: sticky;
  top: 20px;
}

.insight-list {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.insight-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.insight-item strong {
  font-size: 1rem;
}

.insight-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.insight-pill {
  padding: 12px 12px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.insight-pill span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  margin-bottom: 6px;
}

.insight-pill strong {
  font-size: 1rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filters input,
.filters select {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  min-width: 160px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.filters input:focus,
.filters select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--glow);
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.panel > .table-wrap {
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.82rem;
  background: var(--surface-2);
}

.table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-wrap td[dir="ltr"] {
  white-space: normal;
  word-break: break-all;
}

tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
}

tr:hover td {
  background: var(--row-hover) !important;
}

tbody tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-active { background: var(--success-soft); color: var(--success); }
.badge-pending { background: var(--warning-soft); color: var(--warning); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-suspended { background: var(--danger-soft); color: var(--danger); }
.badge-expired { background: var(--surface-3); color: var(--muted); }
.badge-deleted { background: var(--danger-soft); color: var(--danger); }

.pkg-free { color: var(--muted); }
.pkg-pro { color: var(--primary); font-weight: 700; }
.pkg-vpn { color: var(--vpn); font-weight: 700; }

.actions-cell {
  position: relative;
  width: 1%;
}

.action-menu {
  position: relative;
  display: inline-block;
}

.action-menu-toggle {
  min-width: 96px;
}

.action-menu-list {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
}

.action-menu.open .action-menu-list {
  display: block;
}

.action-menu-item {
  display: block;
  width: 100%;
  text-align: right;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.action-menu-item:hover {
  background: var(--surface-2);
}

.action-menu-item.warning {
  color: var(--warning);
}

.action-menu-item.danger {
  color: var(--danger);
}

.action-menu-divider {
  height: 1px;
  margin: 6px 0;
  background: var(--border);
}

.action-menu-label {
  display: block;
  padding: 6px 12px 4px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 1400;
  backdrop-filter: blur(4px);
}

.modal {
  width: min(640px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1401;
  pointer-events: auto;
}

.modal-form-error {
  display: none;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--danger);
  background: color-mix(in srgb, var(--danger-soft) 70%, var(--surface));
  color: var(--text);
  font-size: 0.92rem;
}

.modal-form-error.visible {
  display: block;
}

.modal h3 {
  margin: 0 0 20px;
  font-weight: 800;
}

.modal-wide {
  width: min(960px, 100%);
}

.modal-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.modal-header-row h3 {
  margin: 0 0 8px;
}

.router-perms-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.permissions-grid {
  display: grid;
  gap: 10px;
}

.permission-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.permission-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

#toast-host {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  min-width: 220px;
  opacity: 1;
  transform: translateY(0);
  transition: transform 200ms var(--ease-out), opacity 200ms var(--ease-out);

  @starting-style {
    opacity: 0;
    transform: translateY(12px);
  }
}

.toast.success {
  border-color: var(--success);
  background: color-mix(in srgb, var(--success-soft) 70%, var(--surface));
}

.toast.error {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger-soft) 70%, var(--surface));
}

.toast.warning {
  border-color: var(--warning);
  background: color-mix(in srgb, var(--warning-soft) 70%, var(--surface));
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  margin-inline-start: 8px;
  border-radius: 999px;
  background: var(--warning);
  color: #111827;
  font-size: 0.75rem;
  font-weight: 700;
}

.phone-link {
  color: var(--info);
  text-decoration: none;
  font-weight: 600;
}

.phone-link:hover {
  text-decoration: underline;
}

.activation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.request-name {
  font-weight: 700;
}

.request-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.support-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  min-height: 520px;
}

.support-sidebar,
.support-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.support-search {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 8px;
  background: var(--surface-2);
}

.support-search input,
.support-search select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.support-thread-list {
  max-height: 620px;
  overflow: auto;
}

.support-thread {
  display: block;
  width: 100%;
  text-align: start;
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  color: inherit;
  transition: background var(--transition);
}

.support-thread:hover,
.support-thread.active {
  background: var(--surface-2);
}

.support-thread.active {
  box-shadow: inset -3px 0 0 var(--primary);
}

.support-thread-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.support-thread-meta,
.support-thread-time {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 4px;
}

.support-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.support-chat-messages {
  height: 420px;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--chat-bg);
}

.support-bubble {
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.support-bubble.admin {
  align-self: flex-start;
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: var(--primary-soft);
}

.support-bubble.client {
  align-self: flex-end;
  background: var(--bubble-client);
}

.support-sender {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.support-text {
  white-space: pre-wrap;
  line-height: 1.5;
}

.support-time {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
}

.support-image {
  display: block;
  max-width: 240px;
  border-radius: 10px;
  margin-bottom: 6px;
}

.support-audio {
  display: none;
}

.support-voice {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(240px, 100%);
  margin-bottom: 6px;
  direction: ltr;
}

.support-voice-play {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  color: var(--primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
}

.support-voice-play:disabled {
  opacity: 0.55;
  cursor: wait;
}

.support-voice-play:not(:disabled):hover {
  background: color-mix(in srgb, var(--primary) 28%, transparent);
}

.support-voice-icon-play,
.support-voice-icon-pause {
  display: block;
  width: 0;
  height: 0;
}

.support-voice-icon-play {
  border-style: solid;
  border-width: 7px 0 7px 12px;
  border-color: transparent transparent transparent currentColor;
  margin-inline-start: 2px;
}

.support-voice-icon-pause {
  width: 12px;
  height: 12px;
  border-inline-start: 3px solid currentColor;
  border-inline-end: 3px solid currentColor;
  box-sizing: border-box;
}

.support-voice-play .support-voice-icon-pause {
  display: none;
}

.support-voice-play.is-playing .support-voice-icon-play {
  display: none;
}

.support-voice-play.is-playing .support-voice-icon-pause {
  display: block;
}

.support-voice-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 4px;
}

.support-voice-bar {
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border-strong) 70%, transparent);
  overflow: hidden;
}

.support-voice-progress {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.1s linear;
}

.support-voice-time {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.support-voice-mic {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 2px solid var(--muted);
  border-radius: 999px 999px 6px 6px;
  position: relative;
  opacity: 0.75;
}

.support-voice-mic::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 8px;
  height: 4px;
  border: 2px solid var(--muted);
  border-top: none;
  border-radius: 0 0 6px 6px;
  transform: translateX(-50%);
}

.support-composer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border);
  align-items: end;
  background: var(--surface);
}

.support-composer textarea {
  resize: vertical;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.support-empty {
  display: grid;
  place-items: center;
  min-height: 420px;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.ai-fab {
  position: fixed;
  z-index: 900;
  left: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  pointer-events: none;
}

.ai-fab > * {
  pointer-events: auto;
}

.ai-fab-btn {
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #0f172a));
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--primary) 35%, transparent);
  position: relative;
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.ai-fab-btn:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .ai-fab-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 14px 32px color-mix(in srgb, var(--primary) 45%, transparent);
  }
}

.ai-fab.open .ai-fab-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 8px 20px color-mix(in srgb, #000 18%, transparent);
}

.ai-fab-dot {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--surface);
}

.ai-fab-panel {
  width: min(400px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 18px 50px color-mix(in srgb, #000 28%, transparent);
  overflow: hidden;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: transform 200ms var(--ease-out), opacity 200ms var(--ease-out);

  @starting-style {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
}

.ai-header-actions {
  display: flex;
  gap: 6px;
}

.ai-messages {
  flex: 1;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--chat-bg);
  min-height: 0;
}

.ai-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  opacity: 1;
  transform: translateY(0);
  transition: transform 180ms var(--ease-out), opacity 180ms var(--ease-out);

  @starting-style {
    opacity: 0;
    transform: translateY(12px);
  }
}

.ai-bubble.user {
  align-self: flex-end;
  background: var(--bubble-client);
}

.ai-bubble.assistant {
  align-self: flex-start;
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: var(--primary-soft);
}

.ai-sender {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.ai-text {
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 0.92rem;
}

.ai-tools {
  margin-top: 8px;
  font-size: 0.7rem;
  color: var(--muted);
}

.ai-empty {
  margin: auto;
  max-width: 320px;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
  padding: 16px 8px;
  font-size: 0.9rem;
}

.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.ai-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
  align-items: end;
  background: var(--surface);
  flex-shrink: 0;
}

.ai-composer textarea {
  resize: none;
  min-height: 44px;
  max-height: 96px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
}

.ai-composer textarea:disabled,
.ai-composer button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .ai-fab {
    left: 14px;
    bottom: 14px;
  }

  .ai-fab-panel {
    width: calc(100vw - 28px);
    height: min(70vh, 520px);
  }
}

/* Ops monitoring */
.gauge-grid,
.metrics-kv-grid,
.chart-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}

.gauge-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.metrics-kv-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.metrics-kv-grid div {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.metrics-kv-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.chart-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 280px;
  box-shadow: var(--shadow-sm);
}

.chart-card.wide {
  grid-column: 1 / -1;
  min-height: 320px;
}

.chart-card h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.chart-wrap {
  position: relative;
  height: 240px;
  width: 100%;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.gauge-hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.gauge-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.gauge-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.gauge-track {
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.gauge-fill {
  height: 100%;
  border-radius: 999px;
}

.gauge-fill.gauge-ok,
.gauge-ok { color: var(--success); }
.gauge-fill.gauge-warning,
.gauge-warning { color: var(--warning); }
.gauge-fill.gauge-critical,
.gauge-critical { color: var(--danger); }

.gauge-fill.gauge-ok { background: var(--success); }
.gauge-fill.gauge-warning { background: var(--warning); }
.gauge-fill.gauge-critical { background: var(--danger); }

.gauge-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.alerts-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.alert-box {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.alert-box.ok {
  border-color: color-mix(in srgb, var(--success) 40%, var(--border));
  background: var(--success-soft);
  color: var(--alert-ok);
}

.alert-box.warning {
  border-color: color-mix(in srgb, var(--warning) 40%, var(--border));
  background: var(--warning-soft);
  color: var(--alert-warn);
}

.alert-box.critical {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  background: var(--danger-soft);
  color: var(--alert-crit);
}

.alert-box.info {
  border-color: color-mix(in srgb, var(--info) 40%, var(--border));
  background: var(--info-soft);
  color: var(--alert-info);
}

.tips-stack {
  display: grid;
  gap: 10px;
}

.tip-card {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.tip-card .tip-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.tip-card .tip-message {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.tip-card.tip-info {
  border-color: color-mix(in srgb, var(--info) 35%, var(--border));
  background: var(--info-soft);
}

.tip-card.tip-tip {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--primary) 10%, var(--surface-2));
}

.tip-card.tip-warning {
  border-color: color-mix(in srgb, var(--warning) 40%, var(--border));
  background: var(--warning-soft);
}

.tip-card.tip-critical {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  background: var(--danger-soft);
}

.db-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 16px 0 8px;
}

.db-detail-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.db-detail-card h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.db-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.db-mini-table th,
.db-mini-table td {
  text-align: start;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}

.db-mini-table th {
  color: var(--muted);
  font-weight: 600;
}

.db-mini-table tr:last-child td {
  border-bottom: none;
}

/* Clients table */
.client-actions-compact {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  white-space: nowrap;
}

.icon-btn {
  min-width: 34px;
  padding-inline: 8px;
}

.client-name-cell {
  display: grid;
  gap: 4px;
}

.client-name-cell strong {
  font-weight: 700;
}

.client-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.client-code-cell {
  font-size: 0.85rem;
  white-space: nowrap;
  color: var(--accent);
  letter-spacing: 0.03em;
}

.clients-table-wrap {
  max-height: calc(100vh - 220px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.clients-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface-2);
  box-shadow: 0 1px 0 var(--border);
}

.clients-table .sticky-actions,
.sticky-actions {
  position: sticky;
  inset-inline-start: 0;
  background: var(--surface);
  z-index: 2;
  box-shadow: 4px 0 12px color-mix(in srgb, var(--text) 8%, transparent);
}

.clients-table thead .sticky-actions {
  background: var(--surface-2);
  z-index: 5;
}

/* Client actions modal */
.action-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.action-section {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.action-section h4 {
  margin: 0 0 12px;
  font-size: 0.92rem;
  color: var(--muted);
}

.btn-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.days-control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.days-control-row label {
  font-size: 0.85rem;
  color: var(--muted);
}

.days-control-row input[type="number"] {
  width: 88px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
}

/* OTP admin */
.otp-verification-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 4px;
  background: var(--surface);
}

.otp-verification-banner.is-on {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 40%, var(--border));
}

.otp-verification-banner.is-off {
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 45%, var(--border));
}

.otp-verification-banner.is-partial {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}

.otp-verification-banner-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.otp-verification-banner-text span {
  color: var(--muted);
  font-size: 0.92rem;
}

.otp-layout {
  display: grid;
  gap: 16px;
}

.otp-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  padding: 4px 0 8px;
}

.toggle-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  grid-column: 1 / -1;
}

.toggle-field input {
  width: 18px;
  height: 18px;
}

.field-hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.otp-lookup-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.otp-lookup-row input {
  flex: 1;
  min-width: 200px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.otp-detail-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface-2);
}

.otp-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.otp-detail-header h3 {
  margin: 0;
}

.otp-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.otp-detail-grid .label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.otp-code-display {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.otp-pending-panel .panel-subtitle {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Ops extras */
.notif-wrap {
  position: relative;
}

.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  width: min(340px, 80vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 80;
  overflow: hidden;
}

.notif-wrap.open .notif-dropdown {
  display: block;
}

.notif-dropdown-head {
  padding: 12px 14px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.notif-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: right;
}

.notif-item:hover {
  background: var(--hover);
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  background: var(--primary-soft);
}

.command-palette {
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.command-palette-input {
  width: 100%;
  padding: 16px 18px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
}

.command-palette-input:focus {
  outline: none;
}

.command-palette-list {
  max-height: 360px;
  overflow: auto;
}

.command-palette-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: right;
}

.command-palette-item:hover,
.command-palette-item.active {
  background: var(--primary-soft);
}

.command-palette-foot {
  padding: 10px 16px;
  color: var(--muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
}

.trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 96px;
  overflow-x: auto;
  padding-top: 8px;
}

.trend-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 28px;
}

.trend-bar-fill {
  width: 16px;
  border-radius: 6px 6px 2px 2px;
  background: var(--primary);
}

.trend-bar span {
  font-size: 0.65rem;
  color: var(--muted);
}

.backup-preview {
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  direction: ltr;
  text-align: left;
  white-space: pre-wrap;
}

.support-composer-enhanced {
  grid-template-columns: auto auto 1fr auto;
}

.support-canned-select {
  min-width: 120px;
  max-width: 160px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.topbar-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mobile-menu-btn {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms ease-out, transform 100ms ease-out, border-color 120ms ease-out;
}

.mobile-menu-btn:active {
  transform: scale(0.94);
  background: var(--primary-soft);
}

.mobile-menu-icon {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

.sidebar-backdrop {
  display: none;
}

/* ——— Mobile / tablet shell (Apple fluid sheet) ——— */
@media (max-width: 900px) {
  html,
  body {
    overscroll-behavior: none;
  }

  html.sidebar-drawer-open,
  body.sidebar-drawer-open {
    overflow: hidden;
    touch-action: none;
  }

  .support-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .support-thread-list {
    max-height: min(42vh, 360px);
  }

  .layout,
  .layout.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar-toggle {
    display: none;
  }

  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: min(320px, calc(100vw - 48px));
    max-width: 100%;
    z-index: 120;
    padding:
      max(18px, env(safe-area-inset-top))
      16px
      max(18px, env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left));
    /* Physical X: LTR rail is on the left → hide further left */
    transform: translate3d(-110%, 0, 0);
    transition: transform 320ms cubic-bezier(0.32, 0.72, 0, 1);
    border-inline-start: none;
    border-inline-end: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
    height: 100dvh;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    box-shadow: var(--shadow);
    will-change: transform;
    visibility: hidden;
    pointer-events: none;
  }

  /* RTL: rail on the right → hide further right (translateX is physical) */
  html[dir="rtl"] .sidebar {
    transform: translate3d(110%, 0, 0);
    padding-inline-start: max(14px, env(safe-area-inset-right));
    padding-inline-end: max(16px, env(safe-area-inset-left));
  }

  .layout.sidebar-mobile-open .sidebar {
    transform: translate3d(0, 0, 0);
    visibility: visible;
    pointer-events: auto;
  }

  /* Never keep desktop "icon rail" collapse inside the mobile drawer */
  .layout.sidebar-collapsed .sidebar-brand h2,
  .layout.sidebar-collapsed .sidebar-brand span,
  .layout.sidebar-collapsed .sidebar-brand-badge,
  .layout.sidebar-collapsed .nav-label,
  .layout.sidebar-collapsed .nav-section-title,
  .layout.sidebar-collapsed .theme-toggle-label {
    display: revert;
  }

  .layout.sidebar-collapsed .sidebar {
    padding-inline: 16px;
  }

  .layout.sidebar-collapsed .sidebar-brand {
    padding-inline: 12px;
    text-align: start;
  }

  .layout.sidebar-collapsed .nav-btn {
    justify-content: space-between;
    padding-inline: 14px;
  }

  .layout.sidebar-collapsed .nav-icon {
    display: none;
  }

  .layout.sidebar-collapsed .nav-badge {
    position: static;
    margin-inline-start: 0;
  }

  .layout.sidebar-collapsed .theme-toggle-nav {
    justify-content: space-between;
    padding: 8px 12px;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--overlay) 72%, transparent);
    backdrop-filter: blur(8px) saturate(140%);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    z-index: 110;
    opacity: 0;
    pointer-events: none;
    transition: opacity 280ms cubic-bezier(0.32, 0.72, 0, 1);
  }

  .layout.sidebar-mobile-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .nav-btn {
    min-height: 44px;
    padding: 12px 14px;
  }

  .nav-btn:active {
    transform: scale(0.98);
    background: var(--hover);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-hero,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-side-panel {
    position: static;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-inline: -4px;
    margin-bottom: 16px;
    padding: 12px 14px;
    padding-top: max(12px, env(safe-area-inset-top));
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
  }

  .topbar h1 {
    font-size: 1.2rem;
    line-height: 1.2;
  }

  .topbar-meta {
    font-size: 0.82rem;
  }

  .topbar-actions {
    justify-content: flex-start;
    width: 100%;
    gap: 8px;
  }

  .topbar-actions .btn {
    min-height: 40px;
    flex: 1 1 calc(50% - 4px);
    max-width: 100%;
  }

  .topbar-title-wrap {
    width: 100%;
    min-width: 0;
  }

  .topbar-title-wrap > div {
    min-width: 0;
    flex: 1;
  }

  .topbar-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .filters input,
  .filters select,
  .filters .btn {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .main {
    overflow-x: hidden;
    min-width: 0;
    padding: 12px 14px max(28px, env(safe-area-inset-bottom));
  }

  .panel {
    overflow-x: hidden;
    min-width: 0;
    padding: 16px;
    margin-bottom: 14px;
    border-radius: 14px;
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card .value {
    font-size: 1.45rem;
  }

  .theme-toggle-floating {
    top: max(12px, env(safe-area-inset-top));
    inset-inline-start: max(12px, env(safe-area-inset-left));
  }

  .panel-header {
    gap: 10px;
  }

  .filters input,
  .filters select {
    min-height: 44px;
    font-size: 16px; /* avoid iOS zoom on focus */
  }

  .field input,
  .field select,
  .field textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .field textarea {
    min-height: 96px;
  }

  .table-wrap,
  .clients-table-wrap {
    margin-inline: -4px;
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
  }

  th,
  td {
    padding: 14px 10px;
  }

  .support-composer-enhanced {
    grid-template-columns: 1fr;
  }

  .support-canned-select {
    max-width: none;
    width: 100%;
    min-height: 44px;
  }

  /* Bottom sheet modals */
  .modal-backdrop {
    place-items: end center;
    padding: 0;
    align-content: end;
  }

  .modal,
  .modal-wide {
    width: 100%;
    max-width: 100%;
    max-height: min(92dvh, 100%);
    margin: 0;
    border-radius: 20px 20px 0 0;
    padding: 20px 18px max(20px, env(safe-area-inset-bottom));
    border-bottom: none;
    animation: sheetUp 320ms cubic-bezier(0.32, 0.72, 0, 1);
  }

  .modal::before {
    content: "";
    display: block;
    width: 36px;
    height: 5px;
    margin: 0 auto 16px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--muted) 55%, transparent);
  }

  .modal-actions {
    position: sticky;
    bottom: 0;
    padding-top: 12px;
    background: linear-gradient(to top, var(--surface) 70%, transparent);
  }

  .modal-actions .btn {
    min-height: 44px;
    flex: 1 1 calc(50% - 6px);
  }

  #toast-host {
    left: 12px;
    right: 12px;
    bottom: max(16px, env(safe-area-inset-bottom));
    align-items: stretch;
  }

  .toast {
    min-width: 0;
    width: 100%;
  }

  .login-shell {
    padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
    place-items: center;
  }

  .login-card {
    width: 100%;
    padding: 28px 20px;
    border-radius: 20px;
  }

  .login-brand h1 {
    font-size: 1.45rem;
  }

  .gauge-grid,
  .metrics-kv-grid {
    grid-template-columns: 1fr;
  }

  .chart-card,
  .chart-card.wide {
    min-height: 240px;
  }

  .chart-wrap {
    height: 200px;
  }
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .topbar-actions .btn-primary {
    flex: 1 1 100%;
  }

  .panel-actions .btn,
  .modal-actions .btn {
    width: 100%;
    flex: 1 1 100%;
  }

  .stat-card .value {
    font-size: 1.3rem;
  }
}

@keyframes sheetUp {
  from {
    transform: translate3d(0, 18%, 0);
    opacity: 0.85;
  }
  to {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-backdrop,
  .modal,
  .btn,
  .mobile-menu-btn,
  .nav-btn,
  .toast,
  .ai-fab-panel,
  .ai-bubble,
  .ai-fab-btn {
    transition: opacity 160ms ease !important;
    animation: none !important;
  }

  .btn:not(:disabled):active,
  .mobile-menu-btn:active,
  .nav-btn:active,
  .ai-fab-btn:active {
    transform: none;
  }

  .toast,
  .ai-fab-panel,
  .ai-bubble {
    transform: none !important;
  }
}

@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  .sidebar {
    transition: opacity 160ms ease, visibility 160ms ease !important;
  }

  .layout:not(.sidebar-mobile-open) .sidebar {
    transform: none !important;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .layout.sidebar-mobile-open .sidebar {
    transform: none !important;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .sidebar,
  .topbar,
  .login-card,
  .sidebar-backdrop {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .sidebar,
  .topbar,
  .login-card {
    background: var(--surface);
  }

  .sidebar-backdrop {
    background: var(--overlay);
  }
}

@media (max-width: 900px) {
  .diag-grid {
    grid-template-columns: 1fr;
  }
}

/* Router diagnostics modal */
.diag-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.diag-grid h4 {
  margin: 0 0 10px;
  font-weight: 700;
}

.diag-log {
  margin: 0 0 16px;
  padding: 12px 14px;
  max-height: 240px;
  overflow: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

/* ISP / org admin workspace */
.org-admin-layout {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.org-list-panel {
  border-color: color-mix(in srgb, #0f766e 28%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, #0f766e 10%, transparent), transparent 48%),
    var(--surface);
}

.org-list-panel .panel-header h2 {
  color: color-mix(in srgb, #14b8a6 55%, var(--text));
}

.org-detail-panel {
  border-color: color-mix(in srgb, #14b8a6 22%, var(--border));
}

.org-admin-layout .data-table tbody tr.row-selected {
  background: color-mix(in srgb, #0f766e 14%, var(--surface-2));
  box-shadow: inset 3px 0 0 #0f766e;
}

.org-admin-layout .data-table tbody tr[data-action="select-org"]:hover {
  background: color-mix(in srgb, #0f766e 8%, var(--row-hover));
}

/* Global selection + scrollbar (ops console polish) */
::selection {
  background: color-mix(in srgb, var(--primary) 35%, transparent);
  color: var(--text);
}

* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--primary) 45%, var(--border)) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--primary) 40%, var(--border));
  border-radius: 999px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

/* marketing-lead-agent */
.marketing-layout { display: flex; flex-direction: column; gap: 1rem; }
.marketing-stats { margin: 0; }
.marketing-grid { align-items: start; }
.marketing-platform-row { display: flex; flex-wrap: wrap; gap: 1rem; }
.marketing-discovery-note {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: var(--surface-muted, #f7f3ea);
  border: 1px solid var(--border-color, #d6d0c4);
  line-height: 1.55;
  font-size: 0.92rem;
}
.marketing-warn {
  margin-top: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid #d4a017;
  background: #fff8e6;
  color: #6a4b00;
  font-size: 0.9rem;
}
.marketing-howto {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--border-color, #d6d0c4);
  background: #eef7f1;
  font-size: 0.92rem;
  line-height: 1.55;
}
.marketing-howto ol {
  margin: 0.45rem 0 0 1.1rem;
  padding: 0;
}
.marketing-howto li { margin: 0.25rem 0; }
.marketing-keys-panel {
  margin: 0.85rem 0 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border-color, #d6d0c4);
  border-radius: 12px;
  background: var(--surface-muted, #f7f3ea);
}
.marketing-keys-panel > summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.marketing-keys-form .field input[type="password"] {
  width: 100%;
  margin-top: 0.35rem;
}
.marketing-clear-key {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
  font-size: 0.82rem;
  opacity: 0.85;
}
.marketing-key-status { margin-top: 0.2rem; }
.marketing-chip-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.marketing-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  max-height: 180px;
  overflow: auto;
  padding: 0.25rem 0;
}
.marketing-results-panel {
  order: -1;
}
.marketing-leads-table-wrap {
  max-height: min(62vh, 640px);
  overflow: auto;
}
.marketing-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.5rem 0 0.75rem;
}
.marketing-lead-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.marketing-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.25rem 0;
}
.marketing-summary::-webkit-details-marker { display: none; }
.marketing-config-panel,
.marketing-layout details.panel {
  padding-top: 0.75rem;
}
.marketing-custom-kw {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.65rem;
  align-items: center;
}
.marketing-custom-kw input {
  flex: 1;
  min-width: 0;
}
.btn-danger {
  color: #9b1c1c;
  border-color: #f1aeb5;
  background: #fff5f5;
}
.marketing-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.marketing-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border-color, #d6d0c4);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-size: 0.86rem;
  user-select: none;
}
.marketing-chip:has(input:checked) {
  border-color: var(--primary, #1f7a4c);
  background: rgba(31, 122, 76, 0.08);
}
.marketing-chip input { margin: 0; }
.marketing-activity { max-height: 360px; overflow: auto; display: flex; flex-direction: column; gap: 0.65rem; }
.marketing-event { padding: 0.65rem 0.75rem; border: 1px solid var(--border-color, #d6d0c4); border-radius: 10px; background: var(--surface-muted, #f7f3ea); }
.marketing-event-warn { border-color: #d4a017; }
.marketing-event-error { border-color: #c0392b; }
.marketing-event-msg { font-size: 0.92rem; }
.marketing-lead-detail textarea { width: 100%; min-height: 80px; }
.stat-sub { margin-top: 0.35rem; font-size: 0.78rem; opacity: 0.75; }

/* Growth segments */
.growth-view { display: flex; flex-direction: column; gap: 16px; }
.growth-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.growth-card {
  text-align: start;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.growth-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}
.growth-card-label { font-size: 0.85rem; color: var(--text-muted); }
.growth-card-count { font-size: 1.6rem; font-weight: 700; margin-top: 6px; }
.growth-card-action { font-size: 0.75rem; color: var(--primary-soft-text); margin-top: 8px; }
.growth-queue-panel .table-wrap { max-height: 320px; overflow: auto; }
.growth-outreach-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0 8px;
}
.growth-outreach-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
}
.growth-outreach-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.growth-outreach-channels label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.growth-outreach-confirm {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}
.growth-outreach-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.growth-wa-links {
  margin: 0;
  padding-inline-start: 1.2rem;
  font-size: 0.85rem;
}
.growth-outreach-summary { margin: 0; }

