:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --ink: #1b1b1f;
  --muted: #6b6b73;
  --line: #e3e3e0;
  --accent: #1f5eff;
  --accent-ink: #ffffff;
  --inbound: #ececf0;
  --outbound: #1f5eff;
  --warn: #b3261e;
  --ok: #1a7f37;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
a { color: var(--accent); }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.92em; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.top nav { display: flex; align-items: center; gap: 16px; font-size: 0.95rem; }
.top nav form { margin: 0; }
.top .who { color: var(--muted); }

main { flex: 1; width: 100%; margin: 0 auto; padding: 32px 16px 48px; }
main.narrow { max-width: 460px; }
main.wide { max-width: 760px; }
footer { padding: 16px 24px; font-size: 0.85rem; color: var(--muted); text-align: center; }

h1 { font-size: 1.6rem; margin: 0 0 8px; display: flex; align-items: center; gap: 10px; }
h2 { font-size: 1.15rem; margin: 32px 0 12px; }
.lede { color: var(--muted); margin: 0 0 24px; line-height: 1.5; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
.ok { color: var(--ok); }
.crumbs { font-size: 0.9rem; margin: 0 0 12px; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.stack { display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 0.95rem; }
input, textarea {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button, .button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: 10px 18px; border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
.primary { background: var(--accent); color: var(--accent-ink); }
button.link { background: none; border: none; padding: 0; color: var(--accent); font-weight: 400; }
.instagram { background: #000; color: #fff; padding: 12px 20px; }
.glyph { width: 1.25em; height: 1.25em; flex: none; }

.alert { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; }
.alert.error { background: #fdecea; color: var(--warn); }
.alert.info { background: #e8f0fe; color: #1a3d8f; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel p { margin: 0 0 8px; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 1.1rem; letter-spacing: 0.05em; word-break: break-all; }
.empty { color: var(--muted); padding: 24px; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

.cards { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.card a {
  display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.card .handle { display: flex; align-items: center; gap: 10px; font-weight: 600; }

.account { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; }
.account dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 16px 0 0; }
.account dt { color: var(--muted); }
.account dd { margin: 0; overflow-wrap: anywhere; }

.list { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.list li + li { border-top: 1px solid var(--line); }
.list a { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 14px 18px; color: var(--ink); text-decoration: none; }
.list .who { font-weight: 600; }
.list .preview { grid-column: 1; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .muted { grid-row: 1; grid-column: 2; font-size: 0.85rem; }

.thread { list-style: none; padding: 16px; margin: 0 0 16px; display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 160px; }
.thread .empty { border: none; }
.msg { display: flex; flex-direction: column; max-width: 75%; }
.msg.inbound { align-self: flex-start; }
.msg.outbound { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 9px 14px; border-radius: 18px; line-height: 1.4; overflow-wrap: anywhere; }
.bubble p { margin: 0; white-space: pre-wrap; }
.inbound .bubble { background: var(--inbound); }
.outbound .bubble { background: var(--outbound); color: #fff; }
.placeholder { font-style: italic; opacity: 0.8; }
.meta { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }

.composer { display: flex; flex-direction: column; gap: 10px; }
.composer textarea { resize: vertical; min-height: 84px; }
.composer .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.window { margin: 0; font-size: 0.9rem; color: var(--muted); }
.window.closed { color: var(--warn); }

.prose { line-height: 1.6; }
.prose h2 { margin-top: 28px; }

@media (max-width: 560px) {
  .top { padding: 12px 16px; flex-wrap: wrap; }
  .top .who { display: none; }
  .msg { max-width: 90%; }
  .account dl { grid-template-columns: 1fr; gap: 2px; }
  .account dd { margin-bottom: 10px; }
}
