/* =========================================================================
   Claysend · BRUTALIST MONO — component + layout styles
   Requires colors_and_type.css (tokens) linked first.
   Hard black borders · 0 radius · solid offset shadows · uppercase labels.
   ========================================================================= */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
#root { height: 100vh; overflow: hidden; }
::selection { background: var(--hi); color: var(--ink); }

/* scrollbars — square, stark */
*::-webkit-scrollbar { width: 12px; height: 12px; }
*::-webkit-scrollbar-thumb { background: var(--ink); border: 3px solid var(--surface); }
*::-webkit-scrollbar-track { background: var(--surface-3); }

h1,h2,h3,h4 { margin: 0; }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }

/* ---------- tiny utilities ---------- */
.row { display: flex; align-items: center; gap: var(--sp-2); }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { display: flex; align-items: center; justify-content: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.upper { text-transform: uppercase; letter-spacing: var(--ls-label); }
.mute { color: var(--ink-3); }
.faint { color: var(--mute); }

.eyebrow {
  font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 700;
  letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--ink-3);
}

/* =========================================================================
   APP SHELL
   ========================================================================= */
.app {
  display: grid; grid-template-columns: 256px 1fr; height: 100vh;
  background: var(--paper);
}
.side {
  background: var(--surface); border-right: var(--bw) solid var(--line);
  display: flex; flex-direction: column; height: 100vh; overflow: hidden;
}
.side-head { padding: var(--sp-4); border-bottom: var(--bw) solid var(--line); display: flex; align-items: center; gap: var(--sp-3); }
.brandmark {
  width: 34px; height: 34px; background: var(--ink); color: var(--surface);
  display: flex; align-items: center; justify-content: center; flex: none;
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  border: var(--bw) solid var(--ink); box-shadow: var(--shadow-sm);
}
.brandname { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: var(--ls-tight); text-transform: uppercase; }
.brandsub { font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }

.ws-switch {
  margin: var(--sp-3); padding: var(--sp-2) var(--sp-3); border: var(--bw) solid var(--line);
  display: flex; align-items: center; gap: var(--sp-2); cursor: pointer; background: var(--surface);
}
.ws-switch:hover { background: var(--hi); }
.ws-av { width: 26px; height: 26px; background: var(--accent); color: var(--on-accent); border: var(--bw) solid var(--ink);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex: none; }

.side-new { margin: 0 var(--sp-3) var(--sp-2); }

.nav { flex: 1; overflow-y: auto; padding: var(--sp-2) var(--sp-3) var(--sp-4); }
.nav-label {
  font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 700;
  letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--mute);
  padding: var(--sp-4) var(--sp-1) var(--sp-2); border-bottom: var(--bw-hair) solid var(--surface-3); margin-bottom: var(--sp-1);
}
.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-2); color: var(--ink-2); font-weight: 500;
  font-size: var(--fs-sm); cursor: pointer; border: var(--bw) solid transparent; user-select: none;
}
.nav-item .ico { color: var(--ink); flex: none; }
button.nav-item { background: transparent; }
.nav-item:hover { background: var(--surface-3); }
.nav-item.on { background: var(--ink); color: var(--surface); border-color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 700; }
.nav-item.on .ico { color: var(--surface); }
.nav-count {
  margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-micro); font-weight: 700;
  background: var(--surface); color: var(--ink); border: var(--bw-hair) solid var(--ink); padding: 0 6px; min-width: 22px; text-align: center;
}
.nav-item.on .nav-count { background: var(--hi); }
.nav-dot { margin-left: auto; width: 8px; height: 8px; background: var(--amber); border: var(--bw-hair) solid var(--ink); }
.nav-live { margin-left: auto; width: 8px; height: 8px; background: var(--green); border: var(--bw-hair) solid var(--ink); animation: blink 1.4s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

.side-foot { border-top: var(--bw) solid var(--line); padding: var(--sp-3); display: flex; align-items: center; gap: var(--sp-2); }

/* main column */
.main { display: flex; flex-direction: column; height: 100vh; overflow: hidden; min-width: 0; position: relative; }
.top {
  height: 56px; flex: none; border-bottom: var(--bw) solid var(--line);
  background: var(--surface); display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-5);
}
.crumb { display: flex; align-items: center; gap: var(--sp-2); font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.03em; }
.crumb .sep { color: var(--mute); }
.crumb .cur { color: var(--ink); font-weight: 700; }
.top-search {
  margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); height: 34px; padding: 0 var(--sp-3);
  border: var(--bw) solid var(--line); background: var(--surface); color: var(--mute);
  font-family: var(--font-mono); font-size: var(--fs-sm); min-width: 260px;
}
.kbd {
  font-family: var(--font-mono); font-size: var(--fs-micro); font-weight: 700; color: var(--ink);
  border: var(--bw-hair) solid var(--ink); padding: 1px 5px; background: var(--surface-2);
}

.view { flex: 1; overflow-y: auto; overflow-x: hidden; }
.pad { padding: var(--sp-6) var(--sp-8) 80px; max-width: 1360px; }

.page-head { display: flex; align-items: flex-end; gap: var(--sp-5); margin-bottom: var(--sp-5); }
.page-title { font-family: var(--font-display); font-size: var(--fs-h1); font-weight: 700; letter-spacing: var(--ls-tight); text-transform: uppercase; }
.page-sub { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--ink-3); margin-top: var(--sp-2); }

/* =========================================================================
   BUTTONS
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 36px; padding: 0 var(--sp-4); border: var(--bw) solid var(--ink); background: var(--surface); color: var(--ink);
  font-family: var(--font-display); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
  text-transform: uppercase; letter-spacing: 0.02em; box-shadow: var(--shadow-sm);
  transition: transform .08s, box-shadow .08s, background .08s;
}
.btn:hover { transform: translate(-1px,-1px); box-shadow: var(--shadow); background: var(--hi); }
.btn:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--ink); }
.btn .ico { flex: none; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-press); color: var(--on-accent); }
.btn.dark { background: var(--ink); color: var(--surface); }
.btn.dark:hover { background: var(--ink); color: var(--hi); }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.ghost { box-shadow: none; border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); transform: none; box-shadow: none; }
.btn.sm { height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-micro); }
.btn.lg { height: 42px; padding: 0 var(--sp-5); font-size: var(--fs-body); }
.btn.icon { width: 36px; padding: 0; }
.btn.icon.sm { width: 30px; }
.btn:disabled { opacity: .4; pointer-events: none; }

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border: var(--bw) solid transparent; background: transparent; color: var(--ink-2);
}
.iconbtn:hover { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* =========================================================================
   BADGES / TAGS / CHIPS
   ========================================================================= */
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1); height: 20px; padding: 0 6px;
  border: var(--bw-hair) solid var(--ink); background: var(--surface); color: var(--ink);
  font-family: var(--font-mono); font-size: var(--fs-micro); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; line-height: 1;
}
.badge .bdot { width: 7px; height: 7px; background: currentColor; }
.badge.solid { background: var(--ink); color: var(--surface); }
.badge.green { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); border-color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.badge.hi { background: var(--hi); color: var(--ink); border-color: var(--ink); }

