:root {
  color-scheme: light;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --color-background: #f3f6f4;
  --color-surface: #ffffff;
  --color-surface-subtle: #edf2ef;
  --color-surface-hover: #e5ece8;
  --color-border: #d7e0db;
  --color-border-strong: #bdcac3;
  --color-text: #18231f;
  --color-text-muted: #5d6b65;
  --color-accent: #0f766e;
  --color-accent-hover: #0a5f59;
  --color-accent-soft: #e2f2ee;
  --color-danger: #b42318;
  --color-danger-hover: #8f1d14;
  --color-danger-soft: #fff0ee;
  --color-focus: #0b6b64;
  --color-on-accent: #ffffff;
  --shadow-card: 0 1rem 2.5rem rgb(24 35 31 / 6%);
  --shadow-dialog: 0 1.5rem 4rem rgb(12 25 20 / 22%);
  --radius-small: 0.5rem;
  --radius-medium: 0.875rem;
  --radius-large: 1.25rem;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  --sidebar-width: 19rem;
  --content-width: 52rem;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --color-background: #101714;
  --color-surface: #18211d;
  --color-surface-subtle: #202c26;
  --color-surface-hover: #2a3932;
  --color-border: #314039;
  --color-border-strong: #46574f;
  --color-text: #edf4f0;
  --color-text-muted: #a8b7af;
  --color-accent: #63c7b8;
  --color-accent-hover: #83d7ca;
  --color-accent-soft: #203c35;
  --color-danger: #ff9b91;
  --color-danger-hover: #ffb5ad;
  --color-danger-soft: #3a2421;
  --color-focus: #83d7ca;
  --color-on-accent: #0d211c;
  --shadow-card: 0 1rem 2.5rem rgb(0 0 0 / 18%);
  --shadow-dialog: 0 1.5rem 4rem rgb(0 0 0 / 45%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 20rem;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

button:not(:disabled),
input:not(:disabled) {
  cursor: pointer;
}

input[type="text"] {
  cursor: text;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
.task-checkbox__input:focus-visible + .task-checkbox__box {
  outline: 0.1875rem solid var(--color-focus);
  outline-offset: 0.1875rem;
}

[hidden] {
  display: none !important;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
}

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

.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  transform: translateY(-180%);
  border-radius: var(--radius-small);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: 700;
  text-decoration: none;
}

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

.app-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.sidebar__header,
.brand,
.sidebar__heading,
.list-header__title-row,
.tasks-section__header,
.dialog__header,
.dialog__actions {
  display: flex;
  align-items: center;
}

.sidebar__header,
.sidebar__heading,
.list-header__title-row,
.tasks-section__header,
.dialog__header {
  justify-content: space-between;
  gap: var(--space-4);
}

.brand {
  gap: var(--space-3);
}

.brand__mark {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border-radius: 0.75rem;
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.brand__mark .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.brand__name {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.sidebar__content {
  min-width: 0;
}

.sidebar__heading {
  margin-bottom: var(--space-3);
}

.sidebar__heading h2,
.tasks-section__header h2 {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 750;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.count-label {
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.new-list-button {
  width: 100%;
  margin-bottom: var(--space-5);
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.button {
  padding: 0.6875rem var(--space-4);
}

.button:not(:disabled):active,
.icon-button:not(:disabled):active {
  transform: translateY(1px);
}

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

.button--primary:not(:disabled):hover {
  border-color: var(--color-accent-hover);
  background: var(--color-accent-hover);
}

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

.button--secondary:not(:disabled):hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface-subtle);
}

.button--ghost {
  background: transparent;
  color: var(--color-text-muted);
}

.button--ghost:not(:disabled):hover {
  background: var(--color-surface-subtle);
  color: var(--color-text);
}

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

.button--danger:not(:disabled):hover {
  border-color: var(--color-danger-hover);
  background: var(--color-danger-hover);
}

:root[data-theme="dark"] .button--danger {
  color: #24110e;
}

.button--small {
  min-height: 2.375rem;
  padding: 0.5rem var(--space-3);
  font-size: 0.875rem;
}

.icon-button {
  width: 2.75rem;
  padding: 0;
  flex: 0 0 auto;
  background: transparent;
  color: var(--color-text-muted);
}

.icon-button:not(:disabled):hover {
  background: var(--color-surface-subtle);
  color: var(--color-text);
}

.icon-button--danger:not(:disabled):hover {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.button__spinner,
.state-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  border: 0.125rem solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.state-spinner {
  width: 1.75rem;
  height: 1.75rem;
  border-width: 0.1875rem;
  color: var(--color-accent);
}

.theme-icon--sun {
  display: none;
}

:root[data-theme="dark"] .theme-icon--sun {
  display: block;
}

:root[data-theme="dark"] .theme-icon--moon {
  display: none;
}

.list-items,
.skeleton-list,
.task-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.list-items {
  display: grid;
  gap: var(--space-1);
}

.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 2.875rem;
  padding: var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--color-text-muted);
  text-align: left;
}

.list-item:not(:disabled):hover {
  background: var(--color-surface-subtle);
  color: var(--color-text);
}

.list-item[aria-current="page"] {
  border-color: var(--color-accent-soft);
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-weight: 700;
}

.list-item__name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item__count {
  display: grid;
  min-width: 1.625rem;
  height: 1.625rem;
  padding: 0 var(--space-2);
  place-items: center;
  border-radius: 999px;
  background: var(--color-surface-hover);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.list-item[aria-current="page"] .list-item__count {
  background: var(--color-surface);
  color: var(--color-accent);
}

.skeleton-list {
  display: grid;
  gap: var(--space-2);
}

.skeleton-list__item {
  height: 2.875rem;
  border-radius: var(--radius-small);
  background: linear-gradient(90deg, var(--color-surface-subtle), var(--color-surface-hover), var(--color-surface-subtle));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.sidebar-empty,
.sidebar-error {
  padding: var(--space-3) 0;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.sidebar-error p {
  margin: 0 0 var(--space-3);
}

.sidebar__note {
  margin: auto 0 0;
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

.workspace {
  min-width: 0;
  padding: var(--space-6) var(--space-4) var(--space-8);
}

.workspace:focus {
  outline: none;
}

.workspace__inner {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
}

.list-header {
  margin-bottom: var(--space-6);
}

.eyebrow {
  margin: 0 0 var(--space-2);
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.list-header__title-row {
  align-items: flex-start;
  flex-wrap: wrap;
}

.list-header h1 {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.875rem, 5vw, 2.75rem);
  font-weight: 750;
  letter-spacing: -0.045em;
  line-height: 1.15;
}

.list-actions {
  gap: var(--space-1);
  flex: 0 0 auto;
}

.list-summary {
  margin: var(--space-3) 0 0;
  color: var(--color-text-muted);
}

.progress-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  max-width: 34rem;
  margin-top: var(--space-5);
}

.progress {
  width: 100%;
  height: 0.5rem;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  appearance: none;
  background: var(--color-border);
}

.progress::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--color-border);
}

.progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--color-accent);
  transition: width 180ms ease;
}

.progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--color-accent);
}

.progress-label {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.task-composer {
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.field-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: 0.875rem;
  font-weight: 700;
}

.composer__controls {
  display: flex;
  align-items: stretch;
  gap: var(--space-3);
}

.text-input {
  width: 100%;
  min-width: 0;
  min-height: 2.875rem;
  padding: 0.6875rem var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-small);
  background: var(--color-surface);
  color: var(--color-text);
  line-height: 1.4;
}

.text-input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.85;
}

