/* Carson — the window.
 *
 * Warm paper, warm ink, and one reddish brown that always means the same thing: this is
 * where you act. The send button, the mark on what cannot wait, the edge of the card you are
 * on, the button that asks him something. Everything that needs you is a flat card on the
 * paper; everything else is type. */

:root {
  --paper: #faf7f2;
  --surface: #fffdfa;
  --ink: #2b2724;
  --muted: #8a817a;
  --faint: #b5aca3;
  --line: #e5ded4;
  --line-strong: #d6cabb;
  --accent: #9a4a32;
  --accent-deep: #86402b;
  --accent-soft: #f2e4dd;
  --accent-dim: #c0714f;
  --sans: 'Geist', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'Geist Mono', 'Cascadia Mono', ui-monospace, Consolas, monospace;
  --col: 700px;
  --radius: 10px;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

html,
body,
#root {
  height: 100%;
  margin: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  user-select: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  resize: none;
  user-select: text;
  display: block;
  width: 100%;
}

textarea::placeholder {
  color: var(--faint);
}

button:focus-visible,
textarea:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px var(--accent-soft);
  border-radius: 6px;
}

/* ---- buttons -------------------------------------------------------------------- */

.primary {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  transition: background-color 0.12s ease;
}

.primary:hover:not(:disabled) {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

.primary:disabled {
  background: var(--line);
  border-color: var(--line);
  color: var(--muted);
}

.secondary {
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  transition:
    border-color 0.12s ease,
    color 0.12s ease;
}

.secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.secondary:disabled {
  opacity: 0.45;
}

.quiet {
  color: var(--accent);
  font-weight: 500;
  padding: 7px 10px;
  border-radius: 8px;
  flex: none;
}

.quiet:hover {
  background: var(--accent-soft);
}

.lang {
  color: var(--faint);
  font-size: 13px;
}

.lang:hover {
  color: var(--accent);
}

/* ---- the start ------------------------------------------------------------------ */

.start {
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15vh 32px 84px;
}

.start > .rule,
.start > h1,
.start > .list,
.start > .backlog {
  width: 100%;
  max-width: var(--col);
}

/* The pile, under the list: quiet, dashed like the open row, one button. */
.backlog {
  margin-top: 28px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: arrive 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: 0.3s;
}

.backlog p {
  margin: 0;
  line-height: 1.5;
}

.backlog .quiet {
  align-self: flex-start;
}

/* The old signature: a short accent rule above the title. */
.rule {
  height: 2px;
}

.rule::before {
  content: '';
  display: block;
  width: 44px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.start h1 {
  font-size: clamp(30px, 3.3vw, 38px);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin: 18px 0 26px;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list li {
  position: relative;
  animation: arrive 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 28ms + 60ms);
}

/* The cross, top right of a card, there only while the pointer is on the card. */
.list li .x {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 1;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--faint);
  opacity: 0;
  transition:
    opacity 0.12s ease,
    background-color 0.12s ease,
    color 0.12s ease;
}

.list li .x svg {
  width: 12px;
  height: 12px;
}

.list li:hover .x,
.list li .x:focus-visible {
  opacity: 1;
}

.list li .x:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* A card: flat, on the paper, with an edge. Active means the accent reaches the edge. */
.row {
  display: grid;
  grid-template-columns: 20px 1fr;
  column-gap: 12px;
  align-items: start;
  width: 100%;
  text-align: left;
  padding: 15px 18px 15px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition:
    border-color 0.12s ease,
    background-color 0.12s ease;
}

.row:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
}

.row:active {
  border-color: var(--accent);
}

.row .mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin: 8px 0 0 2px;
  background: transparent;
}

.row[data-priority='now'] .mark {
  background: var(--accent);
}

