:root {
  --bg: #0d0e11;
  --panel: #131519;
  --panel-2: #171a1f;
  --line: #23262d;
  --line-soft: #1c1f25;
  --text: #e6e8ec;
  --dim: #878d99;
  --dimmer: #5d636e;
  --accent: #6ea8fe;
  --good: #4ec98a;
  --warn: #e0b25c;
  --bad: #e06c6c;
  --radius: 8px;
  --sidebar-w: 232px;
  --chat-w: 400px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--chat-w);
  background: var(--bg);
  color: var(--text);
  font: 13px/1.55 ui-sans-serif, -apple-system, "SF Pro Text", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.resizing {
  cursor: col-resize;
  user-select: none;
}
body.resizing iframe,
body.resizing img { pointer-events: none; }

button {
  font: inherit;
  color: inherit;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}
button:hover { background: #1e222a; border-color: #2d323b; }
button:disabled { opacity: .45; cursor: default; }

/* ---------- sidebar ---------- */

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 12px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  min-height: 0;
}

.brand {
  font-weight: 600;
  letter-spacing: .2px;
  padding: 2px 6px 4px;
}

.new {
  width: 100%;
  background: var(--accent);
  border-color: transparent;
  color: #0b1220;
  font-weight: 600;
}
.new:hover { background: #8bbcff; border-color: transparent; }

.list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.item {
  text-align: left;
  border: none;
  background: none;
  border-radius: 6px;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 8px;
  align-items: start;
}
.item:hover { background: var(--panel-2); }
.item.active { background: #1d222b; }
.item .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--dimmer); margin-top: 6px;
}
.item.running .dot { background: var(--accent); animation: pulse 1.4s infinite; }
.item.complete .dot { background: var(--good); }
.item.declined .dot { background: var(--dimmer); }
.item.error .dot { background: var(--bad); }
.item.waiting .dot { background: var(--warn); }
.item .label {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item .meta { color: var(--dimmer); font-size: 11px; }

@keyframes pulse { 50% { opacity: .3; } }

.sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--dimmer);
  font-size: 11px;
  padding: 0 6px;
  position: relative;
}

.account-menu {
  position: relative;
}
.account-menu.hidden { display: none; }
.account-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 140px;
  background: transparent;
  border: 0;
  color: var(--dim);
  cursor: pointer;
  font: inherit;
  padding: 2px 4px;
  border-radius: 4px;
}
.account-menu-toggle:hover { color: var(--text); background: var(--panel-2); }
.account-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-caret { font-size: 9px; opacity: .7; }
.account-menu-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  min-width: 148px;
  padding: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 20;
}
.account-menu-panel.hidden { display: none; }
.account-menu-panel a,
.account-menu-panel button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
.account-menu-panel a:hover,
.account-menu-panel button:hover { background: #1e222a; }
.account-menu-panel a.hidden { display: none; }

.sign-out {
  background: transparent;
  border: 0;
  color: var(--dim);
  cursor: pointer;
  font: inherit;
  padding: 2px 4px;
  border-radius: 4px;
}
.sign-out:hover { color: var(--text); background: var(--panel); }
.sign-out.hidden { display: none; }

/* ---------- main workspace ---------- */

main.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line-soft);
}

h1 {
  font-size: 15px; font-weight: 600; margin: 0;
  line-height: 1.35; max-width: 72ch;
}

/* ---------- workflow / data switch ---------- */

