:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-alt: #f0f4f8;
  --ink: #162033;
  --muted: #637083;
  --line: #d9e0ea;
  --blue: #2463eb;
  --teal: #0f766e;
  --green: #15803d;
  --amber: #b45309;
  --red: #b42318;
  --violet: #6d28d9;
  --shadow: 0 18px 48px rgba(22, 32, 51, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button,
table {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1360px, calc(100vw - 32px));
  margin: 8px auto 28px;
}

.topbar {
  min-height: 54px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 2px 0 8px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(22px, 2.8vw, 34px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: 0;
}

.release-chip {
  min-width: 170px;
  display: grid;
  gap: 2px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(22, 32, 51, 0.06);
}

.release-chip span,
.metric-label,
.flow-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

main {
  display: grid;
  gap: 14px;
}

.overview-band,
.workflow-band,
.phase-panel,
.documents-panel,
.transitions-panel,
.matrix-band,
.moment-test-band {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(22, 32, 51, 0.05);
}

.overview-band {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  overflow: hidden;
}

.overview-copy {
  padding: 12px 16px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.82)),
    url("https://images.unsplash.com/photo-1552664730-d307ca884978?auto=format&fit=crop&w=1400&q=80") center/cover;
}

.overview-copy h2 {
  max-width: 740px;
  font-size: clamp(19px, 2vw, 26px);
  line-height: 1.08;
}

.overview-copy p {
  max-width: 760px;
  margin-top: 6px;
  color: #3f4b5f;
  font-size: 13px;
  line-height: 1.35;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  background: var(--ink);
  color: #ffffff;
}

.metric-strip div {
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: 58px;
  padding: 8px 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

.metric-strip div:last-child {
  border-right: 0;
}

.metric-value {
  font-size: 24px;
  font-weight: 850;
  line-height: 1;
}

.metric-label {
  color: #aeb9c9;
}

.metric-detail {
  color: #d8e0ec;
  font-size: 11px;
  font-weight: 750;
}

.workflow-band,
.matrix-band,
.moment-test-band {
  padding: 22px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.section-heading.compact {
  margin-bottom: 14px;
}

.workflow-heading-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.status-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 680px;
}

.status-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #344154;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 750;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--blue);
}

.dot-open,
.mini-open,
.status-open {
  background: #fef3c7;
  color: #92400e;
}

.dot-analysis,
.mini-analysis,
.status-analysis {
  background: #dbeafe;
  color: #1d4ed8;
}

.dot-review,
.mini-review,
.status-review {
  background: #ede9fe;
  color: #5b21b6;
}

.dot-development,
.mini-development,
.status-development {
  background: #dcfce7;
  color: #166534;
}

.dot-test,
.mini-test,
.status-test {
  background: #ccfbf1;
  color: #0f766e;
}

.dot-uat,
.mini-uat,
.status-uat {
  background: #fce7f3;
  color: #9d174d;
}

.dot-approval,
.mini-approval,
.status-approval {
  background: #fee2e2;
  color: #991b1b;
}

.dot-deploy,
.mini-deploy,
.status-deploy {
  background: #ffedd5;
  color: #9a3412;
}

.dot-closed,
.mini-closed,
.status-closed {
  background: #e2e8f0;
  color: #334155;
}

.status-legend .dot {
  color: transparent;
}

.dot-open {
  background: var(--amber);
}

.dot-analysis {
  background: var(--blue);
}

.dot-review {
  background: var(--violet);
}

.dot-development {
  background: var(--green);
}

.dot-test {
  background: var(--teal);
}

.dot-uat {
  background: #db2777;
}

.dot-approval {
  background: var(--red);
}

.dot-deploy {
  background: #ea580c;
}

.dot-closed {
  background: #64748b;
}

.phase-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.phase-node {
  min-height: 124px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--ink);
  text-align: left;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.phase-node:hover,
.phase-node.is-selected {
  border-color: var(--blue);
  box-shadow: 0 10px 24px rgba(36, 99, 235, 0.14);
  transform: translateY(-1px);
}

.phase-number {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-alt);
  color: #42526a;
  font-weight: 850;
  font-size: 13px;
}

