/* Layout: full-bleed 3D city; thin civic top bar; a floating "permit card" panel on the right
   (bottom sheet on phones). Colour: street-sign ink + crane yellow, with semantic run states. */
:root {
  --bg: #dce9f1;
  --surface: #ffffff;
  --surface-2: #f3f5f7;
  --fg: #18202b;
  --muted: #5b6676;
  --line: #d9dfe6;
  --accent: #f2b632;
  --accent-ink: #1a1405;
  --ok: #23884f;
  --warn: #b87300;
  --bad: #c9231b;
  --idle: #6f7b8b;
  --shadow: 0 10px 30px rgba(24, 32, 43, .14), 0 2px 6px rgba(24, 32, 43, .08);
  --font-display: "Big Shoulders Display", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1320; --surface: #161e2c; --surface-2: #1d2738; --fg: #e8edf4; --muted: #9aa6b6;
    --line: #2a3548; --ok: #4cc782; --warn: #f0a92b; --bad: #ff5d52; --idle: #8b97a8;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1320; --surface: #161e2c; --surface-2: #1d2738; --fg: #e8edf4; --muted: #9aa6b6;
  --line: #2a3548; --ok: #4cc782; --warn: #f0a92b; --bad: #ff5d52; --idle: #8b97a8;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 14px;
  overflow: hidden; position: relative;
}
#city { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
#tags { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- top bar */
.bar {
  position: absolute; top: env(safe-area-inset-top, 0px); left: 0; right: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: 12px 16px; pointer-events: none;
}
.bar > * { pointer-events: auto; }
.brand {
  display: flex; align-items: baseline; gap: 10px; background: var(--fg); color: var(--bg);
  padding: 6px 14px 7px; border-radius: 4px; box-shadow: var(--shadow);
}
.brand b { font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: .04em; text-transform: uppercase; line-height: 1; }
.brand span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.seg {
  display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 3px; box-shadow: var(--shadow);
}
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; font-weight: 600; font-size: 13px;
  color: var(--muted);
}
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.census {
  display: flex; flex-wrap: wrap; gap: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; box-shadow: var(--shadow); font-variant-numeric: tabular-nums;
}
.census span { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; padding-inline: 4px; }
.spacer { flex: 1; }
.btn {
  border: 1px solid var(--line); background: var(--surface); padding: 7px 12px; border-radius: 8px;
  font-weight: 600; font-size: 13px; box-shadow: var(--shadow); display: inline-flex; align-items: center; gap: 6px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: none; }
.btn.quiet { box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.s-running { --c: var(--ok); }
.s-idle { --c: var(--idle); }
.s-failed { --c: var(--bad); }
.s-missed { --c: var(--warn); }
.s-paused, .s-offline, .s-unknown { --c: var(--idle); }
.s-pending, .s-waiting { --c: var(--warn); }
.dot { background: var(--c, var(--idle)); }
.s-running .dot, .dot.s-running { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 30%, transparent); } }

