@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ══════════════════════════════════════════════════════════════
   DESIGN TOKENS  –  dark (default) / light
══════════════════════════════════════════════════════════════ */
:root {
  /* backgrounds */
  --bg:         #0d0f18;
  --surface:    #151822;
  --surface2:   #1e2235;
  --surface3:   #252a40;
  /* borders */
  --border:     #2a2f4a;
  --border2:    #363d5e;
  /* accent — PingForever brand purple (light variant for dark mode) */
  --accent:     #7B6FFF;
  --accent-dim: rgba(123,111,255,.15);
  --accent2:    #6ee7b7;
  /* text */
  --text:       #e9ecf8;
  --text2:      #b8bfda;
  --muted:      #7a84a8;
  /* semantic */
  --success:    #22c55e;
  --success-bg: #052e16;
  --danger:     #ef4444;
  --danger-bg:  #2d0a0a;
  --warn:       #f59e0b;
  --warn-bg:    #2d1b02;
  --info:       #38bdf8;
  --info-bg:    #0c2340;
  /* radius / shadow / transitions */
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 4px 28px rgba(0,0,0,.5);
  --shadow-sm:  0 2px 10px rgba(0,0,0,.3);
  --transition: .18s ease;
  /* layout */
  --sidebar-w:  228px;
  --topnav-h:   60px;
}

[data-theme="light"] {
  --bg:         #f0f3fb;
  --surface:    #ffffff;
  --surface2:   #f5f7fe;
  --surface3:   #eaedfa;
  --border:     #dde3f4;
  --border2:    #c8d1ec;
  /* accent — PingForever brand purple (full dark purple on light backgrounds) */
  --accent:     #200B56;
  --accent-dim: rgba(32,11,86,.10);
  --text:       #111827;
  --text2:      #374151;
  --muted:      #6b7280;
  --success:    #16a34a;
  --success-bg: #dcfce7;
  --danger:     #dc2626;
  --danger-bg:  #fee2e2;
  --warn:       #d97706;
  --warn-bg:    #fef3c7;
  --info:       #0284c7;
  --info-bg:    #e0f2fe;
  --shadow:     0 4px 28px rgba(0,0,0,.10);
  --shadow-sm:  0 2px 10px rgba(0,0,0,.06);
}

/* ══════════════════════════════════════════════════════════════
   BASE
══════════════════════════════════════════════════════════════ */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6,
.page-title, .topnav-brand, .stat-val, .card-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  letter-spacing: -0.02em;
}

/* ══════════════════════════════════════════════════════════════
   THEME TOGGLE
══════════════════════════════════════════════════════════════ */
.theme-toggle {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.05rem;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover { background: var(--border); color: var(--text); }

/* ══════════════════════════════════════════════════════════════
   TOP NAV
══════════════════════════════════════════════════════════════ */
.topnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: var(--topnav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  gap: 10px;
}
.topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.03em;
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 0;
}
.topnav-brand .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .6; transform: scale(1.3); }
}
.topnav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.badge-time {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface2);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* Hamburger button – hidden on desktop */
.nav-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition);
}
.nav-hamburger:hover { background: var(--surface3); }
.nav-hamburger svg { pointer-events: none; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 149;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* ══════════════════════════════════════════════════════════════
   PROFILE AVATAR / DROPDOWN
══════════════════════════════════════════════════════════════ */
.profile-link {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--muted);
  -webkit-tap-highlight-color: transparent;
}
.profile-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; color: #fff;
  background: linear-gradient(135deg, var(--accent), #6b7cff);
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  flex-shrink: 0;
  transition: transform .12s ease;
}
.profile-link:hover .profile-avatar { transform: translateY(-1px); }
.profile-name { font-size: 0.82rem; color: var(--muted); white-space: nowrap; }

.profile-menu { position: relative; display: inline-flex; align-items: center; }
.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 170px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 400;
  overflow: hidden;
}
.profile-menu:hover .profile-dropdown,
.profile-menu:focus-within .profile-dropdown,
.profile-menu.open .profile-dropdown { display: block; }
.profile-dropdown-item {
  display: block;
  padding: 11px 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background var(--transition);
}
.profile-dropdown-item:hover { background: var(--surface2); }
.profile-dropdown-item + .profile-dropdown-item { border-top: 1px solid var(--border); }

