/* Calculator surfaces inherit the site's typography, palette and shared chrome. */
[data-cargo-text] { width: 100%; box-sizing: border-box; resize: vertical; min-height: 220px; margin-top: 10px; padding: 16px; border: 1px solid #ced6e0; border-radius: 8px; font: inherit; font-size: 15px; line-height: 1.7; color: var(--foreground); background: white; }
[data-cargo-text]::placeholder { color: #7b8795; }
[data-cargo-text]:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.tool-parse { margin-top: 18px; min-height: 46px; }
.tool-parse:disabled { opacity: .6; cursor: wait; }
.tool-result { align-self: start; }
.tool-recognized { margin-top: 20px; font-size: 13px; }
.tool-recognized summary { cursor: pointer; }
.tool-table-scroll { overflow-x: auto; margin-top: 12px; }
.tool-table-scroll table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tool-table-scroll td, .tool-table-scroll th { padding: 9px 6px; text-align: right; border-bottom: 1px solid var(--border); }
.tool-table-scroll td:first-child, .tool-table-scroll th:first-child { text-align: left; overflow-wrap: anywhere; min-width: 100px; }
.cargo-tool { padding: 112px 0 80px; }
.cargo-tool [hidden] { display: none !important; }
.tool-breadcrumb { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-bottom: 28px; }
.tool-breadcrumb a:hover, .tool-related:hover { color: var(--primary); }
.tool-heading { max-width: 900px; margin-bottom: 32px; }
.tool-eyebrow { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .13em; margin: 0 0 10px; }
.tool-heading h1 { max-width: none; font-size: clamp(30px, 3.6vw, 46px); line-height: 1.16; letter-spacing: -.035em; margin-bottom: 16px; font-weight: 600; }
.tool-heading > p:last-child { color: var(--muted); font-size: 17px; line-height: 1.6; margin-bottom: 0; }
.tool-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 24px; align-items: stretch; }
.tool-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 28px; min-width: 0; }
.cargo-tool h2 { max-width: none; font-size: 21px; line-height: 1.35; letter-spacing: -.015em; font-weight: 600; margin: 0 0 16px; }
.tool-card-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.tool-text-button { font: inherit; font-size: 13px; font-weight: 500; color: var(--muted); border: 0; background: none; padding: 8px 0; cursor: pointer; text-align: left; }
.tool-text-button:hover { color: var(--primary); }
.tool-dimensions-note { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 0 0 18px; }
.tool-dimensions-note p { margin: 0; font-size: 13px; color: var(--muted); }
.tool-units { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.tool-units select { border: 1px solid var(--border); border-radius: 6px; background: white; font: inherit; color: var(--foreground); padding: 6px 9px; }
.tool-box { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.tool-box legend { font-size: 12px; color: var(--muted); padding: 0; margin-bottom: 8px; }
.tool-box-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tool-field { display: block; min-width: 0; font-size: 13px; color: var(--foreground); }
.tool-field > label { display: block; }
.tool-field input, .tool-field select, [data-copy-fallback] { display: block; width: 100%; min-width: 0; height: 46px; border: 1px solid #ced6e0; border-radius: 6px; padding: 10px 12px; margin-top: 8px; color: var(--foreground); background: #fff; font: inherit; font-size: 16px; }
.tool-field input::placeholder { color: #8a97a7; }
.tool-field small { display: block; color: var(--muted); margin-top: 8px; }
.cargo-tool :is(input, select, button, a, summary):focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }
.tool-field input[aria-invalid=true] { border-color: var(--primary); }
.tool-add { font: inherit; font-size: 13px; color: var(--foreground); border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 10px 14px; cursor: pointer; margin-top: 2px; }
.tool-add:hover { border-color: var(--primary); }
.tool-remove { padding: 4px 0; margin-top: 4px; }
.tool-weight-section { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.tool-switch { display: flex; border: 0; padding: 0; margin: 0 0 18px; gap: 4px; background: var(--background); border-radius: 8px; }
.tool-switch label { flex: 1; min-width: 0; cursor: pointer; position: relative; }
.tool-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tool-switch span { display: block; padding: 10px 8px; text-align: center; font-size: 13px; border: 1px solid transparent; border-radius: 6px; }
.tool-switch input:checked + span { background: #fff; border-color: rgba(239,68,68,.3); color: #bf3030; }
.tool-switch input:focus-visible + span { outline: 3px solid var(--ring); outline-offset: 2px; }
.tool-help, .tool-form-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; line-height: 1.6; }
.tool-settings { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.tool-settings summary { cursor: pointer; font-size: 13px; }
.tool-settings summary span { float: right; color: var(--muted); font-size: 12px; }
.tool-settings-body { padding-top: 18px; display: grid; gap: 14px; }
.tool-form-note { margin-top: 16px; }
.tool-error { font-size: 13px; margin: 14px 0 0; color: #b4232d; }
.tool-result { background: linear-gradient(150deg, #fff, #f2f6fa); display: flex; flex-direction: column; }
.tool-result h2 { margin-bottom: 26px; }
.tool-result-details { margin: 0; display: grid; gap: 20px; }
.tool-result-details div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.tool-result-details dt { font-size: 14px; color: var(--muted); }
.tool-result-details dd { margin: 0; font-size: 24px; font-weight: 500; }
.tool-main-result { margin: 24px 0 0; padding-top: 24px; border-top: 1px solid var(--border); }
.tool-main-result > span { font-size: 14px; display: block; }
.tool-main-result strong { display: block; font-size: clamp(32px, 4vw, 48px); line-height: 1.2; letter-spacing: -.03em; font-weight: 600; margin: 12px 0 18px; overflow-wrap: anywhere; }
.tool-main-result p { font-size: 14px; line-height: 1.6; margin: 0; }
[data-calculator=density] .tool-main-result { margin: 0 0 24px; border-top: 0; padding: 0; }
[data-calculator=density] .tool-result-details { padding-top: 20px; border-top: 1px solid var(--border); }
.tool-result-note { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 20px 0; }
.tool-reset { margin-top: auto; align-self: flex-start; }
.tool-invite { display: flex; gap: 24px; align-items: center; justify-content: space-between; margin-top: 24px; padding: 26px 28px; border: 1px solid rgba(239,68,68,.2); background: #fff; border-radius: 16px; }
.tool-invite h2 { font-size: 20px; margin: 0 0 8px; }
.tool-invite p { margin: 0; font-size: 14px; color: var(--muted); }
.tool-invite .btn { min-height: 48px; flex-shrink: 0; }
.tool-invite .btn:disabled { background: var(--secondary); color: var(--muted); }
.tool-chat { margin-top: 24px; padding: 28px; }
.tool-chat-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.tool-chat-summary { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.tool-chat iframe { width: 100%; height: 650px; display: block; border: 1px solid var(--border); border-radius: 12px; background: white; margin-top: 18px; }
.tool-chat-footnote { color: var(--muted); font-size: 12px; margin: 14px 0 0; }
.tool-chat-recovery { padding: 20px 0; }
.tool-chat-recovery p { margin: 16px 0 0; }
.tool-chat-recovery a { text-decoration: underline; }
[data-copy-fallback] { min-height: 180px; }
.tool-information { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; padding-top: 56px; }
.tool-information p { font-size: 14px; line-height: 1.8; color: var(--muted); }
.tool-formula { background: var(--secondary); border-radius: 8px; padding: 16px 20px; font-size: 14px; margin: 18px 0; }
.tool-related { font-size: 14px; font-weight: 500; text-decoration: underline; text-underline-offset: 4px; }
.tool-faq details { border-bottom: 1px solid var(--border); padding: 16px 0; }
.tool-faq summary { font-size: 14px; cursor: pointer; }
.tool-faq details p { margin: 12px 0 0; }
.tool-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
@media (max-width: 900px) { .tool-grid { grid-template-columns: minmax(0,1.3fr) minmax(0,1fr); gap: 16px; } .tool-card { padding: 22px; } .tool-invite { flex-direction: column; align-items: stretch; } .tool-information { gap: 32px; } }
@media (max-width: 680px) { .cargo-tool { padding: 96px 0 48px; } .tool-breadcrumb { margin-bottom: 22px; font-size: 11px; gap: 8px; } .tool-heading { margin-bottom: 24px; } .tool-heading > p:last-child { font-size: 15px; } .tool-grid, .tool-information { grid-template-columns: minmax(0,1fr); } .tool-box-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .tool-card, .tool-invite { padding: 20px; } .tool-switch span { font-size: 12px; } .tool-add { width: 100%; padding-inline: 8px; } .tool-information { padding-top: 36px; } .tool-chat iframe { height: 620px; } .tool-chat-heading { align-items: flex-start; } .tool-chat-heading .tool-text-button { max-width: 120px; } .tool-settings summary span { float: none; display: block; margin: 6px 0 0 16px; } }
@media (prefers-reduced-motion: reduce) { .cargo-tool * { scroll-behavior: auto; } }

/* Reuse the shared narrow-header layout before its actions can overlap the logo. */
@media (min-width: 361px) and (max-width: 440px) {
  .calculator-page .site-header .nav { flex-wrap: wrap; gap: 8px; padding-block: 8px; }
  .calculator-page .site-header .brand { flex: 0 0 100%; }
  .calculator-page .site-header .nav-actions { display: grid; grid-template-columns: 36px auto minmax(0,1fr); gap: 6px; width: 100%; }
  .calculator-page .site-header .nav-actions .btn { padding-inline: 8px; font-size: 12px; }
}
@media (max-width: 440px) {
  .calculator-page .cargo-tool { padding-top: 118px; }
  .calculator-page { --site-header-offset: 110px; }
  .calculator-page [id] { scroll-margin-top: 110px; }
}

@media (max-width: 680px) {
  .tool-chat { padding: 20px 0; width: calc(100% + 24px); margin-left: -12px; }
  .tool-chat > :not([data-frame-host]) { margin-left: 20px; margin-right: 20px; }
  .tool-chat iframe { border-left: 0; border-right: 0; border-radius: 0; }
}
