:root {
  color-scheme: light;
  --pm-bg: #f8f9fa;
  --pm-card-bg: #ffffff;
  --pm-border: #e5e7eb;
  --pm-border-hover: #abb6c2;
  --pm-radius: 10px;
  --pm-radius-btn: 8px;
  --pm-gap: 8px;
  --pm-text: #212529;
  --pm-text-2: #2c3e50;
  --pm-muted: #8a94a0;
  --pm-placeholder: #aeb6bf;
  --pm-accent: #18bc9c;
  --pm-done-bg: #e8f7f1;
  --pm-done-border: #cdeae0;
  --pm-rail: #cbd5df;
  --pm-active: #64748b;
  --pm-warn: #f39c12;
  --pm-danger: #c0392b;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--pm-bg);
  color: var(--pm-text);
  font: 14px/1.5 "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

button,
input,
select,
textarea {
  min-width: 0;
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-btn);
  font: inherit;
  letter-spacing: 0;
}

button {
  min-height: 32px;
  padding: 5px 11px;
  background: var(--pm-bg);
  color: var(--pm-text-2);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  white-space: nowrap;
}

button:hover:not(:disabled) {
  border-color: var(--pm-border-hover);
  background: #eef1f4;
}

button:disabled {
  color: var(--pm-placeholder);
  cursor: not-allowed;
  opacity: .68;
}

input,
select,
textarea {
  background: #fff;
  color: var(--pm-text);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--pm-placeholder);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--pm-accent);
}

.pm-stage {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  gap: var(--pm-gap);
  overflow: hidden;
  padding: var(--pm-gap);
  background: var(--pm-bg);
  color: var(--pm-text-2);
}

.pm-topbar {
  display: flex;
  min-height: 46px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius);
  background: #fff;
}

.pm-brand {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 12px;
}

.pm-brand h1 {
  color: var(--pm-text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.pm-brand p {
  overflow: hidden;
  color: var(--pm-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-top-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.pm-tb-btn {
  font-size: 13px;
}

.pm-topbar-peek {
  display: none;
  min-height: 14px;
  height: 14px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  padding: 0;
}

.pm-topbar-peek span {
  display: block;
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: #cdd4db;
}

.pm-stage.pm-topbar-hidden .pm-topbar {
  display: none;
}

.pm-stage.pm-topbar-hidden .pm-topbar-peek {
  display: flex;
}

.pm-tabs {
  display: flex;
  min-height: 38px;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 1px;
}

.pm-tabs > button {
  height: 34px;
  flex: 0 0 auto;
  padding: 5px 13px;
  color: #6b7785;
  font-size: 13px;
  font-weight: 600;
}

.pm-tabs > button.active {
  border-color: #16140f;
  background: #fff;
  box-shadow: inset 0 0 0 1px #16140f;
  color: #16140f;
}

.pm-project-target {
  display: flex;
  min-height: 24px;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  padding: 0 2px;
  color: var(--pm-muted);
  font-size: 12px;
}

.pm-project-target[hidden] {
  display: none;
}

.pm-project-target-label {
  flex: 0 0 auto;
  color: #5f6b78;
  font-weight: 700;
}

.pm-project-target-value {
  min-width: 0;
  overflow: hidden;
  color: #127f69;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.pm-project-target-value:hover {
  text-decoration: underline;
}

.pm-plus-tab {
  width: 36px;
  padding-inline: 0;
  font-size: 17px;
  line-height: 1;
}

.pm-tab-create {
  display: flex;
  height: 34px;
  flex: 0 0 auto;
  align-items: stretch;
  gap: 6px;
}

.pm-tab-create input {
  height: 34px;
  padding: 6px 9px;
  font-size: 13px;
}

.pm-tab-create input[name="name"] {
  width: 180px;
}

.pm-tab-create input[name="url"] {
  width: min(330px, 34vw);
}

.pm-tab-create button {
  height: 34px;
  font-size: 13px;
  font-weight: 600;
}

.pm-first-project input[name="name"] {
  width: 220px;
}

.pm-board {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--pm-gap);
}

.pm-composer {
  display: grid;
  min-height: 76px;
  flex: 0 0 auto;
  grid-template-columns: minmax(240px, 1fr) minmax(0, 740px);
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius);
  background: #fff;
}

.pm-composer textarea {
  grid-column: 1;
  grid-row: 1;
  min-height: 58px;
  max-height: 140px;
  resize: vertical;
  padding: 8px 10px;
  border-color: transparent;
  background: transparent;
  font-size: 14px;
}

.pm-goal-attachments {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 8px;
}

.pm-goal-attachments[hidden] {
  display: none;
}

.pm-goal-attachment {
  display: inline-flex;
  max-width: 360px;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border: 1px solid var(--pm-border);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--pm-text-2);
  font-size: 12px;
}

.pm-goal-attachment img {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 5px;
  object-fit: cover;
}

.pm-goal-attachment span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-goal-attachment button {
  min-height: 26px;
  flex: 0 0 auto;
  padding: 3px 7px;
  font-size: 11px;
}

.pm-composer-actions {
  display: flex;
  grid-column: 2;
  grid-row: 1;
  align-items: stretch;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.pm-composer select {
  flex: 1 1 158px;
  width: auto;
  max-width: 178px;
  padding: 5px 9px;
  color: var(--pm-text-2);
  font-size: 13px;
}

.pm-composer button {
  flex: 0 0 auto;
  min-width: 84px;
  border-color: var(--pm-accent);
  background: var(--pm-accent);
  color: #fff;
  font-weight: 700;
}

.pm-composer button.pm-secondary-action {
  border-color: var(--pm-border);
  background: #fff;
  color: var(--pm-text-2);
}

.pm-grid {
  display: grid;
  min-height: 0;
  flex: 1 1 auto;
  align-content: start;
  align-items: start;
  gap: var(--pm-gap);
  grid-auto-rows: max-content;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  overflow: auto;
  padding-bottom: 8px;
}

.pm-card {
  position: relative;
  display: flex;
  min-height: 248px;
  min-width: 0;
  flex-direction: column;
  gap: 9px;
  overflow: visible;
  padding: 10px;
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius);
  background: var(--pm-card-bg);
  cursor: pointer;
  transition: border-color .15s ease, background .2s ease, box-shadow .15s ease;
}

.pm-card:hover {
  border-color: var(--pm-border-hover);
}

.pm-card:focus-visible {
  border-color: var(--pm-accent);
  outline: 2px solid rgba(24, 188, 156, .28);
  outline-offset: 1px;
}

.pm-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: transparent;
  content: "";
}

