/* ==========================================================================
   Planning calculators: Volumetric Weight Calculator and Warehouse Space
   Calculator. Loaded on those pages only, after css/style.css, whose tokens
   it uses. Same look as the area converter (css/area.css): cards on the
   light background, tabular numbers, one orange action per area.
   ========================================================================== */

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ico { width: 1.15em; height: 1.15em; flex: none; }
.btn .ico { width: 1.05em; height: 1.05em; }

/* ---------- Hero ---------- */
.pc-hero-page .page-intro { max-width: 44rem; }
.pc-points { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin: 1.25rem 0 0; padding: 0; font: 500 .9375rem/1.4 var(--f-body); color: var(--ink-2); }
.pc-points li { display: inline-flex; align-items: center; gap: .45rem; }
.pc-points li::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--sun); flex: none; }

/* ---------- Layout ---------- */
.pc-shell { padding: clamp(1.5rem, 4vw, 2.5rem) 0 clamp(2rem, 5vw, 3rem); }
.pc-layout { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; scroll-margin-top: calc(var(--header-h) + 16px); }
.pc-card { min-width: 0; padding: clamp(1rem, 2.5vw, 1.5rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.pc-results { position: sticky; top: calc(var(--header-h) + 12px); max-height: calc(100dvh - var(--header-h) - 24px); overflow-y: auto; overscroll-behavior: contain; }
.pc-h { margin: 0; font-size: 1.25rem; line-height: 1.3; letter-spacing: -.01em; }
.pc-h-gap { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.pc-hint { margin: .35rem 0 0; font-size: .875rem; line-height: 1.45; color: var(--muted); }
.pc-opt { font-weight: 400; color: var(--muted); font-size: .8125rem; }
.pc-alert { padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--sun); }
.pc-textbtn { display: inline; min-height: 24px; padding: .15rem 0; border: 0; background: none; color: var(--sun-ink); font-family: var(--f-body); font-size: .875rem; font-weight: 600; line-height: 1.4; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.pc-textbtn:hover { color: var(--ink); }

/* ---------- Inputs ---------- */
.pc-inputs .field { margin-bottom: 0; min-width: 0; }
.pc-inputs .field label { font-size: .875rem; }
.pc-inputs .field input, .pc-inputs .field select, .pc-inputs textarea { font-variant-numeric: tabular-nums; }
.pc-inputs .field select { padding-right: 2rem; background-position: right .55rem center; }
.pc-gap { margin-top: .85rem; }
.pc-inputs > .field, .pc-inputs .pc-own, .pc-rate { margin-top: .85rem; }
.field input[aria-invalid="true"] { border-color: var(--alarm); background: #FFF6F5; }
.pc-err { margin: .35rem 0 0; font-size: .8125rem; font-weight: 600; line-height: 1.4; color: var(--alarm); }
.pc-io { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 8.5rem); gap: .4rem; }
.pc-io-tight { grid-template-columns: minmax(0, 1fr) 4.6rem; }
.pc-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; margin-top: 1rem; }

.pc-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; margin: .85rem 0 0; padding: 3px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-alt); min-width: 0; }
.pc-seg label { position: relative; display: block; margin: 0; cursor: pointer; }
.pc-seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pc-seg span { display: grid; place-items: center; min-height: 42px; padding: .25rem .4rem; border-radius: calc(var(--r) - 2px); font: 600 .875rem/1.2 var(--f-body); color: var(--ink-2); text-align: center; transition: background-color .15s, color .15s; }
.pc-seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); outline: 1px solid var(--line-strong); }
.pc-seg input:focus-visible + span { outline: 2px solid var(--sun); outline-offset: 1px; }
.pc-seg label:hover span { color: var(--ink); }