.ai-tag {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px;
  border: var(--bw-hair) solid var(--ink); background: var(--hi); color: var(--ink);
  font-family: var(--font-mono); font-size: var(--fs-micro); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}

.chip {
  display: inline-flex; align-items: center; gap: var(--sp-2); height: 30px; padding: 0 var(--sp-3);
  border: var(--bw) solid var(--ink); background: var(--surface); color: var(--ink-2);
  font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.02em;
}
.chip:hover { background: var(--surface-3); }
.chip.on { background: var(--ink); color: var(--surface); box-shadow: var(--shadow-sm); }
.chip.dash { border-style: dashed; cursor: default; }
.chip.dash:hover { background: var(--surface); }

/* segmented control */
.seg { display: inline-flex; border: var(--bw) solid var(--ink); background: var(--surface); }
.seg button {
  border: 0; background: transparent; color: var(--ink-3); font-family: var(--font-display); font-size: var(--fs-sm);
  font-weight: 600; padding: 6px 14px; text-transform: uppercase; letter-spacing: 0.02em;
  border-right: var(--bw-hair) solid var(--ink);
}
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: var(--surface); }

/* tabs */
.tabs { display: flex; border-bottom: var(--bw) solid var(--ink); gap: 0; }
.tabs button {
  border: 0; background: transparent; padding: 10px 16px; font-family: var(--font-display); font-size: var(--fs-sm);
  font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.03em;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }

/* =========================================================================
   CARDS / PANELS
   ========================================================================= */
.card { background: var(--surface); border: var(--bw) solid var(--ink); box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card-pad { padding: var(--sp-5); }
.card-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-5); border-bottom: var(--bw) solid var(--ink); }
.card-title { font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 700; text-transform: uppercase; letter-spacing: var(--ls-tight); }
.divide-y > * + * { border-top: var(--bw-hair) solid var(--ink); }

/* labelled section block */
.block { border: var(--bw) solid var(--ink); background: var(--surface); }
.block-label {
  font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 700; letter-spacing: var(--ls-label);
  text-transform: uppercase; color: var(--surface); background: var(--ink); padding: 5px var(--sp-3);
  display: flex; align-items: center; gap: var(--sp-2);
}
/* empty state: a muted block, one operator-voice line, no illustration */
.empty-box {
  padding: var(--sp-3) var(--sp-4); background: var(--surface-2); border: var(--bw-hair) dashed var(--ink-3);
  font-family: var(--font-mono); font-size: var(--fs-data); line-height: 1.5; color: var(--ink-3); overflow-wrap: anywhere;
}

/* =========================================================================
   AVATARS / LOGO TILES
   ========================================================================= */
.avatar {
  width: 30px; height: 30px; flex: none; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 12px; font-weight: 700; color: var(--surface);
  background: var(--ink); border: var(--bw) solid var(--ink);
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }
.logo-tile {
  width: 30px; height: 30px; flex: none; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  border: var(--bw) solid var(--ink); background: var(--surface); color: var(--ink);
}

/* =========================================================================
   INPUTS
   ========================================================================= */
.input {
  height: 38px; padding: 0 var(--sp-3); border: var(--bw) solid var(--ink); background: var(--surface);
  color: var(--ink); font-family: var(--font-body); font-size: var(--fs-body); width: 100%;
}
.input::placeholder { color: var(--mute); }
.input:focus { outline: none; box-shadow: var(--shadow-sm); border-color: var(--accent); }
textarea.input { height: auto; padding: var(--sp-3); line-height: var(--lh-body); resize: vertical; }
.input.mono { font-family: var(--font-mono); }
.field-label { font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 700; letter-spacing: var(--ls-label);
  text-transform: uppercase; color: var(--ink-2); margin-bottom: var(--sp-2); display: block; }

/* checkbox — square, black fill on check */
.cbx { appearance: none; width: 18px; height: 18px; border: var(--bw) solid var(--ink); background: var(--surface);
  cursor: pointer; position: relative; flex: none; vertical-align: middle; }
.cbx:checked { background: var(--ink); }
.cbx:checked::after { content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px;
  border: solid var(--surface); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }

/* toggle — hard square knob */
.toggle { width: 44px; height: 24px; border: var(--bw) solid var(--ink); background: var(--surface); position: relative; cursor: pointer; flex: none; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: var(--ink); transition: left .12s; }
.toggle.on { background: var(--accent); }
.toggle.on::after { left: 24px; background: var(--surface); }

/* =========================================================================
   TABLES
   ========================================================================= */
