:root {
  --bg: #0b0f19;
  --bg-elevated: #111827;
  --surface: rgba(20, 28, 46, 0.78);
  --surface-hover: rgba(30, 41, 66, 0.9);
  --surface-solid: #151e32;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.3);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --cyan: #06b6d4;
  --surface-subtle: rgba(148, 163, 184, 0.08);
  --chart-grid: rgba(148, 163, 184, 0.16);
  --status-ok-text: #34d399;
  --status-warn-text: #fbbf24;
  --status-err-text: #f87171;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-elevated: #ffffff;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-hover: #ffffff;
  --surface-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.2);
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-glow: rgba(79, 70, 229, 0.25);
  --surface-subtle: rgba(15, 23, 42, 0.04);
  --chart-grid: rgba(15, 23, 42, 0.12);
  --status-ok-text: #059669;
  --status-warn-text: #b45309;
  --status-err-text: #dc2626;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
  max-width: 100%;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

body {
  overflow-x: clip;
}

.hidden {
  display: none !important;
}

/* Ambient background glows */
.bg-glow {
  position: fixed;
  border-radius: 999px;
  filter: blur(110px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.32;
}

[data-theme="light"] .bg-glow {
  opacity: 0.16;
}

.bg-glow-1 {
  width: 480px;
  height: 480px;
  background: #6366f1;
  top: -160px;
  left: -120px;
}

.bg-glow-2 {
  width: 440px;
  height: 440px;
  background: #06b6d4;
  bottom: -160px;
  right: -120px;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  max-width: 100%;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1260px;
  min-width: 0;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 1 auto;
  min-width: min(100%, 210px);
  max-width: 100%;
}

.brand > div:not(.brand-icon) {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.brand-icon {
  width: 42px;
  min-width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px var(--primary-glow);
}

.brand-icon svg {
  width: 22px;
  height: 22px;
}

.brand h1,
#brandTitle {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.brand-subtitle {
  margin: 1px 0 0;
  font-size: 0.76rem;
  color: var(--text-muted);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 440px;
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--text-subtle);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 11px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.14s ease, background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  box-shadow: 0 6px 18px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #5558ec, #4338ca);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-icon {
  width: 39px;
  height: 39px;
  padding: 0;
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-icon:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.plus-glyph {
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 700;
}

/* Main container */
.container {
  position: relative;
  z-index: 1;
  max-width: 1260px;
  margin: 0 auto;
  padding: 26px 24px 110px;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  backdrop-filter: blur(12px);
}

.stat-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.dot-active { background: var(--green); box-shadow: 0 0 8px rgba(16, 185, 129, 0.7); }
.dot-maintenance { background: var(--amber); box-shadow: 0 0 8px rgba(245, 158, 11, 0.6); }
.dot-paused { background: var(--red); box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.pill:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 100%;
}

.select-control {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  max-width: 100%;
}

.select-control:focus {
  border-color: var(--primary);
}

/* Sites Grid */
.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr));
  gap: 18px;
}

.site-card {
  position: relative;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.site-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-accent, var(--primary));
}

.site-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}

.site-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  background: var(--card-accent, var(--primary));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.site-avatar img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 4px;
}

