:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-muted: #eef3ef;
  --text: #17211c;
  --muted: #5e6f66;
  --line: #ccd8d1;
  --primary: #176b5b;
  --primary-strong: #0f4c42;
  --accent: #b14432;
  --focus: #f2b84b;
  --shadow: 0 16px 50px rgb(23 33 28 / 10%);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111614;
  --surface: #1b2320;
  --surface-muted: #26322e;
  --text: #edf4ef;
  --muted: #a8b8af;
  --line: #34443e;
  --primary: #64c8b5;
  --primary-strong: #8de0d1;
  --accent: #ee927f;
  --focus: #f0c15a;
  --shadow: 0 16px 50px rgb(0 0 0 / 26%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111614;
    --surface: #1b2320;
    --surface-muted: #26322e;
    --text: #edf4ef;
    --muted: #a8b8af;
    --line: #34443e;
    --primary: #64c8b5;
    --primary-strong: #8de0d1;
    --accent: #ee927f;
    --focus: #f0c15a;
    --shadow: 0 16px 50px rgb(0 0 0 / 26%);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--surface-muted), transparent 24%), transparent 36rem),
    var(--bg);
}

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

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

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 10;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--surface);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(1240px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.topbar,
.topbar-actions,
.section-heading,
.source-actions,
.input-row,
.task-row,
.stats-grid,
.site-footer {
  display: flex;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
  padding: 0.75rem 0;
  background: color-mix(in srgb, var(--bg), transparent 6%);
  backdrop-filter: blur(16px);
}

.topbar h1,
.source-panel h2,
.tasks-panel h2 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.eyebrow {
  margin: 0 0 0.3rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions {
  align-items: center;
  gap: 0.75rem;
}

.save-state,
.pill,
.source-actions span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.theme-field {
  display: grid;
  gap: 0.25rem;
  min-width: 9rem;
}

.theme-field span,
.source-field,
.add-task-form label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(360px, 1.12fr);
  gap: 1rem;
  align-items: start;
}

.source-panel,
.tasks-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.source-panel {
  display: grid;
  gap: 0.9rem;
  min-height: calc(100vh - 128px);
  padding: clamp(1rem, 3vw, 1.4rem);
}

.tasks-panel {
  padding: clamp(1rem, 3vw, 1.4rem);
}

.section-heading {
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.source-panel h2,
.tasks-panel h2 {
  font-size: clamp(1.4rem, 3vw, 2.1rem);
}

.pill {
  padding: 0.38rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
}

textarea {
  width: 100%;
  min-height: 520px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 0.9rem;
  line-height: 1.5;
}

input,
select {
  width: 100%;
  min-height: 2.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.6rem 0.75rem;
}

textarea:focus,
input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus), transparent 35%);
  outline-offset: 2px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.65rem;
  padding: 0.65rem 0.95rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

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

.button.primary:hover,
.button.primary:focus-visible {
  background: var(--primary-strong);
}

.button.secondary {
  border-color: var(--line);
  background: var(--surface);
}

.button.secondary:hover,
.button.secondary:focus-visible {
  border-color: var(--primary);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.source-actions {
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.stats-grid {
  gap: 0.75rem;
  margin: 1rem 0;
}

.stats-grid div {
  flex: 1;
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

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

.stats-grid span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.add-task-form {
  display: grid;
  gap: 0.45rem;
}

.input-row {
  gap: 0.6rem;
}

.input-row input {
  flex: 1;
}

.task-list {
  display: grid;
  gap: 0.6rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.empty-state {
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

.task-row {
  align-items: center;
  gap: 0.75rem;
  min-height: 4rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.task-row[data-priority="high"] {
  border-left-color: var(--accent);
}

.task-row input {
  width: 1.15rem;
  min-height: 1.15rem;
  accent-color: var(--primary);
}

.task-body {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 0.2rem;
}

.task-body span {
  overflow-wrap: anywhere;
  font-weight: 750;
}

.task-body small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.task-row[data-done="true"] .task-body span {
  color: var(--muted);
  text-decoration: line-through;
}

.icon-button {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  font-weight: 900;
  cursor: pointer;
}

.site-footer {
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.site-footer a {
  color: var(--primary);
}

@media (max-width: 860px) {
  .topbar,
  .topbar-actions,
  .source-actions,
  .input-row {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: static;
  }

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

  .source-panel {
    min-height: auto;
  }

  textarea {
    min-height: 320px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 1rem, 1240px);
  }

  .section-heading,
  .stats-grid {
    flex-direction: column;
  }

  .section-heading {
    align-items: flex-start;
  }

  .stats-grid div {
    width: 100%;
  }
}
