:root {
  --bg0: #0f1419;
  --bg1: #171d25;
  --bg2: #1e2732;
  --line: #2c3848;
  --text: #e7eef7;
  --muted: #8b9bb0;
  --accent: #3d9a7a;
  --accent-2: #c4a35a;
  --danger: #d1645b;
  --ok: #4caf82;
  --warn: #c4a35a;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(61, 154, 122, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(196, 163, 90, 0.12), transparent 50%),
    linear-gradient(165deg, var(--bg0), #121820 45%, #0c1015);
}

body { line-height: 1.45; }

a { color: var(--accent-2); }

code, .mono { font-family: var(--mono); font-size: 0.92em; }

.brand {
  font-weight: 600;
  letter-spacing: 0.08em;
  font-size: 1.05rem;
  text-transform: uppercase;
}

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

.top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 20, 25, 0.72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.top-brand, .top-actions, .row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.row.end { justify-content: flex-end; }

.layout {
  width: min(1100px, calc(100% - 2rem));
  margin: 1.5rem auto 3rem;
  display: grid;
  gap: 1.25rem;
}

.panel {
  background: color-mix(in srgb, var(--bg1) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem 1.4rem;
  box-shadow: var(--shadow);
}

.panel-head h1,
.panel-head h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.lede {
  margin: 0;
  color: var(--muted);
  max-width: 62ch;
}

.table-wrap { overflow-x: auto; margin-top: 1rem; }

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

th, td {
  text-align: left;
  padding: 0.65rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button, .ghost {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

button:hover, .ghost:hover { border-color: #4a5d73; }

button.primary, button[type="submit"] {
  background: linear-gradient(180deg, #49a887, var(--accent));
  border-color: #2f7a60;
  color: #04130e;
}

button.danger { border-color: #8a403a; color: #ffd4d0; }

button:disabled { opacity: 0.5; cursor: not-allowed; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}

.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.pill.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}

.status-dot.running { background: var(--ok); }
.status-dot.stopped { background: var(--muted); }
.status-dot.crashed { background: var(--danger); }

.log {
  margin: 1rem 0 0;
  padding: 0.9rem 1rem;
  min-height: 12rem;
  max-height: 22rem;
  overflow: auto;
  background: #0a0e13;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
}

textarea {
  width: 100%;
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  background: #0a0e13;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.85rem;
  resize: vertical;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

label.inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

label.check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
}

input[type="text"],
input[type="password"] {
  font: inherit;
  color: var(--text);
  background: var(--bg0);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  min-width: 12rem;
}

.flash {
  margin-top: 0.85rem;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg2);
}

.flash.ok { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.flash.err { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); color: #ffd4d0; }

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-panel {
  width: min(420px, 100%);
  padding: 1.75rem 1.5rem 1.6rem;
  background: color-mix(in srgb, var(--bg1) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
}

.auth-panel h1 {
  margin: 0.35rem 0 0.4rem;
  font-size: 1.6rem;
}

.auth-panel form {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.2rem;
}

.auth-panel .err {
  margin: 0.9rem 0 0;
  color: #ffd4d0;
  background: rgba(209, 100, 91, 0.12);
  border: 1px solid rgba(209, 100, 91, 0.35);
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
}

dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg1);
  color: var(--text);
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(0, 0, 0, 0.55); }

.dlg { padding: 1.1rem 1.2rem; min-width: min(360px, 90vw); }

@media (max-width: 720px) {
  .top { flex-direction: column; align-items: flex-start; }
  .actions { justify-content: flex-start; }
}
