:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e3e7ed;
  --border-strong: #cfd6df;
  --text: #172033;
  --muted: #667085;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --on-primary: #ffffff;
  --ok: #127a54;
  --ok-soft: #e7f7ef;
  --ok-border: #c8eeda;
  --ok-text: #065f46;
  --warn: #a15c07;
  --warn-soft: #fff4e5;
  --warn-border: #fce3bf;
  --warn-text: #7a4100;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --bad-border: #f8cdc8;
  --bad-text: #7a271a;
  --danger-hover: #912018;
  --sidebar: #101828;
  --sidebar-text: #c8d0de;
  --sidebar-active: #1d2939;
  --sidebar-hover: #1d2939;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-muted: #98a2b3;
  --sidebar-brand: #ffffff;
  --table-hover: #fbfcfe;
  --input-bg: #ffffff;
  --focus-ring: #bfd3ff;
  --chip-text: #344054;
  --badge-other-bg: #eef2f6;
  --badge-other-text: #475467;
  --progress-track: #edf1f6;
  --progress-end: #60a5fa;
  --code-bg: #f8fafc;
  --code-text: #1e293b;
  --terminal-bg: #f8fafc;
  --terminal-bar: #eef2f7;
  --terminal-border: #cfd6df;
  --terminal-text: #1e293b;
  --terminal-btn: #e2e8f0;
  --terminal-btn-border: #cbd5e1;
  --terminal-btn-hover: #dbe3ee;
  --terminal-muted: #64748b;
  --terminal-status-bg: #e2e8f0;
  --terminal-ok-bg: #d1fae5;
  --terminal-ok-text: #065f46;
  --terminal-bad-bg: #fee2e2;
  --terminal-bad-text: #991b1b;
  --terminal-cursor: #2563eb;
  --terminal-selection: #bfdbfe;
  --terminal-black: #1e293b;
  --terminal-red: #b91c1c;
  --terminal-green: #047857;
  --terminal-yellow: #b45309;
  --terminal-blue: #1d4ed8;
  --terminal-magenta: #7e22ce;
  --terminal-cyan: #0e7490;
  --terminal-white: #475569;
  --toast-bg: #1d2939;
  --toast-text: #ffffff;
  --toast-error-bg: #7a271a;
  --auth-glow: #eaf1ff;
  --auth-shadow: 0 12px 32px rgba(16, 24, 40, 0.08);
  --sidebar-scrim: rgba(16, 24, 40, 0.45);
  --sidebar-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
  --sidebar-btn-border: rgba(255, 255, 255, 0.22);
  --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
  --sidebar-hover-border: rgba(255, 255, 255, 0.35);
  --avatar-bg: #344054;
  --dot-ok: #12b76a;
  --dot-warn: #f79009;
  --dot-bad: #f04438;
  --dot-neutral: #98a2b3;
  --shadow-lg: 0 10px 24px rgba(16, 24, 40, 0.24);
  --chart-blue: #2563eb;
  --chart-purple: #7c3aed;
  --chart-teal: #0e9384;
  --chart-orange: #d97706;
  --chart-cyan: #0891b2;
  --chart-blue-fill: rgba(37, 99, 235, 0.10);
  --chart-purple-fill: rgba(124, 58, 237, 0.10);
  --chart-teal-fill: rgba(14, 147, 132, 0.10);
  --chart-orange-fill: rgba(217, 119, 6, 0.10);
  --chart-cyan-fill: rgba(8, 145, 178, 0.10);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #111a2b;
  --surface-2: #0f1726;
  --border: #263449;
  --border-strong: #3a4a63;
  --text: #e6edf7;
  --muted: #9aa8bb;
  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --primary-soft: #172b4d;
  --on-primary: #07111f;
  --ok: #6ee7b7;
  --ok-soft: #0d2b23;
  --ok-border: #1e5b46;
  --ok-text: #a7f3d0;
  --warn: #fbbf24;
  --warn-soft: #332509;
  --warn-border: #6b4c12;
  --warn-text: #fde68a;
  --bad: #f87171;
  --bad-soft: #3a1717;
  --bad-border: #6b2a2a;
  --bad-text: #fecaca;
  --danger-hover: #b91c1c;
  --sidebar: #070d18;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #152238;
  --sidebar-hover: #152238;
  --sidebar-border: rgba(255, 255, 255, 0.09);
  --sidebar-muted: #94a3b8;
  --sidebar-brand: #f8fafc;
  --table-hover: #162235;
  --input-bg: #0d1625;
  --focus-ring: #2b4a78;
  --chip-text: #cbd5e1;
  --badge-other-bg: #1f2c40;
  --badge-other-text: #cbd5e1;
  --progress-track: #243247;
  --progress-end: #93c5fd;
  --code-bg: #070d18;
  --code-text: #dbe7f7;
  --terminal-bg: #070d18;
  --terminal-bar: #0d1625;
  --terminal-border: #263449;
  --terminal-text: #dbe7f7;
  --terminal-btn: #17243a;
  --terminal-btn-border: #33445f;
  --terminal-btn-hover: #22324c;
  --terminal-muted: #94a3b8;
  --terminal-status-bg: #22324c;
  --terminal-ok-bg: #0d2b23;
  --terminal-ok-text: #6ee7b7;
  --terminal-bad-bg: #3a1717;
  --terminal-bad-text: #fca5a5;
  --terminal-cursor: #7aa2f7;
  --terminal-selection: #2c3a5c;
  --terminal-black: #161b26;
  --terminal-red: #f97066;
  --terminal-green: #6ce9a6;
  --terminal-yellow: #fdb022;
  --terminal-blue: #7aa2f7;
  --terminal-magenta: #c3a3f7;
  --terminal-cyan: #67e3f9;
  --terminal-white: #d5dbe8;
  --toast-bg: #1f2c40;
  --toast-text: #f8fafc;
  --toast-error-bg: #7f1d1d;
  --auth-glow: #10203a;
  --auth-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --sidebar-scrim: rgba(0, 0, 0, 0.62);
  --sidebar-shadow: 0 0 40px rgba(0, 0, 0, 0.55);
  --sidebar-btn-border: rgba(255, 255, 255, 0.18);
  --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
  --sidebar-hover-border: rgba(255, 255, 255, 0.28);
  --avatar-bg: #263449;
  --dot-ok: #34d399;
  --dot-warn: #fbbf24;
  --dot-bad: #f87171;
  --dot-neutral: #94a3b8;
  --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.45);
  --chart-blue: #60a5fa;
  --chart-purple: #c084fc;
  --chart-teal: #2dd4bf;
  --chart-orange: #fbbf24;
  --chart-cyan: #22d3ee;
  --chart-blue-fill: rgba(96, 165, 250, 0.14);
  --chart-purple-fill: rgba(192, 132, 252, 0.14);
  --chart-teal-fill: rgba(45, 212, 191, 0.14);
  --chart-orange-fill: rgba(251, 191, 36, 0.14);
  --chart-cyan-fill: rgba(34, 211, 238, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

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

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 650; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 12px 0 8px; }