.tbl-wrap { border: var(--bw) solid var(--ink); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
table.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--fs-sm); }
table.tbl thead th {
  position: sticky; top: 0; z-index: 2; background: var(--ink); color: var(--surface);
  font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-label); letter-spacing: var(--ls-label);
  text-transform: uppercase; text-align: left; padding: 0 var(--sp-3); height: 40px; white-space: nowrap;
  border-right: var(--bw-hair) solid var(--mute);
}
table.tbl thead th:last-child { border-right: 0; }
table.tbl thead th.ai { background: var(--accent); }
table.tbl tbody td {
  padding: var(--sp-2) var(--sp-3); height: 52px; border-bottom: var(--bw-hair) solid var(--ink);
  border-right: var(--bw-hair) solid var(--surface-3); color: var(--ink-2); vertical-align: middle;
}
table.tbl tbody td:last-child { border-right: 0; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover td { background: var(--surface-2); }
table.tbl tbody tr.sel td { background: var(--accent-soft); }
.td-strong { color: var(--ink); font-weight: 700; font-family: var(--font-display); }
.col-check { width: 44px; text-align: center; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.col-head-ai { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* add-column affordance */
table.tbl thead th.col-add { width: 56px; padding: 0; background: var(--surface-2); border-right: 0; }
.add-col-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; height: 40px; padding: 0 var(--sp-3); cursor: pointer;
  background: var(--surface-2); color: var(--ink); border: 0;
  font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-label);
  letter-spacing: var(--ls-label); text-transform: uppercase; white-space: nowrap;
}
.add-col-btn:hover { background: var(--hi); }
table.tbl tbody td.col-add-cell { background: var(--surface-2); border-right: 0; text-align: center; color: var(--mute); }
table.tbl tbody tr:hover td.col-add-cell { background: var(--surface-2); }
table.tbl tbody tr.sel td.col-add-cell { background: var(--surface-2); }

/* idle (added-but-not-run) column */
table.tbl thead th.col-idle { background: var(--ink-2); }
.col-head-idle { display: inline-flex; align-items: center; gap: 6px; }
.idle-tag { font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: .04em;
  padding: 1px 5px; border: var(--bw-hair) solid var(--surface); color: var(--surface); }
.idle-cell { display: flex; align-items: center; gap: 10px; min-height: 28px; }
.idle-dash { color: var(--mute); font-family: var(--font-mono); }
.cell-run { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; cursor: pointer; opacity: 0;
  background: var(--ink); color: var(--surface); border: var(--bw-hair) solid var(--ink);
  font-family: var(--font-mono); font-weight: 700; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; transition: none; }
table.tbl tbody td:hover .cell-run { opacity: 1; }
.cell-run:hover { background: var(--accent); border-color: var(--accent); }

/* context cell (merged enrichment) */
.ctx-cell { cursor: pointer; padding: 4px 5px; border: var(--bw-hair) solid transparent; user-select: none; }
.ctx-cell:hover { background: var(--hi); border-color: var(--ink); }
.ctx-line { display: flex; align-items: baseline; gap: 6px; font-size: 11.5px; line-height: 1.4; max-width: 230px; }
.ctx-line + .ctx-line { margin-top: 2px; }
.ctx-line b { color: var(--ink); font-weight: 700; white-space: nowrap; font-family: var(--font-display); }
.ctx-line .v { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-more { font-family: var(--font-mono); font-size: 9.5px; color: var(--mute); text-transform: uppercase; margin-top: 5px; display: flex; align-items: center; gap: 6px; }

/* context modal — signal list */
.sig-row { display: flex; gap: 11px; padding: 12px 2px; border-bottom: var(--bw-hair) solid var(--surface-3); }
.sig-row:last-child { border-bottom: 0; }
.sig-ico { width: 28px; height: 28px; border: var(--bw-hair) solid var(--ink); display: flex; align-items: center; justify-content: center; flex: none; background: var(--surface-2); }
.sig-add { display: flex; align-items: center; justify-content: center; gap: 7px; height: 40px; cursor: pointer; margin-top: 8px;
  border: var(--bw-hair) dashed var(--mute); color: var(--ink-3);
  font-family: var(--font-mono); font-weight: 700; font-size: 11px; text-transform: uppercase; }
.sig-add:hover { background: var(--hi); border-color: var(--ink); color: var(--ink); }

/* email sequence rail (multi-email management) */
.seq-rail { width: 220px; border-right: var(--bw) solid var(--ink); background: var(--surface-2); overflow-y: auto; display: flex; flex-direction: column; }
.seq-item { padding: 12px 14px; border-bottom: var(--bw-hair) solid var(--ink); cursor: pointer; }
.seq-item:hover { background: var(--surface); }
.seq-item.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.seq-step { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--ink); display: flex; align-items: center; gap: 7px; }
.seq-when { font-family: var(--font-mono); font-size: 9.5px; color: var(--mute); text-transform: uppercase; margin-top: 3px; }
.seq-subj { font-size: 12px; color: var(--ink-2); margin-top: 6px; line-height: 1.35; }
.seq-add { display: flex; align-items: center; justify-content: center; gap: 7px; height: 44px; cursor: pointer; margin-top: auto;
  border-top: var(--bw-hair) dashed var(--mute); color: var(--ink-3);
  font-family: var(--font-mono); font-weight: 700; font-size: 10.5px; text-transform: uppercase; }
.seq-add:hover { background: var(--hi); color: var(--ink); }

/* platform pills (channel selector — email live, others roadmap) */
.plat-pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; cursor: pointer;
  border: var(--bw-hair) solid var(--ink); background: var(--surface);
  font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--ink); white-space: nowrap; }
.plat-pill.on { background: var(--ink); color: var(--surface); }
.plat-pill.soon { opacity: .45; cursor: not-allowed; }
.plat-pill.soon::after { content: 'SOON'; font-size: 8px; opacity: .8; }

/* clickable channel cell (run → value → open recommendations) */
.ch-cell { display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 4px 6px; border: var(--bw-hair) solid transparent; }
.ch-cell:hover { background: var(--hi); border-color: var(--ink); }
.ch-arrow { color: var(--mute); margin-left: auto; flex: none; opacity: 0; }
.ch-cell:hover .ch-arrow { opacity: 1; color: var(--ink); }

/* fresh / NEW marker */
.fresh-tag { font-family: var(--font-mono); font-size: 8.5px; font-weight: 700; letter-spacing: .06em;
  padding: 1px 5px; background: var(--green); color: var(--surface); border: var(--bw-hair) solid var(--green); }

/* recommendation card (channel modal) */
.rec-card { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border: var(--bw-hair) solid var(--ink); background: var(--surface); }
.rec-card:hover { background: var(--surface-2); }
.rec-ico { width: 30px; height: 30px; border: var(--bw-hair) solid var(--ink); display: flex; align-items: center; justify-content: center; flex: none; background: var(--surface-2); color: var(--ink); }

/* clickable breadcrumb segment */
.crumb-link { cursor: pointer; }
.crumb-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ===== Leads 库 (shared pool) ===== */
.pool-bar { display: flex; align-items: center; gap: 20px; padding: 14px 18px; border: var(--bw) solid var(--ink);
  background: var(--surface); box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.pool-stat { display: flex; flex-direction: column; gap: 1px; }
.pool-num { font-family: var(--font-display); font-weight: 700; font-size: 24px; line-height: 1; color: var(--ink); }
.pool-lbl { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--mute); }
.pool-div { width: var(--bw-hair); height: 30px; background: var(--surface-3); flex: none; }
.usage-chip { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  text-transform: none; color: var(--ink-2); background: var(--surface-2); border: var(--bw-hair) solid var(--ink); padding: 2px 6px; white-space: nowrap; }

/* ===== Google 搜索广告 ===== */
.ads-toggle { width: 24px; height: 24px; border: var(--bw-hair) solid var(--ink); background: var(--surface); flex: none; }
.ads-toggle:hover { background: var(--hi); }
.kind-chip { font-family: var(--font-mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--ink-2); background: var(--surface-2); border: var(--bw-hair) solid var(--ink); padding: 1px 6px; white-space: nowrap; flex: none; }
.pace-bar { display: block; width: 100%; height: 5px; background: var(--surface-3); border: var(--bw-hair) solid var(--ink); }
.pace-bar > span { display: block; height: 100%; }
.mt-chip { font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; padding: 1px 5px; border: var(--bw-hair) solid var(--ink); white-space: nowrap; }
.mt-chip.green { color: var(--green); } .mt-chip.accent { color: var(--accent); } .mt-chip.amber { color: var(--amber); }
.qs-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 20px; padding: 0 6px;
  border: var(--bw) solid; font-family: var(--font-mono); font-weight: 700; font-size: 11px; }
