:root {
  color-scheme: light;
  --paper: #f7f3eb;
  --surface: #fffaf1;
  --ink: #24211d;
  --muted: #766f66;
  --line: #ded6c8;
  --green: #2f7d64;
  --green-dark: #225f4b;
  --coral: #d76d57;
  --blue: #315f8a;
  --yellow: #c79428;
  --shadow: 0 18px 50px rgba(36, 33, 29, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(49, 95, 138, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(49, 95, 138, 0.08) 1px, transparent 1px),
    var(--paper);
  background-size: 34px 34px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.login-card {
  display: grid;
  width: min(100%, 430px);
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.96);
  box-shadow: var(--shadow);
}

.login-card h1 {
  font-size: clamp(2.4rem, 12vw, 4.2rem);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.remember-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--green);
}

.login-message {
  min-height: 20px;
  margin: 0;
  color: #9b3d2d;
  font-size: 0.9rem;
  font-weight: 750;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 5.6rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stats span {
  min-width: 112px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.88);
  color: var(--muted);
  text-align: center;
}

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

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.logout-form {
  margin: 0;
}

.composer {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.94);
  box-shadow: var(--shadow);
}

#taskForm {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(128px, 0.42fr) minmax(144px, 0.42fr) minmax(132px, 0.38fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
}

.input-group,
.search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 125, 100, 0.16);
}

.primary-action,
.ghost-action,
.filter,
.delete-task {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-action {
  background: var(--green);
  color: #ffffff;
}

.primary-action:hover {
  background: var(--green-dark);
}

.workspace {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.sidebar {
  display: grid;
  gap: 8px;
  position: sticky;
  top: 16px;
}

.filter {
  width: 100%;
  border-color: var(--line);
  background: rgba(255, 250, 241, 0.88);
  color: var(--ink);
  text-align: left;
}

.filter.active {
  border-color: var(--green);
  background: #e8f1ec;
  color: var(--green-dark);
}

.task-panel {
  min-height: 420px;
}

.panel-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.search {
  width: min(360px, 100%);
}

.ghost-action {
  border-color: var(--line);
  background: rgba(255, 250, 241, 0.92);
  color: var(--blue);
}

.task-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--green);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.96);
}

.task-item.high {
  border-left-color: var(--coral);
}

.task-item.low {
  border-left-color: var(--blue);
}

.task-item.done {
  opacity: 0.68;
}

.task-item.done .task-name {
  text-decoration: line-through;
}

.check-wrap {
  display: grid;
  place-items: center;
}

.task-check {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.custom-check {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.task-check:checked + .custom-check {
  border-color: var(--green);
  background: var(--green);
}

.task-check:checked + .custom-check::after {
  content: "";
  width: 9px;
  height: 15px;
  border: solid #ffffff;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.task-check:focus + .custom-check {
  box-shadow: 0 0 0 3px rgba(47, 125, 100, 0.16);
}

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

.task-name {
  margin: 0 0 7px;
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 850;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.task-meta span {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
}

.task-meta .late {
  border-color: rgba(215, 109, 87, 0.45);
  color: #9b3d2d;
}

.delete-task {
  border-color: rgba(215, 109, 87, 0.35);
  background: #fff3ef;
  color: #9b3d2d;
}

.empty-state {
  padding: 40px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.68);
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 820px) {
  .topbar,
  .panel-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .stats {
    justify-content: stretch;
  }

  .top-actions {
    justify-content: stretch;
  }

  .stats span {
    flex: 1;
  }

  #logoutButton {
    width: 100%;
  }

  #taskForm {
    grid-template-columns: 1fr 1fr;
  }

  .task-title,
  .primary-action {
    grid-column: 1 / -1;
  }

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

  .sidebar {
    position: static;
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .filter {
    min-width: max-content;
    text-align: center;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding: 18px 0;
  }

  #taskForm {
    grid-template-columns: 1fr;
  }

  .task-item {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .delete-task {
    grid-column: 2;
    justify-self: start;
  }
}