p { margin: 0 0 10px; }
ul { margin: 0; padding: 0; }

code, .mono { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-bad { color: var(--bad); }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 100; }

/* Layout */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  flex: 0 0 236px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { color: var(--sidebar-brand); font-size: 15px; }
.brand-text small { color: var(--sidebar-muted); font-size: 11px; }

.nav { display: flex; flex-direction: column; padding: 12px 10px; gap: 2px; flex: 1; }
.nav-link {
  display: block;
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
}
.nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-brand); text-decoration: none; }
.nav-link.active { background: var(--sidebar-active); color: var(--sidebar-brand); box-shadow: inset 3px 0 0 var(--primary); }

.sidebar-foot { padding: 14px; border-top: 1px solid var(--sidebar-border); }
.sidebar-foot .btn {
  color: var(--sidebar-text);
  border-color: var(--sidebar-btn-border);
}
.sidebar-foot .btn:hover {
  color: var(--sidebar-brand);
  background: var(--sidebar-hover-bg);
  border-color: var(--sidebar-hover-border);
}
.signed-in { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.signed-in-label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--sidebar-muted); }
.signed-in strong { color: var(--sidebar-brand); font-size: 13px; font-weight: 600; }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: var(--sidebar-brand);
  font-size: 11px;
  overflow: hidden;
}
.sidebar-scrim { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main, .content, .card, .grid { min-width: 0; }
img, svg, canvas { max-width: 100%; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { flex: 1; font-size: 18px; }
.topbar-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.menu-btn { display: none; }

.content { padding: 22px 24px 48px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* Cards and grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.card > h2 { margin-bottom: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }

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

.metric { margin-bottom: 0; }
.metric-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.metric-sub { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; white-space: normal; max-width: 72%; text-align: right; line-height: 1.25; }
.metric-value { font-size: 28px; font-weight: 680; letter-spacing: -0.02em; margin: 6px 0 8px; }
.metric-small { font-size: 20px; }
.metric .bar { width: 100%; height: 7px; margin-bottom: 10px; }

progress.bar {
  display: block;
  appearance: none;
  border: 0;
  background: var(--progress-track);
  border-radius: 999px;
  overflow: hidden;
  height: 8px;
  color: var(--primary);
}
progress.bar::-webkit-progress-bar { background: var(--progress-track); border-radius: 999px; }
progress.bar::-webkit-progress-value { background: linear-gradient(90deg, var(--primary), var(--progress-end)); border-radius: 999px; }
progress.bar::-moz-progress-bar { background: var(--primary); border-radius: 999px; }

.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 3px 0; border-top: 1px dashed var(--border); }
.kv:first-of-type { border-top: 0; }
.kv span { color: var(--muted); }

.kv-list { margin: 0; }
.kv-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.kv-list > div:last-child { border-bottom: 0; }
.kv-list dt { color: var(--muted); font-size: 12.5px; }
.kv-list dd { margin: 0; text-align: right; font-size: 12.5px; font-weight: 520; overflow-wrap: anywhere; }
.kv-two-col { columns: 2; column-gap: 24px; }
.kv-two-col > div { break-inside: avoid; }

/* Stats */
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.stat { flex: 1 1 70px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; }
.stat-value { font-size: 20px; font-weight: 650; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 11px; }
.live-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

.project-list { list-style: none; }
.project-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.project-list li:last-child { border-bottom: 0; }
.project-list a { display: inline-flex; align-items: center; gap: 8px; color: var(--text); min-width: 0; }
.project-list a:hover { color: var(--primary); text-decoration: none; }
.project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.process-list { list-style: none; margin-top: 10px; }
.process-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.process-list li:last-child { border-bottom: 0; }
.process-list a { color: var(--text); display: inline-flex; align-items: center; gap: 7px; }

/* Dots and badges */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 8px; }
.dot-ok { background: var(--dot-ok); }
.dot-warn { background: var(--dot-warn); }
.dot-bad { background: var(--dot-bad); }
.dot-neutral { background: var(--dot-neutral); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.badge-online { color: var(--ok); background: var(--ok-soft); }
.badge-stopped { color: var(--warn); background: var(--warn-soft); }
.badge-errored { color: var(--bad); background: var(--bad-soft); }
.badge-other { color: var(--badge-other-text); background: var(--badge-other-bg); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--chip-text);
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
}
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chip-ok { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); }
.chip-warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-border); }
.chip-bad { color: var(--bad); background: var(--bad-soft); border-color: var(--bad-border); }
button.chip { cursor: pointer; }
button.chip:hover { border-color: var(--border-strong); }
.chip-active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip-active:hover { background: var(--primary-dark); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.tag-warn { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn-border); }

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 7px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.3;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: var(--on-primary); }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-sm { padding: 4px 9px; font-size: 11.5px; border-radius: 6px; }
.btn-block { width: 100%; }
.icon-btn { background: transparent; border: 1px solid var(--border); border-radius: 7px; width: 34px; height: 34px; font-size: 16px; cursor: pointer; color: var(--text); }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.quick-links { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.actions { display: flex; gap: 4px; flex-wrap: wrap; }
.inline { display: inline; }

/* Alerts */
.alert { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 14px; font-size: 13px; }
.alert-success { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok-text); }
.alert-warn { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn-text); }
.alert-error { background: var(--bad-soft); border-color: var(--bad-border); color: var(--bad-text); }

