.backlog-page {
  --inbox: #9aa5b5;
  --planned: #70efff;
  --progress: #ffb84d;
  --review: #c69aff;
  --blocked: #ff766d;
  --done: #7dffb0;
}

.backlog-shell { width: min(1720px, calc(100% - 24px)); }
.backlog-page .brand { color: inherit; text-decoration: none; }
.backlog-page .primary {
  color: #0c0e13;
  border-color: rgba(255,184,77,.7);
  background: linear-gradient(135deg, #ffe0a1, #ffb84d);
}
.backlog-page .quiet { color: var(--muted); background: transparent; }

.backlog-hero {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(520px, 1.2fr);
  align-items: end;
  gap: 26px;
  padding: clamp(24px, 4vw, 46px);
  border-radius: 34px;
  overflow: hidden;
}
.backlog-hero h2,
.board-head h2,
.dialog-title h2 {
  margin: 0;
  line-height: .92;
  letter-spacing: -.06em;
}
.backlog-hero h2 { font-size: clamp(46px, 7vw, 96px); }
.backlog-hero p.muted { max-width: 680px; font-size: 17px; line-height: 1.55; }

.backlog-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.summary-card {
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.055);
}
.summary-card span { color: var(--muted); font-size: 13px; font-weight: 850; }
.summary-card strong {
  display: block;
  margin-top: 14px;
  font-size: 40px;
  line-height: .8;
  letter-spacing: -.06em;
}

.filters {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(150px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 16px;
  border-radius: 26px;
}
.filters label,
.task-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
}
.filters select,
.task-form select,
.task-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 15px;
  color: var(--text);
  background: rgba(255,255,255,.075);
  font: inherit;
  outline: none;
}
.task-form textarea { resize: vertical; line-height: 1.5; }

.board-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 4px 0;
}
.board-head h2 { font-size: clamp(34px, 5vw, 64px); }

.kanban-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(290px, 1fr));
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  padding: 2px 2px 18px;
}
.kanban-column {
  min-height: 420px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(16,18,24,.66);
  scroll-snap-align: start;
}
.column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 5px 4px 10px;
  border-bottom: 1px solid var(--line);
}
.column-title { display: flex; align-items: center; gap: 9px; font-weight: 950; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--status-color); box-shadow: 0 0 16px var(--status-color); }
.column-count {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.07);
  font-weight: 900;
}
.column-items { display: grid; gap: 10px; min-height: 320px; align-content: start; }
.column-items.drag-over { outline: 2px dashed var(--status-color); outline-offset: 3px; border-radius: 18px; }

.task-card {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: inherit;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--status-color) 17%, transparent), transparent 44%),
    rgba(255,255,255,.06);
  box-shadow: 0 12px 28px rgba(0,0,0,.12);
  cursor: pointer;
}
.task-card:hover { border-color: color-mix(in srgb, var(--status-color) 55%, var(--line)); transform: translateY(-2px); }
.task-card.dragging { opacity: .45; transform: rotate(1deg) scale(.98); }
.task-top,
.task-meta,
.task-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.priority-badge,
.area-badge,
.estimate-badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.055);
  font-size: 11px;
  font-weight: 950;
}
.priority-badge[data-priority="P0"] { color: #ffd3cf; border-color: rgba(255,118,109,.52); background: rgba(255,118,109,.12); }
.priority-badge[data-priority="P1"] { color: #ffe3b0; border-color: rgba(255,184,77,.48); background: rgba(255,184,77,.1); }
.task-card h3 { margin: 0; font-size: 17px; line-height: 1.28; letter-spacing: -.02em; }
.task-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.42; }
.task-footer small { color: var(--muted-2); }
.task-card select {
  max-width: 132px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: #23262e;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
}

.backlog-dialog {
  width: min(980px, calc(100% - 24px));
  max-height: min(92svh, 980px);
  padding: 0;
  border-radius: 30px;
  color: var(--text);
  overflow: auto;
}
.backlog-dialog::backdrop { background: rgba(3,4,8,.72); backdrop-filter: blur(12px); }
.dialog-close-row {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  height: 0;
}
.icon-button {
  width: 42px;
  height: 42px;
  margin: 14px;
  padding: 0;
  border-radius: 50%;
  font-size: 26px;
  background: rgba(14,16,22,.86);
}
.task-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: clamp(24px, 5vw, 54px);
}
.task-form .wide,
.dialog-title,
.form-actions { grid-column: 1 / -1; }
.dialog-title h2 { font-size: clamp(40px, 6vw, 76px); }
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 8px;
}

.detail-layout { display: grid; gap: 20px; padding: clamp(24px, 5vw, 54px); }
.detail-title { padding-right: 50px; }
.detail-title h2 { margin: 4px 0 12px; font-size: clamp(34px, 5vw, 68px); line-height: .98; letter-spacing: -.055em; }
.detail-title p { margin: 0; color: var(--muted); line-height: 1.55; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); gap: 16px; }
.detail-panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.045);
}
.detail-panel h3 { margin: 0 0 12px; }
.criteria-text { white-space: pre-wrap; color: var(--muted); line-height: 1.55; }
.comment-list,
.event-history { display: grid; gap: 8px; max-height: 280px; overflow: auto; }
.comment,
.history-row { padding: 11px; border-radius: 14px; background: rgba(255,255,255,.055); }
.comment b,
.history-row b { display: block; margin-bottom: 4px; }
.comment small,
.history-row small { color: var(--muted-2); }
.comment p { margin: 7px 0 0; white-space: pre-wrap; line-height: 1.45; }
.comment-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; }
.comment-form input { width: 100%; }

@media (max-width: 1100px) {
  .backlog-hero { grid-template-columns: 1fr; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-field { grid-column: 1 / -1; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .backlog-shell { width: calc(100% - 12px); }
  .backlog-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .kanban-board { grid-template-columns: repeat(6, minmax(84vw, 1fr)); }
  .task-form { grid-template-columns: 1fr; padding: 24px 16px; }
  .task-form .wide,
  .dialog-title,
  .form-actions { grid-column: auto; }
  .form-actions,
  .comment-form { grid-template-columns: 1fr; display: grid; }
  .backlog-dialog { width: calc(100% - 12px); }
  .detail-layout { padding: 28px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .task-card:hover,
  .button-link:hover,
  button:hover { transform: none; }
}
