/* Today: the ranked queue and focus mode. Scoped to .tq / .fq so it cannot affect other pages. */

.tq,
.fq,
.bl,
.rn,
.tq-toasts {
  --tq-ink: #1a1614;
  --tq-ink-2: #5f5955;
  --tq-ink-3: #8f8884;
  --tq-line: #e8e4df;
  --tq-line-strong: #d6d0c9;
  --tq-wash: #faf9f7;
  --tq-hover: #f6f4f1;
  --tq-hot: #8b2942;
  --tq-hot-wash: #f8eef1;
  --tq-warm: #b06f12;
  --tq-warm-wash: #fcf3e3;
  --tq-cool: #5d7488;
  --tq-cool-wash: #eef2f6;
  --tq-alert: #b42318;
  --tq-alert-wash: #fdeeec;
  --tq-ok: #2d6a4f;
  --tq-ok-wash: #eaf5ee;
  --tq-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --tq-serif: 'Cormorant Garamond', Georgia, serif;
}

/* ---------- Buttons ---------- */
.tq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--tq-ink);
  font-family: var(--tq-sans);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
}
.tq-btn svg { width: 15px; height: 15px; flex: 0 0 auto; }
.tq-btn:active { transform: translateY(1px); }
.tq-btn:focus-visible { outline: 2px solid var(--tq-hot); outline-offset: 2px; }
.tq-btn--primary { background: var(--tq-ink); color: #fff; }
.tq-btn--primary:hover { background: #000; }
.tq-btn--ghost { background: #fff; border-color: var(--tq-line-strong); }
.tq-btn--ghost:hover { background: var(--tq-hover); }
.tq-btn--quiet { color: var(--tq-ink-2); padding: 0 10px; }
.tq-btn--quiet:hover { background: var(--tq-hover); color: var(--tq-ink); }
.tq-btn--done { background: var(--tq-ok); color: #fff; }
.tq-btn--done:hover { background: #24573f; }
.tq-btn--sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.tq-btn--lg { height: 44px; padding: 0 18px; font-size: 14.5px; border-radius: 10px; }
.tq-btn:disabled,
.tq-btn.is-disabled { opacity: 0.45; cursor: not-allowed; }
.tq-btn kbd,
.fq kbd {
  font-family: var(--tq-sans);
  font-size: 10.5px;
  font-weight: 600;
  min-width: 18px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(127, 127, 127, 0.16);
  color: inherit;
  opacity: 0.8;
}

/* ---------- Hero ---------- */
.tq { margin: 0 auto 2.25rem; font-family: var(--tq-sans); color: var(--tq-ink); max-width: 980px; }
.tq-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  padding: 1.5rem 1.6rem 1.35rem;
  border: 1px solid var(--tq-line);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(180deg, #fff 0%, var(--tq-wash) 100%);
}
.tq-date { margin: 0 0 4px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tq-ink-3); }
.tq-title { margin: 0; font-family: var(--tq-serif); font-size: 2rem; font-weight: 600; line-height: 1.1; color: var(--tq-ink); }
.tq-sub { margin: 6px 0 0; font-size: 13.5px; color: var(--tq-ink-2); display: flex; flex-wrap: wrap; gap: 0 8px; align-items: center; }
.tq-dot { color: var(--tq-line-strong); }
.tq-working { color: var(--tq-ink-2); }
.tq-working::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 6px; border: 2px solid var(--tq-line-strong); border-top-color: var(--tq-ink-2); border-radius: 50%; vertical-align: -1px; animation: tq-spin 0.8s linear infinite; }
@keyframes tq-spin { to { transform: rotate(360deg); } }
.tq-start { height: 48px; padding: 0 22px; border-radius: 12px; font-size: 15px; box-shadow: 0 6px 18px rgba(26, 22, 20, 0.18); }
.tq-start svg { width: 17px; height: 17px; }

/* ---------- Queue ---------- */
.tq-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  border: 1px solid var(--tq-line);
  border-radius: 0 0 14px 14px;
  background: #fff;
  min-height: 1rem;
}
.tq-list:empty { padding: 0; border-top-color: var(--tq-line); }
.tq-item {
  display: grid;
  grid-template-columns: 22px 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 0.8rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 120ms ease;
}
.tq-item + .tq-item { border-top: 1px solid var(--tq-line); border-radius: 0; }
.tq-item:hover { background: var(--tq-hover); }
.tq-rank { font-size: 12px; font-weight: 600; color: var(--tq-ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.tq-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--tq-wash); color: var(--tq-ink-2); border: 1px solid var(--tq-line); }
.tq-icon svg { width: 17px; height: 17px; }
.tq-kind--reply .tq-icon,
.tq-kind--send .tq-icon { background: var(--tq-hot-wash); color: var(--tq-hot); border-color: #efd7de; }
.tq-kind--call .tq-icon { background: var(--tq-ok-wash); color: var(--tq-ok); border-color: #cfe6d8; }
.tq-kind--schedule .tq-icon { background: var(--tq-cool-wash); color: var(--tq-cool); border-color: #d8e1ea; }
.tq-kind--nudge .tq-icon { background: var(--tq-warm-wash); color: var(--tq-warm); border-color: #f1dfbd; }
.tq-main { min-width: 0; }
.tq-item-title {
  display: block;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--tq-serif);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--tq-ink);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tq-item-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.tq-item-title:focus-visible { outline: 2px solid var(--tq-hot); outline-offset: 2px; border-radius: 3px; }
.tq-item-action { margin: 3px 0 0; font-size: 13px; line-height: 1.45; color: var(--tq-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tq-item-meta { margin: 3px 0 0; font-size: 12px; color: var(--tq-ink-3); display: flex; flex-wrap: wrap; gap: 0 7px; align-items: center; }
.tq-late { color: var(--tq-alert); font-weight: 500; }
.tq-new { margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--tq-alert-wash); color: var(--tq-alert); font-size: 11px; font-weight: 600; }
.tq-side { display: flex; align-items: center; gap: 10px; }
.tq-score { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; background: var(--tq-wash); color: var(--tq-ink-2); }
.tq-score.t-hot { background: var(--tq-hot); color: #fff; }
.tq-score.t-warm { background: var(--tq-warm-wash); color: var(--tq-warm); }
.tq-score.t-cool { background: var(--tq-cool-wash); color: var(--tq-cool); }
.tq-score.t-overdue { background: var(--tq-alert-wash); color: var(--tq-alert); }
.tq-score.t-today { background: var(--tq-cool-wash); color: var(--tq-cool); }
.tq-foot { margin: 0.75rem 0.25rem 0; font-size: 13px; color: var(--tq-ink-2); }
.tq-foot a { color: var(--tq-ink); font-weight: 600; }
.tq-item--skel { cursor: default; grid-template-columns: 1fr; }
.tq-skel { display: block; height: 10px; margin: 7px 0; width: 35%; border-radius: 5px; background: linear-gradient(90deg, #f0ede9 25%, #f8f6f3 50%, #f0ede9 75%); background-size: 200% 100%; animation: tq-shimmer 1.2s infinite linear; }
.tq-skel--long { width: 75%; }
@keyframes tq-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.tq-section-head { max-width: 980px; margin: 0 auto 0.75rem; }
.tq-section-title { margin: 0; font-family: var(--tq-serif, 'Cormorant Garamond', Georgia, serif); font-size: 1.35rem; font-weight: 600; }
.tq-section-sub { margin: 2px 0 0; font-size: 0.85rem; color: var(--ev-gray, #6b6b6b); }

/* ---------- Focus mode ---------- */
.fq {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: #f4f2ef;
  color: var(--tq-ink);
  font-family: var(--tq-sans);
}
.fq::backdrop { background: rgba(26, 22, 20, 0.5); }
.fq[open] { animation: fq-in 180ms ease-out; }
@keyframes fq-in { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: none; } }
.fq-shell { display: flex; flex-direction: column; height: 100%; }
.fq-top { flex: 0 0 auto; padding: 0 1.25rem; background: rgba(244, 242, 239, 0.94); backdrop-filter: blur(6px); }
.fq-progress { height: 3px; margin: 0 -1.25rem; background: var(--tq-line); }
.fq-progress i { display: block; height: 100%; background: var(--tq-ink); transition: width 250ms ease; }
.fq-top-row { display: flex; align-items: center; gap: 14px; max-width: 760px; margin: 0 auto; height: 52px; font-size: 13px; color: var(--tq-ink-2); }
.fq-count { font-weight: 600; color: var(--tq-ink); font-variant-numeric: tabular-nums; }
.fq-done-count { display: inline-flex; align-items: center; gap: 4px; color: var(--tq-ok); font-weight: 500; }
.fq-done-count svg { width: 14px; height: 14px; }
.fq-close { margin-left: auto; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--tq-line-strong); background: #fff; color: var(--tq-ink-2); cursor: pointer; }
.fq-close svg { width: 16px; height: 16px; }
.fq-close:hover { color: var(--tq-ink); }
.fq-close:focus-visible { outline: 2px solid var(--tq-hot); outline-offset: 2px; }
.fq-stage { flex: 1 1 auto; overflow-y: auto; padding: 1.25rem 1.25rem 2rem; overscroll-behavior: contain; }
.fq-card {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.6rem 1.75rem 1.4rem;
  background: #fff;
  border: 1px solid var(--tq-line);
  border-radius: 18px;
  box-shadow: 0 1px 0 rgba(26, 22, 20, 0.03), 0 18px 50px rgba(26, 22, 20, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease;
  touch-action: pan-y;
}
.fq-card.is-swipe-done { box-shadow: 0 0 0 3px var(--tq-ok), 0 18px 50px rgba(26, 22, 20, 0.08); }
.fq-card.is-swipe-skip { box-shadow: 0 0 0 3px var(--tq-line-strong), 0 18px 50px rgba(26, 22, 20, 0.08); }
.fq-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 0.9rem; font-size: 12.5px; color: var(--tq-ink-2); }
.fq-kicker .tq-score { margin-left: auto; }
.fq-kind { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; background: var(--tq-wash); color: var(--tq-ink-2); border: 1px solid var(--tq-line); }
.fq-kind svg { width: 13px; height: 13px; }
.fq-kind.tq-kind--reply,
.fq-kind.tq-kind--send { background: var(--tq-hot-wash); color: var(--tq-hot); border-color: #efd7de; }
.fq-kind.tq-kind--call { background: var(--tq-ok-wash); color: var(--tq-ok); border-color: #cfe6d8; }
.fq-kind.tq-kind--schedule { background: var(--tq-cool-wash); color: var(--tq-cool); border-color: #d8e1ea; }
.fq-kind.tq-kind--nudge { background: var(--tq-warm-wash); color: var(--tq-warm); border-color: #f1dfbd; }
.fq-name { margin: 0; font-family: var(--tq-serif); font-size: 2.2rem; font-weight: 600; line-height: 1.08; overflow-wrap: anywhere; }
.fq-name--task { font-size: 1.85rem; }
.fq-context { margin: 6px 0 0; font-size: 13.5px; color: var(--tq-ink-2); }
.fq-next { margin: 1.15rem 0 0; font-size: 16px; line-height: 1.5; font-weight: 500; }
.fq-label { display: block; margin-bottom: 3px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tq-ink-3); }
.fq-quote { margin: 1rem 0 0; padding: 0.15rem 0 0.15rem 0.9rem; border-left: 2px solid var(--tq-line-strong); font-family: var(--tq-serif); font-size: 1.15rem; line-height: 1.45; }
.fq-quote cite { display: block; margin-top: 3px; font-family: var(--tq-sans); font-style: normal; font-size: 12px; color: var(--tq-ink-3); }
.fq-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 1.1rem; }
.fq-row--center { justify-content: center; }
.fq-call { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1.25rem; }
.fq-call .fq-hint { flex-basis: 100%; }
.fq-hint { margin: 0.75rem 0 0; font-size: 12.5px; color: var(--tq-ink-3); }
.fq-hint--note { padding: 0.6rem 0.8rem; border-radius: 10px; background: var(--tq-wash); color: var(--tq-ink-2); }
.fq-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--tq-line); font-size: 12.5px; }
.fq-links a { display: inline-flex; align-items: center; gap: 5px; color: var(--tq-ink-2); text-decoration: none; }
.fq-links a:hover { color: var(--tq-ink); text-decoration: underline; text-underline-offset: 3px; }
.fq-links svg { width: 14px; height: 14px; }

.fq-draft { margin-top: 1.25rem; padding: 1rem 1.05rem 1rem; border-radius: 14px; border: 1px solid var(--tq-line-strong); background: var(--tq-wash); }
.fq-draft-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 0.7rem; font-size: 12.5px; font-weight: 600; }
.fq-draft-head svg { width: 15px; height: 15px; color: var(--tq-hot); }
.fq-draft-head small { margin-left: auto; font-weight: 400; color: var(--tq-ink-3); font-size: 11.5px; }
.fq .fq-subject,
.fq .fq-body {
  display: block;
  width: 100%;
  min-height: 0;
  border: 1px solid var(--tq-line);
  border-radius: 10px;
  background: #fff;
  font-family: var(--tq-sans);
  color: var(--tq-ink);
}
.fq .fq-subject { height: 40px; padding: 0 12px; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.fq .fq-body { padding: 12px 14px; font-size: 15px; line-height: 1.6; resize: vertical; min-height: 170px; }
.fq .fq-subject:focus,
.fq .fq-body:focus { outline: none; border-color: var(--tq-ink-2); box-shadow: 0 0 0 3px rgba(26, 22, 20, 0.07); }
.fq-warn { margin: 0 0 0.7rem; padding: 0.6rem 0.8rem 0.6rem 1.8rem; border-radius: 8px; background: var(--tq-alert-wash); border: 1px solid #f5cdc8; color: var(--tq-alert); font-size: 12.5px; line-height: 1.45; }
.fq-gate { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 0.6rem; padding: 0.45rem 0.5rem 0.45rem 0.75rem; border-radius: 8px; background: var(--tq-warm-wash); color: var(--tq-warm); font-size: 12.5px; font-weight: 500; }
.fq-gate[hidden] { display: none; }
.fq-draft .fq-row { margin-top: 0.8rem; }
.fq-sent { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 0.8rem; padding: 0.7rem 0.8rem; border-radius: 10px; background: var(--tq-ok-wash); color: var(--tq-ok); font-size: 13.5px; font-weight: 500; }
.fq-sent > span { margin-right: auto; }
.fq-draft--error p { margin: 0; color: var(--tq-alert); font-size: 13px; }

.fq-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.75rem 1.25rem calc(0.75rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--tq-line);
  background: #fff;
}
.fq-bar > * { flex: 0 0 auto; }
.fq-bar-main { display: flex; gap: 8px; margin-left: auto; }
.fq-back { margin-right: auto; }
.fq-bar .tq-btn { height: 42px; }
.fq-snooze { position: relative; }
.fq-menu { position: absolute; bottom: calc(100% + 8px); left: 0; min-width: 11rem; padding: 6px; background: #fff; border: 1px solid var(--tq-line); border-radius: 12px; box-shadow: 0 14px 34px rgba(26, 22, 20, 0.16); z-index: 5; }
.fq-menu[hidden] { display: none; }
.fq-menu button { display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px; background: transparent; text-align: left; font-family: var(--tq-sans); font-size: 13.5px; color: var(--tq-ink); cursor: pointer; }
.fq-menu button:hover,
.fq-menu button:focus-visible { background: var(--tq-hover); outline: none; }

.fq-end { text-align: center; padding: 2.75rem 1.75rem 2.25rem; }
.fq-end-mark { width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 50%; display: grid; place-items: center; background: var(--tq-ok-wash); color: var(--tq-ok); }
.fq-end-mark svg { width: 26px; height: 26px; }
.fq-stats { display: flex; justify-content: center; gap: 12px; margin: 1.5rem 0 0.5rem; }
.fq-stat { min-width: 88px; padding: 0.7rem 0.9rem; border-radius: 12px; background: var(--tq-wash); border: 1px solid var(--tq-line); }
.fq-stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.fq-stat span { font-size: 12px; color: var(--tq-ink-3); }

/* ---------- Toasts ---------- */
.tq-toasts { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.tq-toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 16px; border-radius: 10px; background: var(--tq-ink); color: #fff; font-family: var(--tq-sans); font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); animation: tq-toast-in 180ms ease-out; }
.tq-toast--error { background: var(--tq-alert); padding-right: 16px; }
.tq-toast-undo { border: 0; background: rgba(255, 255, 255, 0.14); color: #fff; font: inherit; font-weight: 600; height: 28px; padding: 0 12px; border-radius: 7px; cursor: pointer; }
.tq-toast-undo:hover { background: rgba(255, 255, 255, 0.24); }
@keyframes tq-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Phone ---------- */
@media (max-width: 640px) {
  .tq-hero { padding: 1.1rem 1rem 1rem; border-radius: 14px 14px 0 0; }
  .tq-title { font-size: 1.65rem; }
  .tq-start { width: 100%; height: 52px; }
  .tq-list { padding: 0.2rem; }
  .tq-item { grid-template-columns: 34px minmax(0, 1fr); gap: 4px 12px; padding: 0.85rem 0.75rem; align-items: start; }
  .tq-rank { display: none; }
  .tq-icon { width: 34px; height: 34px; grid-row: 1 / span 2; }
  .tq-item-action { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .tq-side { grid-column: 2; justify-content: space-between; }
  .tq-side .tq-btn--sm { height: 38px; padding: 0 14px; }
  .fq-top { padding: 0 1rem; }
  .fq-progress { margin: 0 -1rem; }
  .fq-left { display: none; }
  .fq-stage { padding: 0.75rem 0.75rem 1.25rem; }
  .fq-card { padding: 1.2rem 1.1rem 1.1rem; border-radius: 16px; }
  .fq-name { font-size: 1.8rem; }
  .fq-next { font-size: 15.5px; }
  .fq .fq-subject,
  .fq .fq-body { font-size: 16px; }
  .fq-row .tq-btn--lg,
  .fq-call .tq-btn--lg { flex: 1 1 auto; height: 50px; }
  .fq-kicker .tq-score { margin-left: 0; }
  .fq kbd { display: none; }
  .fq-bar { gap: 8px; padding: 0.6rem 0.75rem calc(0.6rem + env(safe-area-inset-bottom)); }
  .fq-bar-main { flex: 1 1 auto; }
  .fq-bar-main > * { flex: 1 1 0; }
  .fq-bar-main .tq-btn,
  .fq-snooze .tq-btn { width: 100%; height: 50px; }
  .fq-bar-label { display: none; }
  .fq-back { margin-right: 0; width: 50px; height: 50px; padding: 0; }
  .tq-toasts { bottom: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  .fq[open],
  .tq-toast,
  .tq-skel,
  .tq-working::before { animation: none; }
  .fq-card,
  .tq-item,
  .fq-progress i { transition: none; }
}
.fq-body-wrap { height: 100%; }
.tq [hidden],
.fq [hidden],
.tq-toasts [hidden] { display: none !important; }
.tq-list:empty { display: none; }
.tq-hero:has(+ .tq-list:empty) { border-bottom: 1px solid var(--tq-line); border-radius: 14px; }
.fq-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
.fq-bar--confirm { background: var(--tq-warm-wash); border-top-color: #f1dfbd; }
.fq-confirm-text { font-size: 14px; font-weight: 500; color: var(--tq-warm); }
@media (max-width: 640px) {
  .fq-bar--confirm { flex-wrap: wrap; }
  .fq-confirm-text { flex-basis: 100%; text-align: center; }
}

/* ---------- Morning summary switch ---------- */
.tq-brief { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; margin-top: 12px; font-size: 12.5px; color: var(--tq-ink-2); }
.tq-brief strong { color: var(--tq-ink); font-weight: 600; }
.tq-switch { position: relative; width: 34px; height: 20px; flex: 0 0 auto; padding: 0; border: 0; border-radius: 999px; background: var(--tq-line-strong); cursor: pointer; transition: background 140ms ease; }
.tq-switch[aria-checked='true'] { background: var(--tq-ok); }
.tq-switch-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 140ms ease; }
.tq-switch[aria-checked='true'] .tq-switch-knob { transform: translateX(14px); }
.tq-switch:focus-visible { outline: 2px solid var(--tq-hot); outline-offset: 2px; }
.tq-linkbtn { padding: 0; border: 0; background: none; font: inherit; color: var(--tq-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.tq-linkbtn:disabled { color: var(--tq-ink-3); cursor: progress; }
@media (prefers-reduced-motion: reduce) { .tq-switch, .tq-switch-knob { transition: none; } }

/* ---------- Backlog: work too old to count as today ---------- */
.tq-backlog { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; padding: 10px 10px 10px 12px; border: 1px solid var(--tq-line); border-radius: 12px; background: var(--tq-wash); font-size: 13px; color: var(--tq-ink-2); max-width: 640px; }
.tq-backlog[hidden] { display: none !important; }
.tq-backlog-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #fff; border: 1px solid var(--tq-line); color: var(--tq-ink-2); flex: 0 0 auto; }
.tq-backlog-icon svg { width: 16px; height: 16px; }
.tq-backlog-text { flex: 1 1 260px; line-height: 1.45; }
.tq-backlog-text strong { color: var(--tq-ink); font-weight: 600; }

.bl { width: min(760px, calc(100vw - 32px)); max-width: none; height: min(860px, calc(100dvh - 48px)); max-height: none; margin: auto; padding: 0; border: 0; border-radius: 18px; background: #fff; color: var(--tq-ink); font-family: var(--tq-sans); box-shadow: 0 30px 80px rgba(26, 22, 20, 0.28); }
.bl::backdrop { background: rgba(26, 22, 20, 0.5); }
.bl[open] { animation: fq-in 180ms ease-out; }
.bl-shell { display: flex; flex-direction: column; height: 100%; }
.bl-head { display: flex; align-items: flex-start; gap: 16px; padding: 22px 24px 16px; border-bottom: 1px solid var(--tq-line); }
.bl-head-text { flex: 1 1 auto; }
.bl-title { margin: 0; font-family: var(--tq-serif); font-size: 1.85rem; font-weight: 600; line-height: 1.1; }
.bl-lede { margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: var(--tq-ink-2); max-width: 560px; }
.bl-head .fq-close { margin-left: 0; flex: 0 0 auto; }
.bl-body { flex: 1 1 auto; overflow-y: auto; padding: 6px 24px 24px; overscroll-behavior: contain; }
.bl-section { margin-top: 18px; }
.bl-h { margin: 0; font-family: var(--tq-sans); display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tq-ink-3); }
.bl-count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--tq-hover); color: var(--tq-ink-2); font-size: 11.5px; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.bl-note { margin: 4px 0 10px; font-size: 12.5px; color: var(--tq-ink-3); }
.bl-groups, .bl-tasks, .bl-buyers { list-style: none; margin: 0; padding: 0; }
.bl-group { border: 1px solid var(--tq-line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.bl-group-head { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; }
.bl-group-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bl-name { font-size: 15px; font-weight: 600; }
.bl-meta { font-size: 12.5px; color: var(--tq-ink-3); font-variant-numeric: tabular-nums; }
.bl-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.bl-tasks { border-top: 1px solid var(--tq-line); background: var(--tq-wash); }
.bl-task, .bl-buyer { display: flex; align-items: center; gap: 12px; padding: 9px 12px 9px 14px; }
.bl-task + .bl-task { border-top: 1px solid var(--tq-line); }
.bl-buyer { border: 1px solid var(--tq-line); border-radius: 12px; margin-bottom: 8px; }
.bl-task-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bl-task-title { font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; }
.bl-foot { display: flex; align-items: center; gap: 10px; padding: 12px 24px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--tq-line); background: #fff; border-radius: 0 0 18px 18px; }
.bl-progress { margin-right: auto; font-size: 13px; color: var(--tq-ink-2); font-variant-numeric: tabular-nums; }
.bl-confirm { display: flex; gap: 8px; }
.bl-body--empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }
.bl-empty-mark { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--tq-ok-wash); color: var(--tq-ok); }
.bl-empty-mark svg { width: 26px; height: 26px; }
.bl-empty-text { margin: 0; font-size: 15px; color: var(--tq-ink-2); max-width: 380px; }

@media (max-width: 640px) {
  .bl { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .bl-head { padding: 16px 16px 12px; }
  .bl-title { font-size: 1.55rem; }
  .bl-body { padding: 4px 16px 20px; }
  .bl-group-head { flex-wrap: wrap; }
  .bl-group-head .bl-actions { width: 100%; justify-content: flex-end; }
  .bl-task, .bl-buyer { flex-wrap: wrap; }
  .bl-task .bl-actions, .bl-buyer .bl-actions { width: 100%; justify-content: flex-end; }
  .bl .tq-btn--sm { height: 38px; padding: 0 14px; }
  .bl-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-radius: 0; }
  .tq-backlog .tq-btn { width: 100%; height: 40px; }
}
@media (prefers-reduced-motion: reduce) { .bl[open] { animation: none; } }
.bl:has(.bl-body--empty) { height: fit-content; }
.bl-body--empty { padding: 40px 24px 44px; }
@media (max-width: 640px) { .bl:has(.bl-body--empty) { height: 100dvh; } }

/* ---------- Record a note ---------- */
.fq-linkbtn { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none; color: var(--tq-ink-2); font: inherit; cursor: pointer; }
.fq-linkbtn svg { width: 14px; height: 14px; }
.fq-linkbtn:hover { color: var(--tq-ink); text-decoration: underline; text-underline-offset: 3px; }
.fq-linkbtn:focus-visible { outline: 2px solid var(--tq-hot); outline-offset: 2px; border-radius: 4px; }
.fq-links .fq-linkbtn { font-size: 12.5px; }

.rn { width: min(600px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 48px); margin: auto; padding: 0; border: 0; border-radius: 18px; background: #fff; color: var(--tq-ink); font-family: var(--tq-sans); box-shadow: 0 30px 80px rgba(26, 22, 20, 0.3); }
.rn::backdrop { background: rgba(26, 22, 20, 0.55); }
.rn[open] { animation: fq-in 180ms ease-out; }
.rn-shell { display: flex; flex-direction: column; max-height: calc(100dvh - 48px); }
.rn-head { display: flex; align-items: flex-start; gap: 16px; padding: 20px 22px 14px; border-bottom: 1px solid var(--tq-line); }
.rn-head-text { flex: 1 1 auto; min-width: 0; }
.rn-kicker { margin: 0; font-size: 11.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tq-ink-3); }
.rn-title { margin: 2px 0 0; font-family: var(--tq-serif); font-size: 1.7rem; font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.rn-head .fq-close { margin-left: 0; flex: 0 0 auto; }
.rn-body { flex: 1 1 auto; overflow-y: auto; padding: 18px 22px 20px; display: flex; flex-direction: column; gap: 12px; }
.rn-body--rec { align-items: stretch; }
.rn-rec { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 22px 0 6px; }
.rn-meter { display: flex; align-items: center; gap: 6px; height: 64px; }
.rn-meter i { display: block; width: 8px; height: 64px; border-radius: 4px; background: var(--tq-line-strong); transform: scaleY(0.15); transform-origin: center; transition: transform 60ms linear; }
.rn-rec.is-live .rn-meter i { background: var(--tq-hot); }
.rn-status { margin: 0; display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; color: var(--tq-ink); font-variant-numeric: tabular-nums; }
.rn-dot { width: 10px; height: 10px; border-radius: 50%; background: #d92d20; animation: rn-pulse 1.2s ease-in-out infinite; }
@keyframes rn-pulse { 50% { opacity: 0.35; } }
.rn-prompt { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--tq-ink-2); text-align: center; max-width: 460px; align-self: center; }
.rn-body--working { align-items: center; justify-content: center; min-height: 220px; }
.rn-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--tq-line); border-top-color: var(--tq-ink); animation: rn-spin 0.8s linear infinite; }
@keyframes rn-spin { to { transform: rotate(360deg); } }
.rn-label { font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tq-ink-3); }
.rn-summary, .rn-type { width: 100%; box-sizing: border-box; padding: 12px 14px; border: 1px solid var(--tq-line-strong); border-radius: 10px; font: 14.5px/1.55 var(--tq-sans); color: var(--tq-ink); resize: vertical; }
.rn-summary:focus, .rn-type:focus, .rn-step-text:focus, .rn-client select:focus, .rn-due select:focus { outline: 2px solid var(--tq-ink); outline-offset: 1px; border-color: transparent; }
.rn-steps-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.rn-due { font-size: 13px; color: var(--tq-ink-2); display: inline-flex; align-items: center; gap: 6px; }
.rn-due select, .rn-client select { height: 34px; padding: 0 10px; border: 1px solid var(--tq-line-strong); border-radius: 8px; background: #fff; font: 13.5px var(--tq-sans); color: var(--tq-ink); }
.rn-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rn-step { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 10px; border: 1px solid var(--tq-line); border-radius: 10px; }
.rn-step input[type='checkbox'], .rn-done input { width: 18px; height: 18px; accent-color: var(--tq-ok); flex: 0 0 auto; }
.rn-step-text { flex: 1 1 auto; min-width: 0; height: 36px; padding: 0 8px; border: 1px solid transparent; border-radius: 7px; font: 14px var(--tq-sans); color: var(--tq-ink); background: transparent; }
.rn-step-text:hover { background: var(--tq-wash); }
.rn-add { align-self: flex-start; font-size: 13px; }
.rn-client { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--tq-ink-2); }
.rn-client select { flex: 1 1 auto; min-width: 0; }
.rn-transcript { font-size: 13px; color: var(--tq-ink-2); }
.rn-transcript summary { cursor: pointer; color: var(--tq-ink-2); }
.rn-transcript p { margin: 8px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--tq-wash); line-height: 1.55; white-space: pre-wrap; }
.rn-done { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--tq-ok-wash); font-size: 13.5px; color: var(--tq-ink); }
.rn-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--tq-alert-wash); color: var(--tq-alert); font-size: 13.5px; line-height: 1.45; }
.rn-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 22px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--tq-line); }
.rn-foot--confirm { justify-content: flex-end; }
.rn-confirm-text { margin-right: auto; font-size: 14px; font-weight: 500; }
@media (max-width: 640px) {
  .rn { width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .rn-shell { max-height: 100dvh; height: 100%; }
  .rn-head { padding: 16px 16px 12px; }
  .rn-body { padding: 14px 16px 16px; }
  .rn-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .rn-foot .tq-btn--lg { flex: 1 1 auto; height: 52px; }
  .rn-summary, .rn-type, .rn-step-text { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .rn[open], .rn-dot, .rn-spinner { animation: none; } .rn-meter i { transition: none; } }

.rn .rn-step-text { border: 1px solid transparent; box-shadow: none; background: transparent; margin: 0; }
.rn .rn-step-text:hover { background: var(--tq-wash); }
.rn .rn-step-text:focus { background: #fff; outline: 2px solid var(--tq-ink); outline-offset: 0; }
.rn-foot-group { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* Hero actions: focus mode plus a note for any client */
.tq-hero-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tq-note-btn { height: 48px; padding: 0 18px; border-radius: 12px; font-size: 14.5px; }
.tq-note-btn svg { width: 17px; height: 17px; }
@media (max-width: 640px) { .tq-hero-actions { width: 100%; } .tq-note-btn { width: 100%; height: 48px; } }

/* Cadence on the Home Screen: one-time tip */
.tq-install { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 12px 12px 12px 14px; border: 1px solid var(--tq-line); border-radius: 14px; background: #fff; box-shadow: 0 4px 16px rgba(26, 22, 20, 0.06); font-size: 13px; color: var(--tq-ink-2); }
.tq-install[hidden] { display: none !important; }
.tq-install-icon { width: 44px; height: 44px; border-radius: 11px; flex: 0 0 auto; }
.tq-install-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.45; }
.tq-install-text strong { color: var(--tq-ink); font-size: 14px; font-weight: 600; }
.tq-install-text b { color: var(--tq-ink); font-weight: 600; }
.tq-install-share { width: 15px; height: 15px; vertical-align: -2px; color: #0a84ff; }
.tq-install-actions { display: flex; gap: 6px; flex: 0 0 auto; }
@media (max-width: 640px) {
  .tq-install { flex-wrap: wrap; }
  .tq-install-text { flex-basis: calc(100% - 56px); }
  .tq-install-actions { width: 100%; justify-content: flex-end; }
}

/* Sellers and deal partners: a role chip instead of a buyer score */
.tq-score.tq-role--seller { background: #eef2f6; color: #3f5a73; }
.tq-score.tq-role--partner { background: var(--tq-wash); color: var(--tq-ink-2); border: 1px solid var(--tq-line); }
.tq-score.tq-role.is-urgent { background: var(--tq-alert-wash); color: var(--tq-alert); border-color: transparent; }

/* Gmail access expired: everything from email is going stale */
.tq-reconnect { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; padding: 10px 10px 10px 14px; border-radius: 12px; background: var(--tq-alert-wash); border: 1px solid #f4c7c1; color: #7a1d14; font-size: 13.5px; line-height: 1.45; max-width: 640px; }
.tq-reconnect[hidden] { display: none !important; }
.tq-reconnect-text { flex: 1 1 260px; }
.tq-reconnect strong { font-weight: 700; }
