:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-alt: #ece7dc;
  --text: #24262b;
  --muted: #5c5f66;
  --border: #d6cfc0;
  --accent: #1f5f5b;
  --accent-text: #ffffff;
  --selected: #dcebe7;
  --danger: #a4262c;
  --todo-bg: #f6e3c5;
  --todo-text: #6b4300;
  --progress-bg: #d7e4f5;
  --progress-text: #1c4471;
  --done-bg: #d5ead8;
  --done-text: #1e5b2b;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  line-height: 1.5;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h2 {
  margin-bottom: 1rem;
  font-size: 1.15rem;
}

/* Header and footer */
.site-header {
  background: var(--accent);
  color: var(--accent-text);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
}

.brand {
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}

.site-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

/* Two-panel layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "create create"
    "list detail";
  gap: 1.25rem;
  align-items: start;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem;
}

.create-card {
  grid-area: create;
}

.list-panel {
  grid-area: list;
}

.detail-panel {
  grid-area: detail;
}

.card {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Forms */
.todo-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.875rem;
}

.todo-form--create {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.field--full {
  grid-column: 1 / -1;
}

label {
  font-size: 0.875rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--muted);
  border-radius: 6px;
  font: inherit;
}

textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  grid-column: 1 / -1;
}

.button {
  justify-self: start;
  padding: 0.55rem 1rem;
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.button--primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

/* Todo list */
.todo-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.todo-item--selected {
  background: var(--selected);
  border-color: var(--accent);
}

.todo-item__body {
  min-width: 0;
}

.todo-item__title {
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.todo-item__description {
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.todo-item__meta {
  color: var(--muted);
  font-size: 0.875rem;
}

.badge {
  flex-shrink: 0;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

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

.badge--progress {
  background: var(--progress-bg);
  color: var(--progress-text);
}

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

/* Panels stack on mobile */
@media (max-width: 767px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "create"
      "list"
      "detail";
    padding: 0.875rem;
  }

  .todo-form,
  .todo-form--create {
    grid-template-columns: minmax(0, 1fr);
  }
}
