/* ============================================================
   QubeMonitor — Design System
   Modern, clean, dark/light theme with CSS custom properties
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── 1. CSS Custom Properties (Tokens) ─────────────────────── */
:root {
  /* Colors — light mode defaults */
  --bg-body:      #f1f5f9;
  --bg-surface:   #ffffff;
  --bg-surface-2: #f8fafc;
  --bg-sidebar:   #0f172a;
  --sidebar-text: rgba(255,255,255,0.7);
  --sidebar-active: #ffffff;
  --border:       rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.15);

  --text-primary:   #0f172a;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;
  --text-inverse:   #ffffff;

  --accent:        #6366f1;
  --accent-hover:  #4f46e5;
  --accent-light:  rgba(99,102,241,0.12);

  --status-up:        #22c55e;
  --status-up-bg:     rgba(34,197,94,0.12);
  --status-down:      #ef4444;
  --status-down-bg:   rgba(239,68,68,0.12);
  --status-warn:      #f59e0b;
  --status-warn-bg:   rgba(245,158,11,0.12);
  --status-unknown:   #94a3b8;
  --status-unknown-bg: rgba(148,163,184,0.12);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-width: 240px;
  --topbar-height: 64px;
}

/* Dark theme */
[data-theme="dark"] {
  --bg-body:      #0b0f19;
  --bg-surface:   #131929;
  --bg-surface-2: #1a2236;
  --bg-sidebar:   #080c14;
  --border:       rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.12);

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
}

/* ── 2. Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15px;
  scroll-behavior: smooth;
  color-scheme: light;
}
[data-theme="dark"] { color-scheme: dark; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  min-height: 100dvh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img, svg { display: block; }

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

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

/* ── 3. Layout: Sidebar + Main ──────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100dvh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-block-end: 1px solid rgba(255,255,255,0.06);
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-icon svg { color: #fff; }

.sidebar-logo-text {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.sidebar-logo-sub {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  font-weight: 400;
}

.sidebar-nav { padding: 12px; flex: 1; }

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3);
  padding: 12px 8px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
  margin-block-end: 2px;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}

.sidebar-link.active {
  background: rgba(99,102,241,0.2);
  color: #fff;
}

.sidebar-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-link.active svg,
.sidebar-link:hover svg { opacity: 1; }

.sidebar-footer {
  padding: 12px;
  border-block-start: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.4);
}

/* ── Main Content ── */
.main-content {
  margin-inline-start: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-block-end: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background var(--transition), border-color var(--transition);
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

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

/* Theme toggle button */
.btn-theme {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.btn-theme:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}

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

.hidden { display: none !important; }

/* ── Page Content ── */
.page-content {
  padding: 28px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-block-end: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-block-start: 4px;
}

/* ── 4. Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition), background var(--transition);
}

.card-header {
  padding: 20px 24px 16px;
  border-block-end: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body { padding: 24px; }

/* ── Service Card (Dashboard) ── */
.service-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-decoration: none;
  color: inherit;
}

.service-card::before {
  content: '';
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transition: background var(--transition);
}

.service-card.up::before      { background: var(--status-up); }
.service-card.down::before    { background: var(--status-down); }
.service-card.unknown::before { background: var(--status-unknown); }

.service-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.service-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.service-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.service-icon.up      { background: var(--status-up-bg);      color: var(--status-up); }
.service-icon.down    { background: var(--status-down-bg);    color: var(--status-down); }
.service-icon.unknown { background: var(--status-unknown-bg); color: var(--status-unknown); }

.service-icon svg { width: 18px; height: 18px; }

.service-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-block-end: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-card-host {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.status-badge.up      { background: var(--status-up-bg);      color: var(--status-up); }
.status-badge.down    { background: var(--status-down-bg);    color: var(--status-down); }
.status-badge.unknown { background: var(--status-unknown-bg); color: var(--status-unknown); }

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.up::before { animation: pulse-dot 2s ease-in-out infinite; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

.service-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-block-start: 12px;
  border-block-start: 1px solid var(--border);
}

.stat-item { display: flex; flex-direction: column; gap: 2px; }

.stat-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.text-up      { color: var(--status-up)   !important; }
.text-down    { color: var(--status-down) !important; }
.text-warning { color: var(--status-warn) !important; }
.text-muted   { color: var(--text-muted)  !important; }

/* ── 5. Stats Row (Dashboard Summary) ─────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-block-end: 28px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-icon.green { background: var(--status-up-bg);   color: var(--status-up); }
.stat-card-icon.red   { background: var(--status-down-bg); color: var(--status-down); }
.stat-card-icon.blue  { background: var(--accent-light);   color: var(--accent); }
.stat-card-icon.amber { background: var(--status-warn-bg); color: var(--status-warn); }

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

.stat-card-num {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1;
}

.stat-card-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-block-start: 4px;
}

/* ── 6. Services Grid ────────────────────────────────────────── */
.group-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-block: 24px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ── 7. Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 0 3px var(--accent-light); }

.btn-secondary {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-strong); background: var(--bg-surface); }

