:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #eef2f7;
  --text: #172033;
  --muted: #697386;
  --line: #d9e1ec;
  --primary: #256f61;
  --primary-strong: #15564b;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --focus: #f2b84b;
  --shadow: 0 18px 45px rgba(30, 41, 59, 0.1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(245, 247, 251, 0.88)),
    var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--primary-strong);
}

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

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.workspace {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.workspace {
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.stats span {
  display: grid;
  min-width: 72px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
}

.stats strong {
  color: var(--text);
  font-size: 1.35rem;
}

.composer {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) 132px;
  gap: 14px;
  align-items: end;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
}

.field,
.search {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
}

input {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 42px;
  resize: vertical;
  padding: 10px 12px;
}

.controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.segmented button {
  min-height: 40px;
  border-radius: 0;
  background: #ffffff;
  color: var(--muted);
}

.segmented button + button {
  border-left: 1px solid var(--line);
}

.segmented button.is-active {
  background: var(--primary);
  color: #ffffff;
}

.search {
  width: min(280px, 100%);
}

.list-panel {
  min-height: 280px;
  background: #fbfcfe;
}

.todo-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 22px 28px 28px;
  list-style: none;
}

.todo-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.checkbox-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.todo-toggle {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
}

.todo-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

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

.todo-notes {
  color: var(--muted);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.todo-item.is-completed .todo-title,
.todo-item.is-completed .todo-notes {
  color: #8a94a6;
  text-decoration: line-through;
}

.item-actions {
  display: flex;
  gap: 8px;
}

button.secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
}

button.secondary:hover {
  background: var(--surface-muted);
}

button.danger {
  border: 1px solid #ffd0cc;
  background: var(--danger-bg);
  color: var(--danger);
}

button.danger:hover {
  background: #ffe0dd;
}

.empty-state {
  padding: 54px 28px;
  text-align: center;
}

.empty-state h2 {
  margin-bottom: 8px;
}

.empty-state p,
.empty-state p {
  color: var(--muted);
}

code {
  display: inline-block;
  max-width: 100%;
  padding: 3px 6px;
  border-radius: 5px;
  background: var(--surface-muted);
  color: #243041;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .topbar,
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .todo-item {
    grid-template-columns: 1fr;
  }

  .item-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 540px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0;
  }

  .topbar,
  .composer,
  .controls,
  .todo-list {
    padding-right: 16px;
    padding-left: 16px;
  }

  .stats,
  .segmented {
    grid-template-columns: 1fr;
  }

  .segmented button + button {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .item-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