.phase-node-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.phase-node-copy strong {
  font-size: 15px;
  line-height: 1.2;
}

.phase-node-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.workflow-status-area {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.mini-status,
.status-pill,
.requirement,
.doc-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
}

.mini-status {
  grid-column: 1 / -1;
  align-self: end;
}

.reset-workflow-btn {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #bfd7ff;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 850;
}

.transitions-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.transition-actions {
  display: grid;
  gap: 9px;
}

.transition-action {
  min-height: 74px;
  display: grid;
  gap: 6px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.transition-action:hover {
  border-color: var(--blue);
  box-shadow: 0 10px 24px rgba(36, 99, 235, 0.13);
  transform: translateY(-1px);
}

.transition-action span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.transition-action strong {
  font-size: 14px;
  line-height: 1.3;
}

.transition-action small,
.transition-action em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.action-normal {
  border-left-color: var(--blue);
}

.action-rework {
  border-left-color: var(--amber);
}

.action-rollback {
  border-left-color: var(--red);
}

.action-closure {
  border-left-color: #64748b;
}

.action-follow-up {
  border-left-color: var(--teal);
}

.empty-transition-status {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #ffffff;
  font-size: 14px;
}

.status-diagram-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.status-diagram {
  display: block;
  width: 100%;
  min-width: 980px;
  height: auto;
}

.diagram-edge {
  fill: none;
  stroke-width: 2.16;
  stroke-linecap: round;
  opacity: 0.28;
  transition: opacity 0.18s ease, stroke-width 0.18s ease;
}

.diagram-edge.is-available {
  opacity: 0.95;
  stroke-width: 2.88;
}

.diagram-edge.is-last {
  opacity: 1;
  stroke-width: 3.6;
}

.diagram-edge.is-hovered {
  opacity: 1;
  stroke-width: 5.04;
  filter: drop-shadow(0 0 5.04px rgba(36, 99, 235, 0.45));
}

.edge-normal {
  stroke: var(--blue);
}

.edge-rework {
  stroke: var(--amber);
  stroke-dasharray: 6.48 5.04;
}

.edge-rollback {
  stroke: var(--red);
  stroke-dasharray: 2.88 4.32;
}

.edge-closure {
  stroke: #64748b;
}

.edge-follow-up {
  stroke: var(--teal);
  stroke-dasharray: 8.64 4.32;
}

#arrow-normal path {
  fill: var(--blue);
}

#arrow-rework path {
  fill: var(--amber);
}

#arrow-rollback path {
  fill: var(--red);
}

#arrow-closure path {
  fill: #64748b;
}

#arrow-follow-up path {
  fill: var(--teal);
}

.diagram-node rect {
  stroke: #cbd5e1;
  stroke-width: 1.44;
  fill: #f1f5f9;
  filter: drop-shadow(0 5.76px 8.64px rgba(22, 32, 51, 0.07));
  transition: fill 0.18s ease, stroke-width 0.18s ease, stroke 0.18s ease, filter 0.18s ease;
}

.diagram-node text {
  fill: #64748b;
  font-size: 10.8px;
  font-weight: 850;
  pointer-events: none;
}

.diagram-node {
  cursor: pointer;
  outline: none;
}

.diagram-node:focus-visible rect,
.diagram-node:hover rect {
  stroke: var(--blue);
  stroke-width: 3.6;
}

.diagram-node.is-current rect {
  fill: #eff6ff;
  stroke: var(--blue);
  stroke-width: 3.6;
  filter: drop-shadow(0 8.64px 12.96px rgba(36, 99, 235, 0.22));
}

.diagram-node.is-current text {
  fill: #0f3f99;
}

.diagram-node.is-reachable rect {
  stroke: #cbd5e1;
  stroke-width: 1.44;
}

.transition-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.transition-card {
  min-height: 104px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: #ffffff;
  opacity: 0.68;
  transition: opacity 0.18s ease, box-shadow 0.18s ease;
}

.transition-card.is-available,
.transition-card.is-last {
  opacity: 1;
}

.transition-card.is-last {
  box-shadow: 0 10px 24px rgba(36, 99, 235, 0.12);
}