.pm-card[data-state="running"]::before,
.pm-card[data-state="crystallizing"]::before,
.pm-card[data-state="merging"]::before {
  background: var(--pm-active);
}

.pm-card[data-state="queued"]::before {
  background: var(--pm-warn);
}

.pm-card[data-state="ready"],
.pm-card[data-state="needs-answers"],
.pm-card[data-state="proven"],
.pm-card[data-state="merged"] {
  border-color: var(--pm-done-border);
  background: var(--pm-done-bg);
}

.pm-card[data-state="ready"]::before,
.pm-card[data-state="needs-answers"]::before,
.pm-card[data-state="proven"]::before,
.pm-card[data-state="merged"]::before {
  background: var(--pm-rail);
}

.pm-card[data-state="not-achieved"]::before,
.pm-card[data-state="merge-error"]::before,
.pm-card[data-state="merge-review"]::before {
  background: var(--pm-danger);
}

.pm-card-body {
  display: flex;
  min-height: 0;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 8px;
}

.pm-card-head {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.pm-card h2 {
  display: -webkit-box;
  overflow: hidden;
  color: var(--pm-text);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow-wrap: anywhere;
}

.pm-chip {
  flex: 0 0 auto;
  border: 1px solid var(--pm-border);
  border-radius: 999px;
  background: var(--pm-bg);
  color: var(--pm-muted);
  padding: 2px 7px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  white-space: nowrap;
}

.pm-card[data-state="ready"] .pm-chip,
.pm-card[data-state="needs-answers"] .pm-chip,
.pm-card[data-state="proven"] .pm-chip,
.pm-card[data-state="merged"] .pm-chip {
  border-color: var(--pm-done-border);
  background: #fff;
  color: #127f69;
}

.pm-card[data-state="merging"] .pm-chip {
  border-color: rgba(100, 116, 139, .28);
  background: #fff;
  color: var(--pm-active);
}

.pm-card[data-state="queued"] .pm-chip {
  border-color: rgba(243, 156, 18, .35);
  background: rgba(243, 156, 18, .08);
  color: #8a5a00;
}

.pm-card[data-state="not-achieved"] .pm-chip,
.pm-card[data-state="merge-error"] .pm-chip,
.pm-card[data-state="merge-review"] .pm-chip {
  border-color: rgba(192, 57, 43, .28);
  background: #fff5f4;
  color: var(--pm-danger);
}

.pm-meta {
  overflow: hidden;
  color: var(--pm-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-progress {
  display: flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  padding: 5px 7px;
  border: 1px solid var(--pm-border);
  border-radius: 8px;
  background: #f7f9fb;
  color: #5f6b78;
  font-size: 11px;
}

.pm-progress-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #94a3b8;
}

.pm-progress[data-state="active"] .pm-progress-dot {
  background: var(--pm-accent);
  box-shadow: 0 0 0 4px rgba(24, 188, 156, .12);
}

.pm-progress[data-state="stale"] {
  border-color: rgba(243, 156, 18, .35);
  background: rgba(243, 156, 18, .07);
  color: #8a5a00;
}

.pm-progress[data-state="stale"] .pm-progress-dot {
  background: var(--pm-warn);
}

.pm-progress-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-feedback-status {
  min-height: 26px;
  overflow: hidden;
  padding: 5px 7px;
  border: 1px solid rgba(24, 188, 156, .25);
  border-radius: 8px;
  background: #f1fbf7;
  color: #127f69;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-feedback-status[hidden] {
  display: none;
}

.pm-contract {
  overflow: auto;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--pm-border);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--pm-text);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.pm-card .pm-contract {
  flex: 0 0 auto;
  min-height: 150px;
  max-height: 240px;
}

.pm-contract:empty,
.pm-contract[hidden],
#modal-contract-section[hidden] {
  display: none;
}

