/* Core Design System & Tokens */
:root {
  --bg-primary: #050505;
  --bg-secondary: #0D0D0F;
  --bg-tertiary: #171719;
  --bg-card: rgba(18, 18, 20, 0.62);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  
  /* Neon Accents */
  --accent-cyan: #06B6D4;
  --accent-cyan-rgb: 6, 182, 212;
  --accent-purple: #6366F1;
  --accent-purple-rgb: 99, 102, 241;
  --accent-green: #10B981;
  --accent-green-rgb: 16, 185, 129;
  --accent-red: #F43F5E;
  --accent-red-rgb: 244, 63, 94;
  --accent-yellow: #F59E0B;
  --accent-yellow-rgb: 245, 158, 11;
  
  /* Typography Colors */
  --text-main: #F3F4F6;
  --text-muted: #9CA3AF;
  --text-dark: #6B7280;

  /* Font Families */
  --font-outfit: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Shadow & Blur */
  --glass-blur: blur(16px);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(6, 182, 212, 0.15);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-outfit);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(6, 182, 212, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Container */
.app-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.actions-area,
.workspace-switcher {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.workspace-switcher select {
  min-width: 180px;
  max-width: 260px;
}

.workspace-switcher .btn {
  padding-inline: 0.8rem;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 2.25rem;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.3));
}

.logo-text h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-text h1 span {
  color: var(--accent-cyan);
}

.logo-text .tagline {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--border-hover);
}

.btn-large {
  padding: 0.8rem 1.75rem;
  font-size: 1.05rem;
}

/* Dashboard Overview Cards */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
}

.stat-card:hover {
  border-color: var(--border-hover);
}

.stat-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.icon-total { color: var(--accent-purple); }
.icon-active { color: var(--accent-cyan); }
.icon-down { color: var(--accent-red); }
.icon-ssl { color: var(--accent-yellow); }

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* Monitors Grid */
.monitors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.5rem;
}

/* Monitor Card */
.monitor-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: var(--shadow-lg);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.monitor-card:hover {
  border-color: rgba(6, 182, 212, 0.3);
  box-shadow: var(--shadow-glow), var(--shadow-lg);
}

.monitor-card:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
  border-color: rgba(6, 182, 212, 0.45);
}

.monitor-card.offline {
  border-color: rgba(244, 63, 94, 0.2);
}

.monitor-card.offline:hover {
  box-shadow: 0 0 20px rgba(244, 63, 94, 0.1), var(--shadow-lg);
  border-color: rgba(244, 63, 94, 0.4);
}

/* Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.host-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-width: 60%;
}

.host-name {
  font-weight: 600;
  font-size: 1.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.host-address {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.protocol-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  width: fit-content;
  margin-top: 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Pulse Dot */
.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.6rem;
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  position: relative;
}

.status-dot.online {
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}
.status-dot.online::after {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  border-radius: 50%;
  background-color: var(--accent-green);
  animation: pulse-ring 1.5s infinite ease-out;
}

.status-dot.offline {
  background-color: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
}
.status-dot.offline::after {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  border-radius: 50%;
  background-color: var(--accent-red);
  animation: pulse-ring 1.5s infinite ease-out;
}

.status-dot.paused {
  background-color: var(--text-dark);
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* Card Latency Panel */
.latency-panel {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.5rem 0;
}

.latency-value {
  font-family: var(--font-mono);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.latency-value.online {
  color: var(--text-main);
}
.latency-value.offline {
  color: var(--accent-red);
}
.latency-value.paused {
  color: var(--text-dark);
}

.latency-unit {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.last-ping-status {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
}
.status-badge-ok {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
}
.status-badge-fail {
  background-color: rgba(244, 63, 94, 0.1);
  color: var(--accent-red);
}

/* Sparkline Chart */
.sparkline-container {
  height: 60px;
  position: relative;
  width: 100%;
}

/* Stats Row */
.card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: 0.5rem;
  padding: 0.75rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.card-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.card-stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 0.15rem;
}

.card-stat-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
}

/* SSL Banner */
.ssl-panel {
  border-top: 1px dashed var(--border-color);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ssl-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ssl-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ssl-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  text-transform: uppercase;
}

.ssl-valid {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
}

.ssl-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--accent-yellow);
}

.ssl-danger {
  background-color: rgba(244, 63, 94, 0.1);
  color: var(--accent-red);
}

.ssl-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.ssl-detail-item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ssl-detail-item span {
  font-weight: 500;
  color: var(--text-main);
}

/* Card Actions */
.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

.btn-icon {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.35rem;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.8rem;
}

.btn-icon:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--border-hover);
}

.btn-icon.btn-edit:hover {
  color: var(--accent-purple);
  border-color: rgba(99, 102, 241, 0.3);
}

.btn-icon.btn-embed:hover {
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.3);
}

.btn-icon.btn-pause:hover {
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.3);
}

.btn-icon.btn-reset:hover {
  color: var(--accent-yellow);
  border-color: rgba(245, 158, 11, 0.3);
}

.btn-icon.btn-delete:hover {
  background-color: rgba(244, 63, 94, 0.1);
  color: var(--accent-red);
  border-color: rgba(244, 63, 94, 0.3);
}

/* Empty State */
.empty-state {
  text-align: center;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 4rem 2rem;
  max-width: 500px;
  margin: 4rem auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.empty-illustration {
  font-size: 3.5rem;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.2));
  margin-bottom: 0.5rem;
}

.empty-state h3 {
  font-size: 1.35rem;
  font-weight: 600;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(5, 7, 11, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  animation: fade-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  max-width: 500px;
  width: 100%;
  max-height: calc(100vh - 2rem);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: scale-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-container-wide {
  max-width: 720px;
  max-height: calc(100vh - 3rem);
  display: flex;
  flex-direction: column;
}

.modal-container-wide form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-container-wide .modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.bulk-import-textarea {
  min-height: 220px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  white-space: pre;
}

.bulk-import-status {
  padding: 0.8rem 1rem;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 0.55rem;
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.1);
  white-space: pre-line;
}

.bulk-import-status.is-error {
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.3);
  background: rgba(244, 63, 94, 0.1);
}

.custom-alert-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid rgba(245, 158, 11, 0.24);
  border-radius: 0.7rem;
  background: rgba(245, 158, 11, 0.06);
}

.custom-alert-fields[hidden] {
  display: none;
}

.custom-alert-tag {
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.1);
}

.info-callout code {
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.dashboard-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.dashboard-summary-panel { min-height: 15rem; }
.dashboard-attention-list, .dashboard-status-list { display: grid; gap: .6rem; }
.attention-row, .dashboard-status-row { display: flex; align-items: center; gap: .65rem; padding: .75rem; border: 1px solid var(--border-color); border-radius: .6rem; background: rgba(255,255,255,.025); }
.attention-row small { margin-left: auto; color: var(--text-muted); }.attention-row.is-down i { color: var(--accent-red); }.attention-row.is-warning i { color: var(--accent-yellow); }.dashboard-status-row strong { margin-left: auto; font-family: var(--font-mono); }
.view-switcher { display: inline-flex; padding: .22rem; border: 1px solid var(--border-color); border-radius: .65rem; background: rgba(0,0,0,.2); }.view-toggle { border: 0; border-radius: .45rem; padding: .48rem .7rem; background: transparent; color: var(--text-muted); cursor: pointer; font: inherit; font-size: .82rem; }.view-toggle.is-active { background: rgba(6,182,212,.15); color: var(--text-main); }
.monitor-list-toolbar { display: flex; align-items: flex-end; gap: .75rem; flex-wrap: wrap; margin: 0 0 1.25rem; padding: .85rem; border: 1px solid var(--border-color); border-radius: .85rem; background: rgba(12,12,14,.62); }
.monitor-list-toolbar label { display: grid; gap: .3rem; min-width: 10rem; color: var(--text-muted); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; }
.monitor-list-toolbar label.monitor-search { position: relative; flex: 1 1 16rem; min-width: 14rem; }
.monitor-list-toolbar .monitor-search i { position: absolute; left: .8rem; bottom: .72rem; color: var(--text-muted); pointer-events: none; }
.monitor-list-toolbar input, .monitor-list-toolbar select { min-height: 2.5rem; margin: 0; padding: .58rem .7rem; border: 1px solid var(--border-color); border-radius: .58rem; background: rgba(0,0,0,.25); color: var(--text-main); font: inherit; font-size: .82rem; letter-spacing: normal; text-transform: none; }
.monitor-list-toolbar .monitor-search input { width: 100%; padding-left: 2.25rem; }
.monitor-list-toolbar input:focus, .monitor-list-toolbar select:focus { border-color: var(--accent-cyan); outline: 2px solid rgba(6,182,212,.14); }
.filter-empty-state { margin-bottom: 1.25rem; }
.monitor-table-wrap { overflow-x: auto; border: 1px solid var(--border-color); border-radius: 1rem; background: var(--bg-card); backdrop-filter: var(--glass-blur); }.monitor-table { width: 100%; min-width: 900px; border-collapse: collapse; text-align: left; }.monitor-table th { padding: .85rem 1rem; color: var(--text-muted); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; background: rgba(255,255,255,.04); }.monitor-table td { padding: .85rem 1rem; border-top: 1px solid var(--border-color); vertical-align: middle; }.monitor-table td small { display: block; margin-top: .25rem; color: var(--text-muted); font-family: var(--font-mono); font-size: .72rem; }.monitor-table tr:hover { background: rgba(255,255,255,.025); }.table-health.online { color: var(--accent-green); }.table-health.offline { color: var(--accent-red); }.table-health.paused { color: var(--accent-yellow); }.table-actions { display: flex; gap: .35rem; }.maintenance-state { border-color: rgba(245,158,11,.38); }.maintenance-tag { color: var(--accent-yellow); }
.blacklist-table { min-width: 980px; }
.blacklist-table .blacklist-monitor-cell strong { display: block; color: var(--text-main); }
.blacklist-table .blacklist-monitor-cell small { display: flex; align-items: center; gap: .35rem; }
.blacklist-table .blacklist-monitor-cell small i { color: var(--accent-cyan); }
.blacklist-table .blacklist-type-label { display: inline-flex; align-items: center; gap: .35rem; color: var(--text-main); }
.blacklist-table .blacklist-report { font-family: var(--font-mono); font-weight: 700; }
.blacklist-table .blacklist-report.is-listed { color: var(--accent-red); }
.blacklist-table .blacklist-report.is-clean { color: var(--accent-green); }
.blacklist-table .table-actions { white-space: nowrap; }
@media (max-width: 760px) { .dashboard-summary-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .monitor-list-toolbar { align-items: stretch; } .monitor-list-toolbar label, .monitor-list-toolbar label.monitor-search { flex: 1 1 100%; min-width: 0; } }

.modal-container > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 2rem);
}

