:root {
  color-scheme: dark;
  --color-bg: #161826;
  --color-surface: #232532;
  --color-terminal: #0d0e15;
  --color-text: #e9e9ed;
  --color-text-muted: rgba(233, 233, 237, 0.55);
  --color-border: rgba(233, 233, 237, 0.12);
  --color-accent: #9184d9;
  --color-accent-soft: rgba(145, 132, 217, 0.18);
  --color-warn: #d2cefd;
  --color-error: #e2665b;
  --color-neutral: #75798c;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
}

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

.text-muted {
  color: var(--color-text-muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* -- buttons -- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  color: var(--color-text);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 7px 12px;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

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

.btn-primary {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.btn-primary:hover {
  background: var(--color-accent-soft);
}

.btn-danger {
  color: var(--color-error);
  border-color: var(--color-error);
}

.btn-block {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

/* -- forms -- */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 12px;
  color: var(--color-text-muted);
}

.input {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 0;
}

.seg {
  display: inline-flex;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.seg-opt {
  flex: 1;
  text-align: center;
  padding: 7px 0;
  font-size: 12.5px;
  color: var(--color-text-muted);
  border: none;
  border-left: 1px solid var(--color-border);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.seg-opt:first-child {
  border-left: none;
}

.seg-opt.active {
  color: var(--color-accent);
  background: var(--color-accent-soft);
}

/* -- login page -- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 360px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 600;
}

.auth-brand .glyph {
  color: var(--color-accent);
  font-size: 20px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-error {
  font-size: 12px;
  color: var(--color-error);
}

/* -- navbar -- */
.navbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
  flex: none;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 16px;
  margin-right: auto;
}

.navbar-brand .glyph {
  color: var(--color-accent);
}

.host-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.host-stat-label {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.host-stat-value {
  font-size: 13px;
}

.navbar-divider {
  width: 1px;
  height: 22px;
  background: var(--color-border);
}

/* -- console layout -- */
.console {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.console-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.sidebar {
  width: 260px;
  flex: none;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--color-border);
  min-width: 0;
}

.sidebar-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 10px;
}

.sidebar-list {
  flex: 1;
  overflow: auto;
  padding: 0 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.container-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  color: inherit;
}

.container-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.container-row.active {
  background: var(--color-accent-soft);
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
}

.empty-state {
  padding: 24px 8px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
}

.main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 18px;
  gap: 16px;
  min-width: 0;
}

/* -- detail card -- */
.detail-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  flex: none;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.detail-name {
  font-size: 18px;
  font-weight: 600;
}

.detail-image {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  white-space: nowrap;
}

.hr {
  height: 1px;
  border: 0;
  margin: 0;
  background: var(--color-border);
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.detail-meta .stat-cpu {
  color: var(--color-accent);
}

.detail-meta .stat-mem {
  color: var(--color-warn);
}

.self-note {
  font-size: 11px;
  font-style: italic;
  color: var(--color-text-muted);
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-row form {
  margin: 0;
}

/* -- logs panel -- */
.logs-panel {
  display: flex;
  flex-direction: column;
  background: var(--color-terminal);
  border-radius: var(--radius-md);
  flex: 1;
  min-height: 240px;
  overflow: hidden;
}

.logs-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  flex: none;
}

.logs-toolbar .input {
  height: 28px;
  min-height: 28px;
  font-size: 11px;
  background: transparent;
  max-width: 160px;
  margin-left: auto;
}

.logs-body {
  flex: 1;
  overflow: auto;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.7;
}

.log-line {
  display: flex;
  gap: 8px;
}

.log-time {
  opacity: 0.5;
  flex: none;
}

.log-level {
  flex: none;
  width: 40px;
  opacity: 0.8;
}

.log-level-error {
  color: var(--color-error);
}

.log-level-warn {
  color: var(--color-warn);
}

.log-level-info {
  color: var(--color-text);
}

/* -- exec page -- */
.exec-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.exec-output {
  background: var(--color-terminal);
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 160px;
  max-height: 400px;
  overflow: auto;
  font-size: 12.5px;
  white-space: pre-wrap;
}

.exec-form {
  display: flex;
  gap: 8px;
}

.exec-form .input {
  flex: 1;
}

/* -- error pages -- */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.error-page h1 {
  font-size: 48px;
  margin: 0;
  color: var(--color-accent);
}
