@font-face {
  font-family: Manrope;
  src: url("manrope-variable.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root, html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10151e;
  --bg2: #171f2c;
  --bg3: #1d293b;
  --bg4: #22334e;
  --line: #2c384b;
  --line-strong: #526580;
  --text: #e6ecf5;
  --muted: #a6b2c5;
  --faint: #a6b2c5;
  --accent: #8cafff;
  --accent-dim: #1e2d49;
  --accent2: #c2a9f6;
  --ok: #93d4b4;
  --ok-dim: #192b29;
  --warn: #edc47e;
  --warn-dim: #332a1b;
  --fail: #f4a6b2;
  --fail-dim: #352127;
  --idle: #6b7385;
  --on-accent: #fff;
  --callout-warn: #f3d98a;
  --callout-fail: #ffb1b1;
  --callout-ok: #8eecc0;
  --callout-info: #c5d4ff;
  --log-bg: #121a27;
  --log-panel: #171f2c;
  --log-text: #c9d4e5;
  --chart-bg: #141d2a;
  --chart-grid: rgba(255, 255, 255, .06);
  --chart-cursor: rgba(255, 255, 255, .28);
  --host-tip-bg: rgba(16, 20, 28, .92);
  --switch-off: #3a4254;
  --pbar-track: #263143;
  --pbar-idle-from: #3a4254;
  --pbar-idle-to: #5c6780;
  --overlay: rgba(6, 8, 12, .72);
  --overlay-soft: rgba(8, 10, 14, .55);
  --hover-wash: rgba(255, 255, 255, .02);
  --shadow: 0 8px 28px #00000024;
}
:root {
  --radius: 10px;
  --radius-sm: 7px;
  --font: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "SF Mono", "Cascadia Code", ui-monospace, monospace;
  --side: 236px;
  --header: 104px;
  --log-bar: 48px;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f5f1;
  --bg2: #fff;
  --bg3: #f4f5f7;
  --bg4: #edf2ff;
  --line: #e2e4e8;
  --line-strong: #a3adb9;
  --text: #202329;
  --muted: #626870;
  --faint: #626870;
  --accent: #244fc2;
  --accent-dim: #edf2ff;
  --accent2: #7952b3;
  --ok: #26734e;
  --ok-dim: #edf7f0;
  --warn: #886009;
  --warn-dim: #fbf4e5;
  --fail: #b83d4a;
  --fail-dim: #fff0f1;
  --idle: #626870;
  --on-accent: #fff;
  --callout-warn: #7a5600;
  --callout-fail: #9a2222;
  --callout-ok: #0f5f38;
  --callout-info: #243f8c;
  --log-bg: #f4f5f7;
  --log-panel: #fff;
  --log-text: #303947;
  --chart-bg: #fafbfc;
  --chart-grid: rgba(40, 32, 18, .08);
  --chart-cursor: rgba(40, 32, 18, .28);
  --host-tip-bg: rgba(255, 252, 247, .94);
  --switch-off: #858e9a;
  --pbar-track: #edf0f4;
  --pbar-idle-from: #b1bbc9;
  --pbar-idle-to: #b1bbc9;
  --overlay: rgba(40, 32, 18, .45);
  --overlay-soft: rgba(40, 32, 18, .28);
  --hover-wash: rgba(40, 32, 18, .04);
  --shadow: 0 8px 28px #2023290c;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; color: inherit; background: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
::selection { background: var(--accent-dim); color: var(--text); }
.hidden, .modal[hidden], .busy[hidden], .login-screen[hidden] { display: none !important; }

/* ——— Login ——— */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}
.login-card {
  width: min(440px, 100%);
  padding: 36px;
  margin: auto;
  box-shadow: var(--shadow);
}
.login-card .brand { margin-bottom: 22px; }
.login-card .primary { width: 100%; margin-top: 8px; }
.login-msg { min-height: 20px; margin: 10px 0 0; color: var(--fail); font-size: 13px; }
.login-msg:empty { display: none; }
.ops-bar, .settings-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.settings-bar h2 { margin-bottom: 4px; }
.settings-bar .k { margin: 0; }
.settings-bar .row { flex: none; flex-wrap: wrap; }
.acl-grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.acl-grid th, .acl-grid td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.acl-checks { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.user-card { margin-bottom: 14px; }

/* ——— Shell ——— */
.app { display: grid; grid-template-columns: var(--side) 1fr; height: 100%; }
.app.locked { display: none; }
.side {
  background: var(--bg2);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 2px 8px; }
.logo {
  width: 36px;
  height: 36px;
  border-radius: 0;
  background: url("buildforge-logo.png") center / contain no-repeat;
  flex: none;
}
.brand-name { font-weight: 650; letter-spacing: -.02em; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .01em; white-space: nowrap; }
nav { display: flex; flex-direction: column; gap: 4px; }
.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: var(--muted);
  padding: 9px 12px;
  border-radius: 10px;
  width: 100%;
}
.nav svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.nav.on {
  background: var(--accent-dim);
  color: var(--accent);
}
.nav:hover { background: var(--bg3); color: var(--text); }
.nav.on:hover { background: var(--accent-dim); }
.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--button);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.side-live {
  margin-top: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg3);
  border: 1px solid var(--line);
}
.side-live .k { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.side-live .v { margin-top: 4px; font-weight: 650; }
.side-live.building { border-color: var(--line-strong); }
.side-live.fail, .side-live.blocked { border-color: rgba(255, 107, 107, .35); }
.side-live.ok { border-color: rgba(61, 214, 140, .3); }
.side-status, .side-foot {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.side-foot {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: auto;
  padding: 0 8px;
}
.side-foot button { color: var(--muted); padding: 6px 0; }
.side-foot button:hover { color: var(--text); }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--idle);
  flex: none;
}
.dot.building { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-dim); animation: pulse 1.6s ease-in-out infinite; }
.dot.ok { background: var(--ok); }
.dot.fail, .dot.blocked { background: var(--fail); }
.dot.sse-off { background: var(--fail); }
.dot.sse-on { background: var(--ok); }

