:root {
  --bg: #f3f5f2;
  --bg-strong: #e7ece8;
  --panel: #ffffff;
  --panel-soft: #f9faf8;
  --text: #17201a;
  --muted: #647067;
  --line: #d7ddd6;
  --line-strong: #bdc8c0;
  --accent: #116a5b;
  --accent-strong: #0a4b42;
  --accent-soft: #dcefeb;
  --danger: #b42318;
  --warning: #a15c07;
  --shadow: 0 16px 40px rgba(32, 45, 36, 0.08);
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(243, 245, 242, 0) 220px),
    radial-gradient(circle at 12% 0%, rgba(17, 106, 91, 0.08), transparent 310px),
    var(--bg);
  font-family: "Aptos", "Segoe UI", "Noto Sans", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

a:hover { color: var(--accent-strong); text-decoration: underline; }

h1, h2 {
  margin: 0 0 14px;
  letter-spacing: 0;
  line-height: 1.14;
}

h1 { font-size: 28px; font-weight: 750; }
h2 { margin-top: 24px; font-size: 17px; font-weight: 750; }
p { margin: 0 0 14px; color: var(--muted); }
strong { color: var(--text); font-weight: 750; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.brand::before {
  content: "";
  width: 12px;
  height: 12px;
  margin-right: 10px;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 14px;
  flex-wrap: wrap;
}

.nav a,
.link-button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
}

.nav a:hover,
.link-button:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
  text-decoration: none;
}