.str-meter { display: inline-block; width: 46px; height: 5px; background: var(--surface-3); border: var(--bw-hair) solid var(--ink); flex: none; }
.str-meter > span { display: block; height: 100%; }
.grp-row { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: var(--bw-hair) solid var(--ink); background: var(--surface); }
.grp-row:hover { background: var(--surface-2); }
.grp-ic { width: 28px; height: 28px; flex: none; display: flex; align-items: center; justify-content: center; border: var(--bw-hair) solid var(--ink); background: var(--surface-2); }
.kw-count { font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--ink-2); background: var(--surface-2); border: var(--bw-hair) solid var(--ink); padding: 2px 7px; flex: none; }
.rsa-line { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: var(--bw-hair) solid var(--ink); background: var(--surface); font-size: 13px; color: var(--ink); }
.rsa-num { font-size: 10px; color: var(--mute); flex: none; }
.rsa-len { font-size: 10px; color: var(--mute); flex: none; }
.rsa-preview { border: var(--bw) solid var(--ink); background: var(--surface); padding: 11px 12px; }
.rsa-ad { font-family: var(--font-mono); font-size: 9px; font-weight: 700; color: var(--ink); border: var(--bw-hair) solid var(--ink); padding: 0 4px; }
.rsa-prev-title { color: #1a0dab; font-size: 14px; font-weight: 600; line-height: 1.3; margin: 6px 0 3px; }
.rsa-prev-desc { color: var(--ink-2); font-size: 11.5px; line-height: 1.5; }
.wiz-steps { display: flex; border-bottom: var(--bw) solid var(--ink); }
.wiz-step { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 8px; cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: 12px; color: var(--ink-3); border-right: var(--bw-hair) solid var(--surface-3); }
.wiz-step:last-child { border-right: 0; }
.wiz-step.on { background: var(--surface-2); color: var(--ink); }
.wiz-step.done { color: var(--green); }
.wiz-num { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; font-size: 10px; font-weight: 700;
  border: var(--bw-hair) solid currentColor; }
.seg-row { display: flex; border-bottom: var(--bw) solid var(--ink); }
.seg-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 8px; border: 0; cursor: pointer; white-space: nowrap;
  background: var(--surface); color: var(--ink-3); font-family: var(--font-display); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .02em;
  border-right: var(--bw-hair) solid var(--surface-3); border-bottom: 3px solid transparent; }