/* ---------- name tags above buildings */
.tag {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -100%);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; pointer-events: auto; cursor: pointer;
  background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 9px 3px 7px; font-size: 12px; font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.tag small { font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.tag.sel { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.tag.sel small { color: inherit; opacity: .75; }
.tag.far { display: none !important; }
/* agent labels: hidden until hover or selection; failed and missed runs show a small pin */
.tag.agent { display: none; }
.tag.agent.show, .tag.agent.sel, .tag.agent.pin { display: inline-flex; }
.tag.agent.pin {
  width: 24px; height: 24px; padding: 0; justify-content: center; border-radius: 50%;
  background: var(--c); border: 2px solid #fff; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.tag.agent.pin > * { display: none; }
.tag.agent.pin::after { content: "!"; font-weight: 800; font-size: 14px; line-height: 1; }

/* ---------- side panel (permit card) */
.panel {
  position: absolute; z-index: 6; right: 16px; top: 76px; bottom: 16px; width: min(400px, calc(100% - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.panel header { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.eyebrow { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 30px; line-height: 1; letter-spacing: .01em; text-wrap: balance; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
}
.prov { width: 10px; height: 10px; border-radius: 3px; display: inline-block; background: var(--pc); }
.close { position: absolute; right: 12px; top: 12px; border: 0; background: transparent; font-size: 20px; line-height: 1; color: var(--muted); padding: 6px; }
.panel .body { padding: 14px 18px 18px; overflow-y: auto; display: grid; gap: 16px; align-content: start; }
.live {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-variant-numeric: tabular-nums;
}
.live strong { font-size: 15px; }
.live .sub { color: var(--muted); font-size: 12px; grid-column: 1 / -1; }
.history { display: flex; gap: 3px; align-items: center; }
.history i { width: 10px; height: 18px; border-radius: 2px; background: var(--ok); display: block; }
.history i.f { background: var(--bad); }
.history i.m { background: var(--warn); }
.readonly {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface)); border-radius: 8px; padding: 9px 12px;
  font-size: 13px; font-weight: 500;
}
form.setup { display: grid; gap: 12px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > label, .lbl { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; box-sizing: border-box; border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 8px 10px; font-size: 14px;
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.field .mono, .mono { font-family: var(--font-mono); font-size: 13px; }
.field .hint { font-size: 12px; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; }
.switch input { width: 40px; height: 22px; accent-color: var(--ok); }
input:disabled, select:disabled, textarea:disabled { opacity: .75; background: var(--surface-2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pipeline { display: grid; gap: 6px; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.pipeline div { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.pipeline div.done { color: var(--fg); }
.pipeline div::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); flex: none; box-sizing: border-box; }
.pipeline div.doing::before { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.pipeline div.done::before { background: var(--ok); border-color: var(--ok); }
@keyframes spin { to { transform: rotate(360deg); } }
.how { font-size: 12px; color: var(--muted); line-height: 1.5; }
.how b { color: var(--fg); font-weight: 600; }

/* ---------- list view */
.list {
  position: absolute; z-index: 4; left: 16px; right: 16px; top: 76px; bottom: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: auto;
}
.list table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.list th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.list td { padding: 10px 14px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.list tr[data-id] { cursor: pointer; }
.list tr[data-id]:hover td { background: var(--surface-2); }
.list .owner td { font-family: var(--font-display); font-weight: 800; font-size: 18px; letter-spacing: .02em; background: var(--surface-2); text-transform: uppercase; }

.drawer {
  position: absolute; z-index: 7; right: 16px; top: 76px; width: min(380px, calc(100% - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 16px 18px; display: grid; gap: 12px;
}
.drawer h3, .modal h3 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 24px; letter-spacing: .02em; text-transform: uppercase; }
.conn { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.conn small { grid-column: 2 / 4; color: var(--muted); font-size: 12px; }
.ok { color: var(--ok); font-weight: 600; font-size: 12px; }

/* ---------- billboard modal */
.scrim { position: absolute; inset: 0; z-index: 8; background: rgba(10, 14, 22, .45); display: grid; place-items: center; padding: 16px; }
.modal {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); width: min(720px, 100%); max-height: 100%;
  overflow: auto; display: grid; grid-template-columns: 1fr 1fr; position: relative;
}
.modal .art { background: var(--fg); color: var(--bg); padding: 22px; display: grid; gap: 14px; align-content: start; border-radius: 14px 0 0 14px; }
.modal .art canvas { width: 100%; height: auto; border-radius: 4px; display: block; background: #fff; }
.modal .art p { margin: 0; font-size: 13px; opacity: .8; line-height: 1.5; }
.modal form { padding: 22px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.slots { display: grid; gap: 6px; }
.slot { display: flex; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; cursor: pointer; }
.slot:has(input:checked) { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
.slot input { position: absolute; opacity: 0; pointer-events: none; }
.slot b { font-weight: 600; }
.slot span { color: var(--muted); font-variant-numeric: tabular-nums; }
.slot .taken { color: var(--bad); }
.weeks { display: flex; flex-wrap: wrap; gap: 6px; }
.weeks label { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 12px; cursor: pointer; font-variant-numeric: tabular-nums; }
.weeks label:has(input:checked) { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.weeks input { position: absolute; opacity: 0; pointer-events: none; }
.total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding-top: 10px; }
.total b { font-family: var(--font-display); font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fine { font-size: 12px; color: var(--muted); line-height: 1.45; }

.toast {
  position: absolute; z-index: 9; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-weight: 600; font-size: 13px; box-shadow: var(--shadow);
  max-width: calc(100% - 32px);
}
.loading { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 22px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.demo { font-size: 11px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; box-shadow: var(--shadow); }

@media (max-width: 720px) {
  .bar { gap: 8px; padding: 10px 12px; }
  .brand span, .demo { display: none; }
  .panel, .drawer { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 64%; border-radius: 14px 14px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .list { top: 116px; left: 12px; right: 12px; }
  .modal { grid-template-columns: 1fr; }
  .modal .art { border-radius: 14px 14px 0 0; }
  .row2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .s-running .dot, .dot.s-running, .pipeline div.doing::before { animation: none; }
}

/* ---------- real-app additions */
body { margin: 0; }
.btn.wide { width: 100%; justify-content: center; padding-block: 10px; }
a.btn { text-decoration: none; color: inherit; }
.s-paused { --c: var(--idle); }
.dot.s-paused { background: transparent; box-shadow: inset 0 0 0 2px var(--idle); }

.auth {
  position: absolute; z-index: 6; left: 16px; top: 76px; width: min(400px, calc(100% - 32px));
  max-height: calc(100% - 92px); overflow-y: auto; box-sizing: border-box;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 22px 22px 20px; display: grid; gap: 14px;
}
.auth h1 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 40px; line-height: .95; letter-spacing: .01em; text-transform: uppercase; text-wrap: balance; }
.auth .lede { margin: 0; color: var(--muted); line-height: 1.5; font-size: 14px; }
.auth form { display: grid; gap: 12px; }
.tabs { width: fit-content; box-shadow: none; }
.form-error { margin: 0; color: var(--bad); font-weight: 600; font-size: 13px; }
.auth-alt { margin: 0; font-size: 13px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; }
#code-actions:not([hidden]) { display: contents; }

.empty-card {
  position: absolute; z-index: 4; left: 50%; bottom: 24px; transform: translateX(-50%);
  width: min(460px, calc(100% - 32px)); box-sizing: border-box;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: center;
}
.empty-card span { color: var(--muted); font-size: 13px; grid-column: 1; }
.empty-card .btn { grid-column: 2; grid-row: 1 / 3; }

.drawer { max-height: calc(100% - 92px); overflow-y: auto; box-sizing: border-box; }
.drawer section { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.drawer h4 { margin: 0; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.drawer h4 .n { font-family: var(--font-display); font-weight: 800; font-size: 18px; width: 22px; height: 22px; border-radius: 50%; background: var(--fg); color: var(--bg); display: inline-grid; place-items: center; flex: none; }
.drawer p, .drawer li { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.drawer ol { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.drawer li b { color: var(--fg); font-weight: 600; }
.codebox {
  font-family: var(--font-mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; word-break: break-all; max-height: 160px; overflow: auto; margin: 0;
}
.copyrow { display: flex; gap: 6px; align-items: stretch; min-width: 0; }
.copyrow .codebox { flex: 1; min-width: 0; max-height: none; }
.copyrow .btn { box-shadow: none; flex: none; }
.statusline { font-size: 12px; font-weight: 600; display: flex; gap: 6px; align-items: center; color: var(--muted); }
.statusline.good { color: var(--ok); }
.statusline.bad { color: var(--bad); }
.warn { color: var(--warn); font-weight: 600; font-size: 12px; }
details summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.inline-confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.soon { display: flex; flex-wrap: wrap; gap: 6px; }

.pipeline div.failed { color: var(--bad); }
.pipeline div.failed::before { background: var(--bad); border-color: var(--bad); }
.list .empty-row td { color: var(--muted); font-style: italic; }
@media (max-width: 720px) {
  .auth { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 72%; border-radius: 14px 14px 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  .auth h1 { font-size: 32px; }
  .empty-card { grid-template-columns: 1fr; }
  .empty-card .btn { grid-column: 1; grid-row: auto; justify-self: start; }
}

/* ---------- blocks, connect hub */
.blocktag {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); pointer-events: auto; cursor: pointer;
  background: var(--fg); color: var(--bg); border: 0; border-radius: 6px; padding: 5px 11px 6px;
  font-family: var(--font-display); font-weight: 800; font-size: 17px; letter-spacing: .04em; text-transform: uppercase;
  white-space: nowrap; box-shadow: 0 3px 10px rgba(0,0,0,.18);
}
.blocktag.invite { background: var(--accent); color: var(--accent-ink); font-size: 15px; }
.blocktag.far { display: none; }
.tabs.wrap { flex-wrap: wrap; width: auto; }
.drawer .keybox { border-top: 0; padding-top: 0; }
.drawer .tabbody { border-top: 0; padding-top: 4px; }
.drawer h4 { margin: 0; }
.result { margin: 0; background: var(--surface-2); border-radius: 8px; padding: 9px 12px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
/* long URLs and code must wrap inside the drawers instead of widening them */
.drawer, .panel .body, .auth { grid-template-columns: minmax(0, 1fr); }
.drawer .mono, .drawer li, .drawer p { overflow-wrap: anywhere; }
.drawer { overflow-x: hidden; }

/* ---------- library */
.tag.library { background: #6b4a2b; color: #fff6e8; border-color: #6b4a2b; }
.tag.library small { color: #f3d9b6; }
.shelf { display: grid; gap: 6px; }
.shelf-row { display: grid; gap: 6px; text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; color: var(--fg); }
.shelf-row:hover { border-color: var(--fg); }
.shelf-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.chip small { color: var(--muted); font-weight: 500; }

/* ---------- connect: platform cards and self-ticking checklists */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.drawer .back { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; justify-self: start; }
.drawer .back:hover { color: var(--fg); }
.c-live { display: grid; gap: 12px; }
.pcards { display: grid; gap: 8px; }
.pcard {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 1px 12px; align-items: center; text-align: left;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--fg); font: inherit; cursor: pointer;
}
.pcard:hover, .pcard:focus-visible { border-color: var(--fg); }
.pcard .pmark { grid-row: 1 / 4; width: 34px; height: 34px; border-radius: 9px; background: var(--c); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.pcard .pname { font-weight: 700; font-size: 14px; }
.pcard .pwhat { grid-column: 2; font-size: 12px; color: var(--muted); }
.pcard .pstat { grid-column: 2; }
.pcard .chev { grid-column: 3; grid-row: 1 / 4; font-size: 22px; color: var(--muted); }
.pstat { display: flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
.pstat.good { color: var(--ok); } .pstat.warn { color: var(--warn); } .pstat.bad { color: var(--bad); }
.drawer ol.steps { list-style: none; padding: 0; gap: 16px; }
.steps > li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: start; }
.steps > li > div { display: grid; gap: 8px; min-width: 0; }
.steps .tick {
  width: 26px; height: 26px; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--line);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--muted);
}
.steps li.now .tick { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.steps li.done .tick { border-color: var(--ok); background: var(--ok); color: #fff; }
.steps b.t, .advanced b.t { color: var(--fg); font-size: 14px; line-height: 26px; }
.advanced b.t { line-height: 1.4; }
.steps li:not(.now):not(.done) > div > :not(b) { opacity: .75; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }
a.btn { color: inherit; text-decoration: none; }
a.btn.primary { color: var(--accent-ink); }
.waiting { display: flex; gap: 8px; align-items: center; font-size: 12px !important; font-weight: 600; }
.spinner { width: 12px; height: 12px; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; flex: none; }
.drawer details.advanced { border-top: 1px solid var(--line); padding-top: 10px; }
.advanced > div { display: grid; gap: 14px; margin-top: 12px; }
.advanced .opt, .advanced form { display: grid; gap: 6px; }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; border-top-color: var(--accent); opacity: .6; } }
.drawer p.ok { color: var(--ok); font-weight: 600; }
.drawer p.form-error { color: var(--bad); }
.reporters { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.drawer .reporters li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 13px; }
.drawer p.warn { color: var(--warn); }

/* ---------- Connect: one checklist per Mayor (each Grok bot), and browser alerts */
.botchecks { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
.botcheck { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; gap: 6px; background: var(--surface-2); }
.botcheck.quiet { border-color: var(--bad); }
.bc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bc-head b { font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.bc-head .star { color: #e2a400; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.checks .ck { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 6px; font-size: 12px; line-height: 1.4; }
.checks .ck-i { font-weight: 700; text-align: center; }
.checks .ok .ck-i { color: var(--ok); }
.checks .bad .ck-i, .checks .bad b { color: var(--bad); }
.checks .todo .ck-i { color: var(--muted); }
.botcheck details summary { font-size: 12px; cursor: pointer; color: var(--muted); }
.botcheck form.bell, .botcheck details > p { margin-top: 6px; }
.drawer .alerts { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; margin: 6px 0; }

/* ---------- Mayor tower and its office */
.tag.mayor { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.tag.mayor small { color: inherit; opacity: .7; }
.office-group { display: grid; gap: 4px; }
.office-head { display: flex; align-items: center; gap: 8px; padding: 6px 2px 2px; }
.office-head b { font-size: 13px; }
.office-head small { color: var(--muted); font-size: 12px; }
.office-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px 6px 10px; }
.office-row.s-paused { opacity: .7; }
.office-open { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; align-items: center; text-align: left;
  background: none; border: 0; padding: 2px 0; color: var(--fg); min-width: 0; }
.office-open .dot { grid-row: 1 / 3; }
.office-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.office-open small { grid-column: 2; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.office-open:hover .office-name { text-decoration: underline; }
.office-actions { display: flex; gap: 6px; align-items: center; }
.office-actions .btn { padding: 4px 10px; }
.office-actions .switch { padding: 0; }
.office-actions input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; margin: 0; width: 36px; height: 20px; border-radius: 999px; cursor: pointer;
  background: var(--line); position: relative; transition: background .15s;
}
.office-actions input[type="checkbox"]::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s;
}
.office-actions input[type="checkbox"]:checked { background: var(--ok); }
.office-actions input[type="checkbox"]:checked::before { transform: translateX(16px); }
.office-actions input[type="checkbox"]:disabled { opacity: .5; cursor: wait; }
@media (prefers-reduced-motion: reduce) { .office-actions input[type="checkbox"], .office-actions input[type="checkbox"]::before { transition: none; } }

/* ---------- billboard booking */
.modal .art .now { opacity: 1; background: rgba(255,255,255,.1); border-radius: 8px; padding: 8px 10px; }
.modal .art .now a { color: var(--accent); font-weight: 600; }
.bb-facts { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13px; line-height: 1.45; opacity: .85; }
.weeks label { display: inline-flex; gap: 6px; align-items: baseline; }
.weeks label.booked { opacity: .45; cursor: not-allowed; text-decoration: line-through; }
.weeks label small { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.drop {
  position: relative; display: grid; gap: 2px; border: 2px dashed var(--line); border-radius: 10px; padding: 12px 14px;
  cursor: pointer; background: var(--surface-2);
}
.drop:hover, .drop:focus-within { border-color: var(--fg); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop span { font-size: 12px; color: var(--muted); }
.field > label.drop { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--fg); font-weight: 400; }

/* ---------- what an agent does: instructions, connectors, skills */
.instructions {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 42vh; overflow-y: auto;
}
.field textarea.grow { min-height: 110px; max-height: 45vh; resize: vertical; }
/* A bot's own instructions: the first lines, with "Show all" for the rest. */
.instructions.bot-instructions { max-height: 220px; overflow: hidden; position: relative; }
.instructions.bot-instructions.open { max-height: none; overflow: visible; }
.chip.skill { cursor: pointer; color: var(--fg); background: var(--surface); border-color: var(--fg); }
.chip.skill span { color: var(--muted); font-size: 14px; line-height: 1; }
.chip.skill:hover { background: var(--fg); color: var(--bg); }
.chip.skill:hover span { color: var(--bg); }

/* ---------- skill view */
.back { justify-self: start; border: 0; background: none; color: var(--muted); font-weight: 600; padding: 0; cursor: pointer; }
.back:hover { color: var(--fg); }
.lede-sm { margin: 0; font-size: 14px; line-height: 1.5; }
.lbl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.seg.mini button { padding: 3px 9px; font-size: 12px; }
.skill-doc { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 14px 10px; font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; }
.skill-doc h3, .skill-doc h4, .skill-doc h5 { margin: 12px 0 4px; line-height: 1.25; }
.skill-doc h3 { font-size: 16px; } .skill-doc h4 { font-size: 14px; } .skill-doc h5 { font-size: 13px; color: var(--muted); }
.skill-doc p { margin: 8px 0; }
.skill-doc ul, .skill-doc ol { margin: 6px 0; padding-left: 20px; }
.skill-doc li { margin: 3px 0; }
.skill-doc code { font-family: var(--font-mono); font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.skill-doc pre { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; overflow-x: auto; }
.skill-doc pre code { border: 0; padding: 0; background: none; }
.skill-raw { margin: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-family: var(--font-mono); font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 52vh; overflow-y: auto; }
.field textarea.tall { min-height: 220px; font-family: var(--font-mono); font-size: 12px; }
.linkish { border: 0; background: none; padding: 0; color: var(--fg); text-decoration: underline; cursor: pointer; font-size: inherit; }
.skill-row { gap: 3px; }
.skill-row .sub { font-size: 12px; color: var(--muted); line-height: 1.4; }
.skill-row .count { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.book { width: 9px; height: 12px; border-radius: 1px 2px 2px 1px; background: #8a5a2b; box-shadow: inset 2px 0 0 rgba(0,0,0,.25); flex: none; }
.ask { display: grid; gap: 10px; }
.ask p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.ask-msg { margin: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow-y: auto; }
details.paste > summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 4px 0; }
details.paste[open] > summary { margin-bottom: 8px; }
.reporters em.old { color: var(--warn); font-style: normal; font-weight: 600; }

/* ---------- the Mayor's corner: the dock (web/mayor-chat.*) sits bottom left; nothing else covers it */
:root { --dock-clear: 104px; }   /* height kept free above the bottom edge on the left; mayor-chat.css may override */
.list { top: calc(var(--bar-h, 64px) + 12px); bottom: var(--dock-clear); }
.auth { max-height: calc(100% - 76px - var(--dock-clear)); }
.toast { max-width: min(640px, calc(100% - 2 * var(--dock-clear))); }

/* ---------- construction sites */
.tag.site { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tag.site small { color: inherit; opacity: .75; }
.tag.build { background: var(--fg); color: var(--bg); border-color: var(--fg); max-width: 220px; }
.tag.build .t-name { overflow: hidden; text-overflow: ellipsis; }
.tag.build small { color: inherit; opacity: .75; }
.pmark { width: 28px; height: 28px; border-radius: 8px; background: var(--c); color: #fff; display: inline-grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.pmark.sm { width: 20px; height: 20px; border-radius: 6px; font-size: 10px; }
.bplat { display: grid; gap: 10px; }
.bp { display: grid; gap: 6px; }
.bp-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.bk {
  display: grid; gap: 2px; text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; color: var(--fg); font: inherit; margin-left: 36px;
}
button.bk:hover, button.bk:focus-visible { border-color: var(--fg); }
.bk b { font-size: 13px; }
.bk span { font-size: 12px; color: var(--muted); line-height: 1.4; }
.bk small { font-size: 11px; font-weight: 600; color: var(--ok); }
.bk.off { background: transparent; border-style: dashed; }
.bk.off .btn { justify-self: start; margin-top: 4px; padding: 4px 10px; }
.bchosen { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--surface-2); border-radius: 8px; padding: 9px 11px; }
.bchosen > span:nth-child(2) { display: grid; gap: 1px; min-width: 0; }
.bchosen small { font-size: 12px; color: var(--muted); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600; color: var(--fg); }
.presets button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.presets + input { margin-top: 4px; }
.field select { appearance: auto; }
.b-status { display: grid; gap: 12px; }
.way-row .count { display: inline-flex; gap: 5px; align-items: center; }

/* ---------- what an automation does: summary and description at the top of its panel */
.about { display: grid; gap: 6px; }
.about .summary { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.4; text-wrap: pretty; }
.about .summary.none { font-weight: 500; color: var(--muted); font-size: 13.5px; }
.about .summary.pending { display: flex; gap: 8px; align-items: center; font-weight: 600; color: var(--muted); font-size: 13.5px; }
.about .desc { font-size: 13.5px; line-height: 1.55; color: var(--fg); overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.about .desc.open { display: block; }
.about .desc p, .about .desc ul, .about .desc ol { margin: 0 0 6px; }
.about .desc ul, .about .desc ol { padding-left: 18px; }
.about .more { justify-self: start; font-size: 12.5px; font-weight: 600; }
.about-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); align-items: center; }
.about-meta .linkish { font-size: 12px; font-weight: 600; }
.about-form textarea { min-height: 110px; }

/* ---------- Library: where each skill lives, how its pushes went, and the tools */
.places { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.panel header .places { margin-top: -2px; }
.pbadge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: var(--fg);
  padding: 1px 7px 1px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
}
.pbadge::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--c); }
.pushstat { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: var(--c); }
.tools { display: grid; gap: 10px; }
.tgroup { display: grid; gap: 6px; }
.tg-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.tg-head small { color: var(--muted); font-size: 12px; }
.toolchips { display: flex; flex-wrap: wrap; gap: 6px; }
.tool { display: grid; gap: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; min-width: 0; }
.tool b { font-size: 12.5px; font-weight: 600; overflow-wrap: anywhere; }
.tool small { font-size: 11px; color: var(--muted); }
.tool .warn { font-size: 11px; }

/* ---------- skill view: push to… */
.push-cta { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.tgroups { display: grid; gap: 12px; }
.trow {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer;
}
.trow input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--fg); }
.trow.off { cursor: default; background: transparent; border-style: dashed; }
.trow.manual { grid-template-columns: minmax(0, 1fr) auto; align-items: center; cursor: default; }
.trow .tl { display: grid; gap: 2px; min-width: 0; }
.trow .tl b { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.trow .sub, .trow .reason { font-size: 12px; color: var(--muted); line-height: 1.4; }
.trow .reason { color: var(--warn); font-weight: 600; }
.differs { color: var(--warn); font-weight: 600; }
.pushes { display: grid; gap: 8px; }
.push { display: grid; gap: 6px; }
.push > b { font-size: 13px; }
.linkout { font-size: 12.5px; font-weight: 600; color: var(--fg); justify-self: start; }

/* ---------- connect: API keys, computers */
.apisec { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.drawer .apisec h4 { font-size: 15px; }
.opt-tag { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; }
.switch.manage { align-items: flex-start; background: var(--surface-2); border-radius: 8px; padding: 9px 11px; cursor: pointer; }
.switch.manage > span { display: grid; gap: 2px; }
.switch.manage b { font-size: 13px; }
.switch.manage small { font-size: 12px; color: var(--muted); line-height: 1.45; font-weight: 400; }
.switch.manage input { flex: none; margin-top: 2px; }
.computers { display: grid; gap: 6px; }
.computer { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
.computer > .dot { margin-top: 6px; }
.computer-main { display: grid; gap: 4px; min-width: 0; }
.computer-main b { font-size: 13px; }
.computer-main small { font-size: 12px; color: var(--muted); }
.computer .btn { padding: 4px 10px; }
ul.plain { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.pcards-more { margin-top: 8px; }
.drawer .hint { font-size: 12px; color: var(--muted); }

@media (max-width: 720px) {
  .list { top: calc(var(--bar-h, 116px) + 6px); bottom: var(--dock-clear); }
  /* centred with insets, so long messages get the full width instead of the right half */
  .toast { bottom: calc(var(--dock-clear) + 4px); left: 16px; right: 16px; transform: none; width: fit-content; max-width: none; margin-inline: auto; box-sizing: border-box; }
  .empty-card { bottom: var(--dock-clear); }
  /* the demo sign-up card floats above the Mayor's corner instead of covering it */
  .auth { bottom: var(--dock-clear); left: 8px; right: 8px; border-radius: 14px; max-height: calc(100% - var(--bar-h, 116px) - 12px - var(--dock-clear)); padding-bottom: 20px; }
  .bk { margin-left: 0; }
  .trow { padding: 8px; }
}

/* ---------- Grok bots: one tower per bot, one floor per routine */
:root { --grok: #3a3d44; --grok-ink: #f4f6f8; --grok-ink-2: #c3c9d2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --grok: #4b505a; } }
:root[data-theme="dark"] { --grok: #4b505a; }
.tag.bot { background: var(--grok); color: var(--grok-ink); border-color: var(--grok); }
.tag.bot small { color: var(--grok-ink-2); }
.tag.bot .dot { box-shadow: 0 0 0 1.5px var(--grok-ink); }
.tag.bot.sel { box-shadow: 0 0 0 2px var(--accent), 0 2px 8px rgba(0, 0, 0, .2); }
.chip.primary { border-color: color-mix(in srgb, var(--accent) 65%, var(--line)); }
.chip .star { width: 12px; height: 12px; fill: var(--accent); flex: none; }
.inbot { margin: 0; font-size: 13px; color: var(--muted); }
.inbot .linkish { font-weight: 700; color: var(--fg); }
.office-head .office-bot { font-weight: 700; font-size: 13px; text-decoration: none; }
.office-head .office-bot:hover, .office-head .office-bot:focus-visible { text-decoration: underline; }
.office-group > .hint { font-size: 12px; color: var(--muted); padding: 2px 2px 4px; }
.rt-row.s-running [data-run] { display: none; }
.rt-row .office-actions .btn { white-space: nowrap; }
.rt-row .office-open small { white-space: normal; }
.list td .inbot-l { display: block; color: var(--muted); font-size: 12px; }

/* ---------- Settings → Your platforms: one platform's buildings, highlighted in the city, then its options */
.plat-buildings .lbl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.switch.inline { padding: 0; gap: 8px; font-size: 12px; color: var(--muted); }
.switch.inline input { width: 32px; height: 18px; }
.plat-buildings .shelf-row { display: grid; gap: 2px; text-align: left; }
.plat-buildings .shelf-row .shelf-name { display: flex; align-items: center; gap: 6px; }
.plat-buildings .shelf-row small { color: var(--muted); font-size: 12px; }
.drawer h4.opt-head { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.drawer .disconnected { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad); color: #fff; }
.spot-chip {
  position: fixed; left: 50%; top: 72px; transform: translateX(-50%); z-index: 6;
  display: inline-flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px);
  background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 6px 5px 8px; font-size: 13px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.14);
}
.spot-chip > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spot-chip .pmark { width: 20px; height: 20px; font-size: 10px; flex: none; }
.spot-chip .close-x { border: 0; background: transparent; font-size: 18px; line-height: 1; color: var(--muted); padding: 2px 6px; cursor: pointer; }
.tag.bot.spot { box-shadow: 0 0 0 2px #f2b632, 0 2px 8px rgba(0,0,0,.12); }
.spot-chip .pmark { border-radius: 6px; background: var(--c); color: #fff; display: grid; place-items: center; font-weight: 800; }
