:root {
  --paper: #f4f3ef;
  --card: #fbfaf6;
  --ink: #22201c;
  --muted: #6e685d;
  --line: #e2ddd1;
  --line-strong: #d3ccbc;
  --accent: #9a5b34;
  --accent-soft: #f0e4d8;
  --danger: #a33a2a;
  --ok: #3f7d4e;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.6rem;
}

h1 {
  font-size: 1.8rem;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1.1rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  font-size: 0.9em;
}

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

.small {
  font-size: 0.875rem;
}

.error {
  background: #f8e4e0;
  border: 1px solid #e2b6ac;
  border-radius: 8px;
  color: var(--danger);
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
}

.topbar {
  align-items: center;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  padding: 0.85rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 700;
}

.brand:hover {
  text-decoration: none;
}

.tabs {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tab {
  border-radius: 7px;
  color: var(--muted);
  padding: 0.35rem 0.7rem;
}

.tab:hover {
  background: var(--paper);
  text-decoration: none;
}

.tab.active {
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 600;
}

.who {
  color: var(--muted);
  font-size: 0.9rem;
}

.logout {
  margin: 0;
}

.link {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.link:hover {
  text-decoration: underline;
}

.wrap {
  margin: 0 auto;
  max-width: 980px;
  padding: 1.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.stack label,
.field {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  gap: 0.3rem;
}

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

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--ink);
  padding: 0.5rem 0.6rem;
  width: 100%;
}

textarea {
  min-height: 5.5rem;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 7px;
  color: #fff;
  cursor: pointer;
  padding: 0.5rem 0.9rem;
}

button:hover {
  filter: brightness(0.95);
}

button.primary {
  align-self: flex-start;
}

button.ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

button.danger {
  background: transparent;
  border-color: #e2b6ac;
  color: var(--danger);
}

.auth-body {
  background: var(--paper);
}

.auth-wrap {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.auth-card {
  max-width: 380px;
  padding: 1.6rem;
  width: 100%;
}

.auth-title {
  font-size: 2rem;
  margin-bottom: 0.2rem;
}

@media (max-width: 720px) {
  .wrap {
    padding: 1rem;
  }

  .topbar {
    padding: 0.75rem 1rem;
  }

  .tabs {
    order: 3;
    width: 100%;
  }

  h1 {
    font-size: 1.5rem;
  }
}

.flash {
  background: #e6f0e6;
  border: 1px solid #b9d3b9;
  border-radius: 8px;
  color: var(--ok);
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
}

.page-head {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.4rem 0 1rem;
}

.chip {
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  font-size: 0.9rem;
}

.chip:hover {
  text-decoration: none;
}

.chip.active {
  background: var(--accent-soft);
  border-color: var(--line-strong);
  color: var(--ink);
  font-weight: 600;
}

.count {
  background: var(--paper);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  min-width: 1.4em;
  padding: 0 0.35em;
  text-align: center;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.filters input,
.filters select {
  flex: 1 1 12rem;
  width: auto;
}

.add-card {
  margin-bottom: 1.25rem;
}

.add-card > summary {
  cursor: pointer;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.row {
  display: flex;
  gap: 0.75rem;
}

.row > label {
  flex: 1;
}

.tasks {
  display: grid;
  gap: 0.75rem;
}

.task {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}

.task.overdue {
  border-left-color: var(--danger);
  background: #fdf6f4;
}

.task-head {
  align-items: flex-start;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.task-head h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.35rem 0 0;
}

.task-note {
  margin: 0.5rem 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.pill {
  align-items: center;
  background: color-mix(in srgb, var(--pill) 14%, white);
  border: 1px solid color-mix(in srgb, var(--pill) 40%, white);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.82rem;
  gap: 0.35rem;
  padding: 0.15rem 0.6rem;
}

.pill .dot {
  background: var(--pill);
  border-radius: 50%;
  display: inline-block;
  height: 0.55rem;
  width: 0.55rem;
}

.empty {
  color: var(--muted);
  padding: 1rem 0;
}

@media (max-width: 720px) {
  .row {
    flex-direction: column;
  }
}

.task-actions {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.inline {
  align-items: center;
  display: inline-flex;
  gap: 0.35rem;
  margin: 0;
}

.inline select {
  width: auto;
}

.small-btn {
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
}

.edit {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
}

.edit > summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 0.88rem;
}

.edit[open] {
  flex-basis: 100%;
}

.edit[open] > summary {
  margin-bottom: 0.6rem;
}

.lists {
  display: grid;
  gap: 0.75rem;
}

.list-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}

.list-card h2 {
  margin: 0 0 0.25rem;
}

.list-card .chips {
  margin: 0.5rem 0 0;
}

.crumbs {
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
}

.notes {
  display: grid;
  gap: 0.75rem;
}

.note-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}

.note-card h2 {
  margin: 0 0 0.35rem;
  overflow-wrap: anywhere;
}

.note-card .task-note {
  margin: 0;
}

.settings-card {
  margin-bottom: 1rem;
}

.settings-card h2 {
  margin-top: 0;
}

.status-list {
  display: grid;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.status-row {
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: space-between;
  padding: 0.55rem 0.7rem;
}

.status-edit {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
}

.status-edit .status-name {
  width: 12rem;
}

.status-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.status-add {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
}

.status-add input[name="name"] {
  width: 14rem;
}

.color {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  height: 2.3rem;
  padding: 0.15rem;
  width: 3rem;
}

.check {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  flex-direction: row;
  font-size: 0.88rem;
  gap: 0.35rem;
  white-space: nowrap;
}

.check input {
  width: auto;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