.seg-btn .ico { flex: none; }
.seg-btn:last-child { border-right: 0; }
.seg-btn:hover { background: var(--surface-2); color: var(--ink); }
.seg-btn.on { background: var(--surface-2); color: var(--ink); border-bottom-color: var(--accent); }
.imp-row { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: var(--bw-hair) solid var(--ink); background: var(--surface); cursor: pointer; }
.imp-row:hover { background: var(--surface-2); }
.imp-row.on { box-shadow: inset 0 0 0 var(--bw) var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ===== in-workspace tab bar (view switcher) ===== */
.ws-shell { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ws-tabbar { flex: none; display: flex; align-items: stretch; height: 48px; background: var(--surface); border-bottom: var(--bw) solid var(--ink); }
.ws-tabbar-id { display: flex; align-items: center; gap: 9px; padding: 0 18px; border-right: var(--bw) solid var(--ink); flex: none; }
.ws-tabs { display: flex; align-items: stretch; overflow-x: auto; }
.ws-tab { display: inline-flex; align-items: center; gap: 7px; padding: 0 16px; border: 0; background: transparent; cursor: pointer; white-space: nowrap;
  font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .02em;
  border-right: var(--bw-hair) solid var(--surface-3); border-bottom: 3px solid transparent; }
.ws-tab:hover { color: var(--ink); background: var(--surface-2); }
.ws-tab.on { color: var(--ink); background: var(--surface-2); border-bottom-color: var(--accent); }
.ws-tab-count { font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; background: var(--ink); color: var(--surface); padding: 1px 5px; }
.ws-tab.on .ws-tab-count { background: var(--accent); }
.ws-tab-dot { width: 7px; height: 7px; background: var(--amber); border: var(--bw-hair) solid var(--ink); }
.ws-views { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ===== workspace hub ===== */
.ws-ic { width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center;
  border: var(--bw) solid var(--ink); background: var(--hi); color: var(--ink); }
.hairline { height: var(--bw-hair); background: var(--surface-3); }
.dotsep { width: 3px; height: 3px; background: var(--mute); border-radius: 50%; }
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(282px, 1fr)); gap: 14px; }
.ws-card { border: var(--bw) solid var(--ink); background: var(--surface); box-shadow: var(--shadow-sm); padding: 14px 15px; cursor: pointer; display: flex; flex-direction: column; gap: 12px; }
.ws-card:hover { box-shadow: var(--shadow); transform: translate(-1px, -1px); }
.ws-card-meta { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); text-transform: uppercase; }
.ws-card-meta b { color: var(--ink); }
.ws-card-foot { display: flex; align-items: center; gap: 8px; padding-top: 11px; border-top: var(--bw-hair) solid var(--surface-3); }
.ws-go { color: var(--mute); flex: none; }
.ws-card:hover .ws-go { color: var(--ink); }
.ws-card.new { align-items: center; justify-content: center; flex-direction: column; gap: 0; border-style: dashed; border-color: var(--mute); color: var(--ink-3); background: var(--surface-2); box-shadow: none; min-height: 132px; }
.ws-card.new:hover { background: var(--hi); border-color: var(--ink); color: var(--ink); transform: none; box-shadow: none; }
/* agent card — quiet footer: blue lives only on the left spine + this arrow (on hover) */
.ws-card--agent .ws-agent-arrow { color: var(--ink); transition: color .12s; }
.ws-card--agent:hover .ws-agent-arrow { color: var(--accent); }
.ws-agent-dot.flash { animation: ws-agent-blink 1.1s ease-in-out infinite; }
@keyframes ws-agent-blink { 0%, 100% { opacity: 1; } 50% { opacity: .28; } }
/* small square icon buttons for block edit/delete (long-term memory) */
.a-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: none; border: var(--bw-hair) solid var(--ink); background: var(--surface); color: var(--mute); cursor: pointer; transition: color .12s, background .12s, border-color .12s; }
.a-iconbtn:hover { color: var(--ink); background: var(--hi); }
.a-trash:hover { color: var(--red, #d3413e); border-color: var(--red, #d3413e); background: var(--surface); }
/* icon buttons that live in a Block's black .block-label bar (brand-voice style) */
.a-headicon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex: none; background: transparent; border: none; color: var(--paper); cursor: pointer; opacity: 0.7; transition: opacity .12s, color .12s; }
.a-headicon:hover { opacity: 1; }
.a-headicon.del:hover { color: #ff7b78; opacity: 1; }
/* mono toggle (task cards): square track, square knob — brutalist, no pills */
.a-switch { position: relative; width: 34px; height: 18px; border: var(--bw-hair) solid var(--ink); background: var(--surface-2); display: inline-block; flex: none; box-sizing: border-box; }
.a-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; background: var(--mute); transition: left .12s steps(3), background .12s; }
.a-switch.on { background: var(--hi); }
.a-switch.on::after { left: 18px; background: var(--ink); }

/* template picker */
.tmpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tmpl-card { border: var(--bw) solid var(--ink); background: var(--surface); padding: 14px; cursor: pointer; }
.tmpl-card:hover { background: var(--surface-2); }
.tmpl-card.on { box-shadow: inset 0 0 0 var(--bw) var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.tmpl-flow { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 16px; padding: 12px 14px; border: var(--bw-hair) solid var(--ink); background: var(--surface-2); }
.flow-step { font-family: var(--font-mono); font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--ink); background: var(--surface); border: var(--bw-hair) solid var(--ink); padding: 3px 8px; white-space: nowrap; }

/* ===== SEO workspace ===== */
.seo-score { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 22px; padding: 0 6px;
  border: var(--bw) solid; font-family: var(--font-mono); font-weight: 700; font-size: 12px; }
.seo-kd { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-weight: 700; font-size: 13px; }
.seo-kd-bar { display: inline-block; width: 42px; height: 5px; background: var(--surface-3); border: var(--bw-hair) solid var(--ink); }
.seo-kd-bar > span { display: block; height: 100%; }

/* enrichment cell states */
.cell-val { color: var(--ink); }
.cell-loading { display: inline-flex; align-items: center; gap: 7px; color: var(--accent); font-family: var(--font-mono); font-size: var(--fs-data); }
.shimmer { display: inline-block; height: 12px; width: 110px; border: var(--bw-hair) solid var(--ink);
  background: repeating-linear-gradient(45deg, var(--accent-soft) 0 6px, var(--surface) 6px 12px);
  background-size: 200% 100%; animation: march 0.8s linear infinite; }
@keyframes march { to { background-position: 34px 0; } }
.cell-queued { color: var(--mute); font-family: var(--font-mono); font-size: var(--fs-data); display: inline-flex; align-items: center; gap: 6px; text-transform: uppercase; }
.cell-err { color: var(--red); display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: var(--fs-data); }
.spin { animation: spin .9s steps(8) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* AI-merged fragment highlight */
.merge { background: var(--hi); color: var(--ink); padding: 0 3px; font-weight: 700; box-shadow: inset 0 -3px 0 var(--ink); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.merge.accent { background: var(--accent); color: var(--on-accent); box-shadow: none; }

/* draft cell (workspace "first email" column) — double-click to expand */
.draft-cell { cursor: pointer; padding: 4px 5px; border: var(--bw-hair) solid transparent; user-select: none; }
.draft-cell:hover { background: var(--hi); border-color: var(--ink); }
.draft-subj { font-family: var(--font-display); font-weight: 700; font-size: 12px; color: var(--ink); display: flex; align-items: center; gap: 5px; }
.draft-prev { font-size: 11px; color: var(--ink-3); line-height: 1.4; margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.draft-meta { font-family: var(--font-mono); font-size: 9.5px; color: var(--mute); text-transform: uppercase; margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.draft-expand { margin-left: auto; opacity: 0; }
.draft-cell:hover .draft-expand { opacity: 1; }

/* centered modal (expanded cell) */
.modal-scrim { position: fixed; inset: 0; background: rgba(10,10,10,.42); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 36px; }
.modal { width: 820px; max-width: 100%; max-height: 86%; background: var(--surface); border: var(--bw) solid var(--ink); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: pop .14s ease; }
@keyframes pop { from { transform: translateY(8px); } }
.modal-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: var(--bw) solid var(--ink); }
.modal-body { flex: 1; overflow-y: auto; }
.modal-foot { padding: var(--sp-3) var(--sp-5); border-top: var(--bw) solid var(--ink); display: flex; gap: var(--sp-2); align-items: center; }

/* annotated draft line */
.dline { display: flex; gap: var(--sp-3); padding: 7px 0; }
.dline .rolecol { width: 100px; flex: none; padding-top: 2px; }
.dline .txt { font-size: 13.5px; line-height: var(--lh-body); flex: 1; }

/* =========================================================================
   KPI / METRICS
   ========================================================================= */
.kpi-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 0; border: var(--bw) solid var(--ink); box-shadow: var(--shadow); background: var(--surface); }
.kpi { padding: var(--sp-4) var(--sp-4); border-right: var(--bw) solid var(--ink); }
.kpi:last-child { border-right: 0; }
.kpi-label { font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 700; letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--ink-3); }
.kpi-num { font-family: var(--font-display); font-size: var(--fs-mega); font-weight: 700; letter-spacing: -0.03em; line-height: 1; margin-top: var(--sp-3); display: flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.kpi-num .unit { font-size: 18px; color: var(--ink-3); }
.kpi-delta { font-family: var(--font-mono); font-size: var(--fs-data); font-weight: 700; margin-top: var(--sp-2); display: inline-flex; align-items: center; gap: 4px; }
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }
.spark-bars { display: flex; align-items: flex-end; gap: 3px; height: 32px; margin-top: var(--sp-3); }
.spark-bars i { flex: 1; background: var(--surface-3); border: var(--bw-hair) solid var(--ink); border-bottom: 0; min-height: 3px; }
.spark-bars i.last { background: var(--accent); }

/* progress / warm bar */
.bar { height: 14px; border: var(--bw) solid var(--ink); background: var(--surface); overflow: hidden; }
.bar > i { display: block; height: 100%; background: repeating-linear-gradient(45deg, var(--ink) 0 4px, transparent 4px 8px), var(--accent); border-right: var(--bw) solid var(--ink); }

/* funnel */
.funnel { display: flex; flex-direction: column; gap: var(--sp-2); }
.funnel .lvl { height: 38px; border: var(--bw) solid var(--ink); display: flex; align-items: center; padding: 0 var(--sp-3);
  font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 700; color: var(--ink); background: var(--surface); white-space: nowrap; }
.funnel .lvl.a1 { background: var(--accent-soft); }
.funnel .lvl.a2 { background: var(--hi); }
.funnel .lvl.a3 { background: var(--accent); color: var(--on-accent); }

/* =========================================================================
   DRAWER / OVERLAY
   ========================================================================= */
.scrim { position: absolute; inset: 0; background: rgba(10,10,10,.35); z-index: 30; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 480px; max-width: 94%;
  background: var(--surface); border-left: var(--bw) solid var(--ink); z-index: 31;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slidein .16s ease;
}
@keyframes slidein { from { transform: translateX(20px); } }
.drawer-head { padding: var(--sp-4) var(--sp-5); border-bottom: var(--bw) solid var(--ink); display: flex; align-items: center; gap: var(--sp-3); }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--sp-5); }
.drawer-foot { padding: var(--sp-3) var(--sp-5); border-top: var(--bw) solid var(--ink); display: flex; gap: var(--sp-2); align-items: center; }

