:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --ink: #17201b;
  --muted: #68756d;
  --line: #d6ddd8;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --warn: #b7791f;
  --bad: #b42318;
  --good: #237a3b;
  --log: #101614;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-body {
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(100%, 420px);
  padding: 18px;
}

.login-panel {
  display: grid;
  gap: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.login-panel p,
.login-message {
  margin-top: 6px;
  color: var(--muted);
}

.login-message {
  min-height: 20px;
  color: var(--bad);
  font-size: 13px;
  font-weight: 650;
}

.shell {
  width: 100%;
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  max-width: 1440px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  font-size: 15px;
  letter-spacing: 0;
}

#statusText {
  margin-top: 6px;
  color: var(--muted);
}

.status-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: end;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: #eef3f0;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
}

.pill.good {
  color: var(--good);
  background: #edf8f0;
  border-color: #c7e7cf;
}

.pill.warn {
  color: var(--warn);
  background: #fff8e8;
  border-color: #f1dfa7;
}

.pill.bad {
  color: var(--bad);
  background: #fff0ee;
  border-color: #f2c2bb;
}

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(320px, 1fr);
  gap: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.controls,
.jobs,
.devices {
  padding: 16px;
}

.log-panel {
  grid-column: 1 / -1;
  min-height: 420px;
  overflow: hidden;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.mode-tabs {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.tab,
.ghost,
.primary {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.tab {
  min-height: 32px;
  padding: 6px 12px;
  background: #f7faf8;
  color: var(--muted);
}

.tab.active {
  background: var(--accent);
  color: white;
}

.ghost {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf9;
  color: var(--muted);
}

.ghost.danger {
  color: var(--bad);
  border-color: #f2c2bb;
  background: #fff8f7;
}

.primary {
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-weight: 650;
}

.primary:hover {
  background: var(--accent-dark);
}

.form-stack {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: #354039;
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fbfdfc;
  font: 14px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  outline: none;
}

textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 10px;
}

.hidden {
  display: none;
}

.job-list {
  display: grid;
  gap: 10px;
}

.job,
.device {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
}

.job-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.job-id {
  color: var(--muted);
  font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.vm-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 130px 180px 130px 100px;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid #eef2ef;
  font-size: 13px;
}

.vm-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.device-list {
  display: grid;
  gap: 10px;
}

.device-main,
.device-actions,
.device-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.device-main {
  justify-content: space-between;
}

.device-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.device-actions {
  margin-top: 12px;
}

pre {
  height: 420px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  background: var(--log);
  color: #d9efe6;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (max-width: 860px) {
  .shell {
    padding: 14px;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .log-panel {
    grid-column: auto;
  }

  .vm-row {
    grid-template-columns: 1fr;
  }
}