.row[data-status='working'] .mark {
  background: none;
  border: 1.5px solid var(--faint);
  animation: breathe 1.6s ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

.row .title {
  display: block;
  font-size: 16.5px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.row .meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13.5px;
  display: flex;
  gap: 14px;
  min-width: 0;
}

.row .meta span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row .meta .state {
  color: var(--faint);
}

/* A date on an item: quiet until it is today, then the accent. */
.row .meta .due.hot {
  color: var(--accent);
  font-weight: 500;
}

/* The open line at the end: an empty card, dashed until it is written in. */
.row.new {
  cursor: text;
  background: transparent;
  border-style: dashed;
  border-color: var(--line-strong);
}

.row.new:hover {
  background: transparent;
  border-color: var(--accent-dim);
}

.row.new:focus-within {
  background: var(--surface);
  border-style: solid;
  border-color: var(--accent-dim);
}

.row.new .mark {
  border: 1.5px solid var(--line-strong);
}

.row.new textarea {
  font-size: 16.5px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
  min-height: 23px;
  overflow: hidden;
}

.row.new textarea:focus-visible {
  box-shadow: none;
}

.row.new .acts {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.status {
  position: fixed;
  left: 24px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--faint);
  font-size: 13px;
  white-space: pre;
}

.status .error {
  color: var(--accent);
}

/* ---- an item ---------------------------------------------------------------------- */

.item {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.bar {
  flex: none;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 12px 8px 8px;
  border-radius: 8px;
}

.back:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.back svg {
  width: 16px;
  height: 16px;
}

/* Done, for the person's own to-dos: at the far end of the bar, quiet until hovered. */
.finish {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
}

.finish:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.finish svg {
  width: 15px;
  height: 15px;
}

.cols {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
}

@media (max-width: 960px) {
  .cols {
    grid-template-columns: 1fr;
  }
  .cols .thread {
    display: none;
  }
}

.thread {
  overflow-y: auto;
  padding: 8px 44px 64px 56px;
}

.thread .subject {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 26px;
}

.msg {
  max-width: 60ch;
  margin-bottom: 30px;
}

.msg .who {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  margin-bottom: 7px;
}

.msg .who b {
  font-weight: 500;
}

.msg .who span {
  color: var(--faint);
}

.msg.mine .who b {
  color: var(--muted);
}

/* Pictures that came with a message: small in the thread, large on a click. */
.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.thumb {
  height: 110px;
  max-width: 220px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: zoom-in;
  background: var(--surface);
  transition: border-color 0.12s ease;
}

.thumb:hover {
  border-color: var(--accent);
}

.thumb.loading {
  display: inline-block;
  width: 140px;
  background: var(--paper);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(43, 39, 36, 0.74);
  cursor: zoom-out;
}

.lightbox img {
  max-width: 92vw;
  max-height: 90vh;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.lightbox .name {
  position: fixed;
  bottom: 18px;
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  font-size: 13px;
  opacity: 0.85;
}

/* An own mail: who it goes to, and what goes with it. */
.ask-to {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.ask-to input {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 260px;
  user-select: text;
}

.ask-to input:focus-visible {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.ask-to .hint {
  color: var(--accent);
  font-size: 13px;
}

.attach {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.attach .chip.file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: default;
}

.attach .drop {
  color: var(--faint);
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
}

.attach .drop:hover {
  color: var(--accent);
}

.msg .body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15.5px;
  line-height: 1.6;
  user-select: text;
}

.msg.mine .body {
  color: var(--muted);
}

.draft {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 40px 24px 16px;
}

/* The reply is a card too — the one you are on, so its edge is already the accent. */
.draft .card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 26px 30px 28px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: var(--radius);
}

.draft .head {
  flex: none;
  margin-bottom: 18px;
}

.draft .head .subj {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.draft .head .to {
  color: var(--muted);
  font-size: 14px;
  margin-top: 2px;
}

.draft .head .note {
  color: var(--faint);
  font-size: 13.5px;
  margin-top: 10px;
}

.draft .head .note.error {
  color: var(--accent);
}

.draft textarea.body {
  flex: 1;
  min-height: 0;
  max-width: 64ch;
  font-size: 16px;
  line-height: 1.65;
  overflow-y: auto;
  transition: opacity 0.2s ease;
}

.draft textarea.body:focus-visible {
  box-shadow: none;
}

.draft textarea.body.faded {
  opacity: 0.45;
}

.skeleton {
  flex: 1;
  max-width: 60ch;
  padding-top: 6px;
}

.skeleton span {
  display: block;
  height: 13px;
  border-radius: 7px;
  margin-bottom: 15px;
  background: linear-gradient(90deg, var(--paper) 25%, var(--line) 50%, var(--paper) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.verdict {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding-top: 14px;
}

/* Grows with what is typed, so a real instruction can be read back before it goes. */
.change {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-height: 40px;
  padding: 7px 6px 7px 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  transition: border-color 0.12s ease;
}

.change:focus-within {
  border-color: var(--accent-dim);
}

.change textarea {
  line-height: 1.45;
  padding: 2px 0;
  max-height: 180px;
  overflow-y: auto;
}

.change textarea:focus-visible {
  box-shadow: none;
}

.change .quiet {
  padding: 4px 8px;
}

/* ---- ask Carson ------------------------------------------------------------------- */

.ask-fab {
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 20;
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--accent-deep);
  transition: background-color 0.12s ease;
}

.ask-fab:hover {
  background: var(--accent-deep);
}

.ask-panel {
  position: fixed;
  right: 24px;
  bottom: 74px;
  z-index: 20;
  width: min(420px, calc(100vw - 48px));
  max-height: min(62vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  animation: arrive 0.2s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.ask-head {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 10px;
  font-weight: 500;
}

/* Hugs its content: with nothing asked yet the field sits right under the title, and the
   panel grows with the conversation up to its ceiling. */
.ask-turns {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ask-turns:empty {
  padding: 0;
}

.ask-hint {
  color: var(--faint);
  margin: 0;
  font-size: 14px;
}

.ask-acts {
  display: flex;
  gap: 4px;
}

.ask-acts .lang.on {
  color: var(--accent);
}

/* Earlier conversations: the first question of each, and when it was last touched. */
.ask-earlier {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ask-past {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.12s ease;
}

.ask-past:hover {
  border-color: var(--accent);
}

.ask-past .q {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ask-past .m {
  color: var(--faint);
  font-size: 12.5px;
}

.turn a {
  color: var(--accent);
  text-decoration: none;
}

.turn a:hover {
  text-decoration: underline;
}

.turn .sources {
  margin-top: 6px;
  font-size: 13px;
  color: var(--faint);
}

.turn .sources a {
  margin-right: 10px;
}

.turn {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
  user-select: text;
}

.turn.user {
  align-self: flex-end;
  max-width: 85%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
}

.turn.thinking {
  color: var(--faint);
}

.ask-input {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 10px 8px 10px 16px;
  border-top: 1px solid var(--line);
}

.ask-input textarea {
  line-height: 1.45;
  padding: 4px 0;
  max-height: 140px;
  overflow-y: auto;
}

.ask-input textarea:focus-visible {
  box-shadow: none;
}

/* ---- full-window screens ----------------------------------------------------------- */

.screen {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 40px;
}

.screen .card {
  max-width: 460px;
}

.screen h1 {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 18px 0 14px;
}

.screen p {
  color: var(--muted);
  margin: 0 0 10px;
  line-height: 1.55;
}

.screen p.error {
  color: var(--accent);
  margin-top: 12px;
}

.screen p.faint {
  color: var(--faint);
  font-size: 13.5px;
  margin-top: 18px;
  min-height: 1.5em;
}

.screen code {
  font: 13.5px/1.6 var(--mono);
  background: var(--accent-soft);
  color: var(--accent-deep);
  padding: 1px 6px;
  border-radius: 5px;
  user-select: text;
}

.screen .lang {
  display: block;
  margin-top: 32px;
}

/* Welcome: centred, and he is the first thing you see. */
.welcome .card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 480px;
}

.welcome .butler {
  margin: 0;
}

.welcome h1 {
  font-size: 32px;
  margin: 10px 0 12px;
}

.signins {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 300px;
  margin-top: 18px;
}

.signin {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  transition:
    border-color 0.12s ease,
    color 0.12s ease,
    background-color 0.12s ease;
}

.signin:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.signin.google {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.signin.google:hover:not(:disabled) {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fff;
}

.signin:disabled {
  opacity: 0.55;
}

.welcome .changekey {
  margin-top: 22px;
}

/* The key: one field and one button, in the welcome's shape. */
.keyform {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 300px;
  margin-top: 18px;
}

.keyform input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: 14px/1.4 var(--mono);
  letter-spacing: 0.02em;
  user-select: text;
}

.keyform input::placeholder {
  color: var(--faint);
  font-family: var(--sans);
  letter-spacing: 0;
}

.keyform input:focus-visible {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.keyscreen .faint a {
  color: var(--accent);
  text-decoration: none;
}

.keyscreen .faint a:hover {
  text-decoration: underline;
}

/* ---- Carson himself --------------------------------------------------------------- */

.butler {
  display: block;
  color: var(--ink);
  margin-left: -6px;
}

.butler .head {
  transform-box: view-box;
  transform-origin: 60px 46px;
}

/* Reading: the head settles toward the sheet and sways a little; the lines on the sheet
   fill in one after another, hold, and clear for the next page. */
.butler.reading .head {
  animation: butler-tilt 3.6s ease-in-out infinite;
}

@keyframes butler-tilt {
  0%,
  100% {
    transform: rotate(7deg);
  }
  50% {
    transform: rotate(10deg);
  }
}

.butler .line {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.butler.reading .line {
  animation: butler-read 3.6s ease-in-out infinite;
}

.butler.reading .line:nth-of-type(2) {
  animation-delay: 0.45s;
}

.butler.reading .line:nth-of-type(3) {
  animation-delay: 0.9s;
}

@keyframes butler-read {
  0% {
    stroke-dashoffset: 1;
    opacity: 1;
  }
  16% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  72% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  80% {
    stroke-dashoffset: 0;
    opacity: 0;
  }
  100% {
    stroke-dashoffset: 1;
    opacity: 0;
  }
}

/* ---- motion ---------------------------------------------------------------------- */

.leaving {
  animation: leave 0.2s ease-in forwards;
}

@keyframes leave {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .list li,
  .leaving,
  .skeleton span,
  .ask-panel,
  .butler .head,
  .butler .line,
  .row[data-status='working'] .mark {
    animation: none;
  }
  .butler .line {
    stroke-dashoffset: 0;
  }
  .row[data-status='working'] .mark {
    opacity: 0.7;
  }
}

/* On an item the verdict bar stops short of the ask button. */
.item .verdict {
  padding-right: 168px;
}

/* The mark, top left on every desk screen: the way back to the beginning. */
.home {
  position: fixed;
  top: 12px;
  left: 16px;
  z-index: 15;
  padding: 4px;
  border-radius: 8px;
  color: var(--ink);
}

.home:hover {
  background: var(--accent-soft);
}

.home .butler {
  margin: 0;
}

/* The calendar, top right: the other place things are, kept as quiet as the mark. */
.cal {
  position: fixed;
  top: 10px;
  right: 20px;
  z-index: 15;
  height: 36px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-weight: 500;
  padding: 0 12px;
  border-radius: 8px;
}

.cal:hover,
.cal.on {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---- the calendar ------------------------------------------------------------------- */

.agenda .start {
  flex: 1;
  min-height: 0;
  padding-top: 3vh;
  --col: 820px;
}

.agenda .start > .cal-head,
.agenda .start > .grid,
.agenda .start > .day {
  width: 100%;
  max-width: var(--col);
}

/* The month's name, the two arrows, and the way back to today. */
.cal-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
}

.cal-head h1 {
  flex: 1;
  margin: 0;
  font-size: 28px;
}

.cal-head .arrow {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 8px;
}

.cal-head .arrow svg {
  width: 16px;
  height: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.grid .wd {
  color: var(--faint);
  font-size: 12.5px;
  padding: 0 8px 4px;
  text-align: right;
}

.cell {
  min-height: 74px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 6px 5px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 0.12s ease;
}

.cell.out {
  opacity: 0.45;
}

.cell:hover {
  border-color: var(--line-strong);
}

.cell.sel,
.cell.sel:hover {
  border-color: var(--accent);
}

.cell .num {
  align-self: flex-end;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 13px;
  color: var(--muted);
}

.cell.today .num {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
}

.cell .chips {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

/* One entry on a day: a due one carries the accent on its edge; a finished one is struck. */
.grid .chip {
  max-width: 100%;
  text-align: left;
  font-size: 12px;
  line-height: 1.3;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip.due {
  border-left: 3px solid var(--accent);
}

.chip.over {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--accent-deep);
}

.chip.done {
  text-decoration: line-through;
  color: var(--faint);
  border-left-color: var(--line-strong);
}

.chip:disabled {
  cursor: default;
}

.chip:not(:disabled):hover {
  border-color: var(--accent);
}

.cell .more {
  font-size: 11.5px;
  color: var(--faint);
  padding-left: 6px;
}

/* The card under the pointer: everything the chip had to cut short. */
.chipwrap {
  position: relative;
  display: block;
  min-width: 0;
  width: 100%;
}

.chipwrap .chip {
  display: block;
  width: 100%;
}

.tip {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  width: 270px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(43, 39, 36, 0.1);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
  text-align: left;
  white-space: normal;
  pointer-events: none;
}

.tip.right {
  left: auto;
  right: 0;
}

.chipwrap:hover .tip {
  display: block;
}

.tip strong {
  display: block;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 3px;
}

.tip .st {
  color: var(--accent);
  margin-top: 4px;
}

.tip .st.ok {
  color: var(--faint);
}

.calendar .day {
  margin-top: 22px;
  padding-bottom: 20px;
}

.day h2 {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 8px;
}

.entry {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: baseline;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color 0.12s ease;
}

.entry .state {
  font-size: 12.5px;
  color: var(--accent);
  min-width: 52px;
  text-align: right;
}

.entry .state.ok {
  color: var(--faint);
}

.entry.done .what {
  text-decoration: line-through;
  color: var(--muted);
}

.entry + .entry {
  margin-top: 6px;
}

.entry:not(:disabled):hover {
  border-color: var(--accent);
}

.entry:disabled {
  cursor: default;
  color: inherit;
}

.entry .when {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.entry.due .when {
  color: var(--accent);
  font-weight: 500;
}

.entry .what {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry .who {
  color: var(--faint);
  font-size: 13.5px;
  white-space: nowrap;
}

.day .none {
  color: var(--faint);
  margin: 0;
  padding: 4px 14px;
}

.item .bar {
  padding-left: 62px;
  /* Room for the calendar, top right, which floats over everything. */
  padding-right: 128px;
}

/* ---- work: attachments, plans, files ------------------------------------------------ */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  transition:
    border-color 0.12s ease,
    color 0.12s ease;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chip.out {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong));
}

.chip.quiet-chip {
  border-color: transparent;
  color: var(--muted);
}

.plan .plan-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  font-size: 15.5px;
  line-height: 1.6;
}

.plan .summary {
  margin: 0 0 14px;
}

.plan ol {
  margin: 0 0 16px;
  padding-left: 22px;
}

.plan ol li {
  margin-bottom: 4px;
}

.plan ol li::marker {
  color: var(--accent);
  font-weight: 500;
}

.plan .facts {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14px;
}

.plan .facts span,
.plan .blocker span {
  font-weight: 500;
  color: var(--ink);
}

.plan .blocker {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 14.5px;
}

.plan .progress {
  color: var(--ink-soft, var(--muted));
  font-size: 14.5px;
}

.steps-quiet {
  margin: 16px 0 0;
  padding-left: 22px;
  color: var(--faint);
  font-size: 14px;
  line-height: 1.55;
}

.work {
  flex: none;
  margin: -6px 0 16px;
}

.work .chips {
  margin-top: 0;
}

.note-lines {
  margin: 12px 0 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 14px;
  row-gap: 4px;
  font-size: 14px;
  line-height: 1.5;
}

.note-lines dt {
  color: var(--muted);
  font-weight: 500;
}

.note-lines dd {
  margin: 0;
  white-space: pre-wrap;
  color: var(--ink);
}

/* The note can be long; the reply must stay in view. The note scrolls, the card clips. */
.draft .card {
  overflow: hidden;
}

.work {
  max-height: 42%;
  overflow-y: auto;
  padding-right: 6px;
}

.note-lines {
  font-size: 13.5px;
}

/* ---- the plan, unmistakably: a band, questions, steps that move --------------------- */

.plan .band {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -26px -30px 18px;
  padding: 11px 30px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 500;
  border-radius: var(--radius) var(--radius) 0 0;
}

.plan .band .butler {
  margin: 0;
  color: var(--accent-deep);
}

.plan .band.live span {
  animation: breathe 2.2s ease-in-out infinite;
}

.plan .q {
  margin: 16px 0 4px;
}

.plan .q-text {
  font-weight: 500;
  margin-bottom: 8px;
}

.plan .q-text em {
  font-style: normal;
  font-weight: 400;
  color: var(--accent);
  font-size: 13.5px;
  margin-left: 6px;
}

.plan .opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.opt {
  font-size: 14.5px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition:
    border-color 0.12s ease,
    background-color 0.12s ease,
    color 0.12s ease;
}

.opt:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.opt.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Steps while running: a marker each, and the current one breathing with his last line. */
.steps.run {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.steps.run li {
  display: grid;
  grid-template-columns: 18px 1fr;
  column-gap: 12px;
  align-items: start;
  padding: 8px 0;
  font-size: 15.5px;
  line-height: 1.5;
  transition: color 0.3s ease;
}

.steps.run .marker {
  width: 10px;
  height: 10px;
  margin: 7px 0 0 2px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: transparent;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    transform 0.3s ease;
}

.steps.run li.done {
  color: var(--muted);
}

.steps.run li.done .marker {
  background: var(--accent);
  border-color: var(--accent);
}

.steps.run li.now {
  color: var(--ink);
  font-weight: 500;
}

.steps.run li.now .marker {
  border-color: var(--accent);
  background: var(--accent);
  transform: scale(1.15);
  animation: breathe 1.8s ease-in-out infinite;
}

.steps.run li.todo {
  color: var(--faint);
}

.steps.run .line {
  font-weight: 400;
  font-size: 14px;
  color: var(--muted);
  margin-top: 2px;
  animation: arrive 0.35s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

/* ---- typed answers, and what is still open --------------------------------------- */

.plan .answer {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 12px;
  background: var(--surface);
  transition: border-color 0.12s ease;
}

.plan .answer:focus-within {
  border-color: var(--accent-dim);
}

.plan .answer textarea {
  line-height: 1.45;
  padding: 2px 0;
  font-size: 15px;
}

.plan .answer textarea:focus-visible {
  box-shadow: none;
}

.open {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--accent-soft);
  font-size: 14px;
}

.open-title {
  font-weight: 500;
  color: var(--accent-deep);
  margin-bottom: 6px;
}

.open ul {
  margin: 0 0 10px;
  padding-left: 18px;
  line-height: 1.5;
}

.open .fill {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 6px 6px 12px;
}

.open .fill textarea {
  line-height: 1.45;
  padding: 3px 0;
}

.open .fill textarea:focus-visible {
  box-shadow: none;
}

.open .fill .primary {
  padding: 6px 12px;
  flex: none;
}