/* floating batch toolbar */
.batchbar {
  position: absolute; left: 50%; bottom: var(--sp-6); transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-4);
  background: var(--ink); color: var(--surface); border: var(--bw) solid var(--ink); box-shadow: var(--shadow-lg); z-index: 20;
}
.batchbar .count { font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-sm); text-transform: uppercase; }
.batchbar .b { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; background: transparent; color: var(--surface); white-space: nowrap;
  border: var(--bw-hair) solid var(--surface); font-family: var(--font-display); font-size: var(--fs-sm); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; cursor: pointer; }
.batchbar .b:hover { background: var(--surface); color: var(--ink); }
.batchbar .b.go { background: var(--accent); border-color: var(--accent); }
.batchbar .b.go:hover { background: var(--hi); color: var(--ink); border-color: var(--hi); }
.batchbar .sep { width: var(--bw); height: 22px; background: var(--mute); }
.batchbar .x { color: var(--surface); cursor: pointer; display: inline-flex; }

/* timeline (sequence steps) */
.tl { position: relative; padding-left: 40px; }
.tl::before { content: ""; position: absolute; left: 17px; top: 6px; bottom: 24px; width: var(--bw); background: var(--ink); }
.tl-node { position: relative; margin-bottom: var(--sp-4); }
.tl-dot { position: absolute; left: -40px; top: 0; width: 34px; height: 34px; background: var(--surface);
  border: var(--bw) solid var(--ink); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-data); z-index: 1; box-shadow: var(--shadow-sm); }
.tl-dot.accent { background: var(--accent); color: var(--on-accent); }
.tl-dot.hi { background: var(--hi); }

/* email body */
.email-body { font-family: var(--font-body); font-size: var(--fs-body); line-height: var(--lh-body); color: var(--ink-2); }
.email-body p { margin: 0 0 var(--sp-3); }

/* live dot (for "running" status) */
.live-dot { width: 9px; height: 9px; background: var(--green); border: var(--bw-hair) solid var(--ink); animation: blink 1.4s steps(1) infinite; }

/* dropzone */
.dropzone { border: var(--bw) dashed var(--ink); background: var(--surface-2); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: var(--sp-2); padding: var(--sp-8); text-align: center; color: var(--ink-3); }
.dropzone:hover { background: var(--hi); color: var(--ink); }

/* =========================================================================
   PROJECT SCREEN — chat thread, composer, products rail
   (screen-project.jsx + chat-render.jsx)
   ========================================================================= */
.proj { flex: 1; min-height: 0; display: flex; background: var(--paper); }
.proj-main { flex: 1; min-width: 0; overflow-y: auto; }
.proj-ph { padding: var(--sp-4); gap: var(--sp-3); }
.err-line { font-family: var(--font-mono); font-size: var(--fs-data); color: var(--red); overflow-wrap: anywhere; }

.chat { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
.chat.compact { flex: none; width: 400px; border-left: var(--bw) solid var(--line); }
.chat-head { flex: none; display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-3) var(--sp-5); border-bottom: var(--bw) solid var(--line); }
.chat-name { font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 700; text-transform: uppercase; letter-spacing: var(--ls-tight); }
.chat-goal { font-size: var(--fs-sm); color: var(--ink-2); }
.chat-owner { font-size: var(--fs-micro); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.chat-err { padding: var(--sp-1) var(--sp-5); border-bottom: var(--bw-hair) solid var(--ink); }

.thread { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; padding: var(--sp-3) var(--sp-5) var(--sp-4); background: var(--paper); }
.day { display: flex; align-items: center; gap: var(--sp-3); margin: var(--sp-4) 0 var(--sp-1); font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 700; letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--ink-3); }
.day::before, .day::after { content: ""; flex: 1; height: var(--bw-hair); background: var(--ink-3); }
.m { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; margin-top: var(--sp-2); padding: var(--sp-2) var(--sp-3); background: var(--surface); border: var(--bw-hair) solid var(--ink); border-left-width: 3px; }
.m.person { border-left-color: var(--hi); }
.m.agent { border-left-color: var(--accent); }
.m.cont { margin-top: 0; border-top: 0; }
.m.running { background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(0,0,0,.06) 6px 12px), var(--surface); }
.hatch { background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(0,0,0,.06) 6px 12px); }
.m-head { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.m.agent .m-head .avatar { background: var(--accent); border-color: var(--accent); }
.m-name { font-size: var(--fs-sm); font-weight: 700; }
.m-time { flex: none; font-size: var(--fs-micro); color: var(--mute); }
.m-body { font-size: var(--fs-body); line-height: var(--lh-body); color: var(--ink); overflow-wrap: anywhere; }
.m-atts { display: flex; flex-direction: column; gap: var(--sp-1); }
.sys { align-self: center; max-width: 100%; margin: var(--sp-2) 0; font-family: var(--font-mono); font-size: var(--fs-data); color: var(--mute); text-align: center; overflow-wrap: anywhere; }
.sys.older { background: transparent; border: var(--bw-hair) dashed var(--mute); padding: 2px var(--sp-2); }
.sys.older:hover { color: var(--ink); border-color: var(--ink); }
.mention { display: inline-block; padding: 0 4px; background: var(--accent-soft); color: var(--accent); border: var(--bw-hair) solid var(--accent); font-weight: 700; }

.pc { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; padding: var(--sp-1) var(--sp-2); background: var(--surface-2); color: var(--ink); border: var(--bw-hair) solid var(--ink); }
.pc:hover { background: var(--hi); }
.pc-name { flex: none; max-width: 55%; font-size: var(--fs-sm); font-weight: 700; }
.pc-pre { flex: 1; min-width: 0; font-size: var(--fs-micro); }

.steps { align-self: flex-start; display: inline-flex; align-items: center; gap: var(--sp-2); padding: 2px var(--sp-2); background: var(--surface); color: var(--ink); border: var(--bw-hair) solid var(--ink); font-size: var(--fs-micro); font-weight: 700; }
.steps:hover, .steps.on { background: var(--ink); color: var(--surface); }
.stepbox { max-height: 360px; overflow-y: auto; background: var(--surface); border: var(--bw) solid var(--ink); font-size: var(--fs-sm); }
.stepbox .step { min-width: 0; padding: var(--sp-1) var(--sp-2); border-bottom: var(--bw-hair) solid var(--surface-3); overflow-wrap: anywhere; }
.stepbox .step.cop-toolrow { margin: 0; border: 0; border-bottom: var(--bw-hair) solid var(--surface-3); background: transparent; }
.step.cli { font-size: var(--fs-data); font-weight: 700; color: var(--ink); white-space: pre-wrap; }
.step.result { font-size: var(--fs-micro); color: var(--ink-3); white-space: pre-wrap; }
.step.result.more { cursor: pointer; }
.step.result.more:hover { background: var(--surface-2); }
.step.err { color: var(--red); }
.frame { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-micro); }
.frame img { display: block; width: 160px; border: var(--bw-hair) solid var(--ink); cursor: zoom-in; }
.frame .truncate { max-width: 320px; }
.frame-ph { width: 160px; height: 100px; display: flex; align-items: center; justify-content: center; border: var(--bw-hair) dashed var(--ink); }
.frame-big .modal-body img { display: block; width: 100%; height: auto; }

