:root {
  font: 16px/1.45 Arial, Helvetica, sans-serif;
  color: #161b1e;
  background: #f1f2f2;
  --ink: #161b1e;
  --muted: #565658;
  --yellow: #ffc42f;
  --line: #d9dcdd;
  --soft: #f5f6f6;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { line-height: 1.1; }
h2 { font-size: 24px; }
p { color: var(--muted); }
.masthead, .hero-band { background: var(--ink); color: white; }
.masthead-inner, .hero, main { max-width: 1280px; margin: 0 auto; padding-inline: 28px; }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 14px; padding-bottom: 12px; }
.ct-logo { display: block; width: 53px; height: auto; }
.badge, .eyebrow { font-size: 11px; font-weight: bold; letter-spacing: .14em; text-transform: uppercase; }
.badge { color: #ababab; text-align: right; }
.hero-band { border-bottom: 5px solid var(--yellow); }
.hero { display: flex; justify-content: space-between; gap: 24px; align-items: end; padding-bottom: 30px; }
.hero-inner { width: 100%; border-top: 2px solid var(--yellow); padding-top: 22px; display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.hero .eyebrow { color: var(--yellow); }
h1 { font-size: clamp(34px,5vw,58px); font-weight: 700; letter-spacing: -.035em; margin: 4px 0 8px; }
.hero p { color: #c4c7c8; }
main { padding-top: 24px; padding-bottom: 28px; }
.panel { background: white; border: 1px solid var(--line); padding: 20px; margin-bottom: 16px; min-width: 0; }
.meta { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.spec-fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,340px),1fr)); gap: 12px; margin-top: 12px; }
.spec-fields form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.spec-fields label { flex: 1 1 160px; }
.grid { display: grid; grid-template-columns: minmax(0,1.9fr) minmax(290px,1fr); gap: 16px; align-items: start; }
.panel-head, .pa-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.pa-head { flex-wrap: wrap; }
.panel-head h2, .pa-head h2 { margin-bottom: 6px; }
.pa-top { border-top: 4px solid var(--yellow); }
.eyebrow { color: var(--muted); margin-bottom: 4px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid #aeb4b5; background: white; padding: 9px 13px; font-size: 14px; font-weight: bold; border-radius: 3px; }
button:hover { background: #edf0f0; }
button:disabled { opacity: .55; cursor: default; }
.primary { border-color: var(--yellow); background: var(--yellow); color: var(--ink); }
.primary:hover { border-color: #efb224; background: #efb224; }
.hero .secondary { border-color: #737b7e; background: transparent; color: white; }
.hero .secondary:hover { background: #343b3e; }
label { display: block; min-width: 0; font-size: 13px; font-weight: bold; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid #b7bdbf; background: white; border-radius: 3px; padding: 8px 9px; }
label :is(input,select,textarea) { margin-top: 5px; }
input:invalid { border-color: #a54b3d; }
:focus-visible { outline: 2px solid #8c6400; outline-offset: 2px; }
.hero :focus-visible { outline-color: var(--yellow); }
.pa-source-fields { display: contents; }
.pa-fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 10px; margin: 10px 0; }
.pa-check { display: flex; align-items: center; align-self: end; gap: 8px; min-height: 37px; }
.pa-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--yellow); }
.pa-check:has(input:disabled) { color: var(--muted); }
.pa-section { margin-top: 14px; }
.pa-file { max-width: 350px; }
.pa-note, .status, footer { font-size: 13px; margin-top: 7px; }
.status:empty { display: none; }
.pa-review { margin-top: 14px; padding: clamp(12px,2vw,20px); border: 1px solid var(--line); border-top: 4px solid var(--yellow); background: var(--soft); }
#pa-review-title, #pa-review-routes-title { font-size: 22px; margin-bottom: 6px; }
.pa-review-actions { margin: 14px 0; gap: 12px; }
.pa-review-actions > .primary { min-height: 52px; min-width: min(240px, 100%); padding: 12px 22px; font-size: 16px; }
.pa-review-route-hangs { display: grid; gap: 6px; margin: 10px 0; }
.pa-review-route-hangs .pa-check { min-height: 30px; }
#pa-review-cards:empty { margin-bottom: 12px; }
summary { cursor: pointer; font-weight: bold; }
.pa-stock > summary { padding: 9px 12px; border: 1px solid var(--line); background: var(--soft); }
.pack-case-options { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,200px),1fr)); gap: 4px 12px; margin: 8px 0; }
.pack-case-options label { display: flex; align-items: start; gap: 8px; overflow-wrap: anywhere; }
.pack-case-options label:has(input:disabled) { color: var(--muted); }
.pack-case-options input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--yellow); }
.pa-card { border: 1px solid var(--line); border-top: 2px solid var(--ink); padding: 15px; margin: 12px 0; background: white; }
.pa-card.has-hang-color { border-top: 1px solid var(--line); border-left: 4px solid var(--hang-accent); background: var(--hang-tint); }
.pa-card + .pa-card { margin-top: 20px; }
.pa-card h3 { font-size: 19px; }
.pa-hang-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; }
.pa-hang-header h3 { overflow-wrap: anywhere; }
.pa-hang-identity { display: grid; grid-template-columns: minmax(0,1fr) minmax(130px,165px); gap: 10px; margin-top: 12px; }
.pa-hang-color select { border-left: 4px solid var(--hang-accent,var(--line)); }
.pa-card a { color: var(--ink); text-decoration-color: #ad7900; text-underline-offset: 3px; font-size: 13px; }
.pa-models { display: grid; gap: 8px; margin: 12px 0; }
.pa-model { border: 1px solid var(--line); background: var(--soft); padding: 10px 12px; }
.has-hang-color :is(.pa-model,.pa-result,.pa-stem) { background: #fffc; }
.has-hang-color .pa-result { border-left-color: var(--hang-accent); }
.pa-model h4 { font-size: 15px; }
.pa-model button { font-size: 13px; padding: 5px 8px; }
.pa-stock-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr auto; gap: 8px; align-items: end; margin: 8px 0; }
.pa-stock-balance { align-self: center; font-size: 13px; }
.pa-result { border-left: 4px solid var(--yellow); padding: 9px 12px; margin: 10px 0; background: var(--soft); }
.pa-result ul { margin: 5px 0; padding-left: 20px; }
.pa-warning { color: #8a382a; font-weight: bold; }
.pa-evidence pre, .pa-result pre, #pa-raw { font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
#pa-raw { max-height: 260px; overflow: auto; }
.pa-rig { margin-top: 6px; }
.pa-inline-truss { border-block: 1px solid var(--line); margin: 8px 0; }
.pa-stem { border: 1px solid var(--line); margin: 8px 0; padding: 8px 12px; background: var(--soft); }
.pa-stem.has-hang-color, .pa-standalone-stem.has-hang-color { border-left: 4px solid var(--hang-accent); background: var(--hang-tint); }
.pa-stem:not(.has-hang-color) .pa-hang-color select { border-left-color: var(--line); }
.table-wrap { overflow: auto; margin: 12px 0; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); }
.routes { min-width: 500px; table-layout: fixed; }
.routes th:nth-child(2) { width: 70px; }
.routes th:nth-child(3) { width: 84px; }
.routes th:last-child { width: 48px; }
.remove { padding: 5px 10px; }
.count { background: var(--ink); color: white; border-bottom: 2px solid var(--yellow); padding: 4px 8px; font-size: 13px; white-space: nowrap; }
.pack-group { padding: 12px 0; border-bottom: 1px solid var(--line); }
.pack-stem, .pack-case { border-left: 3px solid var(--yellow); padding-left: 10px; }
.pack-group h3 { margin: 0 0 4px; font-size: 16px; }
.pack-group.has-hang-color h3 { background: var(--hang-tint); }
.pack-group.has-hang-color h3:not(.pack-linked-title), .pack-group.has-hang-color .pack-linked-title a { border-left: 4px solid var(--hang-accent); }
.pack-group.has-hang-color h3:not(.pack-linked-title), .pack-linked-title a { padding: 8px 9px; }
.pack-group.has-hang-color { border-left: 0; padding-left: 0; }
.pack-linked-title { background: var(--soft); }
.pack-linked-title a { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.pack-linked-title a::after, .pack-member-link::after { content: '↖'; color: var(--muted); }
.pack-member-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px; margin: 6px 0; font-size: 13px; }
.pack-member-links span { color: var(--muted); }
.pack-member-link { padding: 3px 6px; background: var(--hang-tint,var(--soft)); border-left: 3px solid var(--hang-accent,var(--line)); color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.pack-member-link::after { margin-left: 5px; }
.pack-linked-title a:hover, .pack-member-link:hover { text-decoration: underline; }
.pa-hang-header h3, .pack-linked-title, .pack-member-link { scroll-margin-top: 16px; }
.pa-hang-header h3:focus, .pack-linked-title:focus, .pack-member-link:focus { outline: 2px solid var(--hang-accent,#8c6400); outline-offset: 3px; }
.pack-group td, .pack-group th { font-size: 13px; vertical-align: top; }
.pack-group th { background: var(--soft); }
.pack-group small { display: block; color: var(--muted); margin-top: 3px; }
.pack-group .table-wrap { margin: 5px 0; }
.pack-group .pa-warning { font-size: 13px; margin: 4px 0; }
.pack { table-layout: fixed; }
.pack :is(th,td):first-child { overflow-wrap: anywhere; }
.pack th:nth-child(2) { width: 10ch; }
.pack th:nth-child(3) { width: 7ch; }
.pack :is(th,td):nth-child(n+2) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { padding: 16px 0; }
.summary { margin: 12px 0 8px; font-weight: bold; }
.print-text { display: none; }
footer { border-top: 3px solid var(--yellow); color: var(--muted); padding-top: 12px; }
.planner-column { min-width: 0; }
@media screen and (min-width: 900px) {
  .live-pack { position: sticky; top: 16px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; }
  .live-pack #pack { min-height: 0; overflow-y: auto; padding-right: 5px; }
  .live-pack .panel-head, .live-pack > p, .live-pack > .actions { flex: none; }
}
@media(max-width:899px) { .grid { grid-template-columns: 1fr; } }
@media(max-width:660px) {
  .masthead-inner, .hero, main { padding-inline: 16px; }
  .hero-inner { align-items: start; flex-direction: column; gap: 14px; }
  .meta { grid-template-columns: 1fr; }
  .panel { padding: 14px; }
  .pa-stock-row { grid-template-columns: 1fr 1fr; }
}
@media(max-width:400px) { .pa-hang-identity { grid-template-columns: 1fr; } }
@media print {
  :root, body { background: white; }
  .masthead, .hero-band, .has-hang-color { print-color-adjust: exact; }
  .actions, button, footer, .specs, .pa-import, .pa-stock, .pa-rig, .pa-evidence, .pa-card a,
  .routes th:last-child, .routes td:last-child, .status, input, select, textarea { display: none !important; }
  .grid { display: block; }
  .table-wrap { overflow: visible; }
  .routes { min-width: 0; }
  .print-text { display: inline; overflow-wrap: anywhere; }
  .pack-linked-title a::after, .pack-member-link::after { display: none; }
  .pack-group td small, .pa-use-field { display: none; }
  .pack-group, .pa-card, .pa-standalone-stem, tr { break-inside: avoid; }
  thead { display: table-header-group; }
}

.pa-review-block, .pa-review-routing { min-width: 0; margin: 12px 0; padding: 12px; border: 1px solid var(--line); }
.pa-review-block fieldset { min-width: 0; margin: 10px 0; border: 1px solid var(--line); }
.pa-review-block legend { font-weight: bold; }

.pa-review button[aria-pressed="true"] { background: var(--yellow); }

.pa-review-delta { min-width: 0; margin: 14px 0; padding: 4px 12px 10px; border: 1px solid #d9aa39; border-left: 4px solid var(--yellow); background: #fff8e3; }
.pa-review-delta legend { font-weight: 700; }
.pa-review-delta .pa-check { font-weight: 700; }
.pa-review-delta p { margin: 0; }

.pack th:last-child { width: 5rem; }
.pack td:last-child button { padding: .25rem .5rem; }
.pack .pack-edited small:last-child { font-weight: 600; }
.pdf-options.pack-edit-dialog label { display: grid; gap: .25rem; margin-block: .75rem; }
.pack-edit-dialog label :is(input,select) { width: 100%; }
@media print {
  .pack th:last-child, .pack td:last-child, .pack .pack-skipped { display: none; }
}
