:root {
  --bg: #121110; --bg2: #1a1917; --line: #2b2926; --line2: #3a3733;
  --ink: #efe9e1; --ink2: #b7ada1; --mute: #7d756c;
  --acc: #ff5b24; --acc-ink: #1a0c05; --sand: #d9b77a; --ok: #8fc27a; --bad: #e0685a;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Geist", ui-sans-serif, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --r: 14px; --pad: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
body::before { /* paper grain */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: var(--mono); font-size: .88em; background: var(--bg2); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--mute); }
[hidden] { display: none !important; }

/* top */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) var(--pad) 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.mark { font: italic 30px/1 var(--serif); letter-spacing: -.01em; }
.mark.big { font-size: 56px; margin: 0 0 8px; }
.sub { font: 11px var(--mono); color: var(--mute); text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.crawler { display: flex; align-items: center; gap: 8px; max-width: 55%; background: none; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; font: 12px var(--mono); color: var(--ink2); }
.crawler span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mute); flex: none; }
.dot.crawling { background: var(--acc); box-shadow: 0 0 0 0 var(--acc); animation: pulse 1.6s infinite; }
.dot.waiting, .dot.done, .dot.night { background: var(--ok); }
.dot.cooldown, .dot.paused { background: var(--sand); }
.dot.logged_out, .dot.challenge, .dot.cloud_down, .dot.offline { background: var(--bad); }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

main { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding: 18px var(--pad) 24px; }

/* tabs */
.tabs { position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.tabs button { background: none; border: 0; padding: 8px 4px; color: var(--mute); font: 500 12px var(--sans);
  display: flex; flex-direction: column; align-items: center; gap: 2px; border-radius: 10px; }
.tabs button .n { font: 500 15px var(--mono); color: var(--ink2); min-height: 20px; }
.tabs button:not(:has(.n))::before { content: "·"; font: 500 15px var(--mono); min-height: 20px; }
.tabs button.on { color: var(--ink); background: var(--bg2); }
.tabs button.on .n { color: var(--acc); }

/* buttons */
.btn { border: 1px solid var(--line2); background: var(--bg2); border-radius: 12px; padding: 12px 14px; font-weight: 500;
  transition: transform .08s, background .15s, border-color .15s; }
.btn:active { transform: scale(.98); }
a.btn { text-decoration: none; color: inherit; display: inline-grid; place-items: center; text-align: center; }
.btn:hover { border-color: var(--mute); }
.btn.primary { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); font-weight: 600; }
.btn.ghost { background: none; }
.btn.small { padding: 7px 10px; font-size: 13px; border-radius: 9px; }
.btn.danger { color: var(--bad); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.row { display: flex; gap: 8px; }
.row > .btn { flex: 1; }

/* prospect card */
.card { position: relative; background: var(--bg2); border: 1px solid var(--line); border-radius: 20px; padding: 18px;
  animation: in .35s cubic-bezier(.2,.8,.2,1); }
@keyframes in { from { opacity: 0; transform: translateY(10px); } }
.who { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; }
.ava { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--line); border: 1px solid var(--line2); }
.ava.ph { display: grid; place-items: center; font: italic 28px var(--serif); color: var(--mute); }
.handle { font: italic 30px/1.02 var(--serif); letter-spacing: -.01em; word-break: break-all; color: var(--ink); text-decoration: none; }
.handle:hover { color: var(--acc); }
.meta { font: 12px var(--mono); color: var(--ink2); margin-top: 4px; }
.fit { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; font: 400 34px/1 var(--serif);
  border: 1.5px solid currentColor; }
.fit small { font: 10px var(--mono); display: block; margin-top: -8px; }
.fit.A { color: var(--acc); } .fit.B { color: var(--sand); } .fit.C { color: var(--mute); }
.why { font: italic 21px/1.3 var(--serif); margin: 16px 0 6px; color: var(--ink); }
.facts { list-style: none; margin: 10px 0 0; padding: 0; font: 13px/1.55 var(--mono); color: var(--ink2); }
.facts li { padding-left: 16px; position: relative; }
.facts li::before { content: "▸"; position: absolute; left: 0; color: var(--acc); }
.label { font: 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--mute); margin: 18px 0 6px; display: flex; justify-content: space-between; align-items: center; }
.bio { white-space: pre-wrap; color: var(--ink2); font-size: 14px; max-height: 4.6em; overflow: hidden; position: relative; cursor: pointer; }
.bio.open { max-height: none; }
.points { margin: 0; padding-left: 18px; color: var(--ink2); font-size: 14px; }
.points li { margin: 2px 0; }
.links { display: flex; flex-wrap: wrap; gap: 6px 14px; font: 12px var(--mono); }
.links a { color: var(--ink2); text-decoration: underline; text-decoration-color: var(--line2); text-underline-offset: 3px; overflow-wrap: anywhere; }
textarea.dm { width: 100%; min-height: 128px; resize: vertical; field-sizing: content; max-height: 60vh; background: var(--bg); border: 1px solid var(--line2); border-radius: 14px;
  padding: 14px; font: 16px/1.5 var(--sans); color: var(--ink); }
