:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --text: #1f2421;
  --muted: #5b625e;
  --line: #e2ded5;
  --brand: #2f5d50;
  --brand-text: #ffffff;
  --done: #2e7d4f;
  --done-bg: #e6f3ea;
  --next: #1f5fa8;
  --next-bg: #e5eef9;
  --todo: #8a5a00;
  --todo-bg: #fbf0d9;
  --ask: #a33a2b;
  --ask-bg: #fbe7e3;
  --focus: #f2b705;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #151816;
    --card: #1e2220;
    --text: #eef1ee;
    --muted: #a9b1ac;
    --line: #313733;
    --brand: #7fc4ad;
    --brand-text: #10221c;
    --done: #7fd19b;
    --done-bg: #1d3326;
    --next: #8db8ee;
    --next-bg: #1b2a3d;
    --todo: #f0c56b;
    --todo-bg: #3a2f17;
    --ask: #f19a8b;
    --ask-bg: #3d221d;
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #151816;
  --card: #1e2220;
  --text: #eef1ee;
  --muted: #a9b1ac;
  --line: #313733;
  --brand: #7fc4ad;
  --brand-text: #10221c;
  --done: #7fd19b;
  --done-bg: #1d3326;
  --next: #8db8ee;
  --next-bg: #1b2a3d;
  --todo: #f0c56b;
  --todo-bg: #3a2f17;
  --ask: #f19a8b;
  --ask-bg: #3d221d;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.55 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

h1 {
  font-size: 30px;
  line-height: 1.2;
  margin: 0 0 8px;
}

h2 {
  font-size: 23px;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

p {
  margin: 0 0 12px;
}

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

.loading {
  text-align: center;
  padding: 80px 0;
  color: var(--muted);
}

button,
.button {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 12px;
  padding: 14px 22px;
  min-height: 52px;
  background: var(--brand);
  color: var(--brand-text);
  cursor: pointer;
}

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

button.link {
  background: none;
  color: var(--muted);
  padding: 8px 0;
  min-height: 0;
  font-weight: 400;
  text-decoration: underline;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Sign-in screen */
.welcome {
  text-align: center;
  padding: 48px 8px;
}

.welcome .logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.welcome button {
  width: 100%;
  max-width: 340px;
  margin: 20px 0 12px;
  font-size: 20px;
}

.steps {
  text-align: left;
  max-width: 420px;
  margin: 24px auto 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 20px;
}

.steps ol {
  margin: 8px 0 0;
  padding-left: 22px;
}

.steps li {
  margin-bottom: 6px;
}

.steps-foot {
  margin: 10px 0 0;
}

/* Header */
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.updated {
  display: inline-block;
  font-size: 15px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 16px;
}

/* Summary tiles */
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 20px 0 28px;
}

.tile {
  display: block;
  width: 100%;
  min-height: 0;
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
}

/* View switch */
.switch {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
}

.switch-label {
  font-weight: 600;
  margin-right: 4px;
}

.switch button {
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--line);
  min-height: 48px;
  padding: 10px 18px;
}

.switch button[aria-pressed='true'] {
  background: var(--brand);
  color: var(--brand-text);
  border-color: var(--brand);
}

.tag {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

/* Topic view: each card coloured by its status */
.topic .dot {
  background: var(--brand);
}

.card.status-ask {
  border-left-color: var(--ask);
}

.card.status-done {
  border-left-color: var(--done);
}

.card.status-next {
  border-left-color: var(--next);
}

.card.status-todo {
  border-left-color: var(--todo);
}

.chip.status.ask {
  background: var(--ask-bg);
  color: var(--ask);
}

.chip.status.next {
  background: var(--next-bg);
  color: var(--next);
}

.chip.status.todo {
  background: var(--todo-bg);
  color: var(--todo);
}

.tile strong {
  display: block;
  font-size: 32px;
  line-height: 1.1;
}

.tile span {
  font-size: 15px;
  font-weight: 600;
}

.tile.done {
  background: var(--done-bg);
  color: var(--done);
}

.tile.next {
  background: var(--next-bg);
  color: var(--next);
}

.tile.todo {
  background: var(--todo-bg);
  color: var(--todo);
}

/* Sections */
section {
  margin-bottom: 36px;
  scroll-margin-top: 16px;
}

.section-note {
  color: var(--muted);
  margin-bottom: 14px;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: none;
}

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left-width: 6px;
  border-radius: 12px;
  padding: 14px 16px;
}

.card h3 {
  font-size: 19px;
  margin: 0 0 4px;
  line-height: 1.35;
}

.card p {
  margin: 0;
  color: var(--muted);
}

.card .meta {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 600;
}

.ask .card {
  border-left-color: var(--ask);
}

.ask .dot {
  background: var(--ask);
}

.ask .meta {
  color: var(--ask);
}

.done .card {
  border-left-color: var(--done);
}

.done .dot {
  background: var(--done);
}

.done .meta {
  color: var(--done);
}

.next .card {
  border-left-color: var(--next);
}

.next .dot {
  background: var(--next);
}

.todo .card {
  border-left-color: var(--todo);
}

.todo .dot {
  background: var(--todo);
}

/* Ideas */
.ideas .dot {
  background: var(--brand);
}

form.idea {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

label {
  display: block;
  font-weight: 600;
  margin: 0 0 6px;
}

.hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 15px;
}

input[type='text'],
textarea,
select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.message {
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-weight: 600;
}

.message.ok {
  background: var(--done-bg);
  color: var(--done);
}

.message.err {
  background: var(--ask-bg);
  color: var(--ask);
}

.chip {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 10px;
  margin-bottom: 6px;
}

.chip.new {
  background: var(--line);
  color: var(--text);
}

.chip.planned,
.chip.building {
  background: var(--next-bg);
  color: var(--next);
}

.chip.done {
  background: var(--done-bg);
  color: var(--done);
}

.chip.not_now {
  background: var(--todo-bg);
  color: var(--todo);
}

.ideas .card {
  border-left-color: var(--brand);
}

.reply {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
}

.reply strong {
  display: block;
  font-size: 15px;
}

.admin {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.admin textarea {
  min-height: 70px;
}

footer {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  color: var(--muted);
  font-size: 16px;
}

@media (max-width: 420px) {
  h1 {
    font-size: 26px;
  }

  .tile strong {
    font-size: 28px;
  }

  .tile span {
    font-size: 14px;
  }
}
