/* Mustang Creek communications - dark, modern look inspired by Frame.io */

:root {
  --bg: #0c0d11;
  --bg-2: #101116;
  --surface: #16181f;
  --surface-2: #1c1f28;
  --surface-3: #232733;
  --line: #282c38;
  --line-2: #343a49;
  --ink: #eef0f5;
  --muted: #9aa1b2;
  --faint: #6b7384;
  --brand: #5b6cff;
  --brand-2: #7d8aff;
  --brand-soft: rgba(91, 108, 255, .14);
  --green: #36d399;
  --green-soft: rgba(54, 211, 153, .14);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, .14);
  --red: #fb6f92;
  --red-soft: rgba(251, 111, 146, .14);
  --radius: 14px;
  --radius-lg: 18px;
  --shadow: 0 1px 0 rgba(255,255,255,.02), 0 12px 32px rgba(0,0,0,.45);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 70% -10%, #15171f 0%, var(--bg) 55%) fixed;
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { color: var(--ink); }
::selection { background: var(--brand-soft); }

/* Scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.25rem;
  background: rgba(16,17,22,.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar .brand { font-weight: 700; letter-spacing: .2px; display: flex; align-items: center; gap: .55rem; flex: 0 0 auto; }
.topbar .brand .logo {
  width: 1.7rem; height: 1.7rem; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), #9a6bff);
  display: grid; place-items: center; color: #fff; font-size: .85rem; font-weight: 800;
  box-shadow: 0 4px 14px rgba(91,108,255,.45);
}
.topbar .brand small { display: block; font-weight: 500; color: var(--faint); font-size: .68rem; letter-spacing: .3px; }
.topbar nav { display: flex; gap: .15rem; margin-left: .75rem; min-width: 0; }
.topbar nav a {
  color: var(--muted); padding: .42rem .8rem; border-radius: 10px; font-size: .88rem; font-weight: 600;
}
.topbar nav a.active { background: var(--brand-soft); color: var(--brand-2); }
.topbar nav a:hover { background: var(--surface-2); color: var(--ink); }
.topbar .spacer { flex: 1; }
.whoami { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .5rem; }

.presence { display: flex; align-items: center; gap: .4rem; flex: 0 1 auto; min-width: 0; }
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--green); display: inline-block; box-shadow: 0 0 0 3px var(--green-soft); }
.dot.offline { background: #565d6e; box-shadow: none; }
.avatar {
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: linear-gradient(135deg, #3a4252, #2a2f3c);
  color: #dfe3ec; font-size: .68rem; display: grid; place-items: center; font-weight: 700;
  border: 1.5px solid var(--bg-2); margin-left: -.45rem; flex: none;
}
.avatar:first-child { margin-left: 0; }
.avatar.green { background: linear-gradient(135deg, #1f9d6b, var(--green)); color: #06291d; }
.avatar.need-avatar {
  margin-left: 0;
  background: var(--amber-soft);
  color: var(--amber);
  border-color: rgba(251,191,36,.35);
}

.wrap { max-width: 74rem; margin: 1.5rem auto; padding: 0 1.25rem; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; margin-bottom: 1.1rem; }
.toolbar .grow { flex: 1; }
.toolbar h1, .toolbar strong { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }

/* Buttons */
.btn {
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink);
  padding: .5rem .9rem; border-radius: 10px; cursor: pointer; font: inherit; font-size: .88rem; font-weight: 600;
}
.btn:hover { background: var(--surface-3); border-color: #41485a; }
.btn:active { transform: none; }
.btn.primary { background: linear-gradient(135deg, var(--brand), #6f7bff); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(91,108,255,.35); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.approve { background: linear-gradient(135deg, #21b783, var(--green)); border-color: transparent; color: #06291d; }
.btn.reject { background: transparent; border-color: var(--red); color: var(--red); }
.btn.changes { background: transparent; border-color: var(--amber); color: var(--amber); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.small { padding: .34rem .6rem; font-size: .8rem; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
select.btn, select { appearance: none; }

/* Chips and pills */
.chip {
  display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
}
.chip::before { content: ""; width: .42rem; height: .42rem; border-radius: 50%; background: currentColor; }
.chip.draft { background: var(--surface-3); color: #aab2c5; }
.chip.pending { background: var(--amber-soft); color: var(--amber); }
.chip.approved { background: var(--green-soft); color: var(--green); }
.chip.rejected { background: var(--red-soft); color: var(--red); }
.chip.changes_requested { background: rgba(251,146,60,.14); color: #fb923c; }
.chip.urgent-tag { background: var(--red-soft); color: var(--red); }
.house-rules { margin: .4rem 0; padding-left: 1.1rem; color: var(--ink); font-size: .86rem; }
.house-rules li { margin: .2rem 0; }
.chip.waiting-others { background: var(--brand-soft); color: var(--brand-2); }

.reviewer-card {
  flex-direction: row;
  align-items: center;
  gap: .75rem;
  margin-bottom: .6rem;
}
.reviewer-main {
  flex: 1;
  min-width: 12rem;
}
.global-date {
  margin: .8rem 0 1rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.setting-toggle {
  display: flex;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
}
.setting-tile {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  margin-top: .8rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
}
.setting-tile input { width: auto; margin-top: .22rem; }
.setting-tile span span { display: block; }
.holiday-drop summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  list-style: none;
}
.holiday-drop summary::-webkit-details-marker { display: none; }
.holiday-drop summary::after {
  content: "+";
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  color: var(--muted);
}
.holiday-drop[open] summary::after { content: "-"; }
.holiday-list {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-top: .75rem;
}
.holiday-chip {
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 999px;
  padding: .32rem .6rem;
  font: inherit;
  font-size: .82rem;
  cursor: pointer;
}
.holiday-chip span { color: var(--muted); margin-left: .25rem; }

/* Approvers list: on a phone, wrap each row so chips and buttons never run off-screen. */
@media (max-width: 48rem) {
  #reviewer-list .reviewer-card {
    flex-wrap: wrap;
    align-items: center;
    align-content: flex-start;   /* keep wrapped button row from stretching tall */
    gap: .5rem .5rem;
  }
  #reviewer-list .reviewer-card .avatar { order: 0; flex: 0 0 auto; align-self: center; }
  #reviewer-list .reviewer-main { order: 1; flex: 1 1 calc(100% - 3rem); min-width: 0; }
  #reviewer-list .reviewer-card .chip { order: 2; flex: 0 0 auto; align-self: center; }
  #reviewer-list .reviewer-card .btn {
    order: 3;
    flex: 1 1 8rem;
    white-space: nowrap;
    align-self: center;
    height: auto;
  }
}

/* Cards */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr)); }
.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 1.05rem; display: flex; flex-direction: column; gap: .65rem;
}
.card:hover { border-color: var(--line-2); transform: none; }
.card.is-approved { border-color: rgba(54,211,153,.4); }
.card .head { display: flex; align-items: center; gap: .5rem; }
.card .title { font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; }
.card .meta { font-size: .78rem; color: var(--faint); }
.type-tag {
  font-size: .68rem; font-weight: 700; color: var(--brand-2); background: var(--brand-soft);
  padding: .18rem .55rem; border-radius: 7px; text-transform: uppercase; letter-spacing: .04em;
}
.body-text {
  white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: .8rem; font-size: .93rem; color: #dce0ea;
}
.body-text.clickable { cursor: pointer; transition: border-color .12s ease; }
.body-text.clickable:hover { border-color: var(--brand); }
.cmt-del {
  width: auto; padding: 0 .35rem; margin-left: .3rem; border: none; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; border-radius: 6px;
}
.cmt-del:hover { color: var(--reject, #ef4444); background: var(--bg-2); }
.seen-row { font-size: .77rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

.edited-tag { font-size: .74rem; color: var(--amber); font-weight: 600; }
.fav-star { cursor: pointer; color: var(--faint); font-size: .95rem; }
.fav-star.on { color: var(--amber); }

.marquee-card .body-text {
  background: #07090c; color: #ffd43b; font-family: ui-monospace, Menlo, Consolas, monospace;
  text-align: center; letter-spacing: 1px; border-color: #20242e; text-transform: uppercase;
  text-shadow: 0 0 12px rgba(255,212,59,.4);
}

.notice { background: var(--amber-soft); border: 1px solid rgba(251,191,36,.3); color: var(--amber); padding: .6rem .8rem; border-radius: 10px; font-size: .85rem; }
.notice.good { background: var(--green-soft); border-color: rgba(54,211,153,.35); color: var(--green); }

/* Inputs */
textarea, input[type=text], input[type=email], input[type=date], input[type=datetime-local], select {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line-2); border-radius: 10px;
  font: inherit; background: var(--bg); color: var(--ink);
}
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { min-height: 7rem; resize: vertical; line-height: 1.55; }
label.field { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin: .6rem 0 .3rem; }

/* Modal and drawer */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4,5,8,.6); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 60; padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  max-width: 40rem; width: 100%; padding: 1.35rem; box-shadow: var(--shadow);
  max-height: 90vh; overflow: auto;
}
.modal h3 { margin-top: 0; }
.modal.wide { max-width: 52rem; }

/* On desktop, open the message editor larger so there is more room to write. */
@media (min-width: 48rem) {
  .modal.wide { max-width: 64rem; }
  #editor .modal.wide { max-height: 92vh; }
  #editor #edit-body { min-height: 28rem; }
}

/* Editor: most recent comment and the "Recent changes" drop-down. */
.recent-comment {
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px;
  padding: .5rem .7rem; font-size: .9rem; margin-bottom: .5rem;
}
.change-drop { margin-bottom: .6rem; }
.change-drop > summary { cursor: pointer; font-size: .9rem; }
.sms-cost {
  display: inline-flex;
  align-items: baseline;
  gap: .35rem;
  margin: .3rem 0 .55rem;
  padding: 0;
  background: none;
  border: 0;
  width: auto;
  color: var(--muted);
  font-size: .78rem;
}
.sms-cost[hidden] { display: none; }
.sms-cost-total {
  font-size: .78rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
/* Editor send date/time is one field that fills the row. */
#send-when-row input { width: 100%; box-sizing: border-box; }

/* Briefly highlight a card you were sent to from the planning desk. */
.card.flash { animation: card-flash 2.2s ease; }
@keyframes card-flash {
  0%, 100% { box-shadow: var(--shadow); }
  15% { box-shadow: 0 0 0 3px var(--brand, #5b6cff); }
}

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 40rem) { .compare { grid-template-columns: 1fr; } }
.compare .col { border: 1px solid var(--line-2); border-radius: 12px; padding: .7rem; background: var(--bg-2); }
.compare .col h4 { margin: 0 0 .4rem; font-size: .85rem; color: var(--muted); }

.history-row { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem 0; border-top: 1px solid var(--line); }
.history-row:first-child { border-top: none; }

/* Toast */
.toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--surface-3); color: var(--ink); padding: .65rem 1.05rem; border-radius: 12px;
  font-size: .88rem; opacity: 0; z-index: 90; border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty { text-align: center; color: var(--faint); padding: 4rem 1rem; }

/* Planning desk and panels */
.desk { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 52rem) { .desk { grid-template-columns: 1fr; } }
.panel { background: linear-gradient(180deg, var(--surface), var(--bg-2)); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 1.1rem; }
.panel h3 { margin-top: 0; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); font-size: .84rem; }
.private-banner {
  background: linear-gradient(90deg, rgba(91,108,255,.18), transparent);
  color: var(--brand-2); text-align: center; font-size: .76rem; padding: .4rem; font-weight: 600; letter-spacing: .03em;
  border-bottom: 1px solid var(--line);
}

.how-body {
  color: var(--muted);
  font-size: .86rem;
  padding-top: .5rem;
}
.how-body p {
  margin: .35rem 0;
}

/* Login screen */
.login-wrap { display: grid; place-items: center; padding: 3.5rem 1rem; }
.login-card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 2rem 1.75rem; max-width: 25rem; width: 100%; text-align: center;
}
.login-card h2 { margin: .4rem 0 .2rem; }
.login-logo {
  width: 3.2rem; height: 3.2rem; border-radius: 14px; margin: 0 auto .4rem;
  background: linear-gradient(135deg, var(--brand), #9a6bff); display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 1.2rem; box-shadow: 0 10px 30px rgba(91,108,255,.5);
}
.gbtn { display: flex; justify-content: center; margin: .4rem 0; }
.login-or { display: flex; align-items: center; gap: .6rem; color: var(--faint); font-size: .8rem; margin: 1rem 0; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.reviewer-primary {
  background: var(--brand-soft); border: 1px solid rgba(91,108,255,.3); border-radius: 12px;
  padding: 1rem; text-align: left; margin: 1rem 0;
}
.reviewer-primary strong { color: var(--brand-2); }
.admin-box { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.admin-box .btn { width: 100%; }

.calendar-panel { margin-bottom: 1rem; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .35rem;
  margin-top: .8rem;
}
.cal-head {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  text-align: center;
}
.cal-day {
  min-height: 6.4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  padding: .35rem;
  overflow: hidden;
  cursor: pointer;
}
.cal-day:hover { border-color: var(--line-2); }
.cal-day.muted-day { opacity: .45; }
.cal-num {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  margin-bottom: .25rem;
}
.mobile-weekday { display: none; }
.cal-item {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 6px;
  padding: .22rem .3rem;
  margin-bottom: .25rem;
  text-align: left;
  font: inherit;
  font-size: .72rem;
  line-height: 1.2;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-item:hover { background: var(--surface-3); }
.cal-kind {
  color: var(--muted);
  font-size: .66rem;
  font-weight: 800;
  text-transform: uppercase;
}
/* Event markers: the "Event" word is a colored chip, and they are not clickable. */
.cal-event { cursor: default; }
.cal-event .cal-kind { padding: .04rem .3rem; border-radius: 4px; }
/* Yellow "Need review" flag on calendar items the reviewer has not handled. */
.need-review-tag {
  display: inline-block; margin-top: .15rem; padding: 0 .3rem; border-radius: 4px;
  background: #f7b500; color: #1c2330; font-weight: 800; font-size: .58rem;
  text-transform: uppercase; letter-spacing: .02em;
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(5, 2.2rem);
  gap: .45rem;
}
.swatch {
  width: 2.2rem;
  height: 2.2rem;
  border: 2px solid var(--line-2);
  border-radius: 999px;
  cursor: pointer;
}
.swatch.selected {
  border-color: #fff;
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* Hero (landing) */
.hero { text-align: center; padding: 3rem 1rem 1rem; }
.hero h1 { font-size: 2.2rem; letter-spacing: -.02em; margin: .2rem 0; background: linear-gradient(90deg, #fff, #aeb6ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); max-width: 36rem; margin: .6rem auto 1.2rem; }

/* ---- Light mode ---- */
[data-theme="light"] {
  --bg: #f3f5f9;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --surface-3: #e7eaf1;
  --line: #e2e6ee;
  --line-2: #d3d9e4;
  --ink: #1a1d24;
  --muted: #5b6275;
  --faint: #8a91a3;
  --brand: #4f5bff;
  --brand-2: #4452e6;
  --brand-soft: rgba(79, 91, 255, .1);
  --green: #18a06a;
  --green-soft: rgba(24, 160, 106, .12);
  --amber: #b5790a;
  --amber-soft: rgba(181, 121, 10, .12);
  --red: #d6336c;
  --red-soft: rgba(214, 51, 108, .1);
  --shadow: 0 1px 2px rgba(20,30,60,.06), 0 10px 28px rgba(20,30,60,.08);
}
[data-theme="light"] body { background: radial-gradient(1200px 600px at 70% -10%, #eef1f8 0%, var(--bg) 55%) fixed; }
[data-theme="light"] .topbar { background: rgba(255,255,255,.85); }
[data-theme="light"] .body-text { color: #2a2e38; }
[data-theme="light"] .marquee-card .body-text { background: #0b0d12; color: #ffd43b; }
[data-theme="light"] .avatar { background: linear-gradient(135deg, #e2e6f0, #cfd6e6); color: #3a4150; border-color: #fff; }
[data-theme="light"] .btn.approve { color: #06291d; }

/* Theme toggle button */
.theme-toggle {
  width: 2rem; height: 2rem; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--muted); cursor: pointer; display: grid; place-items: center;
  font-size: .95rem;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--line-2); }

/* Admin mode toggle + owner tabs that only show when it is on. */
.topbar { transition: transform .25s ease; }
.topbar.topbar--hidden { transform: translateY(-100%); }
.topbar nav a.admin-only { display: none; }
.topbar.admin-on nav a.admin-only { display: inline-block; }
.admin-switch { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem;
  color: var(--muted); cursor: pointer; user-select: none; white-space: nowrap; }
.admin-switch input { width: auto; margin: 0; }

@media (max-width: 48rem) {
  /* Top row: brand on the left, then the controls cluster (admin mode, theme,
     sign out) on the right. Nav scrolls on its own full-width row below. */
  .topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem .55rem;
    padding: .6rem .8rem;
  }
  .topbar .brand {
    flex: 1 1 auto;
    min-width: 0;
  }
  .topbar .brand span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .brand small { display: none; }   /* drop "COMMUNICATIONS" to save room */
  .topbar .spacer { display: none; }
  .presence { display: none; }
  .topbar .admin-switch,
  .topbar .whoami,
  .topbar .theme-toggle { flex: 0 0 auto; }
  .whoami { gap: .35rem; }
  .whoami .avatar { display: none; }
  .topbar nav {
    order: 9;                /* always wraps below the brand + controls row */
    flex-basis: 100%;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    padding-bottom: .15rem;
    scrollbar-width: none;
  }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a {
    flex: 0 0 auto;
    padding: .38rem .6rem;
    font-size: .8rem;
    border-radius: 8px;
  }
  .wrap {
    margin: 1rem auto;
    padding: 0 .8rem;
  }
  .toolbar {
    align-items: stretch;
  }
  .toolbar h1 {
    flex-basis: 100%;
    margin: .2rem 0;
  }
  .toolbar .grow {
    display: none;
  }
  .toolbar select,
  .toolbar label.btn,
  .toolbar button {
    flex: 1 1 10rem;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .calendar-grid {
    grid-template-columns: 1fr;
  }
  .cal-head {
    display: none;
  }
  .cal-day {
    min-height: 0;
  }
  .cal-num {
    display: flex;
    gap: .35rem;
    align-items: baseline;
  }
  .mobile-weekday {
    display: inline;
    color: var(--faint);
  }
  .cal-day:empty {
    display: none;
  }
  .card {
    border-radius: 12px;
    padding: .9rem;
  }
  .modal-backdrop {
    align-items: flex-end;
    padding: .6rem;
  }
  .modal {
    max-height: 92vh;
    border-radius: 14px;
    padding: 1rem;
  }
  /* The message editor fills the whole screen on a phone. */
  #editor { padding: 0; align-items: stretch; }
  #editor .modal.wide {
    max-height: 100vh;
    height: 100vh;
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
  }
  /* Smaller title on mobile so a long one stays tidy and never shoves the X down. */
  #editor #editor-title { font-size: 1.05rem; line-height: 1.25; }
  #editor #editor-close { font-size: 1.3rem; padding: .2rem .55rem; }
  /* Compact title + send date/time so the message box gets more room. */
  #editor #edit-title-input,
  #editor #send-when-row input {
    padding: .4rem .6rem;
    font-size: .9rem;
  }
  #editor .field { margin-top: .5rem; font-size: .72rem; }
  /* Bigger editing box. */
  #editor #edit-body { min-height: 30rem; }
  .login-wrap {
    padding: 1.5rem .8rem;
  }
}

@media (max-width: 26rem) {
  .topbar {
    grid-template-columns: 1fr auto;
  }
  .theme-toggle {
    display: none;
  }
  .topbar .brand small {
    display: none;
  }
}