.modal-container > form .modal-body {
  overflow-y: auto;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scale-up {
  from { transform: scale(0.9) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.75rem;
  cursor: pointer;
  transition: color 0.15s ease;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.col-6 {
  flex: 0 0 calc(50% - 0.5rem);
}

.col-8 {
  flex: 0 0 calc(66.666% - 0.35rem);
}

.col-4 {
  flex: 0 0 calc(33.333% - 0.7rem);
}

.col-3 {
  flex: 0 0 calc(25% - 0.75rem);
}

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="tel"],
textarea,
select {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-main);
  padding: 0.625rem 0.85rem;
  font-size: 0.95rem;
  width: 100%;
  transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.45;
}

.form-help {
  font-size: 0.725rem;
  color: var(--text-dark);
}

/* Select wrapper for styling */
.select-wrapper {
  position: relative;
}

.select-wrapper::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.75rem;
  color: var(--text-muted);
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

select {
  appearance: none;
  padding-right: 2rem;
}

/* Checkbox group styling */
.checkbox-group {
  margin-top: 0.5rem;
}

.checkbox-container {
  display: flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  gap: 0.5rem;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  height: 1.15rem;
  width: 1.15rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkbox-container:hover input ~ .checkmark {
  border-color: var(--border-hover);
}

.checkbox-container input:checked ~ .checkmark {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  border-color: transparent;
}

.checkmark::after {
  content: "\f00c";
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.7rem;
  color: white;
  display: none;
}

.checkbox-container input:checked ~ .checkmark::after {
  display: block;
}

.checkbox-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: rgba(0, 0, 0, 0.1);
}

/* Global utility classes */
.text-danger { color: var(--accent-red) !important; }
.text-warning { color: var(--accent-yellow) !important; }
.text-success { color: var(--accent-green) !important; }

/* Responsive adjustments */
@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }
  
  .actions-area {
    width: 100%;
  }
  
  .actions-area .btn {
    width: 100%;
  }

  .form-row {
    flex-direction: column;
    gap: 1.25rem;
  }

  .col-6,
  .col-8,
  .col-4,
  .col-3 {
    flex: 0 0 100%;
  }
}

.app-footer {
  margin-top: auto;
  padding: 2.5rem 0 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-dark);
}

.footer-links a {
  color: var(--text-dark);
  text-decoration: none;
  transition: color 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.footer-links a:hover {
  color: var(--text-muted);
}

/* --- Route Visibilities --- */
body.route-public .admin-only { display: none !important; }
body.route-public .public-only { display: block !important; }
body.route-public span.public-only { display: inline !important; }
body.route-public button.public-only { display: inline-flex !important; }
body.route-public a.public-only { display: inline !important; }

body.route-admin span.admin-only { display: inline !important; }
body.route-admin button.admin-only { display: inline-flex !important; }
body.route-admin .public-only { display: none !important; }

body.route-login .main-app-ui { display: none !important; }
body.route-login .login-ui { display: flex !important; }
body.route-public .login-ui, body.route-admin .login-ui { display: none !important; }

/* --- Login UI --- */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 2.5rem;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  animation: scale-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.login-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.login-header .logo-icon {
  width: 3.5rem;
  height: 3.5rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--accent-purple);
  margin-bottom: 0.5rem;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

.login-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

.login-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.btn-full {
  width: 100%;
  padding: 0.75rem;
}

.login-error {
  background-color: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: var(--accent-red);
  padding: 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: shake 0.3s ease;
}

.admin-load-error[hidden] {
  display: none !important;
}

.section-tab[hidden],
.app-section[hidden],
#btnOpenAgentModal[hidden] {
  display: none !important;
}

.admin-load-error {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin: -0.75rem 0 1.5rem;
  padding: 1rem;
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 0.85rem;
  background: rgba(245, 158, 11, 0.09);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.admin-load-error > i {
  color: var(--accent-yellow);
  margin-top: 0.15rem;
}

.admin-load-error strong {
  display: block;
  margin-bottom: 0.2rem;
}

.admin-load-error p {
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.admin-load-actions {
  margin-left: auto;
  display: flex;
  gap: 0.45rem;
  flex-shrink: 0;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.login-footer {
  text-align: center;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.sso-login-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sso-login-area[hidden] {
  display: none !important;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.login-divider::before,
.login-divider::after {
  content: '';
  height: 1px;
  flex: 1;
  background: var(--border-color);
}

.security-grid .settings-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.25rem;
}

.config-value {
  display: block;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background: rgba(16, 16, 18, 0.45);
  color: var(--accent-cyan);
  overflow-wrap: anywhere;
  font-size: 0.78rem;
}

.compact-check {
  margin-top: 0.65rem;
}

.security-status {
  min-height: 1.2rem;
}

.security-status.is-error {
  color: var(--accent-red);
}

.security-status.is-success {
  color: var(--accent-green);
}

.monitor-custom-alert-policy {
  margin: 0.25rem 0 1rem;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.24);
}

.agent-checkbox.is-disabled {
  opacity: 0.55;
}

.tenant-invite-result {
  margin-top: 1rem;
  padding: 0.9rem;
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: 0.65rem;
  background: rgba(6, 182, 212, 0.06);
}

.tenant-invite-result .config-value {
  overflow-wrap: anywhere;
  user-select: all;
}

.tenant-invite-result .btn {
  margin-top: 0.7rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.workspace-switcher {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

body.route-admin .workspace-switcher.admin-only {
  display: flex !important;
}

.workspace-switcher select {
  width: auto;
  min-width: 150px;
  max-width: 230px;
  padding: 0.5rem 2rem 0.5rem 0.7rem;
}

.user-badge {
  color: var(--text-muted);
  font-size: 0.75rem;
  max-width: 190px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tenant-admin-grid {
  margin-top: 1.25rem;
}

.tenant-user-row,
.tenant-user-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.tenant-user-row {
  justify-content: space-between;
}

.tenant-user-row small {
  display: block;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.tenant-user-actions select {
  width: auto;
  min-width: 130px;
}

body.role-viewer .tenant-admin-only {
  display: none !important;
}

@media (max-width: 900px) {
  .workspace-switcher {
    width: 100%;
    order: 3;
  }

  .workspace-switcher select {
    flex: 1;
    max-width: none;
  }
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.15s ease;
}

.btn-text:hover {
  color: var(--text-main);
}

/* Card Visibility Badges & Eye Actions */
.visibility-indicator {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.visibility-public {
  background-color: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan);
}

.visibility-private {
  background-color: rgba(107, 114, 128, 0.15);
  color: var(--text-muted);
  border: 1px dashed var(--border-color);
}

.card-header-badge-row {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.25rem;
  align-items: center;
}

.btn-icon.btn-public:hover {
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.3);
}

.monitor-card.is-private-card {
  border-style: dashed;
  background-color: rgba(18, 18, 20, 0.25);
}

/* Sparkline placeholder for SSL-only monitors */
.sparkline-placeholder {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border-color);
  border-radius: 0.5rem;
}

.sparkline-placeholder i {
  color: var(--accent-cyan);
  font-size: 1.1rem;
}

/* Hide overview widgets on the public page */
body.route-public .stats-overview {
  display: none !important;
}

/* Only admin cards open the detailed history view. */
body.route-admin .monitor-card {
  cursor: pointer;
}

body.route-public .monitor-card {
  cursor: default;
}

body.route-public .monitor-card:hover {
  border-color: var(--border-color);
  box-shadow: var(--shadow-lg);
}

body.route-public .monitor-card.offline:hover {
  border-color: rgba(244, 63, 94, 0.2);
  box-shadow: var(--shadow-lg);
}

/* Detail Modal layout */
.detail-modal {
  max-width: 650px;
}

.detail-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.detail-stat-box {
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.detail-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.detail-stat-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
}

.detail-stat-meta {
  min-height: 1rem;
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.card-drilldown-hint {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  transition: color 0.2s ease;
}

.card-drilldown-hint .fa-chevron-right {
  margin-left: auto;
  font-size: 0.65rem;
  transition: transform 0.2s ease;
}

.monitor-card:hover .card-drilldown-hint,
.monitor-card:focus-visible .card-drilldown-hint {
  color: var(--accent-cyan);
}

.monitor-card:hover .card-drilldown-hint .fa-chevron-right {
  transform: translateX(3px);
}

.detail-chart-container {
  height: 200px;
  position: relative;
  width: 100%;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.detail-log-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.detail-log-title h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.detail-log-list {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.15);
  padding: 0.25rem;
  display: flex;
  flex-direction: column;
}

.log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.log-item:last-child {
  border-bottom: none;
}

.log-item-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
}

.log-item-time {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Public dashboard: one wide chart per row. */
body.route-public:not(.route-embed) .app-container {
  max-width: 1600px;
}

body.route-public .monitors-grid {
  grid-template-columns: minmax(0, 1fr);
}

body.route-public:not(.route-embed) .sparkline-container {
  height: clamp(110px, 10vw, 150px);
}

.public-chart-range {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: -0.65rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.public-chart-range span:last-child {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent-cyan);
}

/* Standalone single-monitor embed surface. */
body.route-embed {
  min-height: 100vh;
  background-attachment: scroll;
}

body.route-embed .app-header,
body.route-embed .stats-overview,
body.route-embed .app-footer {
  display: none !important;
}

body.route-embed .app-container {
  max-width: none;
  min-height: 100vh;
  padding: 0;
}

body.route-embed .app-main,
body.route-embed .monitors-grid {
  min-height: 100vh;
}

body.route-embed .monitor-card {
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 1rem;
  gap: 0.75rem;
}

body.route-embed .sparkline-container,
body.route-embed .sparkline-placeholder {
  height: 90px;
}

body.route-embed #btnEmptyLogin {
  display: none !important;
}

.modal-subtitle {
  margin-top: 0.2rem;
  font-size: 0.82rem;
}

.embed-modal {
  max-width: 640px;
}

.embed-code {
  width: 100%;
  resize: vertical;
  min-height: 170px;
  padding: 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  outline: none;
  background: #080b10;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.55;
}

.embed-code:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}

.embed-visibility-note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid;
  border-radius: 0.5rem;
  font-size: 0.82rem;
  line-height: 1.4;
}

.embed-visibility-note.is-public {
  border-color: rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.08);
  color: var(--accent-green);
}

.embed-visibility-note.is-private {
  border-color: rgba(245, 158, 11, 0.25);
  background: rgba(245, 158, 11, 0.08);
  color: var(--accent-yellow);
}

.embed-preview-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent-cyan);
  font-size: 0.82rem;
  text-decoration: none;
}

