:root {
  color-scheme: dark;
  /* Same tokens as getcoide.vercel.app */
  --bg: #171717;
  --bg-deep: #111112;
  --panel: #1c1c1e;
  --panel-2: #222225;
  --panel-3: #262629;
  --chrome: #141415;
  --ink: #f1f1f2;
  --ink-soft: #9d9da4;
  --ink-faint: #64646b;
  --line: #ffffff1a;
  --line-strong: #ffffff2e;
  --accent: #bd9686;          /* the site's "sand" signal colour */
  --accent-soft: #bd968633;
  --button-bg: #f4f1ed;
  --button-ink: #23201d;
  --button-hover: #e2ddd7;
  --mint: #7ac28a;
  --blue: #849bd0;
  --green: #7ac28a;
  --amber: #d6b46a;
  --red: #e07a7a;
  --brand-claude: #d97757;
  --brand-codex: #10a37f;
  --brand-gemini: linear-gradient(135deg, #4c8dff 0%, #8f6dff 55%, #e0708c 100%);
  --brand-grok: #000000;
  --brand-opencode: #3a3a40;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --display: "Inter", -apple-system, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 8px;
  --topbar: 52px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button { cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: #bd968655; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { background: #ffffff0d; border-color: var(--line-strong); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary {
  background: var(--button-bg);
  border-color: var(--button-bg);
  color: var(--button-ink);
  box-shadow: 0 6px 18px -8px #000;
}
.btn.primary:hover { background: var(--button-hover); border-color: var(--button-hover); }
.btn.ghost { border-color: transparent; color: var(--ink-soft); }
.btn.ghost:hover { color: var(--ink); background: #ffffff0d; }
.btn.small { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1;
}
.icon-btn:hover { background: #ffffff10; color: var(--ink); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------------------------------------------------------------- boot */

.boot {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  gap: 18px;
  background: var(--bg);
}
.boot-inner { display: grid; justify-items: center; gap: 18px; }
.boot img { width: 190px; opacity: .9; }
.boot-bar { width: 140px; height: 2px; background: #ffffff14; overflow: hidden; border-radius: 2px; }
.boot-bar::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  background: var(--accent);
  animation: boot-slide 1s ease-in-out infinite;
}
@keyframes boot-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(360%); }
}

/* ---------------------------------------------------------------- auth */

.auth {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  background: var(--bg);
  overflow: auto;
}
.auth-left {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  padding: clamp(28px, 4vw, 56px);
  border-right: 1px solid var(--line);
  background:
    radial-gradient(900px 500px at 10% 0%, #bd96861f, transparent 60%),
    linear-gradient(180deg, #1a1a1b, #171717);
  overflow: hidden;
}
.auth-left::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(#ffffff06 1px, transparent 1px),
    linear-gradient(90deg, #ffffff06 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(700px 500px at 20% 20%, #000, transparent 80%);
  pointer-events: none;
}
.auth-left > * { position: relative; }
.brand img { width: 168px; height: auto; }
.auth-pitch { max-width: 520px; display: grid; gap: 18px; }
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}
.auth-pitch h1 {
  font-family: var(--display);
  font-size: clamp(38px, 5vw, 62px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -.02em;
}
.auth-pitch > p {
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 44ch;
}
.auth-points {
  display: grid;
  gap: 9px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13.5px;
  color: var(--ink-soft);
}
.auth-points li { display: flex; align-items: center; gap: 9px; }
.auth-points li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.auth-foot {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-faint);
}
.auth-right {
  display: grid;
  place-items: center;
  padding: 32px 24px;
}
.auth-card {
  width: min(100%, 380px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 30px 80px -40px #000;
}
.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff05;
}
.auth-tabs button {
  flex: 1;
  height: 30px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 500;
}
.auth-tabs button.on { background: #ffffff10; color: var(--ink); }
.auth-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

#auth-form { display: grid; gap: 14px; }
#auth-form label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-soft);
}
#auth-form input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-deep);
  color: var(--ink);
  outline: none;
}
#auth-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #bd96862e; }
#auth-form input::placeholder { color: var(--ink-faint); }
#auth-form .btn { width: 100%; height: 38px; margin-top: 4px; }
.form-error {
  min-height: 17px;
  font-size: 12px;
  color: var(--red);
}
.auth-note {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--ink-faint);
}

/* ---------------------------------------------------------------- app shell */

.app { display: flex; flex-direction: column; height: 100%; }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--topbar);
  flex: none;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--chrome);
  position: relative;
}
.topbar .brand { display: flex; align-items: center; flex: none; }
.topbar .brand img { width: 132px; height: auto; }
.topbar-mid {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px #7ac28a22;
  flex: none;
}
.topbar-mid .sep { color: var(--ink-faint); }
.topbar-mid .muted { color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  min-width: 0;
}
.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff05;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink);
}
.credit-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.email { font-size: 12px; color: var(--ink-faint); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-select { display: none; }

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px 10px 10px;
  border-right: 1px solid var(--line);
  background: var(--chrome);
  overflow-y: auto;
}
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 6px 7px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.projects { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.project-row { display: flex; align-items: center; gap: 2px; border-radius: 6px; }
.project-row:hover { background: #ffffff08; }
.project-row.on { background: #ffffff10; }
.project-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  text-align: left;
}
.project-row.on .project-btn { color: var(--ink); }
.project-btn .glyph {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  border: 1px solid var(--ink-faint);
  flex: none;
}
.project-row.on .project-btn .glyph { background: var(--accent); border-color: var(--accent); }
.project-btn .pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-del {
  flex: none;
  width: 22px;
  height: 22px;
  margin-right: 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1;
  opacity: 0;
}
.project-row:hover .project-del { opacity: 1; }
.project-del:hover { background: #ffffff12; color: var(--red); }
.side-empty {
  padding: 8px 10px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-faint);
}
.side-section {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.side-head .live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--green);
}
.side-head .live i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.machine { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 8px; margin: 0; padding: 0 6px; }
.machine dt { font-size: 10.5px; color: var(--ink-faint); }
.machine dd { margin: 3px 0 0; font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.quick { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 4px; }
.quick button {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10.5px;
}
.quick button:hover { border-color: var(--line-strong); color: var(--ink); }
.side-foot {
  margin-top: auto;
  padding: 18px 6px 2px;
  font-size: 11.5px;
  color: var(--ink-faint);
}
.side-foot a:hover { color: var(--ink); }
.side-warn {
  margin: 12px 6px 0;
  padding: 8px 9px;
  border: 1px solid #d6b46a2e;
  border-radius: 6px;
  background: #d6b46a0c;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--ink-faint);
}

/* ---------------------------------------------------------------- main / tabs */

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  flex: none;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: var(--chrome);
}
.tabs button {
  height: 100%;
  padding: 0 12px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 500;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom: 2px solid var(--accent); padding-top: 1px; }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.tabs-spacer { flex: 1; }
.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-faint);
}
.conn::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-faint); }
.conn.online { color: var(--green); }
.conn.online::before { background: var(--green); }

