/* Calculator refinements are scoped to this page. */
/* Viewer tools remain fixed while only the paper scrolls. */
.summary-dialog { width: min(1320px, calc(100% - 32px)); height: calc(100dvh - 32px); max-height: calc(100dvh - 32px); border-radius: 18px; }
.summary-dialog-card { height: 100%; max-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; }
.summary-dialog-head { padding: 14px 20px; }
.summary-dialog-head .small-label { font-size: 10px; letter-spacing: .1em; }
.summary-dialog-head h2 { font-size: 20px; }
.summary-dialog-head button { flex: 0 0 44px; height: 44px; }
.summary-toolbar { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 4px 12px; padding: 6px 16px; border-bottom: 1px solid #e5e3df; }
#summaryPages { display: flex; align-items: center; gap: 4px; margin-right: auto; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#summaryPages[hidden], .summary-dialog [hidden] { display: none; }
.summary-zoom-controls { display: flex; gap: 2px; align-items: center; }
.summary-toolbar button { min-width: 44px; min-height: 44px; padding: 6px; background: transparent; color: #292929; border: 0; border-radius: 8px; cursor: pointer; }
.summary-toolbar button:hover { background: #f2f1ef; }
.summary-toolbar button:disabled { opacity: .3; cursor: default; }
#summaryZoomIn, #summaryZoomOut { font-size: 21px; }
#summaryZoomValue { font-size: 12px; font-variant-numeric: tabular-nums; }
#summaryFit { padding-inline: 12px; margin-left: 6px; font-size: 12px; border: 1px solid #e1dfdb; }
#summaryFit[aria-pressed="true"] { background: #f3f1ed; }
#summaryPageToggle { display: none; }
.summary-viewer-body { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; min-height: 0; overflow: hidden; background: #eeedeb; }
.summary-dialog.has-pages .summary-viewer-body { grid-template-columns: 152px minmax(0, 1fr); }
#summaryThumbnails { display: none; min-height: 0; overflow: auto; padding: 18px 16px; background: #f8f7f5; border-right: 1px solid #dedbd6; }
.has-pages #summaryThumbnails { display: flex; flex-direction: column; gap: 16px; }
#summaryThumbnails button { flex-shrink: 0; position: relative; border: 2px solid transparent; background: transparent; padding: 4px; border-radius: 6px; cursor: pointer; color: #6b6861; font-size: 12px; }
#summaryThumbnails button[aria-current="page"] { border-color: #ad681c; color: #875014; background: #fff9ef; }
#summaryThumbnails img { display: block; width: 100%; height: auto; border: 1px solid #e5e3df; }
#summaryThumbnails span { display: block; padding-top: 6px; }
.summary-image-wrap { display: block; min-width: 0; min-height: 0; overflow: auto; padding: 0; background: #eeedeb; scrollbar-gutter: auto; overscroll-behavior: contain; touch-action: none; cursor: grab; }
.summary-image-wrap:active { cursor: grabbing; }
.summary-page-stage { box-sizing: border-box; display: grid; place-items: center; width: max(100%, calc(var(--summary-page-width, 1px) + 32px)); min-height: max(100%, calc(var(--summary-page-height, 1px) + 32px)); padding: 16px; }
.summary-image-wrap img { display: block; width: var(--summary-page-width, 1px); height: var(--summary-page-height, 1px); max-width: none; margin: 0; object-fit: contain; filter: none; box-shadow: 0 4px 22px #24211b18; user-select: none; -webkit-user-drag: none; }
.summary-export-panel { position: relative; z-index: 2; padding: 10px 16px; background: #fff; border-top: 1px solid #e5e3df; }
.summary-export-panel .summary-dialog-actions { display: flex; align-items: center; justify-content: flex-end; padding: 0; border: 0; gap: 8px; flex-wrap: nowrap; }
.summary-dialog-actions .button { width: auto; min-width: 0; min-height: 44px; border-radius: 10px; padding: 10px 16px; font-size: 13px; white-space: nowrap; }
.summary-dialog-actions .summary-line { background: #f2f6f3; color: #295b3a; border: 1px solid #d5e1d8; }
.summary-send-files { position: relative; flex-shrink: 0; }
.summary-send-files > summary { list-style: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.summary-send-files > summary::-webkit-details-marker { display: none; }
.summary-send-files[open] > summary { background: #e7f0e9; }
.summary-more { position: relative; flex-shrink: 0; }
.summary-more > summary { list-style: none; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #dedbd6; border-radius: 10px; cursor: pointer; font-size: 24px; line-height: 1; }
.summary-more > summary::-webkit-details-marker { display: none; }
.summary-more[open] > summary { background: #f3f1ed; }
.summary-more-menu { position: absolute; right: 0; bottom: calc(100% + 12px); width: 220px; padding: 6px; display: grid; gap: 2px; border: 1px solid #e1dfdb; border-radius: 12px; background: #fff; box-shadow: 0 8px 32px #24211b20; }
.summary-more-menu a, .summary-more-menu button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 6px; background: transparent; color: #292929; font: inherit; font-size: 13px; text-decoration: none; text-align: left; cursor: pointer; }
.summary-more-menu :is(a, button):hover { background: #f4f3f0; }
.summary-more-menu i { width: 18px; text-align: center; color: #77736d; }
#summaryExportStatus:not(.sr-only) { position: absolute; right: 16px; bottom: calc(100% + 8px); max-width: calc(100% - 32px); margin: 0; padding: 10px 14px; background: #292929; color: #fff; border-radius: 8px; font-size: 12px; }
#summaryExportStatus:empty { display: none; }
.summary-dialog[open] .summary-dialog-card { animation: summary-enter 160ms ease-out; }
.summary-dialog.is-closing .summary-dialog-card { animation: summary-exit 120ms ease-in forwards; }
@keyframes summary-enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes summary-exit { to { opacity: 0; transform: translateY(4px); } }
.summary-dialog :is(button, a, summary):focus-visible { outline: 2px solid #ad681c; outline-offset: 2px; }
.summary-dialog-actions .button { transition: background 140ms ease; }
@media (max-width: 760px) {
  .summary-dialog { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .summary-dialog-card { max-height: 100%; }
  .summary-dialog-head { padding: max(10px, env(safe-area-inset-top)) 14px 10px; }
  .summary-dialog-head h2 { font-size: 18px; }
  .summary-toolbar { padding: 4px 8px; gap: 0; }
  .summary-zoom-controls { margin-left: auto; }
  #summaryPages { width: 100%; justify-content: center; border-bottom: 1px solid #e5e3df; padding-bottom: 4px; margin-bottom: 4px; }
  #summaryPageToggle { display: inline-block; margin-right: auto; }
  #summaryNext { margin-right: auto; }
  .summary-dialog.has-pages .summary-viewer-body { grid-template-columns: minmax(0, 1fr); }
  .has-pages #summaryThumbnails { display: none; }
  .has-pages.show-pages #summaryThumbnails { display: flex; position: absolute; z-index: 1; inset: 0 auto 0 0; width: 152px; box-shadow: 6px 0 18px #24211b15; }
  .summary-export-panel { padding: 10px 12px max(10px, env(safe-area-inset-bottom)); }
  .summary-dialog-actions > .button, .summary-dialog-actions > .summary-send-files { flex: 1; }
  .summary-dialog-actions > .button, .summary-send-files > summary { width: 100%; padding: 10px 8px; font-size: 12px; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .summary-dialog[open] .summary-dialog-card, .summary-dialog.is-closing .summary-dialog-card { animation: none; }
  .summary-dialog-actions .button { transition: none; }
}
.size-segments > button.active small { color: #fff; opacity: 1; }
.order-item-note { display: block; }
.order-item-note summary { cursor: pointer; color: #525252; font-size: 13px; padding: 8px 0; }
.order-item-note label { display: block; }
.order-item-note textarea { width: 100%; font-size: 16px; color: #292929; }
.order-item-actions button:focus-visible { outline: 2px solid #ad681c; outline-offset: 2px; }
.order-item-copy .order-item-material { display: block; margin-top: 4px; color: #292929; font-size: 12px; line-height: 1.35; }
.order-item-copy .order-item-options { overflow: visible; color: #686868; font-size: 10px; line-height: 1.45; text-overflow: clip; white-space: normal; }
.order-item-footer { grid-column: 2 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; min-width: 0; }
.order-item-footer .order-item-note, .order-item-footer .order-item-price { grid-column: auto; grid-row: auto; min-width: 0; }
.order-item-footer .order-item-price { align-self: end; padding-bottom: 8px; text-align: right; }
.order-item-footer .order-item-price strong { font-size: 15px; }
.order-file-transfer { margin-top: 16px; padding-top: 16px; display: grid; gap: 9px; border-top: 1px solid #eadfd0; }
.order-file-transfer > strong { color: #292929; font-size: 13px; }
.order-file-transfer-links { display: grid; gap: 7px; }
.order-file-transfer-links a { min-width: 0; min-height: 42px; padding: 9px 11px; display: grid; grid-template-columns: 18px auto minmax(0, 1fr) 14px; align-items: center; gap: 8px; border: 1px solid #e2ded7; border-radius: 10px; color: #3d3d3d; font-size: 11px; text-decoration: none; }
.order-file-transfer-links a:hover { border-color: #cabda9; background: #fffaf2; }
.order-file-transfer-links a > :first-child { color: #ad681c; text-align: center; }
.order-file-transfer-links a b { overflow-wrap: anywhere; color: #292929; font-size: 11px; font-weight: 600; }
.order-file-transfer-links a > :last-child { color: #8a8782; font-size: 9px; }
.customer-contact-grid { min-width: 0; }
.calculator-editing-caption { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid #e2aa55; border-radius: 12px; background: #fff8eb; }
.calculator-editing-caption button { min-height: 36px; padding: 6px 10px; border: 1px solid #dba052; border-radius: 8px; background: #fff; color: #875014; font: inherit; font-size: 12px; cursor: pointer; }
.order-item.is-being-edited { border-color: #d78c16; box-shadow: 0 0 0 2px #f2c375; background: #fffaf0; }
.order-delete-dialog { width: min(420px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 18px; background: transparent; }
.order-delete-dialog::backdrop { background: rgb(23 31 37 / 58%); backdrop-filter: blur(3px); }
.order-delete-card { padding: 26px; border-radius: 18px; background: #fff; box-shadow: 0 24px 70px rgb(23 31 37 / 24%); }
.order-delete-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 16px; border-radius: 12px; background: #fff1ef; color: #bd453d; }
.order-delete-card h2 { margin: 3px 0 0; font-size: 24px; }
.order-delete-card p { margin: 14px 0 22px; color: #525252; line-height: 1.6; }
.order-delete-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.order-delete-actions .button { width: 100%; min-height: 46px; border: 1px solid #ddd5c8; background: #fff; color: #292929; }
.order-delete-actions .order-delete-confirm { border-color: #bd453d; background: #bd453d; color: #fff; }
@media (max-width: 520px) {
  .order-item { grid-template-columns: 32px minmax(0, 1fr) 94px; align-items: start; gap: 10px; }
  .order-item-index { grid-column: 1; grid-row: 1; z-index: 1; }
  .order-item-actions { grid-column: 3; grid-row: 1; justify-content: end; }
  .order-item-copy { grid-column: 1 / 3; grid-row: 1; padding-left: 42px; min-width: 0; }
  .order-item-copy small { white-space: normal; overflow: visible; }
  .order-item-footer { grid-column: 1 / -1; grid-row: 2; }
  .order-item-footer .order-item-note, .order-item-footer .order-item-price { grid-column: auto; grid-row: auto; }
  .calculator-editing-caption { align-items: flex-start; }
}
@media (min-width: 351px) and (max-width: 620px) {
  .customer-contact-grid { grid-template-columns: minmax(0, 1.25fr) minmax(128px, .85fr); gap: 10px; }
}

/* Let the two panels share a row, with actions on the same baseline. */
.calculator-page .calculator-workspace { align-items: stretch; }
.calculator-page .calculator-result { position: static; display: flex; flex-direction: column; }
.calculator-page .result-content:not([hidden]) { display: flex; flex: 1; flex-direction: column; }
.calculator-page .result-content > * { flex-shrink: 0; }
.calculator-page .result-add-button { margin-top: auto; }
.calculator-page .result-stat-grid { margin: 16px 0; }
.calculator-page .result-item-price { padding: 10px 18px; }
.calculator-page .result-item-price > div { padding: 4px 0; }
.calculator-page .result-specs { margin: 16px 0; }
.calculator-page .result-specs + .result-item-price { margin: 0 0 20px; }
.calculator-page .result-spec-grid { gap: 14px 20px; }
.calculator-page .result-spec-grid dt { color: #525252; }
.calculator-page .calculator-mode-options { grid-auto-rows: minmax(80px, auto); align-content: start; }
.calculator-page .calculator-mode-options button { width: 100%; min-height: 80px; height: 100%; }
.calculator-page .material-order-hint { margin: 2px 0 14px; color: #525252; font-size: 12px; line-height: 1.5; }
.calculator-page .material-order-hint strong,
.calculator-page .material-order-hint span { display: block; }
.calculator-page .material-order-hint strong { color: #292929; font-weight: 600; }
@media (max-width: 760px) {
  .calculator-page .calculator-mode-section { padding: 12px; }
  .calculator-page .calculator-mode-options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .calculator-page .calculator-mode-options button { padding: 9px; }
  .calculator-page .calculator-mode-options button strong { font-size: 12px; }
  .calculator-page .calculator-mode-options button small { font-size: 10px; line-height: 1.35; }
  .calculator-page .shape-segments { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .calculator-page .shape-segments > button { min-width: 0; padding-inline: 4px; font-size: 12px; white-space: nowrap; }
  .calculator-page #dimensionFields,
  .calculator-page #customSheetDimensions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .calculator-page #dimensionFields:has(.field[hidden]) { grid-template-columns: 1fr; }
  .calculator-page .calculator-result { scroll-margin-top: 86px; }
}
@media (max-width: 360px) {
  .calculator-page .shape-segments { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 981px) {
  .calculator-page .calculator-form { display: flex; flex-direction: column; }
  .calculator-page .calculator-form > .calculate-button { margin-top: auto; }
}
/* Native focus scrolling must not compete with calculator step navigation. */
html:has(body[data-page="calculator"]) { scroll-behavior: auto; }