.embed-preview-link:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .monitors-grid {
    grid-template-columns: 1fr;
  }

  .detail-stats-grid {
    grid-template-columns: 1fr;
  }

  .detail-modal-body {
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
  }

  .log-item {
    align-items: flex-start;
    gap: 0.75rem;
  }
}

/* --- Admin section shell --- */
.section-nav {
  display: none;
  gap: 0.75rem;
  margin: -0.75rem 0 1.75rem;
  padding: 0.4rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 0.9rem;
}

body.route-admin .section-nav.admin-only {
  display: flex !important;
}

.section-tab {
  flex: 1;
  border: 1px solid transparent;
  border-radius: 0.7rem;
  background: transparent;
  color: var(--text-muted);
  padding: 0.8rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s ease;
}

.section-tab:hover,
.section-tab.is-active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-hover);
}

.section-tab.is-active {
  box-shadow: inset 0 0 0 1px rgba(6, 182, 212, 0.2);
}

.app-section {
  display: none;
}

body.route-public #endpointSection,
body.route-admin .app-section.is-active {
  display: block !important;
}

body.route-admin .app-section:not(.is-active) {
  display: none !important;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  background: rgba(18, 18, 20, 0.35);
  backdrop-filter: var(--glass-blur);
}

body.route-admin .section-heading.admin-only {
  display: flex !important;
}

.section-heading h2 {
  font-size: 1.35rem;
  margin-bottom: 0.3rem;
}

.section-heading p {
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 760px;
}

.eyebrow {
  color: var(--accent-cyan) !important;
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
}

.admin-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.admin-panel,
.utility-card,
.client-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
}

.admin-panel {
  padding: 1.25rem;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-title-row h3 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.panel-title-row p {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.mini-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mini-empty {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
  padding: 0.75rem;
  border: 1px dashed var(--border-color);
  border-radius: 0.65rem;
  background: rgba(0, 0, 0, 0.12);
}

.inline-empty {
  display: inline-flex;
  padding: 0.45rem 0.6rem;
}

.mini-row,
.agent-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.14);
}

.mini-row strong,
.agent-row strong {
  display: block;
  font-size: 0.92rem;
}

.mini-row span,
.agent-row span {
  display: block;
  color: var(--text-muted);
  font-size: 0.74rem;
  margin-top: 0.18rem;
}

.agent-row.is-local {
  border-color: rgba(6, 182, 212, 0.22);
}

.agent-main {
  min-width: 0;
}

.agent-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.agent-client {
  color: var(--accent-cyan) !important;
  display: inline-flex !important;
  align-items: center;
  gap: 0.3rem;
}

.status-pill {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.24rem 0.55rem;
  font-size: 0.68rem !important;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid;
}

.status-pill.is-online {
  color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
}

.status-pill.is-waiting {
  color: var(--text-muted);
  background: rgba(107, 114, 128, 0.1);
  border-color: rgba(107, 114, 128, 0.25);
}

.status-pill.is-down {
  color: var(--accent-red);
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.25);
}

.status-pill.is-warning {
  color: var(--accent-yellow);
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.25);
}

.download-row {
  flex-wrap: wrap;
  justify-content: flex-end;
  display: flex;
  gap: 0.35rem;
}

.btn-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border-radius: 0.45rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-mini:hover {
  color: var(--text-main);
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.08);
}

.checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.6rem;
}

.agent-checkbox {
  padding: 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 0.65rem;
  background: rgba(0, 0, 0, 0.12);
}

.agent-checkbox .checkbox-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.agent-checkbox small {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.info-callout {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  border: 1px solid rgba(6, 182, 212, 0.22);
  background: rgba(6, 182, 212, 0.08);
  color: var(--text-muted);
  border-radius: 0.75rem;
  padding: 0.85rem;
  font-size: 0.84rem;
  line-height: 1.45;
}

.info-callout i {
  color: var(--accent-cyan);
  margin-top: 0.15rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.compact-empty {
  max-width: 620px;
  margin: 2rem auto;
  padding: 2.5rem 2rem;
}

.utility-card,
.client-card {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.utility-card-header,
.client-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.utility-card-header h3,
.client-card-header h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.utility-card-header p,
.client-card-header p {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

.utility-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.metric-row strong {
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.utility-note {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
  margin-top: 0.35rem;
}

.blacklist-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.blacklist-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
}

.blacklist-chip i {
  font-size: 0.62rem;
}

.blacklist-chip.clean {
  color: var(--accent-green);
  background: rgba(var(--accent-green-rgb), 0.08);
  border-color: rgba(var(--accent-green-rgb), 0.22);
}

.blacklist-chip.listed {
  color: var(--accent-red);
  background: rgba(var(--accent-red-rgb), 0.1);
  border-color: rgba(var(--accent-red-rgb), 0.28);
}

.blacklist-chip.error {
  color: var(--accent-yellow);
  background: rgba(var(--accent-yellow-rgb), 0.08);
  border-color: rgba(var(--accent-yellow-rgb), 0.22);
}

.agent-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.target-chip-row {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}

.agent-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.32rem 0.55rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.16);
  font-size: 0.72rem;
  font-weight: 700;
}

.agent-chip b {
  color: var(--text-main);
  font-family: var(--font-mono);
}

.agent-chip.is-online {
  border-color: rgba(16, 185, 129, 0.24);
  color: var(--accent-green);
}

.agent-chip.is-down {
  border-color: rgba(244, 63, 94, 0.25);
  color: var(--accent-red);
}

.agent-chip.is-waiting {
  border-color: rgba(107, 114, 128, 0.28);
}

.target-chip {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.8rem 1rem;
  gap: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-main);
  transition: all 0.2s ease;
}

.target-chip.is-online {
  border-color: rgba(16, 185, 129, 0.25);
}

.target-chip.is-down {
  border-color: rgba(244, 63, 94, 0.28);
  background: rgba(244, 63, 94, 0.08);
}

.target-chip.is-waiting {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.15);
}

