/* ═══════════════════════════════════════════════════════════════════════════
   PM2 Command Center — Main stylesheet (imports per-component partials)
   ═══════════════════════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════════════════
   PM2 Command Center — Design tokens & CSS custom properties
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  color-scheme: dark;
  /* ── Backgrounds ─────────────────────────────────────────────────────── */
  --bg-0: #0a0a0b;
  --bg-1: #101012;
  --bg-2: #18181b;
  --bg-3: #1f1f23;
  /* ── Surfaces / panels ───────────────────────────────────────────────── */
  --panel: rgba(24, 24, 27, 0.92);
  --panel-strong: rgba(31, 31, 35, 0.96);
  --panel-soft: rgba(40, 40, 46, 0.8);
  /* ── Borders ─────────────────────────────────────────────────────────── */
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  /* ── Text ────────────────────────────────────────────────────────────── */
  --text: #f0f0f2;
  --muted: #9e9e9e;
  /* ── Accent (coral / salmon) ──────────────────────────────── */
  --accent: #fd8c66;
  --accent-strong: #f8494d;
  --accent-soft: rgba(253, 140, 102, 0.12);
  --accent-glow: rgba(253, 140, 102, 0.22);
  /* ── Semantic ────────────────────────────────────────────────────────── */
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.14);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.14);
  --critical: #f87171;
  --critical-soft: rgba(248, 113, 113, 0.14);
  /* ── Log level colours ───────────────────────────────────────────────── */
  --log-error: #f87171;
  --log-warn: #fbbf24;
  --log-info: #60a5fa;
  --log-debug: #9e9e9e;
  --log-default: #c8c8cc;
  /* ── Misc ────────────────────────────────────────────────────────────── */
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-ui: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", "Menlo", "Consolas", monospace;
}
/* ── Reset & base typography ────────────────────────────────────────────── */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
body {
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg-0);
}
button {
  font: inherit;
}
strong,
h1,
h2,
h3 {
  letter-spacing: -0.02em;
}
.eyebrow {
  margin: 0 0 6px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.subtle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}
