:root {
  --text: #222833;
  --muted: #5d6573;
  --line: #d5dae2;
  --soft: #f1f4f8;
  --navy: #1d3557;
  --title: #14213d;
  --accent: #2f6fde;
  --tint: #e7eefb;
  --exit: #b54708;
  --exit-tint: #fdf1e7;
  --danger: #c0262d;
  --danger-tint: #fbe9ea;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: #e9ecf1;
  color: var(--text);
  font:
    400 14px/1.6 "Pretendard Variable",
    Pretendard,
    "Malgun Gothic",
    sans-serif;
  font-variant-numeric: tabular-nums;
}

button {
  font: inherit;
  cursor: pointer;
}

.top {
  background: #ffffff;
  border-bottom: 2px solid var(--navy);
}

.top-in {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 24px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
}

.title {
  padding-bottom: 14px;
}

.sec {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.sec::before {
  content: "";
  width: 28px;
  height: 4px;
  background: var(--accent);
}

h1 {
  margin: 4px 0 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--title);
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 14px;
}

.toc a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--navy);
  color: var(--navy);
  font-weight: 600;
  text-decoration: none;
}

.toc a:hover {
  background: var(--tint);
}

.toc span,
.doc-title span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--navy);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px 40px;
}

.notice {
  margin: 0 0 14px;
  padding: 10px 14px;
  background: var(--tint);
  border-left: 4px solid var(--accent);
  color: var(--navy);
}

.doc-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 28px 0 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--title);
  scroll-margin-top: 16px;
}

.doc-title span {
  width: 28px;
  height: 28px;
  font-size: 15px;
}

.doc-title small {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.sheet {
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 20px 24px 24px;
}

.lead {
  margin: 0 0 16px;
  color: var(--muted);
}

.flow {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.flow-col {
  flex: 1 1 0;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 150px;
  padding: 12px;
  border: 1px solid var(--navy);
  border-top-width: 4px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
}

.state:hover {
  background: var(--soft);
}

.state[aria-pressed="true"] {
  background: var(--tint);
  border-color: var(--accent);
}

.state b {
  font-size: 15px;
  color: var(--title);
}

.state-no {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.state-who {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.state-cnt {
  margin-top: auto;
  padding: 1px 8px;
  background: var(--navy);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
}

.arrow {
  flex: none;
  align-self: flex-start;
  margin-top: 62px;
  color: var(--navy);
  font-size: 18px;
  font-weight: 700;
}

.exits {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.exits li {
  padding: 4px 8px 4px 22px;
  border: 1px dashed var(--exit);
  background: var(--exit-tint);
  color: var(--exit);
  font-size: 12px;
  position: relative;
}

.exits li::before {
  content: "↳";
  position: absolute;
  left: 7px;
}

.flow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
}

.flow-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lg {
  display: inline-block;
  width: 14px;
  height: 10px;
  border: 1px solid var(--navy);
}

.lg.exit {
  border: 1px dashed var(--exit);
  background: var(--exit-tint);
}

.lg.sel {
  border-color: var(--accent);
  background: var(--tint);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.chip {
  padding: 5px 12px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
}

.chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--tint);
  color: var(--navy);
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.grid th,
.grid td {
  padding: 9px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.grid thead th {
  background: var(--soft);
  color: var(--navy);
  font-weight: 600;
  border-top: 2px solid var(--navy);
  white-space: nowrap;
}

.c-id {
  width: 92px;
}

.c-id b {
  display: block;
  color: var(--navy);
}

.c-stage {
  font-size: 12px;
  color: var(--muted);
}

.c-sit {
  width: 27%;
}

.c-rule {
  width: 33%;
}

.c-lv {
  width: 66px;
  text-align: center;
}

.q {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border: 1px solid var(--exit);
  color: var(--exit);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.lv {
  display: inline-block;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 600;
}

.lv.hi {
  background: var(--danger-tint);
  color: var(--danger);
}

.lv.mid {
  background: var(--soft);
  color: var(--muted);
}

.foot-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.k-area {
  width: 84px;
  font-weight: 600;
  color: var(--navy);
}

.k-item {
  width: 26%;
}

.k-res {
  width: 120px;
}

.res {
  display: inline-block;
  padding: 1px 8px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .top-in,
  main {
    padding-left: 12px;
    padding-right: 12px;
  }

  .sheet {
    padding: 14px;
  }

  .flow {
    flex-direction: column;
    overflow: visible;
  }

  .flow-col {
    width: 100%;
  }

  .state {
    min-height: 0;
  }

  .arrow {
    align-self: center;
    margin-top: 0;
    transform: rotate(90deg);
  }

  .grid thead {
    display: none;
  }

  .grid tr {
    display: block;
    border: 1px solid var(--line);
    border-top: 2px solid var(--navy);
    margin-bottom: 10px;
  }

  .grid td {
    display: block;
    width: auto;
    border: 0;
    border-bottom: 1px dashed var(--line);
  }

  .grid td:last-child {
    border-bottom: 0;
  }

  .c-test::before {
    content: "확인: ";
    font-weight: 600;
    color: var(--navy);
  }

  .k-how::before {
    content: "확인: ";
    font-weight: 600;
    color: var(--navy);
  }

  .k-why::before {
    content: "위험: ";
    font-weight: 600;
    color: var(--navy);
  }

  .c-lv {
    text-align: left;
  }
}
