:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --panel: #ffffff;
  --text: #1e2722;
  --muted: #647067;
  --line: #dfe5dc;
  --accent: #176b5b;
  --accent-dark: #0d4d40;
  --danger: #9b2f2f;
  --praxis: #e3f2fd;
  --verwaltung: #e8f5e9;
  --haushalt: #fff3e0;
  --freizeit: #fce4ec;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header,
.app-shell {
  width: min(920px, calc(100% - 24px));
  margin: 0 auto;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 18px;
}

.app-header > div {
  min-width: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.icon-button {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 22px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.stats-grid article {
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stats-grid strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.stats-grid span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.task-form {
  display: grid;
  grid-template-columns: 1fr minmax(136px, auto) auto;
  gap: 8px;
  margin: 18px 0 12px;
}

.title-field,
.task-form select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
}

.title-field {
  display: grid;
  grid-template-columns: 1fr 44px;
  align-items: center;
}

.task-form input {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--text);
}

.task-form select {
  padding: 0 10px;
}

.task-form button,
.login-form button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.task-form button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.task-form button {
  padding: 0 18px;
}

.voice-button {
  display: grid;
  width: 38px;
  height: 38px;
  margin-right: 4px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
  color: var(--accent-dark);
  padding: 0;
  font-size: 16px;
}

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

.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  white-space: nowrap;
}

.filter-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.message {
  min-height: 24px;
  margin: 10px 0;
  color: var(--danger);
  font-size: 14px;
}

.message.success {
  color: var(--accent-dark);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  max-width: min(340px, calc(100% - 32px));
  padding: 13px 16px;
  border: 1px solid #b9d8cc;
  border-radius: 8px;
  background: #f4fbf7;
  color: var(--accent-dark);
  box-shadow: 0 12px 28px rgba(30, 39, 34, 0.14);
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.task-board {
  display: grid;
  gap: 12px;
  padding-bottom: 36px;
}

.category-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.category-section[data-category="praxis"] .section-head {
  background: var(--praxis);
}

.category-section[data-category="verwaltung"] .section-head {
  background: var(--verwaltung);
}

.category-section[data-category="haushalt"] .section-head {
  background: var(--haushalt);
}

.category-section[data-category="freizeit"] .section-head {
  background: var(--freizeit);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.section-head h2 {
  font-size: 18px;
}

.section-head span {
  color: var(--muted);
  font-size: 14px;
}

.task-list {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.task-item {
  display: grid;
  grid-template-columns: 44px 1fr 42px;
  gap: 8px;
  min-height: 58px;
  padding: 10px 14px 10px 10px;
  background: var(--panel);
}

.task-item.done {
  color: var(--muted);
}

.task-check {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 20px;
}

.task-title {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.task-edit {
  width: 38px;
  height: 38px;
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 18px;
}

.task-item.editing {
  grid-template-columns: 1fr minmax(120px, auto) auto auto;
  align-items: center;
}

.edit-title,
.edit-category {
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.edit-title {
  padding: 0 12px;
}

.edit-category {
  padding: 0 8px;
}

.edit-save,
.edit-cancel {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 700;
}

.edit-save {
  border: 0;
  background: var(--accent);
  color: #fff;
}

.edit-cancel {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.task-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.done-toggle {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-top: 1px solid var(--line);
  background: #fafbf8;
  color: var(--accent-dark);
  font-weight: 700;
}

.empty-state {
  padding: 16px;
  color: var(--muted);
  background: var(--panel);
  font-size: 15px;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(420px, 100%);
}

.login-panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.login-form input {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.form-error {
  color: var(--danger);
  font-size: 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 680px) {
  .app-header,
  .app-shell {
    width: min(100% - 16px, 920px);
  }

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

  .task-form {
    grid-template-columns: 1fr;
  }

  .task-form button {
    width: 100%;
  }

  .voice-button {
    width: 38px;
  }

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

  .toast {
    right: 8px;
    bottom: 8px;
    max-width: calc(100% - 16px);
  }
}
