:root {
  color-scheme: light;
  --bg: #f5f2ea;
  --panel: #fffdf8;
  --ink: #202124;
  --muted: #6b6257;
  --line: #ddd4c8;
  --accent: #256d6a;
  --accent-strong: #174f4d;
  --danger: #b42318;
  --done: #8a8176;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  min-height: 36px;
  padding: 0 12px;
}

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

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

button.icon {
  width: 36px;
  padding: 0;
}

button.danger {
  color: var(--danger);
}

input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

.shell {
  width: min(1160px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1;
}

.brand p {
  margin: 8px 0 0;
  color: var(--muted);
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-box {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 18px 50px rgba(32, 33, 36, 0.08);
}

.login-box h1 {
  margin: 0 0 20px;
}

.form {
  display: grid;
  gap: 12px;
}

.error {
  color: var(--danger);
  min-height: 22px;
}

.new-section {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 22px;
}

.sections {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  align-items: start;
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-width: 0;
}

.section-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.section-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  word-break: break-word;
}

.item-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 12px;
}

.items {
  display: grid;
  gap: 8px;
}

.item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.item input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  margin: 4px 0 0;
}

.item-text {
  line-height: 1.35;
  min-width: 0;
  overflow-wrap: anywhere;
}

.item.done .item-text {
  color: var(--done);
  text-decoration: line-through;
}

.meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.empty {
  color: var(--muted);
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .new-section,
  .item-form {
    grid-template-columns: 1fr;
  }
}