.approve { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); background: var(--surface); border: var(--bw) solid var(--ink); box-shadow: var(--shadow-sm); }
.approve.pending { box-shadow: var(--shadow); }
.approve-sum { font-size: var(--fs-sm); font-weight: 700; overflow-wrap: anywhere; }
.approve-ev { margin: 0; max-height: 200px; overflow: auto; padding: var(--sp-2); background: var(--surface-2); border: var(--bw-hair) solid var(--ink); font-family: var(--font-mono); font-size: var(--fs-micro); white-space: pre-wrap; overflow-wrap: anywhere; }
.approve-reason { gap: var(--sp-2); }
.approve-st { font-size: var(--fs-data); font-weight: 700; color: var(--ink-3); text-transform: uppercase; }
.approve.approved .approve-st { color: var(--green); }
.approve.rejected .approve-st { color: var(--red); text-transform: none; }

.composer { position: relative; flex: none; display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); background: var(--surface); border-top: var(--bw) solid var(--line); }
.composer.drag { background: var(--hi); }
.composer-row { display: flex; align-items: flex-end; gap: var(--sp-2); }
.composer-row .iconbtn:disabled { opacity: .4; }
.composer textarea.input { flex: 1; min-width: 0; resize: none; padding: var(--sp-2); max-height: calc(6 * var(--lh-body) * 1em + 2 * var(--sp-2) + 2 * var(--bw)); overflow-y: auto; }
.composer-atts { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.chip-x { padding: 0 0 0 var(--sp-1); background: transparent; border: 0; color: inherit; font-weight: 700; }

.pop { position: absolute; left: var(--sp-3); bottom: 100%; z-index: 20; width: 300px; max-width: calc(100% - 2 * var(--sp-3)); max-height: 260px; overflow-y: auto; margin-bottom: var(--sp-1); background: var(--surface); border: var(--bw) solid var(--ink); box-shadow: var(--shadow); }
.pop-item { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2); font-size: var(--fs-sm); cursor: pointer; border-bottom: var(--bw-hair) solid var(--surface-3); }
.pop-item.on, .pop-item:hover { background: var(--hi); }
.pop-item.off { color: var(--mute); }
.pop-item.off .avatar { background: var(--mute); border-color: var(--mute); }

.rail { flex: none; width: 360px; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border-left: var(--bw) solid var(--line); }
.rail-head { flex: none; padding: var(--sp-3) var(--sp-4); border-bottom: var(--bw) solid var(--line); }
.rail-list { flex: 1; min-height: 0; overflow-y: auto; }
.rail-empty { margin: var(--sp-4); }
.thread-empty { align-self: stretch; margin: var(--sp-4) 0; text-align: center; }
.prod { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; padding: var(--sp-2) var(--sp-4); color: var(--ink); border-bottom: var(--bw-hair) solid var(--surface-3); }
.prod:hover { background: var(--hi); }
.prod-txt { gap: 2px; }
.prod-name { font-size: var(--fs-sm); font-weight: 700; }
.prod-time { font-size: var(--fs-micro); }
.av-dot { position: relative; flex: none; display: inline-flex; }
.av-dot .nav-live { position: absolute; right: -3px; bottom: -3px; margin: 0; }
.av-dot.off .avatar { background: var(--mute); border-color: var(--mute); }
.rail-foot { position: relative; flex: none; display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-top: var(--bw) solid var(--line); }
.rail-owner { font-size: var(--fs-micro); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.rail-people { flex-wrap: wrap; }
.rail-foot .pop { left: var(--sp-4); }

/* phones: the sidebar becomes a top strip (scrolls sideways on its own), the
   project panes stack (rail under the thread) and the column scrolls. */
@media (max-width: 720px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .side { height: auto; flex-direction: row; align-items: center; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: var(--bw) solid var(--line); }
  .side > * { flex: none; }
  .side::-webkit-scrollbar { height: 4px; }
  .side-head { padding: var(--sp-2); border-bottom: 0; }
  .side-head .col, .nav-label, .side-foot .col { display: none; }
  .side-foot { padding: var(--sp-2); border-top: 0; }
  .side .nav { display: flex; gap: var(--sp-1); overflow: visible; padding: var(--sp-2) 0; }
  .side .nav-item { max-width: 180px; white-space: nowrap; }
  .side > div:not(.side-head) { border-top: 0 !important; }
  .main { height: auto; min-height: 0; }
  .top { padding: 0 var(--sp-4); }
  .proj { flex-direction: column; overflow-y: auto; }
  .chat, .chat.compact { flex: none; width: auto; height: 72vh; border-left: 0; }
  .proj-main { flex: none; }
  .rail { width: auto; border-left: 0; border-top: var(--bw) solid var(--line); }
  .rail-list { overflow: visible; }
  .chat-head, .thread { padding-left: var(--sp-4); padding-right: var(--sp-4); }
}

/* =========================================================================
   THING VIEWS — table, doc, page, file, link (screen-thing.jsx)
   Cells / sections an agent just wrote flash yellow (.fresh, held 3 s by
   useThing, then fade); what someone else is writing is hatched (locked).
   ========================================================================= */
.thing { display: flex; flex-direction: column; min-height: 100%; min-width: 0; }
.thing-top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-width: 0; padding: var(--sp-3) var(--sp-5); background: var(--surface); border-bottom: var(--bw) solid var(--line); }
.thing-name { max-width: 100%; min-width: 0; padding: 2px var(--sp-1); background: transparent; color: var(--ink); border: var(--bw-hair) dashed transparent; font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 700; text-transform: uppercase; letter-spacing: var(--ls-tight); text-align: left; cursor: text; }
.thing-name:hover { background: var(--hi); border-color: var(--ink); }
.thing-name-in { width: min(360px, 100%); height: 32px; font-weight: 700; }
.thing-acts { margin-left: auto; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.thing-err { flex-basis: 100%; }
.thing-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5) var(--sp-6); }
.thing-ph { padding: var(--sp-4); font-size: var(--fs-data); }

.thing table.tbl tbody td { transition: background-color .8s ease-out; cursor: text; }
.thing table.tbl tbody td.num { text-align: right; font-family: var(--font-mono); }
.thing table.tbl tbody td.hatch { background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(0,0,0,.06) 6px 12px); }
.thing table.tbl tbody td.fresh { background: var(--hi); transition: none; }
.thing table.tbl tbody td.editing { padding: 2px var(--sp-1); }
.thing table.tbl thead th.locked { background: repeating-linear-gradient(45deg, var(--ink) 0 6px, var(--ink-2) 6px 12px); }
.th-lock { margin-left: var(--sp-2); padding: 0 var(--sp-1); background: var(--hi); color: var(--hi-ink); font-size: var(--fs-micro); letter-spacing: 0; text-transform: none; }
.cell-input { width: 100%; min-width: 120px; height: 34px; }
.cell-url { display: inline-block; max-width: 260px; font-size: var(--fs-data); vertical-align: middle; }
.thing table.tbl tbody tr.tbl-empty td { height: 72px; text-align: center; color: var(--mute); font-family: var(--font-mono); font-size: var(--fs-data); cursor: default; }