.btn-danger {
  background: var(--status-down-bg);
  color: var(--status-down);
  border: 1px solid transparent;
}
.btn-danger:hover { background: var(--status-down); color: #fff; }

.btn-success {
  background: var(--status-up-bg);
  color: var(--status-up);
  border: 1px solid transparent;
}
.btn-success:hover { background: var(--status-up); color: #fff; }

.btn-sm    { padding: 5px 10px; font-size: 0.8rem; }
.btn-icon  { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: var(--radius-sm); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── 8. Forms ────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  padding: 9px 13px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }

.form-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Toggle Switch */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }

.toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 999px;
  transition: background var(--transition);
  cursor: pointer;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  inset-block-start: 3px;
  inset-inline-start: 3px;
  transition: translate var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { translate: 18px 0; }

.toggle-label { font-size: 0.875rem; color: var(--text-primary); }

/* ── 9. Modal ────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90dvh;
  overflow-y: auto;
  translate: 0 20px;
  transition: translate var(--transition);
}

.modal-backdrop.open .modal { translate: 0 0; }

.modal-header {
  padding: 24px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}

.modal-close:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body   { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { padding: 0 24px 24px; display: flex; justify-content: flex-end; gap: 10px; }

/* ── 10. Table ────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

thead th {
  background: var(--bg-surface-2);
  padding: 11px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-block-end: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-block-end: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child { border-block-end: none; }
tbody tr:hover { background: var(--bg-surface-2); }

tbody td {
  padding: 12px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}

.td-actions { display: flex; align-items: center; gap: 6px; }

/* ── 11. Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-block-end: 1px solid var(--border);
  margin-block-end: 28px;
}

.tab {
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-block-end: 2px solid transparent;
  margin-block-end: -1px;
  transition: all var(--transition);
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover  { color: var(--text-primary); }
.tab.active { color: var(--accent); border-block-end-color: var(--accent); }

.tab-panel        { display: none; }
.tab-panel.active { display: block; }

/* ── 12. Toasts ──────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  inset-block-end: 24px;
  inset-inline-end: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 380px;
  pointer-events: auto;
  animation: toast-in 0.3s ease forwards;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.toast.success { border-inline-start: 3px solid var(--status-up); }
.toast.error   { border-inline-start: 3px solid var(--status-down); }
.toast.info    { border-inline-start: 3px solid var(--accent); }

.toast-icon svg  { width: 18px; height: 18px; }
.toast.success .toast-icon { color: var(--status-up); }
.toast.error   .toast-icon { color: var(--status-down); }
.toast.info    .toast-icon { color: var(--accent); }

@keyframes toast-in {
  from { opacity: 0; translate: 0 20px; }
  to   { opacity: 1; translate: 0 0; }
}

/* ── 13. Login Page ──────────────────────────────────────────── */
.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(139,92,246,0.1)  0%, transparent 50%);
  pointer-events: none;
}

[data-theme="dark"] .login-bg {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.22) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(139,92,246,0.16) 0%, transparent 50%);
}

.login-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-block-end: 32px;
  text-align: center;
}

.login-logo-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(99,102,241,0.3);
}

.login-logo-icon svg { width: 28px; height: 28px; color: #fff; }

.login-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.login-subtitle { font-size: 0.85rem; color: var(--text-muted); }

.login-error {
  background: var(--status-down-bg);
  border: 1px solid rgba(239,68,68,0.2);
  color: var(--status-down);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-block-end: 16px;
}

/* ── 14. Service Detail ──────────────────────────────────────── */
.detail-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-block-end: 24px;
  flex-wrap: wrap;
}

.detail-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.detail-icon svg { width: 26px; height: 26px; }
.detail-meta     { flex: 1; min-width: 200px; }

.detail-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.detail-host {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  margin-block-start: 4px;
}

.detail-badges { display: flex; align-items: center; gap: 8px; margin-block-start: 12px; flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.stats-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-block-end: 24px;
}

.stats-mini-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stats-mini-val {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  line-height: 1;
}

.stats-mini-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-block-start: 6px;
}

/* Chart wrapper */
.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-block-end: 24px;
}

.chart-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-block-end: 20px;
}

.chart-container { position: relative; height: 200px; }

/* ── 15. Empty State ─────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state svg { width: 48px; height: 48px; opacity: 0.4; }
.empty-state h3  { font-size: 1rem; font-weight: 600; color: var(--text-secondary); }
.empty-state p   { font-size: 0.875rem; max-width: 280px; }

/* ── 16. Hamburger ───────────────────────────────────────────── */
.hamburger {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.hamburger:hover { color: var(--text-primary); background: var(--bg-surface-2); }
.hamburger svg   { width: 20px; height: 20px; }

/* ── 17. Skeleton loader & Spinner ───────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-surface-2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

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

/* ── 18. Log Table & Misc ─────────────────────────────────────── */
.log-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.log-status.up   { color: var(--status-up); }
.log-status.down { color: var(--status-down); }

/* Refresh indicator */
.refresh-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.refresh-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-up);
  animation: pulse-dot 2s ease-in-out infinite;
}

/* ── 19. Responsive ──────────────────────────────────────────── */
@media (max-width: 1200px) {
  .stats-row    { grid-template-columns: repeat(2, 1fr); }
  .stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    transform: translateX(-240px);
    width: 240px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-content { margin-inline-start: 0; }

  .topbar      { padding: 0 16px; }
  .page-content { padding: 16px; }

  .stats-row    { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stats-grid-4 { grid-template-columns: 1fr 1fr; gap: 12px; }

  .form-grid-2,
  .form-grid-3  { grid-template-columns: 1fr; }

  .services-grid { grid-template-columns: 1fr 1fr; }

  .detail-hero { flex-direction: column; }

  .hamburger { display: flex; }
}

@media (max-width: 500px) {
  .services-grid { grid-template-columns: 1fr; }
  .stats-row     { grid-template-columns: 1fr 1fr; }
}

/* ── 20. Reduced Motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .service-card:hover          { transform: none; }
  .status-badge.up::before     { animation: none; }
  .skeleton                    { animation: none; }
  .spinner                     { animation: none; }
  .refresh-dot                 { animation: none; }
}
