:root {
  color-scheme: light;
  --bg: #eef1f4;
  --ink: #17202a;
  --muted: #647180;
  --line: #d7dde4;
  --panel: #ffffff;
  --accent: #247c6d;
  --accent-strong: #185e53;
  --danger: #b42338;
  --warn: #b76e00;
  --shadow: 0 16px 40px rgba(23, 32, 42, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

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

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

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.summary span {
  min-width: 112px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  color: var(--muted);
  text-align: right;
}

.summary strong {
  display: block;
  color: var(--ink);
  font-size: 1.25rem;
}

.composer,
.tools,
.item {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.composer {
  padding: 14px;
}

#addForm {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 130px 48px;
  gap: 10px;
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
}

label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #f9fafb;
  color: var(--ink);
  border-radius: 7px;
  outline: none;
}

input,
select {
  height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 44px;
  resize: vertical;
  padding: 11px 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(36, 124, 109, 0.14);
}

button {
  height: 44px;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.primary {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-strong);
}

.tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
  padding: 12px;
  box-shadow: none;
}

.segments {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f9fafb;
}

.segment {
  height: 38px;
  padding: 0 14px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segment.active {
  background: var(--ink);
  color: #fff;
}

.search {
  position: relative;
  width: min(320px, 100%);
}

.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
}

.search input {
  padding-left: 38px;
}

.board {
  display: grid;
  gap: 10px;
}

.item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) minmax(260px, 330px);
  gap: 12px;
  align-items: start;
  padding: 12px;
  box-shadow: none;
}

.item.done {
  opacity: 0.72;
}

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

.check {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #f9fafb;
  color: transparent;
}

.done .check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.item-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.item-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.item-title {
  font-weight: 780;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ecfdf5;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.badge.high {
  background: #fff2dc;
  color: var(--warn);
}

.badge.low {
  background: #eef4ff;
  color: #315b99;
}

.item-notes {
  min-height: 44px;
}

.item-actions {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(100px, 1fr) 44px;
  gap: 8px;
}

.danger {
  display: grid;
  place-items: center;
  border: 1px solid #ffd6dd;
  background: #fff5f7;
  color: var(--danger);
}

.danger:hover {
  background: #ffe8ed;
}

.empty {
  margin: 30px 0 0;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 20px, 680px);
    padding: 20px 0;
  }

  .topbar,
  .tools {
    align-items: stretch;
    flex-direction: column;
  }

  .summary {
    justify-content: stretch;
  }

  .summary span {
    flex: 1;
    text-align: left;
  }

  #addForm,
  .item {
    grid-template-columns: 1fr;
  }

  .primary {
    width: 100%;
  }

  .segments {
    width: 100%;
  }

  .search {
    width: 100%;
  }

  .check {
    width: 44px;
  }

  .item-actions {
    grid-template-columns: 1fr 1fr 44px;
  }
}

@media (max-width: 460px) {
  .item-actions {
    grid-template-columns: 1fr;
  }

  .danger {
    width: 44px;
  }
}