.section-shell {
  background: var(--bg-1);
}
.empty-state {
  display: block;
}
.empty-card {
  border-radius: var(--radius-md);
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
}
.empty-card.compact {
  padding: 16px;
}
/* ── Focus ──────────────────────────────────────────────────────────────── */
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* ── Layout shell ───────────────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1px;
  max-width: 1720px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--border);
}
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-1);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.brand-card {
  padding: 24px;
  border-bottom: 1px solid var(--border);
}
.brand-card h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}
.content {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  min-width: 0;
}
.hero-card,
.panel {
  padding: 28px 32px;
  animation: rise 380ms ease both;
}
.panel {
  flex: 1;
}
.panel-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}
.panel-header h3 {
  margin: 0;
}
/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    max-height: 50vh;
  }
}
@media (max-width: 760px) {
  .hero-card,
  .panel {
    padding: 20px;
  }
  .hero-card,
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
/* ── Buttons ────────────────────────────────────────────────────────────── */
.ghost-button,
.primary-button {
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.ghost-button {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
}
.ghost-button:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.primary-button {
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--bg-0);
  font-weight: 700;
}
.primary-button:hover {
  background: var(--accent-strong);
}
.ghost-button:disabled,
.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
/* ── Pills / badges ─────────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pill.neutral {
  background: var(--accent-soft);
  color: var(--accent);
}
.pill.healthy {
  background: var(--success-soft);
  color: var(--success);
}
.pill.warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.pill.critical {
  background: var(--critical-soft);
  color: var(--critical);
}
.pill.muted {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}
/* ── Sidebar / Process list ─────────────────────────────────────────────── */
.sidebar-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.sidebar-status {
  font-size: 0.82rem;
  color: var(--muted);
}
.process-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  flex: 1;
}
.process-list::-webkit-scrollbar,
.log-stream::-webkit-scrollbar {
  width: 6px;
}
.process-list::-webkit-scrollbar-thumb,
.log-stream::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}
.process-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background-color 120ms ease;
}
.process-item:hover {
  background: var(--accent-soft);
}
.process-item.active {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
}
.process-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.process-title {
  font-size: 0.92rem;
  font-weight: 600;
}
.process-status {
  font-size: 0.78rem;
  color: var(--muted);
}
.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}
.status-indicator.healthy {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}
.status-indicator.critical {
  background: var(--critical);
  box-shadow: 0 0 0 3px var(--critical-soft);
}
.status-indicator.muted {
  background: rgba(255, 255, 255, 0.24);
}
/* ── Hero card ──────────────────────────────────────────────────────────── */
.hero-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.hero-copy {
  max-width: 760px;
}
.hero-copy h2 {
  margin: 0;
  font-size: 1.4rem;
}
.selection-badges,
.hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.selection-badges {
  margin-top: 14px;
}
.hero-rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 220px;
  align-items: stretch;
}
.signal-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-2);
  font-size: 0.84rem;
}
.signal-label {
  display: block;
  margin-bottom: 2px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.signal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.signal-dot.connected {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}
.signal-dot.disconnected {
  background: var(--muted);
}
@media (max-width: 760px) {
  .hero-rail {
    width: 100%;
    min-width: 0;
  }
}
/* ── Stats / KPI grid ───────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.stat-card {
  border-radius: var(--radius-md);
  padding: 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  position: relative;
  transition: border-color 150ms ease;
}
.stat-card:hover {
  border-color: var(--border-strong);
}
.stat-card.highlight {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent-soft), var(--bg-2));
}
.stat-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.stat-card .stat-sub {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--muted);
}
@media (max-width: 760px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
/* ── Log stream (classical dark terminal view) ──────────────────────────── */
.log-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.actions-dropdown {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.actions-eyebrow {
  color: var(--critical);
}
.action-select {
  width: 100%;
  appearance: none;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 28px 6px 12px;
  font-size: 0.82rem;
  font-family: var(--font-ui);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239e9e9e'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.action-select:focus {
  outline: none;
  border-color: var(--accent);
}
.action-confirm {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text);
}
.action-confirm-buttons {
  display: flex;
  gap: 8px;
}
.action-success {
  color: var(--success);
  font-size: 0.82rem;
  font-weight: 600;
  animation: fade-out 3s ease forwards;
}
@keyframes fade-out {
  0%,
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
.action-param-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
}
.action-param-input:focus {
  outline: none;
  border-color: var(--accent);
}
.btn-sm {
  padding: 4px 12px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: var(--font-ui);
}
.btn-confirm {
  background: var(--success);
  color: #000;
  border-color: var(--success);
  font-weight: 600;
}
.btn-confirm:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-cancel {
  background: var(--bg-3);
  color: var(--text);
}
.btn-cancel:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.log-stream {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 340px);
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #0c0c0e;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
}
/* ── Log groups ─────────────────────────────────────────────────────────── */
.log-group.multi-line {
  border-left: 3px solid var(--border-strong);
  margin: 2px 0;
  border-radius: 2px;
}
.log-group.multi-line.level-error {
  border-left-color: var(--log-error);
}
.log-group.multi-line.level-warn {
  border-left-color: var(--log-warn);
}
.log-group.multi-line.level-info {
  border-left-color: var(--log-info);
}
.log-group-label {
  padding: 3px 16px;
  font-size: 0.72rem;
  opacity: 0.7;
}
.log-line {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 3px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background-color 100ms ease;
}
.log-line:hover {
  background: rgba(255, 255, 255, 0.03);
}
.log-line:last-child {
  border-bottom: none;
}
.log-source {
  flex-shrink: 0;
  font-size: 0.68rem;
}
.log-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #fff;
}
/* Pill colours by log level */
.log-source.pill-error {
  color: var(--log-error);
  border-color: var(--log-error);
}
.log-source.pill-warn {
  color: var(--log-warn);
  border-color: var(--log-warn);
}
.log-source.pill-info {
  color: var(--log-info);
  border-color: var(--log-info);
}
.log-line.level-error {
  background: rgba(248, 113, 113, 0.04);
}
.log-line.level-warn {
  background: rgba(251, 191, 36, 0.03);
}
/* SSE live indicator */
.log-stream-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
}
.log-stream-header .live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--success);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}
.live-badge .pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
@media (max-width: 1120px) {
  .log-stream {
    max-height: 520px;
  }
}
@media (max-width: 760px) {
  .log-stream {
    max-height: none;
  }
  .log-header-right {
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
  }
}
/* ── Login page ─────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--bg-0);
}
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-panel {
  width: min(100%, 880px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--bg-1);
}
.login-panel .brand-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 32px;
  background: var(--bg-2);
  border-bottom: none;
  border-right: 1px solid var(--border);
}
.login-card {
  padding: 40px 32px;
}
.login-card h2 {
  margin: 0;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field span {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-0);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  font-size: 0.92rem;
  transition: border-color 150ms ease;
}
.field input:hover {
  border-color: var(--border-strong);
}
.field input:focus {
  border-color: var(--accent);
}
.field input::placeholder {
  color: rgba(158, 158, 158, 0.6);
}
.login-submit {
  display: inline-flex;
  justify-content: center;
  width: 100%;
  margin-top: 8px;
}
.form-message {
  margin: 0;
  min-height: 1.4em;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}
.form-message.error {
  color: var(--critical);
}
.form-message.success {
  color: var(--success);
}
@media (max-width: 700px) {
  .login-panel {
    grid-template-columns: 1fr;
  }
  .login-panel .brand-card {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}