.empty { padding: 22px 14px; text-align: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--surface-2); }
.loading { padding: 20px; text-align: center; color: var(--muted); }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 650; background: var(--surface-2); white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--table-hover); }
.data-table.compact th, .data-table.compact td { padding: 6px 8px; }
.row-sub { display: block; color: var(--muted); font-size: 11px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-card { overflow: hidden; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--chip-text); }
.field input, .field select {
  font: inherit;
  font-weight: 400;
  font-size: 13.5px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 8px 10px;
  width: 100%;
}
.field input:focus, .field select:focus { outline: 2px solid var(--focus-ring); border-color: var(--primary); }
.field small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.field-inline { flex-direction: row; align-items: center; gap: 10px; max-width: none; margin-bottom: 12px; }
.field-inline select { max-width: 360px; }

/* Toolbar and breadcrumbs */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.breadcrumbs { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 12px; flex-wrap: wrap; }
.breadcrumbs span[aria-hidden] { color: var(--border-strong); }
.page-intro { margin-bottom: 12px; }
.section { margin-top: 22px; }
.section-title { font-size: 16px; margin-bottom: 4px; }
.pagination { display: flex; align-items: center; gap: 10px; margin-top: 14px; }

/* Monitoring */
.range-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.chart-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chart { position: relative; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; min-width: 0; overflow: visible; }
.chart h3 { margin: 0 0 8px; }
.chart canvas { display: block; width: 100%; height: 190px; cursor: crosshair; touch-action: pan-y; }
.chart-overlay { position: absolute; z-index: 2; pointer-events: none; }
.chart-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 150px;
  max-width: 260px;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  font-size: 12px;
  line-height: 1.35;
}
.chart-tooltip-title { color: var(--muted); font-size: 10.5px; font-weight: 650; letter-spacing: 0.03em; text-transform: uppercase; }
.chart-tooltip-value { margin-top: 1px; color: var(--text); font-size: 15px; font-weight: 650; }
.chart-tooltip-time { margin-top: 4px; color: var(--text); font-size: 11.5px; white-space: nowrap; }
.chart-tooltip-note { margin-top: 1px; color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.live-region { transition: opacity 0.1s linear; }
.htmx-request .loading, .htmx-request.live-region { opacity: 0.75; }

/* Logs */
.log-meta { margin-bottom: 6px; }
.log-output {
  margin: 0;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 8px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  max-height: 62vh;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.log-output-empty { font-family: var(--sans); color: var(--muted); white-space: normal; }
.logs-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.logs-control { display: flex; align-items: center; gap: 8px; }
.logs-label { font-size: 12px; font-weight: 650; color: var(--chip-text); }
.logs-select {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 6px 10px;
}
.logs-select:focus-visible { outline: 2px solid var(--focus-ring); border-color: var(--primary); }
.logs-meta { margin-left: auto; }
.logs-notice { border-radius: 8px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 12px; border: 1px solid var(--border); }
.logs-notice-info { background: var(--surface-2); color: var(--muted); }
.logs-notice-error { background: var(--bad-soft, var(--bad)); border-color: var(--bad); color: var(--on-primary); }
.logs-section { margin-top: 14px; }
.logs-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.logs-section-head h2 { font-size: 13px; margin: 0; font-family: var(--mono); }
.logs-pager { margin-top: 8px; display: flex; justify-content: center; }

/* Terminal */
.terminal-shell { background: var(--terminal-bg); border: 1px solid var(--terminal-border); border-radius: 10px; overflow: hidden; }
.terminal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; background: var(--terminal-bar); border-bottom: 1px solid var(--terminal-border); }
.terminal-toolbar .muted { color: var(--terminal-muted); }
.terminal-actions { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.terminal-actions .btn { background: var(--terminal-btn); border-color: var(--terminal-btn-border); color: var(--terminal-text); }
.terminal-actions .btn:hover { background: var(--terminal-btn-hover); }
.terminal-host { height: calc(100vh - 300px); min-height: 360px; padding: 8px; overflow: hidden; }
.terminal-host .xterm { height: 100%; }
.status-pill { display: inline-block; padding: 3px 9px; border-radius: 999px; background: var(--terminal-status-bg); color: var(--terminal-text); font-size: 11.5px; font-weight: 600; }
.status-pill.status-ok { background: var(--terminal-ok-bg); color: var(--terminal-ok-text); }
.status-pill.status-bad { background: var(--terminal-bad-bg); color: var(--terminal-bad-text); }

/* Toast */
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--toast-bg);
  color: var(--toast-text);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast.toast-error { background: var(--toast-error-bg); }

/* Auth */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: radial-gradient(circle at top, var(--auth-glow) 0, var(--bg) 55%); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--auth-shadow); padding: 26px; }
.brand-auth { border: 0; padding: 0 0 18px; background: transparent; }
.brand-auth .brand-text strong { color: var(--text); }
.brand-auth .brand-text small { color: var(--muted); }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card .form { margin-top: 16px; max-width: none; }
.auth-card .form .btn { margin-top: 4px; }
.code-block { background: var(--code-bg); color: var(--code-text); padding: 12px; border-radius: 8px; font-family: var(--mono); font-size: 12.5px; overflow-x: auto; }