.notif-link {
  color: var(--muted); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  padding: 0; border-radius: var(--radius-sm); font-size: 1rem;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition), color var(--transition);
  border: 1px solid transparent;
}
.notif-link:hover { color: var(--accent); background: var(--accent-dim); border-color: var(--border); }
.notif-link i { font-size: 0.95rem; }

/* ══════════════════════════════════════════════════════════════
   SIDEBAR NAV
══════════════════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  left: 0;
  top: var(--topnav-h);
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 10px;
  overflow-y: auto;
  z-index: 150;
  transition: transform .25s ease;
  overscroll-behavior: contain;
}
.sidebar .menu { display: flex; flex-direction: column; gap: 2px; }
.sidebar .menu-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 0.875rem; font-weight: 600;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
  border: 1px solid transparent;
}
/* FA icon in sidebar */
.sidebar .menu-item i {
  width: 18px; text-align: center; font-size: 0.9rem; flex-shrink: 0;
  opacity: 0.75;
  transition: opacity var(--transition);
}
.sidebar .menu-item:hover {
  background: var(--surface2);
  color: var(--text);
}
.sidebar .menu-item:hover i { opacity: 1; }
.sidebar .menu-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(123,111,255,.18);
  font-weight: 700;
}
.sidebar .menu-item.active i { opacity: 1; }
[data-theme="light"] .sidebar .menu-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(32,11,86,.12);
}

/* ══════════════════════════════════════════════════════════════
   PAGE LAYOUT  (sidebar + content)
══════════════════════════════════════════════════════════════ */
.page {
  margin-left: var(--sidebar-w);
  padding: 28px 24px 80px;
  min-height: calc(100vh - var(--topnav-h));
  max-width: 1280px;
}

/* ══════════════════════════════════════════════════════════════
   TOPNAV RUN-CHECKS BUTTON (dashboard only)
══════════════════════════════════════════════════════════════ */
.topnav-run {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 0.85rem; font-weight: 700;
  color: var(--text); text-decoration: none;
  padding: 7px 14px; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1px solid var(--border);
  cursor: pointer; white-space: nowrap;
  transition: background var(--transition), transform .06s ease;
  -webkit-tap-highlight-color: transparent;
}
.topnav-run:hover { background: var(--surface3); color: var(--text); transform: translateY(-1px); }
.topnav-run:active { transform: none; }
.topnav-run:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-dim); }

/* ══════════════════════════════════════════════════════════════
   PAGE HEADING
══════════════════════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.page-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.2;
}

/* ══════════════════════════════════════════════════════════════
   STAT CARDS
══════════════════════════════════════════════════════════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.stat-up::before   { background: var(--success); }
.stat-down::before { background: var(--danger); }
.stat-unk::before  { background: var(--muted); }
.stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
}
.stat-up   .stat-value { color: var(--success); }
.stat-down .stat-value { color: var(--danger); }
.stat-unk  .stat-value { color: var(--muted); }
.stat-icon {
  position: absolute;
  right: 16px; bottom: 12px;
  font-size: 1.8rem;
  opacity: .1;
}

/* ══════════════════════════════════════════════════════════════
   ALERT / INFO BANNERS
══════════════════════════════════════════════════════════════ */
.alert {
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  margin-bottom: 18px;
  font-size: 0.88rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid rgba(56,189,248,.25); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34,197,94,.25); }
.alert-warn    { background: var(--warn-bg);    color: var(--warn);    border: 1px solid rgba(245,158,11,.25); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(239,68,68,.25); }
/* legacy: keep existing .alert as info style */
.alert:not(.alert-success):not(.alert-warn):not(.alert-danger) {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(56,189,248,.25);
}
/* override hardcoded colours in settings/analytics */
.alert.success { background: var(--success-bg) !important; color: var(--success) !important; border: 1px solid rgba(34,197,94,.25) !important; }
.alert.error   { background: var(--danger-bg)  !important; color: var(--danger)  !important; border: 1px solid rgba(239,68,68,.25)  !important; }
.alert.warning { background: var(--warn-bg)    !important; color: var(--warn)    !important; border: 1px solid rgba(245,158,11,.25) !important; }