.views {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 16px; border-bottom: 1px solid var(--line-soft);
}
.view {
  border: none; background: none; color: var(--dim);
  padding: 4px 12px; border-radius: 6px;
}
.view:hover { background: var(--panel-2); color: var(--text); }
.view.active { background: var(--panel-2); color: var(--text); }
.progress-chip {
  margin-left: auto; font-size: 11px; color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.workflow-view {
  flex: 1; overflow-y: auto; min-height: 0;
  padding: 16px 20px 60px;
  display: flex; flex-direction: column; gap: 14px;
  max-width: 860px;
}
/* Cards must keep their natural height so the view scrolls, not clip. */
.workflow-view > * { flex-shrink: 0; }
.data-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
  font-weight: 600; font-size: 12px;
}
.card-actions {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 12px 14px; border-top: 1px solid var(--line-soft);
}
button.primary {
  background: var(--accent); color: #0b1220; border-color: transparent; font-weight: 600;
}
button.primary:hover:not(:disabled) { background: #8bbcff; border-color: transparent; }
button.ghost { color: var(--dim); }

.chip {
  font-size: 11px; font-weight: 400; color: var(--dim);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px;
}
.chip.ok { color: var(--good); border-color: #2b4a3a; }
.chip.warn { color: var(--warn); border-color: #4a3f24; }
.chip.live { color: var(--accent); border-color: #2c3e5c; }

/* ---------- criteria ---------- */

.criteria { list-style: none; margin: 0; padding: 4px 0; }
.criterion {
  display: grid; grid-template-columns: 20px 1fr auto;
  gap: 10px; align-items: baseline;
  padding: 9px 14px; border-bottom: 1px solid var(--line-soft);
}
.criterion:last-child { border-bottom: none; }
.criterion .tick { color: var(--good); }
.criterion.missing .tick { color: var(--bad); }
.criterion.missing .label { color: var(--dim); text-decoration: line-through; }
.criterion .body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.criterion .label { font-weight: 500; }
.criterion .detail { color: var(--dim); font-size: 11.5px; }
.chip.source { flex-shrink: 0; font-size: 10.5px; }
.chip.source.absent { color: var(--bad); border-color: #4d2b2b; }
.chip.source.judgeable { color: #c58ce0; border-color: #43305180; }
.chip.source.external { color: var(--accent); border-color: #2c3e5c; }

.has-data {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.has-data-label {
  color: var(--dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.has-data-hint {
  margin: 0;
  color: var(--dimmer);
  font-size: 11.5px;
  line-height: 1.4;
}
.has-data-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.has-data-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.has-data-option input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  margin: 0;
  flex-shrink: 0;
}
.has-data-option.disabled {
  color: var(--dim);
  cursor: default;
}

/* ---------- live search signals ---------- */

.signals { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 12px; }
.signal-block { display: flex; flex-direction: column; gap: 6px; }
.signal-label {
  color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
}
.signal-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11.5px; padding: 2px 8px; border-radius: 4px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
}
.tag.include { border-color: #2b4a3a; color: var(--good); }
.tag.exclude { border-color: #4d2b2b; color: var(--bad); }
.tag.selected { border-color: var(--accent); color: var(--accent); }
.tag .hit, .tag .field {
  color: var(--dimmer); font-variant-numeric: tabular-nums; margin-left: 4px;
}

/* ---------- flow diagram ---------- */

.flow { list-style: none; margin: 0; padding: 14px 14px 16px; }
.node { display: grid; grid-template-columns: 22px 1fr; gap: 12px; }
.node .rail {
  display: flex; flex-direction: column; align-items: center;
  position: relative; padding-top: 5px;
}
.node .rail .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--panel-2); border: 1.5px solid var(--line); flex-shrink: 0; z-index: 1;
}
/* the connector between one step and the next */
.node:not(:last-child) .rail::after {
  content: ""; flex: 1; width: 1.5px; background: var(--line); margin: 3px 0 -3px;
}
.node.done .rail .dot { background: var(--good); border-color: var(--good); }
.node.done:not(:last-child) .rail::after { background: #2b4a3a; }
.node.active .rail .dot {
  background: var(--accent); border-color: var(--accent); animation: pulse 1.4s infinite;
}
.node.failed .rail .dot { background: var(--bad); border-color: var(--bad); }

.node .body { padding-bottom: 16px; min-width: 0; display: flex;
              flex-direction: column; gap: 4px; }
.node:last-child .body { padding-bottom: 0; }
.node .top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.node .label { color: var(--dim); }
.node.done .label, .node.active .label { color: var(--text); }
.node.active .label { font-weight: 600; }
.node .kind {
  font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--dimmer);
}
.node .pct { color: var(--accent); font-variant-numeric: tabular-nums; font-size: 11px; }
.node.active .note { color: var(--dim); }
.node.active .note.running {
  background: linear-gradient(
    90deg,
    var(--dimmer) 0%,
    var(--accent) 45%,
    var(--text) 55%,
    var(--dimmer) 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: running-shimmer 1.8s linear infinite;
}
.node .bar { height: 3px; background: var(--line); border-radius: 2px; max-width: 260px;
             overflow: hidden; }
.node .bar .fill {
  height: 100%; background: var(--accent); border-radius: 2px;
  transition: width .4s ease;
}
.node.active .bar .fill {
  background: linear-gradient(90deg, var(--accent), #8ec5ff, var(--accent));
  background-size: 200% 100%;
  animation: running-shimmer 1.4s linear infinite;
}
@keyframes running-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.node .tallies { display: flex; gap: 12px; flex-wrap: wrap; }
.node .tally {
  font-size: 11px; color: var(--text); font-variant-numeric: tabular-nums;
  background: var(--panel-2); border-radius: 4px; padding: 1px 7px;
}
.node.active .tally { color: var(--accent); }

/* ---------- counts, estimate, bill ---------- */

.counts { display: flex; gap: 36px; padding: 14px; flex-wrap: wrap; }
.count-group .entity {
  color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 6px;
}
.count-group .pair { display: flex; gap: 24px; }
.count-group .metric .value { font-size: 20px; color: var(--dim); }
.count-group .metric.strong .value { color: var(--good); }

.estimate, .bill { padding: 6px 14px 12px; }
.estimate-row, .bill-row {
  display: grid; align-items: baseline;
  padding: 7px 0; border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
}
.estimate-row {
  grid-template-columns: minmax(120px, 1.2fr) repeat(3, minmax(72px, 1fr));
  gap: 12px;
}
.bill-row { grid-template-columns: 1fr auto; gap: 14px; }
.estimate-row:last-child, .bill-row:last-child { border-bottom: none; }
.estimate-row .label, .bill-row span:first-child { color: var(--dim); }
.estimate-row .value { font-weight: 600; text-align: right; }
.estimate-row .low,
.estimate-row .high { color: var(--dimmer); text-align: right; font-size: 12px; }
.estimate-row.head {
  border-bottom: 1px solid var(--line);
  padding-top: 2px;
  padding-bottom: 8px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--dimmer);
}
.estimate-row.head span:not(.label) { text-align: right; font-weight: 500; }
/* One rule above totals — don't stack with the previous row's border-bottom. */
.estimate-row:has(+ .total),
.bill-row:has(+ .total) { border-bottom: none; }
.estimate-row.total, .bill-row.total {
  border-top: 1px solid var(--line);
  margin-top: 2px;
  padding-top: 9px;
}
.estimate-row.total .value { color: var(--good); }
.bill-row.total span:last-child { color: var(--good); }

.metrics {
  display: flex;
  gap: 28px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.metric .value { font-size: 22px; font-weight: 600; letter-spacing: -.4px; }
.metric .label { color: var(--dim); font-size: 11px; text-transform: uppercase;
                 letter-spacing: .6px; }
.metrics:empty { display: none; }

.data-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; border-bottom: 1px solid var(--line-soft);
  min-height: 44px;
}
.data-toolbar .tabs {
  flex: 1; min-width: 0; padding: 0; border: none; overflow-x: auto;
}
.data-toolbar-actions {
  display: flex; align-items: center; gap: 12px; flex-shrink: 0; margin-left: auto;
}
.data-count {
  font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.data-count:empty { display: none; }
a.download-csv {
  display: inline-flex; align-items: center;
  background: var(--accent); color: #0b1220; font-weight: 600;
  border-radius: 6px; padding: 5px 12px; font-size: 12px;
  text-decoration: none; white-space: nowrap;
}
a.download-csv:hover { background: #8bbcff; }
a.download-csv.hidden { display: none; }

.fill-rates {
  display: flex; gap: 20px; padding: 12px 20px;
  border-bottom: 1px solid var(--line-soft); flex-wrap: wrap;
}
.fill-rates:empty { display: none; }
.fill-rate .value {
  font-size: 20px; font-weight: 600; letter-spacing: -.3px;
  font-variant-numeric: tabular-nums;
}
.fill-rate .value.good { color: var(--good); }
.fill-rate .value.mid { color: var(--warn); }
.fill-rate .value.low { color: var(--bad); }
.fill-rate .label {
  color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
}
.fill-rate .sub {
  color: var(--dimmer); font-size: 10.5px; font-variant-numeric: tabular-nums;
}

.tabs {
  display: flex; gap: 4px; padding: 8px 16px; overflow-x: auto;
  border-bottom: 1px solid var(--line-soft);
}
.tabs:empty { display: none; }
.tab {
  border: none; background: none; color: var(--dim);
  padding: 4px 10px; border-radius: 6px; white-space: nowrap;
}
.tab:hover { background: var(--panel-2); color: var(--text); }
.tab.active { background: var(--panel-2); color: var(--text); }
.tab .n { color: var(--dimmer); margin-left: 6px; font-variant-numeric: tabular-nums; }

.grid-wrap { flex: 1; overflow: auto; min-height: 0; padding-bottom: 40px; }

.grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%;
        font-size: 12px; table-layout: fixed; }
.grid th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg);
  text-align: left; font-weight: 500; color: var(--dim);
  padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap; font-size: 11px; letter-spacing: .3px;
}
.grid th.zone-custom { color: var(--accent); }
.grid th.pinned, .grid td.pinned {
  position: sticky; z-index: 1;
  background: var(--bg);
  box-shadow: 1px 0 0 var(--line-soft);
}
.grid th.pinned { z-index: 3; }
.grid td.pinned { background: var(--bg); }
.grid tbody tr:hover td.pinned { background: var(--panel); }
.grid td {
  padding: 7px 10px; border-bottom: 1px solid var(--line-soft);
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.grid td.reach-cell { max-width: 200px; }
.grid th:not(.avatar-cell), .grid td:not(.avatar-cell) { min-width: 88px; }
.grid td.empty-dash { color: var(--dimmer); }
.grid tbody tr:hover { background: var(--panel); }
.grid a { color: var(--accent); text-decoration: none; }
.grid a:hover { text-decoration: underline; }

.email-cell {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
}
.email-cell a { overflow: hidden; text-overflow: ellipsis; }
.status-pill {
  flex-shrink: 0; font-size: 10px; text-transform: lowercase;
  border: 1px solid var(--line); border-radius: 999px; padding: 0 6px;
  color: var(--dim);
}
.status-pill.valid, .status-pill.verified { color: var(--good); border-color: #2b4a3a; }
.status-pill.invalid, .status-pill.catch-all, .status-pill.catch_all {
  color: var(--warn); border-color: #4a3f24;
}

.avatar {
  width: 26px; height: 26px; border-radius: 50%; object-fit: cover;
  background: var(--panel-2); display: block;
}
.avatar-fallback {
  width: 26px; height: 26px; border-radius: 50%;
  background: #262b34; color: var(--dim);
  display: grid; place-items: center; font-size: 10px; font-weight: 600;
}
.logo, .logo-fallback {
  width: 26px; height: 26px; border-radius: 6px; object-fit: contain;
  background: var(--panel-2); display: block;
}
.logo-fallback {
  display: grid; place-items: center; font-size: 10px; font-weight: 600;
  color: var(--dim);
}
.company-cell {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
}
.company-cell span { overflow: hidden; text-overflow: ellipsis; }
.logo-inline {
  width: 18px; height: 18px; border-radius: 4px; object-fit: contain;
  background: var(--panel-2); flex-shrink: 0;
}
td.avatar-cell { width: 40px; padding-right: 4px; padding-left: 12px; }
th.avatar-cell { width: 40px; padding-right: 4px; padding-left: 12px; }

.empty { padding: 60px 24px; color: var(--dim); max-width: 52ch; }
.empty .dim { color: var(--dimmer); }
.more { padding: 14px 20px; }
.hidden { display: none; }

/* ---------- chat ---------- */

.chat {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  min-height: 0;
}

.panel-resize {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  z-index: 4;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
}
.panel-resize:hover,
.panel-resize:focus-visible,
.panel-resize.active {
  background: var(--accent);
  opacity: .35;
  outline: none;
}
.sidebar .panel-resize { right: -3px; }
.chat .panel-resize { left: -3px; }

.chat-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--line-soft);
  font-weight: 600;
}
.status { color: var(--dim); font-size: 11px; font-weight: 400; max-width: 55%;
          text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status.live {
  background: linear-gradient(90deg, #6b7380 0%, #9ec2ff 42%, #e8f1ff 50%, #9ec2ff 58%, #6b7380 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 2.4s linear infinite;
}

/* Block flow, not a flex column: flex-shrink on log rows once crushed `.ev.stage`
   (when it matched the workspace `.stage` rule) to height 0 and overlapped neighbors. */
.trace { flex: 1; overflow-y: auto; padding: 12px 16px; }

.ev {
  font-size: 12px;
  line-height: 1.45;
  min-height: 1.35em;
  margin-bottom: 8px;
}
.ev:last-child { margin-bottom: 0; }
.ev-enter {
  animation: ev-fade-in 280ms ease-out;
}
@keyframes ev-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.ev-you {
  background: #1d222b; border-radius: var(--radius);
  padding: 8px 11px; width: fit-content; max-width: 92%;
  margin-left: auto;
}
.ev-thinking {
  display: flex; align-items: center; gap: 8px;
  min-height: 1.6em;
  margin-top: 4px;
  color: var(--dim);
}
.ev-thinking.hidden { display: none; }
.thinking-shimmer {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  background: linear-gradient(90deg, #6b7380 0%, #9ec2ff 42%, #e8f1ff 50%, #9ec2ff 58%, #6b7380 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 2.4s linear infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
#workflow-empty-title.thinking-shimmer {
  font-size: inherit;
  font-weight: 600;
}
.ev-thought { color: var(--text); line-height: 1.6; margin-top: 6px; margin-bottom: 6px; }
.ev-tool { color: var(--dim); font-family: ui-monospace, "SF Mono", Menlo, monospace;
           font-size: 11px; display: flex; flex-wrap: wrap; gap: 7px; align-items: baseline;
           min-width: 0; width: 100%; }
.ev-tool .name { color: var(--accent); flex-shrink: 0; }
.ev-tool .args { color: var(--dimmer); min-width: 0; flex: 1 1 12rem;
                 white-space: normal; overflow-wrap: anywhere; }
.ev-stage, .ev-result, .ev-counts, .ev-progress {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
}
.ev-stage { color: var(--good); font-variant-numeric: tabular-nums; }
.ev-progress { color: var(--accent); font-variant-numeric: tabular-nums; }
.ev-counts { color: #7fd4c8; font-variant-numeric: tabular-nums; }
.ev-note { color: var(--warn); }
.ev-upload { color: var(--dim); display: block; overflow-wrap: anywhere; }
.ev-error { color: var(--bad); }
.ev-search { color: #c58ce0; }
.ev-result { color: var(--dimmer); font-size: 11px; }
.ev-question { color: var(--warn); border-left: 2px solid var(--warn); padding-left: 9px; }

.ev-panel {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-2); overflow: hidden;
}
.ev-panel .panel-head {
  padding: 6px 10px; font-size: 11px; color: var(--dim);
  border-bottom: 1px solid var(--line);
}
.ev-panel pre {
  margin: 0; padding: 10px; overflow-x: hidden; font-size: 10.5px; line-height: 1.45;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; color: var(--text);
  white-space: pre-wrap; overflow-wrap: anywhere;
}

.prose p { margin: 0 0 7px; }
.prose p:last-child { margin-bottom: 0; }
.prose h4 { margin: 12px 0 6px; font-size: 12px; font-weight: 600; }
.prose h4:first-child { margin-top: 0; }
.prose ul { margin: 4px 0 8px; padding-left: 18px; }
.prose li { margin-bottom: 2px; }
.prose strong { font-weight: 600; color: #fff; }
.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px;
  background: #22262e; padding: 1px 4px; border-radius: 3px;
}
.prose table.md {
  border-collapse: collapse; margin: 6px 0 9px; width: 100%; font-size: 11.5px;
}
.prose table.md th {
  text-align: left; color: var(--dim); font-weight: 500; padding: 3px 10px 3px 0;
  border-bottom: 1px solid var(--line);
}
.prose table.md td {
  padding: 3px 10px 3px 0; border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
}
.prose table.md td:last-child, .prose table.md th:last-child { padding-right: 0; }

.composer { border-top: 1px solid var(--line); padding: 10px 12px 12px; }
.chat-prompt {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid #2c3e5c;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #171c26 0%, var(--panel-2) 100%);
}
.chat-prompt.hidden { display: none; }
.chat-prompt-copy {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.chat-prompt-copy strong {
  font-size: 13px; font-weight: 600; color: var(--text);
}
.chat-prompt-copy span {
  font-size: 11.5px; color: var(--dim); line-height: 1.4;
}
.chat-prompt-actions {
  display: flex; gap: 8px; align-items: stretch;
}
.chat-prompt-actions .primary {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 12px;
}
.chat-prompt-actions .ghost {
  flex-shrink: 0;
  padding: 9px 12px;
}
.chat-prompt.editing .primary {
  background: transparent; color: var(--accent); border-color: #2c3e5c;
}
.chat-prompt.editing .primary:hover:not(:disabled) {
  background: #1a2230; border-color: #3a547c; color: #9ec2ff;
}
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 4px;
  border: 1px solid rgba(11, 18, 32, 0.25);
  background: rgba(11, 18, 32, 0.18);
  color: inherit;
  font: 11px/1 ui-sans-serif, -apple-system, system-ui, sans-serif;
  opacity: .85;
}
.chat-prompt.editing .kbd,
.kbd.hidden { display: none; }
.composer-box {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.composer-box:focus-within { border-color: #33507d; }
.composer textarea {
  display: block; width: 100%; resize: none;
  background: transparent; color: var(--text);
  border: none; border-radius: var(--radius);
  padding: 10px 44px 10px 12px; font: inherit; min-height: 52px;
}
.composer textarea:focus { outline: none; }
.composer textarea::placeholder { color: var(--dimmer); }
.send {
  position: absolute; right: 8px; bottom: 8px;
  width: 28px; height: 28px; padding: 0;
  display: grid; place-items: center;
  border-radius: 7px; border: none;
  background: transparent; color: var(--dimmer);
}
.send:disabled { opacity: 1; color: var(--dimmer); cursor: default; background: transparent; }
.send:not(:disabled) { background: var(--accent); color: #0b1220; }
.send:hover:not(:disabled) { background: #8bbcff; border-color: transparent; }
.send.busy {
  color: var(--accent);
  pointer-events: none;
  animation: pulse 1.4s infinite;
}

.composer textarea { padding-left: 38px; }
.attach {
  position: absolute; left: 8px; top: 8px;
  width: 26px; height: 26px; padding: 0;
  display: grid; place-items: center;
  border-radius: 7px; border: none;
  background: transparent; color: var(--dimmer);
}
.attach:hover { background: var(--line); color: var(--text); }

.attachments {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 8px;
}
.attachments.hidden { display: none; }
.attachment {
  display: flex; flex-direction: column; gap: 1px;
  padding: 6px 9px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 2px solid var(--good);
  border-radius: 6px;
  font-size: 11px; line-height: 1.35;
  max-width: 100%;
}
.attachment.bad { border-left-color: var(--warn); }
.attachment strong { color: var(--text); font-weight: 500; }
.attachment span { color: var(--dim); }

.drop-veil {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(13, 14, 17, 0.72);
  backdrop-filter: blur(2px);
  pointer-events: none;
}
.drop-veil.hidden { display: none; }
.drop-veil-inner {
  padding: 22px 34px;
  border: 1px dashed var(--accent);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #272b33; border-radius: 6px;
                            border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #343943; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