.pc-rows { min-height: 11.5rem; margin-top: 1rem; display: grid; gap: .85rem; }
.pc-box { position: relative; min-width: 0; margin: 0; padding: .8rem .85rem .9rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-alt); }
.pc-box legend { padding: 0 .35rem; font: 600 .8125rem/1.2 var(--f-body); color: var(--muted); }
.pc-box-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) 4.6rem; gap: .55rem; }
.pc-box-grid .pc-qty { grid-column: span 1; }
.pc-box-grid .pc-wt { grid-column: span 3; }
.pc-box .field input, .pc-box .field select { background-color: var(--surface); }
.pc-remove { position: absolute; top: -.1rem; right: .35rem; display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: var(--r); background: none; color: var(--muted); cursor: pointer; }
.pc-remove:hover { background: var(--well); color: var(--alarm); }
.pc-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-top: .85rem; }
.pc-row-actions .btn { gap: .4rem; }
.pc-paste { margin-top: .75rem; }
.pc-paste label { display: block; margin-bottom: .35rem; font-size: .875rem; color: var(--ink-2); }
.pc-paste textarea { width: 100%; padding: .55rem .7rem; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); font: 400 .9375rem/1.5 var(--f-body); }
.pc-tries { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: .75rem; }
.pc-tries .pc-hint { margin: 0; }
.pc-chip { min-height: 36px; padding: 0 .75rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: 500 .8125rem/1 var(--f-body); cursor: pointer; transition: border-color .2s, background-color .2s, color .2s; }
.pc-chip:hover { border-color: var(--sun); background: #FFF1EA; color: var(--ink); }

.pc-box-plain { padding: .8rem .85rem .9rem; }

/* ---------- The chosen rule ---------- */
.pc-rule { margin-top: .75rem; font-size: .875rem; line-height: 1.5; color: var(--ink-2); }
.pc-rule:empty { display: none; }
.pc-rule-line { display: flex; align-items: flex-start; gap: .5rem; margin: .4rem 0 0; }
.pc-rule-line .ico { margin-top: .15em; color: var(--teal-deep); }
.pc-rule-note { margin: .5rem 0 0; }
.pc-rule-src { margin: .5rem 0 0; font-size: .8125rem; color: var(--muted); overflow-wrap: anywhere; }
.pc-rule-src a { color: var(--sun-ink); text-underline-offset: 2px; }
.pc-tag { flex: none; padding: .1rem .5rem; border-radius: 999px; font: 600 .6875rem/1.5 var(--f-body); white-space: nowrap; }
.pc-tag-ok { background: #EDF7EE; color: var(--ok); }
.pc-tag-assume { background: #FEF3DC; color: var(--brown); }

.pc-more { margin-top: .85rem; border-top: 1px solid var(--line); }
.pc-more summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; font: 600 .875rem/1.3 var(--f-body); color: var(--ink-2); cursor: pointer; list-style: none; }
.pc-more summary::-webkit-details-marker { display: none; }
.pc-more summary::after { content: "▾"; font-size: .75rem; color: var(--muted); transition: transform .2s; }
.pc-more[open] > summary::after { transform: rotate(180deg); }
.pc-more summary:hover { color: var(--ink); }
.pc-more-body { display: grid; gap: .85rem; padding-bottom: .5rem; }
.pc-more-body .pc-textbtn { justify-self: start; }

/* ---------- Results ---------- */
.pc-hero { margin-top: .25rem; }
.pc-hero-label { margin: 0; font: 600 .875rem/1.3 var(--f-body); color: var(--muted); }
.pc-hero-value { margin: .15rem 0 0; font: 800 clamp(2.5rem, 6vw, 3.5rem)/1.05 var(--f-display); letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pc-hero-value small { font-size: .42em; font-weight: 700; letter-spacing: 0; color: var(--ink-2); }
.pc-hero-sub { margin: .4rem 0 0; font-size: .9375rem; line-height: 1.45; color: var(--ink-2); }
.pc-hero-rule { display: inline-block; margin: .5rem 0 0; padding: .2rem .6rem; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-alt); font: 600 .75rem/1.3 var(--f-body); color: var(--ink-2); }
.pc-cost { margin: .75rem 0 0; padding: .55rem .75rem; border-radius: var(--r); background: var(--bg-alt); font-size: .9375rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pc-cost strong { color: var(--ink); }
.pc-bars { display: grid; gap: .45rem; margin-top: 1rem; }
.pc-bar-row { display: grid; grid-template-columns: minmax(5.5rem, 8.5rem) minmax(0, 1fr) auto; align-items: center; gap: .6rem; font-size: .875rem; color: var(--ink-2); }
.pc-bar-row b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc-bar { display: block; height: 12px; border-radius: 6px; background: var(--well); overflow: hidden; }
.pc-bar i { display: block; height: 100%; border-radius: 6px; }
.pc-bar .is-vol { background: var(--sun); }
.pc-bar .is-act { background: var(--teal-deep); }
.pc-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: .6rem .9rem; margin: 1rem 0 0; padding: .75rem .85rem; border-radius: var(--r); background: var(--bg-alt); }
.pc-metrics dt { font-size: .75rem; color: var(--muted); }
.pc-metrics dd { margin: .1rem 0 0; font: 700 1rem/1.3 var(--f-display); color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pc-insights { margin: .85rem 0 0; padding: 0 0 0 1.1rem; font-size: .9375rem; line-height: 1.5; color: var(--ink-2); }
.pc-insights:empty { display: none; }
.pc-insights li + li { margin-top: .35rem; }
.pc-steps { margin: 0 0 .5rem; padding: 0 0 0 1.25rem; font-size: .875rem; line-height: 1.55; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pc-steps li + li { margin-top: .25rem; }
.pc-empty { padding: 2rem .5rem; text-align: center; }
.pc-empty-title { margin: 0; font-weight: 600; color: var(--ink); }
.pc-share { margin-top: .85rem; padding-top: .85rem; border-top: 1px solid var(--line); }
.pc-share-row { display: flex; flex-wrap: wrap; gap: .45rem; }
.pc-share-row .btn { gap: .4rem; }
.pc-share .pc-hint:empty { display: none; }

/* ---------- Tables ---------- */
.pc-table-wrap { overflow-x: auto; }
.pc-table-wrap:focus-visible { outline: 2px solid var(--sun); outline-offset: 2px; }
.pc-table { width: 100%; border-collapse: collapse; font-size: .9375rem; font-variant-numeric: tabular-nums; }
.pc-table th, .pc-table td { padding: .55rem .6rem; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
.pc-table thead th { border-top: 0; font: 600 .75rem/1.3 var(--f-body); color: var(--muted); white-space: nowrap; }
.pc-table td { white-space: nowrap; }
.pc-table td[colspan] { white-space: normal; }
.pc-table tbody th { font-weight: 500; color: var(--ink); }
.pc-table .pc-num { text-align: right; white-space: nowrap; }
.pc-table strong { font-weight: 700; color: var(--ink); }
.pc-table .is-picked th, .pc-table .is-picked td { background: #FFF6F0; }
.pc-table .is-off td, .pc-table .is-off th { color: var(--muted); }
.pc-compare { margin-top: 1.5rem; padding: clamp(1rem, 2.5vw, 1.5rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.pc-compare .pc-table-wrap { margin-top: .75rem; }

/* ---------- Next steps ---------- */
.pc-next { margin-top: 1.5rem; }
.pc-next-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .85rem; margin: .75rem 0 0; padding: 0; }
.pc-next-card { display: grid; gap: .3rem; height: 100%; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--ink-2); font-size: .9375rem; line-height: 1.45; text-decoration: none; transition: border-color .2s, box-shadow .2s; }
.pc-next-card strong { color: var(--ink); font-size: 1rem; }
.pc-next-card:hover { border-color: var(--sun); box-shadow: var(--shadow-sm); }
.pc-next-card.is-main { border-color: var(--sun); background: #FFF6F0; }
.pc-disclaimer { max-width: 56rem; margin: 1.5rem 0 0; font-size: .8125rem; line-height: 1.55; color: var(--muted); }
.pc-guide { border-top: 1px solid var(--line); }

/* ---------- Warehouse plan ---------- */
.pc-plan { margin: .85rem 0 0; }
.pc-plan svg { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.pc-plan figcaption { margin-top: .35rem; font-size: .8125rem; line-height: 1.45; color: var(--muted); }
.pc-breakdown { display: flex; height: 14px; margin-top: 1rem; border-radius: 7px; overflow: hidden; background: var(--well); }
.pc-breakdown i { display: block; height: 100%; }
.pc-legend { list-style: none; display: grid; gap: .3rem; margin: .6rem 0 0; padding: 0; font-size: .875rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pc-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: .5rem; }
.pc-legend i { width: 12px; height: 12px; border-radius: 3px; }
.pc-legend b { font-weight: 700; color: var(--ink); white-space: nowrap; }
.pc-c-store { background: var(--sun); }
.pc-c-aisle { background: #F7C7A9; }
.pc-c-cross { background: #BFE3EA; }
.pc-c-dock { background: var(--teal-deep); }
.pc-c-office { background: var(--brown); }
.pc-assume-note { margin: .5rem 0 0; font-size: .8125rem; line-height: 1.5; color: var(--muted); }
.pc-assume-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: .85rem; }
.pc-assume-grid .pc-src { display: block; margin-top: .25rem; font-size: .75rem; line-height: 1.4; color: var(--muted); }
.pc-note { margin: .75rem 0 0; padding: .55rem .75rem; border: 1px solid #BFE3EA; border-radius: var(--r); background: #EEF7F9; font-size: .875rem; line-height: 1.45; color: var(--ink-2); }
.pc-warn { margin: .75rem 0 0; padding: .55rem .75rem; border: 1px solid rgba(180, 35, 24, .3); border-radius: var(--r); background: #FFF6F5; font-size: .875rem; line-height: 1.45; color: var(--alarm); font-weight: 600; }

/* The guides' tables (inside .prose, which scrolls tables sideways on phones) */
.prose .pc-guide-num td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prose .pc-guide-num td.pc-left { text-align: left; white-space: normal; }
.prose .pc-guide-src { font-size: .9375rem; }
.prose table.pc-guide-src th[scope="row"] { min-width: 10rem; }
.prose table.pc-guide-src td { white-space: nowrap; }
.prose table.pc-guide-src td.pc-left { min-width: 17rem; white-space: normal; }

/* The bar that shows the result on a phone while the result itself is out of view (kit.js, resultBar) */
.pc-jump { display: none; }

/* ---------- Smaller screens ---------- */
@media (max-width: 960px) {
  .pc-layout { grid-template-columns: 1fr; }
  .pc-results { position: static; max-height: none; overflow: visible; scroll-margin-top: calc(var(--header-h) + 16px); }
  #wc-result-title, #sc-result-title { scroll-margin-top: calc(var(--header-h) + 24px); }
  .pc-jump:not([hidden]) {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .75rem 1.25rem calc(.75rem + env(safe-area-inset-bottom)); background: var(--ink); color: #fff; font: 700 1rem/1.25 var(--f-body); text-decoration: none; font-variant-numeric: tabular-nums;
  }
  .pc-jump span:last-child { flex: none; color: var(--sun); font-size: .875rem; }
}
@media (max-width: 640px) {
  .pc-points { display: none; }
}
@media (max-width: 560px) {
  .pc-pair { grid-template-columns: 1fr; }
  .pc-box-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pc-box-grid .pc-unit { grid-column: span 1; }
  .pc-box-grid .pc-qty { grid-column: span 2; }
  .pc-box-grid .pc-wt { grid-column: 1 / -1; }
  .pc-seg-4 { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pc-bar-row { grid-template-columns: minmax(4.5rem, 6.5rem) minmax(0, 1fr) auto; }
  .pc-table { font-size: .875rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pc-seg span, .pc-chip, .pc-next-card, .pc-more summary::after { transition: none; }
}
@media print {
  .site-header, .site-footer, .more-tools, .pc-guide, .pc-share, .pc-next, .pc-tries, .pc-row-actions, .pc-remove, .pc-paste, .pc-jump, .page-hero, .breadcrumbs { display: none !important; }
  .pc-layout { grid-template-columns: 1fr; }
  .pc-results { position: static; max-height: none; overflow: visible; }
  .pc-card, .pc-compare { box-shadow: none; }
  details.pc-more > * { display: block; }
}