/* ══════════════════════════════════════════════════════════════
   SECTION HEADING
══════════════════════════════════════════════════════════════ */
.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

/* ══════════════════════════════════════════════════════════════
   CARD  (generic surface container)
══════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.card + .card { margin-top: 16px; }
.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

/* ══════════════════════════════════════════════════════════════
   TABLE TOOLBAR + SEARCH
══════════════════════════════════════════════════════════════ */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.search-wrap { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 9px 32px 9px 34px;
  width: 220px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.search-input::placeholder { color: var(--muted); }
.search-clear {
  position: absolute; right: 8px;
  background: none; border: none; color: var(--muted);
  font-size: 1.1rem; cursor: pointer; line-height: 1; padding: 0 2px;
}
.search-clear:hover { color: var(--text); }
.no-results td { text-align: center; padding: 32px; color: var(--muted); }

/* ══════════════════════════════════════════════════════════════
   SORTABLE TABLE HEADERS
══════════════════════════════════════════════════════════════ */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--accent); }
th.sortable.asc  .sort-arrow::after { content: ' \2191'; color: var(--accent); }
th.sortable.desc .sort-arrow::after { content: ' \2193'; color: var(--accent); }
th.sortable:not(.asc):not(.desc) .sort-arrow::after { content: ' \2195'; opacity: .35; }

/* ══════════════════════════════════════════════════════════════
   SITES TABLE CARD
══════════════════════════════════════════════════════════════ */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
col.col-name     { width: 20%; }
col.col-url      { width: 28%; }
col.col-checked  { width: 12%; }
col.col-next     { width: 12%; }
col.col-status   { width: 8%; }
col.col-http     { width: 6%; }
col.col-latency  { width: 6%; }
col.col-interval { width: 6%; }
col.col-comments { width: auto; }
col.col-actions  { width: 160px; }
.table-card tbody td:last-child { overflow: visible; }
.table-card .btn-actions .btn-icon { padding: 6px 9px; font-size: 0.85rem; }
thead tr { background: var(--surface2); }
thead th {
  padding: 11px 14px;
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); text-align: left; overflow: hidden;
  white-space: nowrap;
}
tbody tr { border-top: 1px solid var(--border); transition: background .12s; }
tbody tr:hover { background: var(--surface2); }
tbody td {
  padding: 12px 14px; font-size: 0.88rem;
  color: var(--text); vertical-align: middle; overflow: hidden;
}
.site-name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.site-url  { color: var(--accent); text-decoration: none; font-size: 0.81rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 100%; }
.site-url:hover { text-decoration: underline; }
.row-up   { border-left: 3px solid var(--success); }
.row-down { border-left: 3px solid var(--danger); }
.row-unk  { border-left: 3px solid var(--border); }
.checked-time { color: var(--muted); font-size: 0.79rem; white-space: nowrap; }
.latency-ok   { color: var(--success); font-weight: 600; }
.latency-slow { color: var(--warn);    font-weight: 600; }
.comment-text { color: var(--warn); font-size: 0.8rem; }
.comment-eye  { display: inline-flex; align-items: center; color: var(--warn); cursor: default; }
.empty-row td { text-align: center; padding: 40px; color: var(--muted); }

/* ══════════════════════════════════════════════════════════════
   JS TOOLTIP
══════════════════════════════════════════════════════════════ */
#uc-tooltip {
  position: fixed; z-index: 9999;
  background: var(--surface);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.78rem; font-weight: 500; line-height: 1.5;
  padding: 8px 12px; border-radius: 9px;
  border: 1px solid var(--border2);
  box-shadow: var(--shadow);
  max-width: 260px; pointer-events: none;
  opacity: 0; transition: opacity .15s ease;
  white-space: normal; word-break: break-word;
}
#uc-tooltip.visible { opacity: 1; }
#uc-tooltip::after {
  content: ''; position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border2);
}

