/* ---------- l5 tools: shared page CSS (p- classes only) ---------- */
.p-tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 540px);
  gap: 48px 72px;
  align-items: start;
}
.p-tool-t {
  padding-top: 10px;
}
.p-h1.p-h1.p-h1 {
  font-size: clamp(40px, 5.7vw, 86px);
}
.p-lab {
  font-family: var(--g-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mu);
  font-weight: 400;
}
.p-calc-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.p-calc-h .g-pill,
.p-nw {
  white-space: nowrap;
  flex: none;
}
.p-calc-h b {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-stretch: 106%;
}
.p-money {
  background: #fff;
  border: 1px solid var(--ln);
  border-radius: 18px;
  padding: 14px 14px 14px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
}
.p-money:focus-within {
  outline: 2px solid var(--ac);
  outline-offset: 1px;
}
.p-money > .p-lab {
  grid-column: 1/-1;
}
.p-money input,
.p-money output {
  font: inherit;
  font-size: 36px;
  font-weight: 750;
  letter-spacing: -0.045em;
  font-stretch: 108%;
  line-height: 1.1;
  border: 0;
  background: none;
  padding: 0;
  width: 100%;
  min-width: 0;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  outline: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-money output.p-s {
  font-size: 28px;
}
.p-money output.p-xs {
  font-size: 22px;
}
.p-cur {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 34px 0 8px;
  border-radius: 30px;
  background: #f3eee3;
  box-shadow: inset 0 0 0 1px var(--ln);
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.01em;
  cursor: pointer;
}
.p-cur::after {
  content: '';
  position: absolute;
  right: 15px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.6px solid;
  border-bottom: 1.6px solid;
  transform: translateY(-70%) rotate(45deg);
}
.p-cur .g-flag,
.p-cur .p-cc {
  width: 30px;
  height: 30px;
}
.p-cur .p-cc {
  line-height: 30px;
}
.p-cur b {
  font-weight: 700;
  padding-left: 2px;
}
.p-cur select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
  appearance: none;
}
.p-cur:focus-within {
  outline: 2px solid var(--ac);
  outline-offset: 2px;
}
.p-swap {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #14231c;
  color: #f3eee3;
  display: grid;
  place-items: center;
  margin: -10px auto;
  position: relative;
  z-index: 2;
  box-shadow: 0 0 0 5px var(--g-paper);
  transition: transform 0.35s var(--g-ease);
}
button.p-swap:hover {
  transform: rotate(180deg);
}
div.p-swap {
  background: #cfebd9;
  color: #1f4a38;
}
.p-receipt {
  margin-top: 20px;
}
.p-receipt .g-kv:first-child {
  border-top: 0;
}
.p-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  border-top: 1.5px solid var(--fg);
  padding-top: 16px;
  margin-top: 4px;
}
.p-total .g-result {
  font-size: 34px;
  text-align: right;
}
.p-cta {
  width: 100%;
  justify-content: center;
  margin-top: 20px;
}
.p-foot {
  font-size: 13px;
  color: var(--mu);
  margin-top: 14px;
  line-height: 1.5;
}
.p-cc {
  display: inline-block;
  text-align: center;
  line-height: 26px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ln);
  font-family: var(--g-mono);
  font-size: 9.5px;
  letter-spacing: 0.02em;
  font-weight: 500;
  flex: none;
  font-style: normal;
}
/* code checker */
.p-code {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.p-code .g-input {
  font-family: var(--g-mono);
  font-weight: 500;
  letter-spacing: 0.06em;
  font-size: 21px;
  text-transform: uppercase;
}
.p-code .g-btn {
  height: 60px;
  border-radius: 16px;
  padding: 0 24px;
}
.p-res {
  margin-top: 16px;
  border-radius: 20px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--ln);
  padding: 20px;
}
.p-res-h {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.p-res-h b {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-stretch: 106%;
  line-height: 1.2;
}
.p-res-h span {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.p-res p {
  font-size: 14.5px;
  color: var(--mu);
  line-height: 1.5;
  margin-top: 14px;
}
.p-pill-warn {
  background: var(--g-amber);
  color: var(--g-amber-ink);
  box-shadow: none;
}
.p-seg {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0 0;
  font-family: var(--g-mono);
  font-weight: 500;
  font-size: 27px;
  letter-spacing: 0.04em;
  line-height: 1;
}
.p-seg i {
  font-style: normal;
  padding-bottom: 9px;
  border-bottom: 3px solid var(--s1);
}
.p-seg i:nth-child(2) {
  border-color: var(--s2);
}
.p-seg i:nth-child(3) {
  border-color: var(--s3);
}
.p-seg i:nth-child(4) {
  border-color: var(--s4);
}
.p-legend {
  display: flex;
  gap: 6px 16px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--mu);
}
.p-legend span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.p-legend span::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--s1);
}
.p-legend span:nth-child(2)::before {
  background: var(--s2);
}
.p-legend span:nth-child(3)::before {
  background: var(--s3);
}
.p-legend span:nth-child(4)::before {
  background: var(--s4);
}
.p-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px 0 12px;
  border-radius: 30px;
  box-shadow: inset 0 0 0 1px var(--ln);
  font-weight: 650;
  font-size: 14px;
  margin-top: 16px;
  background: var(--g-paper);
  transition: transform 0.25s var(--g-ease);
}
.p-copy:hover {
  transform: translateY(-1px);
}
.p-copy img {
  width: 16px;
  height: 16px;
}
.g-calc,
.p-vars {
  --s1: #1f4a38;
  --s2: #4ca076;
  --s3: #c8963a;
  --s4: #8a958f;
}
[data-theme='forest'] .p-anat,
[data-theme='ink'] .p-anat {
  --s1: #bfe5ce;
  --s2: #7fd3a4;
  --s3: #f2dfb4;
  --s4: rgba(243, 238, 227, 0.5);
}
/* code anatomy */
.p-anat {
  --s1: #1f4a38;
  --s2: #4ca076;
  --s3: #c8963a;
  --s4: #8a958f;
}
.p-anat-c {
  display: flex;
  gap: clamp(8px, 1.2vw, 18px);
  font-size: var(--fs, clamp(40px, 6.2vw, 96px));
  font-weight: 750;
  font-stretch: 108%;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.p-anat-c b {
  font-weight: 750;
  padding-bottom: 0.16em;
  border-bottom: 0.07em solid var(--s1);
}
.p-anat-c b:nth-child(2) {
  border-color: var(--s2);
}
.p-anat-c b:nth-child(3) {
  border-color: var(--s3);
}
.p-anat-c b:nth-child(4) {
  border-color: var(--s4);
  opacity: 0.55;
}
.p-anat-l {
  margin-top: 34px;
  border-bottom: 1px solid var(--ln);
}
.p-anat-l > div {
  display: grid;
  grid-template-columns: 22px minmax(0, 4fr) minmax(0, 7fr);
  gap: 14px;
  align-items: baseline;
  padding: 14px 0;
  border-top: 1px solid var(--ln);
}
.p-anat-l > div::before {
  content: '';
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--s1);
  align-self: center;
}
.p-anat-l > div:nth-child(2)::before {
  background: var(--s2);
}
.p-anat-l > div:nth-child(3)::before {
  background: var(--s3);
}
.p-anat-l > div:nth-child(4)::before {
  background: var(--s4);
}
.p-anat-l dt {
  font-weight: 650;
  font-size: 15.5px;
}
.p-anat-l dd {
  margin: 0;
  font-size: 14.5px;
  color: var(--mu);
  line-height: 1.45;
}
/* directory */
.p-dir-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.p-filter {
  height: 50px;
  width: 300px;
  max-width: 100%;
  border-radius: 30px;
  border: 1px solid var(--ln);
  background: var(--card);
  padding: 0 20px;
  font: inherit;
  font-size: 15.5px;
  color: var(--fg);
}
.p-filter::placeholder {
  color: var(--mu);
}
.p-filter:focus {
  outline: 2px solid var(--ac);
  outline-offset: 1px;
}
.p-codebtn {
  font-family: var(--g-mono);
  font-size: 14.5px;
  letter-spacing: 0.04em;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 10px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--ln);
  transition:
    background 0.2s,
    color 0.2s;
  white-space: nowrap;
}
button.p-codebtn:hover {
  background: var(--fg);
  color: var(--bg);
}
.p-dir .g-table td {
  vertical-align: middle;
  padding-top: 11px;
  padding-bottom: 11px;
}
.p-dir td:last-child {
  color: var(--mu);
  font-size: 14.5px;
}
.p-dir tr[hidden] {
  display: none;
}
.p-dir .g-table-wrap .g-table {
  min-width: 0;
}
.g-table-wrap .p-amt.g-table {
  min-width: 0;
}
.p-none {
  padding: 22px 0;
  color: var(--mu);
  font-size: 15.5px;
}
/* chips that act on the tool */
.p-routes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.p-routes .g-tag {
  cursor: pointer;
  transition:
    transform 0.25s var(--g-ease),
    background 0.2s;
  text-align: left;
  padding: 12px 22px 12px 13px;
}
.p-routes .g-tag:hover {
  transform: translateY(-2px);
}
.p-routes .g-tag b {
  font-size: 16.5px;
}
.p-routes .g-tag.on {
  background: var(--fg);
  color: var(--bg);
}
.p-routes .g-tag.on i {
  color: inherit;
  opacity: 0.7;
}
/* small helpers */
.p-57 {
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
}
.p-tool.p-wide {
  grid-template-columns: minmax(0, 1fr) minmax(0, 600px);
}
.p-chipbtn {
  padding: 11px 20px;
  border-radius: 60px;
  box-shadow: inset 0 0 0 1px var(--ln);
  background: var(--card);
  font-weight: 650;
  font-size: 15.5px;
  letter-spacing: -0.01em;
  transition:
    transform 0.25s var(--g-ease),
    background 0.2s;
}
.p-chipbtn:hover {
  transform: translateY(-2px);
}
.p-chipbtn.on {
  background: var(--fg);
  color: var(--bg);
}
.p-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14.5px;
  color: var(--mu);
}
.p-list li {
  padding: 8px 0 8px 20px;
  border-top: 1px solid var(--ln);
  position: relative;
}
.p-list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 16px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ac);
}
.p-note {
  border-left: 2px solid var(--ac);
  padding: 4px 0 4px 20px;
  font-size: 15.5px;
  color: var(--mu);
  max-width: 44em;
  line-height: 1.55;
}
.p-note b {
  color: var(--fg);
  font-weight: 650;
}
.p-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px 48px;
  align-items: center;
}
@media (max-width: 900px) {
  .p-tool,
  .p-tool.p-wide,
  .p-57 {
    grid-template-columns: minmax(0, 1fr);
  }
  .p-tool {
    gap: 34px;
  }
  .p-chipbtn {
    padding: 9px 16px;
    font-size: 14.5px;
  }
  .p-tool-t {
    padding-top: 0;
  }
  .g-calc {
    padding: 18px;
    border-radius: 26px;
  }
  .p-money input,
  .p-money output {
    font-size: 30px;
  }
  .p-money output.p-s {
    font-size: 24px;
  }
  .p-money output.p-xs {
    font-size: 19px;
  }
  .p-total .g-result {
    font-size: 26px;
  }
  .p-code .g-input {
    font-size: 17px;
    padding: 0 14px;
  }
  .p-code .g-btn {
    padding: 0 18px;
  }
  .p-seg {
    font-size: 22px;
  }
  .p-anat-l > div {
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 2px 10px;
  }
  .p-anat-l dd {
    grid-column: 2;
  }
  .p-filter {
    width: 100%;
  }
  .g-table-wrap .p-stack.g-table {
    min-width: 0;
  }
  .p-stack thead {
    display: none;
  }
  .p-stack tr {
    display: block;
    padding: 16px 0;
    border-bottom: 1px solid var(--ln);
  }
  .p-stack tr:first-child {
    border-top: 1.5px solid var(--fg);
  }
  .p-stack.g-table td {
    display: block;
    padding: 3px 0;
    border: 0;
  }
  .p-stack td:first-child {
    font-size: 18px;
    letter-spacing: -0.02em;
    padding-bottom: 6px;
  }
  .p-stack td[data-l]::before {
    content: attr(data-l);
    display: block;
    font-family: var(--g-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--mu);
    font-weight: 400;
    margin-top: 8px;
  }
  .p-dir .g-table {
    font-size: 14.5px;
  }
  .p-dir .g-table td {
    padding: 11px 12px 11px 0;
  }
  .p-codebtn {
    font-size: 13px;
    padding: 5px 8px;
  }
  .p-routes {
    gap: 8px;
  }
  .p-routes .g-tag {
    padding: 9px 16px 9px 10px;
  }
  .p-routes .g-tag b {
    font-size: 15px;
  }
  .p-band {
    grid-template-columns: minmax(0, 1fr);
  }
}
