/*
 * SO Bundler: X signal desk.
 * Light X palette, X system fonts, pill buttons, white 16px panels. No shadows, no gradients, no animation.
 */

:root {
  color-scheme: light;

  --bg: #f7f9f9;
  --panel: #ffffff;
  --line: #eff3f4;
  --line-2: #cfd9de;
  --ink: #0f1419;
  --ink-2: #536471;
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --accent-soft: #e8f5fd;
  --ok: #00ba7c;
  --warn: #ffad1f;
  --bad: #f4212e;

  --silver: #536471;
  --silver-bg: #eff3f4;
  --gold: #8a5a00;
  --gold-bg: #fff4d6;

  /* hover washes, derived from --ink and --bad */
  --wash: rgba(15, 20, 25, 0.06);
  --bad-wash: rgba(244, 33, 46, 0.08);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.4 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: 20px; line-height: 24px; font-weight: 700; }
h2, h3 { font-size: 15px; line-height: 20px; font-weight: 700; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font: 13px/1.4 var(--mono); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.hint { max-width: 80ch; color: var(--ink-2); font-size: 13px; }
.hint:empty { display: none; }
.muted { color: var(--ink-2); }
.msg { color: var(--ink-2); }
.msg:empty { display: none; }
.msg.err { color: var(--bad); }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }

/* ---------- sign in ---------- */

.login { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.panel.login-card { width: min(400px, 100%); gap: 16px; padding: 32px; }

.brand b { display: block; font-size: 20px; line-height: 24px; font-weight: 700; }
.brand span { display: block; margin-top: 2px; color: var(--ink-2); font-size: 13px; }

/* ---------- shell and sidebar ---------- */

.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); }
.side-in { position: sticky; top: 0; display: flex; flex-direction: column; gap: 24px; height: 100vh; padding: 20px 12px 16px; overflow-y: auto; }
.side .brand { padding: 0 12px; }

#nav { display: grid; gap: 2px; }
#nav a { display: block; padding: 10px 16px; border-radius: 999px; color: var(--ink); line-height: 20px; }
#nav a:hover { background: var(--line); text-decoration: none; }
#nav a[aria-current] { background: var(--accent-soft); font-weight: 700; }

.side-foot { display: grid; gap: 16px; margin-top: auto; padding: 16px 12px 0; border-top: 1px solid var(--line); }
.stream { display: grid; justify-items: start; gap: 6px; }
.spend { display: grid; gap: 6px; }
.spend-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--ink-2); font-size: 13px; }
.spend-top b { color: var(--ink); font-weight: 700; }
.spend-note { color: var(--bad); font-size: 13px; }
.who { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-2); font-size: 13px; }

.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); font-size: 13px; font-weight: 700; line-height: 1; white-space: nowrap; }
.toolbar .pill { max-width: 100%; padding: 6px 14px; white-space: normal; line-height: 1.3; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

.meter { height: 6px; overflow: hidden; border-radius: 999px; background: var(--line); }
.meter > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.meter.warn > i { background: var(--warn); }
.meter.bad > i { background: var(--bad); }

/* ---------- page ---------- */

main { min-width: 0; padding: 0 32px 64px; }
.page { display: grid; gap: 16px; align-content: start; max-width: 1080px; margin: 0 auto; }
.page > * { min-width: 0; }
.page div:empty { display: none; }

.page-head { display: flex; align-items: flex-start; gap: 16px; padding-top: 28px; padding-bottom: 4px; }
.page-head > div:first-child { flex: 1; min-width: 0; }
.page-head p { max-width: 80ch; margin-top: 4px; color: var(--ink-2); }
.actions { display: flex; flex: none; gap: 8px; }

.tools { display: grid; gap: 8px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* ---------- buttons ---------- */

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 700; line-height: 1; white-space: nowrap; text-decoration: none;
  cursor: pointer;
}
button:hover:not(:disabled), .btn:hover { background: var(--accent-hover); text-decoration: none; }
button:disabled { opacity: 0.5; cursor: default; }
button.secondary, .btn.secondary { border-color: var(--line-2); background: var(--panel); color: var(--ink); }
button.secondary:hover:not(:disabled), .btn.secondary:hover { background: var(--wash); }
button.danger { border-color: var(--line-2); background: var(--panel); color: var(--bad); }
button.danger:hover:not(:disabled) { background: var(--bad-wash); }
button.sm, .btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
button.wide { width: 100%; }
.more { justify-self: center; }

/* ---------- form controls ---------- */

input:not([type=checkbox]), select, textarea {
  width: 100%; min-height: 36px; padding: 7px 12px;
  border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--panel); color: var(--ink); line-height: 20px;
}
input:not([type=checkbox]):focus, select:focus, textarea:focus { border-color: var(--accent); outline: 1px solid var(--accent); outline-offset: -1px; }
::placeholder { color: var(--ink-2); font-weight: 400; opacity: 0.7; }
.field input, .field select, .field textarea { color: var(--ink); font-weight: 400; }
textarea { display: block; resize: vertical; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23536471' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

input.toggle { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 40px; height: 24px; padding: 0; border: 0; border-radius: 999px; background: var(--line-2); cursor: pointer; vertical-align: middle; }
input.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; }
input.toggle:checked { background: var(--accent); }
input.toggle:checked::after { left: 18px; }