/* ══════════════════════════════════════════════════════════════
   STATUS BADGE
══════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.73rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-up      { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34,197,94,.25); }
.badge-up::before    { background: var(--success); box-shadow: 0 0 4px var(--success); }
.badge-down    { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(239,68,68,.25); }
.badge-down::before  { background: var(--danger); }
.badge-unknown { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.badge-unknown::before { background: var(--muted); }

/* ══════════════════════════════════════════════════════════════
   BUTTONS  – fully theme-aware
══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.85rem; font-weight: 600;
  padding: 8px 16px; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: opacity var(--transition), transform .1s, background var(--transition), color var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
  line-height: 1.4;
}
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: none; opacity: 1; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary  { background: var(--accent);      color: #fff;          border-color: transparent; }
.btn-ghost    { background: var(--surface2);    color: var(--text);   border-color: var(--border); }
.btn-ghost:hover { background: var(--surface3); opacity: 1; }
.btn-run      { background: linear-gradient(135deg, var(--accent), #6366f1); color: #fff; border-color: transparent; }
.btn-edit     { background: var(--accent-dim);  color: var(--accent); border-color: rgba(79,125,255,.25); }
.btn-del      { background: var(--danger-bg);   color: var(--danger); border-color: rgba(239,68,68,.25); }
.btn-success  { background: var(--success-bg);  color: var(--success);border-color: rgba(34,197,94,.25); }
.btn-warn     { background: var(--warn-bg);     color: var(--warn);   border-color: rgba(245,158,11,.25); }
.btn-sm       { padding: 5px 12px; font-size: 0.78rem; }
.btn-lg       { padding: 11px 22px; font-size: 0.95rem; }
.btn-full     { width: 100%; justify-content: center; }

/* icon-style action button (table rows etc.) */
.btn-icon {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 11px;
  background: var(--accent); color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer; font-family: inherit; font-size: 0.82rem; font-weight: 600;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), transform .1s, box-shadow var(--transition);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn-icon:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-icon:active { transform: none; }
.btn-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-icon.secondary { background: var(--surface2); color: var(--text); border-color: var(--border); }
.btn-icon.secondary:hover { background: var(--surface3); }
.btn-icon.danger    { background: var(--danger-bg); color: var(--danger); border-color: rgba(239,68,68,.25); }
.btn-icon.warn      { background: var(--warn-bg);   color: var(--warn);   border-color: rgba(245,158,11,.25); }
.btn-icon.success   { background: var(--success-bg);color: var(--success);border-color: rgba(34,197,94,.25); }

.btn-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ══════════════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════════════ */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.form-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 18px; color: var(--text); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 0.75rem; font-weight: 700;
  color: var(--muted); letter-spacing: .06em; text-transform: uppercase;
}
.field input,
.field select,
.field textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit; font-size: 0.9rem;
  padding: 10px 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.field input::placeholder,
