:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --ink: #141414;
  --muted: #6d6a66;
  --line: #e6e2dc;
  --red: #e8232e;
  --red-dark: #c51a24;
  --red-soft: #fdecec;
  --green: #1d7a4c;
  --green-soft: #e6f4ec;
  --amber: #8a5a00;
  --amber-soft: #fbf1dc;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.55 Inter, system-ui, sans-serif; }
h1, h2, h3, .brand { font-family: Montserrat, Inter, sans-serif; letter-spacing: -0.01em; }
h1 { font-size: 30px; font-weight: 800; line-height: 1.15; margin: 0 0 12px; }
h2 { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
h3 { font-size: 15px; font-weight: 700; margin: 0; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.brand { font-size: 22px; font-weight: 800; }
.brand span { color: var(--red); }

/* connect + message pages */
body.plain { display: grid; place-items: center; min-height: 100dvh; padding: 16px; }
.sheet { width: min(100%, 480px); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px; }
.sheet .brand { margin-bottom: 28px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--red); margin-bottom: 8px; }
.lead { font-size: 17px; }
.facts { list-style: none; margin: 20px 0 24px; padding: 0; display: grid; gap: 10px; }
.facts li { padding-left: 22px; position: relative; color: #3b3936; }
.facts li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 14px Inter, sans-serif; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: #bdb8b0; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); }
.btn.danger { color: var(--red-dark); }
.btn.big { width: 100%; min-height: 48px; font-size: 15px; }
.btn[disabled] { opacity: 0.55; cursor: default; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
input, textarea, select { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: 400 15px/1.5 Inter, sans-serif; }
textarea { resize: vertical; }

/* app shell */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1040px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; }
.tab { border: 0; background: none; padding: 8px 12px; border-radius: 8px; font: 600 14px Inter, sans-serif; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); background: var(--bg); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 16px 64px; display: grid; gap: 16px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: grid; gap: 8px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--muted); }
.pill.good { background: var(--green-soft); color: var(--green); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.pill.bad { background: var(--red-soft); color: var(--red-dark); }
.body-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--bg); object-fit: cover; flex: none; }
.thumb { max-width: 220px; max-height: 160px; border-radius: 8px; border: 1px solid var(--line); display: block; }
.link-box { font-size: 13px; background: var(--bg); padding: 8px 10px; border-radius: 8px; overflow-wrap: anywhere; }
.hooks { margin: 0; padding-left: 18px; font-size: 14px; color: #3b3936; }
.error { color: var(--red-dark); font-size: 14px; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.output { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); border-radius: 8px; padding: 12px; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; max-width: calc(100vw - 32px); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
#toast.show { opacity: 1; }
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.gate .sheet { display: grid; gap: 14px; }
.gate .brand { margin-bottom: 8px; }
.or { text-align: center; font-size: 13px; color: var(--muted); }
@media (max-width: 560px) {
  .sheet { padding: 24px 20px; }
  .top-in { justify-content: space-between; }
  .tabs { order: 3; flex-basis: 100%; }
  h1 { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
