/* Job Search dashboard — calm, Spark palette, 8px grid */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --text: #161716;
  --muted: #5b5c57;
  --faint: #8a8b84;
  --line: rgba(17, 19, 18, 0.08);
  --line-strong: rgba(17, 19, 18, 0.16);
  --contour: rgba(17, 19, 18, 0.07);
  --contour-accent: rgba(92, 128, 0, 0.35);

  --lime: #e0ff98;
  --lime-soft: #eefcc8;
  --lime-ink: #3f5a00;
  --teal: #135c56;
  --teal-deep: #0f4a45;
  --teal-ink: #e0ff98;
  --clay: #c4613f;

  /* stage colors: tile bg / dot */
  --st-saved: #ebe8f2;   --st-saved-dot: #7d78a3;
  --st-applied: #e2ece6; --st-applied-dot: #2f7564;
  --st-talking: #f5e7cf; --st-talking-dot: #a8711f;
  --st-interview: #eaf7c9; --st-interview-dot: #4d6c00;
  --st-offer: #d8eee7;   --st-offer-dot: #135c56;
  --st-closed: #edece7;  --st-closed-dot: #8a8b84;

  --radius-lg: 24px;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(17, 19, 18, 0.04), 0 8px 24px -16px rgba(17, 19, 18, 0.18);
  --shadow-lg: 0 24px 64px -24px rgba(17, 19, 18, 0.35);

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Hanken Grotesk", ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111312; --surface: #1a1c1b; --surface-2: #161817;
    --text: #edede8; --muted: #a6a6a0; --faint: #7d7e78;
    --line: rgba(255, 255, 255, 0.08); --line-strong: rgba(255, 255, 255, 0.16);
    --contour: rgba(255, 255, 255, 0.06); --contour-accent: rgba(224, 255, 152, 0.3);
    --lime-soft: #2a3315; --lime-ink: #e0ff98; --teal: #1d6f68; --teal-deep: #154f4a;
    --st-saved: #25232f; --st-saved-dot: #a9a4cf;
    --st-applied: #1c2925; --st-applied-dot: #7cc4b0;
    --st-talking: #2e2619; --st-talking-dot: #e0b46a;
    --st-interview: #232c14; --st-interview-dot: #c8ef7a;
    --st-offer: #17322e; --st-offer-dot: #7cc4b0;
    --st-closed: #1f201f; --st-closed-dot: #8a8b84;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -16px rgba(0,0,0,.6);
    --shadow-lg: 0 24px 64px -24px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111312; --surface: #1a1c1b; --surface-2: #161817;
  --text: #edede8; --muted: #a6a6a0; --faint: #7d7e78;
  --line: rgba(255, 255, 255, 0.08); --line-strong: rgba(255, 255, 255, 0.16);
  --contour: rgba(255, 255, 255, 0.06); --contour-accent: rgba(224, 255, 152, 0.3);
  --lime-soft: #2a3315; --lime-ink: #e0ff98; --teal: #1d6f68; --teal-deep: #154f4a;
  --st-saved: #25232f; --st-saved-dot: #a9a4cf;
  --st-applied: #1c2925; --st-applied-dot: #7cc4b0;
  --st-talking: #2e2619; --st-talking-dot: #e0b46a;
  --st-interview: #232c14; --st-interview-dot: #c8ef7a;
  --st-offer: #17322e; --st-offer-dot: #7cc4b0;
  --st-closed: #1f201f; --st-closed-dot: #8a8b84;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -16px rgba(0,0,0,.6);
  --shadow-lg: 0 24px 64px -24px rgba(0,0,0,.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color 400ms ease, color 400ms ease;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.muted { color: var(--muted); }
.small { font-size: 14px; margin: 0; }
kbd {
  font: 500 12px/1 var(--mono);
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid currentColor;
  opacity: 0.45;
}

/* Background contours */
.contours {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}
.contours path { fill: none; stroke: var(--contour); stroke-width: 1; }
.contours path.accent { stroke: var(--contour-accent); }

.shell {
  position: relative; z-index: 1;
  max-width: 1440px; margin: 0 auto;
  padding: 24px 40px 80px;
}

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  /* sticky so "Add opportunity" is always one click away */
  position: sticky; top: 0; z-index: 20;
  margin: -24px -40px 0; padding: 16px 40px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
}
.top.is-stuck { box-shadow: 0 1px 0 var(--line); }
.btn-add { margin-left: 0; margin-right: 8px; height: 40px; padding: 0 16px; font-size: 14px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
@media (max-width: 480px) { .brand-year { display: none; } }
@media (max-width: 360px) { .add-more { display: none; } }
.brand-mark {
  width: 24px; height: 24px; border-radius: 8px; background: var(--teal); position: relative; overflow: hidden;
}
.brand-mark::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: var(--lime); left: 4px; top: 8px;
}
.brand-year { font: 400 14px var(--mono); color: var(--faint); margin-left: 4px; }
.top-right { display: flex; align-items: center; gap: 8px; }
.save-state { font-size: 12px; color: var(--faint); margin-right: 8px; transition: opacity 300ms; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text);
  transition: transform 120ms ease-out, background-color 200ms;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(0.94); }

/* Hero */
.hero { padding: 48px 0 32px; max-width: 880px; }
.eyebrow { font-size: 13px; color: var(--muted); margin: 0 0 16px; text-transform: uppercase; letter-spacing: 0.08em; }
.display {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(40px, 6vw, 80px); line-height: 0.98;
  letter-spacing: -0.03em; margin: 0;
  font-optical-sizing: auto;
}
.display em { font-style: italic; color: var(--lime-ink); }
:root[data-theme="dark"] .display em { color: var(--lime); }
.display-sm { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1.05; letter-spacing: -0.02em; margin: 0; }
.hero-sub { font-size: 18px; color: var(--muted); margin: 16px 0 0; }
.hero-sub b { color: var(--text); font-weight: 600; }

/* Bento */
.bento {
  display: grid; gap: 16px;
  grid-template-columns: 1fr 1.6fr 1.3fr 1fr;
  margin-bottom: 40px;
}
.tile {
  position: relative; overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  min-height: 216px;
  display: flex; flex-direction: column;
}
.label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