.shell { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top {
  min-height: var(--header);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  flex: none;
  gap: 16px;
}
.top-title { min-width: 0; }
.top h1 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.top-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-sub:empty { display: none; }
.top-actions { display: flex; gap: 8px; flex: none; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.theme-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.theme-switch button {
  padding: 6px 9px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
}
.theme-switch button.on {
  background: var(--bg2);
  color: var(--text);
  box-shadow: 0 1px 0 var(--line);
}
.login-card .theme-switch { margin-top: 16px; width: 100%; }
.login-card .theme-switch button { flex: 1; }

.workspace { flex: 1; min-height: 0; overflow: auto; padding: 20px 28px 24px; }

/* ——— Primitives ——— */
.panel, .card, .stat, .hero, .login-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.panel { margin: 0 0 14px; }
.panel h2, .panel h3 { margin: 0 0 12px; }
h2 { font-size: 15px; font-weight: 650; letter-spacing: -.02em; }
h3 { font-size: 13px; color: var(--muted); font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.k { color: var(--muted); font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.row, .row-between { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; min-width: 0; }
.row-between { justify-content: space-between; }
.row-wrap { flex-wrap: wrap; }
.row > input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
.row > select {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}
.row > .ghost, .row > .primary, .row > .danger-btn { flex: none; }
.panel .field + .field { margin-top: 12px; }
.stack { display: grid; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cards { display: grid; gap: 16px; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }

input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
select, textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}
input:not([type=checkbox]):not([type=radio]):not([type=hidden]):focus,
select:focus, textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}
input[readonly], textarea[readonly] { color: var(--muted); }
textarea { resize: vertical; min-height: 72px; font-family: var(--mono); font-size: 12px; line-height: 1.45; }
label { display: block; color: var(--muted); font-size: 12px; margin: 0 0 6px; font-weight: 550; }
.field { min-width: 0; }
.field + .field { margin-top: 0; }

.primary, .ghost, .danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-weight: 650;
  white-space: normal;
  min-height: 44px;
  line-height: 1.4;
  text-align: center;
  overflow-wrap: anywhere;
}
.primary { background: var(--button); color: var(--on-accent); border: 1px solid transparent; }
.primary:hover { background: var(--button-hover); }
.primary:disabled, .ghost:disabled { opacity: .5; cursor: default; }
.ghost { background: var(--bg3); color: var(--text); border: 1px solid var(--line); }
.ghost:hover { border-color: var(--line-strong); background: var(--bg4); }
.danger, .danger-btn { background: transparent; color: var(--fail); padding: 9px 12px; }
.danger-btn { border: 1px solid rgba(255, 107, 107, .25); }
.danger-btn:hover { background: var(--fail-dim); }
.link {
  background: none;
  color: var(--accent2);
  padding: 0;
  margin: 0 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg3); color: var(--text); }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 650;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg3);
  color: var(--muted);
  letter-spacing: .02em;
}
.pill.ok { color: var(--ok); background: var(--ok-dim); }
.pill.warn { color: var(--warn); background: var(--warn-dim); }
.pill.fail { color: var(--fail); background: var(--fail-dim); }
.pill.live { color: var(--accent); background: var(--accent-dim); }
.pill.info { color: var(--accent2); background: rgba(122, 162, 255, .12); }

.switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}
.switch input {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.switch-ui {
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: var(--switch-off);
  position: relative;
  flex: none;
  transition: background .15s ease;
}
.switch-ui::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform .15s ease;
}
.switch input:checked + .switch-ui { background: var(--button); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }

.callout {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin: 8px 0;
  border: 1px solid var(--line);
}
.callout.warn { background: var(--warn-dim); border-color: rgba(245, 197, 66, .28); color: var(--callout-warn); }
.callout.fail { background: var(--fail-dim); border-color: rgba(255, 107, 107, .28); color: var(--callout-fail); }
.callout.ok { background: var(--ok-dim); border-color: rgba(61, 214, 140, .28); color: var(--callout-ok); }
.callout.info { background: rgba(122, 162, 255, .1); border-color: rgba(122, 162, 255, .25); color: var(--callout-info); }
.callout.dismissable { cursor: pointer; }
.callout.dismissable:hover { filter: brightness(1.08); }
.callout .dismiss-hint { float: right; opacity: .55; font-size: 11px; }
.callout summary { cursor: pointer; list-style: none; }
.callout summary::-webkit-details-marker { display: none; }
.callout pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  font: 11px/1.45 var(--mono);
  color: inherit;
  opacity: .9;
  max-height: 160px;
  overflow: auto;
}

.empty {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
}
.empty h3 { color: var(--text); text-transform: none; font-size: 16px; letter-spacing: -.02em; margin-bottom: 6px; }
.empty p { margin: 0 0 16px; }

