:root {
  --blue-950: #061f4a;
  --blue-900: #082c66;
  --blue-700: #0d57a1;
  --cyan-500: #20b8eb;
  --cyan-100: #e9f8fd;
  --yellow-500: #f5c542;
  --purple-500: #7952b3;
  --green-500: #248a52;
  --red-500: #d8464f;
  --ink: #102033;
  --muted: #607086;
  --line: #dce6f2;
  --surface: #f5f8fc;
  --panel: #ffffff;
  --shadow: 0 22px 60px rgba(8, 44, 102, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 8%, rgba(32, 184, 235, 0.15), transparent 24%),
    linear-gradient(145deg, #ffffff 0%, #f7fbff 48%, #edf5fb 100%);
  font-family: "Segoe UI", Arial, sans-serif;
}

button,
a {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(32, 184, 235, 0.5);
  outline-offset: 3px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  min-height: 72px;
  padding: 14px clamp(22px, 4vw, 64px);
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(220, 230, 242, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--blue-900);
  text-decoration: none;
}

.brand-symbol {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--blue-900);
}

.brand-symbol::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 3px;
  background: #fff;
}

.brand-name {
  font-size: 20px;
  font-weight: 650;
}

.brand-name strong {
  color: var(--cyan-500);
}

.header-copy {
  display: flex;
  gap: 12px;
  align-items: baseline;
  color: var(--blue-900);
  font-size: 14px;
  font-weight: 700;
}