.transition-card strong {
  font-size: 14px;
  line-height: 1.3;
}

.transition-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.transition-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.transition-type {
  width: fit-content;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef3f9;
  color: #42526a;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.transition-normal {
  border-left-color: var(--blue);
}

.transition-rework {
  border-left-color: var(--amber);
}

.transition-rollback {
  border-left-color: var(--red);
}

.transition-closure {
  border-left-color: #64748b;
}

.transition-follow-up {
  border-left-color: var(--teal);
}

.detail-layout {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.58fr) minmax(300px, 0.48fr);
  gap: 18px;
  align-items: start;
}

.phase-panel,
.documents-panel,
.transitions-panel {
  padding: 22px;
}

.phase-panel-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.phase-kicker {
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#phasePurpose {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.55;
}

.status-pill {
  flex: 0 0 auto;
  min-width: 112px;
}

.flow-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin: 22px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.flow-card div:not(.flow-arrow) {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.flow-card strong {
  font-size: 18px;
  line-height: 1.25;
}

.flow-arrow {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 850;
}

.criteria-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.criteria-grid section {
  min-height: 210px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: #344154;
}

li {
  margin: 9px 0;
  line-height: 1.45;
}

.document-list {
  display: grid;
  gap: 10px;
}

.document-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  min-height: 106px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.document-card:hover,
.document-card:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 10px 24px rgba(36, 99, 235, 0.13);
  outline: 0;
  transform: translateY(-1px);
}

.document-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.document-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.document-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
  color: #42526a;
  font-size: 12px;
  font-weight: 750;
}

.requirement {
  min-height: 24px;
  background: #e2e8f0;
  color: #334155;
}

.requirement.is-required {
  background: #fee2e2;
  color: #991b1b;
}

.doc-type {
  border: 1px solid #bfd7ff;
  background: #eff6ff;
  color: #1d4ed8;
}

.document-modal[hidden] {
  display: none;
}

.document-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
}

.document-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
}

.document-modal-panel {
  position: relative;
  z-index: 1;
  width: min(620px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.document-modal-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.document-modal-close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.document-modal-evidence {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.document-modal-evidence strong {
  color: var(--ink);
}

.document-index-list {
  margin-top: 16px;
  padding-left: 22px;
}

.document-index-list li {
  padding-left: 4px;
}

.matrix-wrap {
  min-width: 0;
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  background: var(--surface);
}

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

th {
  background: #eef3f9;
  color: #42526a;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td {
  color: #344154;
  font-size: 14px;
}

td span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.moment-test-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.moment-result-card {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.moment-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.moment-result-card strong {
  min-height: 24px;
  font-size: 18px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.moment-result-card code {
  display: block;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2937;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.moment-locale-control select {
  width: 100%;
  min-height: 36px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

@media (max-width: 1120px) {
  .phase-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-layout,
  .overview-band {
    grid-template-columns: 1fr;
  }

  .transition-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .moment-test-grid {
    grid-template-columns: 1fr;
  }

  .metric-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .metric-strip div {
    min-height: 58px;
    border-right: 1px solid rgba(255, 255, 255, 0.14);
  }

  .metric-strip div:last-child {
    border-right: 0;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: calc(100vw - 18px);
    margin-top: 10px;
  }

  .topbar,
  .section-heading,
  .phase-panel-top {
    display: grid;
  }

  .release-chip {
    min-width: 0;
  }

  .overview-copy,
  .workflow-band,
  .phase-panel,
  .documents-panel,
  .transitions-panel,
  .matrix-band,
  .moment-test-band {
    padding: 16px;
  }

  .metric-strip,
  .phase-rail,
  .transition-list,
  .criteria-grid,
  .flow-card {
    grid-template-columns: 1fr;
  }

  .metric-strip div {
    min-height: 54px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  }

  .metric-strip div:last-child {
    border-bottom: 0;
  }

  .status-legend {
    justify-content: flex-start;
  }

  .phase-node {
    min-height: 116px;
  }

  .workflow-heading-actions {
    justify-items: start;
  }

  .flow-arrow {
    transform: rotate(90deg);
    justify-self: center;
  }

  .document-card {
    grid-template-columns: 1fr;
  }
}