.card-title-wrap,
.site-title-wrap {
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.site-name {
  margin: 0;
  font-size: 1.03rem;
  font-weight: 700;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.site-domain {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.site-domain:hover {
  color: var(--primary);
  text-decoration: underline;
}

.fav-btn {
  background: transparent;
  border: none;
  padding: 5px;
  border-radius: 8px;
  color: var(--text-subtle);
  cursor: pointer;
  transition: color 0.15s, transform 0.15s, background-color 0.15s;
}

.fav-btn:hover {
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber);
}

.fav-btn.is-fav {
  color: var(--amber);
}

.fav-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Badges row */
.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  font-family: inherit;
  transition: filter 0.15s, transform 0.12s;
}

.status-badge:hover {
  filter: brightness(1.12);
}

.status-active {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="light"] .status-active {
  color: #059669;
}

.status-maintenance {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="light"] .status-maintenance {
  color: #d97706;
}

.status-paused {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="light"] .status-paused {
  color: #dc2626;
}

.category-tag {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.12);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ping-badge {
  margin-left: auto;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ping-badge.ok { color: var(--green); }
.ping-badge.err { color: var(--red); }
.ping-badge.checking { color: var(--primary); }
.ping-badge.offline { color: var(--amber); }

.ping-spinner {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  display: inline-block;
  animation: spin 0.85s linear infinite;
}

.card-health-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.74rem;
  color: var(--text-subtle);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.health-meta-text,
.health-reason {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.maint-probe {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.71rem;
  font-weight: 600;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.maint-probe-ok {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
}

.maint-probe-err {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
}

[data-theme="light"] .maint-probe-ok {
  color: #059669;
}

[data-theme="light"] .maint-probe-err {
  color: #dc2626;
}

.dns-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid var(--border);
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.card-action-icon.is-checking svg,
#checkAllBtn.is-checking svg {
  animation: spin 0.9s linear infinite;
}

/* Offline Banner */
.offline-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 18px;
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  font-size: 0.86rem;
}

[data-theme="light"] .offline-banner {
  background: rgba(245, 158, 11, 0.1);
  color: #b45309;
}

.offline-banner-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.7);
  flex-shrink: 0;
}

.offline-banner-text {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  min-width: 0;
}

.offline-banner-text span {
  color: var(--text-muted);
}

.site-notes {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Quick shortcuts */
.card-shortcuts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.shortcut-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--border);
  padding: 4px 9px;
  border-radius: 8px;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}

.shortcut-link:hover {
  color: var(--text);
  border-color: var(--primary);
}

/* Card Footer Actions */
.card-actions {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.card-btn-open {
  flex: 1 1 110px;
  min-width: 0;
  padding: 8px 12px;
  font-size: 0.83rem;
}

.card-action-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.card-action-icon:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(148, 163, 184, 0.12);
}

.card-action-icon.danger:hover {
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.1);
}

.card-action-icon svg {
  width: 15px;
  height: 15px;
}

/* Inline "+ Add Site" Card */
.add-card {
  min-height: 215px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  font: inherit;
  transition: all 0.2s ease;
  padding: 24px;
}

.add-card:hover {
  border-color: var(--primary);
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  transform: translateY(-3px);
}

.add-card-circle {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 8px 22px var(--primary-glow);
  transition: transform 0.2s ease;
}

.add-card:hover .add-card-circle {
  transform: scale(1.08) rotate(90deg);
}

.add-card strong {
  font-size: 0.98rem;
}

