:root {
  /* Grounds: Elias Gardens and Grounds green on warm paper (George picked it, 4 Nov). */
  --bg: #f6f4ee;
  --bar: #f6f4ee;
  --line: #e2ded2;
  --text: #1d2620;
  --muted: #7d867f;
  --me: #2f7a4d;
  --me-text: #ffffff;
  --them: #ffffff;
  --them-text: #1d2620;
  --card: #ffffff;
  --accent: #2f7a4d;
  --brand: #1f5134;
  --brand-text: #ffffff;
  --brand-soft: #e8efe6;
  --shadow: 0 1px 2px rgba(40, 50, 30, 0.08);
  --danger: #c0262d;
  /* Text on an --accent or --danger fill. White in light mode; in dark mode both fills are
     bright, so white text fell to 2.7:1 (usability walk, 16 Nov), and dark text is used. */
  --on-accent: #ffffff;
  --on-danger: #ffffff;
  /* What Robin does alone: Ask me is amber, Never is the danger red, softly filled. */
  --ask: #9a5c00;
  --ask-soft: #fbf1df;
  --never-soft: #f8e4e4;
  /* The phone's own font (George, 16 Nov): San Francisco on iPhone and Mac, Segoe UI on Windows.
     Samsung's font is named first because it can't be shipped, only used where the browser
     lets a page reach it (Firefox does); Chrome on Android gives Roboto. */
  --system: "One UI Sans APP VF", "SamsungOne", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: var(--system);
  font-family: var(--system);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101511;
    --bar: #101511;
    --line: #26302a;
    --text: #e8eee9;
    --muted: #8d988f;
    --them: #19211b;
    --them-text: #e8eee9;
    --card: #19211b;
    --accent: #46b06e;
    --brand: #173d27;
    --brand-soft: #1d2b21;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --danger: #ff6961;
    --on-accent: #0f1a12;
    --on-danger: #1a0a0a;
    --ask: #f0b04f;
    --ask-soft: #2f2614;
    --never-soft: #33191a;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
/* The page itself never scrolls or bounces: every screen is fixed and scrolls inside its own
   list. Without this, a drag on a short list (Needs you with one card) fell through to the
   page, iPhone rubber-banded the whole screen and the header slid off under the clock. */
html, body { overflow: hidden; overscroll-behavior: none; }
body { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
/* Full screen by default, edge to edge, so the message box sits just above the home bar.
   100dvh is the whole screen in the home-screen app and the visible part in a browser tab.
   Only while the keyboard is up (app.js sets --app-height then) is a screen sized to the
   visual viewport, so the header, the newest messages and the message box all sit in the
   part still visible. iPhone can report a visual viewport that is too short when no keyboard
   is showing (after the keyboard closes, or on launch), which left a big gap under the bar. */
.screen {
  position: fixed; left: 0; right: 0; top: var(--app-top, 0px);
  height: var(--app-height, 100%);
  display: flex; flex-direction: column;
}
@supports (height: 100dvh) { .screen { height: var(--app-height, 100dvh); } }

.bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: calc(env(safe-area-inset-top) + 6px) 12px 8px;
  background: var(--bar); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 0.5px solid var(--line); z-index: 2;
}
.bar-btn { background: none; border: 0; color: var(--me); font-size: 16px; padding: 6px 0; cursor: pointer; }
.bar-btn:first-child { justify-self: start; }
.bar-btn:last-child { justify-self: end; }
.who { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; }
.who-name { font-size: 12px; color: var(--text); }

/* The typing dots live inside the scrolling area, after the last message, so they push the
   messages up rather than covering the bottom of the last bubble. */
#scroller {
  flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
#thread { flex: none; padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 2px; }
#typing { flex: none; }
/* With the keyboard up, the home-indicator gap under the message box isn't needed. */
.keyboard #composer, .keyboard #recorder { padding-bottom: 8px; }
.stamp { align-self: center; color: var(--muted); font-size: 11px; margin: 12px 0 6px; }
.bubble {
  max-width: 78%; padding: 8px 13px; border-radius: 19px; font-size: 16px; line-height: 1.32;
  white-space: pre-wrap; overflow-wrap: anywhere; position: relative;
}
.bubble.me { align-self: flex-end; background: var(--me); color: var(--me-text); }
.bubble.them { align-self: flex-start; background: var(--them); color: var(--them-text); }
.bubble.me + .bubble.them, .bubble.them + .bubble.me { margin-top: 8px; }
.bubble.tail.me { border-bottom-right-radius: 5px; }
.bubble.tail.them { border-bottom-left-radius: 5px; }
.bubble a { color: inherit; }

/* Robin's formatted replies: paragraphs, lists and headings with breathing room. */
.bubble.rich { white-space: normal; line-height: 1.42; padding: 9px 14px; }
.bubble.rich > :first-child { margin-top: 0; }
.bubble.rich > :last-child { margin-bottom: 0; }
.bubble.rich p { margin: 0 0 9px; }
.bubble.rich ul, .bubble.rich ol { margin: 2px 0 10px; padding-left: 20px; }
.bubble.rich li { margin: 0 0 5px; padding-left: 2px; }
.bubble.rich li:last-child { margin-bottom: 0; }
.bubble.rich ul li::marker { color: var(--accent); }
.bubble.rich ol li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.bubble.rich .rt-head {
  font-weight: 650; margin: 14px 0 5px; padding-top: 10px;
  border-top: 0.5px solid rgba(127, 127, 127, 0.28);
}
.bubble.rich > .rt-head:first-child { padding-top: 0; border-top: 0; }
.bubble.rich strong { font-weight: 650; }
.bubble.rich code {
  font: 0.9em ui-monospace, SFMono-Regular, Menlo, monospace; padding: 1px 5px; border-radius: 6px;
  background: rgba(127, 127, 127, 0.16);
}
.bubble.rich > br { display: none; }
.bubble.rich .play { display: flex; width: fit-content; margin-top: 8px; }
/* Long replies on wide screens keep a comfortable line length. */
.bubble.them.rich { max-width: min(86%, 620px); }
@media (prefers-color-scheme: dark) { .bubble.rich ul li::marker { color: #34c759; } }

.card {
  align-self: flex-start; max-width: 86%; background: var(--card); border: 0.5px solid var(--line);
  border-radius: 16px; overflow: hidden; margin: 6px 0; flex: none;
}
.card-title { font-size: 13px; color: var(--muted); padding: 10px 14px 0; }
.card-body { padding: 6px 14px 12px; font-size: 15px; white-space: pre-wrap; line-height: 1.35; }
/* Scannable cards (5 Nov): text clamps to a few lines and opens on a tap. The clamp sits on
   an inner element with no padding, so no half line peeks out below it. */
.card-clamp { cursor: pointer; --lines: 3; }
.card-clamp .clamp {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--lines); overflow: hidden;
}
.card-clamp.is-open .clamp { display: block; -webkit-line-clamp: unset; overflow: visible; }
.card-said-msg.card-clamp { --lines: 4; }
.card-draft-text.card-clamp { --lines: 6; }
/* Needs you is a list to scan: tighter still. */
#needs-list .card-body.card-clamp { --lines: 2; }
#needs-list .card-said-msg.card-clamp { --lines: 2; }
#needs-list .card-draft-text.card-clamp { --lines: 3; }
.card-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.card-said { padding: 0 14px 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.card-said-msg {
  background: var(--bg); border: 0.5px solid var(--line); border-radius: 14px 14px 14px 4px;
  padding: 7px 11px; font-size: 14px; line-height: 1.35; white-space: pre-wrap; max-width: 92%;
}
.card-draft { margin: 0 10px 10px; padding: 8px 11px 9px; border-radius: 12px; background: var(--brand-soft); }
.card-draft-text { font-size: 15px; line-height: 1.35; white-space: pre-wrap; }
.card-plan { margin: 0 10px 8px; padding: 7px 11px 8px; border-radius: 12px; border: 1px dashed var(--accent); }
.card-plan-text { font-size: 14px; line-height: 1.35; font-weight: 600; }
.card-plan-text.card-clamp { --lines: 2; }
.card-plan .card-more { padding: 4px 0 0; font-size: 13px; }
.card-more { padding: 0 14px 10px; font-size: 14px; color: var(--muted); }
.card-more summary { cursor: pointer; width: fit-content; }
.card-more-text { white-space: pre-wrap; color: var(--text); margin-top: 6px; line-height: 1.35; }
.card-actions { display: flex; border-top: 0.5px solid var(--line); }
.card-actions button {
  flex: 1; background: none; border: 0; padding: 12px 8px; font-size: 16px; color: var(--me); cursor: pointer;
  min-width: 0; line-height: 1.2;
}
.card-actions button:disabled { opacity: 0.5; }
.card-actions button + button { border-left: 0.5px solid var(--line); }
.card-actions button.go { font-weight: 600; }
.card-actions a.go {
  flex: 1; padding: 12px 8px; font-size: 16px; font-weight: 600; line-height: 1.2; text-align: center;
  color: var(--accent, var(--me)); text-decoration: none; min-width: 0;
}
.card-actions a + button, .card-actions button + a { border-left: 0.5px solid var(--line); }
.card-edit {
  display: block; width: calc(100% - 20px); margin: 0 10px 10px; padding: 8px 10px; resize: none;
  border: 1px solid var(--line); border-radius: 12px; font: inherit; font-size: 16px; line-height: 1.35;
  background: var(--bg); color: var(--text);
}
.card-edit:focus { outline: none; border-color: var(--me); }
.card-questions { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 12px; }
.card-q-label { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.card-q-options { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.card-q-chip {
  border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 999px;
  padding: 7px 12px; font: inherit; font-size: 15px; cursor: pointer; min-height: 36px; max-width: 100%;
  text-align: left;
}
.card-q-chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.card-q-typed {
  display: block; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px;
  font: inherit; font-size: 16px; background: var(--bg); color: var(--text);
}
.card-q-typed:focus { outline: none; border-color: var(--accent); }
.card-q-detail { color: var(--muted); font-size: 13px; margin: -2px 0 8px; }
.card-q-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-q-count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.card-q-step { background: none; border: 0; color: var(--accent); font: inherit; font-size: 14px; font-weight: 600; padding: 6px 2px; min-height: 36px; cursor: pointer; }
.card-q-step:disabled { color: var(--muted); opacity: 0.5; cursor: default; }
.bubble.pending { opacity: 0.6; }
.card-done { padding: 10px 14px; font-size: 13px; color: var(--muted); border-top: 0.5px solid var(--line); }

.typing { display: flex; gap: 4px; padding: 12px 14px; margin: 2px 12px 10px; width: fit-content; }
.typing span { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
.typing.drafting { display: block; white-space: pre-wrap; max-width: 78%; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

#composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 10px calc(env(safe-area-inset-bottom) + 8px);
  background: var(--bar); border-top: 0.5px solid var(--line);
}
#input {
  flex: 1; resize: none; border: 1px solid var(--line); border-radius: 19px; padding: 8px 14px;
  font: inherit; font-size: 16px; line-height: 1.3; max-height: 140px; background: var(--bg); color: var(--text);
}
#input:focus { outline: none; border-color: var(--muted); }
#send {
  width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--me); color: #fff;
  display: grid; place-items: center; margin-bottom: 3px; cursor: pointer;
}
#send:disabled { background: var(--line); }
#send svg { width: 18px; height: 18px; }

#mic {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: none; color: var(--muted);
  display: grid; place-items: center; margin-bottom: 1px; cursor: pointer; flex: none;
}
#mic svg { width: 24px; height: 24px; }
#recorder {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px calc(env(safe-area-inset-bottom) + 8px);
  background: var(--bar); border-top: 0.5px solid var(--line);
}
#rec-cancel, #rec-send {
  width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center;
  cursor: pointer; flex: none;
}
#rec-cancel { background: var(--card); color: var(--text); }
#rec-send { background: var(--me); color: #fff; }
#rec-cancel svg, #rec-send svg { width: 20px; height: 20px; }
.rec-live {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border-radius: 20px; background: var(--bg); border: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1.2s infinite; flex: none; }
.rec-hint { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 5px 12px 5px 10px;
  border-radius: 14px; border: 0; font: inherit; font-size: 14px; cursor: pointer;
  background: rgba(127, 127, 127, 0.18); color: inherit;
}
.play[aria-pressed="true"] { background: rgba(127, 127, 127, 0.32); }
.bubble .voice-tag { opacity: 0.8; }

