.projects-section {
  --project-purple: #6f5ee8;
  --project-ink: #252c41;
  --project-muted: #858da1;
  padding: 0 0 44px;
  color: var(--project-ink);
}

.projects-section button,
.project-dialog,
.project-attach-dialog {
  font-family: "Noto Sans SC", sans-serif;
}

.projects-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
}

.projects-header h2 {
  margin: 2px 0 5px;
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 750;
  line-height: 1.16;
  letter-spacing: -.055em;
}

.projects-header > div > p:last-child {
  max-width: 560px;
  margin: 0;
  color: var(--project-muted);
  font-size: 13px;
  line-height: 1.65;
}

.projects-primary {
  min-height: 38px;
  padding: 0 15px !important;
  border: 1px solid #6f5ee8 !important;
  border-radius: 10px !important;
  background: linear-gradient(145deg, #7a68ef, #6857dd) !important;
  box-shadow: 0 7px 16px rgba(103, 87, 220, .2), inset 0 1px rgba(255, 255, 255, .22);
  color: #fff !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: .01em;
}

.projects-primary:hover {
  box-shadow: 0 10px 22px rgba(103, 87, 220, .28), inset 0 1px rgba(255, 255, 255, .26);
  transform: translateY(-1px);
}

.projects-layout {
  display: grid;
  grid-template-columns: minmax(220px, 268px) minmax(0, 1fr);
  min-height: 520px;
  overflow: hidden;
  border: 1px solid #e2e4ec;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(42, 48, 75, .07);
}

.projects-list-panel {
  min-width: 0;
  padding: 22px 14px;
  border-right: 1px solid #e7e8ef;
  background: linear-gradient(180deg, #fbfbfe 0%, #f7f7fb 100%);
}

.projects-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 9px 15px;
}

.projects-list-heading strong {
  color: #555e75;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .02em;
}

.projects-count {
  color: #9aa0b1;
  font: 500 10px "DM Mono", monospace;
}

.projects-list {
  display: grid;
  gap: 7px;
}

.project-list-item {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-width: 0;
  padding: 11px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #30374d;
  cursor: grab;
  text-align: left;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease;
}

.project-list-item.is-dragging {
  opacity: .35;
  cursor: grabbing;
  transform: scale(.985);
}

.project-list-item:hover {
  border-color: #e1def7;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 6px 15px rgba(52, 59, 87, .05);
  transform: translateY(-1px);
}

.project-list-item.is-selected {
  border-color: #d8d2fb;
  background: #f0edff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .58), 0 6px 14px rgba(103, 87, 220, .08);
}

.project-list-item > i {
  width: 7px;
  height: 39px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(43, 49, 72, .05);
}

.project-list-item > span { min-width: 0; }

.project-list-item > span strong,
.project-list-item > span small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-list-item > span strong {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.015em;
}

.project-list-item > span small {
  margin-top: 4px;
  color: #969daf;
  font-size: 10px;
}

.project-list-item > b {
  display: grid;
  min-width: 36px;
  justify-items: center;
  color: #7463dd;
  font-weight: 600;
}

.project-list-item > b em {
  font: 600 12px "DM Mono", monospace;
  font-style: normal;
}

.project-list-item > b small {
  color: #a0a5b4;
  font-size: 8px;
  font-weight: 500;
}

.project-detail {
  min-width: 0;
  padding: 30px clamp(22px, 3vw, 38px) 34px;
  background: linear-gradient(180deg, #fff 0%, #fdfdff 100%);
}

.project-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.project-title {
  display: flex;
  min-width: 0;
  gap: 15px;
}

.project-title > i {
  width: 8px;
  height: 66px;
  flex: none;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(43, 49, 72, .05);
}

.project-title > div { min-width: 0; }

.project-title h3 {
  max-width: 620px;
  margin: 1px 0 5px;
  overflow-wrap: anywhere;
  font-size: clamp(23px, 2.5vw, 31px);
  font-weight: 760;
  line-height: 1.22;
  letter-spacing: -.045em;
}

.project-description {
  max-width: 670px;
  margin: 0;
  color: var(--project-muted);
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.project-detail-actions,
.project-schedule-toolbar > div:last-child {
  display: flex;
  flex: none;
  gap: 8px;
}

.project-detail-actions button,
.project-schedule-toolbar button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #dfe2eb;
  border-radius: 9px;
  background: #fff;
  color: #5b6479;
  font-size: 11px;
  font-weight: 600;
}

.project-detail-actions button:hover,
.project-schedule-toolbar button:not(.projects-primary):hover {
  border-color: #cfc9f4;
  background: #faf9ff;
  color: #6658c8;
}

.project-detail-actions .is-danger { color: #b6656f; }
.project-detail-actions .is-danger:hover { border-color: #efcfd3; background: #fff7f8; color: #a9505b; }

.project-progress {
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 25px 0 29px;
  padding: 14px 16px;
  border: 1px solid #ececf2;
  border-radius: 13px;
  background: #f8f8fc;
}

.project-progress-copy {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.project-progress-copy span {
  color: #858ca0;
  font-size: 10px;
  font-weight: 600;
}

.project-progress-copy strong {
  color: #6757d5;
  font: 650 17px "DM Mono", monospace;
}

.project-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 9px;
  background: #e5e5ed;
}

.project-progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8171ef, #6857d8);
  box-shadow: 0 0 9px rgba(111, 94, 232, .2);
  transition: width .25s ease;
}

.project-progress > small {
  color: #9097a8;
  font-size: 10px;
  white-space: nowrap;
}

.project-schedule-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 13px;
}

.project-schedule-toolbar > div:first-child {
  display: grid;
  min-width: 0;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 2px 10px;
}

.project-schedule-toolbar .eyebrow {
  grid-column: 1 / -1;
  margin: 0;
}

.project-schedule-toolbar strong {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -.025em;
}

.project-schedule-toolbar span {
  overflow: hidden;
  color: #969daf;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.project-task {
  position: relative;
  display: grid;
  grid-template-columns: 4px 20px 23px minmax(0, 1fr) auto auto;
  align-items: center;
  min-width: 0;
  gap: 10px;
  padding: 10px 11px 10px 9px;
  overflow: hidden;
  border: 1px solid #e4e5ed;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 9px rgba(48, 54, 81, .03);
  cursor: grab;
  user-select: none;
  transition: opacity .15s ease, transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.project-task:hover {
  z-index: 1;
  border-color: #cbc5f2;
  box-shadow: 0 9px 22px rgba(54, 60, 88, .08);
  transform: translateY(-1px);
}

.project-task.is-dragging { opacity: .35; cursor: grabbing; }
.project-task.is-drop-before::before,
.project-task.is-drop-after::after {
  position: absolute;
  z-index: 3;
  right: 8px;
  left: 8px;
  height: 3px;
  border-radius: 4px;
  background: var(--project-purple);
  box-shadow: 0 2px 7px rgba(111, 94, 232, .25);
  content: '';
}
.project-task.is-drop-before::before { top: 0; }
.project-task.is-drop-after::after { bottom: 0; }
.project-task-accent { align-self: stretch; width: 4px; border-radius: 5px; background: var(--task-color); }
.project-task-grip { color: #a3a8b7; cursor: grab; font-size: 18px; line-height: 1; }

.project-task-check {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  padding: 0;
  border: 1.5px solid #8991a4;
  border-radius: 50%;
  background: #fff;
  color: var(--project-purple);
  font-size: 11px;
  font-weight: 800;
}

.project-task-main {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #343b50;
  cursor: grab;
  text-align: left;
}

.project-task-main:active { cursor: grabbing; }
.project-task-check,
.project-task-order button { cursor: pointer; }

.project-task-main strong,
.project-task-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-task-main strong {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.project-task-main small {
  margin-top: 3px;
  color: #9299aa;
  font: 500 9px "DM Mono", "Noto Sans SC", sans-serif;
}

.project-task.is-completed { background: #fbfbfd; opacity: .72; }
.project-task.is-completed .project-task-main strong { color: #999faf; text-decoration: line-through; }

.project-task-category {
  max-width: 92px;
  overflow: hidden;
  padding: 4px 8px;
  border-radius: 7px;
  background: #f1f2f6;
  color: #747c90;
  font-size: 9px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-task-order { display: flex; }

.project-task-order button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #e1e3ea;
  background: #fff;
  color: #737b8e;
  font-size: 12px;
}

.project-task-order button:first-child { border-radius: 7px 0 0 7px; }
.project-task-order button:last-child { margin-left: -1px; border-radius: 0 7px 7px 0; }
.project-task-order button:disabled { opacity: .28; cursor: default; }

.project-trash {
  position: fixed;
  z-index: 80;
  right: auto;
  bottom: 18px;
  left: 50%;
  width: min(680px, calc(100vw - 32px));
  transform: translate(-50%, 12px);
}

body.is-project-dragging .project-trash {
  max-height: 58px;
  min-height: 54px;
  padding: 0 16px;
  border: 1px dashed #b8aef5;
  background: rgba(248, 246, 255, .97);
  box-shadow: 0 16px 38px rgba(65, 54, 139, .18);
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

body.is-project-dragging .project-trash.is-drop-target {
  border-color: #9d8ff0;
  background: #eeeaff;
  color: #5f4fd0;
  box-shadow: 0 18px 42px rgba(65, 54, 139, .24);
}

.projects-empty-list,
.projects-empty-detail {
  display: grid;
  gap: 8px;
  padding: 28px 14px;
  color: #9299aa;
  font-size: 11px;
  text-align: center;
}

.projects-empty-detail { height: 100%; place-content: center; }
.projects-empty-detail > span { color: var(--project-purple); font-size: 34px; }
.projects-empty-detail h3 { margin: 0; color: #343b50; font-size: 19px; letter-spacing: -.025em; }
.projects-empty-detail p { margin: 0 0 10px; }

.project-tasks-empty {
  padding: 42px 20px;
  border: 1px dashed #dfe1ea;
  border-radius: 12px;
  background: #fdfdff;
  color: #969daf;
  font-size: 11px;
  text-align: center;
}

.project-dialog textarea {
  width: 100%;
  padding: 10px 11px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline-color: var(--purple);
}

.project-dialog fieldset { margin: 0; padding: 0; border: 0; }
.project-dialog legend { margin-bottom: 9px; color: #697187; font-size: 12px; }
.project-color-options { display: flex; flex-wrap: wrap; gap: 10px; }
.project-color-options input { position: absolute; opacity: 0; }
.project-color-options span { display: block; width: 30px; height: 30px; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #d8dbe5; cursor: pointer; }
.project-color-options input:checked + span { box-shadow: 0 0 0 2px var(--project-purple); }

.project-dialog-description {
  margin: -2px 0 3px;
  color: #858da0;
  font-size: 11px;
  line-height: 1.65;
}

.project-attach-dialog {
  width: min(600px, calc(100vw - 32px));
  max-width: 600px;
  padding: 28px;
  overflow: hidden;
}

.project-attach-dialog section {
  position: relative;
  display: grid;
  width: auto;
  min-width: 0;
  gap: 12px;
}

.project-attach-dialog h2 { margin: 0; font-size: 22px; letter-spacing: -.035em; }

.project-attach-list {
  display: grid;
  width: 100%;
  min-width: 0;
  max-height: min(58vh, 470px);
  gap: 7px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 2px 3px 2px 0;
}

.project-attach-list button {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr) 48px;
  align-items: center;
  width: 100%;
  min-width: 0;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid #e2e4ed;
  border-radius: 10px;
  background: #fff;
  text-align: left;
}

.project-attach-list button:hover { border-color: #d4cef7; background: #fbfaff; }
.project-attach-list button > i { width: 6px; height: 35px; border-radius: 5px; }
.project-attach-list button > span { min-width: 0; }

.project-attach-list strong,
.project-attach-list small {
  display: block;
  overflow-wrap: anywhere;
  white-space: normal;
}

.project-attach-list strong { color: #343b50; font-size: 12px; font-weight: 700; line-height: 1.5; }
.project-attach-list small { margin-top: 4px; color: #9299aa; font: 500 10px/1.45 "DM Mono", "Noto Sans SC", sans-serif; }
.project-attach-list b { justify-self: end; color: #6c5bd2; font-size: 11px; font-weight: 700; white-space: nowrap; }
.project-attach-empty { margin: 18px 0; color: #9299aa; font-size: 11px; text-align: center; }

@media (max-width: 1100px) {
  .projects-layout { grid-template-columns: minmax(200px, 230px) minmax(0, 1fr); }
  .project-detail { padding-inline: 22px; }
  .project-task { grid-template-columns: 4px 18px 21px minmax(0, 1fr) auto; }
  .project-task-category { display: none; }
}

@media (max-width: 900px) {
  .projects-layout { grid-template-columns: 1fr; }
  .projects-list-panel { border-right: 0; border-bottom: 1px solid #e6e8f0; }
  .projects-list { display: flex; overflow-x: auto; padding-bottom: 3px; }
  .project-list-item { min-width: 210px; max-width: 260px; }
  .project-detail { padding: 23px 18px 28px; }
}

@media (max-width: 620px) {
  .projects-section { padding-bottom: 24px; }
  .projects-header,
  .project-detail-header,
  .project-schedule-toolbar { align-items: stretch; flex-direction: column; }
  .projects-header { gap: 14px; }
  .projects-header .projects-primary { align-self: flex-start; }
  .project-detail-actions,
  .project-schedule-toolbar > div:last-child { justify-content: flex-end; }
  .project-progress { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .project-progress-track { grid-column: 1 / -1; grid-row: 2; }
  .project-progress > small { grid-column: 2; grid-row: 1; }
  .project-task { grid-template-columns: 4px 18px 21px minmax(0, 1fr); gap: 8px; }
  .project-task-order { grid-column: 4; justify-self: end; margin-top: 2px; }
  .project-task-main { grid-column: 4; }
  .project-task-accent { grid-row: 1 / span 2; }
  .project-task-grip,
  .project-task-check { grid-row: 1 / span 2; }
  .project-attach-dialog { width: calc(100vw - 22px); padding: 24px 18px; }
  .project-attach-list button { grid-template-columns: 6px minmax(0, 1fr); align-items: start; }
  .project-attach-list button > i { grid-row: 1 / span 2; height: 100%; min-height: 42px; }
  .project-attach-list b { grid-column: 2; justify-self: start; padding-top: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .projects-section *,
  .projects-section *::before,
  .projects-section *::after { transition-duration: 0s !important; }
}