.target-chip-main {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.target-chip-title {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.target-chip-title strong {
  font-size: 0.9rem;
  color: var(--text-main);
}

.target-chip-title small {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.target-chip-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.75rem;
}

.target-chip-status {
  font-weight: 700;
}

.target-chip-meta small {
  color: var(--text-muted);
}

.target-chip-meta .target-chip-agents {
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.target-chip-chart {
  position: relative;
  height: 40px;
  width: 140px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 0.35rem;
  padding: 2px;
}

.target-chip-actions {
  display: flex;
  gap: 0.35rem;
}

.target-chip-actions .btn-icon {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 0.4rem;
  transition: all 0.15s ease;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.target-chip-actions .btn-icon:hover {
  color: var(--text-main);
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.08);
}

.target-chip-actions .btn-icon.btn-delete-client-target:hover {
  color: var(--accent-red);
  border-color: rgba(244, 63, 94, 0.2);
  background: rgba(244, 63, 94, 0.12);
}

.log-item-status small {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  margin-left: 0.25rem;
}

@media (max-width: 780px) {
  .section-nav,
  body.route-admin .section-nav.admin-only,
  .section-heading,
  .admin-split-grid,
  .utility-card-header,
  .client-card-header {
    flex-direction: column;
  }

  .section-nav,
  body.route-admin .section-nav.admin-only {
    display: flex !important;
  }

  .admin-split-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .section-actions {
    width: 100%;
    justify-content: stretch;
  }

  .section-actions .btn {
    flex: 1;
  }

  .mini-row,
  .agent-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .agent-side {
    align-items: flex-start;
  }
}

/* --- Professional operations console polish --- */
:root {
  --bg-primary: #050505;
  --bg-secondary: #0C0C0E;
  --bg-tertiary: #151517;
  --bg-card: rgba(13, 13, 15, 0.88);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.2);
  --accent-cyan: #38BDF8;
  --accent-cyan-rgb: 56, 189, 248;
  --accent-purple: #818CF8;
  --accent-purple-rgb: 129, 140, 248;
  --accent-green: #22C55E;
  --accent-green-rgb: 34, 197, 94;
  --accent-red: #F87171;
  --accent-red-rgb: 248, 113, 113;
  --accent-yellow: #FBBF24;
  --accent-yellow-rgb: 251, 191, 36;
  --text-main: #F7F7F8;
  --text-muted: #A7A7B0;
  --text-dark: #74747E;
  --glass-blur: blur(20px);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.42);
  --shadow-glow: 0 18px 45px rgba(56, 189, 248, 0.06);
}

body {
  background:
    linear-gradient(180deg, rgba(5, 5, 6, 0.96), rgba(0, 0, 0, 0.99)),
    radial-gradient(circle at 16% 0%, rgba(56, 189, 248, 0.055), transparent 32rem),
    radial-gradient(circle at 86% 8%, rgba(129, 140, 248, 0.045), transparent 34rem);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 72%);
}

.app-container {
  max-width: 1320px;
  padding-top: 1.6rem;
}

.app-header {
  position: relative;
  margin-bottom: 1.35rem;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 1.15rem;
  background: rgba(10, 10, 12, 0.84);
  box-shadow: var(--shadow-lg);
  backdrop-filter: var(--glass-blur);
}

.app-header::after {
  content: '';
  position: absolute;
  inset: auto 1.25rem -1px 1.25rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.42), transparent);
}

.logo-area {
  gap: 0.9rem;
}

.logo-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  background:
    linear-gradient(145deg, rgba(56, 189, 248, 0.14), rgba(129, 140, 248, 0.11)),
    rgba(12, 12, 14, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--accent-cyan);
  -webkit-text-fill-color: currentColor;
  filter: none;
}

.logo-text h1 {
  font-size: 1.5rem;
  letter-spacing: -0.035em;
}

.logo-text .tagline {
  color: var(--text-muted);
  font-size: 0.84rem;
}

.actions-area {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.btn {
  min-height: 2.55rem;
  border-radius: 0.72rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: linear-gradient(135deg, #2563EB, #0891B2);
  box-shadow: 0 12px 24px rgba(8, 145, 178, 0.22);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(8, 145, 178, 0.28);
}

.btn-secondary,
.btn-mini {
  background: rgba(17, 17, 19, 0.82);
  border-color: rgba(255, 255, 255, 0.12);
}

.btn-secondary:hover,
.btn-mini:hover {
  background: rgba(31, 31, 34, 0.92);
  border-color: rgba(255, 255, 255, 0.24);
}

.section-nav {
  gap: 0.45rem;
  margin: 0 0 1.35rem;
  padding: 0.35rem;
  border-radius: 1rem;
  background: rgba(11, 11, 13, 0.82);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-sm);
}

.section-tab {
  min-height: 3rem;
  border-radius: 0.78rem;
  color: #AAAAAF;
  font-size: 0.92rem;
  font-weight: 800;
}

.section-tab i {
  color: #85858D;
}

.section-tab:hover {
  background: rgba(29, 29, 32, 0.82);
}

.section-tab.is-active {
  background: linear-gradient(180deg, rgba(31, 31, 34, 0.96), rgba(15, 15, 17, 0.94));
  border-color: rgba(56, 189, 248, 0.28);
  color: var(--text-main);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 10px 24px rgba(0, 0, 0, 0.2);
}

.section-tab.is-active i {
  color: var(--accent-cyan);
}

.stats-overview,
.admin-split-grid,
.cards-grid,
.monitors-grid {
  gap: 1rem;
}

.stat-card,
.monitor-card,
.admin-panel,
.utility-card,
.client-card,
.empty-state,
.login-card,
.modal-container {
  background:
    linear-gradient(180deg, rgba(18, 18, 20, 0.97), rgba(9, 9, 11, 0.94));
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-lg);
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 1rem;
}

.stat-card::before,
.monitor-card::before,
.admin-panel::before,
.utility-card::before,
.client-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  opacity: 0.8;
}

.stat-icon {
  width: 2.45rem;
  height: 2.45rem;
  background: rgba(13, 13, 15, 0.82);
  border-color: rgba(255, 255, 255, 0.1);
}

.stat-label,
.card-stat-label,
.detail-stat-label {
  font-size: 0.66rem;
  letter-spacing: 0.09em;
}

.stat-value {
  font-size: 1.42rem;
}

.section-heading {
  padding: 1.35rem;
  border-color: rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(135deg, rgba(27, 27, 30, 0.82), rgba(12, 12, 14, 0.86)),
    radial-gradient(circle at 100% 0%, rgba(56, 189, 248, 0.055), transparent 26rem);
  box-shadow: var(--shadow-sm);
}

.section-heading h2 {
  font-size: 1.42rem;
  letter-spacing: -0.035em;
}

.section-heading p {
  color: #B1B1B8;
}

.eyebrow {
  color: #93C5FD !important;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

.monitor-card,
.admin-panel,
.utility-card,
.client-card {
  position: relative;
  border-radius: 1rem;
}

.monitor-card {
  gap: 1rem;
  padding: 1.25rem;
}

.monitor-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.26);
  box-shadow: var(--shadow-glow), var(--shadow-lg);
}

.host-info {
  max-width: 70%;
  gap: 0.24rem;
}

.host-name {
  font-size: 1.04rem;
  letter-spacing: -0.02em;
}

.host-address,
.utility-card-header p,
.client-card-header p,
.target-chip small {
  color: #96969F;
}

.protocol-tag,
.visibility-indicator,
.status-badge,
.agent-chip,
.target-chip,
.status-pill {
  border-radius: 999px;
}

.status-badge {
  background: rgba(12, 12, 14, 0.88);
  border-color: rgba(255, 255, 255, 0.1);
}

.status-dot.online,
.status-dot.offline {
  box-shadow: none;
}

.status-dot.online::after,
.status-dot.offline::after {
  display: none;
}

.latency-panel {
  padding: 0.15rem 0;
}

.latency-value {
  font-size: clamp(2rem, 4vw, 2.65rem);
  letter-spacing: -0.05em;
}

.sparkline-container {
  height: 78px;
  padding: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.85rem;
  background: rgba(0, 0, 0, 0.34);
}

.card-stats {
  background: rgba(0, 0, 0, 0.32);
  border-color: rgba(255, 255, 255, 0.08);
  border-radius: 0.85rem;
}

.card-actions {
  border-top-color: rgba(255, 255, 255, 0.09);
  padding-top: 0.85rem;
}

.btn-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.58rem;
  background: rgba(15, 15, 17, 0.86);
  border-color: rgba(255, 255, 255, 0.12);
}

.mini-row,
.agent-row,
.agent-checkbox {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 0.85rem;
}

.panel-title-row h3,
.utility-card-header h3,
.client-card-header h3 {
  letter-spacing: -0.02em;
}

.mini-empty,
.info-callout,
.admin-load-error,
.embed-visibility-note {
  border-radius: 0.85rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  min-height: 2.65rem;
  background-color: rgba(13, 13, 15, 0.94);
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 0.72rem;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.modal-overlay {
  background-color: rgba(0, 0, 0, 0.82);
}

.modal-container {
  border-radius: 1.1rem;
}

.modal-header {
  background: rgba(16, 16, 18, 0.62);
  border-bottom-color: rgba(255, 255, 255, 0.09);
}

.modal-footer {
  background: rgba(0, 0, 0, 0.3);
  border-top-color: rgba(255, 255, 255, 0.09);
}

.login-card {
  max-width: 430px;
}

.login-header .logo-icon {
  background:
    linear-gradient(145deg, rgba(56, 189, 248, 0.12), rgba(129, 140, 248, 0.09)),
    rgba(12, 12, 14, 0.92);
}

.app-footer {
  border-top-color: rgba(255, 255, 255, 0.09);
}

body.route-public:not(.route-embed) .app-container {
  max-width: 1680px;
}

body.route-public:not(.route-embed) .monitor-card {
  padding: 1.4rem;
}

body.route-public:not(.route-embed) .sparkline-container {
  height: clamp(130px, 10vw, 170px);
}

.public-chart-range {
  color: #96969F;
}

@media (max-width: 780px) {
  .app-header,
  .section-heading {
    padding: 1rem;
  }

  .section-tab {
    width: 100%;
    justify-content: flex-start;
  }

  .actions-area {
    flex-direction: column;
    align-items: stretch;
  }

  .workspace-switcher {
    width: 100%;
  }

  .workspace-switcher .select-wrapper {
    flex: 1;
  }

  .workspace-switcher select {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .actions-area .workspace-switcher .btn {
    width: auto;
    flex: 0 0 auto;
  }

  .admin-load-error {
    flex-direction: column;
  }

  .admin-load-actions {
    margin-left: 0;
  }
}

/* --- Alerting administration --- */
.alerting-grid {
  grid-template-columns: minmax(300px, 0.75fr) minmax(460px, 1.25fr);
  align-items: start;
}

.alert-settings-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-subsection {
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  background: rgba(12, 12, 14, 0.58);
}

.settings-subsection-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.settings-subsection-title h4 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-main);
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.switch-row input {
  width: 1rem;
  height: 1rem;
}

.workspace-visibility-form {
  display: grid;
  gap: 1rem;
}

.workspace-visibility-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.workspace-visibility-grid .switch-row {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 0.65rem;
  background: var(--bg-secondary);
}

@media (max-width: 640px) {
  .workspace-visibility-grid {
    grid-template-columns: 1fr;
  }
}

.inline-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: center;
}