.conn-btn {
  flex: none; background: var(--me); color: #fff; border: 0; border-radius: 14px; padding: 7px 14px;
  font: inherit; font-size: 15px; text-decoration: none; cursor: pointer;
}
.conn-btn.quiet { background: none; color: var(--me); padding: 7px 0; }
.connect-note { background: var(--card); border-radius: 12px; padding: 10px 14px; margin: 0 0 12px; font-size: 15px; }

.signin-card {
  margin: auto; text-align: center; padding: 32px 24px; max-width: 360px; width: 100%;
}
.signin-icon { width: 88px; height: 88px; border-radius: 22px; }
.signin-card h1 { margin: 16px 0 4px; font-size: 28px; }
.signin-card p { color: var(--muted); margin: 0 0 28px; }
.primary {
  display: block; background: var(--me); color: #fff; text-decoration: none; padding: 14px; border-radius: 14px;
  font-size: 17px; font-weight: 600;
}
.note { margin-top: 16px !important; color: var(--danger) !important; }

.people-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; padding: 12px 16px calc(env(safe-area-inset-bottom) + 16px); }
.switch { appearance: none; width: 51px; height: 31px; border-radius: 16px; background: var(--line); position: relative; cursor: pointer; flex: none; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.switch:checked { background: #34c759; }
.switch:checked::after { transform: translateX(20px); }
.switch:disabled { opacity: 0.5; }

/* Folding phones and tablets.
   Cover screens are narrow (about 340-380px): bubbles may use more of the width.
   Unfolded (about 700-900px) the chat keeps a readable column instead of stretching, and the
   People page sits beside it. When the fold is reported (viewport segments), nothing sits
   across the hinge: the chat stays on one side. */
@media (max-width: 380px) {
  .bubble { max-width: 86%; font-size: 15.5px; }
  .bubble.them.rich { max-width: 92%; }
  .card { max-width: 94%; }
  .card-actions button { font-size: 15px; padding: 12px 6px; }
  .bar { padding-left: 8px; padding-right: 8px; }
  .rec-hint { display: none; }
}
@media (min-width: 640px) {
  #thread, #composer, #recorder, .people-list { padding-left: max(16px, calc((100% - 760px) / 2)); padding-right: max(16px, calc((100% - 760px) / 2)); }
  .bubble { max-width: 70%; }
  .card { max-width: 72%; }
  .typing { margin-left: max(16px, calc((100% - 760px) / 2)); }
}
@media (horizontal-viewport-segments: 2) {
  #thread, #composer, #recorder, .people-list { padding-left: 12px; padding-right: 12px; }
  .bubble { max-width: 80%; }
}
@media (vertical-viewport-segments: 2) {
  /* Laptop-style fold: messages on top, typing on the bottom half. */
  #chat main { flex: none; height: calc(env(viewport-segment-bottom 0 0, 50vh) - 70px); }
  #composer, #recorder { margin-top: auto; }
}

/* ===== Grounds look ======================================================================
   The chat's look on top of the layout above: a green header with a rounded base, warm
   paper behind the chat, garden-green bubbles for you and white ones for Robin, a white
   message box with the mic always in reach, and quick questions above it. */
.bar {
  background: var(--brand); color: var(--brand-text); border-bottom: 0;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border-radius: 0 0 22px 22px; padding-bottom: 12px;
}
.bar .bar-btn { color: var(--brand-text); }
.bar .who-name { color: var(--brand-text); font-family: var(--display); font-weight: 700; font-size: 17px; }
.chat-bar { display: flex; gap: 8px; padding-left: 14px; padding-right: 12px; }
.chat-bar .who { flex: 1; min-width: 0; flex-direction: row; align-items: center; gap: 10px; }
.chat-bar .avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; flex: none; overflow: hidden; }
.chat-bar .avatar img { width: 100%; height: 100%; }
.who-text { min-width: 0; }
.chat-bar .who-name { font-size: 18px; line-height: 1.1; }
.who-status { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #cfe3d4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-status i { width: 7px; height: 7px; border-radius: 50%; background: #8fe0a6; flex: none; }
.who-status i.off { background: #f2b366; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; flex: none;
  background: rgba(255, 255, 255, 0.14); color: var(--brand-text); cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:active { background: rgba(255, 255, 255, 0.26); }
.icon-btn:focus-visible, .chips button:focus-visible, #mic:focus-visible, #send:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.stamp { color: var(--muted); }
.bubble { border-radius: 20px; }
.bubble.me { margin-top: 2px; }
.bubble.them { box-shadow: var(--shadow); }
.bubble.tail.me { border-bottom-right-radius: 6px; }
.bubble.tail.them { border-bottom-left-radius: 6px; }
.bubble.me + .bubble.them, .bubble.them + .bubble.me, .card + .bubble, .bubble + .card { margin-top: 10px; }
.bubble.rich ul li::marker { color: var(--accent); }
.bubble.me a { color: #fff; }
.typing { background: var(--them); box-shadow: var(--shadow); border-radius: 18px 18px 18px 6px; }
.typing span { background: var(--accent); }
.typing.drafting { border-radius: 20px 20px 20px 6px; }

.card { background: var(--card); border-color: var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.card-actions button, .card-progress { color: var(--accent); }
.card-progress { background: var(--accent); }
.card-actions button.is-busy::after { border-color: var(--accent); border-right-color: transparent; }
.card-edit:focus { border-color: var(--accent); }

/* Quick questions: shown while the message box is empty; one tap asks Robin. */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 10px 2px; background: var(--bg); scrollbar-width: none; flex: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: none; border: 0; border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 14px;
  background: var(--brand-soft); color: var(--accent); cursor: pointer;
}
.chips button:active { filter: brightness(0.95); }
.chips.is-new { animation: rw-fade-in 200ms var(--ease-out, ease) both; }
.chips:empty { display: none; }

#composer, #recorder { background: var(--bg); border-top: 0; padding-top: 6px; }
#input { background: var(--card); border: 0; box-shadow: var(--shadow), 0 0 0 1px var(--line); border-radius: 22px; padding: 9px 15px; }
#input:focus { box-shadow: var(--shadow), 0 0 0 1.5px var(--accent); }
#send { width: 36px; height: 36px; background: var(--accent); margin-bottom: 1px; }
#send:disabled { background: var(--line); }
#mic { width: 36px; height: 36px; background: var(--accent); color: #fff; margin-bottom: 1px; }
#mic svg { width: 20px; height: 20px; }
#talk-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 0; flex: none; cursor: pointer;
  display: grid; place-items: center; margin-bottom: 1px;
  background: var(--card); color: var(--accent); box-shadow: var(--shadow), 0 0 0 1px var(--line);
}
#talk-btn svg { width: 20px; height: 20px; }
#talk-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rec-live { background: var(--card); border: 0; box-shadow: var(--shadow), 0 0 0 1px var(--line); }
#rec-send { background: var(--accent); }
#rec-cancel { background: var(--card); box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.jump { color: var(--accent); background: var(--card); }
.earlier { flex: none; align-self: center; margin: 12px auto 0; padding: 7px 14px; border: 0; border-radius: 999px; font: inherit; font-size: 13px; color: var(--accent); background: var(--card); cursor: pointer; }
.earlier:disabled { opacity: .6; }

.connect-note { background: var(--card); box-shadow: var(--shadow); }
.conn-btn { background: var(--accent); color: var(--on-accent); }
.conn-btn.quiet { background: none; color: var(--accent); }
.switch:checked { background: var(--accent); }

#signin { background: var(--bg); }
.signin-card h1 { font-family: var(--display); font-weight: 700; }
.primary { background: var(--brand); }

@media (min-width: 640px) {
  .chips { padding-left: max(16px, calc((100% - 760px) / 2)); padding-right: max(16px, calc((100% - 760px) / 2)); }
}

/* ===== Settings ==========================================================================
   One screen with two tabs (George, 7 Nov): Robin (connections, drafts, automatic jobs) and
   Team (everyone who signs in, then one person's switches). Inset cards on the warm paper,
   like the chat cards. Unfolded, the Robin cards sit in two columns and the team list sits
   beside the person you picked. */
.set-tabs {
  display: flex; gap: 4px; margin: 12px auto 0; padding: 4px; width: calc(100% - 32px); max-width: 420px;
  background: var(--line); border-radius: 999px; flex: none;
}
.set-tabs button {
  flex: 1; border: 0; background: none; color: var(--muted); font: inherit; font-size: 15px; font-weight: 600;
  padding: 8px 12px; border-radius: 999px; cursor: pointer; transition: background 0.2s, color 0.2s;
}
.set-tabs button[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.set-main { padding-top: 14px; }
.set-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.set-robin { display: flex; flex-direction: column; gap: 14px; }
.set-card { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 4px 16px; }
.set-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 0 2px; }
.set-card-head h3 { margin: 0; font-size: 15px; font-weight: 700; font-family: var(--display); }
.set-card-aside { color: var(--muted); font-size: 13px; flex: none; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 0.5px solid var(--line); min-height: 56px; }
.set-card-head + .set-row, .set-card > .set-row:first-child { border-top: 0; }
.set-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.set-row-title { font-size: 16px; font-weight: 500; line-height: 1.3; }
.set-row-detail { color: var(--muted); font-size: 13.5px; line-height: 1.35; display: flex; flex-wrap: wrap; column-gap: 8px; row-gap: 2px; }
.set-row .conn-btn { font-size: 14px; font-weight: 600; padding: 7px 14px; }
.set-row .conn-btn.quiet { padding: 7px 0; }
.set-app {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none;
  font-weight: 700; font-size: 16px; color: #fff; background: var(--brand);
}
.set-app--mail { background: #c5482f; }
.set-app--instant { background: #d89a1c; font-size: 17px; }
.set-app--voice { background: #5a6f9c; font-size: 17px; }
.set-app--tasks { background: #4772fa; font-size: 17px; }
.set-token { display: flex; gap: 8px; width: 100%; margin-top: 8px; }
.set-token-input {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--text); background: var(--bg);
  border: 0.5px solid var(--line); border-radius: 10px; padding: 7px 10px;
}
.set-token .conn-btn { border: 0; font: inherit; font-size: 14px; font-weight: 600; padding: 7px 14px; cursor: pointer; }
.set-token-error { color: var(--danger); font-size: 13px; width: 100%; }
.set-status { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--text); }
.set-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.set-status--ok i { background: var(--ok, #1f9d55); }
.set-status--wait i { background: #d89a1c; }
.set-status--off { color: var(--danger); }
.set-status--off i { background: var(--danger); }
.set-foot { color: var(--muted); font-size: 13px; margin: 0; padding: 4px 0 14px; }
/* What Robin has learned (Settings): a rule per row, Edit and Forget beside it. */
.learn-row { align-items: flex-start; }
.learn-rule { font-size: 15px; font-weight: 500; }
.learn-tools { display: flex; gap: 14px; flex-shrink: 0; align-items: center; }
.learn-edit { width: 100%; min-height: 64px; }
.learn-filter { width: 100%; margin: 4px 0 6px; }
.learn-list { max-height: 60vh; overflow-y: auto; }
.learn-sub { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 12px 0 2px; }
.learn-allow { margin-bottom: 4px; }
.modes-lede { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 2px 0 8px; }
.modes-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 4px; }
.modes-chip {
  font: inherit; font-size: 13px; color: var(--text); background: transparent; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; min-height: 44px;
}
.modes-chip.on { background: var(--brand-soft); border-color: var(--accent); color: var(--text); font-weight: 600; }
.modes-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-items: center; }
.modes-changed { color: var(--accent); font-size: 11px; font-weight: 700; margin-left: 6px; }
.modes-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; border-radius: 11px; background: var(--bg); }
.modes-seg button {
  font: inherit; font-size: 13px; color: var(--muted); background: transparent; border: 0;
  border-radius: 9px; padding: 8px 4px; min-height: 44px; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.modes-seg button:focus-visible, .modes-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.modes-seg button:disabled { opacity: 0.35; cursor: not-allowed; }
.modes-seg button.on[data-m="do"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.modes-seg button.on[data-m="ask"] { background: var(--ask-soft); color: var(--ask); font-weight: 600; box-shadow: inset 0 0 0 1px var(--ask); }
.modes-seg button.on[data-m="never"] { background: var(--never-soft); color: var(--danger); font-weight: 600; box-shadow: inset 0 0 0 1px var(--danger); }
.modes-lock { color: var(--muted); font-size: 13px; background: var(--bg); border-radius: 11px; padding: 8px 10px; flex: none; }
@media (min-width: 1200px) { .modes-row { grid-template-columns: minmax(0, 1fr) 240px; } }
@media (max-width: 420px) { .modes-card .set-row:not(.modes-row) { flex-wrap: wrap; } }
@media (max-width: 420px) { .learn-row { flex-wrap: wrap; } .learn-tools { width: 100%; justify-content: flex-end; } }

.set-choices { display: flex; flex-direction: column; gap: 8px; padding: 8px 0 14px; }
.set-choice {
  display: grid; grid-template-columns: 22px 1fr; column-gap: 10px; row-gap: 2px; align-items: center;
  text-align: left; font: inherit; color: inherit; background: var(--bg); border: 1.5px solid transparent;
  border-radius: 14px; padding: 12px 14px; cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.set-choice[aria-checked="true"] { border-color: var(--accent); background: var(--brand-soft); }
.set-radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); grid-row: span 2; align-self: start; margin-top: 1px; transition: border 0.2s; }
.set-choice[aria-checked="true"] .set-radio { border: 6px solid var(--accent); }
.set-choice-title { font-weight: 600; font-size: 15.5px; }
.set-choice-detail { grid-column: 2; color: var(--muted); font-size: 13.5px; line-height: 1.35; }

.set-intro { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 0 4px 12px; }
.set-people { padding: 4px 8px; }
.set-person {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 8px; border: 0; background: none;
  font: inherit; color: inherit; text-align: left; border-top: 0.5px solid var(--line); border-radius: 0;
}
button.set-person { cursor: pointer; }
.set-people > .set-person:first-child { border-top: 0; }
button.set-person:active, .set-person[aria-current="true"] { background: var(--brand-soft); border-radius: 12px; }
.set-person[aria-current="true"] + .set-person { border-top-color: transparent; }
.set-avatar {
  --h: 140; width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 700; font-size: 15px; color: hsl(var(--h) 45% 28%); background: hsl(var(--h) 45% 88%);
}
.set-avatar--big { width: 64px; height: 64px; font-size: 22px; }
.set-chev { color: var(--muted); font-size: 22px; line-height: 1; flex: none; }
.set-pill {
  display: inline-block; font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--brand-soft); color: var(--accent); flex: none;
}
.set-pill--off { background: rgba(192, 38, 45, 0.1); color: var(--danger); }

#set-person { display: flex; flex-direction: column; gap: 14px; }
.set-hero { display: flex; align-items: center; gap: 14px; padding: 4px 4px 2px; }
.set-hero-name { font-family: var(--display); font-weight: 700; font-size: 21px; margin-bottom: 4px; }
.set-access .set-row-title { font-weight: 600; }
.set-changes {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 14px; color: var(--muted); padding: 0 4px;
}
.set-reset {
  border: 0; background: none; color: var(--accent); font: inherit; font-size: 14px; font-weight: 600;
  padding: 4px 0; cursor: pointer;
}
.set-changed { color: var(--accent); font-weight: 600; }
.set-groups { display: flex; flex-direction: column; gap: 14px; transition: opacity 0.2s; }
.set-groups.is-off { opacity: 0.45; }
.set-empty { color: var(--muted); text-align: center; margin: 40px 0; }

@media (prefers-color-scheme: dark) {
  .set-avatar { color: hsl(var(--h) 50% 85%); background: hsl(var(--h) 30% 24%); }
  .set-tabs { background: #1b231d; }
  .set-choice { background: #141a16; }
}

@media (min-width: 840px) {
  .set-main { padding-left: max(20px, calc((100% - 1040px) / 2)) !important; padding-right: max(20px, calc((100% - 1040px) / 2)) !important; }
  .set-robin { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 16px; }
  .set-main.is-split { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 20px; align-items: start; }
  .set-main.is-split > #set-team { position: sticky; top: 0; }
  .set-main.is-split > .connect-note { grid-column: 1 / -1; }
}

/* ===== Motion ============================================================================
   Everything that moves lives in this block, keyed off class names (.card, .card-actions,
   .card-done and the modifiers app.js adds), so the look of the cards can change without
   touching it. Only transform and opacity are animated, so it stays smooth on a folding
   phone's cover screen and never fights the unfolded layout. Reduce Motion turns it into
   short fades at the end of the block. */
:root {
  --spring: cubic-bezier(0.2, 0.9, 0.3, 1.18);
  --ease-out: cubic-bezier(0.25, 0.8, 0.25, 1);
  --ok: #1f9d55;
}
@media (prefers-color-scheme: dark) { :root { --ok: #34c759; } }

/* Messages: yours lifts off the message box, Robin's fades up from the left. */
.bubble.me { transform-origin: 100% 100%; }
.bubble.them { transform-origin: 0 100%; }
.bubble.me.is-new { animation: rw-send-in 380ms var(--spring) both; }
.bubble.them.is-new { animation: rw-them-in 300ms var(--ease-out) both; }
.bubble.me.sending { opacity: 0.85; }
.bubble.me.failed { opacity: 0.6; cursor: pointer; margin-bottom: 18px; position: relative; }
.bubble.me.failed::after {
  content: "Not sent · Tap to try again"; position: absolute; right: 2px; top: 100%; margin-top: 3px;
  font-size: 12px; color: var(--danger); white-space: nowrap;
}
@keyframes rw-send-in { from { opacity: 0; transform: translateY(26px) scale(0.86); } 60% { opacity: 1; } }
@keyframes rw-them-in { from { opacity: 0; transform: translateY(8px) scale(0.94); } }
@keyframes rw-fade-in { from { opacity: 0; } }

/* The mic and the send arrow swap with a quick turn. */
#send.is-new, #mic.is-new { animation: rw-swap 220ms var(--ease-out); }
@keyframes rw-swap { from { opacity: 0; transform: scale(0.4) rotate(-40deg); } }

/* Typing: the dots ripple, the bubble grows in from its corner and shrinks away. */
.typing span { opacity: 0.45; animation: rw-wave 1.1s ease-in-out infinite; }
.typing span:nth-child(2) { animation-delay: 0.14s; }
.typing span:nth-child(3) { animation-delay: 0.28s; }
@keyframes rw-wave { 0%, 60%, 100% { transform: none; opacity: 0.45; } 30% { transform: translateY(-4px); opacity: 1; } }
#typing { transform-origin: 0 100%; }
#typing.is-new { animation: rw-them-in 240ms var(--spring) both; }
#typing.is-leaving { animation: rw-pop-out 160ms var(--ease-out) both; }
@keyframes rw-pop-out { to { opacity: 0; transform: scale(0.8); } }
/* Words as they're written: each new piece fades in. */
.typing.drafting { overflow: hidden; }
.typing.drafting span.words {
  width: auto; height: auto; border-radius: 0; background: none; opacity: 1;
  animation: rw-words 340ms var(--ease-out) both; animation-delay: 0s;
}
@keyframes rw-words { from { opacity: 0; filter: blur(3px); } }

/* Cards slide up into the chat. */
.card { position: relative; transform-origin: 0 100%; }
.card.is-new { animation: rw-card-in 420ms var(--spring) both; }
@keyframes rw-card-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
.card-fold { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 360ms var(--ease-out), opacity 260ms; }
.card-fold-inner { overflow: hidden; min-height: 0; }
/* Finished cards fold down to their result line; tapping the line opens them again. */
.card--done .card-fold { grid-template-rows: 0fr; opacity: 0; }
.card--done.card--peek .card-fold, .card--done.card--closing .card-fold { grid-template-rows: 1fr; opacity: 1; }
.card--done .card-done {
  display: flex; align-items: center; gap: 8px; width: 100%; margin: 0; background: none; border: 0;
  border-top: 0.5px solid var(--line); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.card--done:not(.card--peek) .card-done { border-top-color: transparent; }
.card--send .card-done, .card--save .card-done, .card--confirm .card-done { color: var(--text); }
.card--skipped { opacity: 0.62; transition: opacity 300ms; }
.card-tick {
  width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--ok); color: #fff;
}
.card-tick svg { width: 12px; height: 12px; }
.card-tick path { stroke-dasharray: 20; stroke-dashoffset: 0; }
.card--save .card-tick { background: var(--me); }
.card--skipped .card-tick { background: none; border: 1.5px solid var(--muted); width: 14px; height: 14px; margin: 0 3px; }
.card--just-done .card-done { animation: rw-them-in 280ms var(--ease-out) both; }
.card--just-done .card-tick { animation: rw-pop 380ms var(--spring) both 80ms; }
.card--just-done .card-tick path { animation: rw-draw 300ms var(--ease-out) both 220ms; }
.card--just-done.card--send { animation: rw-glow 900ms var(--ease-out); }
@keyframes rw-pop { from { transform: scale(0); } }
@keyframes rw-draw { from { stroke-dashoffset: 20; } }
@keyframes rw-glow { from { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.5); } to { box-shadow: 0 0 0 10px rgba(52, 199, 89, 0); } }
/* While a tap is being answered: a spinner on that button and a thin bar along the top. */
.card-progress { position: absolute; left: 0; top: 0; height: 2px; width: 0; background: var(--me); pointer-events: none; }
.card--sending .card-progress { animation: rw-progress 1.6s var(--ease-out) forwards; }
@keyframes rw-progress { to { width: 85%; } }
.card-actions button { position: relative; }
.card-actions button.is-busy:disabled { opacity: 1; color: transparent; }
.card-actions button.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--me); border-right-color: transparent; animation: rw-spin 700ms linear infinite;
}
@keyframes rw-spin { to { transform: rotate(360deg); } }
/* It didn't go through: a small shake, and the card stays open. */
.card.is-shaking { animation: rw-shake 360ms var(--ease-out); }
@keyframes rw-shake {
  20% { transform: translateX(-6px); } 40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); } 80% { transform: translateX(2px); }
}
.card-note { color: var(--danger); font-size: 13px; padding: 0 14px 10px; }
.card-edit.is-new { animation: rw-fade-in 200ms var(--ease-out) both; }

/* Voice notes: the recorder slides up, bars follow your voice, and the note shimmers while
   it's turned into words. Robin's spoken reply fills its button as it plays. */
#recorder.is-new { animation: rw-slide-up 280ms var(--spring) both; }
#composer.is-new { animation: rw-fade-in 200ms var(--ease-out) both; }
@keyframes rw-slide-up { from { opacity: 0; transform: translateY(100%); } }
.rec-dot { animation: rw-breathe 1.4s ease-in-out infinite; }
@keyframes rw-breathe { 50% { transform: scale(0.7); opacity: 0.5; } }
.rec-bars { flex: 1; min-width: 0; height: 22px; display: flex; align-items: center; justify-content: flex-end; gap: 2px; overflow: hidden; }
.rec-bars i { width: 3px; flex: none; border-radius: 2px; background: var(--muted); animation: rw-bar-in 120ms linear both; transform-origin: center; }
@keyframes rw-bar-in { from { transform: scaleY(0.2); } }
.rec-live:has(.rec-bars:not(:empty)) .rec-hint { display: none; }
.voice-pending { display: flex; flex-direction: column; gap: 8px; }
.bubble.pending.voice-pending { opacity: 1; }
.voice-wave { display: flex; align-items: center; gap: 2px; height: 22px; }
.voice-wave i { width: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.85); }
.voice-shimmer {
  display: block; height: 9px; width: 70%; border-radius: 5px;
  background: linear-gradient(90deg, rgba(255,255,255,.2) 0%, rgba(255,255,255,.55) 50%, rgba(255,255,255,.2) 100%);
  background-size: 200% 100%; animation: rw-shimmer 1.1s linear infinite;
}
@keyframes rw-shimmer { from { background-position: 200% 0; } to { background-position: 0 0; } }
.play, .play[aria-pressed="true"] {
  background: linear-gradient(90deg, rgba(127,127,127,.38) var(--played, 0%), rgba(127,127,127,.18) var(--played, 0%));
}

/* Scrolled up when something new comes in: a pill to take you down. It sits over the bottom
   of the chat without taking any room. */
.jump-wrap { position: sticky; bottom: 10px; height: 0; flex: none; display: flex; align-items: flex-start; justify-content: center; overflow: visible; z-index: 2; }
.jump {
  flex: none; white-space: nowrap;
  transform: translateY(-100%); border: 0.5px solid var(--line); border-radius: 999px; padding: 7px 14px;
  background: var(--bg); color: var(--me); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}
.jump.is-new { animation: rw-jump-in 360ms var(--spring) both; }
@keyframes rw-jump-in { from { opacity: 0; transform: translateY(-40%) scale(0.9); } }

/* Chat, Needs you and Settings slide across; a person's permissions slide in over the team list. */
.set-detail.is-entering { animation: rw-from-right-soft 300ms var(--ease-out) both; }
@keyframes rw-from-right-soft { from { transform: translateX(28px); opacity: 0; } }
.screen-push-in, .screen-pop-out { z-index: 3; background: var(--bg); box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12); }
.screen-push-in { animation: rw-from-right 360ms var(--ease-out) both; }
.screen-push-out { animation: rw-to-left 360ms var(--ease-out) both; }
.screen-pop-in { animation: rw-from-left 360ms var(--ease-out) both; }
.screen-pop-out { animation: rw-to-right 360ms var(--ease-out) both; }
@keyframes rw-from-right { from { transform: translateX(100%); } }
@keyframes rw-to-left { to { transform: translateX(-25%); opacity: 0.6; } }
@keyframes rw-from-left { from { transform: translateX(-25%); opacity: 0.6; } }
@keyframes rw-to-right { to { transform: translateX(100%); } }
.screen-push-in .set-card { animation: rw-them-in 320ms var(--ease-out) both 120ms; }

/* Reduce Motion: nothing slides, bounces or spins; things that arrive fade in quickly. */
@media (prefers-reduced-motion: reduce) {
  .is-new, #typing.is-new, .bubble.me.is-new, .bubble.them.is-new, .card.is-new, .jump.is-new,
  #recorder.is-new { animation: rw-fade-in 160ms linear both; }
  #send.is-new, #mic.is-new, .rec-bars i, .screen-push-in .set-card, .set-detail.is-entering, .card--just-done .card-done,
  .card--just-done .card-tick, .card--just-done .card-tick path, .card--just-done.card--send,
  .card.is-shaking, #typing.is-leaving, .typing.drafting span.words { animation: none; }
  .typing span, .rec-dot { animation: none; opacity: 0.6; }
  .voice-shimmer { animation: none; background: rgba(255, 255, 255, 0.35); }
  .card--sending .card-progress { animation: none; width: 85%; opacity: 0.5; }
  .card-actions button.is-busy::after { animation-duration: 1.6s; }
  .card-fold, .card--skipped { transition: none; }
}

/* Receipts and bills: the paperclip, the photo or PDF in the chat, and the expense card's
   form when its details are being corrected. */
#attach {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: none; color: var(--muted);
  display: grid; place-items: center; margin-bottom: 1px; cursor: pointer; flex: none; padding: 0;
}
#attach svg { width: 22px; height: 22px; }
#attach:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bubble.file { padding: 4px; background: var(--me); }
.bubble.file .file-img {
  display: block; max-width: min(240px, 100%); max-height: 320px; border-radius: 16px; cursor: zoom-in;
  background: var(--brand-soft);
}
.bubble.file .file-caption { padding: 6px 10px 4px; white-space: pre-wrap; }
.bubble.file.failed { opacity: 0.75; }
.bubble.file.failed .file-caption:last-child { font-size: 13px; }
.file-chip {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.16); color: inherit; text-decoration: none; max-width: 260px;
}
.file-icon {
  flex: none; width: 34px; height: 40px; border-radius: 6px; background: #fff; color: var(--danger);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
}
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.receipt-form { display: grid; gap: 8px; padding: 8px 12px 12px; }
.rf-row { display: grid; gap: 3px; font-size: 12.5px; color: var(--muted); }
.rf-row input, .rf-row select {
  width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 16px; color: var(--text); background: var(--bg); -webkit-appearance: none;
  appearance: none;
}
.rf-row select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px;
}
.rf-row input:focus, .rf-row select:focus { outline: none; border-color: var(--accent); }
.receipt-form.is-new { animation: rw-fade-in 200ms var(--ease-out) both; }
/* On a wide screen (an unfolded phone, a tablet) the short fields sit two to a row. */
@media (min-width: 560px) {
  .receipt-form { grid-template-columns: 1fr 1fr; column-gap: 10px; }
  .rf-row:nth-child(1), .rf-row:nth-child(6), .rf-row:nth-child(9) { grid-column: 1 / -1; }
}
.card--file .card-done { color: var(--text); }
@media (prefers-reduced-motion: reduce) { .receipt-form.is-new { animation: none; } }
/* ===== Needs you =========================================================================
   The list of what needs George (needs.py): a round button with an urgent-only badge in
   the chat header, a screen with Urgent / Today / a folded This week, and the round-up
   cards in the chat. Uses the Grounds tokens: --accent green, --card white, --danger red. */