.skeleton {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg3), var(--bg4), var(--bg3));
  background-size: 200% 100%;
  animation: sheen 1.2s linear infinite;
}

/* ——— Dashboard ——— */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 20px;
  align-items: center;
  margin-bottom: 14px;
  padding: 20px 22px;
  background: var(--bg2);
}
.hero.building { border-color: var(--line-strong); }
.hero.fail, .hero.blocked { border-color: rgba(255, 107, 107, .35); }
.hero.paused { border-color: rgba(245, 197, 66, .3); }
.hero-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.hero-job {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-pct {
  font-size: 40px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
  color: var(--accent);
  line-height: 1;
}
.hero.idle .hero-pct, .hero.ok .hero-pct { color: var(--ok); }
.hero.fail .hero-pct, .hero.blocked .hero-pct { color: var(--fail); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.chip b { color: var(--text); font-weight: 650; }

.host-panel { padding: 16px 18px 14px; }
.host-panel h2 { margin-bottom: 4px; }
.host-head { align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.host-panel.hot { border-color: rgba(255, 107, 107, .35); }
.host-now {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  font-variant-numeric: tabular-nums;
}
.host-stat {
  min-width: 72px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--bg3);
  border: 1px solid var(--line);
  text-align: right;
}
.host-stat .k { display: block; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.host-stat b { font-size: 16px; font-weight: 700; letter-spacing: -.03em; }
.host-stat.cpu b { color: var(--accent); }
.host-stat.ram b { color: var(--accent2); }
.host-stat.unity b { color: var(--ok); }
.host-stat.swap b { color: var(--fail); }
.host-chart-wrap {
  position: relative;
  height: 176px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, var(--hover-wash), transparent 40%),
    var(--chart-bg);
  border: 1px solid var(--line);
  overflow: hidden;
}
#host-chart { display: block; width: 100%; height: 176px; }
.host-grid line { stroke: var(--chart-grid); stroke-width: 1; }
.host-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.host-line.cpu { stroke: var(--accent); }
.host-line.ram { stroke: var(--accent2); }
.host-line.unity { stroke: var(--ok); }
.host-line.swap { stroke: var(--fail); stroke-dasharray: 5 4; stroke-width: 1.6; }
.host-area { fill: url(#hostCpuFill); }
.host-cursor { stroke: var(--chart-cursor); stroke-width: 1; display: none; }
.host-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--faint);
  font-size: 13px;
  pointer-events: none;
}
.host-tip {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--host-tip-bg);
  border: 1px solid var(--line-strong);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  box-shadow: var(--shadow);
  min-width: 140px;
}
.host-tip b { font-weight: 650; }
.host-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.host-key { display: inline-flex; align-items: center; gap: 6px; }
.host-key i {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  display: inline-block;
}
.host-key.cpu { color: var(--accent); }
.host-key.ram { color: var(--accent2); }
.host-key.unity { color: var(--ok); }
.host-key.swap { color: var(--fail); }
.side-host {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--muted);
}
.side-host b { color: var(--text); font-weight: 650; }
.side-host:empty { display: none; }

.board-panel h2 { margin-top: 0; }
.board-overall { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 700; font-size: 18px; }
.project-stop {
  background: var(--fail-dim);
  border-color: rgba(255, 107, 107, .45);
  font-weight: 650;
}
.overall-pbar { margin: 4px 0 16px; height: 10px; }
.board-group { margin-bottom: 16px; }
.board-proj { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.pbar-row { margin: 0 0 12px; }
.pbar-meta { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; gap: 10px; }
.pbar-name { font-weight: 650; }
.pbar-pct { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
.pbar {
  height: 8px;
  background: var(--pbar-track);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
  position: relative;
}
.pbar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width .28s cubic-bezier(.22,.8,.36,1);
  position: relative;
  overflow: hidden;
}
.pbar.running .pbar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: sheen 1.35s ease-in-out infinite;
}
.pbar.ok .pbar-fill { background: var(--ok); }
.pbar.fail .pbar-fill { background: var(--fail); }
.pbar.skip .pbar-fill,
.pbar.queued .pbar-fill,
.pbar.idle .pbar-fill { background: linear-gradient(90deg, var(--pbar-idle-from), var(--pbar-idle-to)); box-shadow: none; }
.pbar-phase { margin-top: 5px; font-size: 12px; color: var(--muted); min-height: 16px; }
.mini-bars { display: grid; gap: 6px; margin-top: 10px; }
.mini-bars .pbar { height: 5px; }
.mini-bars .pbar-meta { font-size: 12px; }

/* ——— Projects ——— */
.section-head { margin-bottom: 14px; }
.project-card {
  cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.project-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.project-card.is-live { border-color: var(--accent); }
.project-card.is-off { opacity: .7; }
.project-card.is-fail { border-color: rgba(255, 107, 107, .35); }
.project-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.project-title b { font-size: 16px; letter-spacing: -.02em; }
.project-card-actions { flex: none; align-items: center; gap: 8px; }
.sha { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.path-row input { font-family: var(--mono); font-size: 12px; }

.profiles { display: grid; gap: 6px; margin: 10px 0; }
.profiles label, .check {
  color: var(--text);
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg3);
  cursor: pointer;
}
.profiles input[type=checkbox], .check input[type=checkbox] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex: none;
  accent-color: var(--accent);
}
.art-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.art-table th { text-align: left; color: var(--muted); font-weight: 550; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 6px 8px; }
.art-table td { padding: 16px 8px; border-top: 1px solid var(--line); overflow-wrap: anywhere; vertical-align: top; }
.danger-zone {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed rgba(255, 107, 107, .25);
}