.add-card span {
  font-size: 0.8rem;
  color: var(--text-subtle);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 58px 20px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  font-weight: 600;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.empty-state p {
  margin: 0 0 20px;
  color: var(--text-muted);
}

/* Floating Action Button (+) */
.fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 40;
  width: 62px;
  height: 62px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  color: #fff;
  font-size: 2.15rem;
  font-weight: 500;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fab:hover {
  transform: scale(1.08) rotate(90deg);
  box-shadow: 0 16px 34px rgba(99, 102, 241, 0.65);
}

.fab:active {
  transform: scale(0.96);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 18px;
  animation: fadeIn 0.16s ease;
}

.modal-card {
  width: 100%;
  min-width: 0;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.18s ease;
}

.modal-preview {
  max-width: 980px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.modal-form {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.req { color: var(--red); }
.opt { font-weight: 400; color: var(--text-subtle); }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-divider {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 2px;
}

.form-section-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
}

.form-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.84rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1.35;
}

.checkbox-field input[type="checkbox"] {
  width: 17px;
  height: 17px;
  padding: 0;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.color-swatches {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
  flex-wrap: wrap;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.swatch:hover {
  transform: scale(1.12);
}

.swatch.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--primary);
  transform: scale(1.12);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

/* Preview Modal */
.preview-header-info {
  min-width: 0;
  max-width: 100%;
  flex: 1;
}

.preview-url {
  display: block;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 0.8rem;
  color: var(--primary);
  text-decoration: none;
  margin-top: 2px;
}

.preview-url:hover {
  text-decoration: underline;
}

.preview-notice {
  padding: 9px 22px;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(99, 102, 241, 0.08);
  border-bottom: 1px solid var(--border);
}

.preview-frame-wrap {
  flex: 1;
  background: #fff;
}

.preview-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Toasts */
.toast-container {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 24px);
}

.toast {
  background: var(--surface-solid);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  animation: slideUp 0.2s ease;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
}

.toast.toast-err {
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 12px 30px rgba(239, 68, 68, 0.18);
}

.spin {
  animation: spin 0.9s linear infinite;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Unsafe link neutralization */
.is-unsafe-link {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Compact button & select helpers */
.btn-xs {
  padding: 5px 11px;
  font-size: 0.78rem;
  border-radius: 9px;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.82rem;
}

.select-compact {
  padding: 5px 10px;
  font-size: 0.78rem;
  border-radius: 9px;
}

.view-tab:focus-visible,
.btn:focus-visible,
.th-sort:focus-visible,
.card-action-icon:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Auto-check Cadence Bar */
.cadence-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  flex-wrap: wrap;
  padding: 11px 16px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  min-width: 0;
  max-width: 100%;
}

.cadence-controls,
.cadence-kpis {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.cadence-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.cadence-dot.is-paused {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.cadence-dot.is-off {
  background: var(--text-subtle);
  box-shadow: none;
}

.cadence-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.cadence-countdown {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text);
}

.cadence-kpi {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 0.79rem;
}

.cadence-kpi-label {
  color: var(--text-muted);
}

.cadence-kpi-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* View Switcher Tabs */
.view-switcher-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 16px;
  max-width: 100%;
}

.view-tabs {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  max-width: 100%;
}

.view-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.view-tab:hover {
  color: var(--text);
  background: var(--surface-subtle);
}

.view-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.view-tab svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: rgba(148, 163, 184, 0.2);
  color: inherit;
}

.view-tab.active .tab-badge {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}

/* Enriched Card Telemetry & Sparkline */
.card-telemetry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  min-width: 0;
  max-width: 100%;
}

.card-telemetry-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.uptime-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-subtle);
}

.uptime-badge.is-good {
  background: rgba(16, 185, 129, 0.14);
  color: var(--status-ok-text);
}

.uptime-badge.is-warn {
  background: rgba(245, 158, 11, 0.14);
  color: var(--status-warn-text);
}

.uptime-badge.is-bad {
  background: rgba(239, 68, 68, 0.14);
  color: var(--status-err-text);
}

.probe-chip {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.age-label {
  font-size: 0.71rem;
  color: var(--text-subtle);
  white-space: nowrap;
}

.sparkline-wrap {
  flex-shrink: 0;
  width: 88px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.sparkline-svg {
  width: 88px;
  height: 24px;
  display: block;
  overflow: visible;
}

/* Table View */
.table-view {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.table-scroll-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sites-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: left;
}

.sites-table th,
.sites-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.sites-table thead th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-subtle);
  white-space: nowrap;
}

.sites-table tbody tr:last-child td {
  border-bottom: none;
}

.sites-table tbody tr:hover {
  background: var(--surface-hover);
}

.th-sort {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.th-sort:hover {
  color: var(--text);
}

.sort-indicator {
  font-size: 0.75rem;
  opacity: 0.75;
}

.table-site-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.table-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.76rem;
  flex-shrink: 0;
}

.table-site-meta {
  min-width: 0;
}

.table-site-name {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}

.table-site-link {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}

.table-site-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.table-actions .card-action-icon,
.table-actions .fav-btn {
  width: 30px;
  height: 30px;
}

.probe-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.probe-pill.is-ok {
  background: rgba(16, 185, 129, 0.14);
  color: var(--status-ok-text);
}

.probe-pill.is-err {
  background: rgba(239, 68, 68, 0.14);
  color: var(--status-err-text);
}