.needs-btn { position: relative; }
.needs-badge {
  position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: var(--on-danger); font-size: 11px; font-weight: 700;
  line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--brand);
}
.needs-sub { font-size: 12px; color: #cfe3d4; }
.needs-main {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; padding: 12px 16px calc(env(safe-area-inset-bottom) + 20px);
  display: flex; flex-direction: column; gap: 6px;
}
#needs-list { display: flex; flex-direction: column; gap: 14px; }
.needs-group { display: flex; flex-direction: column; }
.needs-head {
  margin: 0 0 2px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); display: flex; align-items: center; gap: 8px;
}
.needs-head::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.needs-group--urgent .needs-head { color: var(--danger); }
.needs-group--urgent .needs-head::before { background: var(--danger); }
.needs-group--week .needs-head { cursor: pointer; list-style: none; padding: 8px 0; }
.needs-group--week .needs-head::-webkit-details-marker { display: none; }
.needs-group--week .needs-head::before { background: var(--muted); }
.needs-group--week:not([open]) .needs-head::after { content: "▸"; }
.needs-group--week[open] .needs-head::after { content: "▾"; }
#needs-list .card { max-width: none; width: 100%; align-self: stretch; }
#needs-list .card--urgent { border-color: var(--danger); box-shadow: inset 3px 0 0 var(--danger); }
#needs-list .card--urgent .card-title { color: var(--danger); font-weight: 600; }
.needs-empty { color: var(--muted); text-align: center; margin: 48px 12px; font-size: 15px; line-height: 1.45; }
.needs-push {
  display: flex; align-items: center; gap: 12px; background: var(--card); border: 0.5px solid var(--line);
  border-radius: 14px; padding: 10px 12px; font-size: 14px; color: var(--text); margin-bottom: 6px;
}
.needs-push span { flex: 1; }
.needs-push--on { background: none; border: 0; padding: 0 4px; font-size: 13px; color: var(--muted); margin-bottom: 0; }
.needs-push--on button.quiet { font-size: 13px; padding: 2px 4px; }
.needs-push button {
  flex: none; background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 7px 14px;
  font: inherit; font-weight: 600; cursor: pointer;
}
.needs-push button.quiet { background: none; color: var(--accent); padding: 7px 4px; }

