:root {
  --bg: #f5f4ef; --surface: #ffffff; --surface-2: #f0efe9; --ink: #1d2125; --muted: #646b73;
  --line: #e2e0d8; --accent: #0d6e63; --accent-ink: #ffffff; --accent-soft: #dcefeb;
  --danger: #b3362b; --danger-soft: #f9e4e1; --warn: #8a5a00; --warn-soft: #f8ecd2; --ok: #1f7a4d; --ok-soft: #dff2e7;
  --nav: #16201f; --nav-ink: #c9d4d1; --nav-active: #24403b;
  --shadow: 0 1px 2px rgba(20, 24, 22, .05), 0 8px 24px rgba(20, 24, 22, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111514; --surface: #1a201e; --surface-2: #232a28; --ink: #e9ece9; --muted: #9aa5a1;
    --line: #2e3734; --accent: #4cc0ae; --accent-ink: #08201c; --accent-soft: #1d3a35;
    --danger: #f0897d; --danger-soft: #41211e; --warn: #eab95e; --warn-soft: #3b2e13; --ok: #6fd19d; --ok-soft: #173427;
    --nav: #0c100f; --nav-ink: #aab6b2; --nav-active: #1f3531;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 "Be Vietnam Pro", system-ui, "Segoe UI", sans-serif; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--nav); color: var(--nav-ink); padding: 22px 14px; display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: #fff; font-weight: 700; font-size: 17px; }
.brand i { width: 28px; height: 28px; border-radius: 8px; background: #4cc0ae; color: #08201c; display: grid; place-items: center; font-style: normal; font-weight: 700; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav button { display: flex; align-items: center; gap: 11px; padding: 10px 11px; border: 0; border-radius: 9px; background: none; color: inherit; cursor: pointer; text-align: left; font-weight: 500; white-space: nowrap; }
.nav button:hover { background: rgba(255, 255, 255, .06); }
.nav button.on { background: var(--nav-active); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; }
.side-foot { margin-top: auto; display: grid; gap: 12px; font-size: 13px; }
.budget { padding: 12px; border-radius: 10px; background: rgba(255, 255, 255, .05); display: grid; gap: 7px; }
.budget b { color: #fff; font-weight: 600; }
.budget .row { display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; }
.meter { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .13); overflow: hidden; }
.meter span { display: block; height: 100%; background: #4cc0ae; }
.who { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 4px; }
.who div { display: flex; gap: 2px; }
.link { background: none; border: 0; color: inherit; cursor: pointer; padding: 3px 6px; border-radius: 6px; font-size: 13px; }
.link:hover { background: rgba(255, 255, 255, .08); color: #fff; }

main { padding: 34px clamp(16px, 4vw, 44px) 60px; max-width: 1040px; width: 100%; }
.head { margin-bottom: 22px; }
.head h1 { font-size: 25px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
.head p { color: var(--muted); margin-top: 4px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.card + .card, .stack > * + * { margin-top: 16px; }
.card h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.two { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.two > .card { margin-top: 0; }
label.field { display: grid; gap: 5px; font-size: 13px; font-weight: 500; color: var(--muted); }
input[type=text], input[type=password], input[type=number], select, textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; color: var(--ink); font-size: 15px; font-weight: 400; }
textarea { resize: vertical; min-height: 118px; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.hint { color: var(--muted); font-size: 13px; }
.row-end { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 500; font-size: 14px; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; padding: 10px 20px; font-size: 15px; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.cost { font-size: 14px; color: var(--muted); }
.cost b { color: var(--ink); font-weight: 600; }
.mt { margin-top: 14px; }
details.more { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
summary { cursor: pointer; font-weight: 500; font-size: 14px; }
details.more > div { margin-top: 12px; display: grid; gap: 12px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

.section-title { font-size: 16px; font-weight: 600; margin: 26px 0 10px; }
.job { padding: 16px 18px; }
.job-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.job-title { font-weight: 600; overflow-wrap: anywhere; }
.job-meta { font-size: 13px; color: var(--muted); }
.badge { flex: none; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.running, .badge.queued { background: var(--accent-soft); color: var(--accent); }
.badge.done { background: var(--ok-soft); color: var(--ok); }
.badge.partial, .badge.budget { background: var(--warn-soft); color: var(--warn); }
.badge.error { background: var(--danger-soft); color: var(--danger); }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 11px; }
.bar span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.log { margin-top: 10px; }
.log pre { margin: 8px 0 0; padding: 10px 12px; background: var(--surface-2); border-radius: 9px; font: 12.5px/1.55 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 230px; overflow: auto; }
.media { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-top: 12px; }
.media figure { margin: 0; display: grid; gap: 5px; min-width: 0; }
.media img, .media video { width: 100%; border-radius: 9px; background: #000; display: block; }
.media figcaption { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--muted); }
.media figcaption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; font-size: 14px; }
.files li { display: flex; justify-content: space-between; gap: 10px; }
.files span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-actions { margin-top: 12px; }

.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin-top: 14px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px 13px; }
.stat b { display: block; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.table-wrap { overflow-x: auto; margin-top: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

.vlist { display: grid; gap: 6px; }
.vitem { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; }
.vitem .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.live-dot.on { background: #e5483b; box-shadow: 0 0 0 4px rgba(229, 72, 59, .18); }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth { width: min(380px, 100%); display: grid; gap: 14px; }
.auth .brand { color: var(--ink); padding: 0; margin-bottom: 4px; }
.auth .btn.primary { justify-content: center; }
.error { color: var(--danger); font-size: 14px; min-height: 1.4em; }

dialog { border: 1px solid var(--line); border-radius: 14px; padding: 22px; background: var(--surface); color: var(--ink); width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 14, 13, .5); }
dialog h3 { font-size: 17px; margin-bottom: 8px; }
dialog .actions { justify-content: flex-end; margin-top: 18px; }
.secret { font: 15px ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 10px 12px; border-radius: 9px; overflow-wrap: anywhere; margin-top: 10px; }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100vw - 32px); z-index: 20; }
#toast.show { opacity: 1; }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; padding: 14px 12px; gap: 12px; }
  .nav { flex-direction: row; overflow-x: auto; margin: 0 -12px; padding: 0 12px; scrollbar-width: none; }
  .side-foot { margin-top: 0; }
  .two { grid-template-columns: minmax(0, 1fr); }
  main { padding-top: 22px; }
}
