/*
 * The Laterbase — "bench notebook" theme.
 * Warm concrete paper with a faint dot grid, near-black ink, and one loud
 * signal-orange accent; violet marks what Claude did. Bricolage Grotesque for
 * names and headings, Inter for reading, JetBrains Mono for the small
 * technical bits (counts, dates, labels). Phones get one column and bottom
 * sheets; wide screens get a sidebar and a task panel beside the board.
 */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-grotesque.woff2') format('woff2');
  font-weight: 600 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 500 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light dark;
  --bg: light-dark(#efebe3, #12110f);
  --dot: light-dark(rgb(25 23 20 / 0.09), rgb(243 239 231 / 0.06));
  --surface: light-dark(#fbf9f5, #1c1a17);
  --surface-2: light-dark(#f1ece3, #26231f);
  --field: light-dark(#ffffff, #161412);
  --ink: light-dark(#191714, #f3efe7);
  --ink-2: light-dark(#4d4942, #cfc8bc);
  --muted: light-dark(#6a655c, #a39c90);
  --line: light-dark(#e4ded3, #322e28);
  --line-strong: light-dark(#d6cfc2, #3d3831);
  --card-border: light-dark(rgb(25 23 20 / 0.05), #2a2723);
  --accent: light-dark(#ff5a1f, #ff6b2c);
  --on-accent: light-dark(#191714, #16120e);
  --accent-soft: light-dark(#ffe2d4, #3b2014);
  /* Orange for small text: the bright accent is too light to read on paper. */
  --accent-ink: light-dark(#b83c0e, #ff8a57);
  --selected: light-dark(#fff1e8, #2a1c14);
  --violet: light-dark(#6b4cf5, #a996ff);
  --on-violet: light-dark(#ffffff, #16120e);
  --violet-soft: light-dark(#e9e4ff, #2a2347);
  --danger: light-dark(#c0291d, #ff6b5f);
  --danger-fill: light-dark(#d92d20, #ff6b5f);
  --on-danger: light-dark(#ffffff, #1c0b09);
  --today-bg: light-dark(#fff1c2, #3d2e05);
  --today-ink: light-dark(#7a4a00, #fdb022);
  --ok: light-dark(#12805c, #4ade80);
  --ok-soft: light-dark(#dff3ea, #12301f);
  --ok-ink: light-dark(#0e6b4c, #6ee7a0);
  --bar: light-dark(#191714, #f3efe7);
  --on-bar: light-dark(#f6f2ea, #16140f);
  --on-bar-muted: light-dark(rgb(246 242 234 / 0.6), rgb(22 20 15 / 0.55));
  --shadow: 0 1px 0 rgb(25 23 20 / 0.04), 0 12px 28px -18px rgb(25 23 20 / 0.35);
  --shadow-lift: 0 16px 34px -18px rgb(0 0 0 / 0.6);

  --display: 'Bricolage Grotesque', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;

  --tap: 44px;
  --radius: 20px;
  --panel: 400px;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.4;
}

/* Light or dark: the device's choice, unless Settings → Appearance picks one (data-theme on <html>).
   Colours use light-dark(); shadows aren't colours, so they switch here. */
:root[data-theme='light'] {
  color-scheme: light;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --shadow: 0 1px 0 rgb(0 0 0 / 0.3), 0 14px 32px -18px rgb(0 0 0 / 0.85);
  --shadow-lift: 0 16px 34px -18px rgb(0 0 0 / 0.9);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --shadow: 0 1px 0 rgb(0 0 0 / 0.3), 0 14px 32px -18px rgb(0 0 0 / 0.85);
    --shadow-lift: 0 16px 34px -18px rgb(0 0 0 / 0.9);
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px calc(110px + env(safe-area-inset-bottom));
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
}

p code,
li code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
}

a {
  color: var(--accent-ink);
}

/* ---- Icons ---- */

svg.i {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.i-more circle,
.i-claude path {
  fill: currentColor;
  stroke: none;
}

.i-plus path,
.i-close path,
.i-tick path {
  stroke-width: 2.2;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

input[type='text'],
input[type='password'],
input[type='url'],
input[type='date'],
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 9px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--field);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px var(--accent-soft);
  outline: none;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  min-height: var(--tap);
  padding: 8px 20px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition:
    transform 0.08s,
    background 0.15s,
    border-color 0.15s,
    opacity 0.15s;
}

button:active:not(:disabled) {
  transform: scale(0.97);
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

button.danger {
  color: var(--danger);
}

button.link {
  min-height: auto;
  padding: 4px 6px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--accent-ink);
  font-weight: 700;
}

button.link.quiet {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
}

button.icon {
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  min-width: var(--tap);
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
}

button.icon:hover {
  background: var(--surface-2);
}

a.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 8px 20px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

a.button.dark {
  padding-left: 16px;
  border-color: var(--bar);
  background: var(--bar);
  color: var(--on-bar);
}

/* ---- Small shared bits ---- */

.loading,
.hint,
.meta,
.empty {
  color: var(--muted);
}

.hint {
  font-size: 0.875rem;
  line-height: 1.45;
}

.meta {
  font-family: var(--mono);
  font-size: 0.72rem;
}

.error {
  color: var(--danger);
  font-weight: 600;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge.due.today {
  background: var(--today-bg);
  color: var(--today-ink);
}

.badge.due.overdue {
  background: var(--danger-fill);
  color: var(--on-danger);
}

/* A small mono label with a rule running off to the right. */
.group,
.history .day,
.subtask-editor h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.group::after,
.history .day::after,
.subtask-editor h3::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---- Wordmark ---- */

.wordmark {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.035em;
  line-height: 1;
}

.wordmark .the {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.wordmark .dot {
  color: var(--accent);
}

/* ---- Login & consent ---- */

.login,
.consent {
  max-width: 380px;
  margin: 14vh auto 0;
}

.login h1,
.consent h1 {
  margin: 18px 0 10px;
  font-size: 2.3rem;
  letter-spacing: -0.035em;
}

.login .tagline {
  margin: 0 0 28px;
  color: var(--muted);
}

.login form,
.consent form {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.login label,
.consent label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.consent-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.consent-actions button {
  flex: 1;
}

/* ---- Top bar (phones and tablets) ---- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(14px + env(safe-area-inset-top)) 0 12px;
  background: linear-gradient(var(--bg) 78%, transparent);
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tab {
  white-space: nowrap;
  min-height: 40px;
  padding: 0 13px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.85rem;
}

.tab.on {
  padding: 0 15px;
  background: var(--bar);
  color: var(--on-bar);
}

.tab {
  display: inline-flex;
  align-items: center;
}

.tab .i {
  display: none;
}

@media (max-width: 520px) {
  .tab.minor .tab-label {
    display: none;
  }

  .tab.minor .i {
    display: block;
  }

  .tab.minor,
  .tab.minor.on {
    padding: 0 11px;
  }
}

@media (max-width: 400px) {
  #app {
    padding-left: 12px;
    padding-right: 12px;
  }

  .topbar .wordmark {
    font-size: 1.35rem;
  }

  .tab,
  .tab.on {
    padding: 0 10px;
    font-size: 0.8rem;
  }
}

/* ---- Sidebar (wide screens) ---- */

.sidebar {
  display: none;
}

.side-nav {
  display: grid;
  gap: 2px;
}

button.new-task-side {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.side-nav button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 14px;
  border: none;
  border-radius: 14px;
  background: none;
  color: var(--ink-2);
  text-align: left;
}

.side-nav button:hover {
  background: var(--surface-2);
}

.side-nav button.on {
  background: var(--bar);
  color: var(--on-bar);
}

.side-lists h2 {
  margin: 0 0 6px 14px;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.side-lists ul {
  display: grid;
  gap: 2px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.side-lists ul.deferred {
  opacity: 0.75;
}

.list-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px 0 14px;
  border: none;
  border-radius: 12px;
  background: none;
  font-weight: 500;
  text-align: left;
}

.list-link:hover {
  background: var(--surface-2);
}

.list-mark {
  flex: none;
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
}

.deferred .list-mark {
  border-style: dashed;
  border-color: var(--muted);
}

.list-link.inbox {
  font-weight: 600;
}

.list-link.inbox .list-mark {
  border: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.list-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-count {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.list-link.inbox .list-count:not(:empty) {
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bar);
  color: var(--on-bar);
  text-align: center;
}

/* History, Settings and the footer, pushed to the bottom of the sidebar. */
.side-bottom {
  display: grid;
  gap: 16px;
  margin-top: auto;
}

.side-foot {
  display: grid;
  justify-items: start;
  gap: 6px;
  padding: 16px 0 0 6px;
  border-top: 1px solid var(--line);
}

.side-toggle {
  padding-left: 6px;
}

.side-toggle .toggle {
  margin: 0;
}

/* ---- Quick add: a command bar ---- */

.quick-add {
  position: sticky;
  top: calc(72px + env(safe-area-inset-top));
  z-index: 4;
  margin: 4px 0 24px;
}

.quick-add.open {
  position: relative;
  top: auto;
}

.quick-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-row {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 58px;
  padding: 0 7px 0 20px;
  border-radius: 999px;
  background: var(--bar);
  color: var(--on-bar);
  box-shadow: var(--shadow-lift);
}

.quick-row input[type='text'] {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--on-bar);
  font-size: 1.02rem;
  font-weight: 500;
}

.quick-row input::placeholder {
  color: var(--on-bar-muted);
  opacity: 1;
}

.quick-row button.add {
  flex: none;
  display: grid;
  place-items: center;
  width: var(--tap);
  padding: 0;
}

.quick-ai {
  flex: none;
  display: grid;
  margin-left: -4px;
  color: color-mix(in srgb, var(--violet) 55%, var(--on-bar));
}

.quick-row.reading {
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--violet) 45%, transparent),
    var(--shadow-lift);
}

.quick-row.reading button.add {
  animation: pulse 1.2s ease-in-out infinite;
}

/* The full-form "Add task" button beside the bar. */
button.new-task {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 58px;
  padding: 0 20px 0 16px;
  border: 1px solid var(--card-border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

@media (max-width: 560px) {
  button.new-task {
    width: 58px;
    padding: 0;
    justify-content: center;
  }

  button.new-task span {
    display: none;
  }
}

.quick-error {
  margin: 10px 20px 0;
  font-size: 0.88rem;
}

.reading-hint {
  color: var(--violet);
}

/* Claude's suggestion, to check and change before anything is added. */
.suggestion {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px 14px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow:
    0 0 0 1.5px var(--violet-soft),
    var(--shadow);
  animation: rise-in 0.2s ease-out;
}

/* Claude's answer to a question: text to read, nothing to confirm. */
.answer-question {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.answer-text {
  display: grid;
  gap: 8px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.answer-text p,
.answer-text ul {
  margin: 0;
}

.answer-text ul {
  display: grid;
  gap: 3px;
  padding-left: 1.2em;
}

.answer-text strong {
  font-weight: 650;
}

.answer .row {
  justify-content: flex-end;
}

.suggestion.rules {
  box-shadow:
    0 0 0 1.5px var(--line),
    var(--shadow);
}

.suggestion-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.suggestion-head .hint {
  flex: 1;
}

.suggestion-head button.icon {
  margin: -6px -8px -6px 0;
}

.suggestion-tasks {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.suggestion-tasks > li {
  display: grid;
  gap: 8px;
}

.suggestion-tasks > li + li {
  padding-top: 10px;
  border-top: 1.5px dashed var(--line);
}

.suggestion-title {
  display: flex;
  align-items: center;
  gap: 4px;
}

.suggestion-title input[type='text'] {
  flex: 1;
  min-width: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.suggestion-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.suggestion-fields label,
.suggestion-notes {
  display: grid;
  gap: 4px;
}

.suggestion-fields span,
.suggestion-notes span {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.suggestion-fields select,
.suggestion-fields input {
  min-height: 42px;
  padding: 6px 10px;
  font-size: 0.92rem;
}

.suggestion-notes textarea {
  font-size: 0.92rem;
  resize: vertical;
}

.suggestion-subtasks {
  display: grid;
  gap: 4px;
  margin: 0 0 0 10px;
  padding: 0 0 0 10px;
  list-style: none;
  border-left: 2px dotted var(--line-strong);
}

.suggestion-subtasks li {
  display: flex;
  align-items: center;
  gap: 4px;
}

.suggestion-subtasks input[type='text'] {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  font-size: 0.9rem;
}

.quick-row button.add:disabled {
  opacity: 1;
  background: transparent;
  border-color: color-mix(in srgb, var(--on-bar) 25%, transparent);
  color: var(--on-bar-muted);
}

.quick-hint {
  margin: 10px 20px 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
}

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

.chip {
  min-height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

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

/* ---- Sections ---- */

.section {
  margin: 0 0 26px;
  scroll-margin-top: 150px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.collapse {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 6px;
  border: none;
  border-radius: 12px;
  background: none;
  text-align: left;
}

.collapse h2 {
  font-size: 1.45rem;
  overflow-wrap: anywhere;
}

.caret {
  display: grid;
  color: var(--muted);
  transition: transform 0.15s;
}

.collapse[aria-expanded='false'] .caret {
  transform: rotate(-90deg);
}

.count {
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bar);
  color: var(--on-bar);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
}

.count:empty {
  display: none;
}

.section-note {
  padding: 0 12px;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

/* The Inbox is one orange-ringed card, heading and all. */
.section.inbox {
  overflow: hidden;
  margin-bottom: 30px;
  border: 1.5px solid var(--accent);
  border-radius: 22px;
  background: var(--surface);
  box-shadow:
    0 0 0 5px var(--accent-soft),
    var(--shadow);
}

.section.inbox .section-head {
  margin: 0;
  padding: 6px 4px 4px 6px;
}

.section.inbox .collapse h2 {
  font-size: 1.3rem;
}

.section.inbox .collapse h2::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.14em;
}

.section.inbox ul.tasks {
  border: none;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.section.deferred,
.section.archived {
  opacity: 0.72;
}

.section.deferred .collapse h2,
.section.archived .collapse h2 {
  font-size: 1.15rem;
}

.group {
  margin: 40px 6px 10px;
}

/* ---- Drag to reorder ---- */

button.grip {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  min-width: 22px;
  min-height: var(--tap);
  margin-right: -6px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  opacity: 0.45;
  cursor: grab;
  touch-action: none;
}

.i-grip circle {
  fill: currentColor;
  stroke: none;
}

button.grip:active:not(:disabled) {
  transform: none;
}

.section-head > button.grip {
  margin-right: -4px;
}

.task.sub button.grip {
  min-height: 40px;
}

/* With a mouse, grips show when the row or card is pointed at. */
@media (hover: hover) and (pointer: fine) {
  button.grip {
    opacity: 0;
  }

  .task-row:hover > button.grip,
  .section-head:hover > button.grip,
  button.grip:focus-visible {
    opacity: 0.8;
  }
}

button.grip:hover {
  color: var(--ink);
}

.is-dragging,
.is-dragging * {
  cursor: grabbing !important;
  user-select: none;
  -webkit-user-select: none;
}

.dragging {
  opacity: 0.35;
}

.drag-ghost {
  position: fixed;
  z-index: 50;
  max-height: 260px;
  overflow: hidden;
  margin: 0;
  list-style: none;
  border-radius: 16px;
  background: var(--surface);
  pointer-events: none;
  opacity: 0;
}

.drag-ghost.lifted {
  opacity: 0.95;
  box-shadow:
    0 0 0 1.5px var(--accent),
    0 14px 34px rgb(0 0 0 / 0.18);
}

.drag-ghost > .task-row > button.grip,
.drag-ghost > .section-head > button.grip {
  opacity: 0.8;
}

.drop-marker {
  position: fixed;
  z-index: 49;
  height: 3px;
  border-radius: 3px;
  background: var(--accent);
  pointer-events: none;
}

.drop-marker.across {
  width: 3px;
}

/* ---- Tasks ---- */

ul.tasks,
ul.subtasks {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.tasks {
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

ul.tasks:empty {
  display: none;
}

ul.tasks > li.task + li.task {
  border-top: 1px solid var(--line);
}

ul.subtasks {
  margin: -6px 0 10px 25px;
  padding-left: 8px;
  border-left: 2px dotted var(--line-strong);
}

.empty {
  padding: 14px 18px;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.task-row {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 12px 3px 3px;
}

.task.selected > .task-row {
  background: var(--selected);
}

.check {
  flex: none;
  position: relative;
  width: var(--tap);
  height: var(--tap);
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
}

.check::before {
  content: '';
  position: absolute;
  inset: 12px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.task.sub .check::before {
  inset: 14px;
  border-radius: 5px;
  border-color: var(--muted);
}

.task.deferred > .task-row .check::before {
  border-color: var(--muted);
}

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

.check.done::before {
  background: var(--accent);
  border-color: var(--accent);
}

.check.done::after {
  content: '';
  position: absolute;
  left: 18px;
  top: 14px;
  width: 6px;
  height: 11px;
  border: solid var(--on-accent);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.task.sub .check.done::after {
  left: 19px;
  top: 16px;
  width: 5px;
  height: 9px;
}

.task-row .title {
  flex: 1;
  display: block;
  min-width: 0;
  min-height: var(--tap);
  padding: 10px 4px;
  border: none;
  border-radius: 10px;
  background: none;
  font-size: 0.97rem;
  font-weight: 500;
  text-align: left;
}

.task.sub .title {
  min-height: 40px;
  padding: 8px 4px;
  font-weight: 400;
  font-size: 0.92rem;
}

.title-text {
  display: block;
  overflow-wrap: anywhere;
}

.task.selected > .task-row .title-text {
  font-weight: 600;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.task.selected .badge:not(.due) {
  background: var(--surface);
}

.task.done > .task-row .title-text {
  text-decoration: line-through;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  color: var(--muted);
}

.task.deferred > .task-row .title-text {
  color: var(--muted);
}

.file-to {
  flex: none;
  width: auto;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
}

.add-project {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: -6px 0 0;
  padding: 0 16px 0 12px;
  border: 1.5px dashed var(--line-strong);
  background: none;
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}

.inline-form input[type='text'] {
  flex: 1 1 180px;
  min-width: 0;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  margin: 30px 6px 0;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  cursor: pointer;
}

.toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

/* ---- Sheets (dialogs) ---- */

dialog.sheet {
  width: min(560px, 100vw);
  max-width: 100vw;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: auto auto 0;
  padding: 0;
  border: none;
  border-radius: 28px 28px 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 -12px 40px rgb(0 0 0 / 0.25);
}

@media (min-width: 600px) {
  dialog.sheet {
    margin: auto;
    border-radius: 28px;
  }
}

dialog.sheet::backdrop {
  background: rgb(18 17 15 / 0.48);
  backdrop-filter: blur(3px);
}

.sheet-body {
  display: grid;
  gap: 16px;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
}

.sheet-body::before {
  content: '';
  display: block;
  justify-self: center;
  width: 40px;
  height: 4px;
  margin-bottom: -8px;
  border-radius: 2px;
  background: var(--line-strong);
}

.sheet-body > * {
  min-width: 0;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.sheet-head h2 .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.sheet-head button.icon {
  margin-right: -10px;
}

.task-form {
  display: grid;
  gap: 14px;
}

.task-form label {
  display: grid;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.task-form label > * {
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.task-form textarea {
  line-height: 1.45;
  resize: vertical;
}

.task-form .title-input {
  min-height: 52px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

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

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Done / Defer / Drop as one segmented control. */
.status-actions {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: var(--surface-2);
}

.status-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: none;
  background: none;
}

.status-actions button:hover {
  background: var(--surface);
}

.status-actions button.done {
  background: var(--bar);
  color: var(--on-bar);
}

.status-actions .badge {
  justify-self: center;
}

.subtask-editor {
  display: grid;
  gap: 8px;
}

.subtask-editor h3 span {
  letter-spacing: 0.04em;
}

.subtask-editor ul.tasks {
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: none;
  box-shadow: none;
}

.subtask-editor .inline-form {
  margin: 0;
}

.subtask-editor .inline-form input {
  min-height: var(--tap);
  border-style: dashed;
  border-color: var(--line-strong);
  border-radius: 999px;
  background: none;
}

/* ---- History ---- */

.history > h2,
.settings > h2 {
  margin: 14px 4px 4px;
  font-size: 2.1rem;
  letter-spacing: -0.035em;
  line-height: 1;
}

.history > .hint,
.settings > .hint {
  margin: 4px 4px 0;
}

.history .day {
  margin: 28px 4px 12px;
}

ol.events {
  display: grid;
  gap: 10px;
  margin: 0 0 0 6px;
  padding: 0 0 0 22px;
  list-style: none;
  border-left: 2px dotted var(--line-strong);
}

ol.events > li {
  position: relative;
  padding: 12px 14px 14px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

ol.events > li::before {
  content: '';
  position: absolute;
  left: -30px;
  top: 19px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--ink);
}

ol.events > li.by-mcp,
ol.events > li.by-ai {
  box-shadow:
    0 0 0 1.5px var(--violet-soft),
    var(--shadow);
}

ol.events > li.by-mcp::before,
ol.events > li.by-ai::before {
  background: var(--violet);
  border-color: var(--violet);
}

ol.events > li.undone {
  opacity: 0.6;
  background: var(--surface-2);
  box-shadow: none;
}

ol.events > li.undone ul {
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}

ol.events ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--ink-2);
  font-size: 0.92rem;
  line-height: 1.55;
}

ol.events ul li:only-child {
  margin-left: -18px;
  list-style: none;
  color: var(--ink);
}

.event-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.event-head time {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.actor {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bar);
  color: var(--on-bar);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.actor.ai,
.actor.mcp {
  background: var(--violet);
  color: var(--on-violet);
}

.actor.import,
.actor.api,
.actor.system {
  background: var(--surface-2);
  color: var(--ink-2);
}

button.undo {
  min-height: 40px;
  margin: -6px -6px -6px 0;
  padding: 0 16px;
  background: none;
  font-size: 0.85rem;
}

.more {
  color: var(--muted);
}

/* ---- Settings ---- */

/* Section headings: a small mono label with a rule. */
.settings-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 26px 6px 10px;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.settings-group::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.settings > h2 + .settings-group {
  margin-top: 14px;
}

.card {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--card-border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  scroll-margin-top: 90px;
}

.card > * {
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-head h3 {
  font-size: 1.25rem;
}

.tile {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
}

.card.claude {
  border-color: transparent;
  box-shadow:
    0 0 0 1.5px var(--violet-soft),
    var(--shadow);
}

.card.claude .tile {
  background: var(--violet-soft);
  color: var(--violet);
}

.card > .hint {
  margin: 0;
}

.connections {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1.5px dashed var(--line);
}

.connections h4,
.label,
.stack > label:not(.toggle-row) {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.connections ul,
.token-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.connections li,
.token-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  padding: 4px 4px 4px 14px;
  border-radius: 14px;
  background: var(--surface-2);
}

.connections li strong,
.token-list li strong {
  font-weight: 600;
}

.connections li strong,
.token-list li strong {
  flex: 1;
}

.connections .when,
.token-list .when {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.connections li button,
.token-list li button {
  border: none;
  background: none;
}

.new-token {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 14px;
  border: 1.5px dashed var(--accent);
  border-radius: 16px;
}

.new-token p {
  margin: 0;
}

.new-token .copy-field {
  justify-self: stretch;
}

/* ---- Setup ---- */

.setup {
  max-width: 480px;
  margin: 0 auto;
  padding-top: calc(28px + env(safe-area-inset-top));
}

.progress {
  display: flex;
  gap: 6px;
  margin: 18px 0 14px;
  padding: 0;
  list-style: none;
}

.progress li {
  flex: 1;
  min-width: 0;
}

.progress li::before {
  content: '';
  display: block;
  height: 5px;
  margin-bottom: 6px;
  border-radius: 999px;
  background: var(--line);
  transition: background 0.3s;
}

.progress li.done::before {
  background: var(--ink);
}

.progress li.on::before {
  background: var(--accent);
}

.progress span {
  display: block;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.progress li.on span {
  color: var(--ink);
  font-weight: 700;
}

.setup-card {
  padding: 26px 22px 24px;
  border: 1px solid var(--card-border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: rise-in 0.25s ease-out;
}

@keyframes rise-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

.setup h1 {
  font-size: 1.9rem;
  letter-spacing: -0.03em;
}

.lead {
  margin: 0 0 4px;
  color: var(--muted);
  line-height: 1.5;
}

.stack {
  display: grid;
  gap: 12px;
}

.stack > * {
  min-width: 0;
}

.stack > p,
.success p {
  margin: 0;
}

.stack > label:not(.toggle-row) {
  margin: 6px 0 -4px;
}

.where {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
}

.where p {
  margin: 0 0 8px;
}

.where p:last-child {
  margin: 0;
}

/* A read-only value with a Copy button, as one pill. */
.copy-field {
  display: flex;
  gap: 6px;
  padding: 4px 4px 4px 14px;
  border-radius: 999px;
  background: var(--surface-2);
}

.copy-field input[type='text'] {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.copy-field button {
  flex: none;
  min-width: 92px;
  min-height: 40px;
  padding: 0 16px;
  border-color: var(--bar);
  background: var(--bar);
  color: var(--on-bar);
  font-size: 0.85rem;
}

.copy-field button.copied {
  border-color: var(--ok);
  background: var(--ok);
  color: var(--surface);
}

input.code-input {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
}

input.code-input::placeholder {
  color: var(--line-strong);
}

button.wide {
  width: 100%;
  margin-top: 4px;
}

.password-row {
  position: relative;
}

.password-row input {
  padding-right: 70px;
}

.password-row button.link {
  position: absolute;
  top: 50%;
  right: 6px;
  min-height: var(--tap);
  padding: 0 12px;
  transform: translateY(-50%);
}

/* Password rules as pills that turn green when met. */
ul.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

ul.checks li {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  transition:
    background 0.2s,
    color 0.2s;
}

ul.checks li::before {
  content: '○\00a0';
}

ul.checks li.ok {
  background: var(--ok-soft);
  color: var(--ok-ink);
}

ul.checks li.ok::before {
  content: '✓\00a0';
}

.callout {
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--accent-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.address {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

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

textarea.list-input {
  min-height: 190px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  resize: vertical;
}

details summary {
  cursor: pointer;
  color: var(--accent-ink);
  font-size: 0.9rem;
  font-weight: 700;
}

details.how-it-reads {
  border-radius: 14px;
  background: var(--surface-2);
}

details.how-it-reads summary {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: 14px;
}

details ul {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 0.88rem;
  color: var(--ink-2);
  line-height: 1.55;
}

details.how-it-reads ul {
  margin: 0;
  padding: 0 14px 14px 32px;
}

details li {
  margin: 4px 0;
}

.preview {
  max-height: 320px;
  overflow: auto;
  padding: 2px 14px 12px;
  border-radius: 14px;
  background: var(--surface-2);
}

.preview h4 {
  margin: 12px 0 4px;
  font-family: var(--display);
  font-size: 1rem;
}

.preview ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.9rem;
}

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

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.success {
  display: grid;
  gap: 8px;
  justify-items: start;
  padding: 14px;
  border-radius: 14px;
  background: var(--ok-soft);
}

.success strong {
  color: var(--ok-ink);
}

.success .wide {
  justify-self: stretch;
}

.seg {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-2);
}

.seg button {
  min-height: 40px;
  padding: 0 14px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.88rem;
}

.seg button.on {
  background: var(--bar);
  color: var(--on-bar);
}

/* Numbered steps with orange numerals. */
ol.how {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  line-height: 1.45;
  counter-reset: step;
}

ol.how[start='2'] {
  counter-reset: step 1;
}

ol.how li {
  position: relative;
  padding-left: 36px;
  counter-increment: step;
}

ol.how li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -1px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
}

ol.how strong {
  font-weight: 600;
}

.status {
  display: flex;
  align-items: center;
  margin: 4px 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.status.ok {
  color: var(--ok);
  font-weight: 700;
}

.pulse {
  width: 9px;
  height: 9px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.25;
    transform: scale(0.7);
  }
}

button.skip {
  justify-self: center;
  color: var(--muted);
}

.hint.center {
  margin: 0;
  text-align: center;
}

.login .forgot {
  margin-top: 36px;
}

.login .forgot p {
  margin: 10px 0;
  font-size: 0.9rem;
}

.sign-out {
  display: block;
  margin: 32px auto 0;
  border: none;
  background: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.card.ai {
  border-color: transparent;
  box-shadow:
    0 0 0 1.5px var(--violet-soft),
    var(--shadow);
}

.card.ai .tile {
  background: var(--violet-soft);
  color: var(--violet);
}

.key-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
}

.key-hint {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
}

.key-status .status {
  margin: 0;
}

/* ---- Bring in a list: the editable preview ---- */

.ai-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0;
}

.ai-note svg {
  margin-top: 2px;
  color: var(--violet);
}

.review-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.review-head p {
  margin: 0;
}

.read-by {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.read-by.claude {
  background: var(--violet);
  color: var(--on-violet);
}

.draft {
  display: grid;
  gap: 12px;
}

.draft-group {
  display: grid;
  gap: 4px;
  padding: 8px 8px 6px;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  background: var(--field);
}

.draft-group.inbox {
  border-color: var(--accent);
}

.draft-group.deferred {
  border-style: dashed;
}

.draft-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  padding-left: 4px;
}

.draft-head h4 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 0 4px;
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 800;
}

.draft-head h4 .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.draft-name[type='text'] {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 4px 10px;
  border-color: transparent;
  background: none;
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 800;
}

.draft-name[type='text']:hover {
  border-color: var(--line);
}

.draft-deferred {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
}

.draft-deferred input,
.draft-done {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
}

.draft-tasks,
.draft-subtasks {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.draft-tasks > li + li {
  border-top: 1px solid var(--line);
}

.draft-subtasks {
  margin: 0 0 4px 22px;
  padding-left: 6px;
  border-left: 2px dotted var(--line-strong);
}

.draft-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 8px;
}

.draft-done {
  flex: none;
}

.draft-title[type='text'] {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 4px 8px;
  border-color: transparent;
  border-radius: 10px;
  background: none;
  font-size: 0.95rem;
}

.draft-title[type='text']:hover {
  border-color: var(--line);
}

.draft-subtasks .draft-title[type='text'] {
  font-size: 0.88rem;
}

.draft-row.done .draft-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--accent);
}

.draft-row.left-out {
  opacity: 0.55;
}

.draft-move {
  flex: none;
  width: auto;
  max-width: 84px;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
}

@media (max-width: 500px) {
  .draft-group {
    padding: 6px 4px 4px;
  }

  .draft-row {
    padding-left: 6px;
  }

  .draft-move {
    max-width: 64px;
    padding: 0 4px;
  }
}

.draft-row button.icon {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
}

.draft-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  min-height: 36px;
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 0.74rem;
}

.draft .add-project {
  justify-self: start;
  margin: 0;
}

/* ---- Tidy with Claude ---- */

button.ai-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-color: var(--violet-soft);
  background: var(--violet-soft);
  color: light-dark(var(--violet), var(--ink));
}

.ai-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--violet-soft);
}

.ai-banner .hint {
  flex: 1 1 160px;
  color: var(--ink-2);
}

.ai-banner .link {
  min-height: 36px;
}

.ai-actions {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 8px;
}

.status.thinking {
  min-height: 60px;
  color: var(--violet);
}

.plan-question {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--field);
}

.plan-question .question {
  font-weight: 600;
  line-height: 1.35;
}

.plan-question .chips {
  margin: 0;
}

.plan-question .chip {
  font-family: var(--body);
  font-size: 0.85rem;
  text-align: left;
}

.plan-question input[type='text'] {
  min-height: 42px;
  font-size: 0.92rem;
}

.subtask-drafts {
  display: grid;
  gap: 4px;
}

.subtask-drafts .drafts-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.subtask-drafts ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0 0 0 10px;
  list-style: none;
  border-left: 2px dotted var(--line-strong);
}

.subtask-drafts li {
  display: flex;
  align-items: center;
  gap: 4px;
}

.subtask-drafts input[type='text'] {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  font-size: 0.92rem;
}

.subtask-drafts .draft-add {
  justify-self: start;
}

.tidy-tasks {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tidy-tasks > li {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--field);
}

.tidy-tasks > li.is-new {
  border-style: dashed;
  border-color: var(--violet);
}

.tidy-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tidy-row input[type='text'] {
  flex: 1;
  min-width: 0;
  min-height: 40px;
}

textarea.step-box {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 9px 12px;
  overflow: hidden;
  resize: none;
  font-size: 0.92rem;
  line-height: 1.3;
}

textarea.tidy-title {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 8px 12px;
  overflow: hidden;
  resize: none;
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.25;
}

.tidy-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tidy-badges:empty {
  display: none;
}

.badge.new {
  background: var(--violet);
  color: var(--on-violet);
}

.badge.changed {
  background: var(--violet-soft);
  color: light-dark(var(--violet), var(--ink));
}

.badge.moved {
  background: var(--accent-soft);
  color: var(--accent-ink);
}


.was {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.tidy-notes {
  min-height: 0;
  font-size: 0.9rem;
  resize: vertical;
}

.tidy-subtasks {
  display: grid;
  gap: 6px;
  margin: 2px 0 0 8px;
  padding: 0 0 0 10px;
  list-style: none;
  border-left: 2px dotted var(--line-strong);
}

.tidy-subtasks > li {
  display: grid;
  gap: 4px;
}

.tidy-subtasks input[type='text'] {
  font-size: 0.92rem;
}

/* Tasks a tidy-up or plan would take off the list. */
.removals {
  display: grid;
  gap: 8px;
}

.removals h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.removals h3::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.removals ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.removals li {
  display: grid;
  gap: 4px;
  justify-items: start;
  padding: 10px 12px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 16px;
  background: var(--surface-2);
}

.removal-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.removal-title {
  font-weight: 600;
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--danger);
  overflow-wrap: anywhere;
}

.removals .hint {
  margin: 0;
}

.removals .link {
  min-height: 36px;
  padding: 0;
}

.badge.drop {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

.badge.done-badge {
  background: var(--ok-soft);
  color: var(--ok-ink);
}

/* "Change it": ask Claude to revise its suggestion. */
.change-it {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1.5px dashed var(--violet-soft);
  border-radius: 16px;
}

.change-it .label {
  margin: 0;
}

.change-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.change-row input {
  flex: 1 1 200px;
  min-width: 0;
}

.change-row button {
  flex: none;
}

.change-it .link {
  justify-self: start;
  min-height: 36px;
  padding: 0;
}

.change-it .error {
  margin: 0;
}

/* Sort the Inbox: tasks grouped by where they'd go. */
.section-head .sort-chip {
  min-height: 34px;
  margin-right: 4px;
  padding: 0 12px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.sort-groups {
  display: grid;
  gap: 18px;
}

.sort-group {
  display: grid;
  gap: 8px;
}

.sort-group > h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 800;
}

.sort-group.inbox > h3 {
  color: var(--accent-ink);
}

.sort-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sort-group input.new-project {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  border-style: dashed;
  border-color: var(--violet);
  font-family: var(--display);
  font-weight: 800;
}

.sort-group ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sort-group li {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--field);
}

.sort-group.new li {
  border-style: dashed;
  border-color: var(--violet);
}

.sort-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.sort-foot .hint {
  margin: 0;
}

select.sort-to {
  width: auto;
  max-width: 100%;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
}

/* ---- Clarity: just what needs you this week ---- */

.side-actions {
  display: grid;
  gap: 8px;
}

.view-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 4px 0 18px;
}

.view-head > div {
  flex: 1 1 240px;
}

.view-title {
  margin: 0 0 4px;
  font-size: 1.6rem;
}

.view-head .hint {
  margin: 0;
}

.inbox-nudge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 0 14px;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  background: none;
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
}

.inbox-nudge .list-mark {
  border: none;
  border-radius: 50%;
  background: var(--accent);
}

.empty-view {
  padding: 40px 0;
  color: var(--muted);
  text-align: center;
}

.clarity-grid {
  display: grid;
  gap: 16px;
  align-items: start;
}

@media (min-width: 1100px) {
  .clarity-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
  }
}

.clarity-card {
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.clarity-card.inbox {
  border: 1.5px solid var(--accent);
}

.clarity-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 4px 4px 6px;
}

.clarity-name {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 8px;
  border: none;
  border-radius: 12px;
  background: none;
  text-align: left;
}

.clarity-name h3 {
  margin: 0;
  font-size: 1.3rem;
  overflow-wrap: anywhere;
}

.clarity-card ul.tasks {
  border: none;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  box-shadow: none;
}

/* The rest of the list, fading out under frosted glass: there, but not in the way. */
.peek {
  position: relative;
  max-height: 104px;
  overflow: hidden;
}

.peek ul.tasks {
  pointer-events: none;
  user-select: none;
  mask-image: linear-gradient(to bottom, rgb(0 0 0 / 0.7), transparent 92%);
  -webkit-mask-image: linear-gradient(to bottom, rgb(0 0 0 / 0.7), transparent 92%);
}

.peek-glass {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--surface) 0%, transparent),
    color-mix(in srgb, var(--surface) 55%, transparent) 70%
  );
  backdrop-filter: blur(5px) saturate(1.2);
  -webkit-backdrop-filter: blur(5px) saturate(1.2);
  mask-image: linear-gradient(to bottom, transparent, #000 75%);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 75%);
  pointer-events: none;
}

.more-pill {
  position: absolute;
  left: 50%;
  bottom: 12px;
  min-height: 36px;
  padding: 0 16px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.more-pill:hover {
  color: var(--accent-ink);
}

/* Prioritise: Claude's picks for the week, in order. */
.priority-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.priority-list > li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 10px 6px 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--field);
}

.rank {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--violet-soft);
  color: var(--violet);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
}

.priority-body {
  display: grid;
  gap: 3px;
}

.priority-title {
  font-family: var(--display);
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.priority-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.priority-body .hint {
  margin: 0;
}

.priority-moves {
  display: flex;
  align-items: center;
}

.priority-moves .icon {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
}

.icon.flip svg {
  transform: rotate(180deg);
}

.proposal .toggle {
  margin: 0;
}

/* ---- Toast ---- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 7px 7px 7px 20px;
  border-radius: 999px;
  background: var(--bar);
  color: var(--on-bar);
  font-weight: 600;
  box-shadow: var(--shadow-lift);
  animation: rise 0.2s ease-out;
}

.toast .link {
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
}

.toast.error {
  background: var(--danger-fill);
  color: var(--on-danger);
}

@keyframes rise {
  from {
    transform: translate(-50%, 12px);
    opacity: 0;
  }
}

/* ---- Wide screens: sidebar, project grid, task panel ---- */

@media (min-width: 1100px) {
  #app {
    max-width: 1480px;
    padding: 0 24px 60px;
  }

  .shell {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
  }

  .shell.panel-open {
    padding-right: calc(var(--panel) + 8px);
  }

  .topbar {
    display: none;
  }

  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: 100dvh;
    overflow-y: auto;
    padding: 28px 0 24px;
  }

  .sidebar .wordmark {
    margin-left: 14px;
    font-size: 1.9rem;
  }

  .content {
    max-width: 1000px;
    padding-top: 24px;
  }

  .quick-add {
    top: 0;
    margin: -24px -8px 16px;
    padding: 24px 8px 8px;
    background: linear-gradient(var(--bg) 82%, transparent);
  }

  .board-toggle {
    display: none;
  }

  /* Project cards side by side, each heading inside its card. */
  .projects {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
    align-items: start;
    margin-bottom: 22px;
  }

  .projects .section {
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--card-border);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .projects .section-head {
    margin: 0;
    padding: 6px 4px 4px 6px;
  }

  .projects .collapse h2 {
    font-size: 1.35rem;
  }

  .projects .section ul.tasks {
    border: none;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: none;
    box-shadow: none;
  }

  .history,
  .settings {
    max-width: 720px;
  }

  /* The task sheet becomes a panel beside the board. */
  dialog.sheet.panel {
    position: fixed;
    inset: 20px 20px auto auto;
    z-index: 10;
    width: var(--panel);
    height: fit-content;
    /* Fits its content, up to the window; past that it scrolls. */
    max-height: calc(100dvh - 40px);
    margin: 0;
    overflow-y: auto;
    border: 1px solid var(--card-border);
    border-radius: 26px;
    box-shadow:
      0 1px 0 rgb(25 23 20 / 0.04),
      0 24px 48px -24px rgb(25 23 20 / 0.5);
    animation: slide-in 0.2s ease-out;
  }

  dialog.sheet.panel .sheet-body {
    padding: 16px 20px 22px;
  }

  dialog.sheet.panel .sheet-body::before {
    display: none;
  }

  .toast {
    left: calc(50% + 134px);
  }

  .shell.panel-open ~ .toast {
    left: calc(50% + 134px - (var(--panel) + 8px) / 2);
  }
}

@keyframes slide-in {
  from {
    transform: translateX(16px);
    opacity: 0;
  }
}

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

/* ---- Priorities: marked by hand, first in Clarity, unmoved in Tasks ---- */

.badge.priority {
  gap: 4px;
  background: var(--accent);
  color: #fff;
}

.badge.priority .i {
  fill: currentColor;
}

.task.priority > .task-row .title-text {
  font-weight: 600;
}

.task-row .title .list-from {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.priority-card {
  margin: 0 0 18px;
  overflow: hidden;
  border: 2px solid var(--accent);
  border-radius: 22px;
  background: linear-gradient(var(--accent-soft), var(--surface) 72px);
  box-shadow: var(--shadow);
}

.priority-card .clarity-head {
  padding: 12px 14px 8px;
}

.priority-card h3 {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--accent-ink);
  font-size: 1.3rem;
}

.priority-card h3 .i {
  fill: currentColor;
}

.priority-card ul.tasks {
  border: none;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
  box-shadow: none;
}

/* In the priorities card every row is one, so the badge would only repeat the heading. */
.priority-card .badge.priority {
  display: none;
}

.priority-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 10px;
  padding: 10px 16px;
  border: 1.5px dashed var(--accent);
  border-radius: 18px;
  background: none;
  color: var(--accent-ink);
  font-weight: 700;
  text-align: left;
}

.priority-toggle span {
  display: grid;
  gap: 2px;
}

.priority-toggle small {
  color: var(--muted);
  font-weight: 500;
}

.priority-toggle.on {
  border-style: solid;
  background: var(--accent);
  color: #fff;
}

.priority-toggle.on small {
  color: rgb(255 255 255 / 0.85);
}

.priority-toggle.on .i {
  fill: currentColor;
}

/* Prioritise the week: earlier priorities Claude left out, each with Keep. */
.leaving ul {
  display: grid;
  gap: 6px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.leaving li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px 8px 12px;
  border: 1.5px dashed var(--accent);
  border-radius: 16px;
}

.leaving li > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.leaving button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-ink);
}

.priority-meta .badge.priority {
  height: 18px;
}

/* ---- Snooze, waiting, repeats and target dates ---- */

.badge {
  gap: 4px;
}

.badge .i {
  flex: none;
}

.badge.snoozed {
  background: var(--violet-soft);
  color: var(--violet);
}

.badge.waiting {
  border: 1px dashed var(--line-strong);
  background: none;
  color: var(--ink-2);
  text-transform: none;
  letter-spacing: 0;
}

.badge.target {
  flex: none;
  background: var(--surface-2);
  color: var(--ink-2);
}

.badge.target.today {
  background: var(--today-bg);
  color: var(--today-ink);
}

.badge.target.overdue {
  background: var(--danger-fill);
  color: var(--on-danger);
}

/* A project's countdown sits under its name, so long names keep their room on a phone. */
.section-sub {
  margin: -6px 0 10px 34px;
}

.clarity-sub {
  margin: -4px 0 8px 14px;
}

.status-actions button .i {
  flex: none;
}

.snooze .chips .chip {
  display: inline-grid;
  gap: 1px;
  justify-items: start;
  padding: 6px 14px;
  text-align: left;
}

.snooze .chip small {
  font-family: var(--mono);
  font-size: 0.64rem;
  opacity: 0.75;
}

.snooze label {
  display: grid;
  gap: 6px;
}

.snooze .chips {
  margin: 0;
}

/* Links found in a task's notes, to open them. */
.note-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 0 0;
  padding: 0;
  list-style: none;
}

.note-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--accent-ink);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-links a:hover {
  background: var(--accent-soft);
}

.tidy-due {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.tidy-due input {
  min-height: 34px;
  padding: 0 8px;
}

/* ---- Search ---- */

.search-box {
  position: sticky;
  top: calc(72px + env(safe-area-inset-top));
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--bar);
  color: var(--on-bar-muted);
  box-shadow: var(--shadow);
}

.search-box input {
  flex: 1;
  min-height: 52px;
  border: none;
  background: none;
  color: var(--on-bar);
  font-size: 1rem;
  outline: none;
}

/* The pill draws the focus ring; keep the global input ring off the inner field. */
.search-box input:focus {
  box-shadow: none;
}

.search-box input::placeholder {
  color: var(--on-bar-muted);
}

.search-box:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (min-width: 1100px) {
  .search-box {
    top: 16px;
  }
}

/* ---- Reminders ---- */

.inline-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.inline-field input[type='time'] {
  width: auto;
}

/* ---- Appearance ---- */

.segmented {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-2);
}

.segmented button {
  min-height: 40px;
  padding: 0 10px;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--ink-2);
  font-weight: 600;
}

.segmented button.on {
  background: var(--bar);
  color: var(--on-bar);
}

/* Shown only without the sidebar, which has its own copy. */
@media (min-width: 1100px) {
  .narrow-only {
    display: none !important;
  }
}


/* ---- Settings: notes, folded cards, one-line cards ---- */

.card-note {
  margin-left: auto;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card.fold {
  display: block;
  padding: 0;
}

.card.fold > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 12px 16px 12px 12px;
  cursor: pointer;
  list-style: none;
}

.card.fold > summary::-webkit-details-marker {
  display: none;
}

.fold-title {
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 700;
}

.card.fold .caret {
  flex: none;
  color: var(--muted);
  transform: rotate(-90deg);
  transition: transform 0.15s;
}

.card.fold[open] .caret {
  transform: none;
}

.card.fold > summary .card-note + .caret {
  margin-left: 0;
}

.card.fold > summary .fold-title + .caret {
  margin-left: auto;
}

.fold-body {
  display: grid;
  gap: 12px;
  padding: 0 18px 18px;
}

.row-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.row-card > div {
  flex: 1;
  min-width: 0;
}

.row-card h3 {
  font-size: 1.1rem;
}

.row-card .hint {
  margin: 2px 0 0;
}

.row-card .button {
  flex: none;
}

/* On a phone the titles say enough; the summaries would squeeze them. */
@media (max-width: 520px) {
  .card.fold .card-note {
    visibility: hidden;
    flex: 1;
  }

  .row-card .hint {
    display: none;
  }
}