textarea.dm:focus, input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--acc) 60%, transparent); outline-offset: 1px; }
.dm-tools { display: flex; gap: 8px; margin-top: 8px; }
.dm-tools input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; font-size: 13px; }
.chars { font: 11px var(--mono); color: var(--mute); }
.actions { display: grid; gap: 8px; margin-top: 16px; }
.actions .primary { padding: 16px; font-size: 16px; }
.loading { opacity: .55; }
.skel { height: 128px; border-radius: 14px; background: linear-gradient(90deg, var(--bg) 0, var(--line) 50%, var(--bg) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.after { font: 12px var(--mono); color: var(--mute); text-align: center; margin-top: 14px; }

/* filters */
.filters { display: flex; gap: 6px; margin-bottom: 14px; align-items: center; }
.filters .lbl { font: 11px var(--mono); color: var(--mute); text-transform: uppercase; letter-spacing: .08em; margin-right: 4px; }
.seg { border: 1px solid var(--line); background: none; border-radius: 9px; padding: 5px 11px; font: 13px var(--mono); color: var(--mute); }
.seg.on { color: var(--ink); border-color: var(--line2); background: var(--bg2); }

/* empty */
.empty { text-align: center; padding: 48px 12px; }
.empty .big { font: italic 40px/1.1 var(--serif); margin: 0 0 12px; }
.empty p { color: var(--ink2); max-width: 36ch; margin: 8px auto; }

/* lists (pipeline, seeds) */
h2 { font: italic 34px/1.1 var(--serif); margin: 4px 0 14px; font-weight: 400; }
h3 { font: 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--mute); margin: 26px 0 8px; font-weight: 500; display: flex; justify-content: space-between; }
.item { border-top: 1px solid var(--line); padding: 12px 0; }
.item-h { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; cursor: pointer; }
.item-h .ava { width: 40px; height: 40px; }
.item-h .ava.ph { font-size: 18px; }
.item-name { font: italic 21px/1.1 var(--serif); }
.item-sub { font: 12px var(--mono); color: var(--mute); }
.due { color: var(--acc); }
.item-b { padding: 12px 0 4px 52px; display: grid; gap: 10px; }
.sent-text { white-space: pre-wrap; font-size: 14px; color: var(--ink2); border-left: 2px solid var(--line2); padding-left: 10px; }
.bubble { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; }
.bubble .sent-text { color: var(--ink); }
.status-row { display: flex; flex-wrap: wrap; gap: 6px; }
.status-row .btn.on { border-color: var(--acc); color: var(--acc); }
.note { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 14px; }

/* forms */
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.panel p { margin: 0 0 10px; color: var(--ink2); font-size: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font: 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--mute); }
.field small { color: var(--mute); font-size: 12px; }
.field input, .field textarea, .field select, .panel textarea, .panel input { width: 100%; background: var(--bg); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; font-size: 15px; }
.field textarea, .panel textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.switch { width: 50px; height: 30px; border-radius: 999px; background: var(--line2); border: 0; position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); transition: transform .2s; }
.switch.on { background: var(--acc); }
.switch.on::after { transform: translateX(20px); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font: 13px var(--mono); color: var(--ink2); }
.kv b { color: var(--ink); font-weight: 500; }
.log { font: 11.5px/1.55 var(--mono); color: var(--ink2); background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; max-height: 260px; overflow: auto; white-space: pre-wrap; margin: 10px 0 0; }
.seedrow { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.seedrow .item-name { font-size: 19px; }
.seedrow.off { opacity: .45; }
.kind-hub { color: var(--acc); }
.bar { height: 3px; background: var(--line); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--acc); }

/* sheet / gate / toast */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet-card { width: min(640px, 100%); background: var(--bg2); border-top: 1px solid var(--line2); border-radius: 22px 22px 0 0; padding: 22px var(--pad) calc(22px + env(safe-area-inset-bottom)); }
.sheet-q { font: italic 26px/1.2 var(--serif); margin: 0 0 16px; }
.sheet-q b { font-weight: 400; color: var(--acc); }
@keyframes fade { from { opacity: 0; } }
.gate { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: grid; place-items: center; padding: var(--pad); }
.gate-card { width: min(380px, 100%); display: grid; gap: 12px; }
.gate-card input { background: var(--bg2); border: 1px solid var(--line2); border-radius: 12px; padding: 12px; }
.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; z-index: 40;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font: 500 14px var(--sans); transition: .2s; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); color: #fff; }

@media (max-width: 480px) { .sub { display: none; } }
@media (min-width: 720px) {
  main { padding-top: 28px; }
  .handle { font-size: 36px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