.field { display: grid; gap: 6px; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.field.inline { display: flex; align-items: center; gap: 8px; }
.field.inline select { width: auto; }
.field.grow { flex: 1 1 200px; min-width: 0; }
.check { display: flex; align-items: center; gap: 8px; min-height: 36px; color: var(--ink); font-size: 15px; font-weight: 400; }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.row.end { justify-content: flex-end; }

/* ---------- panels ---------- */

.panel { display: grid; gap: 12px; align-content: start; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel.flush { position: relative; display: block; padding: 0; overflow: hidden; }
.pad { display: grid; gap: 12px; padding: 16px; }
.section { display: grid; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.empty { display: grid; justify-items: center; gap: 12px; padding: 32px 16px; text-align: center; }
.empty p { max-width: 52ch; color: var(--ink-2); }
p.panel-line:not(:empty) { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.stack { display: grid; gap: 16px; align-content: start; }
.cards { display: grid; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }

/* ---------- tables ---------- */

.tbl { container-type: inline-size; overflow-x: auto; }
.boxed { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
#entities-list > *, #fires-list > * { border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px; border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: 13px; font-weight: 700; text-align: left; white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: break-word; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg); }
tbody tr.open { background: var(--accent-soft); }
td code { overflow-wrap: anywhere; }
td.end { text-align: right; white-space: nowrap; }
.btns { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.sub { display: block; color: var(--ink-2); font-size: 13px; }
.row-link { font-weight: 700; }
.row-link + .chip { margin-left: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* a table that gets narrow becomes a list of small cards, so nothing scrolls sideways */
@container (max-width: 720px) {
  table, tbody, tr, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  tbody tr:last-child { border-bottom: 0; }
  td, td:first-child, td:last-child { display: flex; align-items: baseline; gap: 12px; padding: 4px 0; border: 0; text-align: left; }
  td:empty { display: none; }
  td > * { min-width: 0; }
  td::before { content: attr(data-label); flex: 0 0 84px; color: var(--ink-2); font-size: 13px; font-weight: 700; }
  td[data-label=""]::before { display: none; }
  td.end { justify-content: flex-start; }
  td.center { align-items: center; }
}

/* ---------- posts and events, laid out like posts on X ---------- */

.tweet { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 12px 16px; }
.tweet + .tweet { border-top: 1px solid var(--line); }
.tweet:hover { background: var(--bg); }

.avatar { position: relative; display: grid; place-items: center; flex: none; width: 40px; height: 40px; overflow: hidden; border-radius: 50%; background: var(--line-2); color: var(--ink); font-weight: 700; user-select: none; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.has-img { color: transparent; }
.avatar.sm { width: 24px; height: 24px; font-size: 12px; }

.t-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.t-who { min-width: 0; overflow-wrap: anywhere; }
.t-name { font-weight: 700; }
.t-sub { color: var(--ink-2); }
.t-tags { display: flex; flex: none; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.t-text { max-width: 72ch; margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.t-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-top: 8px; color: var(--ink-2); font-size: 13px; }
.t-foot details[open], .signal-foot details[open] { flex: 1 0 100%; }
.tag { color: var(--accent); }
.tag.ca { font-family: var(--mono); font-size: 13px; }

.quote { display: grid; gap: 4px; margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.quote-head { display: flex; align-items: center; gap: 8px; min-width: 0; }

.kit { display: grid; gap: 8px; margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.kit-title { font-size: 13px; font-weight: 700; }
.kit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { display: block; width: 64px; height: 64px; border: 1px solid var(--line); border-radius: 12px; background: var(--line); object-fit: cover; }

.signal { gap: 8px; }
.signal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.signal-head time { margin-left: auto; color: var(--ink-2); font-size: 13px; }
.signal-line { overflow-wrap: anywhere; }
.signal-line b { font-weight: 700; }
.signal-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }

/* ---------- chips ---------- */

.chip { display: inline-flex; align-items: center; min-height: 24px; max-width: 100%; padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); color: var(--ink-2); font-size: 13px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.t-tags .chip { white-space: nowrap; }
.chip.name { border-color: transparent; background: var(--accent-soft); color: var(--ink); }
.chip.mono { border-color: transparent; background: var(--line); color: var(--ink); font: 600 13px/1.2 var(--mono); }
.chip.silver { border-color: transparent; background: var(--silver-bg); color: var(--silver); font-weight: 700; }
.chip.gold { border-color: transparent; background: var(--gold-bg); color: var(--gold); font-weight: 700; }

/* ---------- results ---------- */

.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 24px; }
.kv > div { min-width: 0; }
.kv dt { color: var(--ink-2); font-size: 13px; }
.kv dd { margin: 2px 0 0; overflow-wrap: anywhere; font-weight: 600; }
.kv .wide { grid-column: 1 / -1; }
.kv dd code { font-weight: 400; }
.result { display: grid; gap: 16px; padding-top: 4px; }
.list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
#sim-out { display: grid; gap: 12px; }

details.raw > summary { width: fit-content; color: var(--ink-2); font-size: 13px; cursor: pointer; }
details.raw > summary:hover { color: var(--ink); }
pre { max-height: 360px; margin: 8px 0 0; padding: 12px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); white-space: pre-wrap; overflow-wrap: anywhere; }

.meter-row { display: grid; gap: 6px; }
.meter-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.meter-top span { color: var(--ink-2); }
.meter-top b { font-weight: 700; }

.status-list { display: grid; }
.status-list > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.status-list > div:last-child { border-bottom: 0; }
.state { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }

/* ---------- studio ---------- */

.studio { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.studio .panel { gap: 16px; }
.ideas { display: grid; }
.idea { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.idea:last-child { border-bottom: 0; }
.idea b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.slot { display: grid; gap: 8px; }
.slot > .hint { display: grid; place-items: center; min-height: 96px; border-radius: 12px; background: var(--bg); text-align: center; }
.slot .gen { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; }
.slot.logo .gen { max-width: 320px; }
.slot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- tweet to pump.fun ---------- */

.pump-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.pump-col { display: grid; gap: 16px; align-content: start; min-width: 0; }
.pump-col .slot { gap: 12px; }
#pump-notes { max-width: none; }
.pump-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.count { font-weight: 400; font-variant-numeric: tabular-nums; }
.count.over { color: var(--bad); font-weight: 700; }
.pump-ctl { display: flex; align-items: flex-start; gap: 8px; }
.pump-ctl > :first-child { flex: 1; min-width: 0; }
.pump-alts { display: grid; gap: 8px; }
.alts { display: flex; flex-wrap: wrap; gap: 8px; }
.alt { width: 64px; height: 64px; padding: 0; overflow: hidden; border: 2px solid var(--line); border-radius: 12px; background: var(--line); }
.alt:hover:not(:disabled) { border-color: var(--line-2); background: var(--line); }
.alt[aria-pressed=true] { border-color: var(--accent); }
.alt img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pump-src .tweet { border-top: 1px solid var(--line); }

/* ---------- new key, toasts, dialog ---------- */

.key { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--accent); border-radius: 16px; background: var(--accent-soft); }
.key code { padding: 8px 12px; border-radius: 8px; background: var(--panel); overflow-wrap: anywhere; user-select: all; }
.key .row { align-items: center; }

#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; overflow-wrap: anywhere; pointer-events: auto; cursor: pointer; }
.toast .dot { margin-top: 7px; }

dialog { width: min(400px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: 16px; background: var(--panel); color: var(--ink); }
dialog::backdrop { background: rgba(91, 112, 131, 0.4); }
dialog form { display: grid; gap: 12px; }
dialog h2 { font-size: 20px; line-height: 24px; }
dialog p { color: var(--ink-2); }

/* ---------- small screens ---------- */

@media (max-width: 1060px) {
  .grid-2, .studio, .pump-cols { grid-template-columns: minmax(0, 1fr); }
  .pump-cols { gap: 16px; }
  .pump-col + .pump-col { padding-top: 16px; border-top: 1px solid var(--line); }
}

@media (max-width: 759px) {
  .shell { display: block; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  .side-in { position: static; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; height: auto; padding: 12px 16px; overflow: visible; }
  .side .brand { grid-area: 1 / 1; padding: 0; }
  .side-foot { display: contents; }
  .who { grid-area: 1 / 2; }
  #nav { grid-area: 2 / 1 / 3 / 3; display: flex; flex-wrap: wrap; gap: 4px; }
  #nav a { padding: 6px 10px; }
  .stream { grid-area: 3 / 1; align-self: center; }
  .spend { grid-area: 3 / 2; align-self: center; min-width: 148px; }

  main { padding: 0 16px 48px; }
  .page-head { flex-direction: column; gap: 12px; padding-top: 20px; }
  .t-head { flex-direction: column; gap: 6px; }
  .t-tags { justify-content: flex-start; }
  .login { padding: 16px; }
  .login-card { padding: 24px; }
  .row.end { justify-content: flex-start; }
}