.probe-pill.is-warn {
  background: rgba(245, 158, 11, 0.14);
  color: var(--status-warn-text);
}

.probe-pill.is-none {
  background: var(--surface-subtle);
  color: var(--text-subtle);
}

/* Analytics View */
.analytics-view {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  max-width: 100%;
}

.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.analytics-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.analytics-kpi-label {
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.analytics-kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.analytics-kpi-sub {
  font-size: 0.78rem;
  color: var(--text-subtle);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.analytics-charts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 18px;
  min-width: 0;
}

.analytics-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.analytics-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.analytics-card-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.analytics-sub {
  font-size: 0.78rem;
  color: var(--text-subtle);
}

.analytics-chart-body {
  min-width: 0;
  max-width: 100%;
}

.donut-layout {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.donut-svg {
  width: 156px;
  height: 156px;
  max-width: 100%;
  flex-shrink: 0;
  display: block;
}

.donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 140px;
  min-width: 0;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.84rem;
}

.donut-legend-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.latency-chart-svg {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

.analytics-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.86rem;
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
}

/* Activity Log View */
.log-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}

.log-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
  min-width: 0;
}

.log-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1 1 220px;
  min-width: 0;
}

.log-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.log-count {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.log-entry-head {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.log-level {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}

.log-level-ok {
  background: rgba(16, 185, 129, 0.14);
  color: var(--status-ok-text);
}

.log-level-warn {
  background: rgba(245, 158, 11, 0.14);
  color: var(--status-warn-text);
}

.log-level-err {
  background: rgba(239, 68, 68, 0.14);
  color: var(--status-err-text);
}

.log-level-info {
  background: rgba(99, 102, 241, 0.16);
  color: var(--primary);
}

.log-time {
  font-size: 0.78rem;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.log-site {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.log-message {
  flex: 1 1 220px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.log-empty {
  padding: 36px 20px;
  text-align: center;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Site Inspector Modal */
#siteInspectorModal .modal-card,
.modal-inspector {
  max-width: 780px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.inspector-header {
  flex-wrap: wrap;
  align-items: flex-start;
  min-width: 0;
  max-width: 100%;
}

.inspector-header-info {
  min-width: 0;
  max-width: 100%;
  flex: 1 1 240px;
}

.inspector-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

#inspectorTitle {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#inspectorExternalLink {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.inspector-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--primary);
}

.inspector-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.inspector-body {
  padding: 18px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.inspector-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.inspector-kpi {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  min-width: 0;
}

.inspector-kpi-label {
  display: block;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.inspector-kpi-value {
  display: block;
  margin-top: 4px;
  font-size: 1.08rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.inspector-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.inspector-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.inspector-section-head h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.inspector-section-sub {
  font-size: 0.76rem;
  color: var(--text-subtle);
}

.inspector-chart-wrap {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.inspector-chart-svg {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

.inspector-chart-empty {
  padding: 18px 10px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.inspector-dns-panel {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 0.84rem;
  line-height: 1.45;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.inspector-history-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.inspector-history-table th,
.inspector-history-table td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--border);
}

.inspector-history-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-subtle);
}

.inspector-history-table tbody tr:last-child td {
  border-bottom: none;
}

/* Responsive */
@media (max-width: 820px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-charts-grid {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    padding: 12px 16px;
  }

  .search-wrap {
    order: 3;
    min-width: 0;
    max-width: none;
    flex-basis: 100%;
  }

  .topbar-actions #checkAllBtn span,
  .topbar-actions #headerAddBtn span:last-child {
    display: none;
  }
}

@media (max-width: 560px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .inspector-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .view-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .container {
    padding: 18px 14px 100px;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .card-health-line {
    flex-direction: column;
    align-items: flex-start;
  }

  .fab {
    right: 18px;
    bottom: 18px;
    width: 56px;
    height: 56px;
  }
}

@media (max-width: 440px) {
  .analytics-kpi-grid {
    grid-template-columns: 1fr;
  }

  .card-btn-open {
    flex: 1 1 100%;
  }
}