.page {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar h1 { margin-bottom: 0; }

form.toolbar {
  justify-content: flex-start;
  padding: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.button,
button {
  min-height: 36px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 750;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(17, 106, 91, 0.18);
}

.button:hover,
button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
  text-decoration: none;
}

.button.secondary,
button.secondary {
  color: var(--text);
  background: #fff;
  border-color: var(--line-strong);
  box-shadow: none;
}

.button.secondary:hover,
button.secondary:hover {
  background: var(--panel-soft);
  color: var(--accent-strong);
}

.button.danger,
button.danger {
  background: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 8px 18px rgba(180, 35, 24, 0.16);
}

.button.danger:hover,
button.danger:hover {
  background: #8f1d14;
  border-color: #8f1d14;
}

.link-button {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.inline-form {
  display: inline-flex;
  margin: 2px 4px 2px 0;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

.table tr:last-child td { border-bottom: 0; }

.table th {
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.table tbody tr:hover { background: #fbfcfb; }

.task-row {
  --priority-accent: var(--line-strong);
  --priority-row-bg: #fbfcfb;
  box-shadow: inset 4px 0 0 var(--priority-accent);
}

.task-row:hover { background: var(--priority-row-bg); }

.priority-row-low {
  --priority-accent: #6d8191;
  --priority-row-bg: #f4f7fa;
}

.priority-row-normal {
  --priority-accent: #1f9d74;
  --priority-row-bg: #f1fbf6;
}

.priority-row-high {
  --priority-accent: #d37a00;
  --priority-row-bg: #fff7e6;
}

.priority-row-urgent {
  --priority-accent: #cf2e22;
  --priority-row-bg: #fff3f0;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.priority {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px 4px 8px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.priority::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.priority-low {
  background: #e6edf3;
  border: 1px solid #aebdcc;
  color: #2f4858;
}

.priority-normal {
  background: #d7f4e6;
  border: 1px solid #80d0ae;
  color: #0b654a;
}

.priority-high {
  background: #ffd889;
  border: 1px solid #e29a18;
  color: #7a3f00;
}

.priority-urgent {
  background: #ffbdb4;
  border: 1px solid #e4685c;
  color: #96190f;
}

.filters {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.filters summary {
  min-height: 42px;
  padding: 11px 12px;
  color: var(--accent-strong);
  font-weight: 800;
  cursor: pointer;
  list-style-position: inside;
}

.filters form.toolbar {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
}

.action-drawer {
  max-width: 760px;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow: hidden;
}

.action-drawer summary {
  min-height: 40px;
  padding: 10px 12px;
  color: var(--accent-strong);
  font-weight: 800;
  cursor: pointer;
  list-style-position: inside;
}

.action-drawer .form-grid {
  max-width: none;
  margin: 0;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.action-drawer-complete {
  border-color: var(--accent);
  background: #fff;
}

.action-drawer-complete summary {
  color: #fff;
  background: var(--accent);
  text-align: center;
  list-style: none;
}

.action-drawer-complete summary::marker,
.action-drawer-complete summary::-webkit-details-marker {
  display: none;
  content: "";
}

.action-drawer-complete summary:hover {
  background: var(--accent-strong);
}

.message {
  margin-bottom: 14px;
  padding: 11px 13px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.message.error {
  background: #fef3f2;
  color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  font: inherit;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(17, 106, 91, 0.14);
  border-color: var(--accent);
}

.toolbar select {
  width: auto;
  min-width: 150px;
}

.form-grid {
  display: grid;
  gap: 12px;
  max-width: 760px;
  margin-bottom: 16px;
}

.form-grid p { margin: 0; color: var(--text); }
.form-grid label,
.form-grid p label {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 750;
}

.field label { display: block; font-weight: 750; margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; }

.priority-choice-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
}

.priority-choice {
  display: flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
}

.priority-choice input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.priority-choice .priority {
  justify-content: center;
  width: 100%;
  min-height: 40px;
  border-radius: 7px;
}

.priority-choice input:checked + .priority {
  outline: 3px solid rgba(17, 106, 91, 0.22);
  box-shadow: 0 8px 18px rgba(32, 45, 36, 0.12);
}

.priority-choice input:focus-visible + .priority {
  outline: 3px solid rgba(17, 106, 91, 0.28);
}

.hint {
  margin: 0;
  color: var(--warning);
  font-weight: 750;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.checklist-item {
  display: grid;
  gap: 4px;
  margin: 8px 0;
}

.checklist-toggle-form {
  margin: 0;
}

.checklist-toggle-form label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
}

.checklist-toggle-form input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  accent-color: var(--accent);
}

.checklist-item.is-done span {
  color: var(--muted);
  text-decoration: line-through;
}

.checklist-item small {
  color: var(--muted);
  padding-left: 30px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 10px 26px rgba(32, 45, 36, 0.06);
}

.card h2 {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 30px;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

ul {
  margin: 0 0 16px;
  padding-left: 20px;
}

li { margin: 6px 0; }

@media (max-width: 760px) {
  body { font-size: 14px; }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .brand { min-height: 30px; }

  .nav {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }

  .nav a,
  .link-button {
    min-height: 32px;
    padding: 6px 9px;
    background: var(--panel-soft);
  }

  .nav .inline-form {
    display: inline-flex;
    width: auto;
    margin: 0;
  }

  .nav .link-button {
    width: auto;
    justify-content: flex-start;
  }

  .page { padding: 12px; }
  .panel { padding: 14px; }
  h1 { font-size: 22px; }
  h2 { font-size: 16px; }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar > * { width: 100%; }
  .toolbar select,
  .toolbar button,
  .toolbar .button {
    width: 100%;
  }

  .button,
  button {
    width: 100%;
    justify-content: center;
  }

  .inline-form {
    display: block;
    width: 100%;
    margin: 6px 0;
  }

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

  .table {
    display: block;
    border: 0;
    background: transparent;
  }

  .table thead { display: none; }
  .table tbody { display: grid; gap: 10px; }
  .table tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow:
      inset 4px 0 0 var(--priority-accent),
      0 8px 22px rgba(32, 45, 36, 0.06);
    overflow: hidden;
  }

  .table td {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    text-align: right;
  }

  .table td:last-child { border-bottom: 0; }

  .table td::before {
    content: attr(data-label);
    flex: 0 0 42%;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-align: left;
    text-transform: uppercase;
  }

  .table td[colspan] {
    display: block;
    text-align: left;
  }

  .table td[colspan]::before { content: ""; display: none; }
}

@media (max-width: 430px) {
  .cards { grid-template-columns: 1fr; }
}
