/*
 * One stylesheet for every page.
 *
 * Two themes, and a choice between them. The OS preference is the default
 * because it is usually right, but it is only a default — this gets used at
 * night and in a bright room, and the person at the keyboard knows better than
 * the operating system which they want.
 *
 * Both themes are defined from the same token names, so nothing below that
 * block needs to know which is active.
 */

:root {
  color-scheme: light dark;

  --bg: #faf9f7;
  --bg-sunk: #f2f1ed;
  --panel: #ffffff;
  --fg: #1b1b19;
  --muted: #6b6b63;
  --faint: #8e8e85;
  --border: #e4e2dc;
  --border-strong: #d2d0c8;

  --accent: #2d6a4c;
  --accent-soft: #e8f1ec;
  --accent-fg: #ffffff;
  --bad: #a8423f;
  --warn: #8a6410;
  --info: #35618f;

  --shadow-sm: 0 1px 2px rgba(24, 24, 20, 0.05);
  --shadow: 0 1px 3px rgba(24, 24, 20, 0.07), 0 6px 16px -8px rgba(24, 24, 20, 0.14);
  --shadow-lg: 0 12px 40px -12px rgba(24, 24, 20, 0.3);

  --radius: 10px;
  --radius-lg: 14px;
}

/* Dark values, kept in one place and applied from two. */
@media (prefers-color-scheme: dark) {
  /* The OS preference, honoured only when no explicit choice has been made. */
  :root:not([data-theme="light"]) {
    --bg: #141416;
    --bg-sunk: #0f0f11;
    --panel: #1c1c20;
    --fg: #ededea;
    --muted: #9b9b94;
    --faint: #7a7a74;
    --border: #2e2e34;
    --border-strong: #3d3d45;

    --accent: #6fbd97;
    --accent-soft: #1b2c24;
    --accent-fg: #0d1a13;
    --bad: #e4908c;
    --warn: #d8b25c;
    --info: #85b0e0;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 8px 20px -10px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 16px 48px -12px rgba(0, 0, 0, 0.7);
  }
}

/*
 * An explicit choice wins over the OS, in both directions.
 *
 * color-scheme is set too, not just the tokens. Without it the browser keeps
 * drawing scrollbars, autofilled fields and native control chrome from the
 * operating system's preference — so choosing light on a dark machine left dark
 * furniture scattered over a light page.
 */
:root[data-theme="light"] { color-scheme: light; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141416;
  --bg-sunk: #0f0f11;
  --panel: #1c1c20;
  --fg: #ededea;
  --muted: #9b9b94;
  --faint: #7a7a74;
  --border: #2e2e34;
  --border-strong: #3d3d45;

  --accent: #6fbd97;
  --accent-soft: #1b2c24;
  --accent-fg: #0d1a13;
  --bad: #e4908c;
  --warn: #d8b25c;
  --info: #85b0e0;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 8px 20px -10px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 16px 48px -12px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Wide screens get a comfortable measure rather than a table a metre across. */
#app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 56px;
}

/* Shown only when moving by keyboard, so it guides without decorating. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------------------------------- header -------------------------------- */

header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 0 13px;
  margin-bottom: 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--border);
}

h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -0.015em; }

header nav {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-sunk);
  border-radius: 9px;
  border: 1px solid var(--border);
}

header nav a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}
header nav a:hover { color: var(--fg); text-decoration: none; }
header nav a.on { color: var(--fg); background: var(--panel); box-shadow: var(--shadow-sm); }

.sub { color: var(--faint); font-size: 12px; }

h2 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
  margin: 30px 0 11px;
  font-weight: 650;
}

/* ---------------------------------- cards --------------------------------- */

.cards {
  display: grid;
  gap: 13px;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.card h3 { margin: 0 0 3px; font-size: 15px; font-weight: 620; letter-spacing: -0.01em; }
.card .meta { color: var(--muted); font-size: 12px; margin-bottom: 11px; }

.bar { height: 6px; background: var(--bg-sunk); border-radius: 99px; overflow: hidden; margin: 9px 0 6px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar.full > i { background: var(--bad); }

.capacity { display: flex; justify-content: space-between; font-size: 12px; }
.last-send { font-size: 11px; color: var(--faint); margin-top: 4px; }

/* Separated from the 24h figure above it, which measures something else. */
.lifetime { margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--border); }
.lifetime .bar > i { background: var(--info); }
.lifetime .capacity { color: var(--muted); }

.warn {
  margin-top: 11px; padding: 8px 10px; border-radius: 8px; font-size: 11.5px;
  background: color-mix(in srgb, var(--warn) 13%, transparent); color: var(--warn);
}

.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 11px; }
.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 99px;
  border: 1px solid var(--border); color: var(--muted);
}
.tag.unread {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent);
  font-weight: 600;
}