.doc { gap: var(--sp-3); }
.sec { background: var(--surface); border: var(--bw) solid var(--ink); box-shadow: var(--shadow-sm); transition: background-color .8s ease-out; }
.sec.hatch { background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(0,0,0,.06) 6px 12px), var(--surface); }
.sec.fresh { background: var(--hi); transition: none; }
.sec-head { gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-bottom: var(--bw-hair) solid var(--ink); }
.sec-title { font-size: var(--fs-h3); font-weight: 700; overflow-wrap: anywhere; }
.sec-lock { flex: none; padding: 0 var(--sp-1); background: var(--hi); color: var(--hi-ink); border: var(--bw-hair) solid var(--ink); font-size: var(--fs-micro); }
.sec-body { min-height: 44px; padding: var(--sp-3); cursor: text; overflow-wrap: anywhere; }
.sec-body:hover { background: rgba(0,0,0,.03); }
.sec.locked .sec-body { cursor: not-allowed; }
.sec-edit { gap: var(--sp-2); padding: var(--sp-3); }
.sec-edit textarea.input { min-height: 120px; resize: none; overflow: hidden; }

.page-frame { display: block; width: 100%; height: calc(100vh - 170px); min-height: 420px; background: var(--surface); border: var(--bw) solid var(--ink); box-shadow: var(--shadow); }
.file-card, .link-card { gap: var(--sp-3); padding: var(--sp-4); background: var(--surface); border: var(--bw) solid var(--ink); box-shadow: var(--shadow); min-width: 0; }
.file-meta { gap: var(--sp-3); min-width: 0; font-size: var(--fs-data); }
.file-prev { display: block; align-self: flex-start; max-width: 100%; max-height: 70vh; border: var(--bw-hair) solid var(--ink); background: var(--surface-2); }
.file-prev.pdf { width: 100%; height: 70vh; }
.link-url { font-size: var(--fs-data); color: var(--ink-2); overflow-wrap: anywhere; }

.toast { position: fixed; left: 50%; bottom: var(--sp-6); z-index: 100; transform: translateX(-50%); max-width: calc(100vw - 2 * var(--sp-4)); padding: var(--sp-2) var(--sp-4); background: var(--ink); color: var(--surface); border: var(--bw) solid var(--hi); box-shadow: var(--shadow); font-family: var(--font-mono); font-size: var(--fs-data); overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .thing-top { position: static; padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .thing-body { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .thing-acts { margin-left: 0; }
  .page-frame { height: 70vh; min-height: 0; }
}

/* =========================================================================
   MEMBERS & MACHINES — people, their computers and AI staff; agent editor
   (screen-members.jsx; ConnectMachine is also used by onboarding.jsx)
   ========================================================================= */
.members-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--sp-5); align-items: start; }
.members-left { gap: var(--sp-4); min-width: 0; }
.members-right { min-width: 0; }
.members .block { box-shadow: var(--shadow); }
.members .block .block, .members .mb-connect .block { box-shadow: var(--shadow-sm); }
.mb-pad { gap: var(--sp-3); padding: var(--sp-4); min-width: 0; }
.mb-sec { padding: var(--sp-2) var(--sp-4) var(--sp-3); border-bottom: var(--bw-hair) solid var(--surface-3); }
.mb-sec-label { padding: var(--sp-1) 0; font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 700; letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--ink-3); }
.mb-empty { padding: var(--sp-1) 0; font-family: var(--font-mono); font-size: var(--fs-data); color: var(--mute); }
.mb-name { min-width: 0; font-size: var(--fs-sm); font-weight: 700; overflow-wrap: anywhere; }
.mb-small { font-size: var(--fs-micro); line-height: 1.5; overflow-wrap: anywhere; }
.mb-full { flex-basis: 100%; }
.machine-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-width: 0; min-height: 34px; padding: var(--sp-1) 0; }
.machine-row .nav-live { flex: none; margin-left: 0; }
.mb-off { flex: none; width: 8px; height: 8px; background: var(--mute); border: var(--bw-hair) solid var(--ink); }
.agent-row { display: flex; align-items: center; gap: var(--sp-3); width: calc(100% + 2 * var(--sp-2)); min-width: 0; margin: 0 calc(-1 * var(--sp-2)); padding: var(--sp-2); background: transparent; color: var(--ink); border: var(--bw-hair) solid transparent; font: inherit; text-align: left; cursor: pointer; }
.agent-row:hover { background: var(--surface-2); }
.agent-row.on { background: var(--hi); border-color: var(--ink); box-shadow: var(--shadow-sm); }
.agent-row .col { gap: 2px; min-width: 0; }
.mb-acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); }
.mb-connect { padding: 0 var(--sp-4) var(--sp-4); }
.mb-mint { flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2); }
.mb-mint label { min-width: 180px; }
.mb-cmd { padding: 10px 12px; background: var(--ink); color: var(--surface); font-size: var(--fs-data); line-height: 1.5; white-space: pre-wrap; word-break: break-all; user-select: all; }
.invite-row { flex-wrap: wrap; gap: var(--sp-2); }
.invite-code { padding: var(--sp-1) var(--sp-3); background: var(--ink); color: var(--surface); font-size: var(--fs-h3); font-weight: 700; letter-spacing: 0.2em; user-select: all; }
.agent-editor { gap: var(--sp-3); min-width: 0; }
.mb-fields { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: var(--sp-3); }
.members .input:disabled { background: var(--surface-2); color: var(--ink-3); cursor: default; }
.mb-skill { display: flex; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-2) 0; border-bottom: var(--bw-hair) solid var(--surface-3); cursor: pointer; }
.mb-skill:last-child { border-bottom: 0; }
.mb-skill .cbx { margin-top: 1px; }
.members .cbx:disabled { cursor: default; opacity: .6; }
.mb-seg { flex-wrap: wrap; align-self: flex-start; max-width: 100%; }
.mb-seg button:not(.on):not(:disabled):hover { background: var(--surface-2); color: var(--ink); cursor: pointer; }
.mb-seg button:disabled { cursor: default; }
.mb-grants { gap: var(--sp-2); }
.mb-check { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); cursor: pointer; }
.mb-save { flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.hire-modal { width: 560px; }

@media (max-width: 720px) {
  .members.pad { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .members-grid { grid-template-columns: minmax(0, 1fr); }
}
fieldset.agent-editor { margin: 0; padding: 0; border: 0; }
