/* anPCB Stackup Builder — shared by the shortcode. Scoped to .anpcb-stackup.
   © 2026 anPCB. All rights reserved.
   Unauthorized copying or redistribution of this file is prohibited without written permission. */
.anpcb-stackup {
  color: #43566d;
  font-size: 13px;
  line-height: 1.55;
}

.anpcb-stackup * { box-sizing: border-box; }

.anpcb-stackup .tpl {
  margin: 0 0 12px;
}

.anpcb-stackup .tpl-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.anpcb-stackup .tpl-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.anpcb-stackup .tpl .tpl-cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  background: #fff;
}

.anpcb-stackup .tpl .tpl-cat-btn i {
  font-style: normal;
  font-size: 10.5px;
  color: #7b8fa6;
  background: #f0f5fa;
  border-radius: 999px;
  padding: 0 6px;
}

.anpcb-stackup .tpl .tpl-cat-btn:hover {
  border-color: #0f4c81;
}

.anpcb-stackup .tpl .tpl-cat-btn.is-open {
  border-color: #0f4c81;
  background: #f3f8fd;
  color: #0f4c81;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px #0f4c81;
}

.anpcb-stackup .tpl .tpl-cat-btn.is-open i {
  background: #e3eefb;
  color: #0f4c81;
}

.anpcb-stackup .tpl .mytpl-save {
  padding: 6px 10px;
  border-radius: 6px;
  color: #1f3864;
}

.anpcb-stackup .tpl .mytpl-save:hover {
  border-color: #0f4c81;
}

.anpcb-stackup .tpl-panel {
  margin-top: 9px;
  border: 1px solid #e1eaf3;
  background: #f8fbfe;
  border-radius: 9px;
  padding: 9px;
  max-height: 168px;
  overflow: auto;
}

.anpcb-stackup .tpl-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.anpcb-stackup .tpl-user {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #dbe6f0;
}

.anpcb-stackup .tpl-user:empty {
  display: none;
}

.anpcb-stackup .tpl-user-cap {
  flex-basis: 100%;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #8a9bb0;
}

.anpcb-stackup .mytpl-chip {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid #c9d9ea;
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
  max-width: 100%;
}

.anpcb-stackup .mytpl-chip button {
  appearance: none;
  border: 0;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}

.anpcb-stackup .mytpl-apply {
  padding: 5px 9px;
  font-size: 12px;
  color: #1f3864;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anpcb-stackup .mytpl-apply:hover {
  background: #f3f8fd;
}

.anpcb-stackup .mytpl-mini {
  border-left: 1px solid #e6edf5 !important;
  padding: 0 7px;
  font-size: 10.5px;
  color: #7b8fa6;
}

.anpcb-stackup .mytpl-mini:hover {
  background: #f3f8fd;
  color: #0f4c81;
}

.anpcb-stackup .tpl-empty {
  font-size: 11.5px;
  color: #8a9bb0;
}

@media (max-width: 520px) {
  .anpcb-stackup .mytpl-apply { max-width: 130px; }
}

.anpcb-stackup .tpl button {
  appearance: none;
  border: 1px solid #dbe6f0;
  background: #fff;
  border-radius: 6px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 12px;
  color: #3a4e66;
  cursor: pointer;
}

.anpcb-stackup .tpl button.is-on {
  border-color: #0f4c81;
  background: #f3f8fd;
  color: #0f4c81;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px #0f4c81;
}

.anpcb-stackup .grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 16px;
  align-items: start;
}

.anpcb-stackup .panel {
  background: #fff;
  border: 1px solid #dbe6f0;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 10px 28px -26px rgba(13, 44, 84, .3);
  min-width: 0;
}

.anpcb-stackup .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.anpcb-stackup .panel-head h3 {
  margin: 0;
  font-size: 15px;
  color: #14356b;
  line-height: 1.3;
}

.anpcb-stackup .panel-head span {
  font-size: 11px;
  color: #8a9bb0;
}

.anpcb-stackup .rows {
  max-height: 430px;
  overflow: auto;
  border: 1px solid #dbe6f0;
  border-radius: 8px;
}

.anpcb-stackup .row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 88px 92px;
  gap: 8px;
  align-items: center;
  padding: 5px 9px;
  border-bottom: 1px solid #edf3fa;
}