.card.not-active { opacity: 0.6; }

/* --------------------------------- controls ------------------------------- */

.controls { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }

input, select, textarea {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:hover, select:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

button {
  font: inherit; font-size: 13px; cursor: pointer; border-radius: 8px; padding: 7px 13px;
  border: 1px solid var(--border); background: var(--panel); color: var(--fg);
  box-shadow: var(--shadow-sm);
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}
button:hover { border-color: var(--border-strong); background: var(--bg-sunk); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

button.primary {
  background: var(--accent); border-color: var(--accent);
  color: var(--accent-fg); font-weight: 600;
}
button.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--fg)); }

button.link {
  border: 0; background: none; color: var(--info); padding: 0; font-size: 12px; box-shadow: none;
}
button.link:hover { background: none; text-decoration: underline; }

.card-actions { display: flex; gap: 10px; margin-top: 11px; }

/* Destructive, and sitting among buttons that merely describe something. */
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
button.danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); border-color: var(--bad); }
.tokens button.danger { margin-left: auto; }

/* ---------------------------------- tables -------------------------------- */

.wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--faint); font-weight: 650; padding: 11px 14px;
  background: var(--bg-sunk); border-bottom: 1px solid var(--border); white-space: nowrap;
}

td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:hover > td { background: color-mix(in srgb, var(--bg-sunk) 55%, transparent); }
tr:last-child td { border-bottom: 0; }

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------- pills --------------------------------- */