.card.roundup { padding-bottom: 4px; }
.roundup-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 2px; }
.roundup-chip { font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--accent); }
.roundup-chip--urgent { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.roundup-chip--done { background: none; color: var(--muted); font-weight: 500; padding-left: 2px; }
.roundup-fyi { margin: 6px 0 0; padding: 0 14px 0 32px; font-size: 14px; color: var(--muted); }
.roundup-fyi li { margin: 2px 0; }
.roundup-open {
  display: block; background: none; border: 0; color: var(--accent); font: inherit; font-size: 15px;
  font-weight: 600; padding: 8px 14px 8px; cursor: pointer;
}
@media (min-width: 640px) {
  .needs-main { align-items: center; }
  .needs-main > * { width: min(100%, 640px); }
}
#needs-list .card-title { display: flex; align-items: center; gap: 8px; }
#needs-list .card-title > span { flex: 1; min-width: 0; }
.card-later {
  flex: none; background: var(--brand-soft); color: var(--accent); border: 0; border-radius: 999px;
  font: inherit; font-size: 13px; font-weight: 600; padding: 4px 10px; cursor: pointer;
}
.card-later:disabled { opacity: 0.5; }

/* --- Talk mode: a live spoken conversation (talk.py) ------------------------------------ */
/* One full screen over the chat: big words, one big End button, so it can be used from a
   dash mount at a glance, folded or open. */
.talk {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 28px) 20px calc(env(safe-area-inset-bottom) + 28px);
  background: var(--brand); color: var(--brand-text); text-align: center;
}
.talk-top { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.talk-top .avatar { width: 56px; height: 56px; }
.talk-top .avatar img { width: 100%; height: 100%; }
.talk-name { font-family: var(--display); font-size: 26px; font-weight: 700; }
.talk-state { font-size: 16px; opacity: 0.8; min-height: 1.3em; }
/* The live waveform: your voice while listening, Robin's while it talks, a slow ripple while
   it thinks. Drawn on a canvas by app.js (drawWave). */
.talk-wave { width: min(100%, 420px); height: 140px; flex: none; }
@keyframes rw-talk-breathe { 50% { transform: scale(1.1); } }
.talk-words { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 14px; }
.talk-words p { margin: 0; overflow-wrap: anywhere; }
.talk-you { font-size: 17px; opacity: 0.75; min-height: 1.4em; }
.talk-rowan { font-size: 22px; line-height: 1.35; min-height: 2.7em; }
.talk-note { margin: 0; font-size: 13px; opacity: 0.65; }
.talk-actions { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.talk-hush {
  background: rgba(255, 255, 255, 0.16); color: inherit; border: 0; border-radius: 999px;
  padding: 12px 22px; font-size: 16px; cursor: pointer;
}
.talk-actions .talk-hush[hidden] { display: none; }
/* A talk carrying on while the chat is shown ("show me"): a bar under the header leads back. */
.talk-bar {
  display: flex; align-items: center; gap: 10px; width: 100%; flex: none;
  padding: 9px 16px; border: 0; cursor: pointer; font: inherit; font-size: 15px; text-align: left;
  background: var(--brand); color: var(--brand-text);
}
.talk-bar[hidden] { display: none; }
.talk-bar i { width: 9px; height: 9px; border-radius: 50%; background: #7ee08a; flex: none; animation: rw-talk-pulse 1.6s ease-in-out infinite; }
.talk-bar span { flex: 1; opacity: 0.9; }
.talk-bar b { font-weight: 600; }
@keyframes rw-talk-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .talk-bar i { animation: none; } }
.talk-end {
  width: 76px; height: 76px; border-radius: 50%; border: 0; cursor: pointer;
  background: #d93a3f; color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.talk-end svg { width: 30px; height: 30px; }
.talk-end:focus-visible, .talk-hush:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@media (max-height: 560px) {
  .talk-top .avatar { display: none; }
  .talk-wave { height: 84px; }
}

/* --- Needs you in the chat (6 Nov): one batch per type, a slim index, Reply on a card --- */
.batch {
  align-self: stretch; display: flex; flex-direction: column; margin: 8px 0;
  border-left: 3px solid var(--brand-soft); padding-left: 8px;
}
.batch-head { font-size: 12px; font-weight: 600; color: var(--accent); letter-spacing: 0.02em; margin: 2px 0 2px 4px; }
.batch-items { display: flex; flex-direction: column; }
.batch .card { max-width: min(100%, 560px); margin: 4px 0; }
.batch .card-body.card-clamp { --lines: 2; }
.batch .card-said-msg.card-clamp { --lines: 2; }
.batch .card-draft-text.card-clamp { --lines: 4; }
.card .card-title:has(.card-reply) { display: flex; align-items: center; gap: 8px; }
.card .card-title:has(.card-reply) > span { flex: 1; min-width: 0; }
.card--urgent { border-color: var(--danger); box-shadow: inset 3px 0 0 var(--danger); }
.card--urgent .card-title { color: var(--danger); font-weight: 600; }
.card.is-flash { animation: rw-flash 1.6s var(--ease-out); }
@keyframes rw-flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: var(--shadow); } }
.reply-to {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 13px;
  color: var(--accent); background: var(--bar); border-top: 0.5px solid var(--line);
}
.reply-to[hidden] { display: none; }
.reply-to span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-to button { background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1; padding: 0 4px; cursor: pointer; }
.needs-row {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 0.5px solid var(--line);
  border-radius: 14px; padding: 8px 10px 8px 4px; margin: 4px 0;
}
.needs-group--urgent .needs-row { border-color: var(--danger); box-shadow: inset 3px 0 0 var(--danger); }
.needs-row-go {
  flex: 1; min-width: 0; text-align: left; background: none; border: 0; font: inherit; color: inherit;
  padding: 2px 8px; cursor: pointer;
}
.needs-row-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.needs-row-sub {
  font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; overflow: hidden;
}
@media (prefers-reduced-motion: reduce) { .card.is-flash { animation: none; outline: 2px solid var(--accent); } }

/* ===== One menu, every screen (George, 9 Nov) ============================================
   The whole-app tidy-up: one labelled menu instead of four round buttons (tabs along the
   bottom of a phone, a green rail down the side of an open fold, a tablet or a desktop),
   titles on the left of every header, cards with an icon for their type and one solid button
   for the main action, bigger things to tap and darker small print. On a wide screen Needs
   you and today's diary sit beside the chat. The Motion block above is untouched: it keys
   off the same class names. */
:root { --muted: #5f6a62; --soft-btn: #efece3; --nav-h: 0px; --rail: 0px; --side: 0px; }
@media (prefers-color-scheme: dark) { :root { --muted: #9aa69d; --soft-btn: #232c26; } }
button, input, select, textarea { font-family: inherit; }

body.has-nav { --nav-h: calc(58px + env(safe-area-inset-bottom)); }
/* Typing on a phone: the tabs step aside so the message box sits on the keyboard. */
body.has-nav.keyboard { --nav-h: 0px; }
.screen { left: var(--rail); height: calc(var(--app-height, 100%) - var(--nav-h)); }
@supports (height: 100dvh) { .screen { height: calc(var(--app-height, 100dvh) - var(--nav-h)); } }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: var(--nav-h);
  display: flex; padding: 5px 6px env(safe-area-inset-bottom);
  background: var(--card); border-top: 0.5px solid var(--line);
}
body.keyboard .nav { display: none; }
.nav-brand, .nav-me { display: none; }
.nav-btn {
  flex: 1; min-width: 0; min-height: 48px; padding: 0; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 11.5px; font-weight: 600; -webkit-tap-highlight-color: transparent;
}
.nav-pill { position: relative; width: 56px; height: 28px; border-radius: 14px; display: grid; place-items: center; transition: background 0.2s; }
.nav-pill svg { width: 22px; height: 22px; }
.nav-btn[aria-current="page"] { color: var(--accent); }
.nav-btn[aria-current="page"] .nav-pill { background: var(--brand-soft); }
.nav-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 12px; }
.nav .needs-badge { top: -4px; right: 6px; box-shadow: 0 0 0 2px var(--card); }

/* Headers: the title on the left, the same on every screen. */
.bar { display: flex; align-items: center; gap: 10px; padding-left: 16px; padding-right: 14px; }
.bar .who { flex: 1; min-width: 0; align-items: flex-start; gap: 1px; }
.bar .who-name { font-size: 20px; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-bar .who { align-items: center; gap: 10px; }
.needs-sub { font-size: 12.5px; }
.bar .bar-btn { font-size: 15px; font-weight: 600; padding: 8px 4px; }

/* Cards: what it is, what it says, one clear thing to tap. */
.card-title {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px 0;
  font-size: 15.5px; font-weight: 700; line-height: 1.25; color: var(--text);
}
.card-title > span:not(.card-ic) { flex: 1; min-width: 0; }
.card .card-title:has(.card-reply) > .card-ic, .card-title > .card-ic { flex: none; }
.card-ic {
  width: 32px; height: 32px; border-radius: 10px; flex: none; display: grid; place-items: center;
  color: var(--accent); background: color-mix(in srgb, currentColor 14%, transparent); font-size: 16px; font-weight: 400;
}
.card-ic svg { width: 18px; height: 18px; }
.card-ic--diary { color: var(--p1, #3f86d6); }
.card-ic--clock { color: var(--p2, #e0912a); }
.card-ic--dot { color: var(--muted); }
.card--done .card-ic { display: none; }
.card--done .card-title { font-size: 13px; font-weight: 500; color: var(--muted); padding-top: 10px; }
.card-body { padding-top: 8px; }
.card-actions { flex-wrap: wrap; gap: 8px; padding: 2px 12px 12px; border-top: 0; }
.card-actions button, .card-actions a.go {
  flex: 0 1 auto; order: 1; min-height: 44px; padding: 0 16px; border-radius: 12px;
  display: grid; place-items: center; font-size: 15px; font-weight: 600;
  background: var(--soft-btn); color: var(--text);
}
.card-actions button + button, .card-actions a + button, .card-actions button + a { border-left: 0; }
.card-actions .go { color: var(--accent); }
.card-actions .is-main { flex: 1 1 40%; order: 0; background: var(--me); color: #fff; }
.card-actions .quiet { order: 2; background: none; color: var(--muted); padding: 0 10px; }
.card-actions button:active, .card-actions a.go:active { filter: brightness(0.94); }
.card-actions button.is-main.is-busy::after { border-color: #fff; border-right-color: transparent; }
.card-actions button:focus-visible, .card-actions a.go:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-done { border-top: 0; }
.card-later { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.card-more summary { padding: 6px 0; }
.chips button { padding: 9px 14px; }
#send, #mic, #talk-btn, #attach { width: 40px; height: 40px; margin-bottom: 0; }
#input { min-height: 40px; }
@media (max-width: 380px) { .card-actions button { font-size: 15px; padding: 0 12px; } }

/* Needs you: each row leads with its type. */
.needs-row { gap: 10px; padding: 10px 10px 10px 12px; border-radius: 16px; min-height: 60px; }
.needs-row-go { padding: 2px 0; }
.needs-row-sub { font-size: 13.5px; }

/* Settings: who is signed in, and the way out, at the foot. */
.set-account { margin-top: 14px; }
.set-main.is-split > .set-account { grid-column: 1 / -1; margin-top: 0; }
.set-signout {
  flex: none; min-height: 44px; padding: 0 16px; border: 0; border-radius: 12px; cursor: pointer;
  font-size: 15px; font-weight: 600; color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.chat-side { display: none; }
.side-head {
  display: flex; justify-content: space-between; gap: 8px; margin: 0 2px 6px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.side-needs { display: flex; flex-direction: column; gap: 10px; }
.side-needs .needs-head { margin-left: 2px; }
.side-needs .needs-row-sub { -webkit-line-clamp: 1; }
.side-needs .needs-row { gap: 8px; padding-right: 8px; }
.side-needs .needs-row-title { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.25; }
.side-needs .card-later { padding: 0 10px; font-size: 12.5px; }
.chat-side .needs-push { flex-wrap: wrap; margin-bottom: 0; }
.chat-side .needs-push--on { padding: 0 2px; }
.side-empty { margin: 0 2px; font-size: 14px; color: var(--muted); }
.side-diary-row { display: flex; gap: 12px; padding: 7px 2px; font-size: 14.5px; }
.side-diary-time { flex: none; width: 46px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.side-diary-title { min-width: 0; overflow-wrap: anywhere; }
.side-diary-row.is-past { opacity: 0.55; }
.side-diary-row.is-off .side-diary-title { text-decoration: line-through; }
.chat-side.is-flash .needs-row { animation: rw-flash 1.6s var(--ease-out); }
@media (prefers-reduced-motion: reduce) { .chat-side.is-flash .needs-row { animation: none; } }

/* A phone: the tabs own the home-bar gap, so nothing above them leaves one. */
@media (max-width: 699px) {
  body.has-nav:not(.keyboard) #composer, body.has-nav:not(.keyboard) #recorder { padding-bottom: 8px; }
  body.has-nav .people-list { padding-bottom: 16px; }
  body.has-nav .needs-main { padding-bottom: 20px; }
}

/* An open fold, a tablet, a desktop: the menu is a rail and the headers go quiet. */
@media (min-width: 700px) {
  body.has-nav { --nav-h: 0px; --rail: 84px; }
  .nav {
    top: 0; right: auto; width: var(--rail); height: auto; flex-direction: column; gap: 6px; border: 0;
    padding: calc(env(safe-area-inset-top) + 14px) 8px calc(env(safe-area-inset-bottom) + 14px);
    background: var(--brand);
  }
  body.keyboard .nav { display: flex; }
  .nav-brand { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: 12px; color: #fff; font-weight: 700; font-size: 13px; }
  .nav-brand .avatar { width: 40px; height: 40px; background: var(--brand-soft); overflow: hidden; display: grid; }
  .nav-brand .avatar img { width: 100%; height: 100%; }
  .nav-btn { flex: none; padding: 8px 2px; color: #cfe3d4; }
  .nav-btn[aria-current="page"] { color: #fff; }
  .nav-btn[aria-current="page"] .nav-pill { background: rgba(255, 255, 255, 0.18); }
  .nav-btn:focus-visible { outline-color: #fff; }
  .nav .needs-badge { box-shadow: 0 0 0 2px var(--brand); }
  .nav-me { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: auto; color: #fff; font-weight: 600; min-width: 0; }
  .nav-initial { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--brand-soft); color: var(--accent); font-weight: 700; }
  .nav-name { display: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .bar {
    background: var(--bg); color: var(--text); border-radius: 0; border-bottom: 0.5px solid var(--line);
    padding: calc(env(safe-area-inset-top) + 14px) 20px 12px;
  }
  .bar .who-name { color: var(--text); font-size: 21px; }
  .bar .bar-btn { color: var(--accent); }
  .who-status, .needs-sub { color: var(--muted); }
  .who-status i { background: var(--accent); }
  .chat-bar .avatar { display: none; }
  .bar .icon-btn { background: var(--brand-soft); color: var(--accent); }
}
/* The chat has the whole screen at every width (George, 16 Nov: "just have chat please and
   needs you its own page"): the column of Needs you and the diary beside it is gone, and
   today's diary is the strip across the top. */
@media (min-width: 1100px) {
  body.has-nav { --rail: 208px; --side: 340px; }
  .nav { padding-left: 12px; padding-right: 12px; }
  .nav-brand { flex-direction: row; gap: 10px; padding: 2px 6px 16px; font-size: 18px; }
  .nav-btn { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 46px; padding: 4px 6px; border-radius: 12px; font-size: 15px; }
  .nav-pill { width: 36px; }
  .nav-btn[aria-current="page"] { background: rgba(255, 255, 255, 0.16); }
  .nav-btn[aria-current="page"] .nav-pill { background: none; }
  .nav-me { justify-content: flex-start; padding: 0 6px; }
  .nav-name { display: block; }
}
/* Fill the whole screen on iPhone (George, 10 Nov; app.js fillScreen sets html.tall). The
   home-screen app lays the page out shorter than the screen by the height of the clock bar
   and draws nothing fixed below that line, but 100lvh is the true height. So the page itself
   is made that tall and the screens and tabs are laid out on it, not pinned to the short
   window. Not while typing in any text box (html.kb-up, set in fitViewport): the keyboard
   path still follows the visible window. */
@media (max-width: 699px) {
  html.tall, html.tall body { height: 100lvh; }
  html.tall:not(.kb-up) .screen { position: absolute; height: calc(100lvh - var(--nav-h)); }
  html.tall:not(.kb-up) .nav { position: absolute; bottom: auto; top: calc(100lvh - var(--nav-h)); }
}

/* The day plan as a day view (10 Nov 2026): hour lines, blocks as tall as they last, coloured
   by what they are. Field visit green, Field task amber, other work plain, personal purple,
   office calendar blue. */
:root {
  --plan-grid: #eeebe2; --plan-task: #f1efe8; --plan-task-edge: #d9d4c6;
  --plan-visit: #dcebdf; --plan-visit-text: #1f5134;
  --plan-field: #f6e6c8; --plan-field-text: #7a4b05;
  --plan-me: #ece4f6; --plan-me-text: #5a3b86;
  --plan-cal: #e1e8f8; --plan-cal-text: #2c4a94;
  --plan-now: #d64545;
}
@media (prefers-color-scheme: dark) {
  :root {
    --plan-grid: #222b24; --plan-task: #222b24; --plan-task-edge: #34403a;
    --plan-visit: #1f3a29; --plan-visit-text: #9fdbb4;
    --plan-field: #3a2e17; --plan-field-text: #f0c879;
    --plan-me: #2c2338; --plan-me-text: #cdb6ef;
    --plan-cal: #1f2a44; --plan-cal-text: #a9bff2;
    --plan-now: #ff6961;
  }
}
.card.card--dayplan { width: 100%; max-width: min(100%, 480px); }
.card--dayplan .card-fold-inner > * { margin-left: 14px; margin-right: 14px; }
.plan-sum { font-size: 14.5px; color: var(--muted); line-height: 1.35; margin-top: 4px; }
.plan-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.plan-chip {
  font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--soft-btn); color: var(--muted); font-variant-numeric: tabular-nums;
}
.plan-allday {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px;
  padding-bottom: 8px; border-bottom: 0.5px solid var(--line);
}
.plan-allday-label { font-size: 12px; font-weight: 600; color: var(--muted); width: 44px; flex: none; }
.plan-ad { font-size: 12.5px; font-weight: 600; padding: 4px 9px; border-radius: 7px; max-width: 100%; overflow-wrap: anywhere; }
.plan-day { position: relative; margin-top: 16px; margin-bottom: 10px; }
.plan-hr { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--plan-grid); }
.plan-hr span {
  font-size: 12px;
  position: absolute; left: 0; top: -8px; font-weight: 600; color: var(--muted);
  font-variant-numeric: tabular-nums; background: var(--card); padding-right: 4px; line-height: 1.3;
}
.plan-gap {
  position: absolute; left: 44px; right: 0; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--muted); border-radius: 8px;
  background: repeating-linear-gradient(135deg, transparent 0 6px, var(--plan-grid) 6px 7px);
}
.plan-gap span { background: var(--card); padding: 0 8px; border-radius: 999px; }
.plan-blk {
  position: absolute; left: 44px; right: 0; border-radius: 8px; padding: 5px 9px; overflow: hidden;
  display: flex; gap: 8px; align-items: flex-start; min-width: 0; box-sizing: border-box;
}
.plan-bt { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; flex: none; padding-top: 1px; }
.plan-bw { min-width: 0; flex: 1; }
.plan-bn { font-weight: 600; font-size: 13.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-bx, .plan-bx-inline { font-size: 12px; font-weight: 500; opacity: 0.8; line-height: 1.3; }
.plan-bx { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-bd { font-size: 12px; opacity: 0.85; flex: none; font-variant-numeric: tabular-nums; padding-top: 1px; }
.plan-blk.plan-task { background: var(--plan-task); border: 1px solid var(--plan-task-edge); color: var(--text); }
.plan-blk.plan-task .plan-bt { color: var(--accent); }
.plan-visit { background: var(--plan-visit); color: var(--plan-visit-text); }
.plan-field { background: var(--plan-field); color: var(--plan-field-text); }
.plan-me { background: var(--plan-me); color: var(--plan-me-text); }
.plan-cal { background: var(--plan-cal); color: var(--plan-cal-text); }
/* A drive between appointments (travel.py): time in the van, not free. */
.plan-travel {
  background: repeating-linear-gradient(135deg, var(--plan-cal) 0 6px, transparent 6px 12px);
  color: var(--muted); border: 1px dashed var(--line);
}
.plan-warn { margin-top: 8px; padding: 8px 10px; border-radius: 10px;
  background: rgba(214, 120, 30, .12); color: inherit; font-size: 14px; line-height: 1.35; }
.plan-warn .card-label { color: #b8611a; }
.plan-warn-row + .plan-warn-row { margin-top: 4px; }
.plan-blk.is-past { filter: grayscale(0.7); }
.plan-blk.is-past > * { opacity: 0.55; }
.plan-now { position: absolute; left: 36px; right: 0; height: 0; border-top: 2px solid var(--plan-now); z-index: 1; }
.plan-now::before {
  content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--plan-now);
}
.plan-list { margin-top: 10px; margin-bottom: 10px; }
.plan-row {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; align-items: baseline;
  padding: 7px 0; border-top: 0.5px solid var(--line);
}
.plan-row:first-of-type { border-top: 0; padding-top: 2px; }
.plan-k { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.plan-n { font-weight: 600; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.plan-x { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.plan-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.plan-dot.plan-task { background: var(--muted); }
.plan-dot.plan-field { background: var(--plan-field-text); }
.plan-dot.plan-me { background: var(--plan-me-text); }

/* Cards to decide at a glance (10 Nov 2026, George: "hard to quickly skim and make
   decisions"). A small coloured tag for the kind (the day plan's colours), who or what in
   bold with any amount on the right, one line to decide, facts as chips, problems amber and
   reasons green, texts as bubbles, a pick list, and at most two buttons; the rest under ⋯. */
:root {
  --tag-robin: #ecebe6; --tag-robin-text: #545c56;
  --chip-bg: #f1efe8; --chip-text: #3d4a41;
  --warn-bg: #fbf0d9; --warn-text: #7a4b05; --ok-bg: #e3f0e6; --ok-text: #1f5134;
  --bubble-them: #f1efe8; --bubble-draft: #e3f0e6; --bubble-draft-text: #16301f;
  --card-btn-line: #e2ded2;
}
@media (prefers-color-scheme: dark) {
  :root {
    --tag-robin: #262e28; --tag-robin-text: #aab4ac;
    --chip-bg: #222b24; --chip-text: #c4cdc6;
    --warn-bg: #3a2e17; --warn-text: #f0c879; --ok-bg: #1f3a29; --ok-text: #9fdbb4;
    --bubble-them: #232c25; --bubble-draft: #1f3a29; --bubble-draft-text: #dcf3e3;
    --card-btn-line: #34403a;
  }
}
.card { width: min(100%, 440px); max-width: min(94%, 440px); }
.batch .card { width: 100%; max-width: min(100%, 560px); }
.card-top { display: flex; align-items: center; gap: 6px; padding: 10px 8px 0 14px; min-height: 40px; }
.card-tag {
  display: inline-flex; align-items: center; gap: 5px; flex: none; max-width: 70%;
  font-size: 12px; font-weight: 700; line-height: 1; padding: 5px 9px 5px 7px; border-radius: 999px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-tag svg { width: 14px; height: 14px; flex: none; }
.card-tag--msg { background: var(--plan-cal); color: var(--plan-cal-text); }
.card-tag--diary { background: var(--plan-visit); color: var(--plan-visit-text); }
.card-tag--money { background: var(--plan-field); color: var(--plan-field-text); }
.card-tag--robin { background: var(--tag-robin); color: var(--tag-robin-text); }
.card-urgent {
  font-size: 11.5px; font-weight: 700; color: var(--danger); padding: 4px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}
.card-age { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.card-icon-btn {
  width: 44px; height: 44px; margin: -4px -4px -4px 0; flex: none; display: grid; place-items: center; border: 0; background: none;
  color: var(--muted); border-radius: 10px; cursor: pointer; padding: 0;
}
.card-icon-btn svg { width: 19px; height: 19px; }
.card-icon-btn:hover, .card-icon-btn[aria-expanded="true"] { background: var(--chip-bg); color: var(--text); }
.card-icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.card .card-title { display: flex; align-items: baseline; gap: 10px; padding: 4px 14px 0; font-size: 17px; font-weight: 800; }
.card .card-title .card-who-text { flex: 1; min-width: 0; }
.card-amt { flex: none; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.card-amt small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.card-who { padding: 4px 14px 0; font-size: 16px; font-weight: 800; line-height: 1.3; }
.card-who.card-clamp { --lines: 3; }
.card-ask { padding: 2px 14px 0; font-size: 14.5px; color: var(--text); opacity: 0.86; line-height: 1.35; white-space: pre-wrap; }
.card-ask.card-clamp { --lines: 2; }
.card-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 0; }
.card-chip {
  font-size: 12.5px; font-weight: 600; padding: 4px 9px; border-radius: 8px; background: var(--chip-bg);
  color: var(--chip-text); font-variant-numeric: tabular-nums; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-line {
  display: flex; gap: 8px; align-items: flex-start; margin: 10px 14px 0; padding: 8px 10px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; line-height: 1.35;
}
.card-line svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.card-line--warn { background: var(--warn-bg); color: var(--warn-text); }
.card-line--ok { background: var(--ok-bg); color: var(--ok-text); }
.card-lines { margin: 10px 14px 0; border-top: 0.5px solid var(--line); }
.card-ln {
  display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 0.5px solid var(--line); font-size: 14px;
}
.card-ln span:first-child { min-width: 0; }
.card-ln span:last-child { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.card-ln--note { color: var(--muted); font-size: 13px; border-bottom: 0; }
.card-pairs { display: grid; grid-template-columns: 46px 1fr; gap: 6px 8px; padding: 10px 14px 0; font-size: 14px; line-height: 1.35; }
.card-pairs b { font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.card-foot { padding: 8px 14px 0; font-size: 12.5px; color: var(--muted); }
.card-then { padding-bottom: 10px; }
.card-then::first-letter { font-weight: 600; }
.card-rest { padding: 8px 14px 0; font-size: 14px; }
/* Texts as texts: theirs on the left, Robin's draft on the right; tap the draft to edit. */
.card-msgs { display: flex; flex-direction: column; gap: 4px; padding: 10px 14px 0; }
.card-msgs .card-said-msg {
  align-self: flex-start; max-width: 86%; background: var(--bubble-them); border: 0;
  border-radius: 16px 16px 16px 5px; padding: 7px 11px; font-size: 14.5px;
}
.card-msgs .card-draft-label { align-self: flex-end; margin: 6px 2px 0; font-size: 12.5px; }
.card-msgs .card-draft {
  align-self: flex-end; max-width: 92%; margin: 0; padding: 8px 12px; background: var(--bubble-draft);
  color: var(--bubble-draft-text); border-radius: 16px 16px 5px 16px;
}
.card-msgs .card-draft-text { font-size: 14.5px; }
.card-msgs .card-draft-text.card-clamp { --lines: 4; }
.card-draft-text.is-editable { cursor: text; }
.card-edit { width: calc(100% - 28px); margin: 10px 14px 0; }
/* A pick list: Field's free times, or the job an expense is for. */
.card-section { padding: 12px 14px 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.card-opt-list { display: grid; gap: 6px; padding: 0 14px; }
.card-opt {
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center;
  min-height: 44px; padding: 9px 12px 9px 34px; text-align: left; font: inherit; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.card-opt::before {
  content: ""; position: absolute; left: 11px; top: 13px; width: 14px; height: 14px; box-sizing: border-box;
  border-radius: 50%; border: 2px solid var(--card-btn-line);
}
.card-opt[aria-checked="true"] { border-color: var(--accent); background: var(--brand-soft); }
.card-opt[aria-checked="true"]::before { border: 4px solid var(--accent); }
.card-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-opt-t { font-size: 14.5px; min-width: 0; font-variant-numeric: tabular-nums; }
.card-opt-t b { font-weight: 800; }
.card-opt-badge {
  font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--chip-bg);
  color: var(--muted); white-space: nowrap;
}
.card-opt-badge.is-rec { background: var(--plan-visit); color: var(--plan-visit-text); }
.card-opt-n { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.card-opt-more { padding-left: 12px; grid-template-columns: 1fr; text-align: center; color: var(--accent); font-weight: 700; font-size: 14px; border-style: dashed; }
.card-opt-more::before { display: none; }
.card-strip { margin: 12px 14px 0; }
.card-strip-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.card-strip-head span:last-child { color: var(--muted); font-weight: 600; }
.card-strip-bar {
  position: relative; height: 34px; border-radius: 10px; border: 1px solid var(--line); overflow: hidden;
  background: repeating-linear-gradient(90deg, var(--plan-grid) 0 1px, transparent 1px 9.0909%);
}
.card-strip-blk {
  position: absolute; top: 4px; bottom: 4px; border-radius: 6px; padding: 3px 5px; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis; font-size: 11px; font-weight: 600;
  background: var(--plan-task-edge); color: var(--muted);
}
.card-strip-blk.is-mine { background: var(--accent); color: var(--on-accent); font-weight: 700; z-index: 1; }
.card-strip-hours { display: flex; justify-content: space-between; margin-top: 3px; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Two buttons: the solid one for the likely yes, an outlined one for not now. */
.card .card-actions { padding: 12px 14px 14px; gap: 8px; flex-wrap: nowrap; }
.card .card-actions .is-main { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .card-actions .second {
  flex: none; background: none; color: var(--text); box-shadow: inset 0 0 0 1px var(--card-btn-line); order: 1;
}
.card .card-actions.card-answers { display: grid; grid-template-columns: repeat(3, 1fr); }
.card .card-actions.card-answers button { padding: 0 6px; font-size: 14px; line-height: 1.15; white-space: normal; }
/* ⋯: everything else the card can do. */
.card-menu { margin: 10px 14px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.card-menu > button, .card-menu > a {
  display: block; width: 100%; padding: 12px 14px; text-align: left; font: inherit; font-size: 15px;
  color: var(--text); background: var(--card); border: 0; border-bottom: 0.5px solid var(--line);
  text-decoration: none; cursor: pointer;
}
.card-menu > :last-child { border-bottom: 0; }
.card-menu > .quiet { color: var(--muted); }
.card-menu > :focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* A one-line card (Learned): the rule and its two small buttons. */
.card--mini .card-mini { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; padding: 10px 10px 10px 12px; }
.card--mini .card-mini-text { flex: 1 1 150px; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.3; }
.card--mini .card-actions { padding: 0; flex: none; margin-left: auto; }
.card--mini .card-actions button { min-height: 44px; min-width: 44px; padding: 0 12px; font-size: 14px; }
/* Done: the top line and pick list go, the result line stays. */
.card--done .card-top, .card--done .card-options, .card--done .card-menu { display: none; }
.card--done .card-title { padding-bottom: 0; }
.card--urgent { box-shadow: inset 0 0 0 1px var(--danger), var(--shadow); }
/* A page of Robin's own (Reconnect Field) as the main button: solid like any other. */
.card .card-actions a.go.is-main { background: var(--me); color: #fff; text-decoration: none; }
/* Three answers: the likely one across the top, the other two side by side under it. */
.card .card-actions.card-answers:has(> :nth-child(3)) { grid-template-columns: 1fr 1fr; }
.card .card-actions.card-answers:has(> :nth-child(3)) > .is-main { grid-column: 1 / -1; }

/* Tap a task in the day view to open it in Tasks; its circle ticks it off (11 Nov 2026). */
.plan-blk.is-link, .plan-row.is-link { cursor: pointer; text-decoration: none; }
.plan-blk.is-link:active, .plan-row.is-link:active { filter: brightness(0.94); }
.plan-tick {
  flex: none; width: 18px; height: 18px; margin: 0; padding: 0; border-radius: 50%;
  border: 2px solid currentColor; background: transparent; color: inherit; cursor: pointer;
  position: relative; opacity: 0.9; box-sizing: border-box;
}
/* A bigger tap area than the circle itself. */
.plan-tick::before { content: ""; position: absolute; inset: -12px; }
.plan-tick.is-on { background: currentColor; }
.plan-tick.is-on::after {
  content: ""; position: absolute; left: 4px; top: 3px; width: 6px; height: 3px;
  border: solid var(--card); border-width: 0 0 2px 2px; transform: rotate(-45deg);
}
.plan-blk .plan-tick { margin-top: 1px; }
.plan-blk.plan-task .plan-tick { color: var(--accent); }
.plan-row .plan-tick { width: 16px; height: 16px; margin-right: 8px; vertical-align: -3px; display: inline-block; }
.plan-row .plan-tick.plan-task { color: var(--muted); }
.plan-row .plan-tick.plan-field { color: var(--plan-field-text); background-color: transparent; }
.plan-row .plan-tick.plan-me { color: var(--plan-me-text); background-color: transparent; }
.plan-row .plan-tick.is-on { background-color: currentColor; }
.plan-blk.is-done .plan-bn, .plan-row.is-done .plan-n { text-decoration: line-through; }
.plan-blk.is-done { filter: grayscale(0.7); }
.plan-blk.is-done > :not(.plan-tick) { opacity: 0.55; }
.plan-row.is-done { opacity: 0.6; }

/* Calendar edits from the day view (tasks.js eventSheet): free stretches add an event. */
button.plan-gap { border: 0; font: inherit; font-size: 12px; color: var(--muted); padding: 0; cursor: pointer; }
button.plan-gap span { color: var(--accent); font-weight: 600; }
button.plan-ad { border: 0; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }

/* ===== A Needs you card, opened where you are (George, 15 Nov) ==========================
   Tapping a row in Needs you lifts that card into a sheet instead of jumping to it in the
   chat: up from the bottom on a phone or a closed fold, over the list beside the chat on an
   open fold, a tablet or a desktop. The card inside is the chat's own, so it works the same. */
.card-sheet { position: fixed; inset: 0; z-index: 30; }
.card-sheet[hidden] { display: none; }
.card-sheet-scrim {
  position: absolute; inset: 0; background: rgba(8, 12, 9, 0.45);
  transition: opacity 0.24s var(--ease-out);
}
.card-sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100% - 48px - env(safe-area-inset-top));
  display: flex; flex-direction: column; background: var(--bg); border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.22); padding-bottom: env(safe-area-inset-bottom);
  transition: transform 0.26s var(--ease-out);
}
.card-sheet.is-opening .card-sheet-panel, .card-sheet.is-closing .card-sheet-panel { transform: translateY(100%); }
.card-sheet.is-opening .card-sheet-scrim, .card-sheet.is-closing .card-sheet-scrim { opacity: 0; }
.card-sheet-head {
  position: relative; flex: none; display: flex; align-items: center; gap: 8px; padding: 18px 10px 6px 16px;
}
.card-sheet-grab {
  position: absolute; top: 7px; left: 50%; width: 38px; height: 5px; margin-left: -19px;
  border-radius: 3px; background: var(--line);
}
.card-sheet-back { display: none; }
.card-sheet-pos { flex: 1; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-sheet-chat {
  min-height: 44px; padding: 0 12px; border: 0; border-radius: 12px; cursor: pointer;
  background: none; color: var(--accent); font-size: 14.5px; font-weight: 600;
}
.card-sheet-close {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: var(--soft-btn); color: var(--text); cursor: pointer;
}
.card-sheet-close svg { width: 18px; height: 18px; }
.card-sheet-chat:focus-visible, .card-sheet-close:focus-visible, .card-sheet-back:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px 16px; }
.card-sheet-body > .card { max-width: none; width: 100%; margin: 0; align-self: stretch; }
.needs-row.is-open { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }

/* Wide: the card takes the place of the list beside the chat, with a way back to the list.
   The chat stays as it is, so there's no dimming. */
.card-sheet--side { left: auto; width: var(--side); inset-inline-start: auto; }
.card-sheet--side .card-sheet-scrim, .card-sheet--side .card-sheet-grab { display: none; }
.card-sheet--side .card-sheet-panel {
  top: 0; max-height: none; border-radius: 0; box-shadow: none; border-left: 0.5px solid var(--line);
}
.card-sheet--side.is-opening .card-sheet-panel, .card-sheet--side.is-closing .card-sheet-panel { transform: translateX(16px); opacity: 0; }
.card-sheet--side .card-sheet-panel { transition: transform 0.22s var(--ease-out), opacity 0.22s var(--ease-out); }
.card-sheet--side .card-sheet-head { padding: 14px 8px 6px 6px; }
.card-sheet--side .card-sheet-back {
  display: flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 8px 0 2px; border: 0; background: none;
  color: var(--accent); font-size: 14.5px; font-weight: 600; cursor: pointer;
}
.card-sheet--side .card-sheet-back svg { width: 20px; height: 20px; }
.card-sheet--side .card-sheet-pos { text-align: right; }
.card-sheet--side .card-sheet-close { display: none; }
@media (horizontal-viewport-segments: 2) {
  .card-sheet--side { left: env(viewport-segment-left 1 0, 50%); width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .card-sheet-panel, .card-sheet-scrim { transition: none; }
}

/* ===== A shorter Needs you (George, 15 Nov) ===============================================
   Stacked rows (one customer, or several new leads) open to show each; a ✓ on every row;
   an Undo bar after a tick; a swipe left for Tomorrow on a phone. */
.needs-stack { margin: 4px 0; }
.needs-stack > summary { list-style: none; cursor: pointer; margin: 0; position: relative; }
.needs-stack > summary::-webkit-details-marker { display: none; }
.needs-stack:not([open]) > summary { box-shadow: 0 5px 0 -1px var(--card), 0 5px 0 -0.5px var(--line); margin-bottom: 8px; }
.needs-stack-count {
  flex: none; min-width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: var(--accent); background: var(--brand-soft); padding: 0 8px;
}
.needs-stack > summary::after { content: "›"; flex: none; color: var(--muted); font-weight: 700; font-size: 18px; transition: transform .2s; }
.needs-stack[open] > summary::after { transform: rotate(90deg); }
.needs-stack-items { padding-left: 14px; border-left: 2px solid var(--line); margin: 2px 0 6px 10px; }
.needs-stack > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.needs-tick {
  flex: none; width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid var(--line); background: none;
  color: var(--accent); font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; display: grid; place-items: center;
}
.needs-tick:hover, .needs-tick:focus-visible { border-color: var(--accent); outline: none; }
.needs-tick:active { background: var(--accent); color: #fff; }
.needs-row { transition: transform .15s; touch-action: pan-y; }
.needs-row.is-swiping { background: var(--brand-soft); }
/* A phone: Tomorrow is a swipe left, so the name keeps its room beside the tick. */
@media (max-width: 699px) { #needs-list .needs-row:has(.needs-tick) .card-later { display: none; } }
.needs-undo {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); max-width: min(92vw, 420px);
  display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 16px; border-radius: 14px;
  background: var(--text); color: var(--bg); font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}
.needs-undo span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.needs-undo button {
  flex: none; background: none; border: 0; color: var(--bg); font: inherit; font-weight: 700; cursor: pointer;
  padding: 6px 10px; border-radius: 8px; text-decoration: underline;
}
@media (prefers-reduced-motion: reduce) { .needs-row, .needs-stack > summary::after { transition: none; } }

/* Who a card is about (George, 16 Nov: "hard to see what the leads are and their details"):
   what they are to the business beside the name, their details, and one tap to ring, text,
   find the place or open them in Field. */
.card-tag--lead { background: var(--ok-bg); color: var(--ok-text); }
.card-who-tag { flex: none; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.card-chip--ok { background: var(--ok-bg); color: var(--ok-text); }
.card-chip--warn { background: var(--warn-bg); color: var(--warn-text); }
.card-said-label { align-self: flex-start; margin: 2px 2px 0; font-size: 12px; font-weight: 600; }
.card-contact {
  display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; padding: 10px 14px 0; font-size: 13.5px; line-height: 1.4;
  user-select: text; -webkit-user-select: text;
}
.card-contact b { font-weight: 600; color: var(--muted); }
.card-contact span { min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.card-quick { display: flex; gap: 6px; padding: 10px 14px 0; }
.card-quick-btn {
  flex: 1 1 0; min-width: 0; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 6px 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text);
  font-size: 12.5px; font-weight: 600; text-decoration: none;
}
.card-quick-btn svg { width: 18px; height: 18px; color: var(--accent); }
.card-quick-btn:hover { background: var(--chip-bg); }
.card-quick-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.needs-row-wait {
  float: right; margin-left: 8px; font-size: 11.5px; font-weight: 700; line-height: 1.5; padding: 1px 7px; border-radius: 999px;
  background: var(--warn-bg); color: var(--warn-text); font-variant-numeric: tabular-nums;
}

/* Today across the top of the chat (16 Nov): visits and diary in time order, the one on now
   or next marked. The wide layout has the same list beside the chat instead. */
.day-strip { display: flex; gap: 8px; overflow-x: auto; padding: 8px 12px; flex: none; scrollbar-width: none; background: var(--bg); border-bottom: 0.5px solid var(--line); position: relative; }
.day-strip::-webkit-scrollbar { display: none; }
.day-chip { flex: none; max-width: 220px; display: flex; align-items: baseline; gap: 6px; padding: 7px 11px; border-radius: 12px; background: var(--card); border: 0.5px solid var(--line); font-size: 13.5px; white-space: nowrap; }
.day-chip-time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.day-chip-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.day-chip-flag { font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); }
.day-chip.is-link, .side-diary-row.is-link { font: inherit; font-size: 13.5px; color: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform 0.12s var(--ease-out), background 0.12s; }
.day-chip.is-link { min-height: 36px; align-items: center; }
.side-diary-row.is-link { width: 100%; border: 0; background: none; font-size: 14.5px; border-radius: 8px; }
.day-chip.is-link:active { transform: scale(0.96); background: var(--accent-soft, var(--card)); }
.side-diary-row.is-link:active { background: var(--card); }
.day-chip.is-link:focus-visible, .side-diary-row.is-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.day-chip.is-past { opacity: 0.5; }
.day-chip.is-off .day-chip-title { text-decoration: line-through; }
.day-chip.is-crew { background: transparent; border-style: dashed; color: var(--muted, inherit); }
.day-chip.is-crew .day-chip-time { color: inherit; font-weight: 600; }
.day-chip-crew { font-size: 11.5px; opacity: 0.8; }
.side-diary-row.is-crew { opacity: 0.65; }
.side-diary-crew { font-size: 11.5px; opacity: 0.8; margin-left: 6px; }
.day-chip.is-now, .day-chip.is-next { border-color: var(--accent); }
.side-diary-row.is-now .side-diary-title, .side-diary-row.is-next .side-diary-title { font-weight: 600; }
.day-mark { align-self: stretch; display: flex; align-items: center; gap: 10px; margin: 10px 4px 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.day-mark::before, .day-mark::after { content: ""; flex: 1; height: 0.5px; background: var(--line); }
.day-mark-text { flex: none; max-width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 14px; background: var(--bg); border-bottom: 0.5px solid var(--line); }
.now-btn { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; border: 0; padding: 2px 0; min-height: 40px; justify-content: center; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.now-line { font-size: 14.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-line { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-btn { flex: none; border: 0; border-radius: 999px; padding: 8px 14px; min-height: 36px; background: var(--accent); color: var(--on-accent); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.next-btn:active, .now-btn:active { filter: brightness(0.94); }

/* Later's three times, under a Needs you row. */
.later-menu { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 2px; }
.later-opt { border: 0.5px solid var(--line); border-radius: 999px; padding: 0 13px; min-height: 36px; background: var(--card); color: inherit; font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.later-opt:active { filter: brightness(0.95); }
.needs-row:has(.later-menu) { flex-wrap: wrap; }

/* Search and a customer's page: one panel over the app (16 Nov). */
.over { position: fixed; inset: 0; z-index: 40; }
.over[hidden] { display: none; }
.over-panel { position: absolute; inset: 0; margin: auto; display: flex; flex-direction: column; background: var(--bg); padding-top: env(safe-area-inset-top); }
.over-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 0.5px solid var(--line); flex: none; }
.over-title { flex: 1; min-width: 0; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.over-body { flex: 1; overflow-y: auto; padding: 12px 14px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.over-input { width: 100%; box-sizing: border-box; border: 0.5px solid var(--line); border-radius: 12px; padding: 12px 14px; font: inherit; font-size: 16px; background: var(--card); color: inherit; }
.over-results { display: flex; flex-direction: column; gap: 6px; }
.over-note { color: var(--muted); font-size: 14px; margin: 8px 2px; }
.over-head { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 12px 2px 2px; }
.over-tag { color: var(--muted); font-size: 14px; }
.over-row, .over-line { display: flex; flex-direction: column; gap: 2px; text-align: left; border: 0.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--card); color: inherit; font: inherit; }
.over-row { cursor: pointer; min-height: 44px; }
.over-row:active { filter: brightness(0.96); }
.over-row-title { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.over-row-sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.over-row-sub:empty { display: none; }
@media (min-width: 700px) {
  .over-panel { inset: 5vh 0; width: min(560px, 92vw); border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); overflow: hidden; padding-top: 0; }
}
.card-who-text.is-link { cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
/* The name is the way to the customer page: a full-size tap target without moving the title
   (the walk on 17 Nov measured it at 21px tall). */
.card-who-text.is-link { padding-block: 12px; margin-block: -12px; }
.card-photos { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; }
.card-photos a { flex: none; }
.card-photos img { display: block; width: 84px; height: 84px; object-fit: cover; border-radius: 10px; background: var(--line); }
.card-photos-more { align-self: center; color: var(--muted); font-size: 13px; padding: 0 6px; }

/* "2 of 3" on a card that's one of several things asked for in one go. */
.card-step { font-size: 11.5px; font-weight: 700; color: var(--muted); border: 0.5px solid var(--line); border-radius: 999px; padding: 1px 7px; }

/* The look card (look.js, George 18 Nov): what to check on site, notes and photos, saved to
   Field as they go; anything still on the phone (no signal) shows amber until it's sent. */
.look { padding-bottom: 2px; }
.look-section { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.look-section small { letter-spacing: 0; text-transform: none; font-size: 12px; font-weight: 600; }
.look-checks { display: grid; gap: 6px; padding: 0 14px; }
.look-check { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px 9px 36px; }
.look-check::before {
  content: ""; position: absolute; left: 11px; top: 10px; width: 16px; height: 16px; box-sizing: border-box;
  border-radius: 5px; border: 2px solid var(--card-btn-line);
}
.look-check.is-done { background: var(--brand-soft); border-color: transparent; }
.look-check.is-done::before { background: var(--accent); border-color: var(--accent); }
.look-check.is-done::after {
  content: ""; position: absolute; left: 16.5px; top: 12px; width: 5px; height: 9px;
  border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.look-q { font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.look-why { font-size: 12.5px; color: var(--muted); }
.look-opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.look-opt {
  min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; font-size: 14px; cursor: pointer;
}
.look-opt.is-on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.look-input, .look-notes {
  display: block; width: 100%; margin-top: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 16px; line-height: 1.35;
}
.look-notes { width: calc(100% - 28px); margin: 0 14px; min-height: 96px; resize: vertical; }
.look-input:focus, .look-notes:focus { outline: none; border-color: var(--accent); }
.look-opt:focus-visible, .look-add:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.look-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 14px; }
.look-ph, .look-add { aspect-ratio: 1; max-width: 100%; border-radius: 10px; overflow: hidden; position: relative; }
.look-ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.look-ph.is-wait img { opacity: 0.55; }
.look-ph.is-wait::after {
  content: ""; position: absolute; right: 5px; bottom: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--warn-text); box-shadow: 0 0 0 2px var(--card);
}
.look-ph.is-sent { display: grid; place-items: center; background: var(--ok-bg); color: var(--ok-text); }
.look-ph.is-sent svg { width: 22px; height: 22px; }
.look-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer;
  border: 1.5px dashed var(--accent); color: var(--accent); font-size: 12.5px; font-weight: 700;
}
.look-add svg { width: 22px; height: 22px; }
.look-status { display: flex; align-items: center; gap: 6px; padding: 10px 14px 0; font-size: 12.5px; color: var(--muted); }
.look-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.look-status.is-wait { color: var(--warn-text); font-weight: 600; }
.look-status.is-wait::before { background: var(--warn-text); }

/* The morning brief as an action card (George, 23 Nov, option A): "Do first" rows, each with
   one button, then folded groups. Colours are the card tags': texts/emails blue, diary and
   booking green, quotes and chases amber, new leads the lead green, urgent red. */
.card.card--brief { width: 100%; max-width: min(100%, 560px); }
.card--brief .card-fold-inner > * { margin-left: 14px; margin-right: 14px; }
.brief-head { font-size: 15px; line-height: 1.35; margin-top: 4px; }
.brief-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.brief-chip { font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; max-width: 100%; overflow-wrap: anywhere; }
.brief-chip--diary { background: var(--plan-visit); color: var(--plan-visit-text); }
.brief-chip--msg { background: var(--plan-cal); color: var(--plan-cal-text); }
.brief-flag { margin-top: 8px; }
.brief-sect {
  display: flex; justify-content: space-between; margin-top: 12px; margin-bottom: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.brief-sect-first { color: var(--danger); }
.brief-rows { border: 0.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.brief-row {
  display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 9px 10px 9px 0; min-height: 54px; border-top: 0.5px solid var(--line); background: var(--card);
}
.brief-row:first-child { border-top: 0; }
.brief-bar { align-self: stretch; background: var(--tag-robin); }
.brief-row--msg .brief-bar { background: var(--plan-cal-text); }
.brief-row--diary .brief-bar { background: var(--plan-visit-text); }
.brief-row--money .brief-bar { background: var(--plan-field-text); }
.brief-row--lead .brief-bar { background: var(--danger); }
.brief-txt { min-width: 0; }
.brief-txt.is-link { cursor: pointer; }
.brief-l1 { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-weight: 650; font-size: 15px; }
.brief-who { overflow-wrap: anywhere; }
.brief-amt { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.brief-l2 { color: var(--muted); font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere; }
.brief-why { color: var(--danger); font-size: 12.5px; font-weight: 600; margin-top: 1px; }
.card--brief .brief-btn {
  min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; cursor: pointer;
  font: inherit; font-size: 14.5px; font-weight: 600; white-space: nowrap;
  background: var(--me); color: #fff;
}
.card--brief .brief-btn:active { filter: brightness(0.94); }
.card--brief .brief-btn:disabled { opacity: 0.6; }
.card--brief .brief-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.brief-row.is-done { background: var(--ok-bg); }
.brief-row.is-done .brief-bar { background: var(--ok-text); }
.brief-row.is-done .brief-l1, .brief-row.is-done .brief-l2 { color: var(--ok-text); }
.brief-done { color: var(--ok-text); font-weight: 650; font-size: 13.5px; padding-right: 4px; }
.brief-grp { border: 0.5px solid var(--line); border-radius: 12px; margin-top: 8px; background: var(--card); }
.brief-grp > summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 10px 12px; min-height: 48px;
}
.brief-grp > summary::-webkit-details-marker { display: none; }
.brief-grp > .brief-rows { border: 0; border-top: 0.5px solid var(--line); border-radius: 0 0 12px 12px; }
.brief-grp-words { min-width: 0; display: flex; flex-direction: column; }
.brief-grp-name { font-weight: 650; }
.brief-grp-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brief-caret { color: var(--muted); font-size: 20px; transition: transform 0.15s; }
.brief-grp[open] .brief-caret { transform: rotate(90deg); }
.brief-fyi { margin-top: 10px; padding: 9px 12px; border-radius: 10px; background: var(--soft-btn); color: var(--muted); font-size: 14px; }
.brief-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 12.5px; }
.brief-prog { flex: 0 0 64px; height: 6px; border-radius: 6px; background: var(--soft-btn); overflow: hidden; }
.brief-prog i { display: block; height: 100%; background: var(--accent); transition: width 0.25s; }
@media (prefers-reduced-motion: reduce) { .brief-caret, .brief-prog i { transition: none; } }