/* ——— Git picker ——— */
.git-picker { margin: 4px 0 12px; display: grid; gap: 10px; }
.git-device {
  margin: 12px 0;
  padding: 18px;
  border: 1px dashed var(--accent);
  border-radius: 12px;
  background: var(--accent-dim);
  text-align: center;
}
.git-code {
  font: 32px/1.2 var(--mono);
  letter-spacing: .14em;
  color: var(--accent);
  margin: 6px 0 10px;
}
.repo-list {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  max-height: 228px;
  overflow: auto;
  background: var(--bg);
}
.repo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
.repo-item:last-child { border-bottom: 0; }
.repo-item:hover { background: var(--bg3); }
.repo-item.on { background: var(--accent-dim); box-shadow: inset 3px 0 0 var(--accent); }
.repo-empty, .repo-loading { padding: 14px 12px; color: var(--muted); font-size: 13px; }
.git-install-row { margin-top: 0; }
.git-org-steps { margin: 8px 0 0; padding-left: 18px; color: var(--text); font-size: 13px; line-height: 1.45; }
.git-org-steps li + li { margin-top: 4px; }
a.primary, a.ghost { text-decoration: none; }
.git-advanced { margin-top: 8px; }
.git-advanced summary { cursor: pointer; color: var(--muted); }
.settings-h { margin: 0 0 8px; font-size: 15px; text-transform: none; letter-spacing: -.02em; color: var(--text); }
.settings-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg3);
  border-radius: 12px;
  margin-bottom: 16px;
  width: fit-content;
  flex-wrap: wrap;
}
.settings-tabs button {
  padding: 8px 12px;
  border-radius: 9px;
  color: var(--muted);
}
.settings-tabs button.on { background: var(--bg2); color: var(--text); font-weight: 650; }
.settings-foot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 0 4px;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  background: var(--bg3);
  border: 1px solid var(--line);
  margin: 10px 0;
}

.browser {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
}
.browser-path {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  background: var(--bg3);
  font-size: 12px;
}
.crumb { color: var(--accent2); padding: 0; }
.crumb:hover { text-decoration: underline; }
.browser-list { max-height: 280px; overflow: auto; }
.browser-list button {
  display: flex;
  width: 100%;
  text-align: left;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
.browser-list button:hover { background: var(--bg3); }
.browser-list .unity { color: var(--accent); font-weight: 650; }
.folder-mark { color: var(--muted); font-size: 12px; width: 16px; }

.tg-list {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  max-height: 240px;
  overflow: auto;
  background: var(--bg);
}
.tg-list button {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.tg-list button:last-child { border-bottom: 0; }
.tg-list button:hover, .tg-list button.on { background: var(--bg3); }
.tg-list button.on { box-shadow: inset 3px 0 0 var(--accent); }
.tg-list .meta { color: var(--muted); font-size: 12px; }

/* ——— Log drawer ——— */
.log-drawer {
  border-top: 1px solid var(--line);
  background: var(--log-panel);
  flex: none;
}
.log-toggle {
  width: 100%;
  height: var(--log-bar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: var(--muted);
}
.log-toggle:hover { color: var(--text); background: var(--hover-wash); }
.log-toggle-left { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); }
.log-tools { display: flex; gap: 6px; }
.log-body { display: none; flex-direction: column; height: min(260px, 38dvh); min-height: 150px; padding: 0 20px 16px; }
.log-drawer.open .log-body { display: flex; }
.log-drawer.open .chev { transform: rotate(90deg); }
.chev {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--muted);
  transition: transform .15s ease;
}
.log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--log-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: 12px/1.45 var(--mono);
  color: var(--log-text);
  margin: 0;
  white-space: pre-wrap;
}
.log-line { white-space: pre-wrap; word-break: break-word; }
.log-line.err { color: var(--callout-fail); }
.log-line.warn { color: var(--callout-warn); }
.log-line.ok { color: var(--callout-ok); }

/* ——— Overlays ——— */
.toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100% - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: toast-in .18s ease;
}
.toast.ok { border-color: rgba(61, 214, 140, .35); }
.toast.fail { border-color: rgba(255, 107, 107, .4); color: var(--callout-fail); }
.toast.warn { border-color: rgba(245, 197, 66, .35); }
.modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  background: var(--overlay);
  padding: 24px;
}
.modal-card { width: min(420px, 100%); }
.busy {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  background: var(--overlay-soft);
  text-align: center;
  padding: 24px;
}
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin .8s linear infinite;
}