.pill {
  font-size: 10.5px; font-weight: 650; letter-spacing: 0.02em;
  padding: 3px 9px; border-radius: 99px; white-space: nowrap; display: inline-block;
}
.SUBMITTED { background: var(--accent-soft); color: var(--accent); }
.DRAFT { background: color-mix(in srgb, var(--muted) 15%, transparent); color: var(--muted); }
.FAILED, .RATE_LIMITED { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.APPROVED, .SKIPPED { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }

/* Client status. ACTIVE is deliberately unstyled — it is the normal case and a
   badge on every card would say nothing. */
.ON_HOLD { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.PLACED { background: var(--accent-soft); color: var(--accent); }
.ARCHIVED { background: color-mix(in srgb, var(--muted) 15%, transparent); color: var(--muted); }

.reason { color: var(--muted); font-size: 11.5px; max-width: 340px; }
.empty {
  padding: 40px 26px; text-align: center; color: var(--faint);
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
}

/* --------------------------------- analytics ------------------------------ */

.stats {
  display: grid; gap: 13px; margin-bottom: 15px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.stat {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 15px; box-shadow: var(--shadow-sm);
}
.stat .n { font-size: 25px; font-weight: 650; letter-spacing: -0.025em; }
.stat .k {
  font-size: 10.5px; color: var(--faint); text-transform: uppercase;
  letter-spacing: 0.06em; margin-top: 3px; font-weight: 600;
}
.stat .sub { font-size: 11px; color: var(--muted); margin-top: 5px; }

.panels {
  display: grid; gap: 13px; margin-bottom: 15px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 15px 16px; overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.panel h4 { margin: 0 0 2px; font-size: 13px; font-weight: 620; }
.panel .why { margin: 0 0 11px; font-size: 11px; color: var(--faint); }

.hbar {
  display: grid; grid-template-columns: minmax(110px, 34%) 1fr auto;
  gap: 9px; align-items: center; font-size: 12px; padding: 2.5px 0;
}
.hbar .track { background: var(--bg-sunk); border-radius: 99px; height: 9px; }
.hbar .fill { background: var(--accent); height: 100%; border-radius: 99px; }
.hbar.bad .fill { background: var(--bad); }
.hbar .lbl { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .val { font-variant-numeric: tabular-nums; }

/* ----------------------------------- steps -------------------------------- */

tr.detail-row > td { padding: 0 14px 14px; background: var(--bg-sunk); }
.steps { border-left: 2px solid var(--border); margin: 2px 0 0 4px; padding-left: 13px; }
.steps .s { display: flex; gap: 10px; padding: 3px 0; font-size: 11.5px; }
.steps .s time { color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.steps .s b { font-weight: 650; min-width: 132px; }
.steps .s span { color: var(--muted); word-break: break-word; }
.steps .s.bad b, .steps .s.bad span { color: var(--bad); }
.steps .s.good b { color: var(--accent); }
.meta-line { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.expand { cursor: pointer; user-select: none; }
.expand::before { content: "▸ "; color: var(--faint); }
tr.open .expand::before { content: "▾ "; }

/* --------------------------------- run banner ----------------------------- */

.run-banner {
  display: flex; align-items: center; gap: 13px; flex-wrap: wrap;
  border: 1px solid var(--border); border-left-width: 3px;
  border-radius: var(--radius-lg); background: var(--panel);
  padding: 13px 15px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
.run-banner.running { border-left-color: var(--accent); }
.run-banner.idle { border-left-color: var(--border-strong); }
.run-banner.warn { border-left-color: var(--warn); }
.run-state { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.run-detail { color: var(--muted); font-size: 12.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dot.live { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.dot.warn { background: var(--warn); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

@media (prefers-reduced-motion: reduce) {
  .dot.live { animation: none; }
  * { transition: none !important; }
}

/* ---------------------------------- dialog -------------------------------- */

dialog {
  border: 1px solid var(--border); border-radius: 16px; background: var(--panel);
  color: var(--fg); padding: 0; width: min(640px, 94vw); max-height: 90vh;
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(2px); }

.dlg-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.dlg-head h3 { margin: 0; font-size: 16px; font-weight: 620; }

form.client-form { padding: 18px 20px; overflow-y: auto; max-height: calc(90vh - 132px); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 10.5px; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 5px; font-weight: 650;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--fg); font: inherit; font-size: 13px;
}
.field textarea {
  min-height: 190px; resize: vertical;
  font-family: ui-monospace, Menlo, monospace; font-size: 12.5px;
}
.field .hint { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.field .err { font-size: 11.5px; color: var(--bad); margin-top: 4px; }
.field.bad input, .field.bad textarea { border-color: var(--bad); }

.tokens { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.tokens button { font-size: 11px; padding: 3px 9px; border-radius: 99px; color: var(--muted); }
.tokens button:hover { border-color: var(--accent); color: var(--accent); }

.dlg-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 13px 20px; border-top: 1px solid var(--border); background: var(--bg-sunk);
  border-radius: 0 0 16px 16px;
}
.form-error { color: var(--bad); font-size: 12px; margin-right: auto; align-self: center; }

/* ---------------------------------- login --------------------------------- */

.login-box {
  max-width: 352px; margin: 14vh auto 0; padding: 28px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--panel);
  box-shadow: var(--shadow);
}

/* --------------------------------- utilities ------------------------------ */

.hint { font-size: 11.5px; color: var(--muted); }
.viewer-hidden { display: none !important; }

/*
 * A suggested match is the action being offered; dismissing is the exception.
 * They sat side by side looking identical, which made the common case no
 * easier to find than the rare one.
 */
button[data-link] {
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 99px;
}
button[data-link]:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: var(--accent);
  text-decoration: none;
}
button[data-link] .hint { color: inherit; opacity: 0.75; }

/* A line of figures, not a wall of cards. */
.strip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  padding: 10px 14px;
  margin-bottom: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.strip b { color: var(--fg); font-weight: 650; }
.strip .sep { color: var(--border-strong); }

details#review-section {
  margin-top: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px 14px;
}
details#review-section > summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--fg);
  list-style: none;
}
details#review-section > summary::-webkit-details-marker { display: none; }
details#review-section > summary::before { content: "▸ "; color: var(--faint); }
details#review-section[open] > summary::before { content: "▾ "; }

/* -------------------------------- client hub ------------------------------ */

.hub-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.hub-head h1 { margin: 0; }
.hub-head a { font-size: 12.5px; }
.sub-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--faint); margin: 16px 0 8px; font-weight: 650;
}

details.booker {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px 14px;
  margin-bottom: 13px;
}
details.booker > summary {
  cursor: pointer; font-size: 12.5px; font-weight: 650; list-style: none;
}
details.booker > summary::-webkit-details-marker { display: none; }
details.booker > summary::before { content: "+ "; color: var(--faint); }
details.booker[open] > summary::before { content: "− "; }
details.booker .field { margin-bottom: 10px; }
details.booker input, details.booker select {
  width: 100%; background: var(--bg);
}

/* ------------------------------- mail panes ------------------------------- */

/*
 * A list beside what is being read, rather than a stack of cards each dumping a
 * full message. Scanning twenty conversations means seeing twenty lines, not
 * scrolling past twenty bodies to find the one that matters.
 */
.mail {
  display: grid;
  grid-template-columns: minmax(260px, 330px) 1fr;
  gap: 13px;
  align-items: start;
}

.mail-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  max-height: 72vh;
  overflow-y: auto;
}

.mail-row {
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: grid;
  gap: 2px;
  transition: background 0.12s ease;
}
.mail-row:last-child { border-bottom: 0; }
.mail-row:hover { background: var(--bg-sunk); }
.mail-row.on { background: var(--accent-soft); }
/*
 * Three lines, in the order the eye needs them: who it is with, what it is
 * about, and how it left off. Unread is carried by weight rather than a marker,
 * the way a mail client does it — a badge on top of bold text says it twice.
 */
.mail-row .who { font-size: 12.5px; display: flex; gap: 6px; align-items: baseline; }
.mail-row .who .name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row .who .count {
  font-size: 10.5px; color: var(--faint); background: var(--bg-sunk);
  border-radius: 99px; padding: 0 5px; flex: none;
}
.mail-row .who .when { margin-left: auto; font-size: 11px; color: var(--faint); flex: none; }
.mail-row .what { font-size: 12.5px; color: var(--fg); }
.mail-row .peek { font-size: 11.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row .peek .you { color: var(--muted); }

.mail-row.unseen .who .name { color: var(--fg); font-weight: 650; }
.mail-row.unseen .what { font-weight: 650; }

.mail-row .row-state:empty { display: none; }
.mail-row .row-state { margin-top: 4px; }

.mail-pane {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  min-height: 260px;
}
.mail-pane h3 { margin: 0 0 3px; font-size: 16px; font-weight: 620; letter-spacing: -0.01em; }
.mail-pane .meta { color: var(--muted); font-size: 12px; margin-bottom: 14px; }

/*
 * Who wrote it has to land before the words do. The name carries the weight;
 * the direction and the date sit behind it. A thin coloured border alone was
 * not enough to tell "they wrote" from "we sent" at a glance.
 */
.msg {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--border-strong);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.msg.sent {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.msg .from {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 7px;
}
.msg .from .name { font-size: 13px; font-weight: 650; color: var(--fg); }
.msg .from .dir {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 650;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--bg-sunk);
  color: var(--muted);
}
.msg.sent .from .dir { background: var(--accent-soft); color: var(--accent); }
.msg .from .at { font-size: 11px; color: var(--faint); }
.msg .text.empty-text { color: var(--faint); font-style: italic; }
.msg .text { font-size: 13px; white-space: pre-wrap; line-height: 1.6; word-break: break-word; }

/* Long messages are clipped until asked for; most of a care home's reply is a
   signature block and a disclaimer. */
.msg .text.clipped {
  max-height: 180px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 120px, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 120px, transparent 100%);
}

/* Set back and dimmed: it is there for reference, not for reading again. */
.msg .text.quoted {
  margin-top: 10px;
  padding-left: 10px;
  border-left: 2px solid var(--border);
  color: var(--faint);
  font-size: 12px;
}

.composer { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.composer textarea { width: 100%; min-height: 110px; resize: vertical; }

@media (max-width: 900px) {
  .mail { grid-template-columns: 1fr; }
  .mail-list { max-height: 320px; }
}

/* Sits with the account controls, not among the navigation. */
#theme-select { padding: 6px 8px; font-size: 12px; color: var(--muted); }
#theme-select:hover { color: var(--fg); }

@media (max-width: 720px) {
  #app { padding: 0 14px 40px; }
  header { gap: 10px; padding: 12px 0; }
  header nav { order: 3; width: 100%; overflow-x: auto; }
  #updated { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .reason { max-width: none; }
}