.compact-checkbox {
  min-height: 100%;
  align-items: center;
  padding-top: 1.9rem;
}

.small-field {
  max-width: 320px;
}

.test-row {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.8rem;
}

.test-row input {
  flex: 1;
}

.inline-footer {
  justify-content: flex-end;
  padding: 0;
  border-top: 0;
}

.alert-contact-row,
.delivery-log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 0.9rem;
  background: rgba(13, 13, 15, 0.62);
}

.alert-contact-row.is-disabled {
  opacity: 0.62;
}

.alert-contact-main,
.delivery-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.alert-contact-main strong,
.delivery-main strong {
  color: var(--text-main);
}

.alert-contact-main span,
.delivery-main span,
.delivery-time {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.alert-contact-main small,
.delivery-main small {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  color: var(--text-dark);
}

.alert-contact-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.alert-log-panel {
  margin-top: 1rem;
}

.delivery-log-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.delivery-log-row {
  justify-content: flex-start;
}

.delivery-channel {
  min-width: 5.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 15, 17, 0.8);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.delivery-log-row.is-success .delivery-channel {
  color: var(--accent-green);
  border-color: rgba(var(--accent-green-rgb), 0.24);
}

.delivery-log-row.is-failed .delivery-channel {
  color: var(--accent-red);
  border-color: rgba(var(--accent-red-rgb), 0.28);
}

.delivery-time {
  margin-left: auto;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .alerting-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .test-row,
  .alert-contact-row,
  .delivery-log-row {
    align-items: stretch;
    flex-direction: column;
  }

  .alert-contact-actions {
    justify-content: space-between;
  }

  .delivery-channel {
    justify-content: flex-start;
    width: fit-content;
  }

  .delivery-time {
    margin-left: 0;
  }
}

/* --- Route Monitoring styles --- */
.routes-grid {
  grid-template-columns: minmax(300px, 0.75fr) minmax(500px, 1.25fr);
  align-items: start;
}

.hops-flow-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.26);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 1rem;
}

.hop-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  padding: 0.5rem 0;
}

.hop-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 17px;
  top: 36px;
  bottom: -12px;
  width: 2px;
  background: rgba(255, 255, 255, 0.1);
  z-index: 1;
}

.hop-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(14, 14, 16, 0.9);
  border: 2px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  z-index: 2;
  transition: all 0.3s ease;
}

