:root {
  --bg: #faf7f2;
  --ink: #1f1a14;
  --muted: #7a6f61;
  --accent: #d4500f;
  --accent-dark: #a83e0a;
  --card: #ffffff;
  --line: #e8e0d4;
  --content: 960px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

main { max-width: var(--content); margin: 0 auto; padding: 1.5rem 1rem 4rem; }

/* ---- Top bar ---- */

.topbar { border-bottom: 1px solid var(--line); background: var(--card); }
.topbar-inner {
  max-width: var(--content); margin: 0 auto; padding: 0.7rem 1rem;
  display: flex; justify-content: space-between; align-items: center;
}
.topbar nav { display: flex; gap: 1.25rem; align-items: center; }
.brand { font-weight: 800; font-size: 1.15rem; text-decoration: none; color: var(--ink); }

a { color: var(--accent-dark); }

/* ---- Type ---- */

h1 { font-size: 1.6rem; letter-spacing: -0.02em; margin: 0; }

.page-head {
  display: flex; align-items: baseline; gap: 0.75rem;
  margin: 0.25rem 0 1.25rem;
}

.muted { color: var(--muted); font-weight: 400; }

/* ---- Cards ---- */

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 1.1rem 1.25rem 1.25rem; margin-bottom: 1.25rem;
}
.card h3 {
  display: flex; align-items: center; gap: 0.5rem;
  margin: 0 0 0.85rem;
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted);
}
.card > :last-child { margin-bottom: 0; }
.card p { margin: 0.5rem 0; }

/* ---- Buttons & forms ---- */

.btn {
  display: inline-block; background: var(--accent); color: #fff; border: none;
  padding: 0.55rem 1.1rem; border-radius: 8px; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; text-decoration: none; line-height: 1.4;
}
.btn:hover { background: var(--accent-dark); }
.btn-lg { font-size: 1.15rem; padding: 0.75rem 1.5rem; }
.btn-sm { font-size: 0.85rem; padding: 0.35rem 0.75rem; }
.btn-ghost { background: transparent; color: var(--accent-dark); border: 1px solid var(--accent); }
.btn-ghost:hover { background: #fdf0e8; }

.linklike {
  background: none; border: none; color: var(--accent-dark); cursor: pointer;
  padding: 0; font-size: inherit; text-decoration: underline;
}

.inline { display: inline; }

label, .field-label { display: block; margin: 0.85rem 0 0; font-weight: 600; font-size: 0.9rem; }
label:first-of-type, .field-label:first-of-type { margin-top: 0; }
input {
  display: block; width: 100%; margin-top: 0.35rem; padding: 0.5rem 0.65rem;
  border: 1px solid var(--line); border-radius: 8px; font-size: 0.95rem; background: #fff;
}
input:focus { outline: 2px solid var(--accent); border-color: transparent; }
input[readonly] { color: var(--muted); font-size: 0.85rem; }
form .btn { margin-top: 1rem; }

.copy-row { display: flex; gap: 0.5rem; align-items: stretch; margin-top: 0.35rem; }
.copy-row input { flex: 1; margin-top: 0; min-width: 0; }
.copy-row .btn { margin-top: 0; white-space: nowrap; }

/* ---- Landing ---- */

.hero { text-align: center; padding: 3rem 0 1rem; }
.hero h1 { font-size: 2.4rem; margin-bottom: 1rem; }
.lede { max-width: 560px; margin: 1rem auto; color: var(--muted); font-size: 1.1rem; }
.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem; margin-top: 2.5rem; text-align: left;
}
.cards .card { margin-bottom: 0; }
.cards .card h3 { font-size: 1rem; text-transform: none; letter-spacing: 0; color: var(--ink); }

/* ---- Narrow pages (auth, setup, join) ---- */

.narrow { max-width: 460px; margin: 0 auto; }
.narrow h1 { margin-bottom: 0.75rem; }

.flash { max-width: var(--content); margin: 1rem auto 0; padding: 0.6rem 1rem; border-radius: 8px; }
.flash.error { background: #fde8e8; color: #92210f; border: 1px solid #f5c2bb; }

/* ---- Dashboard ---- */

.dashboard { display: grid; grid-template-columns: 1fr 300px; gap: 1.25rem; align-items: start; }
@media (max-width: 800px) { .dashboard { grid-template-columns: 1fr; } }

.queue-item {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.75rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.queue-item:first-of-type { padding-top: 0; }
.queue-item:last-child { border-bottom: none; padding-bottom: 0; }
.queue-item p { margin: 0.15rem 0 0; }
.actions { display: flex; gap: 0.5rem; align-items: center; }
.note { color: var(--muted); font-style: italic; }

.post-row {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.6rem 0; border-bottom: 1px solid var(--line);
}
.post-row:first-of-type { padding-top: 0; }
.post-row:last-child { border-bottom: none; padding-bottom: 0; }
.post-row a { word-break: break-all; }

.tag {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0; text-transform: none;
  background: #f1e9dd; color: var(--muted);
  border-radius: 999px; padding: 0.12rem 0.55rem; white-space: nowrap;
}
.tag.ok { background: #e3f1df; color: #2e6b22; }

.members { list-style: none; padding: 0; margin: 0 0 1rem; }
.members li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.35rem 0; border-bottom: 1px solid var(--line);
}
.members li:last-child { border-bottom: none; }

details summary { cursor: pointer; }
.card details { margin-top: 0.75rem; }

.safety { background: #fdf6ec; }
.safety ul { padding-left: 1.1rem; margin: 0; }
.safety li { margin: 0.35rem 0; }

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

.setup-steps { padding-left: 1.3rem; margin: 1.25rem 0; }
.setup-steps li { margin: 0.9rem 0; }
.waiting { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); }
.spinner {
  width: 16px; height: 16px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.connected { background: #f0f7ee; border-color: #cde3c8; }
.stale { background: #fdf2e3; border-color: #ecd9b8; }
.pin-callout { background: #fdf6ec; border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem 1rem; }
.steps { padding-left: 1.2rem; margin: 0.5rem 0; }
.steps li { margin: 0.2rem 0; }

/* ---- Footer ---- */

footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 2rem 1rem; }

code { background: #f1e9dd; padding: 0.1rem 0.3rem; border-radius: 4px; font-size: 0.85em; }

.post-link { display: block; font-size: 0.85rem; word-break: break-all; }
