:root {
  --bg: #0b0e12;
  --panel: #12161c;
  --panel-2: #181d25;
  --line: #232a35;
  --line-2: #2f3846;
  --fg: #eef1f5;
  --dim: #a3adbb;
  --faint: #8e99a8;
  --amber: #f5a524;
  --amber-bg: rgba(245, 165, 36, .12);
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, .12);
  --red-bg: rgba(255, 107, 87, .12);
  --blue: #8fb6ff;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --body: "Manrope", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 var(--body);
  overflow-wrap: anywhere;
}
h1, h2, h3, p, pre { margin: 0; }
h2 { font: 700 17px/1.25 var(--display); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled, select:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
textarea::placeholder { color: var(--faint); }
textarea, input, select { min-width: 0; }
.small { font-size: 13px; }
.muted { color: var(--dim); }
.error { color: #ffb3a8; }
.empty { color: var(--dim); padding: 4px 0; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; font: 700 17px var(--display); }
.logo::before {
  content: "";
  flex: 0 0 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}
.pause {
  border: 1px solid rgba(255, 107, 87, .45);
  background: var(--red-bg);
  color: #ffb3a8;
  border-radius: 8px;
  padding: 7px 14px;
  font-weight: 700;
  white-space: nowrap;
}
.pause.resume { background: var(--green-bg); color: #8ff0c4; border-color: rgba(52, 211, 153, .4); }
.gate { flex: 1; display: grid; place-items: center; padding: 16px; }
.gate-card { display: grid; gap: 12px; width: min(100%, 360px); padding: 22px; }
.gate-card .send { justify-self: start; }
.gate-card input, .change-note textarea {
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 16px;
}

.dashboard { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.notice { padding: 7px 16px; text-align: center; background: var(--panel-2); }
.paused-banner { color: #ffd08a; background: var(--amber-bg); }
.page {
  --gap: clamp(10px, 1.25vw, 18px);
  width: min(100%, 1480px);
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  padding: var(--gap) var(--gap) 0;
  display: grid;
  grid-template-columns: minmax(205px, .76fr) minmax(0, 1.75fr) minmax(246px, 1fr);
  gap: var(--gap);
}
.column {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
  overflow-y: auto;
  padding-bottom: var(--gap);
}
.column > * { flex-shrink: 0; }
.box { border: 1px solid var(--line); background: var(--panel); border-radius: 14px; min-width: 0; }
.box-h { display: flex; align-items: baseline; gap: 9px; padding: 14px 14px 0; }
.count, .tile-value { font-variant-numeric: tabular-nums; }
.tiles { display: grid; gap: 8px; }
.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
  padding: 10px 14px;
  text-align: left;
}
.tile-label { font-size: 13px; color: var(--dim); font-weight: 700; }
.tile-value { font: 700 27px/1.15 var(--display); }
.tile.need { border-color: rgba(245, 165, 36, .5); background: linear-gradient(180deg, var(--amber-bg), var(--panel) 80%); }
.tile.need .tile-value { color: var(--amber); }
.usage, .agents, .cards, .feed { display: grid; gap: 10px; padding: 12px 14px 14px; }
.usage-plan + .usage-plan { border-top: 1px solid var(--line); padding-top: 10px; }
.u-h { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; }
.u-h span { font: 600 13px/1.5 var(--mono); }
.u-s { margin-top: 4px; }
.mini { height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 6px; }
.mini span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.mini span.low { background: var(--amber); }
.agent { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 8px; align-items: start; }
.agent-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 7px; }
.agent + .agent { border-top: 1px solid var(--line); padding-top: 10px; }
.av { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; font: 600 13px var(--mono); background: #2a2140; color: #c7a6ff; }
.av.claude { background: #3a2a14; color: #f5c06b; }
.av.codex { background: #16263d; color: var(--blue); }
.st { font-size: 13px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--panel-2); color: var(--dim); }
.st.working { background: var(--green-bg); color: #8ff0c4; }
.st.queued { background: var(--amber-bg); color: #ffd08a; }

.chat-screen { display: flex; flex-direction: column; min-height: 0; overflow: hidden; margin-bottom: var(--gap); }
.chat-header { display: grid; justify-items: start; gap: 5px; padding: 14px 16px 11px; border-bottom: 1px solid var(--line); }
.project-picker, .recipient { display: flex; align-items: center; gap: 7px; max-width: 100%; }
.project-picker { margin-top: 3px; font-weight: 700; }
.project-picker label, .recipient label { white-space: nowrap; }
select { text-overflow: ellipsis; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel-2); padding: 5px 8px; }
.chat-history { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; }
#messages, #draft-replies { display: grid; gap: 12px; }
#draft-replies:not(:empty) { margin-top: 12px; }
.message { display: flex; align-items: flex-start; gap: 8px; }
.message.user { justify-content: flex-end; padding-left: 24px; }
.bubble { min-width: 0; max-width: 72ch; background: var(--panel-2); border-radius: 4px 12px 12px; padding: 9px 12px; }
.user .bubble { background: #1c2839; border-radius: 12px 4px 12px 12px; }
.message-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; margin-bottom: 3px; }
.message-text, .review-summary { white-space: pre-wrap; }
.chat-form { display: grid; gap: 7px; padding: 9px 12px 12px; border-top: 1px solid var(--line); }
.recipient { color: var(--dim); font-size: 13px; }
.recipient select { padding-block: 3px; }
.input { display: flex; align-items: flex-end; gap: 8px; padding: 6px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); }
.input textarea { flex: 1; resize: none; padding: 4px 6px; border: 0; background: transparent; font-size: 16px; }
.send { border: 0; border-radius: 9px; padding: 8px 14px; background: var(--amber); color: #1a1205; font-weight: 800; }
.send:hover:not(:disabled) { background: #ffba50; }

.card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); }
.media { display: block; width: 100%; max-height: 270px; object-fit: contain; background: #0d1117; }
.media-error { padding: 10px; }
.card-body { display: grid; gap: 8px; padding: 10px; }
.card h3 { font-size: 14px; }
.files { margin: 3px 0 0; padding-left: 20px; }
.diff { max-height: 220px; overflow: auto; padding: 8px; background: #0d1117; border-radius: 8px; font: 500 13px/1.55 var(--mono); white-space: pre-wrap; }
.diff .added { color: #7ee2a8; }
.diff .removed { color: #ff9a8c; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; }
.acts button { flex: 1; border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 6px; font-size: 13px; font-weight: 800; background: var(--panel-2); }
.acts .ok { background: var(--green-bg); border-color: rgba(52, 211, 153, .4); color: #8ff0c4; }
.acts .no { color: #ffb3a8; }
.acts button:hover:not(:disabled), .pause:hover:not(:disabled) { filter: brightness(1.22); }
.change-note { display: grid; gap: 6px; }
.change-note textarea { width: 100%; resize: vertical; }
.ev + .ev { border-top: 1px solid var(--line); padding-top: 9px; }
.ev-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; margin-bottom: 2px; }
.ev time { color: var(--faint); font: 500 13px var(--mono); }
.ev .claude { color: #f5c06b; }
.ev .codex { color: var(--blue); }
.tabs { display: none; }

@media (width < 860px) {
  .bar { padding: 8px 12px; }
  .page { display: flex; flex-direction: column; padding: 10px 10px 0; overflow-y: auto; }
  .column { overflow: visible; }
  .right { display: none; }
  .dashboard[data-screen="approve"] .right, .dashboard[data-screen="activity"] .right { display: flex; }
  .dashboard:not([data-screen="chat"]) .chat-screen,
  .dashboard:not([data-screen="status"]) .status-screen,
  .dashboard:not([data-screen="approve"]) .approve-screen,
  .dashboard:not([data-screen="activity"]) .activity-screen { display: none; }
  .chat-screen { flex: 1; }
  .tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 3px 4px calc(4px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
    background: var(--panel);
  }
  .tabs button { min-height: 46px; padding: 4px 1px; border: 0; border-radius: 8px; background: none; color: var(--dim); font-size: 13px; font-weight: 800; }
  .tabs button[aria-current] { color: var(--amber); background: var(--amber-bg); }
  .badge { display: inline-block; border-radius: 99px; background: var(--amber); color: #1a1205; padding: 0 5px; font: 600 13px/1.45 var(--mono); }
}