.hop-item.success .hop-badge {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.hop-item.fail .hop-badge {
  border-color: #ef4444;
  color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.hop-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(25, 25, 28, 0.48);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(4px);
  transition: all 0.3s ease;
}

.hop-item:hover .hop-content {
  border-color: rgba(6, 182, 212, 0.25);
  background: rgba(32, 32, 35, 0.64);
}

.hop-details {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.hop-ip {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: #f1f5f9;
}

.hop-host {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.hop-metrics {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hop-latency {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 0.5rem;
  background: rgba(14, 14, 16, 0.7);
}

.hop-latency.low {
  color: #10b981;
}

.hop-latency.medium {
  color: #f59e0b;
}

.hop-latency.high {
  color: #ef4444;
}

.hop-status-icon {
  font-size: 0.85rem;
}

.hop-status-icon.online {
  color: #10b981;
}

.hop-status-icon.offline {
  color: #ef4444;
}

.route-trace-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 0.75rem;
  color: var(--accent-cyan);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

@media (max-width: 980px) {
  .routes-grid {
    grid-template-columns: 1fr;
  }
}

/* Graph history range selectors */
.sparkline-header-admin {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.sparkline-title-admin {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.sparkline-range-select, .detail-range-select, .route-range-select, .target-range-select {
  background: rgba(14, 14, 16, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 0.72rem;
  border-radius: 0.35rem;
  padding: 0.15rem 0.4rem;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: all 0.15s ease;
}

.sparkline-range-select:hover, .detail-range-select:hover, .route-range-select:hover, .target-range-select:hover {
  background: rgba(16, 16, 18, 0.88);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.sparkline-range-select:focus, .detail-range-select:focus, .route-range-select:focus, .target-range-select:focus {
  border-color: var(--accent-cyan);
}

.sparkline-range-select option, .detail-range-select option, .route-range-select option, .target-range-select option {
  background-color: #101012;
  color: #f7f7f8;
}

/* --- Theme, profile menu, compact page chrome, and in-table filters --- */
:root {
  --bg-primary: #10141B;
  --bg-secondary: #151A23;
  --bg-tertiary: #1C2330;
  --bg-card: rgba(24, 31, 42, 0.94);
  --border-color: rgba(226, 232, 240, 0.17);
  --border-hover: rgba(226, 232, 240, 0.3);
  --text-main: #F8FAFC;
  --text-muted: #B6C0CE;
  --text-dark: #8E9AAA;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 18px 45px rgba(0, 0, 0, 0.32);
}

body {
  background:
    linear-gradient(180deg, rgba(16, 20, 27, 0.96), rgba(11, 15, 21, 0.99)),
    radial-gradient(circle at 16% 0%, rgba(56, 189, 248, 0.08), transparent 32rem),
    radial-gradient(circle at 86% 8%, rgba(129, 140, 248, 0.065), transparent 34rem);
}

.app-header,
.section-nav {
  background: rgba(20, 26, 36, 0.94);
}

.app-header {
  z-index: 200;
}

.section-nav,
.app-main,
.app-section {
  position: relative;
  z-index: 1;
}

.stat-card,
.monitor-card,
.admin-panel,
.utility-card,
.client-card,
.empty-state,
.login-card,
.modal-container {
  background: linear-gradient(180deg, rgba(28, 36, 49, 0.98), rgba(20, 27, 38, 0.97));
}

.btn-secondary,
.btn-mini,
.btn-icon,
.mini-row,
.agent-row,
.agent-checkbox,
.card-stats,
.sparkline-container {
  background-color: rgba(28, 36, 49, 0.9);
  border-color: var(--border-color);
}

.section-heading {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  align-items: center;
  background: linear-gradient(135deg, rgba(28, 36, 49, 0.9), rgba(20, 27, 38, 0.9));
}

.section-heading h2 {
  margin-bottom: 0.18rem;
  font-size: 1.22rem;
}

.section-heading p {
  font-size: 0.88rem;
  line-height: 1.35;
}

.monitor-list-toolbar {
  margin-bottom: 0.8rem;
  padding: 0.55rem;
}

.app-section.is-table-view > .monitor-list-toolbar {
  display: none !important;
}

.monitor-table {
  min-width: 1060px;
}

.monitor-table th {
  padding: 0.65rem 0.75rem;
  vertical-align: bottom;
  background: rgba(36, 46, 61, 0.88);
  border-bottom: 1px solid var(--border-color);
}

.monitor-table td {
  padding: 0.78rem 0.75rem;
  border-top-color: var(--border-color);
}

.table-filter-cell {
  min-width: 132px;
}

.table-name-filter {
  min-width: 210px;
}

.table-sort-filter {
  min-width: 155px;
}

.table-column-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.42rem;
}

.table-column-heading > .table-header-control {
  flex: 1 1 auto;
}

.table-column-heading > .table-column-label {
  padding-top: 0.48rem;
}

.table-column-sort {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  margin-top: 0.17rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0.42rem;
  background: transparent;
  color: var(--text-dark);
  cursor: pointer;
}

.table-column-sort:hover,
.table-column-sort.is-active {
  border-color: var(--border-hover);
  background: rgba(var(--accent-cyan-rgb), 0.12);
  color: var(--accent-cyan);
}

.table-topbar {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(24, 31, 42, 0.72);
}

.table-sort-menu {
  display: grid;
  justify-items: end;
}

.table-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  min-height: 2.2rem;
  padding: 0.42rem 0.68rem;
  border: 1px solid var(--border-color);
  border-radius: 0.58rem;
  background: var(--bg-tertiary);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.table-sort-button:hover,
.table-sort-button[aria-expanded="true"] {
  border-color: var(--border-hover);
  background: rgba(42, 52, 68, 0.95);
}

.table-sort-button .fa-chevron-down {
  color: var(--text-dark);
  font-size: 0.62rem;
}

.table-sort-options {
  width: 220px;
  margin-top: 0.35rem;
  padding: 0.3rem;
  border: 1px solid var(--border-color);
  border-radius: 0.68rem;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-lg);
}

.table-sort-options[hidden] {
  display: none !important;
}

.table-sort-options button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.48rem 0.55rem;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--text-main);
  font-size: 0.76rem;
  text-align: left;
  cursor: pointer;
}

.table-sort-options button:hover,
.table-sort-options button[aria-checked="true"] {
  background: var(--bg-tertiary);
}

.table-sort-options button i {
  color: var(--accent-cyan);
}

.table-header-control {
  display: grid;
  gap: 0.34rem;
  position: relative;
  color: var(--text-muted);
  font-size: 0.67rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.table-header-control input,
.table-header-control select {
  width: 100%;
  min-height: 2rem;
  padding: 0.36rem 0.48rem;
  border: 1px solid var(--border-color);
  border-radius: 0.46rem;
  background: rgba(13, 18, 26, 0.72);
  color: var(--text-main);
  font: 500 0.75rem var(--font-outfit);
  letter-spacing: normal;
  text-transform: none;
  outline: none;
}

.table-header-control input:focus,
.table-header-control select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(var(--accent-cyan-rgb), 0.14);
}

.table-header-search i {
  position: absolute;
  left: 0.55rem;
  bottom: 0.54rem;
  color: var(--text-dark);
  font-size: 0.7rem;
}

.table-header-search input {
  padding-left: 1.65rem;
}

.table-empty-row:hover {
  background: transparent !important;
}

.table-empty-row td {
  height: 9rem;
  text-align: center;
  color: var(--text-muted);
}

.table-empty-row i,
.table-empty-row strong,
.table-empty-row span {
  display: block;
}

.table-empty-row i {
  margin-bottom: 0.55rem;
  color: var(--accent-cyan);
  font-size: 1.25rem;
}

.table-empty-row strong {
  margin-bottom: 0.18rem;
  color: var(--text-main);
}

body.route-admin .settings-shell.admin-only {
  display: none !important;
}

body.route-admin.section-settings .settings-shell.admin-only,
body.route-admin.section-alerting .settings-shell.admin-only,
body.route-admin.section-security .settings-shell.admin-only,
body.route-admin.section-maintenance .settings-shell.admin-only,
body.route-admin.section-integrations .settings-shell.admin-only {
  display: block !important;
}

.settings-shell-heading {
  justify-content: space-between;
}

.settings-subnav {
  display: flex;
  gap: 0.35rem;
  padding: 0.28rem;
  border: 1px solid var(--border-color);
  border-radius: 0.72rem;
  background: rgba(10, 15, 22, 0.38);
}

.settings-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  min-height: 2.2rem;
  padding: 0.42rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
}

.settings-tab:hover,
.settings-tab.is-active {
  color: var(--text-main);
  background: var(--bg-tertiary);
  border-color: var(--border-color);
}

.settings-tab.is-active i {
  color: var(--accent-cyan);
}

.profile-menu {
  position: relative;
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 0.62rem;
  min-width: 190px;
  min-height: 2.75rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border-color);
  border-radius: 0.78rem;
  background: var(--bg-tertiary);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}

.profile-trigger:hover,
.profile-trigger[aria-expanded="true"] {
  border-color: var(--border-hover);
  background: rgba(42, 52, 68, 0.95);
}

.profile-avatar {
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(var(--accent-cyan-rgb), 0.35);
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(var(--accent-purple-rgb), 0.38), rgba(var(--accent-cyan-rgb), 0.32));
  color: #fff;
  font-size: 0.73rem;
  font-weight: 800;
}

.profile-trigger-copy {
  min-width: 0;
  flex: 1;
  display: grid;
}

.profile-trigger-copy strong,
.profile-trigger-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-trigger-copy strong {
  font-size: 0.82rem;
}

.profile-trigger-copy small {
  color: var(--text-muted);
  font-size: 0.68rem;
  text-transform: capitalize;
}

.profile-chevron {
  color: var(--text-dark);
  font-size: 0.65rem;
}

.profile-dropdown {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 290px;
  padding: 0.45rem;
  border: 1px solid var(--border-color);
  border-radius: 0.9rem;
  background: rgba(23, 30, 41, 0.99);
  box-shadow: var(--shadow-lg);
}

.profile-dropdown[hidden] {
  display: none !important;
}

.profile-dropdown-identity {
  display: grid;
  gap: 0.12rem;
  padding: 0.55rem 0.65rem 0.7rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.35rem;
}

.profile-dropdown-identity strong {
  font-size: 0.9rem;
}

.profile-dropdown-identity span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.73rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-dropdown > button {
  width: 100%;
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.62rem;
  border: 0;
  border-radius: 0.62rem;
  background: transparent;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}

.profile-dropdown > button:hover {
  background: var(--bg-tertiary);
}

.profile-dropdown > button > i {
  color: var(--text-muted);
  text-align: center;
}

.profile-dropdown > button > span {
  display: grid;
  gap: 0.06rem;
}

.profile-dropdown > button strong {
  font-size: 0.8rem;
}

.profile-dropdown > button small {
  color: var(--text-muted);
  font-size: 0.69rem;
}

.profile-theme-picker {
  display: grid;
  grid-template-columns: 1.5rem 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.62rem;
  color: var(--text-main);
}

.profile-theme-picker > i {
  color: var(--text-muted);
  text-align: center;
}

.profile-theme-picker > span {
  display: grid;
  gap: 0.06rem;
}

.profile-theme-picker strong {
  font-size: 0.8rem;
}

.profile-theme-picker small {
  color: var(--text-muted);
  font-size: 0.69rem;
}

.profile-theme-picker select {
  width: auto;
  min-width: 4.8rem;
  min-height: 2rem;
  padding: 0.25rem 1.6rem 0.25rem 0.48rem;
  border: 1px solid var(--border-color);
  border-radius: 0.48rem;
  background-color: var(--bg-secondary);
  color: var(--text-main);
}

.profile-menu-divider {
  height: 1px;
  margin: 0.35rem 0.2rem;
  background: var(--border-color);
}

.profile-dropdown > .profile-logout:hover,
.profile-dropdown > .profile-logout:hover i {
  color: var(--accent-red);
}

html[data-app-theme="light"] {
  color-scheme: light;
  --bg-primary: #F4F7FB;
  --bg-secondary: #EDF2F7;
  --bg-tertiary: #FFFFFF;
  --bg-card: rgba(255, 255, 255, 0.96);
  --border-color: rgba(51, 65, 85, 0.18);
  --border-hover: rgba(51, 65, 85, 0.34);
  --text-main: #172033;
  --text-muted: #5B687C;
  --text-dark: #758197;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 16px 36px rgba(14, 165, 233, 0.08);
}

html[data-app-theme="light"] body {
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(238, 243, 249, 0.99)),
    radial-gradient(circle at 16% 0%, rgba(14, 165, 233, 0.08), transparent 32rem),
    radial-gradient(circle at 86% 8%, rgba(99, 102, 241, 0.065), transparent 34rem);
}

html[data-app-theme="light"] body::before {
  background-image: linear-gradient(rgba(51, 65, 85, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(51, 65, 85, 0.035) 1px, transparent 1px);
}

html[data-app-theme="light"] .app-header,
html[data-app-theme="light"] .section-nav,
html[data-app-theme="light"] .section-heading,
html[data-app-theme="light"] .profile-dropdown,
html[data-app-theme="light"] .monitor-list-toolbar,
html[data-app-theme="light"] .monitor-table-wrap {
  background: rgba(255, 255, 255, 0.94);
}

html[data-app-theme="light"] .stat-card,
html[data-app-theme="light"] .monitor-card,
html[data-app-theme="light"] .admin-panel,
html[data-app-theme="light"] .utility-card,
html[data-app-theme="light"] .client-card,
html[data-app-theme="light"] .empty-state,
html[data-app-theme="light"] .login-card,
html[data-app-theme="light"] .modal-container {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(247, 250, 252, 0.98));
}

html[data-app-theme="light"] .btn-secondary,
html[data-app-theme="light"] .btn-mini,
html[data-app-theme="light"] .btn-icon,
html[data-app-theme="light"] .mini-row,
html[data-app-theme="light"] .agent-row,
html[data-app-theme="light"] .agent-checkbox,
html[data-app-theme="light"] .card-stats,
html[data-app-theme="light"] .sparkline-container,
html[data-app-theme="light"] .profile-trigger,
html[data-app-theme="light"] .settings-subnav {
  background: #F8FAFC;
}

html[data-app-theme="light"] .profile-trigger:hover,
html[data-app-theme="light"] .profile-trigger[aria-expanded="true"],
html[data-app-theme="light"] .profile-dropdown > button:hover,
html[data-app-theme="light"] .settings-tab:hover,
html[data-app-theme="light"] .settings-tab.is-active {
  background: #EEF3F8;
}

html[data-app-theme="light"] .section-tab:hover {
  background: #F1F5F9;
  color: #334155;
}

html[data-app-theme="light"] .section-tab.is-active {
  background: #E0F2FE;
  border-color: #7DD3FC;
  color: #0C4A6E;
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.12);
}

html[data-app-theme="light"] .section-tab.is-active i {
  color: #0284C7;
}