.tile-today { background: var(--teal); color: #f2f6ee; border-color: transparent; }
.tile-today .label { color: rgba(224, 255, 152, 0.75); }
.today-head { display: flex; justify-content: space-between; align-items: flex-start; }
.today-count { font: 400 64px/1 var(--serif); letter-spacing: -0.03em; margin: auto 0 8px; color: var(--lime); font-variant-numeric: tabular-nums; }
.today-goal { font-size: 32px; color: rgba(224, 255, 152, 0.45); }
.today-note { margin: 0 0 16px; font-size: 14px; color: rgba(242, 246, 238, 0.8); }
.meter { height: 8px; border-radius: 8px; background: rgba(0, 0, 0, 0.22); overflow: hidden; position: relative; z-index: 1; }
.meter-fill {
  display: block; height: 100%; width: 0; border-radius: 8px; background: var(--lime);
  transition: width 700ms var(--ease-out);
}
.shape { position: absolute; pointer-events: none; }

.stats-head { display: flex; justify-content: space-between; gap: 16px; }
.stats-big { font: 400 48px/1 var(--serif); letter-spacing: -0.03em; margin: 8px 0 0; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-applied { background: var(--teal); }
.dot-today { background: var(--lime); box-shadow: inset 0 0 0 1.5px var(--lime-ink); }
.bars {
  margin-top: auto; padding-top: 16px;
  display: grid; grid-template-columns: repeat(14, 1fr); gap: 8px;
  height: 120px; align-items: end;
}
.bar {
  position: relative; height: 100%;
  border-radius: 8px; background: var(--surface-2);
  border: 1px solid var(--line);
  display: flex; align-items: flex-end; overflow: hidden;
}
.bar-fill {
  width: 100%; border-radius: 6px; background: var(--teal);
  height: 0; transition: height 800ms var(--ease-out);
  transition-delay: calc(var(--b) * 30ms);
}
.bar.is-today .bar-fill { background: var(--lime); box-shadow: inset 0 0 0 1.5px var(--lime-ink); }
.bar.is-weekend { background: transparent; }
.bar-tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; translate: -50% 4px;
  white-space: nowrap; font: 500 12px var(--mono);
  background: var(--text); color: var(--bg); padding: 4px 8px; border-radius: 6px;
  opacity: 0; pointer-events: none; transition: opacity 150ms, translate 150ms var(--ease-out);
}
.bar-wrap { position: relative; height: 100%; }
.bar-wrap:hover .bar-tip { opacity: 1; translate: -50% 0; }

.tile-needs { background: var(--lime); color: #16210a; border-color: transparent; }
.tile-needs .label { color: #3f5a00; }
.needs-head { display: flex; justify-content: space-between; align-items: center; }
.pill-count {
  font: 500 14px var(--mono); background: #16210a; color: var(--lime);
  min-width: 32px; height: 32px; border-radius: 16px; display: grid; place-items: center; padding: 0 8px;
}
.needs-list { list-style: none; margin: 16px 0 0; padding: 0; position: relative; z-index: 1; }
.needs-list li + li { border-top: 1px solid rgba(22, 33, 10, 0.12); }
.needs-list li { display: flex; align-items: center; gap: 8px; }
.needs-list .needs-item, .needs-list [data-filter-you] {
  all: unset; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 0 8px;
  flex: 1; min-width: 0; padding: 8px 0; border-radius: 8px;
}
.needs-list .needs-done {
  appearance: none; background: none; cursor: pointer; flex: none; box-sizing: border-box; width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border-radius: 50%;
  border: 1.5px solid rgba(22, 33, 10, 0.35); color: #16210a;
  transition: background-color 150ms, transform 120ms ease-out, border-color 150ms;
}
.needs-list .needs-done:hover { background: #16210a; color: var(--lime); border-color: #16210a; }
.needs-list .needs-done:active { transform: scale(0.9); }
.needs-list button:focus-visible { outline: 2px solid #16210a; outline-offset: 2px; }
.needs-done svg { display: block; }
.needs-co { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.needs-step { grid-column: 1 / -1; font-size: 14px; color: rgba(22, 33, 10, 0.72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.needs-age { font: 400 12px var(--mono); color: rgba(22, 33, 10, 0.6); align-self: center; }
.needs-empty { font-size: 15px; color: rgba(22, 33, 10, 0.72); }

.pipe-rate { font: 400 48px/1 var(--serif); letter-spacing: -0.03em; margin: 8px 0 0; }
.pipe-strip { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 16px; }
.pipe-row { display: grid; grid-template-columns: 96px 1fr 32px; align-items: center; gap: 8px; font-size: 14px; }
.pipe-row .muted { font-size: 14px; }
.pipe-track { height: 8px; background: var(--surface-2); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.pipe-fill { display: block; height: 100%; width: 0; border-radius: 8px; transition: width 900ms var(--ease-out); }
.pipe-num { font: 500 13px var(--mono); text-align: right; font-variant-numeric: tabular-nums; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.seg {
  position: relative; display: inline-flex; padding: 4px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--line);
}
.seg-btn {
  position: relative; z-index: 1; border: 0; background: none;
  height: 40px; padding: 0 16px; border-radius: 20px; font-weight: 500; color: var(--muted);
  transition: color 200ms;
}
.seg-btn[aria-selected="true"] { color: var(--teal-ink); }
.seg-thumb {
  position: absolute; top: 4px; left: 4px; height: 40px; border-radius: 20px;
  background: var(--teal); transition: transform 400ms var(--ease-out), width 400ms var(--ease-out);
}
.search {
  flex: 1; min-width: 240px; max-width: 480px;
  display: flex; align-items: center; gap: 8px;
  height: 48px; padding: 0 16px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--muted);
  transition: border-color 200ms, box-shadow 200ms;
}
.search:focus-within { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(19, 92, 86, 0.12); }
.search input { flex: 1; border: 0; background: none; outline: none; color: var(--text); font-size: 16px; min-width: 0; }
.search input::-webkit-search-cancel-button { display: none; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); cursor: pointer; -webkit-user-select: none; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { width: 40px; height: 24px; border-radius: 12px; background: var(--line-strong); position: relative; transition: background-color 250ms; }
.toggle-knob { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform 300ms var(--ease-spring); }
.toggle input:checked + .toggle-track { background: var(--teal); }
.toggle input:checked + .toggle-track .toggle-knob { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--teal); outline-offset: 2px; }

.btn {
  height: 48px; padding: 0 24px; border-radius: 24px; border: 0;
  display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 15px;
  transition: transform 120ms ease-out, background-color 200ms, box-shadow 200ms;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
a.btn { text-decoration: none; color: inherit; }
.btn-primary { background: var(--teal); color: var(--teal-ink); margin-left: auto; }
.btn-primary:hover { background: var(--teal-deep); }
.btn-primary kbd { color: var(--teal-ink); }
.btn-ghost { background: transparent; border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-teal { background: #135c56; color: #e0ff98; }
.btn-teal:hover { background: #0f4a45; }
.btn-danger { background: transparent; color: var(--clay); padding: 0 16px; }
.btn-danger:hover { background: rgba(196, 97, 63, 0.08); }
.btn:focus-visible, .icon-btn:focus-visible, .seg-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Board */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(216px, 1fr);
  gap: 16px; align-items: start;
  overflow-x: auto; padding-bottom: 16px; margin: 0 -40px; padding-inline: 40px;
  scroll-snap-type: x proximity; scroll-padding-inline: 40px;
}
.col {
  border-radius: var(--radius-lg); padding: 8px;
  background: color-mix(in srgb, var(--col) 55%, transparent);
  border: 1px solid var(--line);
  scroll-snap-align: start;
  transition: background-color 200ms, box-shadow 200ms;
  min-height: 160px;
}
.col.is-over { background: var(--col); box-shadow: inset 0 0 0 2px var(--col-dot); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 16px; }
.col-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.col-head .dot { background: var(--col-dot); width: 10px; height: 10px; }
.col-count { font: 500 13px var(--mono); color: var(--muted); margin-left: auto; }
.field-hint { font-size: 14px; color: var(--muted); margin: 8px 0 0; min-height: 20px; }
.tile-sub { font-size: 14px; color: #3f5a00; margin: 8px 0 0; position: relative; z-index: 1; }
.col-hint { font-size: 13px; color: var(--muted); padding: 0 8px 8px; margin: -8px 0 8px; }
.col-cards { display: flex; flex-direction: column; gap: 8px; min-height: 48px; }
.col-empty {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 16px;
  font-size: 14px; color: var(--muted); text-align: center;
}
.col-more {
  all: unset; cursor: pointer; text-align: center; font-size: 14px; color: var(--muted); padding: 8px; border-radius: 12px;
}
.col-more:hover { background: var(--surface); color: var(--text); }
.col-more:focus-visible { outline: 2px solid var(--teal); }

.card {
  position: relative;
  background: var(--surface); border-radius: var(--radius);
  padding: 16px; border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(17, 19, 18, 0.04);
  cursor: grab; touch-action: pan-y; -webkit-user-select: none; user-select: none;
  transition: transform 150ms ease-out, box-shadow 200ms, opacity 200ms;
}
.card:hover { box-shadow: var(--shadow-sm); }
.card:active { transform: scale(0.985); }
.card:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.card.is-placeholder { opacity: 0.3; }
.card.is-new { animation: card-in 600ms var(--ease-spring) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(-8px) scale(0.96); } }
.card-meet {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 6px 8px; border-radius: 8px;
  font: 600 14px/1.2 var(--sans); background: var(--st-interview); color: var(--st-interview-dot);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st-interview-dot) 30%, transparent);
}
.card-meet svg { flex: none; }
.card-meet.is-today { background: var(--teal); color: var(--teal-ink); box-shadow: none; }
.card-co { font-weight: 600; font-size: 16px; line-height: 1.3; margin: 0; padding-right: 24px; }
.card-role { font-size: 14px; color: var(--muted); margin: 4px 0 0; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; align-items: center; }
.chip {
  font: 500 12px/1 var(--mono); padding: 6px 8px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.chip-you { background: rgba(196, 97, 63, 0.1); color: var(--clay); border-color: rgba(196, 97, 63, 0.2); }
.chip-flag { background: var(--clay); color: #fff; border-color: transparent; }
.card-link {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; color: var(--faint); opacity: 0; transition: opacity 150ms, background-color 150ms;
}
.card:hover .card-link, .card-link:focus-visible { opacity: 1; }
.card-link:hover { background: var(--surface-2); color: var(--text); }
@media (hover: none) { .card-link { opacity: 1; } }

.ghost {
  /* above the tour's dim; no transition, or it glides in from the corner (.card has one) */
  position: fixed; top: 0; left: 0; z-index: 88; pointer-events: none; margin: 0;
  box-shadow: var(--shadow-lg); cursor: grabbing;
  will-change: transform; transition: none;
}
body.is-dragging, body.is-dragging * { cursor: grabbing !important; -webkit-user-select: none !important; user-select: none !important; }

/* List */
.list { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--line); box-shadow: var(--shadow-sm); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th {
  text-align: left; font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding: 16px; border-bottom: 1px solid var(--line); background: var(--surface-2);
  white-space: nowrap;
}
.table th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.table th button:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; border-radius: 4px; }
.table th[aria-sort] button { color: var(--text); }
.table td { padding: 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; transition: background-color 150ms; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.td-co { font-weight: 600; }
.td-role { color: var(--muted); max-width: 320px; }
.td-step { color: var(--muted); max-width: 280px; font-size: 14px; }
.td-date { font: 400 13px var(--mono); color: var(--muted); white-space: nowrap; }
.status-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 8px;
  border-radius: 16px; background: var(--pill); font-size: 14px; font-weight: 500; white-space: nowrap;
  border: 0; appearance: none; cursor: pointer;
}
.status-pill .dot { background: var(--pill-dot); }
.list-empty { padding: 48px 16px; text-align: center; color: var(--muted); }

/* Sheet */
.scrim {
  position: fixed; inset: 0; z-index: 30; background: rgba(17, 19, 18, 0.24);
  backdrop-filter: blur(2px); opacity: 0; transition: opacity 300ms ease;
}
.scrim.is-open { opacity: 1; }
.sheet {
  position: fixed; z-index: 31; top: 8px; right: 8px; bottom: 8px;
  width: min(520px, calc(100vw - 16px));
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  transform: translateX(calc(100% + 24px)); visibility: hidden;
  transition: transform 450ms var(--ease-out), visibility 0s linear 450ms;
  display: flex; flex-direction: column; overflow: hidden;
}
.sheet.is-open { transform: none; visibility: visible; transition: transform 450ms var(--ease-out), visibility 0s; }
.sheet-head { padding: 24px 24px 16px; border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.sheet-head .shape {
  width: 200px; height: 200px; border-radius: 50%; right: -64px; top: -96px; background: var(--sheet-col, var(--lime-soft));
}
.sheet-top { display: flex; justify-content: space-between; align-items: center; position: relative; margin-bottom: 16px; }
.sheet-title {
  font-family: var(--serif); font-size: 40px; line-height: 1; letter-spacing: -0.03em; font-weight: 400;
  border: 0; background: none; width: 100%; padding: 0; outline: none; position: relative;
}
.sheet-role { border: 0; background: none; width: 100%; padding: 8px 0 0; color: var(--muted); font-size: 16px; outline: none; position: relative; }
.sheet-title:focus, .sheet-role:focus { box-shadow: 0 2px 0 var(--teal); }
.sheet-body { padding: 24px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 24px; overscroll-behavior: contain; }
.sheet-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  height: 40px; padding: 0 16px 0 12px; border-radius: 20px; display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 14px; font-weight: 500;
  transition: background-color 200ms, border-color 200ms, transform 120ms ease-out, color 200ms;
}
.chip-btn .dot { background: var(--c-dot); }
.chip-btn:hover { background: var(--c); }
.chip-btn:active { transform: scale(0.96); }
.chip-btn[aria-pressed="true"] { background: var(--c); border-color: var(--c-dot); }
.chip-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field > span, .field-label { font-size: 14px; font-weight: 500; color: var(--muted); padding-left: 8px; }
.field input, .field textarea {
  min-height: 48px; padding: 12px 16px; border-radius: 12px; font-size: 16px;
  border: 1px solid var(--line-strong); background: var(--surface-2); outline: none;
  transition: border-color 200ms, box-shadow 200ms, background-color 200ms;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus { border-color: var(--teal); background: var(--surface); box-shadow: 0 0 0 4px rgba(19, 92, 86, 0.12); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > * { min-width: 0; }
.field input, .field textarea { width: 100%; min-width: 0; max-width: 100%; display: block; }
/* iOS Safari draws date and other inputs natively at their own width and height; make every field the same box */
.field input { -webkit-appearance: none; appearance: none; height: 48px; margin: 0; }
.field textarea { -webkit-appearance: none; appearance: none; margin: 0; }
.field input[type="date"] { line-height: 22px; }
.field input::-webkit-date-and-time-value { text-align: left; margin: 0; }
.field input::-webkit-datetime-edit { padding: 0; }

.waits-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.btn-sm { height: 40px; padding: 0 16px; font-size: 14px; }
.waits-name {
  min-height: 48px; padding: 12px 16px; border-radius: 12px; font-size: 16px; margin-top: 8px;
  border: 1px solid var(--line-strong); background: var(--surface-2); outline: none;
}
.waits-name:focus { border-color: var(--teal); background: var(--surface); box-shadow: 0 0 0 4px rgba(19, 92, 86, 0.12); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 8px; }
.timeline li { position: relative; padding: 0 0 16px 24px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--t-dot); }
.timeline li::after { content: ""; position: absolute; left: 4.5px; top: 20px; bottom: 0; width: 1px; background: var(--line-strong); }
.timeline li:last-child::after { display: none; }
.timeline .mono { color: var(--muted); font-size: 12px; margin-left: 8px; }

/* Modal */
.modal {
  border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
  width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-lg);
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  /* scroll up and down only: nothing inside can push the card sideways */
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
}
.modal-body { min-width: 0; max-width: 100%; }
.modal[open] { animation: modal-in 400ms var(--ease-out); }
.modal.is-closing { animation: modal-out 200ms ease-in forwards; }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(0.97); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }
.modal::backdrop { background: rgba(17, 19, 18, 0.32); backdrop-filter: blur(4px); }
.modal[open]::backdrop { animation: fade 300ms ease; }
@keyframes fade { from { opacity: 0; } }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.modal-foot .btn-primary { margin-left: 0; }

/* Toasts */
.toasts { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 16px; padding: 8px 8px 8px 16px; min-height: 48px;
  background: #161716; color: #edede8; border-radius: 24px; box-shadow: var(--shadow-lg); font-size: 15px;
  animation: toast-in 400ms var(--ease-spring);
}
.toast.is-leaving { animation: toast-out 200ms ease-in forwards; }
.toast button { all: unset; cursor: pointer; color: var(--lime); font-weight: 600; padding: 8px 16px; border-radius: 16px; }
.toast button:hover { background: rgba(255,255,255,0.08); }
.toast:not(:has(button)) { padding-right: 16px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* Buddies: flat shapes, line limbs */
.buddy { display: block; overflow: visible; color: #161716; }
:root[data-theme="dark"] .buddy { color: #edede8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .buddy { color: #edede8; } }
.buddy .limbs path, .buddy .face path:not(.fill) { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.buddy .face .eye, .buddy .face .fill { fill: currentColor; }
.buddy .face { transform-box: fill-box; transform-origin: center; }
.buddy .eye { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }

/* Today card window: a notch cut out of the card's top-right corner, buddy peeking over the sill */
.tile-today { border: 0; }
.peek {
  position: absolute; top: 0; right: 0; z-index: 2;
  width: 128px; height: 136px; margin: 0; padding: 0; border: 0;
  border-radius: 0 0 0 24px;
  background: var(--bg);
  overflow: hidden; isolation: isolate;
  /* the card's cut edge casts a little shadow into the hole */
  box-shadow: inset 12px 0 14px -12px rgba(0, 0, 0, 0.28);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.peek::after { /* the sill: a lip of the card the buddy hides behind */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 12px; z-index: 2;
  background: var(--teal); box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.18);
}
.peek:focus-visible { outline: 2px solid var(--lime); outline-offset: -6px; }
:root .tile-today .peek .buddy { color: #161716; }
.peek-buddy {
  position: absolute; left: 50%; bottom: -12px; width: 96px; height: 106px; margin-left: -48px;
  transform-origin: 50% 100%;
  transition: transform 220ms cubic-bezier(0.5, 0, 0.75, 0);
}
.peek-buddy .buddy { width: 100%; height: 100%; }
.peek-buddy.is-hidden { transform: translateY(105%); }
.peek-buddy.is-back { transition: transform 520ms var(--ease-spring); }
.peek-buddy.is-new .buddy { animation: pop-in 600ms var(--ease-spring) both; }
@keyframes pop-in { from { transform: translateY(40%); } }
/* dark mode: the window is lit from inside, warm, so the dark line limbs still read */
:root[data-theme="dark"] .peek {
  background: radial-gradient(120% 100% at 55% 25%, #fff7e0 0%, #f4e4b8 55%, #dcc68f 100%);
  box-shadow: inset 12px 0 16px -12px rgba(0, 0, 0, 0.5), 0 0 40px 4px rgba(255, 214, 130, 0.22);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .peek {
    background: radial-gradient(120% 100% at 55% 25%, #fff7e0 0%, #f4e4b8 55%, #dcc68f 100%);
    box-shadow: inset 12px 0 16px -12px rgba(0, 0, 0, 0.5), 0 0 40px 4px rgba(255, 214, 130, 0.22);
  }
}

/* Buddy picker */
.top-right { position: relative; }
.picker {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  width: 328px; padding: 16px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform-origin: calc(100% - 68px) -8px;
  opacity: 0; transform: scale(0.94) translateY(-4px);
  transition: opacity 180ms ease, transform 260ms var(--ease-out);
}
.picker.is-open { opacity: 1; transform: none; }
.picker-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 8px 8px; }
.picker-head .small { color: var(--muted); }
.picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pick {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px; border-radius: 16px; border: 1px solid transparent; background: none;
  font-size: 14px; font-weight: 500; color: var(--text);
  transition: background-color 150ms, border-color 150ms, transform 120ms ease-out;
}
.pick:hover { background: var(--surface-2); }
.pick:active { transform: scale(0.95); }
.pick[aria-checked="true"] { border-color: var(--teal); background: var(--surface-2); }
.pick:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.pick .buddy { width: 56px; height: 62px; }
.pick:hover .buddy-all { transform-box: view-box; transform-origin: 60px 124px; animation: bob 500ms var(--ease-spring); }
@keyframes bob { 40% { transform: translateY(-6px) scale(0.97, 1.03); } }
.pick-auto { width: 56px; height: 62px; position: relative; }
.pick-auto i { position: absolute; border-radius: 50%; }
.pick-auto i:nth-child(1) { width: 28px; height: 28px; background: #f06b4f; left: 4px; top: 18px; }
.pick-auto i:nth-child(2) { width: 28px; height: 28px; background: #f8c33f; left: 22px; top: 8px; }
.pick-auto i:nth-child(3) { width: 28px; height: 28px; background: #3fb3f5; left: 26px; top: 28px; }
.icon-btn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--line-strong); }
@media (max-width: 720px) { .picker { position: fixed; top: 72px; left: 16px; right: 16px; width: auto; } }

.deco-star { width: 200px; height: 200px; right: -64px; bottom: -72px; }
.deco-star path { fill: rgba(224, 255, 152, 0.1); }
.deco-squiggle { width: 200px; height: 160px; right: -48px; top: -40px; }
.deco-squiggle path { fill: none; stroke: rgba(19, 92, 86, 0.14); stroke-width: 16; stroke-linecap: round; }

.cheer {
  position: fixed; z-index: 70; right: 24px; bottom: 24px;
  width: min(408px, calc(100vw - 32px));
  background: #fbf8f0; color: #161716; border-radius: var(--radius-lg);
  border: 1px solid rgba(17, 19, 18, 0.08);
  padding: 24px 24px 24px 144px; min-height: 168px; box-shadow: var(--shadow-lg);
  overflow: visible;
}
:root[data-theme="dark"] .cheer { background: #1f211f; color: #edede8; border-color: rgba(255,255,255,.1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cheer { background: #1f211f; color: #edede8; border-color: rgba(255,255,255,.1); } }
.cheer[hidden] { display: none; }
.cheer.is-in { animation: cheer-in 600ms var(--ease-spring) both; }
.cheer.is-out { animation: cheer-out 250ms ease-in forwards; }
@keyframes cheer-in { from { opacity: 0; transform: translateY(32px) scale(0.94); } }
@keyframes cheer-out { to { opacity: 0; transform: translateY(16px) scale(0.97); } }
/* the buddy stands on the card's bottom-left and pokes out over the top */
.cheer-buddy { position: absolute; left: 8px; bottom: 12px; width: 128px; height: 141px; }
.cheer-buddy .buddy { width: 100%; height: 100%; }
.cheer.is-in .buddy-all { transform-box: view-box; transform-origin: 60px 124px; animation: hop 900ms var(--ease-spring) 150ms both; }
@keyframes hop {
  0% { transform: translateY(56px) scale(0.5); opacity: 0; }
  45% { transform: translateY(-14px) scale(0.96, 1.05); opacity: 1; }
  70% { transform: translateY(0) scale(1.06, 0.93); }
  100% { transform: none; }
}
.cheer.is-in .arm-r.is-wave { transform-box: view-box; transform-origin: 88px 62px; animation: wave 360ms ease-in-out 900ms 6 alternate both; }
.cheer.is-in .arm-l.is-wave { transform-box: view-box; transform-origin: 32px 62px; animation: wave-l 360ms ease-in-out 900ms 6 alternate both; }
.cheer.is-in .arm-r.is-thumb { animation: thumb 500ms ease-in-out 900ms 3 alternate both; transform-origin: 88px 68px; }
@keyframes wave { from { transform: rotate(-10deg); } to { transform: rotate(12deg); } }
@keyframes wave-l { from { transform: rotate(10deg); } to { transform: rotate(-12deg); } }
@keyframes thumb { to { transform: translateY(-4px); } }
.cheer.is-in .pose-cheer .buddy-all { animation: hop 900ms var(--ease-spring) 150ms both, jump 420ms ease-in-out 1100ms 4 alternate; }
@keyframes jump { from { transform: translateY(0); } to { transform: translateY(-10px); } }
.cheer.is-in .motion-lines { animation: flick 500ms steps(2) 900ms 6 both; }
@keyframes flick { 0% { opacity: 0; } 50% { opacity: 1; } }
.cheer-title { font-size: 28px; }
.cheer-text { margin: 8px 0 16px; font-size: 15px; opacity: 0.78; }
.cheer-burst { position: absolute; left: 72px; bottom: 96px; width: 0; height: 0; pointer-events: none; }
.bit { position: absolute; left: 0; top: 0; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 80; }

/* Note under the greeting: encouragement and nudges, the buddy says them */
.note {
  display: inline-flex; align-items: center; gap: 16px; margin-top: 24px; max-width: 720px;
  padding: 8px 8px 8px 8px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.note[hidden] { display: none; }
.note-buddy { flex: none; width: 40px; height: 44px; display: block; }
.note-buddy .buddy { width: 100%; height: 100%; }
.note-text {
  margin: 0; flex: 1; font: italic 400 18px/1.4 var(--serif); color: var(--text);
  transition: opacity 220ms ease, transform 220ms var(--ease-out);
}
.note.is-swap .note-text { opacity: 0; transform: translateY(4px); }
.note-act {
  font: 500 14px var(--sans); font-style: normal; color: var(--teal); background: none; border: 0;
  padding: 0 0 0 8px; text-decoration: underline; text-underline-offset: 3px;
}
:root[data-theme="dark"] .note-act { color: var(--lime); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .note-act { color: var(--lime); } }
.note-act:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
.note-next {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: none; color: var(--muted);
  display: grid; place-items: center; transition: background-color 200ms, color 200ms, transform 120ms ease-out;
}
.note-next:hover { background: var(--surface-2); color: var(--text); }
.note-next:active { transform: scale(0.92) rotate(-30deg); }
.note-next:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Settings */
.modal-settings { width: min(640px, calc(100vw - 32px)); overflow-y: auto; overscroll-behavior: contain; }
.modal-settings .modal-body { gap: 24px; }
.set-sec { display: flex; flex-direction: column; gap: 8px; padding-top: 24px; border-top: 1px solid var(--line); }
.set-sec:first-of-type { border-top: 0; padding-top: 0; }
.set-h { margin: 0; font-size: 16px; font-weight: 600; }
.set-p, .set-where { margin: 0; font-size: 15px; color: var(--muted); }
.set-where { color: var(--text); }
.set-fine { font-size: 14px; }
.stepper { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.stepper-num { min-width: 48px; text-align: center; font: 400 40px/1 var(--serif); font-variant-numeric: tabular-nums; }
.steps { margin: 8px 0; padding-left: 24px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.steps li::marker { font: 500 14px var(--mono); color: var(--muted); }
.steps a { color: var(--teal); text-underline-offset: 3px; }
:root[data-theme="dark"] .steps a { color: var(--lime); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .steps a { color: var(--lime); } }
.steps-act { display: block; margin-top: 8px; }
.set-msg { margin: 8px 0 0; font-size: 14px; color: var(--muted); min-height: 0; }
.set-msg:empty { display: none; }
.set-msg.is-bad { color: var(--clay); }
.set-row { display: flex; gap: 8px; margin-top: 16px; }
.set-row + .set-fine { margin-top: 8px; }
.script-box { display: block; width: 100%; height: 160px; margin-top: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: 12px/1.5 var(--mono); resize: vertical; }
.script-box[hidden] { display: none; }
.script-hint { display: block; margin-top: 8px; font-size: 14px; color: var(--muted); }
.script-hint[hidden] { display: none; }
.set-row .btn-primary, .set-connected .btn { margin-left: 0; }
.set-connected { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.set-connected[hidden], #sheetSetup[hidden], #sheetOpen[hidden] { display: none; }
.btn:disabled { opacity: 0.6; cursor: progress; }

/* Empty board, first visit: the metrics and toolbar wait for the first card */
.is-empty .bento, .is-empty .toolbar, .is-empty .hero-sub, .is-empty .note, .is-empty .btn-add { display: none; }
.is-empty .hero { padding-bottom: 24px; }
.empty {
  display: flex; align-items: flex-start; gap: 40px; padding: 48px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line);
}
.empty-buddy { flex: none; width: 136px; height: 150px; animation: bob 3.2s var(--ease-out) infinite; }
.empty-buddy .buddy { width: 100%; height: 100%; }
.empty-body > p { margin: 8px 0 24px; max-width: 560px; font-size: 16px; }
.empty-path { list-style: none; padding: 0; margin: 0 0 32px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; max-width: 760px; }
.empty-path li {
  display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 16px;
  background: var(--c); font-size: 14px; color: var(--muted);
}
.empty-path b { color: var(--text); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.empty-path .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-dot); }
.empty-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.empty-acts .btn-primary { margin-left: 0; }
.empty-foot { margin: 16px 0 0; }
@media (max-width: 960px) { .empty-path { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) {
  .empty { flex-direction: column; gap: 16px; padding: 24px; }
  .empty-buddy { width: 96px; height: 106px; }
  /* the button comes before the stage list so it's above the fold */
  .empty-body { display: flex; flex-direction: column; }
  .empty-acts { order: 1; }
  .empty-path { order: 2; margin: 24px 0 0; grid-template-columns: 1fr; }
  .empty-path li { flex-direction: row; align-items: baseline; justify-content: space-between; padding: 8px 16px; }
  .empty-foot { order: 3; }
}
@media (prefers-reduced-motion: reduce) { .empty-buddy { animation: none; } }

/* The buddy's day in the Today window */
.peek-buddy .face { transform: translate(var(--lx, 0px), var(--ly, 0px)); transition: transform 320ms var(--ease-out); }
.peek-buddy .buddy { transition: transform 260ms var(--ease-spring); }
.peek:hover .peek-buddy:not(.is-hidden) .buddy { transform: translateY(-6px); }
.peek-buddy .buddy-all { transform-box: view-box; transform-origin: 60px 124px; }
.peek-buddy.do-hop .buddy-all { animation: idle-hop 900ms var(--ease-out); }
@keyframes idle-hop { 30% { transform: translateY(-14px) scale(0.97, 1.04); } 60% { transform: translateY(0) scale(1.05, 0.95); } 80% { transform: none; } }
.peek-buddy.do-look .buddy-all { animation: idle-look 2400ms ease-in-out; }
@keyframes idle-look { 20%, 40% { transform: rotate(-7deg); } 60%, 80% { transform: rotate(6deg); } }
.peek-buddy.do-stretch .buddy-all { animation: idle-stretch 1400ms ease-in-out; }
@keyframes idle-stretch { 40%, 60% { transform: scale(0.94, 1.1); } 80% { transform: scale(1.03, 0.97); } }
.peek-buddy.do-wiggle .buddy-all { animation: idle-wiggle 900ms ease-in-out; }
@keyframes idle-wiggle { 20% { transform: rotate(-5deg); } 45% { transform: rotate(5deg); } 70% { transform: rotate(-3deg); } }
.peek-buddy.do-blink .eye { animation: blink-twice 700ms ease-in-out; }
@keyframes blink-twice { 15%, 55% { transform: scaleY(0.1); } 0%, 35%, 75%, 100% { transform: scaleY(1); } }
.peek-buddy.do-wave .arm-r { transform-box: view-box; transform-origin: 88px 64px; animation: idle-wave 380ms ease-in-out 5 alternate; }
@keyframes idle-wave { from { transform: rotate(0deg); } to { transform: rotate(-38deg); } }
.peek-buddy.do-startle .buddy-all { animation: idle-startle 700ms var(--ease-out); }
@keyframes idle-startle { 25% { transform: translateY(-16px) scale(1.04); } 60% { transform: translateY(0) scale(1.05, 0.94); } }
.peek-buddy.do-droop .buddy-all { animation: idle-droop 1400ms ease-in-out; }
@keyframes idle-droop { 30%, 70% { transform: translateY(6px) scale(1.03, 0.95) rotate(-3deg); } }
.peek-buddy.do-talk .buddy-all { animation: idle-talk 800ms ease-in-out; }
@keyframes idle-talk { 25%, 75% { transform: scale(1.03, 0.97); } 50% { transform: translateY(-4px); } }
/* napping */
/* the buddy's idle acts: props, notes, bubbles and a friend, inside the window */
.peek-stage { position: absolute; inset: 0; pointer-events: none; } /* no z-index: notes and bubbles go above the buddy, the machine and friend below */
.peek-buddy { z-index: 1; }
.peek-stage .friend, .machine { z-index: 0; }
.music-note, .heart-pop { z-index: 3; }
.peek-buddy .steam path, .machine .steam path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; opacity: 0; animation: steam 1.6s ease-in-out infinite; }
.machine .steam path { stroke: #161716; }
.peek-buddy .steam path:nth-child(2), .machine .steam path:nth-child(2) { animation-delay: 0.8s; }
@keyframes steam { 0% { opacity: 0; transform: translateY(2px); } 40% { opacity: 0.7; } 100% { opacity: 0; transform: translateY(-4px); } }
.peek-buddy.do-sway .buddy-all { animation: sway 1.3s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
.peek-buddy.do-call .arm-l { transform-box: view-box; transform-origin: 32px 62px; animation: call 340ms ease-in-out infinite alternate; }
@keyframes call { to { transform: rotate(22deg); } }
.music-note { position: absolute; left: 66px; top: 78px; width: 14px; height: 18px; opacity: 0; animation: music-note 2.3s ease-out forwards; }
.music-note svg { display: block; width: 100%; height: 100%; }
.heart-pop { position: absolute; top: 48px; width: 16px; height: 14px; opacity: 0; animation: heart-pop 1.8s var(--ease-out) forwards; }
.heart-pop svg { display: block; width: 100%; height: 100%; }
@keyframes heart-pop { 0% { opacity: 0; transform: translate(0, 8px) scale(0.4); } 20% { opacity: 1; transform: translate(0, 0) scale(1.1); } 100% { opacity: 0; transform: translate(var(--dx, 0px), -40px) scale(0.9); } }
@keyframes music-note { 0% { opacity: 0; transform: translate(0, 0) rotate(-10deg) scale(0.7); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx, 16px), -64px) rotate(14deg) scale(1); } }
.bubble {
  position: absolute; top: 24px; z-index: 3; translate: -50% 0; min-width: 32px; padding: 0 8px; border-radius: 12px;
  background: #fff; color: #161716; box-shadow: 0 0 0 1.5px #161716; text-align: center;
  font: 500 14px/24px var(--mono); white-space: nowrap; animation: bubble-in 260ms var(--ease-spring) both;
}
.bubble::after { content: ""; position: absolute; left: calc(50% - 4px); bottom: -5px; width: 8px; height: 8px; background: #fff; box-shadow: 1.5px 1.5px 0 0 #161716; rotate: 45deg; }
.bubble.is-out { animation: bubble-out 160ms ease-in forwards; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(6px) scale(0.6); } }
@keyframes bubble-out { to { opacity: 0; transform: scale(0.8); } }
.machine { position: absolute; left: 2px; bottom: 12px; width: 48px; height: 70px; }
.machine svg { display: block; width: 100%; height: 100%; }
.machine .m-drip { stroke-dasharray: 3 4; opacity: 0; }
.machine.is-brewing .m-drip { opacity: 1; animation: drip 300ms linear infinite; }
@keyframes drip { to { stroke-dashoffset: -7; } }
.machine .m-coffee { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); }
.machine.is-brewing .m-coffee { transition: transform 2.6s linear; transform: scaleY(1); }
.machine.is-ready .m-coffee { transform: scaleY(1); }
.machine .m-steam { display: none; }
.machine.is-ready .m-steam { display: inline; }
.machine.no-cup .m-cup { visibility: hidden; }
.machine .m-btn { transform-box: fill-box; transform-origin: center; transition: transform 150ms; }
.machine.is-pressed .m-btn { transform: scale(0.7); }
@media (prefers-reduced-motion: reduce) {
  .music-note { animation-name: note-still; }
  @keyframes note-still { 0% { opacity: 0; transform: translate(var(--dx, 16px), -32px); } 20%, 70% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx, 16px), -32px); } }
  .peek-buddy .steam path, .machine .steam path { animation: none; opacity: 0.6; }
}
.peek.is-asleep .peek-buddy .buddy-all { animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.03, 0.97); } }
.zzz { position: absolute; right: 16px; top: 16px; z-index: 3; pointer-events: none; font: 500 14px var(--mono); color: #5b5c57; }
.zzz i { position: absolute; right: 0; top: 0; font-style: normal; opacity: 0; }
.peek.is-asleep .zzz i { animation: zzz 3s ease-out infinite; }
.peek.is-asleep .zzz i:nth-child(2) { animation-delay: 1s; font-size: 16px; }
.peek.is-asleep .zzz i:nth-child(3) { animation-delay: 2s; font-size: 18px; }
@keyframes zzz { 0% { opacity: 0; transform: translate(0, 24px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(-16px, -8px); } }
@media (prefers-reduced-motion: reduce) {
  .peek.is-asleep .zzz i { animation: none; opacity: 1; }
  .peek.is-asleep .zzz i:nth-child(1) { transform: translate(-16px, 16px); }
  .peek.is-asleep .zzz i:nth-child(2) { transform: translate(-8px, 4px); }
  .peek.is-asleep .zzz i:nth-child(3) { transform: translate(0, -8px); }
}

/* Entrance */
.reveal { animation: rise 700ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.view-swap { animation: swap 350ms var(--ease-out); }
@keyframes swap { from { opacity: 0; transform: translateY(8px); } }

/* Responsive */
@media (max-width: 1180px) {
  .bento { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .shell { padding: 16px 16px 80px; }
  .top { margin: -16px -16px 0; padding: 8px 16px; }
  .btn-add .mono, .brand-name, #exportBtn { display: none; }
  .top-right { gap: 8px; }
  .hero { padding: 32px 0 24px; }
  .hero-sub { font-size: 16px; }
  .bento { grid-template-columns: 1fr; gap: 8px; }
  .tile { min-height: 0; }
  .today-count { margin-top: 16px; }
  .board { margin: 0 -16px; padding-inline: 16px; scroll-padding-inline: 16px; grid-auto-columns: 84%; }
  .toolbar { gap: 8px; }
  .search { order: 3; min-width: 100%; }
  .btn-primary kbd, .search kbd { display: none; }
  .btn-primary { padding: 0 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { padding: 16px; border-bottom: 1px solid var(--line); }
  .table td { padding: 0; border: 0; }
  .table td + td { margin-top: 4px; }
  .td-hide-sm { display: none !important; }
  .cheer { right: 16px; bottom: 16px; padding-left: 120px; }
  .cheer-buddy { width: 104px; height: 115px; }
  .save-state { display: none; }
  .note { margin-top: 16px; gap: 8px; }
  .note-text { font-size: 16px; }
  .toasts { bottom: auto; top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
  .sheet { transition: opacity 200ms ease, visibility 0s linear 200ms !important; transform: none; opacity: 0; }
  .sheet.is-open { opacity: 1; transition: opacity 200ms ease !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .scrim, .modal::backdrop { backdrop-filter: none; }
}

/* Role picker */
.field > label { font-size: 14px; font-weight: 500; color: var(--muted); padding-left: 8px; }
.combo { position: relative; }
.combo input { width: 100%; padding-right: 48px; }
.combo .sheet-role { padding-right: 40px; }
.combo-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: 0; border-radius: 8px; background: none; color: var(--muted);
  display: grid; place-items: center; transition: background-color 200ms, color 200ms;
}
.sheet-head .combo-toggle { right: -8px; top: calc(50% + 4px); }
.combo-toggle:hover { background: var(--surface-2); color: var(--text); }
.combo-list {
  position: fixed; inset: auto; margin: 0; padding: 8px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 16px;
  box-shadow: var(--shadow-lg); overflow-y: auto; overscroll-behavior: contain;
}
.combo-list:popover-open { animation: combo-in 160ms var(--ease-out); }
@keyframes combo-in { from { opacity: 0; transform: translateY(-4px); } }
.combo-opt {
  min-height: 40px; display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-radius: 8px;
  font-size: 15px; line-height: 1.3; cursor: pointer;
}
.combo-opt:hover { background: var(--surface-2); }
.combo-opt[aria-selected="true"] { background: var(--lime-soft); }
.combo-name { flex: 1; min-width: 0; }
.combo-n { font-size: 14px; color: var(--muted); }
.combo-plus { font: 500 16px var(--mono); color: var(--teal); width: 16px; text-align: center; }
.combo-opt.is-add { color: var(--teal); font-weight: 500; }
:root[data-theme="dark"] .combo-opt.is-add, :root[data-theme="dark"] .combo-plus { color: var(--lime); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .combo-opt.is-add, :root:not([data-theme="light"]) .combo-plus { color: var(--lime); } }
.combo-x {
  width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 18px; line-height: 1;
  opacity: 0; transition: opacity 150ms, background-color 150ms;
}
.combo-opt:hover .combo-x, .combo-opt[aria-selected="true"] .combo-x { opacity: 1; }
.combo-x:hover { background: var(--surface); color: var(--text); }
.combo-empty { margin: 0; padding: 8px 12px; font-size: 15px; color: var(--muted); }

/* Resume and cover letter links */
.doc-row { display: flex; gap: 8px; align-items: center; }
.doc-row input { flex: 1; min-width: 0; }
.doc-open { flex: none; width: 48px; height: 48px; border-radius: 12px; }
.doc-open[hidden] { display: none; }

/* Notes: a rich text log */
.rt-box {
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface-2);
  transition: border-color 200ms, box-shadow 200ms, background-color 200ms;
}
.rt-box:focus-within { border-color: var(--teal); background: var(--surface); box-shadow: 0 0 0 4px rgba(19, 92, 86, 0.12); }
.rt-tools {
  display: flex; align-items: center; gap: 4px; padding: 4px; border-bottom: 1px solid var(--line);
  position: sticky; top: -24px; z-index: 1; background: inherit; border-radius: 12px 12px 0 0;
}
.rt-log {
  margin-left: auto; height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: none;
  font-size: 14px; font-weight: 500; color: var(--teal); display: inline-flex; align-items: center; gap: 4px;
  transition: background-color 150ms;
}
.rt-log:hover { background: var(--lime-soft); }
.rt-log:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
:root[data-theme="dark"] .rt-log { color: var(--lime); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rt-log { color: var(--lime); } }
.rt-btn {
  width: 40px; height: 40px; border: 0; border-radius: 8px; background: none; color: var(--muted);
  display: grid; place-items: center; font: 500 16px var(--serif); transition: background-color 150ms, color 150ms;
}
.rt-btn:hover { background: var(--line); color: var(--text); }
.rt-btn[aria-pressed="true"] { background: var(--lime-soft); color: var(--text); }
.rt-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.rt-link { padding: 8px; border-bottom: 1px solid var(--line); position: sticky; top: 25px; z-index: 1; background: inherit; }
.rt-link[hidden] { display: none; }
.rt-link-input {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 8px; font-size: 15px;
  border: 1px solid var(--line-strong); background: var(--surface); outline: none;
}
.rt-link-input:focus { border-color: var(--teal); }
.rt {
  min-height: 160px; padding: 12px 16px; font-size: 16px; line-height: 1.6; outline: none;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.rt:empty::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; }
.rt b, .rt strong { font-weight: 600; }
.rt ul, .rt ol { margin: 0; padding-left: 24px; }
.rt a { color: var(--teal); text-underline-offset: 3px; cursor: pointer; }
:root[data-theme="dark"] .rt a { color: var(--lime); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rt a { color: var(--lime); } }
@media (prefers-reduced-motion: reduce) { .combo-list:popover-open { animation: none; } }

/* ---------- application summary (the sheet's read-first view) ---------- */
.sum-title { margin: 0; overflow-wrap: anywhere; }
.sum-role { margin: 8px 0 0; color: var(--muted); font-size: 16px; line-height: 1.4; position: relative; }
.sum-status { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; position: relative; }
.status-wrap { position: relative; }
/* the status menu hangs below the header: let it overflow (the sheet itself still clips the round shape) */
.sheet-head:has(.status-wrap) { overflow: visible; z-index: 2; }
.sheet-head:has(.status-wrap) .shape { clip-path: inset(96px 64px 0 0); }
.status-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 16px; border-radius: 999px;
  background: var(--c); color: var(--text); font: 500 15px/1 var(--sans);
  border: 1px solid color-mix(in srgb, var(--c-dot) 35%, transparent);
}
.status-pill .dot, .status-opt .dot { background: var(--c-dot); width: 8px; height: 8px; }
.status-pill:hover { border-color: var(--c-dot); }
.status-pill:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.status-pill[aria-expanded="true"] svg { transform: rotate(180deg); }
.status-menu {
  position: absolute; z-index: 5; top: calc(100% + 8px); left: 0; min-width: 208px; padding: 8px;
  display: grid; gap: 4px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
}
.status-menu[hidden] { display: none; }
.status-opt {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px 8px 8px; min-height: 40px; border: 0; border-radius: 8px;
  background: none; text-align: left; font: 400 15px/1.2 var(--sans); color: var(--text);
}
.status-opt:hover, .status-opt:focus-visible { background: var(--c); outline: none; }
.status-opt[aria-checked="true"] { font-weight: 600; }
.status-opt[aria-checked="true"]::after { content: "✓"; margin-left: auto; color: var(--muted); font-weight: 400; }
.sum-facts { margin: 0; font-size: 14px; line-height: 1.4; color: var(--muted); }
.sum-facts span + span::before { content: "·"; margin: 0 8px; }

.sum-next {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px;
  border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line);
}
.sum-next .card-meet { margin: 0; }
.sum-step { margin: 0; font-size: 16px; line-height: 1.5; }
.sum-k { font: 500 12px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-right: 8px; }
.sum-you { display: flex; align-items: center; gap: 8px; }
.sum-sec { display: flex; flex-direction: column; }
.sum-h { margin: 0 0 8px; padding-left: 8px; font-size: 14px; font-weight: 500; color: var(--muted); }

.link-list { display: grid; gap: 8px; }
.link-row {
  display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 8px 16px 8px 8px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none;
}
.link-row:hover { background: var(--surface-2); border-color: var(--line-strong); }
.link-row:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.link-row > svg { margin-left: auto; color: var(--faint); flex: none; }
.link-row:hover > svg { color: var(--text); }
.link-ico {
  flex: none; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  background: var(--lime-soft); color: var(--lime-ink);
}
.link-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.link-name { font-size: 16px; font-weight: 500; line-height: 1.2; }
.link-host { font: 400 13px/1.2 var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-row.is-empty { width: 100%; min-height: 48px; padding: 8px 16px 8px 8px; border-style: dashed; background: none; color: var(--muted); font: inherit; text-align: left; cursor: pointer; }
.link-row.is-empty .link-ico { width: 32px; height: 32px; border-radius: 8px; background: none; color: inherit; font: 400 20px/1 var(--mono); }
.link-row.is-empty .link-name { font-size: 15px; font-weight: 400; }
.link-row.is-empty:hover { color: var(--text); }

.log-add { display: flex; gap: 8px; margin-bottom: 16px; }
.log-input {
  flex: 1; min-width: 0; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: 400 15px/1 var(--sans); outline: none;
}
.log-input:focus { border-color: var(--teal); background: var(--surface); box-shadow: 0 0 0 4px rgba(19, 92, 86, 0.12); }
.log-add .btn { height: 40px; flex: none; }
.activity { list-style: none; margin: 0; padding: 0 0 0 8px; }
.act { position: relative; padding: 0 0 16px 24px; font-size: 15px; line-height: 1.5; }
.act::before { content: ""; position: absolute; left: 0; top: 6px; width: 10px; height: 10px; border-radius: 50%; box-sizing: border-box; }
.act::after { content: ""; position: absolute; left: 4.5px; top: 20px; bottom: 0; width: 1px; background: var(--line-strong); }
.act:last-child::after { display: none; }
.act-status::before { background: var(--t-dot); }
.act-log::before, .act-note::before { border: 2px solid var(--teal); background: var(--surface); }
.act-status { color: var(--muted); display: flex; align-items: baseline; gap: 8px; }
.act-status b { color: var(--text); font-weight: 500; }
.act-when { font-size: 12px; color: var(--muted); }
.act-log .act-when, .act-note .act-tag { display: block; margin-bottom: 4px; }
.act-tag { font-size: 12px; color: var(--muted); }
.act-md { overflow-wrap: anywhere; }
.act-md b, .act-md strong { font-weight: 600; }
.act-md ul, .act-md ol { margin: 0; padding-left: 24px; }
.act-md a { color: var(--teal); text-underline-offset: 3px; }
:root[data-theme="dark"] .act-md a, :root[data-theme="dark"] .act-log::before, :root[data-theme="dark"] .act-note::before { color: var(--lime); border-color: var(--lime); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .act-md a, :root:not([data-theme="light"]) .act-log::before, :root:not([data-theme="light"]) .act-note::before { color: var(--lime); border-color: var(--lime); }
}
@media (max-width: 480px) { .link-row { min-height: 56px; } .link-ico { width: 40px; height: 40px; } }

/* Launch splash */
.splash {
  position: fixed; inset: 0; z-index: 90; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  transition: opacity 400ms var(--ease-out), visibility 0s 400ms;
}
.splash.is-out { opacity: 0; visibility: hidden; }
.splash-buddy { width: 152px; height: 168px; animation: bob 2.4s var(--ease-out) infinite; transition: transform 400ms var(--ease-out); }
.splash-buddy .buddy { width: 100%; height: 100%; }
.splash-msg { margin: 0; font: italic 400 24px/1.3 var(--serif, "Newsreader", serif); color: var(--text); text-align: center; padding: 0 24px; }
.splash-dots { display: flex; gap: 8px; }
.splash-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); animation: dot-pulse 1.2s ease-in-out infinite; }
.splash-dots i:nth-child(2) { animation-delay: 150ms; }
.splash-dots i:nth-child(3) { animation-delay: 300ms; }
@keyframes dot-pulse { 0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); } 40% { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .splash { transition-duration: 150ms; transition-delay: 0s, 150ms; }
  .splash-buddy, .splash-dots i { animation: none; }
}

/* Onboarding tour */
.tour-spot {
  position: fixed; z-index: 85; pointer-events: none; border-radius: 24px;
  box-shadow: 0 0 0 2px var(--lime), 0 0 0 9999px rgba(17, 19, 18, 0.42);
  transition: left 350ms var(--ease-out), top 350ms var(--ease-out), width 350ms var(--ease-out), height 350ms var(--ease-out);
}
.tour {
  position: fixed; z-index: 86; width: min(360px, calc(100vw - 32px)); padding: 24px;
  border-radius: 24px; background: var(--teal); color: var(--teal-ink);
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.4);
}
.tour.is-in { animation: tour-in 350ms var(--ease-out); }
@keyframes tour-in { from { opacity: 0; transform: translateY(8px) scale(0.97); } }
.tour[data-side="above"].is-in { animation-name: tour-in-up; }
@keyframes tour-in-up { from { opacity: 0; transform: translateY(-8px) scale(0.97); } }
.tour-step { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: color-mix(in srgb, var(--teal-ink) 70%, transparent); }
.tour-title { font: 400 24px/1.15 var(--serif); margin: 8px 0; letter-spacing: -0.01em; }
.tour-text { margin: 0 0 24px; font-size: 16px; line-height: 1.5; color: color-mix(in srgb, var(--teal-ink) 88%, transparent); }
.tour-acts { display: flex; justify-content: space-between; gap: 8px; }
.tour .btn-ghost { color: var(--teal-ink); background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--teal-ink) 35%, transparent); }
.tour .btn-primary { background: #e0ff98; color: #16210a; margin-left: 0; }
.tour .btn-primary:hover { background: #d4f57a; }
.tour[hidden], .tour-spot[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .tour.is-in { animation: fade 150ms; } .tour-spot { transition: none; } }

/* a panel or dialog is open: the page behind it stays put */
html:has(dialog[open]), html:has(.sheet.is-open) { overflow: hidden; }

/* ---------- web app: avatar menu, Account panel ---------- */
/* the menu holds Settings, buddy, theme and export, so the header keeps just Add and your photo */
.is-cloud #settingsBtn, .is-cloud #buddyBtn, .is-cloud #exportBtn, .is-cloud #themeBtn { display: none; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; overflow: hidden;
  display: grid; place-items: center;
  background: var(--teal); color: var(--teal-ink);
  font: 600 15px var(--sans); letter-spacing: 0.02em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-btn { border: 0; padding: 0; cursor: pointer; box-shadow: 0 0 0 1px var(--line); transition: transform 120ms ease-out, box-shadow 200ms; }
.avatar-btn[hidden] { display: none; }
.avatar-btn:hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 25%, transparent); }
.avatar-btn:active { transform: scale(0.94); }
.avatar-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.avatar-lg { width: 64px; height: 64px; font-size: 24px; }

.menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  width: min(280px, calc(100vw - 32px)); padding: 8px;
  border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform-origin: calc(100% - 20px) -8px;
  animation: menu-in 200ms var(--ease-out);
}
.menu[hidden] { display: none; }
@keyframes menu-in { from { opacity: 0; transform: scale(0.96) translateY(-4px); } }
.menu-who { margin: 0; padding: 8px 8px 16px; display: flex; flex-direction: column; gap: 0; min-width: 0; }
.menu-who b { font-size: 15px; font-weight: 600; }
.menu-who span { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item {
  all: unset; box-sizing: border-box; cursor: pointer;
  height: 44px; padding: 0 8px; border-radius: var(--radius-sm);
  display: flex; align-items: center; font-size: 15px; color: var(--text);
}
.menu-item:hover { background: var(--surface-2); }
.menu-item:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; background: var(--surface-2); }
.menu-line { border: 0; border-top: 1px solid var(--line); margin: 8px 0; width: 100%; }

.acc-profile { flex-direction: row; align-items: center; gap: 16px; }
.acc-who { min-width: 0; }
.acc-name { margin: 0; font-size: 18px; font-weight: 600; }
.acc-email { margin: 0; font-size: 15px; color: var(--muted); overflow-wrap: anywhere; }
.acc-since { margin-top: 4px; font-size: 14px; }
.acc-devices { list-style: none; margin: 0; padding: 0; }
.acc-devices li { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; font-size: 15px; border-bottom: 1px solid var(--line); }
.acc-devices li:last-child { border-bottom: 0; }
.set-wrap { flex-wrap: wrap; }
.set-fine a { color: inherit; }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- phone: stage tabs instead of a dragged board ---------- */
.stage-tabs {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  position: sticky; top: 56px; z-index: 15;
  margin: 0 -16px 8px; padding: 8px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.stage-tabs::-webkit-scrollbar { display: none; }
.stage-tab {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 20px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: 500 14px var(--sans); cursor: pointer;
  transition: background-color 200ms, border-color 200ms;
}
.stage-tab .dot { background: var(--col-dot); }
.stage-n { font: 500 14px var(--mono); color: var(--muted); }
.stage-tab[aria-selected="true"] { background: var(--col); border-color: var(--col-dot); }
.stage-tab:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.stage-panel { border-radius: var(--radius-lg); padding: 8px; background: color-mix(in srgb, var(--col) 55%, transparent); border: 1px solid var(--line); }
.stage-hint { font-size: 14px; color: var(--muted); margin: 8px 8px 16px; }
.phone-board .card { cursor: pointer; touch-action: auto; }

.card-move {
  display: flex; align-items: center; gap: 8px; width: 100%;
  margin-top: 16px; height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--mv-dot) 35%, transparent);
  background: var(--mv); color: var(--text); font: 500 15px var(--sans); cursor: pointer;
}
.card-move .dot { background: var(--mv-dot); }
.card-move-to { margin-left: auto; color: var(--muted); font-size: 14px; }
.card-move svg { color: var(--muted); }
.card-move:active { transform: scale(0.98); }
.card-move:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.move-opts { display: flex; flex-direction: column; gap: 8px; }
.move-opt {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  min-height: 64px; padding: 8px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
  transition: background-color 150ms;
}
.move-opt:hover { background: color-mix(in srgb, var(--col) 50%, var(--surface)); }
.move-opt:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.move-opt .dot { background: var(--col-dot); width: 12px; height: 12px; flex: none; }
.move-name { display: flex; flex-direction: column; gap: 4px; font-size: 16px; font-weight: 600; }
.move-hint { font-size: 14px; font-weight: 400; color: var(--muted); }
.move-opt[aria-current="true"] { background: var(--col); border-color: var(--col-dot); }
.move-now { margin-left: auto; font: 500 14px var(--mono); color: var(--muted); }

.bento-more { display: none; }
@media (max-width: 720px) {
  /* the Move sheet comes up from the bottom, in reach of a thumb */
  .modal-move { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .modal-move[open] { animation: sheet-up 360ms var(--ease-out); }
  @keyframes sheet-up { from { transform: translateY(100%); } }

  /* overview tiles fold to their numbers; "Show details" opens them */
  .bento-more {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
    height: 44px; margin: -24px 0 24px; border-radius: 22px;
    border: 1px solid var(--line-strong); background: transparent; color: var(--text);
    font: 500 15px var(--sans); cursor: pointer;
  }
  .bento-more svg { transition: transform 250ms var(--ease-out); }
  .bento-more[aria-expanded="true"] svg { transform: rotate(180deg); }
  .bento-more:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
  .bento { margin-bottom: 40px; }
  .bento.is-collapsed { grid-template-columns: 1fr 1fr; }
  .bento.is-collapsed .tile { padding: 16px; min-height: 0; cursor: pointer; }
  .bento.is-collapsed :is(.today-note, .meter, .legend, .bars, .tile-sub, .needs-list, .pipe-strip, .shape, .peek, .stats-head .muted, .tile-pipe > .muted) { display: none; }
  .bento.is-collapsed .today-count { font-size: 40px; margin: 8px 0 0; }
  .bento.is-collapsed .today-goal { font-size: 20px; }
  .bento.is-collapsed :is(.stats-big, .pipe-rate) { font-size: 40px; }
  .bento.is-collapsed .needs-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .bento.is-collapsed .pill-count { font: 400 40px/1 var(--serif); background: none; color: #16210a; padding: 0; height: auto; min-width: 0; }
  .bento.is-collapsed .label { font-size: 13px; }
}

/* buddies: face always dark, it sits on the colored body in light and dark mode */
.buddy .face path:not(.fill) { stroke: #161716; }
.buddy .face .eye, .buddy .face .fill { fill: #161716; }

/* clay at text size, dark enough for 4.5:1 on the panel */
.modal .btn-danger { color: #a3462a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .modal .btn-danger { color: #f0a184; } }
:root[data-theme="dark"] .modal .btn-danger { color: #f0a184; }
.is-empty .bento-more { display: none; }
