:root {
  --bg: #f4f5f7; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e5e7eb;
  --accent: #2563eb; --accent-2: #1d4ed8; --danger: #b91c1c;
  --ok: #15803d; --run: #b45309; --q: #4b5563;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
header { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px;
  background: #111827; color: #fff; }
header .muted { color: #9ca3af; }
.brand { font-weight: 600; font-size: 16px; }
.tag { font-size: 11px; background: #374151; padding: 2px 6px; border-radius: 4px; margin-left: 6px; font-weight: 400; }
#userbar { display: flex; gap: 14px; align-items: center; }
main { max-width: 1200px; margin: 20px auto; padding: 0 16px; display: grid; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; }
.card.narrow { max-width: 380px; margin: 60px auto; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
h2 { font-size: 16px; margin: 0 0 8px; }
h3 { font-size: 13px; margin: 16px 0 6px; }
table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 500; color: var(--muted); font-size: 12px; }
td.actions { text-align: right; white-space: nowrap; }
button, .button { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 7px 12px;
  cursor: pointer; font: inherit; display: inline-block; }
button:hover, .button:hover { background: var(--accent-2); }
button:disabled { opacity: .5; cursor: default; }
button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
header button.ghost { color: #e5e7eb; border-color: #374151; }
button.ghost:hover { background: #eef2ff; }
header button.ghost:hover { background: #1f2937; }
button.small, td.actions button { padding: 4px 8px; font-size: 12px; }
button.danger { background: var(--danger); }
td.actions button + button { margin-left: 4px; }
label { display: block; margin: 8px 0; font-size: 12px; color: var(--muted); }
input, select { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit;
  color: var(--text); margin-top: 3px; background: #fff; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); min-height: 1em; margin: 6px 0; }
.hidden { display: none !important; }
.status { padding: 2px 8px; border-radius: 10px; font-size: 12px; color: #fff; background: var(--q); }
.status.succeeded { background: var(--ok); }
.status.running, .status.cancelling { background: var(--run); }
.status.failed { background: var(--danger); }
.status.cancelled { background: #9ca3af; }
dialog { border: 0; border-radius: 10px; padding: 20px 22px; width: min(760px, 94vw); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(17,24,39,.45); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-items: end; }
.params { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 14px; max-height: 45vh; overflow: auto; }
.params .p { display: grid; grid-template-columns: 140px 1fr; align-items: center; gap: 8px; }
.params .p span { font-family: ui-monospace, monospace; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.params .p input { margin: 0; padding: 5px 8px; }
.params .p.changed input { border-color: var(--run); background: #fffbeb; }
.params .p input.key { font-family: ui-monospace, monospace; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 16px; font-family: ui-monospace, monospace; font-size: 12px; }
.kv .changed { color: var(--run); font-weight: 600; }
pre { background: #0f172a; color: #e2e8f0; padding: 10px; border-radius: 6px; max-height: 260px; overflow: auto; font-size: 12px; }
.files { columns: 3; padding-left: 18px; font-size: 12px; }
.files a { color: var(--accent); }
a { color: var(--accent); }
details summary { cursor: pointer; font-weight: 500; }
.domain { display: grid; grid-template-columns: 1fr 210px; gap: 14px; align-items: start; }
.domtable { margin-top: 0; }
.domtable th, .domtable td { padding: 3px 6px; border: 0; }
.domtable td input { margin: 0; padding: 4px 6px; }
.domtable td input.align { width: auto; margin: 0 2px; }
.domtable td input[readonly] { background: #f3f4f6; color: var(--muted); }
.domtable td.ro { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); }
.domside label { margin: 0 0 6px; }
.warn { color: var(--run); min-height: 1em; margin: 4px 0; }
.actions.left { justify-content: flex-start; margin-top: 4px; }
.pill { font-size: 11px; padding: 1px 6px; border-radius: 8px; background: #eef2ff; color: var(--accent); margin-left: 6px; }

/* GPU instance status (header) */
.gpu { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #374151; }
.gpu.running, .gpu.idle { background: #14532d; }
.gpu.starting, .gpu.stopping, .gpu.waiting_capacity { background: #713f12; }
.gpu.manual { background: #1e3a8a; }
.gpu.error, .gpu.unknown { background: #7f1d1d; }
.gpu-note { display: block; font-size: 11px; }