html[data-app-theme="light"] .monitor-table th {
  background: #EDF2F7;
}

html[data-app-theme="light"] .table-topbar,
html[data-app-theme="light"] .table-sort-options {
  background: #F8FAFC;
}

html[data-app-theme="light"] .table-sort-button,
html[data-app-theme="light"] .table-sort-options button:hover,
html[data-app-theme="light"] .table-sort-options button[aria-checked="true"] {
  background: #FFFFFF;
}

html[data-app-theme="light"] .monitor-table tr:hover {
  background: rgba(14, 165, 233, 0.045);
}

html[data-app-theme="light"] .table-header-control input,
html[data-app-theme="light"] .table-header-control select,
html[data-app-theme="light"] input[type="text"],
html[data-app-theme="light"] input[type="password"],
html[data-app-theme="light"] input[type="number"],
html[data-app-theme="light"] input[type="email"],
html[data-app-theme="light"] input[type="url"],
html[data-app-theme="light"] input[type="tel"],
html[data-app-theme="light"] input[type="search"],
html[data-app-theme="light"] textarea,
html[data-app-theme="light"] select {
  background-color: #FFFFFF;
  color: var(--text-main);
}

html[data-app-theme="light"] .section-heading p,
html[data-app-theme="light"] .host-address,
html[data-app-theme="light"] .utility-card-header p,
html[data-app-theme="light"] .client-card-header p,
html[data-app-theme="light"] .target-chip small {
  color: var(--text-muted);
}

html[data-app-theme="light"] .sparkline-range-select option,
html[data-app-theme="light"] .detail-range-select option,
html[data-app-theme="light"] .route-range-select option,
html[data-app-theme="light"] .target-range-select option {
  background: #FFFFFF;
  color: var(--text-main);
}

@media (max-width: 900px) {
  .actions-area {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .profile-menu {
    order: 2;
  }

  .settings-shell-heading,
  .settings-subnav {
    align-items: stretch;
  }

  .settings-shell-heading {
    flex-direction: column;
  }

  .settings-subnav {
    width: 100%;
    overflow-x: auto;
  }

  .settings-tab {
    flex: 1 0 auto;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .profile-trigger {
    min-width: 0;
  }

  .profile-trigger-copy,
  .profile-chevron {
    display: none;
  }

  .profile-dropdown {
    position: fixed;
    top: 5.2rem;
    right: 1rem;
    left: 1rem;
    width: auto;
  }
}


/* ============================================================
   Toast notifications + styled confirm dialog
   ============================================================ */
.toast-stack {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: min(92vw, 380px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-cyan);
  color: var(--text-main);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: var(--glass-blur);
  font-size: 0.9rem;
  line-height: 1.35;
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.toast.toast-in { transform: translateX(0); opacity: 1; }
.toast.toast-leaving { transform: translateX(120%); opacity: 0; }
.toast i { margin-top: 0.1rem; flex-shrink: 0; }
.toast .toast-message { flex: 1; word-break: break-word; }
.toast .toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.15rem;
}
.toast .toast-close:hover { color: var(--text-main); }
.toast-success { border-left-color: var(--accent-green); }
.toast-success i { color: var(--accent-green); }
.toast-error { border-left-color: var(--accent-red); }
.toast-error i { color: var(--accent-red); }
.toast-warning { border-left-color: var(--accent-yellow); }
.toast-warning i { color: var(--accent-yellow); }
.toast-info { border-left-color: var(--accent-cyan); }
.toast-info i { color: var(--accent-cyan); }

.confirm-overlay { z-index: 1600; }
.confirm-container { max-width: 440px; width: 100%; }
.confirm-container .confirm-message {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}
.confirm-container .modal-header h2 i { color: var(--accent-yellow); }

.btn-danger {
  background: var(--accent-red);
  border: 1px solid var(--accent-red);
  color: #fff;
}
.btn-danger:hover { filter: brightness(1.08); }

.login-workspace-note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: -0.35rem 0 0.9rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: rgba(var(--accent-cyan-rgb), 0.08);
  border: 1px solid rgba(var(--accent-cyan-rgb), 0.25);
  color: var(--text-muted);
  font-size: 0.85rem;
}
.login-workspace-note i { color: var(--accent-cyan); }
.login-workspace-note strong { color: var(--text-main); }

/* ============================================================
   Global header search
   ============================================================ */
.global-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.7rem;
  height: 38px;
  min-width: 210px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}
.global-search > i { color: var(--text-muted); font-size: 0.85rem; }
.global-search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
}
.global-search input::placeholder { color: var(--text-dark); }
.global-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 1200;
  max-height: 340px;
  overflow-y: auto;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  backdrop-filter: var(--glass-blur);
  padding: 0.35rem;
}
.global-search-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "icon label type" "icon sub type";
  column-gap: 0.6rem;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.6rem;
  border: none;
  border-radius: 9px;
  background: none;
  color: var(--text-main);
  cursor: pointer;
}
.global-search-item:hover { background: var(--bg-tertiary); }
.global-search-item i { grid-area: icon; align-self: center; color: var(--accent-cyan); }
.global-search-item .gs-label { grid-area: label; font-weight: 600; font-size: 0.9rem; }
.global-search-item .gs-sub { grid-area: sub; font-size: 0.78rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-search-item .gs-type {
  grid-area: type;
  align-self: center;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dark);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}
.global-search-empty { padding: 0.75rem 0.6rem; color: var(--text-muted); font-size: 0.85rem; }

@media (max-width: 900px) {
  .global-search { display: none; }
}

/* ============================================================
   Monitor table bulk actions
   ============================================================ */
.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  background: rgba(var(--accent-cyan-rgb), 0.09);
  border: 1px solid rgba(var(--accent-cyan-rgb), 0.28);
}
.bulk-bar .bulk-count { color: var(--text-main); font-size: 0.9rem; }
.bulk-bar .bulk-count strong { color: var(--accent-cyan); }
.bulk-bar .bulk-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.monitor-table .bulk-select-cell { width: 34px; text-align: center; padding-right: 0; }
.monitor-table .bulk-select-cell input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent-cyan); }
.monitor-table tr.is-selected { background: rgba(var(--accent-cyan-rgb), 0.06); }

/* ============================================================
   Maintenance windows, API tokens, and shared list helpers
   ============================================================ */
.mini-list-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.14);
}
.mini-list-item strong { display: block; font-size: 0.92rem; }
.mini-list-item small { display: block; color: var(--text-muted); font-size: 0.74rem; margin-top: 0.2rem; }
.mini-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
.mini-list-item .status-pill { font-size: 0.62rem; margin-left: 0.4rem; vertical-align: middle; }

.agent-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.4rem;
  border: 1px solid var(--border-color);
  border-radius: 0.65rem;
}

.token-reveal {
  margin: 0.6rem 0;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  word-break: break-all;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
}
.api-usage p { margin: 0 0 0.6rem; font-size: 0.85rem; color: var(--text-muted); }
.api-usage code {
  display: inline-block;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.1rem 0.4rem;
  font-size: 0.78rem;
}

.settings-subheading {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.settings-subheading i { color: var(--accent-cyan); }

/* ============================================================
   Public status page (/status, /status/:slug)
   ============================================================ */
.status-page { display: none; }
body.route-status .app-container { display: none !important; }
body.route-status .status-page { display: block; min-height: 100vh; }

.status-shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}
.status-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.status-brand { font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; }
.status-brand i { color: var(--accent-cyan); }
.status-generated { color: var(--text-muted); font-size: 0.8rem; }
.status-loading { text-align: center; padding: 4rem 0; color: var(--text-muted); }

.status-hero {
  text-align: center;
  padding: 2rem 1.5rem;
  border-radius: 16px;
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
}
.status-hero i { font-size: 2.2rem; margin-bottom: 0.6rem; display: block; }
.status-hero h1 { margin: 0; font-size: 1.5rem; }
.status-hero p { margin: 0.4rem 0 0; color: var(--text-muted); }
.status-hero.status-ok { background: rgba(var(--accent-green-rgb), 0.1); border-color: rgba(var(--accent-green-rgb), 0.35); }
.status-hero.status-ok i, .status-hero.status-ok h1 { color: var(--accent-green); }
.status-hero.status-bad { background: rgba(var(--accent-red-rgb), 0.1); border-color: rgba(var(--accent-red-rgb), 0.35); }
.status-hero.status-bad i, .status-hero.status-bad h1 { color: var(--accent-red); }
.status-hero.status-unknown { background: var(--bg-card); }

.status-section { margin-bottom: 2rem; }
.status-section h2 { font-size: 1rem; margin: 0 0 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.status-monitors { display: flex; flex-direction: column; gap: 0.75rem; }
.status-monitor {
  padding: 1rem 1.1rem;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}
.status-monitor-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.status-monitor-name { font-weight: 600; }
.status-uptime-bars { display: flex; gap: 3px; margin: 0.7rem 0 0.55rem; height: 26px; align-items: stretch; }
.uptime-bar { flex: 1; min-width: 3px; border-radius: 2px; background: var(--bg-tertiary); }
.uptime-ok { background: var(--accent-green); }
.uptime-warn { background: var(--accent-yellow); }
.uptime-bad { background: var(--accent-red); }
.uptime-unknown { background: var(--border-color); }
.status-monitor-foot { display: flex; justify-content: space-between; color: var(--text-muted); font-size: 0.8rem; }
.status-monitor-foot strong { color: var(--text-main); }
.status-nodata { color: var(--text-muted); font-size: 0.85rem; padding: 0.5rem 0; }

.status-incidents { display: flex; flex-direction: column; gap: 0.6rem; }
.status-incident {
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-green);
}
.status-incident.is-ongoing { border-left-color: var(--accent-red); }
.status-incident-head { display: flex; justify-content: space-between; align-items: center; }
.status-incident small { color: var(--text-muted); font-size: 0.78rem; }
.status-footer { text-align: center; color: var(--text-dark); font-size: 0.8rem; margin-top: 2.5rem; }