.pm-contract-questions {
  padding: 7px 8px;
  border: 1px solid rgba(243, 156, 18, .35);
  border-radius: 7px;
  background: rgba(243, 156, 18, .07);
}

.pm-contract-part {
  margin: 0 0 10px;
  padding: 0;
}

.pm-contract-part:last-child {
  margin-bottom: 0;
}

.pm-contract-part h4 {
  margin: 0 0 4px;
  color: #5f6b78;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.pm-contract-part p {
  margin: 0;
}

.pm-contract-part ul {
  margin: 0;
  padding-left: 18px;
}

.pm-contract-part li {
  margin: 4px 0;
}

.pm-assumptions {
  padding-left: 0!important;
  list-style: none;
}

.pm-assumptions li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.pm-assumption-text {
  min-width: 0;
  flex: 1 1 auto;
}

.pm-assumption-confidence {
  flex: 0 0 auto;
  padding: 1px 6px;
  border: 1px solid var(--pm-border);
  border-radius: 999px;
  background: #fff;
  color: #5f6b78;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.pm-card-actions,
.feedback {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.pm-card-actions button,
.feedback button {
  font-size: 12px;
}

.pm-card-actions {
  position: relative;
}

.launch {
  border-color: var(--pm-accent);
  background: #fdfffe;
  color: #127f69;
  font-weight: 700;
}

.launch:disabled,
.merge:disabled {
  border-color: var(--pm-border);
  background: var(--pm-bg);
  color: var(--pm-placeholder);
  font-weight: 600;
}

.merge {
  margin-left: auto;
}

.feedback-toggle {
  position: relative;
  width: 32px;
  min-width: 32px;
  margin-left: 0;
  padding: 0;
}

.feedback-toggle::before {
  position: absolute;
  inset: 8px 7px 10px;
  border: 2px solid currentColor;
  border-radius: 5px;
  content: "";
}

.feedback-toggle::after {
  position: absolute;
  right: 8px;
  bottom: 7px;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  background: var(--pm-card-bg);
  content: "";
  transform: skew(20deg);
}

.feedback-toggle[aria-expanded="true"] {
  border-color: var(--pm-accent);
  background: #f1fbf7;
  color: #127f69;
}

.feedback {
  position: absolute;
  right: 10px;
  bottom: 48px;
  z-index: 5;
  width: min(360px, calc(100% - 20px));
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--pm-border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(33, 37, 41, .18);
  cursor: default;
}

.feedback[hidden] {
  display: none;
}

.feedback input {
  min-width: 0;
  flex: 1 1 auto;
  padding: 6px 9px;
  font-size: 12px;
}

.feedback button {
  flex: 0 0 auto;
}

.dev-link,
.handoff {
  display: block;
  overflow: hidden;
  color: #127f69;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-notice {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 50;
  max-width: min(520px, calc(100vw - 28px));
  padding: 9px 12px;
  border: 1px solid var(--pm-done-border);
  border-radius: 8px;
  background: #f1fbf7;
  box-shadow: 0 10px 28px rgba(33, 37, 41, .16);
  color: #127f69;
  font-size: 13px;
}

.pm-notice[data-kind="error"] {
  border-color: rgba(192, 57, 43, .28);
  background: #fff5f4;
  color: var(--pm-danger);
}

.pm-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  background: rgba(248, 249, 250, .96);
}

.pm-modal[hidden],
.pm-notice[hidden] {
  display: none;
}

.pm-modal-panel {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  padding: 18px 20px 32px;
  background: #fff;
}

.pm-modal-head {
  display: flex;
  width: min(1180px, 100%);
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: 0 auto;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--pm-border);
}

