:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-soft: #f8f9fb;
  --ink: #15171c;
  --muted: #727783;
  --faint: #9ca1ab;
  --line: #e4e6eb;
  --line-strong: #d7dae1;
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: #eef0ff;
  --amber: #b7791f;
  --amber-soft: #fff8e7;
  --green: #2f7d5b;
  --green-soft: #edf8f2;
  --danger: #b83b3b;
  --danger-soft: #fff0f0;
  --shadow: 0 18px 50px rgba(22, 25, 32, 0.08);
  --shadow-soft: 0 6px 18px rgba(22, 25, 32, 0.05);
  --radius: 22px;
  font-family: Inter, "SF Pro Display", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 78% -10%, rgba(79, 70, 229, 0.07), transparent 30rem),
    radial-gradient(circle at 8% 108%, rgba(21, 23, 28, 0.05), transparent 26rem),
    var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.nav {
  display: grid;
  gap: 5px;
  margin-top: 40px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 13px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.nav-item.is-active {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 20px rgba(21, 23, 28, 0.12);
}

.nav-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: rgba(114, 119, 131, 0.08);
}

.nav-item.is-active .nav-icon {
  background: rgba(255, 255, 255, 0.12);
}

.nav-icon svg {
  width: 16px;
  height: 16px;
}

.nav-count {
  min-width: 24px;
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(114, 119, 131, 0.09);
  color: var(--faint);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.nav-item.is-active .nav-count {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.progress-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.progress-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.progress-heading strong {
  color: var(--ink);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 7px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ink), var(--accent));
  transition: width 300ms ease;
}

.progress-card p {
  margin: 10px 0 0;
  color: var(--faint);
  font-size: 0.72rem;
  line-height: 1.45;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 18px;
  padding: 13px 8px 0;
  border-top: 1px solid var(--line);
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 800;
}

.sidebar-footer div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.sidebar-footer strong {
  font-size: 0.78rem;
}

.sidebar-footer span:not(.avatar) {
  overflow: hidden;
  color: var(--faint);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 46px clamp(24px, 4.5vw, 72px) 64px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.primary-button,
.ghost-button,
.danger-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.primary-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 750;
  box-shadow: 0 10px 24px rgba(21, 23, 28, 0.16);
}

.primary-button:hover {
  transform: translateY(-1px);
  background: #000;
}

.primary-button svg {
  width: 16px;
  height: 16px;
}

.primary-button:disabled,
.danger-button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 34px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.stat-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.stat-icon.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.stat-icon.green {
  background: var(--green-soft);
  color: var(--green);
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-card div {
  display: grid;
  gap: 3px;
}

.stat-card span:not(.stat-icon) {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.stat-card strong {
  font-size: 1.4rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.task-panel {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.panel-header h2 {
  margin: 0;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}

.panel-header p {
  margin: 5px 0 0;
  color: var(--faint);
  font-size: 0.76rem;
}

.filters {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 11px;
  background: var(--surface-soft);
}

.filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
}

.filter span {
  color: var(--faint);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.filter:hover {
  color: var(--ink);
}

.filter.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(22, 25, 32, 0.08);
}

.filter.is-active span {
  color: var(--accent);
}

.status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 18px 24px 0;
  padding: 12px 14px;
  border: 1px solid #f1caca;
  border-radius: 12px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 600;
}

.text-button {
  padding: 0;
  background: transparent;
  color: var(--danger);
  font-size: 0.76rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.task-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  transition: background 160ms ease;
}

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

.task-item:hover {
  background: #fcfcfd;
}

.check {
  position: relative;
  display: block;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  cursor: pointer;
}

.check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.check-mark {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1.5px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  transition: background 160ms ease, border-color 160ms ease;
}

.check:hover .check-mark {
  border-color: var(--accent);
}

.check input:focus-visible + .check-mark {
  outline: 3px solid rgba(79, 70, 229, 0.22);
  outline-offset: 2px;
}

.check input:checked + .check-mark {
  border-color: var(--accent);
  background: var(--accent);
}

.check input:checked + .check-mark::after {
  width: 5px;
  height: 10px;
  margin-top: -2px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  content: "";
  transform: rotate(45deg);
}

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

.task-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.task-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.45;
}

.task-description {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.task-meta {
  margin: 7px 0 0;
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 600;
}

.task-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.task-item.is-completed .task-title {
  color: var(--faint);
  text-decoration: line-through;
  text-decoration-color: rgba(114, 119, 131, 0.45);
}

.task-item.is-completed .task-description {
  color: var(--faint);
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 160ms ease;
}

.task-item:hover .task-actions,
.task-item:focus-within .task-actions {
  opacity: 1;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--faint);
  place-items: center;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.icon-button svg {
  width: 16px;
  height: 16px;
}

.icon-button:hover {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.icon-button.danger:hover {
  border-color: #f1caca;
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state {
  display: grid;
  justify-items: center;
  padding: 64px 24px;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--faint);
}

.empty-icon svg {
  width: 22px;
  height: 22px;
}

.empty-state h3 {
  margin: 16px 0 4px;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.empty-state p {
  max-width: 22rem;
  margin: 0;
  color: var(--faint);
  font-size: 0.78rem;
  line-height: 1.55;
}

.task-dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(12, 14, 20, 0.28);
}

.task-dialog::backdrop {
  background: rgba(21, 23, 28, 0.42);
  backdrop-filter: blur(4px);
}

.task-dialog form,
.confirm-dialog {
  padding: 24px;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.dialog-header .eyebrow {
  margin-bottom: 6px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 15px;
}

.field span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 0.86rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field input {
  height: 44px;
  padding: 0 12px;
}

.field textarea {
  min-height: 104px;
  padding: 11px 12px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--faint);
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.form-error {
  margin: 13px 0 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.74rem;
  font-weight: 600;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 24px;
}

.ghost-button,
.danger-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 750;
}

.ghost-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
}

.ghost-button:hover {
  border-color: var(--faint);
  color: var(--ink);
}

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

.danger-button:hover {
  background: #a83232;
}

.confirm-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.confirm-copy strong {
  color: var(--ink);
}

:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.28);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    display: flex;
    gap: 6px;
    margin-top: 18px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    width: auto;
    flex: 0 0 auto;
    padding: 9px 11px;
  }

  .nav-icon {
    display: none;
  }

  .progress-card,
  .sidebar-footer {
    display: none;
  }

  .main {
    padding-top: 30px;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 26px 16px 44px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .primary-button {
    width: 100%;
  }

  .topbar .primary-button {
    width: auto;
  }

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

  .stat-card {
    padding: 14px 16px;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 18px 18px 16px;
  }

  .filters {
    width: 100%;
  }

  .filter {
    flex: 1;
    justify-content: center;
    padding: 0 8px;
  }

  .task-item {
    grid-template-columns: 24px minmax(0, 1fr);
    padding: 16px 18px;
  }

  .task-actions {
    grid-column: 2;
    justify-content: flex-end;
    opacity: 1;
  }

  .status-banner {
    margin: 14px 18px 0;
  }

  .empty-state {
    padding: 48px 18px;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions button {
    width: 100%;
  }
}

@media (hover: none) {
  .task-actions {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