/* ============================================================
   Production SaaS interface refinements
   ============================================================ */
.app-container {
  max-width: 1440px;
  padding: 1.5rem clamp(1rem, 2.5vw, 2rem) 1rem;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto;
  gap: 1.25rem;
  align-items: center;
  min-height: 5rem;
  padding: 0.9rem 1rem;
}

.logo-area,
.actions-area,
.workspace-switcher,
.profile-trigger {
  min-width: 0;
}

.logo-icon {
  flex: 0 0 3rem;
}

.logo-text {
  min-width: 0;
}

.logo-text .tagline {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions-area {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

body.route-admin .global-search.admin-only {
  display: flex !important;
}

.global-search {
  width: clamp(220px, 23vw, 340px);
  min-width: 0;
  height: 2.75rem;
  background: var(--bg-tertiary);
}

.global-search:focus-within {
  border-color: rgba(var(--accent-cyan-rgb), 0.65);
  box-shadow: 0 0 0 3px rgba(var(--accent-cyan-rgb), 0.13);
}

.workspace-switcher {
  flex: 0 1 245px;
}

.workspace-switcher select {
  width: 100%;
  min-width: 155px;
  max-width: 220px;
  min-height: 2.75rem;
}

.workspace-switcher .btn {
  width: 2.75rem;
  min-width: 2.75rem;
  padding-inline: 0;
}

.profile-trigger {
  min-width: 205px;
}

.section-nav,
body.route-admin .section-nav.admin-only {
  display: grid !important;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
  padding: 0.45rem;
}

.section-tab {
  min-width: 0;
  min-height: 3.45rem;
  display: grid;
  grid-template-columns: 2rem minmax(0, auto);
  gap: 0.4rem;
  justify-content: center;
  align-items: center;
  padding: 0.45rem 0.5rem;
  font-size: clamp(0.76rem, 0.76vw, 0.86rem);
  line-height: 1.15;
  text-align: left;
  white-space: nowrap;
}

.section-tab i {
  width: 1.9rem;
  height: 1.9rem;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 0.58rem;
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.88rem;
  text-align: center;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.section-tab:hover i,
.section-tab.is-active i {
  border-color: rgba(var(--accent-cyan-rgb), 0.22);
  background: rgba(var(--accent-cyan-rgb), 0.1);
}

.section-heading {
  min-height: 4.7rem;
  gap: 1.5rem;
}

.section-heading > div:first-child {
  min-width: 0;
}

.section-heading p {
  display: block;
  max-width: 76ch;
}

.section-actions {
  flex: 0 0 auto;
  align-items: center;
}

.stats-overview {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  min-width: 0;
}

.dashboard-summary-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1rem;
}

.dashboard-summary-panel {
  min-height: 12rem;
}

.dashboard-summary-panel:nth-child(-n + 2) {
  grid-column: span 3;
}

.dashboard-summary-panel:nth-child(n + 3) {
  grid-column: span 2;
}

.admin-panel {
  min-width: 0;
}

.panel-title-row {
  gap: 1rem;
  align-items: flex-start;
}

.panel-title-row h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-title-row h3 i {
  flex: 0 0 1rem;
  width: 1rem;
  color: var(--accent-cyan);
  text-align: center;
}

.panel-title-row > .btn {
  flex: 0 0 auto;
  min-width: 7rem;
  white-space: nowrap;
}

.panel-title-row h3,
.section-heading h2 {
  letter-spacing: -0.02em;
}

.cards-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}

.settings-grid .workspace-visibility-panel {
  grid-column: 1 / -1;
}

.workspace-visibility-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workspace-visibility-grid .switch-row {
  min-height: 3.1rem;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.workspace-visibility-grid .switch-row:hover {
  border-color: var(--border-hover);
  background: var(--bg-tertiary);
}

.workspace-visibility-grid .switch-row:has(input:checked) {
  border-color: rgba(var(--accent-cyan-rgb), 0.35);
  background: rgba(var(--accent-cyan-rgb), 0.075);
}

.workspace-visibility-grid input {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 1.1rem;
  accent-color: var(--accent-cyan);
}

.workspace-visibility-form > .btn {
  justify-self: start;
}

input[type="date"],
input[type="datetime-local"],
input[type="file"] {
  width: 100%;
  min-height: 2.65rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 0.72rem;
  background: var(--bg-tertiary);
  color: var(--text-main);
}

input[type="file"]::file-selector-button {
  margin: -0.4rem 0.7rem -0.4rem -0.55rem;
  padding: 0.48rem 0.72rem;
  border: 0;
  border-right: 1px solid var(--border-color);
  background: rgba(var(--accent-cyan-rgb), 0.09);
  color: var(--text-main);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

:is(button, a, input, select, textarea):focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

.checkbox-container input:focus-visible ~ .checkmark {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

.btn:disabled,
.btn-mini:disabled,
.btn-icon:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.btn-icon {
  min-width: 2.4rem;
  min-height: 2.4rem;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.footer-links a {
  display: inline-flex;
}

.settings-subnav {
  scrollbar-width: none;
}

.settings-subnav::-webkit-scrollbar {
  display: none;
}

html[data-app-theme="light"] {
  --text-dark: #64748B;
}

@media (max-width: 1120px) {
  .app-header {
    grid-template-columns: 1fr;
  }

  .actions-area {
    width: 100%;
    justify-content: stretch;
  }

  .global-search {
    flex: 1 1 260px;
    width: auto;
  }

  .workspace-switcher {
    flex: 0 1 255px;
    width: auto;
    order: initial;
  }

  .section-nav,
  body.route-admin .section-nav.admin-only {
    grid-template-columns: repeat(7, minmax(155px, 1fr));
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

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

  .dashboard-summary-panel:nth-child(n) {
    grid-column: auto;
  }
}

@media (max-width: 900px) {
  body.route-admin .global-search.admin-only {
    display: none !important;
  }

  .app-header {
    gap: 0.9rem;
  }

  .actions-area {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
  }

  .workspace-switcher {
    width: auto;
    order: initial;
  }

  .profile-menu {
    order: initial;
  }

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

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

@media (max-width: 780px) {
  .app-container {
    padding-inline: 0.85rem;
  }

  .section-nav,
  body.route-admin .section-nav.admin-only {
    display: grid !important;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(170px, 56vw);
    flex-direction: initial;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .section-nav::-webkit-scrollbar {
    display: none;
  }

  .section-tab {
    width: auto;
    justify-content: start;
    scroll-snap-align: start;
  }

  .section-heading {
    min-height: 0;
    align-items: stretch;
  }

  .section-actions {
    display: flex;
    width: 100%;
  }

  .section-actions > .btn,
  .section-actions > .view-switcher {
    flex: 1 1 auto;
  }

  .view-switcher {
    justify-content: center;
  }

  .dashboard-summary-grid {
    grid-template-columns: 1fr;
  }

  .cards-grid,
  .monitors-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-footer {
    gap: 0.8rem;
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .app-container {
    padding: 0.8rem 0.7rem;
  }

  .app-header {
    grid-template-columns: minmax(0, 1fr);
    padding: 0.8rem;
    border-radius: 1rem;
  }

  .logo-icon {
    width: 2.65rem;
    height: 2.65rem;
    flex-basis: 2.65rem;
  }

  .logo-text h1 {
    font-size: 1.3rem;
  }

  .logo-text .tagline {
    font-size: 0.76rem;
  }

  .actions-area {
    flex-direction: initial;
  }

  .workspace-switcher select {
    min-width: 0;
    max-width: none;
  }

  .profile-trigger {
    width: 2.75rem;
    min-width: 2.75rem;
    padding: 0.35rem;
  }

  .profile-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    left: auto;
    width: min(320px, calc(100vw - 2rem));
  }

  .section-nav,
  body.route-admin .section-nav.admin-only {
    margin-bottom: 1rem;
    grid-auto-columns: minmax(165px, 58vw);
  }

  .section-heading {
    padding: 0.9rem;
  }

  .section-heading h2 {
    font-size: 1.15rem;
  }

  .section-actions {
    gap: 0.5rem;
  }

  .section-actions > .btn,
  .section-actions > .view-switcher {
    flex: 1 1 100%;
  }

  .stats-overview {
    gap: 0.65rem;
  }

  .stat-card {
    gap: 0.65rem;
    padding: 0.8rem;
  }

  .stat-icon {
    width: 2.3rem;
    height: 2.3rem;
    flex: 0 0 2.3rem;
  }

  .stat-info span {
    font-size: 0.62rem;
  }

  .stat-info strong {
    font-size: 1.35rem;
  }

  .workspace-visibility-grid {
    grid-template-columns: 1fr;
  }

  .panel-title-row {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-title-row > .btn {
    width: 100%;
    min-width: 0;
  }

  .admin-panel,
  .utility-card,
  .client-card {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
