:root {
  --bg: #f4f6f9; --card: #ffffff; --ink: #1b2430; --mute: #5b6877; --line: #d9dfe7;
  --brand: #1f3a5f; --brand-ink: #ffffff; --red: #d92d20; --green: #1a7f4b; --amber: #a15c07;
  --soft: #e8eef6;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11161d; --card: #1a222c; --ink: #e8edf3; --mute: #9aa7b6; --line: #2c3745;
          --brand: #5b8fd6; --brand-ink: #0b1118; --soft: #223044; --red: #ff6b5e; --green: #4cc38a; --amber: #e0a24a; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { min-height: 100vh; -webkit-text-size-adjust: 100%; }
#app { max-width: 640px; margin: 0 auto; padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }
h1 { font-size: 22px; margin: 18px 0 4px; }
h2 { font-size: 17px; margin: 18px 0 8px; }
p { margin: 6px 0; }
.mute { color: var(--mute); font-size: 14px; }
.bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 6px; }
.bar b { font-size: 20px; }
button, .btn { font: inherit; min-height: 48px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer; }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
button.danger { color: var(--red); }
button:disabled { opacity: .5; cursor: default; }
button.link { min-height: 44px; min-width: 44px; border: 0; background: none; color: var(--brand); padding: 8px; }
input, select, textarea { font: inherit; width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); }
textarea { min-height: 84px; resize: vertical; }
label { display: block; margin: 12px 0 4px; font-size: 14px; color: var(--mute); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 10px 0; }
.card.unheard { border-left: 6px solid var(--red); }
.card.expired { opacity: .6; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.row > .fit { flex: 0 0 auto; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--red); margin-right: 8px; vertical-align: middle; }
.badge { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 11px; background: var(--red); color: #fff; font-size: 13px; font-weight: 700; text-align: center; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs button { flex: 1; border: 0; border-radius: 0; background: none; min-height: 58px; font-size: 14px; color: var(--mute); }
/* Inbox and Send are the two things everyone does: bigger and wider than Sent and Admin */
.tabs button:nth-child(-n+2) { flex: 2; min-height: 72px; font-size: 18px; font-weight: 700; }
.tabs button.on { color: var(--brand); font-weight: 700; }
.who { font-weight: 700; }
.msg { font-size: 18px; margin: 8px 0; word-break: break-word; }
.answers { display: flex; gap: 8px; margin-top: 10px; }
.answers button { flex: 1; padding: 10px 6px; }
.answers button.sel { background: var(--soft); border-color: var(--brand); font-weight: 700; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 9px; background: var(--soft); font-size: 13px; margin: 2px 4px 2px 0; }
.err { color: var(--red); margin: 8px 0; min-height: 20px; }
.ok { color: var(--green); }
.pick { display: block; width: 100%; text-align: left; margin: 6px 0; }
.mic { width: 100%; min-height: 96px; font-size: 20px; font-weight: 700; border-radius: 18px; }
.live { background: var(--red); color: #fff; border-color: var(--red); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .78; } }
.micbar { position: sticky; top: 0; z-index: 6; background: var(--red); color: #fff; text-align: center; padding: 10px; font-weight: 700; margin: 0 -16px; }
.phrases { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.phrases button { min-height: 44px; padding: 8px 12px; border-radius: 22px; }
.pin { font-size: 22px; letter-spacing: 8px; text-align: center; }
.big { font-size: 28px; font-weight: 700; letter-spacing: 6px; }
.empty { text-align: center; padding: 36px 8px; color: var(--mute); }
audio { width: 100%; margin-top: 6px; }
.count { font-variant-numeric: tabular-nums; }

/* Home: Inbox and Send fill the first screen, the rest sits below the fold */
.home-pair { display: flex; flex-direction: column; gap: 14px; min-height: calc(100vh - 170px); min-height: calc(100dvh - 170px); margin: 10px 0 18px; }
.big-btn { flex: 1; border: 0; border-radius: 22px; font-size: 40px; font-weight: 800; color: #fff; min-height: 160px; position: relative; }
.big-btn.inbox { background: var(--brand); }
.big-btn.send { background: #1f7a4d; }
.badge.big { font-size: 24px; min-width: 40px; padding: 4px 14px; border-radius: 22px; margin-left: 14px; vertical-align: middle; }
