:root {
  --bg: #090c13;
  --panel: #10151f;
  --panel-2: #151b28;
  --border: #222a3b;
  --text: #e7eaf1;
  --muted: #8b94a8;
  --red: #c8102e;
  --red-hi: #e3243f;
  --gold: #f2b134;
  --arc: #6fe7ff;
  --ok: #3ddc97;
  --bad: #ff5b6b;
  --warn: #f2b134;
  --radius: 10px;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #1a1020 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}
a { color: var(--arc); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.wordmark { font-weight: 800; letter-spacing: .28em; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--border);
  border-top: 3px solid var(--red); border-radius: var(--radius); padding: 32px 28px; text-align: center;
  box-shadow: 0 20px 60px #0008, 0 0 80px #6fe7ff10;
}
.login-logo { width: 72px; height: 72px; filter: drop-shadow(0 0 18px #6fe7ff55); }
.login-card h1 { margin: 12px 0 2px; font-size: 22px; }
.tagline { color: var(--gold); margin: 0 0 22px; font-size: 13px; letter-spacing: .08em; }
.login-card label { text-align: left; }

/* shell */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100%; }
.sidebar {
  background: #0c1018; border-right: 1px solid var(--border); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); padding: 4px 6px; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.brand .wordmark { font-size: 14px; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { color: var(--muted); padding: 8px 10px; border-radius: 8px; border-left: 2px solid transparent; }
nav a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
nav a.active { color: var(--text); background: var(--panel-2); border-left-color: var(--red); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; font-size: 12px; }
.view { padding: 28px 32px 60px; max-width: 1200px; width: 100%; }

/* headings & layout */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 22px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card h3 { margin: 0 0 6px; font-size: 15px; }
.card p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat.accent { border-top: 2px solid var(--arc); }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 26px 0 10px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); }

/* tables */
.table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; background: #0e131c; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--panel-2); }
td .actions { justify-content: flex-end; }

/* status */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.running::before, .status.success::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.status.failed::before, .status.exited::before, .status.dead::before { background: var(--bad); }
.status.queued::before, .status.restarting::before, .status.created::before, .status.paused::before { background: var(--warn); }
.status.running.pulse::before { animation: pulse 1.2s infinite; background: var(--arc); box-shadow: 0 0 8px var(--arc); }
@keyframes pulse { 50% { opacity: .3; } }

/* forms */
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--border); background: #0b0f17; color: var(--text); font: inherit;
}
textarea { font-family: var(--mono); font-size: 12.5px; min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--arc); box-shadow: 0 0 0 3px #6fe7ff22; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.check input { width: auto; margin: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12px; color: var(--muted); margin: -6px 0 12px; }
.error { color: var(--bad); font-size: 13px; min-height: 18px; margin: 10px 0 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); font: inherit; font-weight: 500; white-space: nowrap;
}
.btn:hover { border-color: #33405a; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: linear-gradient(180deg, var(--red-hi), var(--red)); border-color: var(--red); color: #fff; }
.btn.primary:hover { box-shadow: 0 0 18px #c8102e66; }
.btn.gold { border-color: var(--gold); color: var(--gold); background: transparent; }
.btn.danger { border-color: #5a1a24; color: var(--bad); background: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.login-card .btn { width: 100%; margin-top: 6px; padding: 11px; }

/* logs */
.log {
  background: #05070b; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  max-height: 70vh; overflow-y: auto; color: #c9d1e0;
}
.log .step { color: var(--arc); font-weight: 600; }
.log .fail { color: var(--bad); font-weight: 600; }
.log .ok { color: var(--ok); font-weight: 600; }

/* modal & toast */
.modal { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; padding: 20px; z-index: 10; }
.modal-card {
  width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; background: var(--panel);
  border: 1px solid var(--border); border-top: 3px solid var(--red); border-radius: var(--radius); padding: 18px 22px 22px;
}
.modal-card.wide { max-width: 980px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 17px; }
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 20; max-width: 420px; padding: 12px 16px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--arc); box-shadow: 0 10px 30px #0008;
}
.toast.bad { border-left-color: var(--bad); }
.secret-box { background: #0b0f17; border: 1px dashed var(--gold); border-radius: 8px; padding: 12px; font-family: var(--mono); font-size: 12.5px; word-break: break-all; margin-bottom: 12px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .view { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
}
