/* Mobile and narrow-screen corrections for the IWInco configurator. */
@media (max-width: 980px) {
  .workspace,
  .visual-stage,
  .choices-panel,
  .products-panel,
  .config-card {
    min-width: 0;
    max-width: 100%;
  }

  .workspace {
    width: 100%;
    overflow: clip;
  }
}

@media (min-width: 761px) and (max-width: 980px) {
  .topbar {
    gap: 10px;
    padding-inline: 14px;
  }

  .brand {
    flex: 0 0 128px;
    width: 128px;
  }

  .topbar nav {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0 0 0 auto;
    gap: 3px;
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: none;
  }

  .topbar nav::-webkit-scrollbar {
    display: none;
  }

  .nav-link {
    flex: 0 0 auto;
    padding: 10px 8px;
    font-size: 12px;
    white-space: nowrap;
  }

  .account {
    flex: 0 0 auto;
  }
}

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    overflow-x: clip;
  }

  .intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 15px;
    align-items: start;
    color: #fff;
    padding: 24px 20px 20px;
  }

  .intro-copy {
    min-width: 0;
  }

  .intro h1 {
    color: #fff;
    font-size: clamp(29px, 8vw, 36px);
    line-height: 1.06;
    overflow-wrap: anywhere;
  }

  .intro p {
    color: #e0e6f0;
    font-size: 15px;
    line-height: 1.45;
  }

  .intro .eyebrow {
    color: #a9df83;
  }

  .progress {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    margin: 0;
    padding: 2px 1px 5px;
    scrollbar-width: none;
  }

  .progress::-webkit-scrollbar,
  .category-tabs::-webkit-scrollbar {
    display: none;
  }

  .progress-step {
    flex: 0 0 34px;
    min-width: 34px;
    gap: 0;
  }

  .progress-step b {
    display: none;
  }

  .progress-step span {
    width: 30px;
    height: 30px;
  }

  .progress i {
    flex: 0 0 15px;
    width: 15px;
    margin: 0;
  }

  .category-tabs {
    display: flex;
    width: 100%;
    min-width: 0;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding: 0 20px 17px;
  }

  .category-tabs .tab {
    flex: 0 0 auto;
    max-width: calc(100vw - 40px);
    scroll-snap-align: start;
    font-size: 15px;
    padding: 11px 16px;
  }

  .workspace {
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 14px;
    padding: 0 14px 20px;
  }

  .visual-stage {
    order: 1;
    width: 100%;
    min-height: clamp(360px, 100vw, 440px);
    padding: 76px 24px 72px;
  }

  .preview-panel-title {
    min-height: 54px;
    gap: 8px;
    padding: 0 13px;
  }

  .preview-panel-title b {
    font-size: 15px;
  }

  .preview-panel-title span {
    font-size: 11px;
    white-space: nowrap;
  }

  .visual-stage .view-toggle {
    top: 66px;
    max-width: calc(100% - 24px);
  }

  .view-toggle button {
    padding: 8px 12px;
    font-size: 11px;
  }

  .visual-stage .dimension-width {
    top: 114px;
    left: 18%;
    right: 18%;
  }

  .window-preview {
    width: min(66vw, 270px);
    max-width: 100%;
    border-width: 12px;
  }

  .dimension-height {
    left: 7%;
  }

  .preview-caption {
    bottom: 28px;
    width: calc(100% - 34px);
    max-width: 100%;
  }

  .preview-caption strong {
    font-size: 15px;
  }

  .products-panel {
    order: 2;
    width: 100%;
    min-width: 0;
  }

  .reference-section-title {
    min-height: 50px;
    padding: 0 13px;
  }

  .reference-section-title b {
    font-size: 14px;
  }

  .reference-section-title span {
    font-size: 11px;
    text-align: right;
  }

  .products-panel .products {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    width: 100%;
    max-height: none;
    overflow: visible;
    margin: 0;
    padding: 10px 0 0;
  }

  .products-panel .product {
    display: block;
    min-width: 0;
    min-height: 0;
  }

  .products-panel .product-image {
    display: grid;
    height: clamp(100px, 32vw, 145px);
    padding: 8px;
  }

  .products-panel .product-body {
    min-width: 0;
    min-height: 0;
    padding: 10px;
  }

  .products-panel .product h3 {
    font-size: 14px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .products-panel .product p {
    display: block;
    font-size: 11px;
    line-height: 1.35;
  }

  .products-panel .product-footer {
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
  }

  .products-panel .product-footer strong {
    font-size: 11px;
  }

  .config-card {
    order: 3;
    width: 100%;
    max-height: none;
    margin: 0;
    overflow: hidden;
  }

  .config-content {
    padding: 18px;
  }

  .config-title {
    margin: -18px -18px 16px;
    padding: 16px 18px;
  }

  .field-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dock-product,
  .checkout-dock label {
    display: none;
  }

  .topbar nav {
    bottom: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding: 5px 8px max(5px, env(safe-area-inset-bottom, 0px));
    z-index: 30;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .nav-link {
    flex: 0 0 auto;
    min-height: 42px;
  }

  .checkout-dock {
    position: fixed;
    z-index: 35;
    right: 0;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    left: 0;
    display: flex;
    width: 100%;
    min-height: 70px;
    gap: 10px;
    padding: 8px 12px;
  }

  .dock-price {
    flex: 0 0 auto;
    min-width: 76px;
    margin: 0;
    text-align: left;
  }

  .dock-price strong {
    font-size: 18px;
  }

  .checkout-dock button {
    flex: 1 1 auto;
    min-width: 0;
    height: 48px;
    padding: 0 10px;
    font-size: clamp(12px, 3.5vw, 15px);
    white-space: nowrap;
  }

  .checkout-dock button span {
    margin-left: 6px;
  }

  body {
    padding-bottom: calc(142px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 380px) {
  .products-panel .products {
    grid-template-columns: minmax(0, 1fr);
  }

  .products-panel .product {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .products-panel .product-image {
    height: 100%;
    min-height: 100px;
  }

  .products-panel .product-body {
    padding: 9px;
  }

  .dock-price {
    min-width: 64px;
  }
}

.documents-empty,
.news-locked {
  border: 1px solid #d8dce5;
  background: #fff;
  padding: 20px;
}

.documents-empty p {
  margin-bottom: 0;
  color: #65726b;
}

.document-download-list {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.document-download {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 15px 18px;
  border: 1px solid #d8dce5;
  background: #fff;
  color: #18223a;
  text-decoration: none;
}

.document-download b {
  color: #347047;
  white-space: nowrap;
}

.password-reset-details,
.register-details {
  margin-top: 12px;
}

.password-reset-details form {
  display: grid;
  gap: 10px;
  padding: 12px 0 4px;
}

.reset-message {
  margin: 0;
  color: #347047;
  font-size: 13px;
}

.reset-message.error {
  color: #9d3f38;
}

.admin-dashboard-link {
  display: block;
  margin-top: 9px;
  text-align: center;
  text-decoration: none;
}

.print-preview-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 25, 45, .72);
}

.print-preview-overlay.hidden {
  display: none !important;
}

.print-preview-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(900px, 100%);
  max-height: min(90vh, 1000px);
  background: #f4f6f8;
  box-shadow: 0 24px 90px rgba(0, 0, 0, .28);
}

.print-preview-dialog > header,
.print-preview-dialog > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: #18223a;
  color: #fff;
}

.print-preview-dialog > header p {
  margin: 0 0 3px;
  color: #a9df83;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
}

.print-preview-dialog > header h2 {
  margin: 0;
  font-size: 20px;
}

.print-preview-dialog > header button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #18223a;
  font-size: 24px;
}