.text-input:focus {
  border-color: var(--color-focus);
}

.text-input[aria-invalid="true"] {
  border-color: var(--color-danger);
}

.field-hint {
  margin: var(--space-2) 0 0;
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

.form-error {
  margin: var(--space-3) 0 0;
  color: var(--color-danger);
  font-size: 0.875rem;
  font-weight: 600;
}

.tasks-section {
  margin-top: var(--space-6);
}

.tasks-section__header {
  padding: 0 var(--space-1);
  margin-bottom: var(--space-3);
}

.content-state {
  min-height: 15rem;
}

.state-panel {
  display: flex;
  min-height: 15rem;
  padding: var(--space-6);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-large);
  text-align: center;
}

.state-panel h2 {
  margin: var(--space-4) 0 var(--space-2);
  font-size: 1.125rem;
}

.state-panel p {
  max-width: 26rem;
  margin: 0 0 var(--space-4);
  color: var(--color-text-muted);
}

.state-panel--error {
  border-style: solid;
  border-color: var(--color-danger);
  background: var(--color-danger-soft);
}

.state-panel--error h2,
.state-panel--error p {
  color: var(--color-danger);
}

.task-list {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.task-item {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  min-height: 4.75rem;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  transition: background-color 150ms ease;
}

.task-item:last-child {
  border-bottom: 0;
}

.task-item:not(:last-child)::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: var(--color-border);
  content: "";
  pointer-events: none;
}

.task-item:hover {
  background: var(--color-surface-subtle);
}

.task-item--completed {
  background: color-mix(in srgb, var(--color-surface-subtle) 45%, transparent);
}