.header-kicker {
  color: var(--cyan-500);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.header-links {
  display: flex;
  gap: 8px;
}

.header-links a {
  padding: 8px 11px;
  color: var(--blue-900);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

main {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 0 clamp(22px, 4vw, 64px) 54px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(420px, 0.8fr);
  gap: 64px;
  align-items: end;
  padding: 64px 0 38px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan-500);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 900px;
  margin-bottom: 20px;
  color: var(--blue-950);
  font-size: clamp(44px, 5vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 0;
  color: var(--blue-950);
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

h3 {
  color: var(--blue-900);
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.hero-lead {
  max-width: 780px;
  margin-bottom: 0;
  font-size: 20px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.hero-metrics article {
  min-height: 122px;
  padding: 24px 20px;
  border-left: 1px solid var(--line);
}

.hero-metrics article:first-child {
  border-left: 0;
}

.hero-metrics strong,
.hero-metrics span {
  display: block;
}

.hero-metrics strong {
  color: var(--blue-900);
  font-size: 26px;
  line-height: 1.1;
}

.hero-metrics span {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(8, 44, 102, 0.06);
}

.view-toggle,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.view-toggle {
  padding: 4px;
  background: var(--surface);
  border-radius: 8px;
}

.toolbar button {
  min-height: 36px;
  padding: 8px 12px;
  color: var(--blue-900);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.view-toggle button.active {
  color: #fff;
  background: var(--blue-900);
}

.filters > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.filters button {
  background: #fff;
  border-color: var(--line);
}

.filters button.active {
  color: #fff;
  background: var(--blue-700);
  border-color: var(--blue-700);
}

.filters .clear-filter {
  color: var(--muted);
}

.process-section,
.timeline-section,
.complete-view,
.legend-section {
  margin-top: 24px;
  padding: clamp(24px, 3vw, 38px);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(8, 44, 102, 0.08);
}

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

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

.section-heading > p {
  max-width: 460px;
  margin-bottom: 0;
}

.macro-flow {
  display: grid;
  grid-template-columns: repeat(6, minmax(190px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding: 6px 3px 22px;
}

.macro-card {
  position: relative;
  min-height: 284px;
  padding: 20px;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 5px solid var(--stage-color, var(--blue-700));
  border-radius: 9px;
  box-shadow: 0 12px 28px rgba(8, 44, 102, 0.07);
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.macro-card::after {
  content: "";
  position: absolute;
  top: 47px;
  right: -17px;
  width: 17px;
  height: 2px;
  background: var(--cyan-500);
}

.macro-card:last-child::after {
  content: none;
}

.macro-card:hover,
.macro-card:focus-visible,
.macro-card.selected {
  z-index: 2;
  transform: translateY(-5px);
  box-shadow: 0 20px 42px rgba(8, 44, 102, 0.15);
}

.macro-card.dimmed,
.lane-card.dimmed {
  opacity: 0.3;
}

.stage-number {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
  color: #fff;
  background: var(--stage-color, var(--blue-700));
  border-radius: 50%;
  font-weight: 850;
}

.macro-card h3 {
  min-height: 48px;
  margin-bottom: 10px;
  font-size: 18px;
}

.macro-card > p {
  min-height: 66px;
  margin-bottom: 20px;
  font-size: 14px;
}

.card-meta,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-chip,
.detail-chip,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 8px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}

.meta-chip.automation,
.detail-chip.automation {
  color: #17653a;
  background: #eaf8f0;
  border-color: #bfe5cf;
}

.meta-chip.manual,
.detail-chip.manual {
  color: #775600;
  background: #fff6d9;
  border-color: #eedb93;
}

.exit-route {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  align-items: center;
  margin-top: 4px;
  padding: 15px 18px;
  background: #fff3f3;
  border: 1px dashed rgba(216, 70, 79, 0.55);
  border-radius: 9px;
}

.exit-route p {
  margin-bottom: 0;
  font-size: 13px;
}

.exit-icon {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--red-500);
  border-radius: 50%;
  font-weight: 850;
}

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

.critical-timeline article {
  position: relative;
  min-height: 156px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.critical-timeline article::after {
  content: "";
  position: absolute;
  top: 38px;
  right: -15px;
  width: 15px;
  height: 2px;
  background: var(--cyan-500);
}

.critical-timeline article:last-child::after {
  content: none;
}

.critical-timeline .time-main {
  background: var(--cyan-100);
  border-color: rgba(32, 184, 235, 0.45);
}

.critical-timeline .time-parallel {
  border-style: dashed;
}

.time-code {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--blue-900);
  font-size: 21px;
  font-weight: 850;
}

.critical-timeline strong {
  display: block;
  color: var(--blue-900);
}

.critical-timeline p {
  margin: 7px 0 0;
  font-size: 13px;
}

.lane-map {
  display: grid;
  gap: 12px;
  overflow-x: auto;
}

.lane {
  display: grid;
  grid-template-columns: 190px minmax(1020px, 1fr);
  min-width: 1210px;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}

.lane-label {
  display: flex;
  align-items: center;
  padding: 18px;
  color: var(--blue-900);
  background: var(--surface);
  border-right: 1px solid var(--line);
  font-size: 13px;
  font-weight: 850;
}

.lane-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(160px, 1fr));
  gap: 9px;
  padding: 12px;
}

.lane-card {
  min-height: 110px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--lane-color);
  border-radius: 7px;
  transition: opacity 160ms ease;
}

.lane-card.empty {
  background: repeating-linear-gradient(-45deg, #fafbfd, #fafbfd 6px, #f4f7fa 6px, #f4f7fa 12px);
  border-left-color: var(--line);
}

.lane-card strong {
  display: block;
  color: var(--blue-900);
  font-size: 13px;
}

.lane-card span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.legend-section {
  display: flex;
  gap: 26px;
  align-items: center;
  padding-top: 20px;
  padding-bottom: 20px;
}

.legend-section h2 {
  font-size: 18px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.legend span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.dot.applicant { background: var(--cyan-500); }
.dot.selection { background: var(--yellow-500); }
.dot.admin { background: var(--purple-500); }
.dot.automation { background: var(--green-500); }
.dot.system { background: #7d8996; }
.dot.risk { background: var(--red-500); }

.panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(6, 31, 74, 0.28);
  backdrop-filter: blur(2px);
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 80;
  width: min(590px, 94vw);
  height: 100vh;
  overflow-y: auto;
  background: #fff;
  box-shadow: -20px 0 70px rgba(6, 31, 74, 0.22);
  transform: translateX(105%);
  transition: transform 220ms ease;
}

.detail-panel.open {
  transform: translateX(0);
}

.panel-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  padding: 26px 28px 20px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.panel-step {
  display: block;
  margin-bottom: 5px;
  color: var(--cyan-500);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.panel-header h2 {
  font-size: 30px;
}

.panel-close {
  width: 40px;
  height: 40px;
  color: var(--blue-900);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  font-size: 27px;
  line-height: 1;
}

.panel-content {
  padding: 26px 28px 44px;
}

.panel-summary {
  margin-bottom: 22px;
  font-size: 17px;
}

.detail-section {
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.detail-section h3 {
  margin-bottom: 12px;
  font-size: 15px;
}

.detail-section ul,
.detail-section ol {
  margin: 0;
  padding-left: 20px;
}

.detail-section li {
  margin: 8px 0;
  color: #4f6075;
  font-size: 14px;
  line-height: 1.45;
}

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

.detail-grid article {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-grid strong,
.detail-grid span {
  display: block;
}

.detail-grid strong {
  color: var(--blue-900);
  font-size: 12px;
}

.detail-grid span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.branch-diagram {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.branch {
  padding: 15px;
  background: #f1fbf5;
  border: 1px solid #c5e8d3;
  border-radius: 8px;
}

.branch strong {
  display: block;
  margin-bottom: 10px;
  color: #17653a;
}

.branch span {
  display: block;
  margin-top: 7px;
  padding-left: 12px;
  color: #4f6075;
  border-left: 2px solid var(--green-500);
  font-size: 12px;
  line-height: 1.4;
}

.risk-box {
  padding: 15px;
  background: #fff3f3;
  border: 1px solid #efc2c5;
  border-radius: 8px;
}

.risk-box ul {
  margin-bottom: 0;
}

body.panel-open {
  overflow: hidden;
}

@media (max-width: 1100px) {
  .app-header {
    grid-template-columns: auto 1fr;
  }

  .header-links {
    grid-column: 1 / -1;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .toolbar,
  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .toolbar {
    display: grid;
  }

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

  .critical-timeline article::after {
    content: none;
  }
}

@media (max-width: 720px) {
  .app-header {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
  }

  .header-copy {
    display: none;
  }

  .header-links {
    width: 100%;
  }

  .hero {
    padding-top: 38px;
  }

  .hero-metrics,
  .critical-timeline,
  .detail-grid,
  .branch-diagram {
    grid-template-columns: 1fr;
  }

  .hero-metrics article {
    min-height: 88px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .hero-metrics article:first-child {
    border-top: 0;
  }

  .process-section,
  .timeline-section,
  .complete-view {
    padding: 20px;
  }

  .macro-flow {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .macro-card {
    min-height: 0;
  }

  .macro-card::after {
    top: auto;
    right: auto;
    bottom: -17px;
    left: 38px;
    width: 2px;
    height: 17px;
  }

  .macro-card h3,
  .macro-card > p {
    min-height: 0;
  }

  .legend-section {
    display: block;
  }

  .legend {
    margin-top: 14px;
  }

  .panel-header,
  .panel-content {
    padding-right: 20px;
    padding-left: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