/* Theme toggle */
.theme-toggle { flex: 0 0 auto; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.theme-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: block; }
[data-theme="dark"] .theme-icon-sun { display: block; }
[data-theme="dark"] .theme-icon-moon { display: none; }
.auth-theme-toggle { position: absolute; top: 14px; right: 14px; z-index: 2; }
.auth-card { position: relative; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* PM2 list/detail additions */
.process-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.process-main > a { font-weight: 600; overflow-wrap: anywhere; }
.process-meta { color: var(--muted); font-size: 11.5px; overflow-wrap: anywhere; }
.row-sub { max-width: 420px; }
.process-actions { min-width: 0; }
.command-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.command-card { min-width: 0; }
.command-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.command-head h3 { margin: 0; color: var(--text); font-size: 12px; }
.command-block { margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--code-bg); color: var(--code-text); font-family: var(--mono); font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: auto; max-height: 260px; }
.command-empty { padding: 12px; border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 12.5px; }
.copy-btn { flex: 0 0 auto; }
.help-text { color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.current-values { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0 0 12px; font-size: 12.5px; }
.current-values dt { color: var(--muted); }
.current-values dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

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

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    width: min(280px, 86vw);
    flex-basis: auto;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    box-shadow: var(--sidebar-shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { display: none; position: fixed; inset: 0; background: var(--sidebar-scrim); z-index: 30; }
  .sidebar-scrim.open { display: block; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .content { padding: 16px 14px 40px; }
  .topbar { padding: 10px 14px; }
  .topbar h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .grid-2 { grid-template-columns: 1fr; }
  .kv-two-col { columns: 1; }
  .command-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .grid-4 { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
  .chart canvas { height: 170px; }
  .terminal-host { height: calc(100vh - 330px); }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; background: var(--surface); }
  .data-table td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .data-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 650; text-align: left; flex: 0 0 88px; }
  .data-table td.actions { justify-content: flex-end; padding-top: 6px; }
  .data-table td.actions::before { content: ""; flex: 0 0 0; }
  .data-table .row-sub { max-width: 190px; }
  .toolbar { align-items: flex-start; }
  .metric-value { font-size: 24px; }
  .topbar-tags { display: none; }
  .data-table td { overflow-wrap: anywhere; }
  .data-table td::before { flex: 0 0 92px; }
  .data-table .row-sub { max-width: 100%; }
  .live-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-inline { flex-direction: column; align-items: stretch; }
  .field-inline select { max-width: none; }
  .field input, .field select { font-size: 16px; min-height: 44px; }
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .terminal-host { height: calc(100dvh - 330px); min-height: 280px; }
  .command-grid { grid-template-columns: 1fr; }
  .current-values { grid-template-columns: 1fr; gap: 2px; }
  .current-values dd { margin-bottom: 6px; }
  .pagination { flex-wrap: wrap; }
  .terminal-actions { margin-left: 0; width: 100%; }
}

@media (max-width: 480px) {
  body { font-size: 13.5px; }
  .content { padding: 12px 10px 36px; }
  .topbar { padding: 8px 10px; gap: 6px; }
  .topbar h1 { font-size: 16px; }
  .icon-btn { width: 40px; height: 40px; flex: 0 0 40px; }
  .card { padding: 12px; border-radius: 9px; }
  .card-head { align-items: flex-start; }
  .metric-value { font-size: 21px; }
  .metric-value.metric-small { font-size: 17px; }
  .kv-list > div { padding: 6px 0; flex-direction: column; align-items: flex-start; gap: 2px; }
  .kv-list dd { overflow-wrap: anywhere; text-align: left; }
  .stat { flex: 1 1 44%; }
  .data-table td { display: block; text-align: left; }
  .data-table td::before { display: block; flex: none; margin-bottom: 1px; }
  .data-table td.actions { justify-content: flex-start; }
  .data-table td.actions::before { display: none; }
  .actions { width: 100%; }
  .actions form { flex: 0 1 auto; }
  .button-row { width: 100%; }
  .button-row .btn { flex: 1 1 auto; }
  .chart canvas { height: 160px; }
  .terminal-toolbar { padding: 7px 8px; }
  .terminal-actions .btn { min-height: 34px; }
  .log-output { max-height: 58vh; }
  .auth-card { padding: 20px; }
  .auth-theme-toggle { top: 10px; right: 10px; }
  .command-block { max-height: 220px; }
}

@media (max-width: 360px) {
  .topbar h1 { font-size: 15px; }
  .content { padding-left: 8px; padding-right: 8px; }
  .card { padding: 10px; }
  .stat { flex-basis: 100%; }
  .live-stats { grid-template-columns: 1fr; }
  .actions form, .actions .btn { width: 100%; }
  .actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