.task-item.is-busy .task-checkbox,
.task-item.is-busy .task-item__actions {
  opacity: 0.55;
}

.task-checkbox {
  position: relative;
  display: inline-flex;
  width: 1.5rem;
  height: 1.5rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.task-checkbox__input {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
}

.task-checkbox__box {
  display: grid;
  width: 1.375rem;
  height: 1.375rem;
  place-items: center;
  border: 0.125rem solid var(--color-border-strong);
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-on-accent);
  pointer-events: none;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.task-checkbox__box .icon {
  width: 0.9375rem;
  height: 0.9375rem;
  opacity: 0;
}

.task-checkbox__input:checked + .task-checkbox__box {
  border-color: var(--color-accent);
  background: var(--color-accent);
}

.task-checkbox__input:checked + .task-checkbox__box .icon {
  opacity: 1;
}

.task-checkbox:hover .task-checkbox__box {
  border-color: var(--color-accent);
}

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

.task-item__title {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 550;
  line-height: 1.45;
}

.task-item--completed .task-item__title {
  color: var(--color-text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--color-text-muted);
  text-decoration-thickness: 1px;
}

.task-item__status {
  margin: 0.125rem 0 0;
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 650;
}

.task-item__status:empty {
  display: none;
}

.task-item__actions {
  display: flex;
  gap: var(--space-1);
}

.task-item__actions .icon-button {
  width: 2.5rem;
  min-height: 2.5rem;
}

.task-item__pending {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

.task-item__pending .button__spinner {
  width: 0.75rem;
  height: 0.75rem;
  border-width: 0.09375rem;
}

.toast-region {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 80;
  display: grid;
  width: min(24rem, calc(100vw - 2rem));
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-left: 0.25rem solid var(--color-accent);
  border-radius: var(--radius-medium);
  background: var(--color-surface);
  box-shadow: var(--shadow-dialog);
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.toast--error {
  border-left-color: var(--color-danger);
}

.toast__message {
  margin: 0;
  flex: 1;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.toast__close {
  padding: var(--space-1) 0;
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.toast__close:hover {
  color: var(--color-text);
}

.dialog {
  width: min(30rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-dialog);
}

.dialog::backdrop {
  background: rgb(10 20 16 / 55%);
  backdrop-filter: blur(2px);
}

.dialog__header {
  align-items: flex-start;
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.dialog__header h2 {
  margin: 0;
  font-size: 1.375rem;
  letter-spacing: -0.025em;
}

.dialog form {
  padding: var(--space-5);
}

.dialog__message,
.dialog__warning {
  padding: 0 var(--space-5);
  margin: var(--space-5) 0 0;
  overflow-wrap: anywhere;
}

.dialog__message {
  color: var(--color-text-muted);
}

.dialog__warning {
  margin-top: var(--space-2);
  margin-bottom: var(--space-5);
  color: var(--color-danger);
  font-size: 0.875rem;
  font-weight: 650;
}

.dialog--confirm .form-error {
  padding: 0 var(--space-5);
}

.dialog--confirm .dialog__actions {
  padding: 0 var(--space-5) var(--space-5);
}

.dialog__actions {
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.noscript {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  left: var(--space-4);
  z-index: 90;
  padding: var(--space-4);
  margin: 0;
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-medium);
  background: var(--color-danger-soft);
  color: var(--color-danger);
  text-align: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 47.99rem) {
  .sidebar__note {
    display: none;
  }

  .lists-nav {
    overflow-x: auto;
    padding-bottom: var(--space-2);
  }

  .list-items {
    display: flex;
    gap: var(--space-2);
  }

  .list-item {
    width: auto;
    min-width: 10rem;
    max-width: 15rem;
    flex: 0 0 auto;
    border-color: var(--color-border);
  }

  .new-list-button {
    width: auto;
  }
}

@media (max-width: 29.99rem) {
  .workspace {
    padding-top: var(--space-5);
  }

  .composer__controls {
    flex-direction: column;
  }

  .composer__controls .button {
    width: 100%;
  }

  .task-item {
    gap: var(--space-2);
    padding: var(--space-3);
  }

  .task-item__actions {
    gap: 0;
  }

  .task-item__actions .icon-button {
    width: 2.375rem;
  }

  .dialog__actions {
    flex-wrap: wrap;
  }

  .dialog__actions .button {
    flex: 1;
  }
}

@media (min-width: 56rem) {
  .app-shell {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    padding: var(--space-5);
    overflow-y: auto;
    border-right: 1px solid var(--color-border);
    border-bottom: 0;
  }

  .workspace {
    padding: var(--space-8) clamp(var(--space-6), 5vw, 4.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