@keyframes sheen {
  from { transform: translateX(-120%); background-position: 200% 0; }
  to { transform: translateX(120%); background-position: -200% 0; }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-dim); }
  50% { box-shadow: 0 0 0 7px var(--accent-dim); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

/* Pavel Foxx console: shared palette, typography and responsive workspace. */
:root { --button: #315fd6; --button-hover: #3e6ee5; --workspace-bottom: 32px; }
html[data-theme="light"] { --button: #244fc2; --button-hover: #1b3e9e; }
*, *::before, *::after { box-sizing: border-box; }
body { overflow: hidden; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea, summary { scroll-margin: 16px; }
button:disabled { cursor: default; opacity: .55; }
a { color: var(--accent); text-underline-offset: 3px; }
img, svg { max-width: 100%; }
.skip-link { position: fixed; left: 20px; top: -80px; z-index: 100; padding: 12px 20px; background: var(--bg2); border: 2px solid var(--accent); border-radius: 7px; }
.skip-link:focus { top: 12px; }
.app { grid-template-columns: var(--side) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.side { padding: 28px 16px 20px; gap: 28px; min-height: 0; overflow-y: auto; }
.brand { gap: 10px; padding: 0 6px; min-width: 0; }
.logo { width: 38px; height: 38px; }
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: -.045em; line-height: 1.2; }
.brand-sub { font-size: 10px; letter-spacing: .015em; margin-top: 4px; }
.side-os { margin-left: auto; font-size: 10px; }
.nav-label, .side-caption { font-size: 10px; font-weight: 700; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.nav-label { margin: 0 12px 8px; }
.side-caption { padding: 0 8px; font-size: 9px; letter-spacing: .08em; }
.nav { padding: 11px 12px; min-height: 46px; border-radius: 7px; font-weight: 600; }
.nav svg { width: 18px; height: 18px; }
.side-live { padding: 14px; border-radius: 8px; background: var(--bg); }
.side-live .v, #side-job { overflow-wrap: anywhere; }
.side-live.building { border-color: var(--line); }
.side-foot { flex-wrap: wrap; }
.top { padding: 20px 36px; gap: 20px; }
.top h1 { font-size: 30px; font-weight: 650; letter-spacing: -.045em; line-height: 1.25; }
.top-sub { margin-top: 5px; white-space: normal; overflow-wrap: anywhere; }
.theme-switch { border-radius: 8px; }
.theme-switch button { min-height: 38px; padding: 9px 10px; border-radius: 5px; }
.theme-picker { position: relative; }
.theme-picker > summary { display: grid; place-items: center; width: 44px; height: 44px; list-style: none; cursor: pointer; color: var(--muted); border-radius: 7px; border: 1px solid var(--line); background: var(--bg2); }
.theme-picker > summary::-webkit-details-marker { display: none; }
.theme-picker[open] > summary, .theme-picker > summary:hover { color: var(--accent); background: var(--accent-dim); }
.theme-picker .theme-switch { position: absolute; z-index: 12; right: 0; top: calc(100% + 8px); display: grid; width: 180px; padding: 6px; background: var(--bg2); box-shadow: var(--shadow); }
.theme-picker .theme-switch button { min-height: 44px; text-align: left; padding-inline: 14px; font-size: 12px; }
.theme-picker .theme-switch button.on { background: var(--accent-dim); color: var(--accent); box-shadow: none; }
.workspace { padding: 28px 36px 32px; scrollbar-gutter: stable; scroll-padding: 20px; }
.view { width: 100%; max-width: 1360px; margin-inline: auto; }
.fold-section.panel { padding: 0; }
.fold-section > .section-summary { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; padding: 20px 52px 20px 24px; min-height: 70px; list-style: none; cursor: pointer; margin: 0; border-radius: var(--radius); }
.section-summary::-webkit-details-marker { display: none; }
.section-summary::after { content: ""; position: absolute; right: 26px; top: 29px; width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); }
.fold-section[open] > .section-summary::after { transform: rotate(225deg); top: 32px; }
.fold-section[open] > .section-summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.section-summary:hover { background: var(--hover-wash); }
.section-summary h2, .section-summary h3 { font-size: 16px; letter-spacing: -.02em; text-transform: none; color: var(--text); margin: 0; }
.section-title { min-width: 0; flex: 1; }
.section-caption { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 4px; overflow-wrap: anywhere; }
.section-body { padding: 20px 24px 24px; min-width: 0; }
.settings-bar.fold-section { display: block; }
.settings-bar .section-body > .row { flex-wrap: wrap; }
.host-head.section-summary { align-items: flex-start; }
.host-head.section-summary #host-meta { margin: 5px 0 0; }
.section-body > :first-child { margin-top: 0; }
.section-body > :last-child { margin-bottom: 0; }
.section-body > .field + .row, .section-body > .form-grid + .row { margin-top: 14px; }
.section-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; margin: 4px 0 14px; }
.section-tools .link { margin: 0; min-height: 44px; padding: 8px 0; font-size: 12px; }
.section-tools .row { gap: 20px; }
.project-sections { display: block; }
.project-overview { display: block; }
.project-overview-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; margin: 10px 0 0; }
.project-overview .project-detail-actions { width: auto; }
.project-live-details.git-advanced { margin-top: 4px; }
.project-live-summary { min-height: 44px; padding-block: 12px; font-size: 12px; }
.hero-progress { text-align: right; }
.hero-progress-label { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0; line-height: 1.4; }
.panel, .card, .stat { padding: 22px 24px; min-width: 0; }
.panel { margin-bottom: 20px; }
h2 { font-size: 17px; letter-spacing: -.025em; line-height: 1.4; }
.k, .mono, .sha, code, .callout, .pbar-name, .pbar-phase, .board-proj { overflow-wrap: anywhere; }
.row > *, .row-between > * { min-width: 0; max-width: 100%; }
.form-grid { gap: 16px; }
.panel .form-grid .field + .field { margin-top: 0; }
.panel > .field + .row, .panel > .form-grid + .row { margin-top: 14px; }
.row > input:not([type=checkbox]):not([type=radio]):not([type=hidden]), .row > select { flex-basis: 160px; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea { min-height: 44px; min-width: 0; max-width: 100%; background: var(--bg2); border-color: var(--line-strong); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[type=file] { font-size: 12px; }
input::file-selector-button { font: inherit; color: var(--text); background: var(--bg3); border: 0; border-radius: 4px; padding: 4px 8px; margin-right: 8px; }
label { color: var(--text); font-weight: 600; margin-bottom: 7px; }
input + label, select + label, textarea + label, .row + label { margin-top: 16px; }
.form-grid + label { margin-top: 16px; }
.ghost { background: var(--bg2); }
.link { color: var(--accent); min-height: 44px; }
.icon-btn { width: 44px; height: 44px; border-radius: 7px; }
.switch { min-height: 44px; line-height: 1.5; }
.check, .profiles label { min-height: 44px; align-items: center; border-radius: 7px; overflow-wrap: anywhere; }
.profiles label span { min-width: 0; }
.profiles input[type=checkbox], .check input[type=checkbox] { margin-top: 0; }
.hero { margin-bottom: 20px; padding: 26px 28px; min-height: 120px; grid-template-columns: minmax(0, 1fr) auto; }
.hero.building { border: 1px solid var(--line); border-left: 3px solid var(--accent); }
.hero > div { min-width: 0; }
.hero-job { font-size: 26px; line-height: 1.35; margin-top: 7px; white-space: normal; overflow-wrap: anywhere; }
.hero-pct { font-size: 44px; }
.chips { gap: 10px; margin-bottom: 20px; }
.chip { padding: 12px 16px; border-radius: 8px; }
.host-panel { padding: 22px 24px 18px; }
.host-head { gap: 16px; margin-bottom: 16px; }
.host-stat { border-radius: 7px; }
.host-chart-wrap { border-radius: 7px; background: var(--chart-bg); }
#hostCpuFill stop { stop-color: var(--accent); }
.host-legend { gap: 10px 20px; }
.board-panel h2 { margin-bottom: 4px; }
.board-group { margin-top: 20px; margin-bottom: 20px; }
.board-group:last-child { margin-bottom: 0; }
.pbar-meta { flex-wrap: wrap; gap: 4px 12px; }
.pbar-pct { flex-shrink: 0; }
.section-head { margin-bottom: 22px; gap: 16px; }
.section-head p { margin: 6px 0 0; }
.project-card.is-live { border: 1px solid var(--line); border-left: 3px solid var(--accent); }
.project-card .row-between { gap: 12px 24px; }
.project-title b { font-size: 18px; letter-spacing: -.03em; overflow-wrap: anywhere; }
.project-card > .k { margin-top: 12px; }
.project-card-actions { flex-wrap: wrap; }
.project-detail-actions { flex-wrap: wrap; }
.archive-table th:first-child { width: 30%; }
.archive-table th:last-child { width: 24%; }
.artifacts-table th:last-child { width: 50%; }
.art-table .art-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.acl-grid { table-layout: fixed; }
.acl-grid th:first-child { width: 30%; }
.acl-grid td { overflow-wrap: anywhere; }
.acl-checks label { min-height: 44px; display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.acl-checks input { width: 18px; height: 18px; accent-color: var(--button); }
.user-card { border: 1px solid var(--line); border-radius: 8px; padding: 20px; background: var(--bg); }
.user-card > .row-between { margin-bottom: 16px; }
.settings-h { font-size: 17px; }
.settings-bar { align-items: flex-start; }
#s-restart-msg:empty { display: none; }
.settings-tabs { gap: 8px; padding: 0 0 10px; background: none; border-radius: 0; border-bottom: 1px solid var(--line); margin-bottom: 24px; width: 100%; }
.settings-tabs button { padding: 10px 16px; min-height: 44px; border-radius: 6px; }
.settings-tabs button.on { background: var(--accent-dim); color: var(--accent); font-weight: 700; }
.settings-tabs button:hover { color: var(--accent); background: var(--accent-dim); }
.settings-foot { padding: 12px 0; bottom: calc(-1 * var(--workspace-bottom)); }
#git-https-box, #git-ssh-box { margin-top: 16px; }
.account-card { flex-wrap: wrap; border-radius: 8px; }
.git-advanced summary { min-height: 44px; padding-block: 10px; }
.git-advanced[open] summary { margin-bottom: 10px; }
.repo-item, .browser-list button, .tg-list button { min-height: 44px; overflow-wrap: anywhere; }
.repo-item > * { min-width: 0; }
.repo-item .k { flex-shrink: 0; }
.crumb { min-height: 44px; min-width: 44px; overflow-wrap: anywhere; }
.browser { margin-bottom: 20px; }
.browser-path { gap: 2px 8px; }
.browser-path .k { flex-basis: 100%; }
.danger-zone { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding-bottom: 8px; }
.callout.dismissable { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; cursor: default; }
.callout.dismissable details { min-width: 0; grid-column: 1; grid-row: 1; }
.callout .dismiss-hint { grid-column: 2; grid-row: 1; align-self: start; float: none; opacity: 1; min-height: 44px; padding: 8px; margin: 0; border-radius: 5px; text-decoration: underline; }
.callout summary::before { content: "›"; display: inline-block; margin-right: 6px; font-size: 16px; line-height: 1; }
.callout summary { min-height: 44px; padding-block: 10px; }
.callout details[open] summary::before { transform: rotate(90deg); }
.log-toggle { padding-inline: 24px; }
.log-body > .row-between { gap: 8px; }
.log-body .ghost { min-height: 40px; padding: 8px 12px; }
.log-close { display: none; }
.log-drawer.mobile-overlay { position: fixed; inset: 0; z-index: 42; display: flex; flex-direction: column; height: 100vh; height: 100dvh; padding-top: env(safe-area-inset-top); }
.log-drawer.mobile-overlay .log-close { display: inline-flex; position: absolute; right: 12px; top: calc(4px + env(safe-area-inset-top)); z-index: 1; min-height: 40px; }
.log-drawer.mobile-overlay .log-toggle { flex: none; padding-right: 120px; border-bottom: 1px solid var(--line); }
.log-drawer.mobile-overlay .log-tools { display: none; }
.log-drawer.mobile-overlay .log-body { height: auto; flex: 1; min-height: 0; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); }
.log-drawer.mobile-overlay .log { min-height: 0; }
.login-screen, .modal { overflow-y: auto; }
.login-card { padding: 36px; }
.login-heading { margin: 0 0 6px; font-size: 26px; letter-spacing: -.04em; }
.login-caption { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.login-mode { margin: 0 0 18px; font-size: 13px; font-weight: 650; }
.login-card .brand { padding: 0; margin-bottom: 32px; }
.login-card .theme-switch { margin-top: 24px; }
.modal-card { margin: auto; max-height: calc(100dvh - 48px); overflow-y: auto; padding: 28px; }
.modal-card h2 { font-size: 22px; }
.toasts { top: max(16px, env(safe-area-inset-top)); }

@media (min-width: 1600px) {
  :root { --side: 256px; }
  .workspace { padding-inline: 48px; }
  .top { padding-inline: 48px; }
}
@media (max-width: 1200px) {
  :root { --side: 208px; --workspace-bottom: 24px; }
  .workspace { padding: 24px; }
  .top { padding-inline: 24px; }
  .side { padding-inline: 12px; }
  .split { grid-template-columns: 1fr; gap: 0; }
  .project-card-actions { flex-basis: 100%; }
}
@media (max-width: 980px) {
  :root { --header: 92px; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .side { flex-direction: row; align-items: center; justify-content: space-between; padding: 12px 24px; border-right: 0; border-bottom: 1px solid var(--line); gap: 20px; overflow: visible; }
  .side nav { flex-direction: row; gap: 6px; }
  .side .brand { padding: 0; }
  .side-live, .side-foot, .side-caption, .nav-label { display: none; }
  .nav { width: auto; white-space: nowrap; padding-inline: 14px; }
  .nav-badge { margin-left: 0; }
  .top h1 { font-size: 28px; }
  .hero-job { font-size: 24px; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .host-head { flex-direction: column; }
  .host-now { width: 100%; justify-content: flex-start; }
  .host-stat { flex: 1 1 80px; text-align: left; }
  .archive-table, .archive-table tbody { display: block; width: 100%; }
  .archive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .archive-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 16px; border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-top: 14px; background: var(--bg); }
  .archive-table td { border: 0; padding: 0; min-width: 0; }
  .archive-table td:first-child, .archive-table td.art-actions { grid-column: 1 / -1; }
  .archive-table td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font: 11px/1.5 var(--font); margin-bottom: 4px; }
  .archive-table td.art-actions::before { display: none; }
  .archive-table .art-actions { margin-top: 4px; }
}
@media (max-width: 650px) {
  :root { --header: 0px; }
  .side { flex-direction: column; align-items: stretch; padding: 10px 16px 8px; gap: 8px; }
  .side .brand { padding-inline: 2px; }
  .side .logo { width: 32px; height: 32px; }
  .side .brand-name { font-size: 18px; }
  .side .brand-sub { font-size: 9px; }
  .side nav { display: flex; width: 100%; gap: 4px; }
  .nav { flex: 1; justify-content: center; font-size: 12px; padding: 10px 6px; gap: 6px; }
  .nav svg { width: 16px; height: 16px; }
  .nav-badge { padding: 0 4px; min-width: 16px; height: 16px; font-size: 10px; }
  .top { padding: 14px 16px; align-items: flex-start; gap: 12px; }
  .top-title { flex: 1; }
  .top h1 { font-size: 23px; }
  .top-sub { font-size: 11px; line-height: 1.45; margin-top: 4px; }
  .top-actions { width: auto; flex-wrap: nowrap; gap: 6px; }
  .theme-switch button { flex: 1; min-height: 38px; padding: 9px 7px; font-size: 11px; }
  .theme-picker .theme-switch button { min-height: 44px; font-size: 12px; padding-inline: 14px; }
  .top-actions > .ghost { padding-inline: 12px; }
  .workspace { padding: 18px 16px 24px; scrollbar-gutter: auto; }
  .panel, .card, .stat { padding: 18px; }
  .panel { margin-bottom: 16px; }
  .fold-section > .section-summary { padding: 16px 44px 16px 18px; min-height: 68px; }
  .section-summary::after { right: 20px; top: 26px; }
  .fold-section[open] > .section-summary::after { top: 29px; }
  .section-body { padding: 18px; }
  .section-tools > .k { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .section-tools .row { justify-content: space-between; width: 100%; }
  h2 { font-size: 16px; }
  .hero { padding: 20px; gap: 12px; min-height: 118px; margin-bottom: 14px; }
  .hero-job { font-size: 21px; }
  .hero-kicker { font-size: 10px; letter-spacing: .05em; }
  .hero-pct { font-size: 32px; }
  .hero-progress-label { font-size: 10px; max-width: 100px; }
  .host-panel { padding: 18px 14px; }
  .host-head { gap: 10px; }
  .host-now { gap: 6px; }
  .host-stat { min-width: 0; padding: 8px; flex: 1 1 60px; }
  .host-stat b { font-size: 15px; }
  .host-chart-wrap, #host-chart { height: 156px; }
  .host-legend { gap: 8px 14px; font-size: 11px; }
  .board-group { margin-top: 16px; }
  .grid-3, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .field + .field { margin-top: 0; }
  input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea { font-size: 16px; }
  .path-row input, input[type=file] { font-size: 13px; }
  .row > input:not([type=checkbox]):not([type=radio]):not([type=hidden]), .row > select { flex-basis: 100%; }
  .row > .primary, .row > .ghost, .row > .danger-btn { flex: 1 1 auto; }
  .path-row > input:not([type=checkbox]) { flex-basis: 130px; }
  .path-row > .ghost { flex: 0 0 auto; }
  .section-head > div, .section-head > .primary { width: 100%; }
  .project-card-actions { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-card-actions .primary:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .project-detail-actions { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-detail-actions > .primary { grid-column: 1 / -1; }
  .project-overview { gap: 12px; }
  .project-overview .project-detail-actions { display: flex; width: 100%; }
  .project-overview .project-detail-actions > * { flex: 1 1 auto; }
  .project-title b { font-size: 17px; }
  .project-card > .k { margin-top: 14px; line-height: 1.8; }
  .settings-bar { gap: 16px; }
  .settings-bar .section-body > .row { flex: 1 1 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #btn-restart-daemon { grid-column: 1 / -1; }
  .settings-tabs { gap: 6px; margin-bottom: 18px; }
  .settings-tabs button { padding: 10px 12px; flex: 1 1 auto; font-size: 12px; }
  #settings-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; padding-bottom: 8px; gap: 4px; }
  #settings-tabs button { flex: 0 0 auto; white-space: nowrap; padding-inline: 12px; }
  .settings-foot .primary { min-width: 150px; }
  .account-card { padding: 14px; }
  .account-card .row { width: 100%; }
  .user-card { padding: 14px; }
  .acl-grid, .acl-grid tbody, .acl-grid tr, .acl-grid td { display: block; width: 100%; }
  .acl-grid thead { display: none; }
  .acl-grid td { border: 0; padding: 6px 0; }
  .acl-grid tr { padding-block: 8px; border-bottom: 1px solid var(--line); }
  .acl-checks { gap: 4px 12px; }
  .art-table, .art-table tbody, .art-table tr, .art-table td { display: block; width: 100%; }
  .art-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .art-table tr { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-top: 14px; background: var(--bg); }
  .art-table td { border: 0; padding: 5px 0; font-size: 13px; }
  .art-table td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font: 10px/1.5 var(--font); letter-spacing: .04em; margin-bottom: 2px; }
  .art-table .art-actions { padding-top: 12px; }
  .art-table .art-actions > * { flex: 1; }
  .artifacts-table td { overflow-wrap: anywhere; }
  .log-toggle { padding-inline: 18px; }
  .log-body { padding-inline: 16px; height: min(300px, 44dvh); }
  .log-body > .row-between { flex-direction: column; align-items: stretch; }
  .log-body .row { gap: 6px; }
  .log-body .ghost { font-size: 11px; padding-inline: 7px; }
  .log-tools .pill { font-size: 10px; }
  .login-screen, .modal { padding: 18px; }
  .login-card { padding: 28px 22px; }
  .modal-card { padding: 24px; max-height: calc(100dvh - 36px); }
  .login-card .theme-switch button { padding-inline: 4px; }
  .toasts { right: 12px; width: calc(100% - 24px); }
}
@media (max-width: 360px) {
  .side { padding-inline: 12px; }
  .nav { font-size: 11px; gap: 4px; }
  .nav svg { width: 14px; height: 14px; }
  .workspace { padding-inline: 12px; }
  .top { padding-inline: 14px; }
  .theme-switch button { font-size: 10px; padding-inline: 5px; }
  .panel, .card { padding: 14px; }
  .hero { padding: 16px; }
  .hero-job { font-size: 19px; }
  .hero-pct { font-size: 28px; }
}
/* Short landscape screens scroll as one document, leaving room for forms and logs. */
@media (max-height: 540px) and (max-width: 980px) {
  :root { --workspace-bottom: 0px; }
  body { overflow: auto; }
  .app { height: auto; min-height: 100dvh; display: flex; flex-direction: column; }
  .side { padding: 8px 20px; flex-direction: row; }
  .side .brand-sub { display: none; }
  .side nav { width: auto; }
  .side .logo { width: 30px; height: 30px; }
  .top { min-height: 0; padding: 12px 22px; flex-wrap: nowrap; }
  .top h1 { font-size: 24px; }
  .top-title { flex: 1; }
  .top-actions { width: auto; }
  .shell { overflow: visible; }
  .workspace { overflow: visible; flex: auto; padding: 20px 22px; }
  .hero { min-height: 100px; padding-block: 20px; }
  .log-body { height: 230px; }
  .login-screen, .modal { align-items: start; }
  .login-card { margin-block: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