.field textarea::placeholder { color: var(--muted); }
.field select { cursor: pointer; }
.field-hint { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

/* URL combo input */
.url-combo {
  display: flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.url-combo:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.url-scheme {
  background: var(--surface2); border: none; border-right: 1px solid var(--border);
  color: var(--muted); font-family: inherit; font-size: 0.84rem; font-weight: 600;
  padding: 0 10px; cursor: pointer; outline: none; flex-shrink: 0;
}
.url-domain {
  flex: 1; background: var(--surface2); border: none !important;
  border-radius: 0 !important; box-shadow: none !important;
  padding: 10px 13px; font-family: inherit; font-size: 0.88rem;
  color: var(--text); outline: none; min-width: 0;
}
.url-domain::placeholder { color: var(--muted); }

/* ══════════════════════════════════════════════════════════════
   SETTINGS / INNER PAGE OVERRIDE
   (pages with their own <style> blocks use --primary etc.)
══════════════════════════════════════════════════════════════ */
:root {
  --primary:       var(--accent);
  --card-bg:       var(--surface);
  --bg-secondary:  var(--surface2);
  --text-primary:  var(--text);
  --text-secondary:var(--muted);
  --code-bg:       var(--surface3);
  --input-bg:      var(--surface2);
  --warning:       var(--warn);
}

/* Fix hardcoded code-block colour in settings.php */
.code-block {
  background: var(--surface3) !important;
  color: var(--text) !important;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  overflow-x: auto;
  margin: 8px 0;
  border: 1px solid var(--border);
}

/* Toggle switch (settings page) */
.toggle-label { display: flex; align-items: center; cursor: pointer; gap: 10px; }
.toggle-switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--surface3); border: 1px solid var(--border);
  transition: .25s; border-radius: 24px;
}
.toggle-slider:before {
  position: absolute; content: "";
  height: 18px; width: 18px;
  left: 2px; bottom: 2px;
  background: var(--muted); transition: .25s; border-radius: 50%;
}
input:checked + .toggle-slider { background: var(--success); border-color: var(--success); }
input:checked + .toggle-slider:before { transform: translateX(20px); background: #fff; }

/* ══════════════════════════════════════════════════════════════
   MOBILE CARD VIEW  (replace table rows on small screens)
══════════════════════════════════════════════════════════════ */
.mobile-card-list { display: none; }
.m-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: inherit;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.m-card:hover { background: var(--surface2); }
.m-card-left { flex: 1; min-width: 0; }
.m-card-name { font-weight: 700; font-size: 0.95rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-card-url  { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.m-card-meta { font-size: 0.75rem; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.m-card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
══════════════════════════════════════════════════════════════ */

/* ── 1024px: narrow sidebar ── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 200px; }
  .page { padding: 22px 18px 72px; }
}

/* ── 900px: hide sidebar, show hamburger ── */
@media (max-width: 900px) {
  :root { --sidebar-w: 220px; }

  .nav-hamburger { display: flex; }

  .sidebar {
    transform: translateX(-110%);
    top: 0; /* full-height drawer on mobile */
    box-shadow: var(--shadow);
    z-index: 160;
  }
  .sidebar.open { transform: translateX(0); }

  .page {
    margin-left: 0;
    padding: 18px 16px 72px;
  }

  /* table columns: hide URL, Last Checked, HTTP, Interval */
  col.col-url, col.col-checked, col.col-http, col.col-interval { width: 0; }
  thead th:nth-child(2), tbody td:nth-child(2),
  thead th:nth-child(3), tbody td:nth-child(3),
  thead th:nth-child(6), tbody td:nth-child(6),
  thead th:nth-child(8), tbody td:nth-child(8) { display: none; }
  col.col-name    { width: 30%; }
  col.col-status  { width: 16%; }
  col.col-latency { width: 14%; }
  col.col-actions { width: 120px; }
}

/* ── 768px: tighter spacing ── */
@media (max-width: 768px) {
  .topnav { padding: 0 14px; gap: 8px; }
  .badge-time, .profile-name, .badge-auto, .user-email { display: none; }
  .stat-value { font-size: 1.8rem; }
  .form-grid { grid-template-columns: 1fr; }
  .search-input { width: 100%; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ── 560px: mobile — show card list instead of table ── */
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat-card { padding: 13px 14px; }
  .stat-value { font-size: 1.5rem; }
  .stat-icon  { font-size: 1.4rem; }

  /* hide full table, show card list */
  .table-wrap table { display: none; }
  .mobile-card-list  { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px 14px; }

  .btn-actions .btn-icon .btn-label { display: none; }
  .btn-sm { padding: 5px 8px; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { justify-content: center; }

  .topnav-right { gap: 6px; }
  .topnav-run { font-size: 0; padding: 8px; }
  .topnav-run::before { content: '▶'; font-size: 0.85rem; }
  .page { padding: 14px 12px 80px; }

  /* table toolbar stacks nicely */
  .table-toolbar > div:first-child { flex-direction: column; align-items: stretch; gap: 8px; }
  #addMonitorBtn { width: 100%; justify-content: center; }
}

/* ── 400px: very small phones ── */
@media (max-width: 400px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .stat-card { padding: 10px 11px; }
  .stat-value { font-size: 1.25rem; }
  .stat-label { font-size: 0.62rem; }
  .topnav-brand span:not(.dot) { font-size: 0.88rem; }
}

/* ══════════════════════════════════════════════════════════════
   PWA  –  safe-area insets for notched phones
══════════════════════════════════════════════════════════════ */
@supports (padding: max(0px)) {
  .topnav { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .sidebar { padding-left: max(10px, env(safe-area-inset-left)); }
  .page { padding-bottom: max(80px, calc(env(safe-area-inset-bottom) + 60px)); }
}