.panel { display: none; flex: 1; min-height: 0; min-width: 0; }
.panel.on { display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- terminal */

.terminal-wrap { display: flex; flex-direction: column; flex: 1; min-height: 0; background: var(--bg-deep); }
.terminal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  flex: none;
  padding: 0 10px;
  border-bottom: 1px solid #ffffff0d;
  background: var(--chrome);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
}
.traffic { display: inline-flex; gap: 5px; }
.traffic i { width: 8px; height: 8px; border-radius: 50%; background: #ffffff1f; }
.traffic i:first-child { background: #e07a7a99; }
.traffic i:nth-child(2) { background: #d6b46a99; }
.traffic i:nth-child(3) { background: #7ac28a99; }
.term-actions { margin-left: auto; display: flex; gap: 6px; }
.terminal { flex: 1; min-height: 0; padding: 6px 8px; }
.terminal .xterm { height: 100%; }
.terminal .xterm-viewport { background: transparent !important; }
.term-foot {
  flex: none;
  padding: 6px 12px;
  border-top: 1px solid #ffffff0d;
  background: var(--chrome);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-faint);
}
.term-foot kbd {
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #ffffff08;
  font-family: var(--mono);
  font-size: 9.5px;
}

/* ---------------------------------------------------------------- files */

.files { display: grid; grid-template-columns: 280px minmax(0, 1fr); flex: 1; min-height: 0; }
.tree-wrap { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--chrome); }
.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 34px;
  flex: none;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  overflow: hidden;
}
.pane-head > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree { flex: 1; min-height: 0; overflow: auto; padding: 6px 4px 20px; font-family: var(--mono); font-size: 11.5px; }
.tree-empty { padding: 12px; color: var(--ink-faint); font-family: var(--sans); font-size: 12px; line-height: 1.5; }
.tree details { margin: 0; }
.tree summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 4px;
  color: var(--ink-soft);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before { content: "▸"; color: var(--ink-faint); font-size: 9px; transition: transform .12s; }
.tree details[open] > summary::before { transform: rotate(90deg); }
.tree summary:hover { background: #ffffff08; color: var(--ink); }
.tree-file {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 21px;
  border-radius: 4px;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-file::before { content: "·"; color: var(--ink-faint); }
.tree-file:hover { background: #ffffff08; color: var(--ink); }
.tree-file.on { background: #ffffff12; color: var(--ink); }
.tree-children { margin-left: 11px; border-left: 1px solid #ffffff0a; padding-left: 2px; }

.viewer-wrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.file-actions { display: flex; gap: 6px; flex: none; }
.file-view {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  color: #dcdce0;
  white-space: pre;
  tab-size: 2;
}
.file-view.empty { display: grid; place-items: center; color: var(--ink-faint); font-family: var(--sans); font-size: 13px; }
.file-edit {
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 16px 18px;
  border: 0;
  outline: none;
  resize: none;
  background: var(--bg);
  color: #dcdce0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  tab-size: 2;
}
.file-toast {
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--green);
  background: var(--chrome);
}
.file-toast.error { color: var(--red); }

/* ---------------------------------------------------------------- agents */

.agents-view { flex: 1; min-height: 0; overflow: auto; padding: clamp(20px, 3vw, 34px); }
.agents-head { max-width: 680px; display: grid; gap: 8px; margin-bottom: 22px; }
.agents-head h2 { font-family: var(--display); font-size: 26px; font-weight: 400; letter-spacing: -.01em; }
.agents-head p { font-size: 13px; line-height: 1.6; color: var(--ink-soft); }
.toolchain-head { margin-top: 40px; }
.agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; max-width: 1180px; }
.agent-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-3);
  overflow: hidden;
}
.agent-card.on { border-color: #7ac28a40; }
.agent-top { position: relative; display: flex; gap: 12px; align-items: center; }
.agent-info { display: grid; gap: 2px; min-width: 0; }
.agent-top h3 { font-size: 15px; font-weight: 600; }
.agent-vendor { font-size: 11.5px; color: var(--ink-faint); }
.agent-note { position: relative; font-size: 12.5px; line-height: 1.55; color: var(--ink-soft); }

.agent-tile {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 8px;
  background: var(--brand-opencode);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 0 #ffffff26 inset;
}
.agent-tile img { width: 60%; height: 60%; object-fit: contain; }
.agent-tile.lg { width: 42px; height: 42px; border-radius: 11px; }
.agent-tile.sm { width: 20px; height: 20px; border-radius: 6px; }
.agent-tile[data-agent="claude"] { background: var(--brand-claude); }
.agent-tile[data-agent="codex"] { background: var(--brand-codex); }
.agent-tile[data-agent="gemini"] { background: var(--brand-gemini); }
.agent-tile[data-agent="grok"] { background: var(--brand-grok); box-shadow: inset 0 0 0 1px #ffffff2e; }
.agent-tile[data-agent="grok"] img { width: 54%; height: 54%; }
.agent-tile[data-agent="opencode"] { background: var(--brand-opencode); }
.agent-tile[data-agent="opencode"] img { width: 46%; height: 46%; }

.agent-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
}
.agent-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); }
.agent-status.on { color: var(--mint); border-color: #7ac28a40; background: #7ac28a12; }
.agent-status.on::before { background: var(--mint); }
.agent-status.off { color: var(--amber); border-color: #d6b46a33; background: #d6b46a0d; }
.agent-status.off::before { background: var(--amber); }

.agent-actions { position: relative; display: flex; align-items: center; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.agent-actions .btn { height: 34px; padding: 0 14px; border-radius: 8px; }
.agent-actions code {
  flex: 1;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-deep);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* "Sign in with …": a clean white button, like "Open in ChatGPT" */
.btn.brand {
  background: var(--button-bg);
  border-color: var(--button-bg);
  color: var(--button-ink);
  font-weight: 600;
  box-shadow: 0 6px 18px -8px #000;
}
.btn.brand:hover { background: var(--button-hover); border-color: var(--button-hover); }
.agents-note {
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-soft);
  background: #ffffff04;
}

/* sidebar agents */
.side-link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--accent);
}
.side-link:hover { color: var(--ink); }
.side-agents { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.side-agent { display: flex; align-items: center; gap: 4px; border-radius: 7px; }
.side-agent:hover { background: #ffffff08; }
.side-agent-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-size: 12.5px;
  text-align: left;
}
.side-agent-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-agent-dot { width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: var(--ink-faint); flex: none; }
.side-agent.on .side-agent-dot { background: var(--mint); }
.side-agent.off .side-agent-dot { background: var(--amber); }
.side-agent.missing { opacity: .6; }
.side-agent-sign {
  flex: none;
  height: 22px;
  margin-right: 4px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: var(--button-bg);
  color: var(--button-ink);
  font-size: 11px;
  font-weight: 600;
}
.side-agent-sign:hover { background: var(--button-hover); }

/* ---------------------------------------------------------------- preview */

.preview-wrap { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.preview-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  flex: none;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: var(--chrome);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
}
.preview-bar > span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-bar > div { display: flex; gap: 6px; }
.preview { flex: 1; min-height: 0; width: 100%; border: 0; background: #fff; }

.preview-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  flex: none;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-deep);
}
.preview-hint { font-size: 11px; color: var(--ink-faint); min-width: 0; }
.tunnel-panel {
  flex: none;
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.tunnel-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tunnel-row label { color: var(--ink); font-weight: 500; }
.tunnel-row input {
  width: 92px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
}
.tunnel-panel code {
  display: block;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  overflow-x: auto;
  white-space: pre;
}
.tunnel-panel p { margin: 8px 0 0; }
.tunnel-panel a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ---------------------------------------------------------------- dialog */

.dialog {
  width: min(calc(100vw - 32px), 440px);
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 40px 100px -30px #000;
}
.dialog::backdrop { background: #000a; backdrop-filter: blur(3px); }
.dialog h2 { font-family: var(--display); font-size: 22px; font-weight: 400; margin-bottom: 4px; }
.dialog .sub { font-size: 12px; line-height: 1.5; color: var(--ink-soft); margin-bottom: 18px; }
.dialog form { display: grid; gap: 13px; }
.dialog label { display: grid; gap: 6px; font-size: 12px; color: var(--ink-soft); }
.dialog input {
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-deep);
  color: var(--ink);
  outline: none;
}
.dialog input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #bd96862e; }
.dialog input::placeholder { color: var(--ink-faint); }
.dialog .hint { font-size: 10.5px; color: var(--ink-faint); margin-top: -4px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.dialog .form-error { min-height: 0; }
.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

/* ---------------------------------------------------------------- scrollbars */

* { scrollbar-width: thin; scrollbar-color: #ffffff26 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #ffffff1f; border-radius: 6px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #ffffff33; background-clip: padding-box; border: 3px solid transparent; }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .project-select {
    display: block;
    max-width: 170px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--bg-deep);
    color: var(--ink);
    font-size: 12px;
    outline: none;
  }
  .topbar-mid { display: none; }
  .email { display: none; }
  .agents { grid-template-columns: minmax(0, 1fr); }
  .files { grid-template-columns: 220px minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-left { display: none; }
  .auth-right { padding: 20px; }
  .topbar .brand img { width: 112px; }
  .credit-pill { display: none; }
  .tabs { padding: 0 6px; }
  .tabs button { padding: 0 9px; font-size: 12px; }
  .files { display: flex; flex-direction: column; }
  .tree-wrap {
    max-height: 38vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .viewer-wrap { flex: 1; }
  .term-foot { display: none; }
}

/* ---------------------------------------------------------------- crypto / v2 additions */

:root { --sol-a: #bd9686; --sol-b: #7ac28a; } /* chain accents: sand + mint, from the site palette */

.auth-or {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0 12px;
  font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em;
}
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.wallet-btn {
  width: 100%; height: 40px; gap: 10px;
  background: var(--panel-2);
  border-color: var(--line-strong);
}
.wallet-btn:hover { background: var(--panel-3); border-color: #bd968699; }
.wallet-mark { width: 16px; height: 16px; flex: none; color: var(--accent); }
.auth-hint { margin-top: 10px; font-size: 11.5px; line-height: 1.5; color: var(--ink-faint); }
.auth-hint b { color: var(--ink-soft); font-weight: 500; }

.cluster-pill {
  height: 24px; padding: 0 9px; display: inline-flex; align-items: center;
  border: 1px solid #7ac28a40; border-radius: 999px;
  font-family: var(--mono); font-size: 11px; color: var(--sol-b); background: #7ac28a10;
}
.account-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 8px 0 4px;
  border: 1px solid transparent; border-radius: 999px; background: transparent; color: inherit; cursor: pointer;
}
.account-btn:hover { border-color: var(--line); background: #ffffff08; }
.account-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar { width: 20px; height: 20px; border-radius: 50%; background: conic-gradient(from 200deg, var(--sol-a), var(--sol-b), var(--accent), var(--sol-a)); flex: none; }
.role-badge {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent);
}

/* terminal blocked */
.term-blocked { flex: 1; display: grid; align-content: center; justify-items: center; gap: 8px; padding: 32px; text-align: center; }
.term-blocked[hidden] { display: none; }
.term-blocked .tb-title { font-family: var(--display); font-size: 22px; color: var(--ink); }
.term-blocked p { max-width: 460px; font-size: 13px; line-height: 1.55; color: var(--ink-soft); }
.term-blocked .tb-sub { color: var(--ink-faint); font-size: 12px; }
.terminal[hidden] { display: none; }

/* toolchain */
.toolchain { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-bottom: 14px; }
.tool-row {
  display: grid; grid-template-columns: 8px auto 1fr; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
}
.tool-row i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
.tool-row.ok i { background: var(--green); box-shadow: 0 0 0 3px #7ac28a22; }
.tool-row b { font-size: 13px; font-weight: 500; }
.tool-row span { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-row.ok span { color: var(--ink-soft); }
.solana-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 34px; }

/* templates in new-project dialog */
.dialog { max-height: calc(100dvh - 32px); overflow: auto; }
.templates { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.templates legend { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; padding: 0; }
.tpl {
  display: grid !important; grid-template-columns: 16px 1fr; gap: 10px !important; align-items: start;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-deep); cursor: pointer;
}
.tpl:has(input:checked) { border-color: var(--accent); background: #bd968612; }
.tpl input { margin: 2px 0 0; accent-color: var(--accent); height: auto !important; }
.tpl b { display: block; font-size: 13px; font-weight: 500; color: var(--ink); }
.tpl small { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.45; color: var(--ink-soft); }

/* account dialog */
#account-dialog { width: min(calc(100vw - 32px), 480px); }
.acc-section { padding: 14px 0; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.acc-section h3 { font-size: 13px; font-weight: 500; }
.acc-section form { gap: 10px; }
.acc-value { font-size: 12px; word-break: break-all; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-faint); }
.dialog-actions.left { justify-content: flex-start; margin-top: 0; }

/* admin */
.admin-view { flex: 1; min-height: 0; overflow: auto; padding: clamp(16px, 3vw, 30px); display: grid; align-content: start; gap: 26px; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.stat { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); display: grid; gap: 4px; }
.stat span { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; }
.stat b { font-family: var(--display); font-size: 20px; font-weight: 400; }
.admin-warn { grid-column: 1 / -1; padding: 10px 14px; border: 1px solid #d6b46a55; border-radius: var(--radius); background: #d6b46a12; color: #e6c98a; font-size: 12.5px; line-height: 1.5; }
.admin-block { display: grid; gap: 12px; }
.admin-block-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
.admin-block-head h2 { font-family: var(--display); font-size: 22px; font-weight: 400; }
.invite-form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.invite-form label { display: grid; gap: 4px; font-size: 11px; color: var(--ink-faint); }
.invite-form input {
  height: 28px; width: 70px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 5px; background: var(--bg-deep); color: var(--ink); outline: none;
}
.invite-form label.grow input { width: 180px; }
.invite-form input:focus { border-color: var(--accent); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.admin-table th { text-align: left; font-weight: 500; font-size: 11px; color: var(--ink-faint); padding: 9px 12px; background: var(--panel); border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr.dim td { opacity: .5; }
.admin-table td.actions { text-align: right; }
.admin-table td.actions > * + * { margin-left: 6px; }
.admin-table .who { display: grid; gap: 2px; }
.admin-table .who small { font-size: 11px; color: var(--ink-faint); }
.admin-table .live-tag { color: var(--green) !important; }
.code-btn { border: 0; background: none; padding: 0; color: var(--ink); font-family: var(--mono); font-size: 12px; cursor: copy; }
.code-btn:hover { color: var(--accent); }
.credit-input { width: 72px; height: 26px; padding: 0 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg-deep); color: var(--ink); font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; border: 1px solid var(--line); color: var(--ink-soft); }
.pill.active, .pill.user { color: var(--green); border-color: #7ac28a55; }
.pill.admin { color: var(--accent); border-color: #bd968677; }
.pill.used, .pill.expired, .pill.revoked { color: var(--ink-faint); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: #e07a7a66; background: #e07a7a14; }

.app-toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 100;
  max-width: calc(100vw - 32px); padding: 9px 14px; border-radius: 8px;
  background: var(--panel-3); border: 1px solid var(--line-strong); color: var(--ink); font-size: 12.5px;
  box-shadow: 0 16px 40px -16px #000; white-space: pre-line;
}
.app-toast.error { border-color: #e07a7a77; color: #f0a0a0; }

@media (max-width: 760px) {
  .cluster-pill { display: none; }
  .invite-form label.grow input { width: 140px; }
}
.acc-credit { display: flex; justify-content: space-between; align-items: baseline; }
.acc-credit span { font-size: 12px; color: var(--ink-soft); }
.acc-credit b { font-family: var(--display); font-size: 22px; font-weight: 400; }

/* ---------------------------------------------------------------- billing */

button.credit-pill { font: inherit; font-family: var(--mono); cursor: pointer; }
button.credit-pill:hover { border-color: var(--line-strong); background: #ffffff0d; }
button.credit-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.billing-dialog { width: min(calc(100vw - 32px), 460px); }
.bill-balance { padding: 4px 0 16px; display: grid; gap: 4px; }
.bill-balance div { display: flex; justify-content: space-between; align-items: baseline; }
.bill-balance span { font-size: 12px; color: var(--ink-soft); }
.bill-balance b { font-family: var(--display); font-size: 34px; font-weight: 400; font-variant-numeric: tabular-nums; }

.topup { padding: 16px 0; border-top: 1px solid var(--line); }
.topup h3, .bill-history h3 { font-size: 13px; font-weight: 500; }
.topup [hidden] { display: none !important; }
.seg { display: inline-grid; grid-auto-flow: column; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: #ffffff05; justify-self: start; }
.seg label { display: block !important; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 5px 16px; border-radius: 5px; font-size: 12.5px; color: var(--ink-soft); }
.seg input:checked + span { background: #ffffff14; color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.amounts { display: flex; flex-wrap: wrap; gap: 6px; }
.amounts button {
  height: 34px; min-width: 56px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg-deep); color: var(--ink);
  font-variant-numeric: tabular-nums; cursor: pointer;
}
.amounts button.on { border-color: var(--accent); background: #bd968614; }
.amounts .custom { display: flex !important; align-items: center; gap: 4px !important; grid-auto-flow: column; color: var(--ink-soft); font-size: 13px; }
.amounts .custom input { width: 76px; height: 34px !important; }
.topup .wallet-btn { margin-top: 2px; }
.topup-status { font-size: 12.5px; color: var(--sol-b); line-height: 1.5; }

.bill-history { padding-top: 14px; border-top: 1px solid var(--line); }
.bill-history ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; max-height: 220px; overflow: auto; }
.bill-history li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.bill-history li:last-child { border-bottom: 0; }
.bill-history .what { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.bill-history .what b { font-weight: 500; }
.bill-history .what small { color: var(--ink-faint); font-size: 11px; }
.bill-history .what a { color: var(--ink-faint); font-size: 11px; text-decoration: none; }
.bill-history .what a:hover { color: var(--accent); }
.bill-history .plus { color: var(--green); font-variant-numeric: tabular-nums; }
.bill-history .minus { color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.settings-grid label { display: grid; gap: 5px; font-size: 11.5px; color: var(--ink-soft); }
.settings-grid .wide { grid-column: 1 / -1; }
.settings-grid input[type=text], .settings-grid input[type=url], .settings-grid input[type=number], .settings-grid select {
  height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-deep); color: var(--ink); outline: none; font: inherit; font-size: 12.5px;
}
.settings-grid #set-treasury { font-family: var(--mono); }
.settings-grid input:focus, .settings-grid select:focus { border-color: var(--accent); }
.settings-grid label.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink); }
.settings-grid label.check input { accent-color: var(--accent); }
.admin-table a { color: var(--ink-soft); font-family: var(--mono); font-size: 11.5px; }
.admin-table a:hover { color: var(--accent); }

[hidden] { display: none !important; }

.top-link { font-size: 12px; color: var(--ink-soft); }
.top-link:hover { color: var(--ink); }