.print-preview-content {
  overflow: auto;
  padding: 22px;
}

.print-preview-sheet {
  max-width: 720px;
  margin: 0 auto 16px;
  padding: 22px;
  border: 1px solid #d8dce5;
  background: #fff;
  box-shadow: 0 4px 16px rgba(24, 34, 58, .08);
}

.print-preview-sheet h3 {
  margin: 0 0 12px;
}

.print-preview-customer {
  display: grid;
  gap: 4px;
  margin: 14px 0 8px;
  padding: 12px 14px;
  border-left: 4px solid #79c165;
  background: #f3f7f1;
}

.print-preview-customer span {
  color: #638153;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .1em;
}

.print-preview-customer b {
  color: #1e3027;
  font-size: 16px;
}

.print-preview-customer small {
  color: #5f6e65;
  font-size: 12px;
}

.print-preview-item {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 15px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e6e9ed;
}

.print-preview-drawing {
  width: 110px;
  height: 90px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 7px;
  box-sizing: border-box;
  background: #f6f7f8;
}

.print-window-drawing {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 5px solid #efeee9;
  outline: 1px solid #aab4ae;
  box-sizing: border-box;
  background: linear-gradient(145deg,#dceaf0,#f6fafb);
}

.print-window-drawing .pane-area {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.print-window-drawing .pane-area > .pane {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border-right: 3px solid #f4f2eb;
  box-shadow: inset 0 0 0 1px #aebbb4;
}

.print-window-drawing .pane-area > .pane:last-child {
  border-right: 0;
}

.print-window-drawing svg {
  width: 100%;
  height: 100%;
}

.print-preview-item small {
  display: block;
  margin-top: 4px;
  color: #65726b;
  line-height: 1.5;
}

.print-preview-totals {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, .85fr);
  gap: 24px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #cfd5df;
}

.print-preview-costs,
.print-preview-summary {
  display: grid;
  align-content: start;
  gap: 7px;
}

.print-preview-costs {
  padding: 14px 16px;
  background: #f1f7ed;
  border-left: 4px solid #78ba3c;
  text-align: left;
}

.print-preview-costs > b {
  margin-bottom: 3px;
  color: #35602e;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.print-preview-summary { text-align: right; }

.print-preview-summary .grand {
  padding-top: 9px;
  border-top: 1px solid #cfd5df;
  font-size: 19px;
  font-weight: 850;
}

@media(max-width:700px){
  .print-preview-totals{grid-template-columns:1fr}
}

.print-preview-dialog > footer {
  justify-content: flex-end;
}

.print-preview-dialog > footer button {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid #d8dce5;
  background: #fff;
  color: #18223a;
  font-weight: 750;
}

.print-preview-dialog > footer #confirmPrintPreview {
  border-color: #79c165;
  background: #79c165;
}

.config-content .primary:disabled,
.checkout-dock button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

@media (max-width: 600px) {
  .print-preview-overlay {
    padding: 8px;
  }

  .print-preview-dialog {
    max-height: 94vh;
  }

  .print-preview-content {
    padding: 12px;
  }

  .print-preview-sheet {
    padding: 14px;
  }

  .print-preview-item {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
  }

  .print-preview-drawing {
    width: 76px;
    height: 72px;
  }

  .print-preview-dialog > footer {
    padding: 10px;
  }

  .print-preview-dialog > footer button {
    padding: 0 10px;
    font-size: 12px;
  }
}

@media print {
  .print-preview-overlay {
    display: none !important;
  }
}

/* 1.0.26 — separazione netta foto/testi nelle card catalogo */
.products-panel .product-image {
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.products-panel .product-image img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}
.products-panel .product-body {
  position: relative;
  z-index: 2;
  background: #fff;
  border-top: 1px solid #edf0ed;
}
.products-panel .badge,
.products-panel .product h3,
.products-panel .product p,
.products-panel .product-footer {
  position: relative;
  z-index: 3;
}

@media (max-width: 760px) {
  .products-panel .product {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .products-panel .product-image {
    flex: 0 0 auto;
    height: clamp(112px, 34vw, 152px);
    padding: 12px 12px 18px;
    border-right: 0;
    border-bottom: 0;
    background: #fff;
  }
  .products-panel .product-image img {
    width: 100%;
    height: 100%;
    max-width: 92%;
    max-height: 88%;
    margin: auto;
  }
  .products-panel .product-body {
    flex: 1 1 auto;
    min-height: 154px;
    padding: 13px 10px 11px;
    border-top: 1px solid #e5e9e5;
  }
  .products-panel .badge {
    display: block;
    margin: 0 0 6px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
  .products-panel .product h3 {
    margin: 0 0 6px;
    line-height: 1.2;
  }
  .products-panel .product p {
    margin: 0;
    min-height: 30px;
  }
  .products-panel .product-footer {
    margin-top: 10px;
    padding-top: 9px;
  }
}

@media (max-width: 380px) {
  .products-panel .product {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    min-height: 122px;
  }
  .products-panel .product-image {
    height: 100%;
    min-height: 122px;
    padding: 10px;
    border-right: 1px solid #e5e9e5;
    border-bottom: 0;
  }
  .products-panel .product-body {
    min-height: 122px;
    padding: 10px;
    border-top: 0;
  }
}
