:root {
  --bg: #f5f5f3; --card: #ffffff; --text: #1c1c1a; --muted: #6b6b66; --line: #e3e2de;
  --accent: #e87d0d; --accent-text: #ffffff;
  --ok: #1f8a4c; --busy: #2563c9; --idle: #8a8a84; --warn: #b7791f; --bad: #c0392b;
  --bar-bg: #ecebe7;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615; --card: #20201e; --text: #ecebe7; --muted: #9a9993; --line: #33332f;
    --ok: #3fbf74; --busy: #5b8ef0; --idle: #8a8a84; --warn: #e0a84a; --bad: #e5645a;
    --bar-bg: #2c2c29;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--card); }
.brand { font-weight: 700; font-size: 17px; }
.summary { color: var(--muted); font-size: 14px; }
main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; display: grid; gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; min-width: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.banner { padding: 12px 14px; border-radius: 8px; white-space: pre-wrap; }
.banner.error { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.banner.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--text); margin-bottom: 10px; }

.drop { display: block; border: 2px dashed var(--line); border-radius: 10px; padding: 28px 16px;
  text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.drop .hint { display: block; color: var(--muted); font-size: 13px; margin-top: 6px; }

.bar { height: 8px; background: var(--bar-bg); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar > div { height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.bar.done > div { background: var(--ok); }
.bar.bad > div { background: var(--bad); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 7px 9px; min-width: 0; }
.facts { color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; }
button { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 6px; padding: 7px 14px; cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.small { padding: 3px 9px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }
.msg { margin: 10px 0 0; white-space: pre-wrap; }
.msg.error { color: var(--bad); }
.msg.ok { color: var(--ok); }

.machines { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 45%), 1fr)); gap: 10px; }
.machine { min-width: 0; perspective: 900px; }
.machine .flip { position: relative; height: 156px; transition: transform .45s ease; transform-style: preserve-3d; }
.machine.flipped .flip { transform: rotateY(180deg); }
.machine .face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden;
  -webkit-backface-visibility: hidden; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; background: var(--card); }
.machine .back { transform: rotateY(180deg); font-size: 12px; }
.machine[data-id] { cursor: default; }
.machine .hint { position: absolute; bottom: 8px; left: 12px; font-size: 11px; color: var(--muted); opacity: .8; }
.machine .chip { color: var(--muted); margin: 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.machine .stat { display: flex; gap: 6px; align-items: baseline; white-space: nowrap; color: var(--muted); line-height: 1.35; }
.machine .stat span { width: 56px; flex: none; }
.machine .stat b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.machine .updated { font-size: 11px; color: var(--muted); margin-top: 2px; }
.meter { height: 3px; background: var(--bar-bg); border-radius: 99px; overflow: hidden; margin: 1px 0 3px; }
.meter > div { height: 100%; background: var(--ok); }
.meter.busy > div { background: var(--busy); } .meter.warn > div { background: var(--warn); } .meter.bad > div { background: var(--bad); }
.t-ok { color: var(--ok) !important; } .t-warn { color: var(--warn) !important; } .t-bad { color: var(--bad) !important; }
@media (prefers-reduced-motion: reduce) { .machine .flip { transition: none; } }
.machine .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.machine .what { font-size: 13px; color: var(--muted); margin-top: 4px; min-height: 2.9em;
  overflow: hidden; text-overflow: ellipsis; }
.machine.missing { opacity: .6; }
.machine.missing .face { border-style: dashed; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.s-rendering { color: var(--busy); } .s-idle { color: var(--ok); } .s-asleep, .s-missing { color: var(--idle); }
.s-offline, .s-error, .s-failed, .s-canceled { color: var(--bad); }
.s-starting, .s-testing, .s-restart, .s-queued, .s-paused, .s-pause-requested,
.s-cancel-requested, .s-requeueing, .s-under-construction { color: var(--warn); }
.s-active { color: var(--busy); } .s-completed { color: var(--ok); }

.job { display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line); }
.job:first-child { border-top: 0; }
.thumb { width: 96px; height: 54px; border-radius: 6px; background: var(--bar-bg); object-fit: cover; display: block; }
.job .title { font-weight: 600; overflow-wrap: anywhere; }
.job .meta { font-size: 13px; color: var(--muted); }
.job .btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.delivery { font-size: 13px; margin-top: 4px; }
.delivery.failed { color: var(--bad); }
.delivery.done { color: var(--ok); }
@media (max-width: 600px) {
  .job { grid-template-columns: 64px 1fr; }
  .thumb { width: 64px; height: 36px; }
  .job .btns { grid-column: 1 / -1; justify-content: flex-start; }
}

.login { max-width: 360px; }
.login form { display: grid; gap: 12px; }
.login input { font-size: 20px; letter-spacing: .3em; text-align: center; }
.top .right { display: flex; align-items: center; gap: 12px; }
