:root {
  --paper: #f6f2e8;
  --surface: #fffdf8;
  --ink: #27302d;
  --muted: #65706a;
  --line: #d6d2c7;
  --accent: #2f6a61;
  --accent-soft: #d9ebe5;
  --focus: #c9802c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.site-header,
.workspace,
footer {
  width: min(100% - 32px, 760px);
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.workspace {
  display: grid;
  gap: 20px;
  padding-block: 32px 44px;
}

.intro {
  max-width: 620px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 6vw, 2.8rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.1rem;
  letter-spacing: -0.015em;
}

.intro p,
.section-help,
.empty-state,
footer {
  color: var(--muted);
}

.intro p {
  max-width: 590px;
  margin-bottom: 0;
}

.capture-panel,
.queue-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.data-panel {
  padding: 4px 2px;
  color: var(--muted);
}

.data-panel h2 {
  color: var(--ink);
}

.data-panel p {
  max-width: 560px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.data-panel .text-button {
  padding: 4px 0;
}

.data-actions,
.restore-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.restore-preview {
  margin-top: 12px;
  padding: 12px;
  border-left: 2px solid var(--accent);
  background: var(--surface);
  color: var(--ink);
}

.restore-preview h3,
.restore-preview p {
  margin-bottom: 6px;
}

.restore-preview h3 {
  font-size: 0.94rem;
}

.restore-preferences,
.restore-warning {
  color: var(--muted);
  font-size: 0.84rem;
}

.restore-warning {
  margin-top: 10px;
}

.restore-actions {
  margin-top: 10px;
}

.data-message {
  min-height: 1.3em;
  margin: 6px 0 0;
  font-size: 0.84rem;
}

.section-help {
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.task-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(132px, 0.38fr) auto;
  gap: 10px;
}

.field {
  min-width: 0;
}

.field label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.task-form input,
.task-form select,
.current-energy select,
.current-time select {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.title-field input {
  font-weight: 550;
}

.primary-button,
.text-button,
.quiet-button,
summary {
  cursor: pointer;
}

.primary-button {
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
}

.primary-button:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.text-button,
.quiet-button,
summary {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 650;
}

.quiet-button {
  padding: 7px 0;
}

.add-task-button {
  align-self: end;
}

.task-context {
  grid-column: 1 / -1;
}

.task-context summary {
  width: fit-content;
  padding-block: 4px;
}

.context-fields {
  display: grid;
  grid-template-columns: minmax(132px, 0.35fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 8px;
  padding: 12px;
  border-left: 2px solid var(--accent-soft);
  background: #fbf9f2;
}

.field-help,
.form-message,
.focus-status,
.next-message {
  margin: 6px 0 0;
  font-size: 0.84rem;
}

.form-message,
.next-message {
  min-height: 1.3em;
}

.field-help,
.form-message {
  color: var(--muted);
}

.next-card {
  padding: 20px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
}

.next-card h2 {
  color: #fff;
}

.current-energy,
.current-time {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-top: 16px;
}

.current-energy label,
.current-time label {
  flex: 1;
  color: #d7e8e2;
  font-size: 0.84rem;
  font-weight: 650;
}

.current-energy-help {
  margin: 6px 0 0;
  color: #d7e8e2;
  font-size: 0.8rem;
}

.current-energy select,
.current-time select {
  width: min(100%, 170px);
  border-color: #6f918a;
  background: var(--ink);
  color: #fff;
  font-size: 0.86rem;
}

.current-energy option,
.current-time option {
  background: var(--ink);
}

.next-task {
  margin: 14px 0 8px;
  font-size: clamp(1.45rem, 4vw, 2rem);
  font-weight: 720;
  letter-spacing: -0.03em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.next-details {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.next-detail,
.next-message,
.focus-status,
.why-task {
  color: #d7e8e2;
}

.next-detail,
.why-task {
  margin: 0;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.why-task summary {
  color: #d7e8e2;
}

.why-task p {
  margin: 7px 0 0;
}

.next-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.next-card .text-button {
  color: #d7e8e2;
}

.undo-delete {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
  font-size: 0.84rem;
}

.undo-delete p {
  margin: 0;
  color: #d7e8e2;
}

.undo-delete .text-button {
  padding: 2px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.next-card .focus-status {
  min-height: 1.3em;
  margin-top: 12px;
}

.focus-timer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin: 18px 0 14px;
  padding: 12px 0;
  border-top: 1px solid #5c7771;
  border-bottom: 1px solid #5c7771;
}

.focus-timer h3 {
  margin: 0;
  font-size: 0.9rem;
}

.timer-task {
  margin: 4px 0 0;
  color: #d7e8e2;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.timer-display {
  margin: 3px 0 0;
  color: #fffdf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1;
}

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

.focus-timer .focus-status {
  flex-basis: 100%;
  margin: 0;
}

.task-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.task-row:last-child {
  border-bottom: 0;
}

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

.task-content {
  min-width: 0;
}

.task-text {
  display: block;
  font-size: 0.94rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.task-meta,
.snooze-label {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.task-row.is-done {
  opacity: 0.58;
}

.task-row.is-done .task-text {
  text-decoration: line-through;
}

.energy-tag {
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
}

.delete-task {
  color: #8b4d4d;
}

.empty-state {
  margin: 14px 0 0;
  font-size: 0.9rem;
}

.skip-link {
  position: absolute;
  left: -999px;
}

.skip-link:focus {
  top: 12px;
  left: 12px;
  z-index: 1;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

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

footer {
  padding-bottom: 28px;
  font-size: 0.82rem;
}

footer p {
  margin-bottom: 0;
}

body.calm {
  --paper: #eef4f2;
  --surface: #fcfffe;
  --ink: #24323b;
  --accent: #315f8d;
  --accent-soft: #dce8f3;
}

@media (max-width: 640px) {
  .site-header,
  .workspace,
  footer {
    width: min(100% - 24px, 760px);
  }

  .workspace {
    gap: 16px;
    padding-block: 22px 32px;
  }

  .task-form,
  .context-fields {
    grid-template-columns: 1fr;
  }

  .add-task-button,
  .primary-button,
  .current-energy select,
  .current-time select {
    width: 100%;
  }

  .capture-panel,
  .queue-panel,
  .next-card {
    padding: 16px;
  }

  .current-energy,
  .current-time {
    align-items: stretch;
    flex-direction: column;
  }

  .next-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .next-actions > * {
    width: 100%;
    text-align: left;
  }

  .undo-delete {
    align-items: flex-start;
    flex-direction: column;
  }

  .data-actions,
  .restore-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .data-actions > *,
  .restore-actions > * {
    width: 100%;
    text-align: left;
  }

  .focus-timer {
    align-items: stretch;
    flex-direction: column;
  }

  .timer-controls {
    flex-direction: column;
  }

  .timer-controls > * {
    width: 100%;
    text-align: left;
  }

  .task-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .energy-tag {
    display: none;
  }

  .task-actions {
    grid-column: 2;
    justify-content: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