.anpcb-stackup .row:last-child { border-bottom: 0; }
.anpcb-stackup .row.diel { background: #f8fbfe; }

.anpcb-stackup .lid {
  font-size: 10.5px;
  font-weight: 700;
  color: #5c6d82;
  letter-spacing: .04em;
}

.anpcb-stackup .row select,
.anpcb-stackup .row input {
  width: 100%;
  min-width: 0;
  height: 31px;
  border: 1px solid #cfe0f1;
  border-radius: 5px;
  background: #fff;
  padding: 0 7px;
  font-family: inherit;
  font-size: 12px;
  color: #14356b;
  outline: none;
}

.anpcb-stackup .row select:focus,
.anpcb-stackup .row input:focus,
.anpcb-stackup .knob input:focus,
.anpcb-stackup .knob select:focus {
  border-color: #0f4c81;
  box-shadow: 0 0 0 2px rgba(15, 76, 129, .12);
}

.anpcb-stackup .knob select:disabled {
  color: #9aa9bb;
  background: #f5f8fb;
  cursor: not-allowed;
}

.anpcb-stackup .row .unit,
.anpcb-stackup .knob .unit { position: relative; }
.anpcb-stackup .row .unit input,
.anpcb-stackup .knob .unit input { padding-right: 28px; }

.anpcb-stackup .row .unit em,
.anpcb-stackup .knob .unit em {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  font-style: normal;
  font-size: 10px;
  color: #8a9bb0;
}

.anpcb-stackup .row .cap { font-size: 10px; color: #8a9bb0; }

.anpcb-stackup .row .dtype {
  font-size: 10.5px;
  height: 28px;
  padding: 0 4px;
  color: #5c6d82;
}

.anpcb-stackup .row .fixedcell {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 28px;
  padding: 0 5px;
  overflow: hidden;
  border: 1px solid #e1eaf5;
  border-radius: 5px;
  background: #f1f6fb;
  font-size: 10px;
  color: #5c6d82;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* How-to section under the tool */
.anpcb-stackup-guide {
  max-width: 980px;
  margin: 40px auto 8px;
  color: #31445a;
  font-size: 15px;
  line-height: 1.65;
}
.anpcb-stackup-guide h2 {
  margin: 0 0 10px;
  font-size: 25px;
  line-height: 1.25;
  color: #10263f;
}
.anpcb-stackup-guide .guide-lead { margin: 0 0 22px; color: #4a5d73; }
.anpcb-stackup-guide .guide-step {
  padding: 16px 0 4px;
  border-top: 1px solid #e4ecf6;
}
.anpcb-stackup-guide .guide-step h3 {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 0 0 9px;
  font-size: 17px;
  line-height: 1.35;
  color: #10263f;
}
.anpcb-stackup-guide .guide-step h3 span {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #0f4c81;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}
.anpcb-stackup-guide p { margin: 0 0 10px; }
.anpcb-stackup-guide a { color: #0f4c81; text-decoration: underline; text-underline-offset: 2px; }
.anpcb-stackup-guide .guide-trap {
  padding: 9px 12px;
  border-left: 3px solid #c9d9ea;
  background: #f5f9fd;
  font-size: 14px;
  color: #44586e;
}
.anpcb-stackup-guide .guide-list {
  margin: 6px 0 4px 20px;
  padding: 0;
}
.anpcb-stackup-guide .guide-list li { margin: 0 0 7px; }
.anpcb-stackup-guide .guide-more { margin-top: 18px; color: #4a5d73; }
@media (max-width: 640px) {
  .anpcb-stackup-guide { margin-top: 28px; font-size: 15px; }
  .anpcb-stackup-guide h2 { font-size: 21px; }
  .anpcb-stackup-guide .guide-step h3 { font-size: 16px; }
}

.anpcb-stackup .row.diel .ppcell {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin-top: 3px;
}
.anpcb-stackup .row.diel .pphint {
  flex: 0 1 auto;
  font-size: 10px;
  color: #8a9bb0;
  white-space: nowrap;
}
.anpcb-stackup .row.diel .ppcell.is-pinned .pphint { color: #8a5a1e; }
.anpcb-stackup .row.diel .ppreset {
  flex: 0 0 auto;
  padding: 0 8px;
  height: 26px;
  border: 1px solid #cfe0f1;
  border-radius: 5px;
  background: #fff;
  color: #0f4c81;
  font-family: inherit;
  font-size: 10px;
  cursor: pointer;
  visibility: hidden;
}
.anpcb-stackup .row.diel .ppcell.is-pinned .ppreset { visibility: visible; }

.anpcb-stackup .knobs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

/* The layer count is an editable dropdown: type a count, or click the field /
   chevron to pick one of the presets the board type allows. */
.anpcb-stackup .knob { position: relative; }
.anpcb-stackup .unit.combo { position: relative; display: flex; align-items: center; min-width: 0; }
.anpcb-stackup .knob .unit.combo input[data-layers] {
  min-width: 0;
  padding-right: 32px;
  font-variant-numeric: tabular-nums;
}
/* Keep the field free of native spinners so the typed count never gets
   squeezed next to them; the chevron on the right opens the preset list. */
.anpcb-stackup .knob .unit.combo input[data-layers]::-webkit-outer-spin-button,
.anpcb-stackup .knob .unit.combo input[data-layers]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.anpcb-stackup .combo-btn {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-left: 1px solid #dbe4ef;
  border-radius: 0 6px 6px 0;
  background: #f5f9fd;
  cursor: pointer;
}
.anpcb-stackup .combo-btn i {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #48627f;
}
.anpcb-stackup .combo-btn:hover { background: #e9f1f9; }
.anpcb-stackup .combo-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 30;
  max-height: 220px;
  overflow: auto;
  padding: 4px;
  border: 1px solid #cfdeee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(20, 53, 107, .16);
}
.anpcb-stackup .combo-menu[hidden] { display: none; }
.anpcb-stackup .combo-menu button {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  text-align: left;
  font: 600 12px/1.2 inherit;
  color: #14356b;
  cursor: pointer;
}
.anpcb-stackup .combo-menu button:hover { background: #eef4fb; }
.anpcb-stackup .combo-menu button[aria-selected="true"] { background: #1f3864; color: #fff; }
.anpcb-stackup .combo-menu button em { margin-left: 4px; font-style: normal; font-size: 10.5px; font-weight: 500; color: #6b7f96; }
.anpcb-stackup .combo-menu button[aria-selected="true"] em { color: #cfe0f1; }
.anpcb-stackup .knob-note {
  margin: 4px 0 0;
  font-size: 10.5px;
  line-height: 1.35;
  color: #7b8a9b;
}


.anpcb-stackup .knob label {
  display: block;
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 700;
  color: #2a4767;
  margin-bottom: 4px;
}

.anpcb-stackup .knob input,
.anpcb-stackup .knob select {
  width: 100%;
  height: 32px;
  border: 1px solid #cfe0f1;
  border-radius: 6px;
  background: #fff;
  padding: 0 8px;
  font-family: inherit;
  font-size: 12.5px;
  color: #14356b;
}

/* Target-impedance presets: quick picks beside the free-entry field. */
.anpcb-stackup .zquick {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.anpcb-stackup .zquick button {
  height: 22px;
  padding: 0 7px;
  border: 1px solid #cfe0f1;
  border-radius: 5px;
  background: #fff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: #2a4767;
  cursor: pointer;
}
.anpcb-stackup .zquick button:hover { border-color: #0f4c81; }
.anpcb-stackup .zquick button.is-on {
  background: #0f4c81;
  border-color: #0f4c81;
  color: #fff;
}

.anpcb-stackup .stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 2px;
}

.anpcb-stackup .stat b {
  font-size: 42px;
  line-height: 1;
  color: #0f4c81;
  letter-spacing: -.02em;
}

.anpcb-stackup .stat span {
  font-size: 15px;
  color: #2a4767;
  font-weight: 600;
}

.anpcb-stackup .stat-note {
  margin: 4px 0 10px;
  font-size: 11.5px;
  color: #6b7f96;
}

.anpcb-stackup .stack {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #e1eaf5;
  border-radius: 8px;
  background: #fbfdff;
}

/* Cross-section: fixed label and value columns, flexible bar column.
   The middle track is minmax(0,1fr) so the bar shrinks first, never the text. */
.anpcb-stackup .stackview {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  column-gap: 8px;
  row-gap: 2px;
  padding: 12px 10px 6px;
  border: 1px solid #e1eaf5;
  border-radius: 8px;
  background: #fbfdff;
  min-width: 0;
}

.anpcb-stackup .sv-l {
  font-size: 9.5px;
  line-height: 1;
  color: #33475c;
  white-space: nowrap;
  text-align: right;
  min-width: 74px;
}

.anpcb-stackup .sv-l.diel {
  font-weight: 400;
  color: #7e97b4;
}

.anpcb-stackup .sv-bar {
  display: block;
  min-width: 0;
  width: 100%;
  border-radius: 1px;
}

.anpcb-stackup .sv-v {
  font-size: 9.5px;
  line-height: 1;
  color: #6b7f96;
  white-space: nowrap;
  text-align: right;
  min-width: 38px;
}

.anpcb-stackup .sv-total {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  text-align: right;
  font-size: 11.5px;
  font-weight: 700;
  color: #14356b;
}

.anpcb-stackup .sv-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 6px;
  padding: 0 2px;
  font-size: 9.5px;
  line-height: 1.4;
  color: #6b7f96;
}

.anpcb-stackup .sv-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.anpcb-stackup .sv-legend i {
  display: inline-block;
  width: 12px;
  height: 8px;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 2px;
}

.anpcb-stackup .sv-legend i.diel {
  background: #eaf2f9;
  border-color: #cfe2f8;
}

.anpcb-stackup .sv-l.empty { color: #7b8ea5; font-style: italic; }
.anpcb-stackup .sv-legend i.empty {
  background: #f4f7fa;
  border: 1px dashed #a7b8ca;
}

/* Rigid-flex cross-section: layered drawing per the site template. */
.anpcb-stackup .rfview {
  padding: 8px;
  border: 1px solid #e1eaf5;
  border-radius: 8px;
  background: #fbfdff;
  min-width: 0;
  overflow: hidden;
}

.anpcb-stackup .rfsvg {
  display: block;
  width: 100%;
  height: auto;
}

/* The total sits between the drawing and the legend with equal 10px gaps. */
.anpcb-stackup .rf-total {
  margin: 10px 0;
  text-align: right;
  font-size: 13.5px;
  font-weight: 700;
  color: #14356b;
}

/* Keep the summary on one line in the narrower result column. */
@media (max-width: 1120px) {
  .anpcb-stackup .rf-total { font-size: 12.5px; }
}

.anpcb-stackup .rf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 0;
  padding: 0 2px;
  font-size: 11px;
  line-height: 1.4;
  color: #5b7088;
}

.anpcb-stackup .rf-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.anpcb-stackup .rf-legend i {
  display: inline-block;
  width: 16px;
  height: 9px;
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 2px;
}

.anpcb-stackup .rf-legend i.rf-adh {
  background: #cfe3f7;
  border-color: #8fb0d4;
}

@media (max-width: 640px) {
  .anpcb-stackup .rfview { overflow-x: auto; }
  .anpcb-stackup .rfsvg { min-width: 540px; }
  .anpcb-stackup .rf-total { font-size: 12px; }
  .anpcb-stackup .rf-legend { font-size: 10px; gap: 5px 10px; }
}

.anpcb-stackup .checks {
  margin: 10px 0 0;
  display: grid;
  gap: 5px;
}

/* Class name avoids the theme's editorial `.chk` marker, which forces nowrap. */
.anpcb-stackup .stk-chk {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  padding: 6px 9px;
  border-left: 2px solid #3b6da1;
  background: #f1f6fc;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.5;
  color: #3d5875;
  min-width: 0;
  white-space: normal;
}

.anpcb-stackup .stk-chk span {
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.anpcb-stackup .stk-chk.warn { border-left-color: #b0752f; background: #fdf7ef; }
.anpcb-stackup .stk-chk.bad { border-left-color: #b42318; background: #fdf2f1; }
.anpcb-stackup .stk-chk b { flex: 0 0 auto; white-space: nowrap; }

.anpcb-stackup .zlist {
  margin: 10px 0 0;
  border: 1px solid #dbe6f0;
  border-radius: 8px;
  overflow: hidden;
  container-type: inline-size;
}

.anpcb-stackup .zrow {
  display: grid;
  grid-template-columns: max-content max-content minmax(0, 1fr) max-content;
  gap: 8px;
  padding: 6px 9px;
  border-bottom: 1px solid #edf3fa;
  font-size: 11.5px;
  align-items: center;
  min-width: 0;
}

.anpcb-stackup .zrow span { min-width: 0; overflow-wrap: anywhere; }
.anpcb-stackup .zrow b,
.anpcb-stackup .zrow .z,
.anpcb-stackup .zrow .impick { white-space: nowrap; }

/* One line per layer: W / S / H / Dk never wrap. */
.anpcb-stackup .zrow .zdesc {
  white-space: nowrap;
  font-size: 11px;
}
.anpcb-stackup .zrow.bend .zdesc { white-space: normal; }

/* When the list cannot fit the description beside the value and the Print
   pick, the description gets the full row width instead of wrapping. */
@container (max-width: 580px) {
  .anpcb-stackup .zrow {
    grid-template-areas: "zl zz . zi" "zd zd zd zd";
    row-gap: 2px;
  }
  .anpcb-stackup .zrow b { grid-area: zl; }
  .anpcb-stackup .zrow .z { grid-area: zz; }
  .anpcb-stackup .zrow .zdesc { grid-area: zd; }
  .anpcb-stackup .zrow .impick { grid-area: zi; justify-self: end; }
}

.anpcb-stackup .zrow:last-child { border-bottom: 0; }
.anpcb-stackup .zrow b { color: #14356b; font-size: 12.5px; }
.anpcb-stackup .zrow .z { text-align: left; font-weight: 700; color: #0f4c81; display: flex; flex-direction: column; align-items: flex-start; }
.anpcb-stackup .zrow .z.na { color: #7b8ea5; font-weight: 600; }
.anpcb-stackup .zrow .z .zt { font-size: 8.5px; font-weight: 600; color: #7b8ea5; letter-spacing: .03em; }
.anpcb-stackup .zrow.is-capped .z .zt { color: #2a4767; }

.anpcb-stackup .zrow .impick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: #5d7288;
  cursor: pointer;
  user-select: none;
}
.anpcb-stackup .zrow .impick input {
  margin: 0;
  width: 14px;
  height: 14px;
  accent-color: #0f4c81;
  cursor: pointer;
}
.anpcb-stackup .zrow .impick.na { visibility: hidden; }

.anpcb-stackup .tablewrap {
  margin-top: 10px;
  border: 1px solid #dbe6f0;
  border-radius: 8px;
  overflow: hidden;
}

.anpcb-stackup table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin: 0;
}

.anpcb-stackup th {
  background: #eaf2f9;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #2a4767;
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid #dbe6f0;
}

.anpcb-stackup th.c1 { width: 52px; }
.anpcb-stackup th.c2 { width: 92px; }
.anpcb-stackup th.c4 { width: 82px; }

.anpcb-stackup td {
  font-size: 11.5px;
  padding: 6px 8px;
  border-bottom: 1px solid #edf3fa;
  color: #43566d;
}

.anpcb-stackup tr:last-child td { border-bottom: 0; }
.anpcb-stackup td:first-child { font-weight: 600; color: #14356b; }

.anpcb-stackup .concl {
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid #d7e5f2;
  border-radius: 6px;
  background: #f7fbff;
  font-size: 11.5px;
  line-height: 1.6;
  color: #3d5875;
}

.anpcb-stackup .concl a { font-weight: 700; }

.anpcb-stackup .fine a { color: #2196f3; font-weight: 600; }

.anpcb-stackup .fine {
  margin: 14px 0 0;
  padding-top: 10px;
  border-top: 1px solid #edf3fa;
  font-size: 14px;
  line-height: 1.7;
  color: #6b7f96;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .anpcb-stackup .grid { grid-template-columns: 1fr; }
  .anpcb-stackup .row { grid-template-columns: 36px minmax(0, 1fr) 80px 86px; }
  .anpcb-stackup .knobs { grid-template-columns: 1fr 1fr; }
  .anpcb-stackup .rows { max-height: none; }
}

@media (max-width: 520px) {
  .anpcb-stackup .row { grid-template-columns: 30px minmax(0, 1fr) 84px; }
  .anpcb-stackup .row .cap { display: none; }
  .anpcb-stackup .row.diel { grid-template-columns: 30px minmax(0, 1fr) 62px 78px; }
  .anpcb-stackup .knobs { grid-template-columns: 1fr; }
  .anpcb-stackup .fine { font-size: 13.5px; line-height: 1.7; }
  .anpcb-stackup .sv-l { font-size: 9px; min-width: 64px; }
  .anpcb-stackup .sv-v { font-size: 9px; min-width: 34px; }
  .anpcb-stackup .stackview { column-gap: 6px; padding: 10px 8px; }

  /* Two-line impedance row: L#, the value and the print pick stay on one line,
     the description gets its own. */
  .anpcb-stackup .zrow {
    grid-template-columns: max-content max-content minmax(0, 1fr) max-content;
    grid-template-areas: "zl zz . zi" "zd zd zd zd";
    row-gap: 2px;
    column-gap: 8px;
  }
  .anpcb-stackup .zrow b { grid-area: zl; }
  .anpcb-stackup .zrow .z { grid-area: zz; }
  .anpcb-stackup .zrow .zdesc { grid-area: zd; }
  .anpcb-stackup .zrow .impick { grid-area: zi; justify-self: end; }

  .anpcb-stackup th, .anpcb-stackup td { padding: 5px 5px; font-size: 10px; }
  .anpcb-stackup th { font-size: 9px; letter-spacing: .03em; }
  .anpcb-stackup th.c1 { width: 38px; }
  .anpcb-stackup th.c2 { width: 62px; }
  .anpcb-stackup th.c4 { width: 70px; }
  .anpcb-stackup td { overflow-wrap: anywhere; }
}

@media (max-width: 380px) {
  .anpcb-stackup .row.diel {
    grid-template-columns: 30px minmax(0, 1fr) 74px;
    grid-template-areas: "dl dm dv" "dl dt dt";
    row-gap: 4px;
  }
  .anpcb-stackup .row.diel .lid { grid-area: dl; }
  .anpcb-stackup .row.diel select[data-k="mat"],
  .anpcb-stackup .row.diel select[data-k="rfcores"] { grid-area: dm; }
  .anpcb-stackup .row.diel .dtype { grid-area: dt; }
  .anpcb-stackup .row.diel .unit { grid-area: dv; }
}

/* Per-layer single-ended / differential width controls */
.anpcb-stackup .zhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 0 6px;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #5b7390;
}

.anpcb-stackup .mode {
  display: flex;
  gap: 4px;
}

.anpcb-stackup .mode button {
  border: 1px solid #cfdcea;
  background: #fff;
  color: #3d5875;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
}

.anpcb-stackup .mode button.is-on {
  background: #0f4c81;
  border-color: #0f4c81;
  color: #fff;
}

.anpcb-stackup .wreset {
  display: inline-block;
  margin: 8px 0 0;
  padding: 4px 9px;
  border: 1px solid #cfdcea;
  border-radius: 5px;
  background: #fff;
  color: #3d5875;
  font-size: 9.5px;
  font-weight: 600;
  cursor: pointer;
}

.anpcb-stackup .sigrow td {
  background: #f7fbff;
  padding: 7px 8px;
}

.anpcb-stackup .sigline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px 6px;
  font-size: 9.5px;
  line-height: 1.5;
  color: #43566d;
  min-width: 0;
}

.anpcb-stackup .sigline + .sigline {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed #dfeaf5;
}

.anpcb-stackup .sigline .tag {
  min-width: 26px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .05em;
  color: #2a4767;
}

.anpcb-stackup .sigline label {
  font-size: 8.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #7b8ea5;
}

.anpcb-stackup .sigline input {
  width: 46px;
  padding: 2px 4px;
  border: 1px solid #d6e2ef;
  border-radius: 4px;
  background: #fff;
  color: #14356b;
  font-size: 9.5px;
}

.anpcb-stackup .sigline input::-webkit-outer-spin-button,
.anpcb-stackup .sigline input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.anpcb-stackup .sigline input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.anpcb-stackup .sigline em {
  font-style: normal;
  font-size: 8.5px;
  color: #8a9bb0;
}

.anpcb-stackup .sigline b {
  font-size: 10px;
  color: #0f4c81;
  white-space: nowrap;
}

.anpcb-stackup .sigline .atag {
  font-style: normal;
  font-size: 8px;
  color: #5f7a96;
}

.anpcb-stackup .sigline .atag.manual {
  color: #a35d00;
  font-weight: 700;
}

.anpcb-stackup .sigline .tgt {
  font-style: normal;
  font-size: 8px;
  color: #2a4767;
  background: #eef4fa;
  border-radius: 3px;
  padding: 0 3px;
  white-space: nowrap;
}

.anpcb-stackup .sigline .sig-na {
  font-size: 9px;
  color: #7b8ea5;
}

/* Coplanar ground switch: a plain checkbox, not one of the numeric fields. */
.anpcb-stackup .sigline .cpwtog {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: #43566d;
  cursor: pointer;
  user-select: none;
}
.anpcb-stackup .sigline .cpwtog input {
  width: 13px;
  height: 13px;
  min-width: 13px;
  padding: 0;
  margin: 0;
  accent-color: #0f4c81;
  cursor: pointer;
}

@media (max-width: 520px) {
  .anpcb-stackup .zhead {
    flex-wrap: wrap;
    gap: 5px;
  }
  .anpcb-stackup .mode button {
    font-size: 9px;
    padding: 3px 6px;
  }
  .anpcb-stackup .sigrow td {
    padding: 6px 5px;
  }
  .anpcb-stackup .sigline {
    gap: 2px 5px;
    font-size: 9px;
  }
  .anpcb-stackup .sigline input {
    width: 42px;
  }
}

@media (max-width: 380px) {
  .anpcb-stackup .sigline .tag {
    min-width: 24px;
  }
  .anpcb-stackup .sigline input {
    width: 40px;
  }
}

/* Custom input rejection and the soldermask cover layer */
.anpcb-stackup .stk-err {
  margin: 8px 0 0;
  padding: 7px 9px;
  border: 1px solid #e7b8b3;
  border-left: 3px solid #b42318;
  border-radius: 5px;
  background: #fdf2f1;
  font-size: 11px;
  line-height: 1.5;
  color: #8a2a21;
}

.anpcb-stackup .stk-err[hidden] { display: none; }

.anpcb-stackup .maskbox {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid #dbe6f0;
  border-radius: 8px;
  background: #f8fbfe;
}

.anpcb-stackup .msk-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 11.5px;
  color: #2a4767;
}

.anpcb-stackup .msk-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.anpcb-stackup .msk-switch span {
  position: relative;
  flex: 0 0 auto;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: #cfdcea;
  transition: background .15s;
}

.anpcb-stackup .msk-switch span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  transition: transform .15s;
}

.anpcb-stackup .msk-switch input:checked + span { background: #0f4c81; }
.anpcb-stackup .msk-switch input:checked + span::after { transform: translateX(14px); }
.anpcb-stackup .msk-switch input:focus-visible + span { box-shadow: 0 0 0 2px rgba(15, 76, 129, .25); }

.anpcb-stackup .msk-note {
  margin: 6px 0 0;
  font-size: 10.5px;
  line-height: 1.5;
  color: #6b7f96;
}

.anpcb-stackup .msk-note.warn { color: #8a5a1e; }
.anpcb-stackup .msk-note.on { color: #2a4767; }

/* Inline metadata follows its label on the same line. */
.anpcb-stackup .stk-meta {
  margin-left: 8px;
  display: inline-block;
  width: 101.93px;
  height: 17px;
  background-image: var(--ref-asset);
  background-repeat: no-repeat;
  background-position: left top;
  background-size: 100% 100%;
  vertical-align: -4.6px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.anpcb-stackup .panel-head h3 .stk-meta {
  font-family: Arimo, Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: #6B7F96;
  width: 94.7px;
  vertical-align: -3.7px;
  margin-left: 8px;
}
@media (max-width: 768px) {
  .anpcb-stackup .stk-meta { display: none; }
}
/* Faded chart label: SVG text pinned inside the plot, no layout impact. */
.anpcb-stackup [data-stack] { position: relative; }
.anpcb-stackup .stk-wm {
  position: absolute;
  width: 104px;
  height: 16px;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  font-family: Arimo, Arial, Helvetica, sans-serif;
}

.anpcb-stackup .knob .msk-missing {
  margin: 4px 0 0;
  font-size: 10px;
  line-height: 1.45;
  color: #b42318;
}

.anpcb-stackup .knob .msk-missing[hidden] { display: none; }

.anpcb-stackup .knob input:disabled {
  color: #9aa9bb;
  background: #f5f8fb;
  cursor: not-allowed;
}

.anpcb-stackup .knob input.is-bad,
.anpcb-stackup .row input.is-bad {
  border-color: #b42318;
  box-shadow: 0 0 0 2px rgba(180, 35, 24, .12);
}

/* Keep the native stepper from covering the unit suffix and the digits. */
.anpcb-stackup .knob input[type="number"]::-webkit-outer-spin-button,
.anpcb-stackup .knob input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.anpcb-stackup .knob input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.anpcb-stackup .zbasis {
  margin: 4px 0 8px;
  padding: 5px 8px;
  border-radius: 5px;
  background: #f1f6fc;
  font-size: 10.5px;
  line-height: 1.5;
  color: #3d5875;
}

.anpcb-stackup .zbasis.on { background: #eef7f0; color: #2c5e3f; }
.anpcb-stackup .zbasis.warn { background: #fdf7ef; color: #8a5a1e; }

.anpcb-stackup .sv-l.mask { color: #2c5e3f; font-weight: 700; }
.anpcb-stackup .sv-bar.mask { background: #7fb38f; border: 1px solid #5c9470; }
.anpcb-stackup tr.maskrow td { background: #f3f9f4; color: #2c5e3f; font-weight: 600; }

/* Rigid-flex: flex core, bonding, coverlay, stiffener and bend zone */
.anpcb-stackup .rfbox {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid #e2d9cf;
  border-radius: 8px;
  background: #fbf8f4;
}

.anpcb-stackup .rfbox[hidden] { display: none; }

.anpcb-stackup .rfknobs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.anpcb-stackup .rfsections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0 10px;
}

.anpcb-stackup .rfcell {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid #e2d9cf;
  border-radius: 6px;
  background: #fbf8f4;
}

.anpcb-stackup .rfcell b {
  display: block;
  font-size: 9.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #7a5a3a;
}

.anpcb-stackup .rfcell .rfv {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #14356b;
  overflow-wrap: anywhere;
}

.anpcb-stackup .rfcell em {
  display: block;
  font-style: normal;
  font-size: 9.5px;
  line-height: 1.45;
  color: #7b8ea5;
}

.anpcb-stackup .zgroup {
  padding: 5px 9px;
  border-bottom: 1px solid #dbe6f0;
  background: #eaf2f9;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #5b7390;
}

.anpcb-stackup .zgroup.flex { color: #2c5e3f; background: #eef7f0; }

/* Per-layer impedance requirement groups: layer header, then single-ended and
   differential subsections, each row editable in place. */
.anpcb-stackup .reqadd {
  border: 1px solid #cfdcea;
  background: #fff;
  color: #0f4c81;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  white-space: nowrap;
}
.anpcb-stackup .reqadd:hover { border-color: #0f4c81; }
.anpcb-stackup .zhead .reqadd { font-size: 9.5px; padding: 3px 9px; }
.anpcb-stackup .zgroup.zlayer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 5px 9px;
  background: #eef4fb;
  border-bottom: 1px solid #dbe6f0;
  border-top: 1px solid #dfeaf5;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: #2a4767;
}
.anpcb-stackup .zgroup.zlayer b { font-size: 11.5px; color: #14356b; }
.anpcb-stackup .zgroup.zlayer em { font-style: normal; font-weight: 500; color: #6b7f96; }
.anpcb-stackup .zgroup.zlayer .reqadd { margin-left: auto; }
.anpcb-stackup .zgroup.zlayer.bad { background: #fdf2f1; }
.anpcb-stackup .zsub { border-bottom: 1px solid #edf3fa; }
.anpcb-stackup .zsub > summary {
  list-style: none;
  cursor: pointer;
  padding: 3px 9px;
  background: #f7fbff;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #5b7390;
  user-select: none;
}
.anpcb-stackup .zsub > summary::-webkit-details-marker { display: none; }
.anpcb-stackup .zsub > summary::before { content: '▸'; display: inline-block; margin-right: 5px; color: #8a9bb0; }
.anpcb-stackup .zsub[open] > summary::before { content: '▾'; }
.anpcb-stackup .zsub > summary span { color: #8a9bb0; font-weight: 600; }

.anpcb-stackup .reqrow {
  display: grid;
  grid-template-columns: max-content max-content max-content max-content max-content max-content max-content;
  grid-template-areas: "lay typ tgt z geo pdf del";
  align-items: end;
  gap: 2px 5px;
  padding: 3px 8px;
  border-top: 1px dashed #edf3fa;
  font-size: 9.5px;
  color: #43566d;
  min-width: 0;
}
.anpcb-stackup .reqrow .rqlayer { grid-area: lay; }
.anpcb-stackup .reqrow .rqtype { grid-area: typ; }
.anpcb-stackup .reqrow .rqtgt { grid-area: tgt; }
.anpcb-stackup .reqrow .reqz { grid-area: z; }
.anpcb-stackup .reqrow .rqgeo { grid-area: geo; }
.anpcb-stackup .reqrow .reqprint { grid-area: pdf; }
.anpcb-stackup .reqrow .reqdel { grid-area: del; }
.anpcb-stackup .reqrow .reqerr { grid-column: 1 / -1; }
/* Narrow results column: keep every requirement to two tidy lines instead of
   letting the controls scatter over several rows. */
@container (max-width: 470px) {
  .anpcb-stackup .reqrow {
    grid-template-columns: max-content max-content max-content max-content max-content max-content;
    grid-template-areas:
      "lay typ tgt z pdf del"
      "geo geo geo geo geo geo";
  }
}
.anpcb-stackup .reqrow.is-conflict { background: #fdf2f1; box-shadow: inset 2px 0 0 #b42318; }
.anpcb-stackup .reqrow.is-invalid { background: #fdf7ef; box-shadow: inset 2px 0 0 #b0752f; }
.anpcb-stackup .reqrow .rqlayer,
.anpcb-stackup .reqrow .rq { display: flex; flex-direction: column; gap: 1px; }
.anpcb-stackup .reqrow .rqlayer > span,
.anpcb-stackup .reqrow .rq > span {
  font-size: 7px;
  line-height: 1;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #7b8ea5;
}
.anpcb-stackup .reqrow .rqlayer select,
.anpcb-stackup .reqrow select.rqtype {
  height: 21px;
  padding: 1px 3px;
  border: 1px solid #d6e2ef;
  border-radius: 4px;
  background: #fff;
  color: #14356b;
  font-size: 9.5px;
}
.anpcb-stackup .reqrow .rqlayer select { width: 46px; }
.anpcb-stackup .reqrow select.rqtype { width: 92px; align-self: flex-end; }
.anpcb-stackup .reqrow .rqgeo { display: inline-flex; align-items: flex-end; gap: 4px; }
.anpcb-stackup .reqrow .rqin { position: relative; display: inline-flex; align-items: center; }
.anpcb-stackup .reqrow .rqin input {
  width: 52px;
  height: 21px;
  padding: 1px 14px 1px 4px;
  border: 1px solid #d6e2ef;
  border-radius: 4px;
  background: #fff;
  color: #14356b;
  font-size: 9.5px;
}
.anpcb-stackup .reqrow .rqin em {
  position: absolute;
  right: 3px;
  font-style: normal;
  font-size: 7.5px;
  color: #8a9bb0;
  pointer-events: none;
}
.anpcb-stackup .reqrow .rq.off .rqin input { background: #f3f7fb; color: #a9b8c9; }
.anpcb-stackup .reqrow .reqz {
  min-width: 42px;
  padding-bottom: 3px;
  font-size: 10.5px;
  font-weight: 700;
  color: #0f4c81;
  white-space: nowrap;
}
.anpcb-stackup .reqrow .reqprint {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding-bottom: 3px;
  font-size: 8.5px;
  font-weight: 700;
  color: #5d7288;
  cursor: pointer;
  user-select: none;
}
.anpcb-stackup .reqrow .reqprint input { width: 14px; height: 14px; margin: 0; accent-color: #0f4c81; cursor: pointer; }
.anpcb-stackup .reqrow .reqdel {
  align-self: flex-end;
  border: 0;
  background: none;
  color: #b42318;
  font-size: 14px;
  line-height: 1;
  padding: 0 3px 3px;
  cursor: pointer;
}
.anpcb-stackup .reqrow .reqdel:hover { color: #7d150d; }
.anpcb-stackup .reqrow .reqerr {
  flex: 1 0 100%;
  font-size: 8.5px;
  line-height: 1.4;
  color: #a35d00;
}
.anpcb-stackup .reqrow.is-conflict .reqerr { color: #8a2a21; }
.anpcb-stackup .reqrow input[type="number"]::-webkit-outer-spin-button,
.anpcb-stackup .reqrow input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.anpcb-stackup .reqrow input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

.anpcb-stackup .zrow.bend {
  background: #fdf7ef;
  color: #8a5a1e;
  font-size: 10.5px;
}

.anpcb-stackup .sv-l.stf,
.anpcb-stackup .sv-l.flex { color: #7a5a3a; font-weight: 700; }

.anpcb-stackup .sv-bar.stf {
  background: #cdb79c;
  border: 1px dashed #8a6a45;
}

.anpcb-stackup .sv-bend {
  grid-column: 1 / -1;
  padding: 3px 6px;
  border-radius: 4px;
  background: #eef7f0;
  font-size: 9.5px;
  font-weight: 700;
  color: #2c5e3f;
  text-align: center;
}

@media (max-width: 520px) {
  .anpcb-stackup .rfsections { grid-template-columns: 1fr; }
  .anpcb-stackup .rfknobs { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
  .anpcb-stackup .rfknobs { grid-template-columns: 1fr; }
}

/* mm / mil display toggle */
.anpcb-stackup .panel-head .headtools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.anpcb-stackup .unit-toggle {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid #cfdcea;
  border-radius: 6px;
  background: #fff;
}

.anpcb-stackup .unit-toggle button {
  padding: 4px 8px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  color: #5b7390;
  cursor: pointer;
}

.anpcb-stackup .unit-toggle button + button { border-left: 1px solid #dbe6f0; }
.anpcb-stackup .unit-toggle button.is-on { background: #0f4c81; color: #fff; }

/* Tool purpose and liability note, above the copyright line */
.anpcb-stackup .tool-why,
.anpcb-stackup .tool-disclaimer {
  margin: 16px 2px 0;
  font-size: 13px;
  line-height: 1.8;
  color: #4A5A6A;
  overflow-wrap: anywhere;
}
.anpcb-stackup .tool-disclaimer { margin-top: 8px; }

/* Tool-level copyright line, below the module cards */
.anpcb-stackup .legal {
  margin: 14px 2px 0;
  font-size: 11px;
  line-height: 1.6;
  color: #7b8ea5;
  overflow-wrap: anywhere;
}

.anpcb-stackup .legal a {
  color: #5f7a96;
  text-decoration: underline;
}

@media (max-width: 520px) {
  .anpcb-stackup .legal { margin-top: 12px; font-size: 10.5px; }
}

/* ==========================================================================
   Batch 4 — control and annotation type scale.
   Same optical tier as the site body copy after the 1.1x page zoom: labels and
   explanatory text at 14px, inputs at 16px (no iOS focus zoom), buttons at
   15px with a 44px hit height. Watermark rules are untouched.
   ========================================================================== */

.anpcb-stackup { font-size: 14px; }

/* Headings and their right-hand controls. */
.anpcb-stackup .panel-head h3 { font-size: 16px; }
.anpcb-stackup .panel-head span { font-size: 13px; }
.anpcb-stackup .unit-toggle button { font-size: 12.5px; padding: 8px 10px; }

/* Layer rows. */
.anpcb-stackup .row { padding: 6px 9px; }
.anpcb-stackup .row .lid { font-size: 12px; }
.anpcb-stackup .row select,
.anpcb-stackup .row input { height: 36px; font-size: 16px; }
.anpcb-stackup .row .unit em { font-size: 11.5px; }
.anpcb-stackup .row .cap { font-size: 11.5px; }
.anpcb-stackup .row .dtype { font-size: 12.5px; height: 34px; }
.anpcb-stackup .row .fixedcell { font-size: 11.5px; height: 32px; }

/* Knobs: three columns must stay three columns at 1366. */
.anpcb-stackup .knob label { font-size: 12.5px; }
/* The inline note after BOARD TYPE must not stretch that one label's line
   box, which pushed the column's select 2.6px below its two neighbours. */
.anpcb-stackup .knob label .stk-meta { line-height: 0; position: relative; top: -0.9px; }
.anpcb-stackup .knob input,
.anpcb-stackup .knob select { height: 38px; font-size: 16px; }
.anpcb-stackup .knob .msk-missing { font-size: 11.5px; }

/* Result card: headline, chart, notices. */
.anpcb-stackup .stat b { font-size: 46px; }
.anpcb-stackup .stat span { font-size: 16px; }
.anpcb-stackup .stat-note { font-size: 13.5px; }
.anpcb-stackup .sv-l,
.anpcb-stackup .sv-v { font-size: 11.5px; }
.anpcb-stackup .sv-total { font-size: 13.5px; }
.anpcb-stackup .sv-legend { font-size: 11.5px; }
.anpcb-stackup .sv-bend { font-size: 11.5px; }
.anpcb-stackup .stk-chk { font-size: 13px; }
.anpcb-stackup .zbasis { font-size: 12.5px; }
.anpcb-stackup .zhead { font-size: 11.5px; }
.anpcb-stackup .mode button { font-size: 12.5px; padding: 6px 10px; }
.anpcb-stackup .zrow { font-size: 13px; }
.anpcb-stackup .zrow b { font-size: 14px; }
.anpcb-stackup .zrow .z .zt { font-size: 10.5px; }
.anpcb-stackup .zgroup { font-size: 11px; }
.anpcb-stackup .wreset { font-size: 12.5px; padding: 10px 14px; min-height: 44px; }

/* Per-layer width editors. */
.anpcb-stackup .sigline { font-size: 11.5px; }
.anpcb-stackup .sigline .tag { font-size: 10.5px; }
.anpcb-stackup .sigline label { font-size: 10.5px; }
.anpcb-stackup .sigline input { width: 58px; font-size: 16px; height: 28px; }
.anpcb-stackup .sigline em { font-size: 10.5px; }
.anpcb-stackup .sigline b { font-size: 12px; }
.anpcb-stackup .sigline .atag { font-size: 10px; }
.anpcb-stackup .sigline .tgt { font-size: 10px; }
.anpcb-stackup .sigline .sig-na { font-size: 11px; }

/* Detail table. */
.anpcb-stackup th { font-size: 12px; padding: 8px; }
.anpcb-stackup td { font-size: 13px; padding: 8px; }
.anpcb-stackup th.c2 { width: 96px; }
.anpcb-stackup th.c4 { width: 96px; }
.anpcb-stackup .concl { font-size: 13px; }

/* Soldermask / rigid-flex boxes. */
.anpcb-stackup .msk-switch { font-size: 13px; min-height: 32px; }
.anpcb-stackup .msk-note { font-size: 12.5px; }
.anpcb-stackup .stk-err { font-size: 12.5px; }
.anpcb-stackup .rfcell b { font-size: 11.5px; }
.anpcb-stackup .rfcell .rfv { font-size: 14px; }
.anpcb-stackup .rfcell em { font-size: 11.5px; }

/* Preset strip: kept at 12.5px so the 16 presets stay on one row at 1440. */
.anpcb-stackup .tpl button { font-size: 12.5px; padding: 6px 8px; }

@media (max-width: 520px) {
  .anpcb-stackup .sv-l,
  .anpcb-stackup .sv-v { font-size: 10.5px; }
  .anpcb-stackup th { font-size: 11px; letter-spacing: .03em; }
  .anpcb-stackup td { font-size: 12px; }
  .anpcb-stackup .sigline { font-size: 11px; }
  .anpcb-stackup .sigline input { width: 56px; }
  .anpcb-stackup .mode button { font-size: 11.5px; }
  .anpcb-stackup .legal { font-size: 12px; }
  .anpcb-stackup .row { grid-template-columns: 30px minmax(0, 1fr) 96px; }
  .anpcb-stackup .row.diel { grid-template-columns: 30px minmax(0, 1fr) 62px 94px; }
  .anpcb-stackup th.c1 { width: 46px; }
}

@media (max-width: 380px) {
  .anpcb-stackup .row.diel { grid-template-columns: 30px minmax(0, 1fr) 82px; }
  .anpcb-stackup .sigline input { width: 54px; }
}

@media (max-width: 380px) {
  .anpcb-stackup .row.diel { grid-template-columns: 30px minmax(0, 1fr) 80px; }
  .anpcb-stackup .sigline input { width: 54px; }
}

/* The theme blocks text selection on body; editor fields must still take a
   caret and typed input even if that rule wins the cascade. */
.anpcb-stackup input,
.anpcb-stackup textarea,
.anpcb-stackup select,
.anpcb-stackup option {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
  -webkit-touch-callout: default !important;
}

/* Print / PDF export */
.pdfbtn {
  margin-left: 10px;
  padding: 4px 10px;
  border: 1px solid #c9d4e2;
  border-radius: 6px;
  background: #fff;
  color: #16212e;
  font: 600 11px/1.2 inherit;
  cursor: pointer;
}
.pdfbtn:hover { border-color: #8aa4c4; }
#anpcb-print { display: none; }

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body > * { display: none !important; }
  body > #anpcb-print { display: block !important; }
  #anpcb-print {
    color: #16212e;
    font-family: Arimo, Arial, Helvetica, sans-serif;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #anpcb-print .prh {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    border-bottom: 1.5px solid #c9d4e2;
    padding-bottom: 3mm;
  }
  #anpcb-print h1 { margin: 0; font-size: 17pt; }
  #anpcb-print .prh p { margin: 1mm 0 0; font-size: 9.5pt; color: #4a5a6d; }
  #anpcb-print .prh-r { font-size: 8pt; color: #6b7f96; text-align: right; line-height: 1.5; }
  #anpcb-print .prd { margin: 4mm 0 1mm; }
  #anpcb-print .prd svg { display: block; width: 100%; height: auto; max-height: 88mm; }
  #anpcb-print .prt { margin: 0 0 2mm; font-size: 10pt; font-weight: 700; }
  #anpcb-print .prl .sv-legend,
  #anpcb-print .prl .rf-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 2mm 5mm;
    margin: 0 0 2mm;
  }
  #anpcb-print .prl span {
    display: inline-flex;
    align-items: center;
    gap: 1.2mm;
    font-size: 8pt;
  }
  #anpcb-print .prl i {
    display: inline-block;
    width: 3.2mm;
    height: 3.2mm;
    border: 0.3mm solid #b9c4d0;
    border-radius: 0.6mm;
  }
  #anpcb-print .prl i.empty {
    background: #f4f7fa;
    border-style: dashed;
  }
  #anpcb-print .prextra {
    display: flex;
    flex-wrap: wrap;
    gap: 1mm 6mm;
    margin: 0 0 3mm;
    padding: 0;
    list-style: none;
    font-size: 8.5pt;
    color: #4a5a6d;
  }
  #anpcb-print .prtbl { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
  #anpcb-print .prtbl th {
    padding: 1.4mm 1.8mm;
    text-align: left;
    background: #eef3f8;
    border-bottom: 1px solid #c9d4e2;
  }
  #anpcb-print .prtbl td { padding: 1.2mm 1.8mm; border-bottom: 0.5px solid #e1e7ef; }
  #anpcb-print .prtbl td.num { text-align: right; white-space: nowrap; }
  #anpcb-print .prtbl tr { break-inside: avoid; }
  #anpcb-print .prtbl thead { display: table-header-group; }
  #anpcb-print .prf { margin: 3mm 0 0; font-size: 7.5pt; color: #7b8a9b; }
}

/* Prominent export button; wraps instead of squeezing the panel title */
.panel.results .panel-head {
  flex-wrap: wrap;
  row-gap: 6px;
}
.pdfbtn {
  margin-left: 10px;
  padding: 7px 14px;
  border: 1px solid #1f3864;
  border-radius: 7px;
  background: #1f3864;
  color: #fff;
  font: 700 12px/1.1 inherit;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(31, 56, 100, 0.18);
}
.pdfbtn:hover {
  background: #2f5597;
  border-color: #2f5597;
}

/* Export hint: shown only after the PDF button is pressed, hidden in print. */
.print-tip {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  z-index: 99999;
  max-width: min(92vw, 560px);
  padding: 10px 15px;
  border-radius: 8px;
  background: #1f3864;
  color: #fff;
  font: 600 12.5px/1.45 Arimo, Arial, Helvetica, sans-serif;
  box-shadow: 0 10px 30px rgba(31, 56, 100, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.print-tip.on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Print sheet follows the capability-sheet template */
@media print {
  @page {
    size: A4 portrait;
    margin: 15mm 14mm 20mm;
    @bottom-right {
      content: "Page " counter(page) " / " counter(pages);
      font: 7pt Arimo, Arial, Helvetica, sans-serif;
      color: #6b7f96;
    }
  }
  body > * { display: none !important; }
  body > #anpcb-print { display: block !important; }
  #anpcb-print,
  #anpcb-print * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  #anpcb-print {
    position: relative;
    color: #1f2937;
    font-family: Arimo, Arial, Helvetica, sans-serif;
  }
  #anpcb-print .prhead {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10mm;
    border-bottom: 0.4mm solid #1f3864;
    padding-bottom: 2.2mm;
  }
  #anpcb-print .prlogo { display: block; height: 8.5mm; width: auto; }
  #anpcb-print .prhead-r { text-align: right; line-height: 1.5; }
  #anpcb-print .prhead-r b { display: block; font-size: 8pt; color: #1f3864; }
  #anpcb-print .prhead-r span { display: block; font-size: 6.4pt; color: #6b7f96; }
  #anpcb-print .prfoot {
    display: flex;
    justify-content: space-between;
    gap: 6mm;
    margin-top: 4mm;
    border-top: 0.25mm solid #c9d4e2;
    padding-top: 2mm;
    font-size: 6.4pt;
    color: #6b7f96;
    break-inside: avoid;
  }
  #anpcb-print .prbody { position: relative; z-index: 1; padding-top: 5mm; }
  #anpcb-print .preyebrow {
    margin: 0 0 1.4mm;
    font-size: 7pt;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #2f5597;
  }
  #anpcb-print h1 { margin: 0 0 1.4mm; font-size: 18.5pt; line-height: 1.12; color: #1f3864; }
  #anpcb-print .prsub { margin: 0 0 1mm; font-size: 8.6pt; color: #5a6673; }
  #anpcb-print .prmeta { margin: 0 0 2mm; font-size: 6.8pt; color: #7b8a9b; }
  #anpcb-print .prd { margin: 0 0 1.5mm; break-inside: avoid; text-align: center; }
  /* The cross-section sits in the middle of the text column instead of
     stretching edge to edge; labels and leaders scale with the drawing. */
  #anpcb-print .prd svg { display: inline-block; width: auto; height: auto; max-width: 82%; max-height: 60mm; }
  #anpcb-print .prd .stackview {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) max-content;
    align-items: center;
    column-gap: 2.4mm;
    row-gap: 0;
    width: 66%;
    margin-left: auto;
    margin-right: auto;
    padding: 1.8mm 2.6mm 1.2mm;
    border: 0.25mm solid #e1eaf5;
    border-radius: 1.5mm;
    background: #fbfdff;
    text-align: left;
  }
  #anpcb-print .prd .sv-l {
    font-size: 5pt;
    line-height: 1.06;
    color: #33475c;
    white-space: nowrap;
    text-align: right;
    min-width: 19mm;
  }
  #anpcb-print .prd .sv-l.diel { font-weight: 400; color: #7e97b4; }
  #anpcb-print .prd .sv-l.empty { color: #7b8ea5; font-style: italic; }
  #anpcb-print .prd .sv-l.mask { color: #2c5e3f; font-weight: 700; }
  #anpcb-print .prd .sv-l.stf,
  #anpcb-print .prd .sv-l.flex { color: #7a5a3a; font-weight: 700; }
  #anpcb-print .prd .sv-bar { display: block; width: 100%; border-radius: 0.3mm; }
  /* The sheet lives outside .anpcb-stackup, so the mask and stiffener fills
     must be repeated here; without them those bars print as empty gaps. */
  #anpcb-print .prd .sv-bar.mask { background: #7fb38f; border: 0.25mm solid #5c9470; }
  #anpcb-print .prd .sv-bar.stf { background: #cdb79c; border: 0.25mm dashed #8a6a45; }
  #anpcb-print .prd .sv-v {
    font-size: 5pt;
    line-height: 1.06;
    color: #6b7f96;
    white-space: nowrap;
    text-align: right;
    min-width: 10mm;
  }
  #anpcb-print .prd .sv-total {
    grid-column: 1 / -1;
    margin: 2mm 0 0;
    text-align: right;
    font-size: 7.2pt;
    font-weight: 700;
    color: #14356b;
  }
  #anpcb-print .prd .sv-bend { grid-column: 1 / -1; font-size: 6pt; color: #7a5a3a; }
  #anpcb-print .prl i.diel { background: #eaf2f9; border-color: #cfe2f8; }
  #anpcb-print .prt { margin: 0 0 1.5mm; font-size: 10.5pt; font-weight: 700; color: #1f3864; }
  #anpcb-print .prl .sv-legend,
  #anpcb-print .prl .rf-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.3mm 4mm;
    margin: 0 0 2.2mm;
  }
  #anpcb-print .prl span {
    display: inline-flex;
    align-items: center;
    gap: 1.1mm;
    font-size: 6.9pt;
    color: #33414f;
  }
  #anpcb-print .prl i {
    display: inline-block;
    width: 2.6mm;
    height: 2.6mm;
    border: 0.25mm solid #b9c4d0;
    border-radius: 0.5mm;
  }
  #anpcb-print .prextra {
    display: flex;
    flex-wrap: wrap;
    gap: 1mm 6mm;
    margin: 0 0 2.5mm;
    padding: 0;
    list-style: none;
    font-size: 6.9pt;
    color: #4a5a6d;
  }
  #anpcb-print .prtbl { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 8pt; line-height: 1.3; }
  /* The sheet lives outside .anpcb-stackup, so state the box model here: the
     column percentages then describe the full cell, padding included, and a
     value can never be pushed past its column edge. */
  #anpcb-print .prtbl,
  #anpcb-print .prtbl th,
  #anpcb-print .prtbl td { box-sizing: border-box; }
  #anpcb-print .prtbl th:nth-child(1) { width: 15%; }
  #anpcb-print .prtbl th:nth-child(2) { width: 24%; }
  #anpcb-print .prtbl th:nth-child(3) { width: 41%; }
  #anpcb-print .prtbl th:nth-child(4) { width: 20%; }
  #anpcb-print .prtbl thead th {
    padding: 1.3mm 2mm;
    text-align: left;
    background: #1f3864;
    color: #fff;
    font-size: 7.6pt;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 0;
  }
  #anpcb-print .prtbl th:last-child,
  #anpcb-print .prtbl td.num { text-align: right; white-space: nowrap; }
  #anpcb-print .prtbl td {
    padding: 0.9mm 2mm;
    border-bottom: 0.2mm solid #dbe2ea;
    color: #26313d;
    vertical-align: top;
  }
  #anpcb-print .prtbl td:first-child { font-weight: 700; color: #1f3864; }
  #anpcb-print .prtbl tbody tr:nth-child(even) { background: #eff3f8; }
  #anpcb-print .prtbl tr { break-inside: avoid; }
  #anpcb-print .prtbl thead { display: table-header-group; }
  #anpcb-print .prf { margin: 2.5mm 0 0; font-size: 6.4pt; color: #7b8a9b; }
  /* Impedance requirements: same sheet styling, own heading and column split. */
  #anpcb-print .prh2 {
    margin: 4mm 0 1.4mm;
    padding-bottom: 0.8mm;
    border-bottom: 0.2mm solid #c9d4e2;
    font-size: 8.6pt;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #1f3864;
    break-after: avoid;
  }
  #anpcb-print .prtbl.primp th:nth-child(1) { width: 8%; }
  #anpcb-print .prtbl.primp th:nth-child(2) { width: 22%; }
  #anpcb-print .prtbl.primp th:nth-child(3) { width: 11%; }
  #anpcb-print .prtbl.primp th:nth-child(4) { width: 13%; }
  #anpcb-print .prtbl.primp th:nth-child(5) { width: 15%; }
  #anpcb-print .prtbl.primp th:nth-child(6) { width: 15%; }
  #anpcb-print .prtbl.primp th:nth-child(7) { width: 16%; }
  /* Numeric columns print right-aligned, so their labels must sit over the
     same right edge; otherwise each header looks shifted left of its values. */
  #anpcb-print .prtbl.primp thead th:nth-child(n+3) { text-align: right; }
  #anpcb-print .prtbl.primp td { padding-top: 0.7mm; padding-bottom: 0.7mm; }
  #anpcb-print .prtbl.primp + .prf { margin-top: 2.2mm; break-before: avoid; }
  #anpcb-print .prf { break-before: avoid; }
  /* Tall stacks: denser blocks so the sheet still breaks nowhere. */
  #anpcb-print.is-tall .prd { margin-bottom: 1mm; }
  #anpcb-print.is-tall .prd .stackview { padding: 1.3mm 2.4mm 1mm; }
  #anpcb-print.is-tall .prd .sv-l,
  #anpcb-print.is-tall .prd .sv-v { font-size: 3.7pt; line-height: 1.02; }
  #anpcb-print.is-tall .prtbl { font-size: 6.4pt; line-height: 1.2; }
  #anpcb-print.is-tall .prtbl td { padding: 0.32mm 2mm; }
  #anpcb-print.is-tall .prh2 { margin: 2mm 0 0.8mm; font-size: 6.8pt; }
  #anpcb-print.is-tall .prtbl.primp td { padding-top: 0.2mm; padding-bottom: 0.2mm; }
  /* Tall build plus an impedance table: trim the closing block and heading so
     the footnote and footer stay on the same page. */
  #anpcb-print.is-tall.has-imp .prh2 { margin: 1.6mm 0 0.6mm; }
  #anpcb-print.is-tall.has-imp .prtbl td { padding-top: 0.16mm; padding-bottom: 0.16mm; }
  #anpcb-print.is-tall.has-imp .prtbl thead th { padding-top: 0.6mm; padding-bottom: 0.6mm; }
  #anpcb-print.is-tall.has-imp .prtbl.primp + .prf { margin-top: 1.2mm; }
  #anpcb-print.is-tall.has-imp .prfoot { margin-top: 1.2mm; padding-top: 0.8mm; }
  #anpcb-print.is-tall .prfoot { margin-top: 2mm; padding-top: 1.2mm; }
}