.pm-modal-head > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
}

.pm-modal-head h2 {
  color: var(--pm-text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.pm-modal-meta {
  width: min(1180px, 100%);
  flex: 0 0 auto;
  margin: 0 auto;
  overflow-wrap: anywhere;
  color: var(--pm-muted);
  font-size: 12px;
}

.pm-modal-section {
  display: flex;
  width: min(1180px, 100%);
  flex: 0 0 auto;
  flex-direction: column;
  gap: 6px;
  margin: 0 auto;
}

.pm-modal-section h3 {
  margin: 0;
  color: var(--pm-text-2);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.pm-modal-text {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 0 16px;
  border: 0;
  border-bottom: 1px solid var(--pm-border);
  border-radius: 0;
  background: transparent;
  color: var(--pm-text);
  font: 15px/1.62 "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  white-space: normal;
  overflow-wrap: anywhere;
}

.pm-modal-text p {
  max-width: 92ch;
  margin: 0 0 10px;
}

.pm-modal-text p:last-child,
.pm-modal-text ul:last-child,
.pm-modal-text ol:last-child {
  margin-bottom: 0;
}

.pm-modal-text h4 {
  margin: 19px 0 8px;
  padding: 0;
  border: 0;
  color: #18202a;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.pm-modal-text h4:first-child {
  margin-top: 0;
}

.pm-modal-text ul,
.pm-modal-text ol {
  max-width: 98ch;
  margin: 0 0 10px;
  padding-left: 22px;
}

.pm-modal-text li {
  margin: 5px 0;
}

.pm-modal-long {
  font-size: 15px;
}

.pm-modal-text code {
  padding: 1px 4px;
  border-radius: 4px;
  background: #f2f4f6;
  color: #2f3945;
  font-family: "Roboto Mono", Consolas, Monaco, monospace;
  font-size: .88em;
}

.pm-modal-text strong {
  font-weight: 700;
}

.pm-modal-runtime {
  padding: 10px 0 0;
  border-bottom: 0;
  background: transparent;
  color: #46515f;
  font-size: 12px;
}

.pm-runtime-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid #edf0f3;
}

.pm-runtime-row:last-child {
  border-bottom: 0;
}

.pm-runtime-key {
  color: var(--pm-muted);
  font-weight: 700;
}

.pm-runtime-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .pm-composer {
    grid-template-columns: 1fr;
  }

  .pm-composer textarea,
  .pm-composer-actions {
    grid-column: 1;
    grid-row: auto;
  }

  .pm-composer-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .pm-composer select {
    flex: 1 1 190px;
    max-width: none;
  }

  .pm-composer button {
    margin-left: auto;
  }
}

@media (max-width: 620px) {
  .pm-stage {
    padding: 6px;
  }

  .pm-topbar,
  .pm-brand,
  .pm-top-actions,
  .pm-card-actions,
  .feedback {
    align-items: stretch;
    flex-direction: column;
  }

  .pm-tab-create {
    height: auto;
    flex-wrap: wrap;
  }

  .pm-tab-create input[name="name"],
  .pm-tab-create input[name="url"] {
    width: min(260px, 70vw);
  }

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

  .feedback {
    right: 8px;
    left: 8px;
    bottom: 46px;
    width: auto;
    align-items: center;
    flex-direction: row;
  }

  .pm-composer button {
    flex: 1 1 100%;
    margin-left: 0;
  }

  .merge {
    margin-left: 0;
  }
}
