/* 73.18.0 · UX quality pass
   Screen-only polish. PDF and print layouts keep their existing contract. */
@media screen {
  :root {
    --ux-bg: #f5f2ed;
    --ux-surface: #fffdfa;
    --ux-surface-strong: #ffffff;
    --ux-ink: #302a25;
    --ux-muted: #756b61;
    --ux-line: #e2d9cd;
    --ux-line-strong: #d3c5b5;
    --ux-accent: #6c5744;
    --ux-accent-soft: #f1e6d8;
    --ux-green: #2e7653;
    --ux-radius: 18px;
    --ux-shadow: 0 8px 22px rgba(54, 41, 28, .045);
    --ux-shadow-raised: 0 14px 34px rgba(54, 41, 28, .09);
  }

  body {
    background:
      radial-gradient(circle at 88% -6%, rgba(219, 199, 174, .24), transparent 29rem),
      var(--ux-bg);
    color: var(--ux-ink);
  }

  main {
    padding: clamp(18px, 2.3vw, 32px) clamp(16px, 2.8vw, 38px);
  }

  .view {
    max-width: 1480px;
    margin: 0 auto;
    min-width: 0;
  }

  .app-utility {
    position: sticky;
    top: 0;
    z-index: 35;
    min-height: 58px;
    padding: 8px 12px;
    background: rgba(250, 247, 242, .9);
    border: 1px solid rgba(226, 217, 205, .94);
    border-radius: 16px;
    box-shadow: 0 5px 16px rgba(54, 41, 28, .045);
    backdrop-filter: blur(16px);
  }

  .utility-left,
  .utility-right,
  .breadcrumb {
    min-width: 0;
  }

  .section-context {
    min-width: 0;
  }

  .section-context #currentSectionTitle {
    font-weight: 700;
    letter-spacing: -.015em;
  }

  .section-context #currentSectionSubtitle {
    color: var(--ux-muted);
    font-size: 11px;
  }

  .utility-right {
    gap: 8px;
  }

  .utility-right #quickNewSale,
  .utility-right #quickQuotation {
    display: inline-flex !important;
    align-items: center;
    min-height: 40px;
    padding: 9px 13px;
    border-radius: 11px;
    font-size: 12px;
  }

  .utility-right #quickNewSale {
    background: var(--ux-accent);
    border: 1px solid var(--ux-accent);
    color: #fffdf8;
    box-shadow: 0 3px 8px rgba(74, 55, 38, .12);
  }

  .utility-right #quickNewSale span {
    font-size: 18px;
    line-height: 1;
    margin-right: 5px;
  }

  .utility-right #quickQuotation {
    background: var(--ux-accent-soft);
    border-color: #dfcfbb;
    color: #654e39;
  }

  .sidebar .brand {
    padding: 13px 12px 17px;
    border-bottom-color: rgba(255, 255, 255, .12);
  }

  .sidebar .brand p {
    color: #cbbcac;
    line-height: 1.4;
  }

  .sidebar .nav-section-title {
    margin-top: 8px;
    padding: 0 10px;
    font-size: 10px;
    letter-spacing: .16em;
  }

  .sidebar .nav {
    min-height: 44px;
    padding: 11px 13px;
    border-radius: 12px;
  }

  .sidebar .nav.active {
    box-shadow: inset 3px 0 0 #d8b98f;
  }

  .view > .top {
    margin: 20px auto 18px;
    padding: 0 2px;
  }

  .view > .top h1,
  #venta .sale-editor-top h1 {
    color: var(--ux-ink);
    letter-spacing: -.035em;
    font-weight: 700;
  }

  .view > .top p,
  #venta .sale-editor-top p {
    color: var(--ux-muted);
  }

  #venta .sale-editor-top {
    align-items: flex-start;
    gap: 22px;
    padding: 16px 18px 17px;
    margin-top: 12px;
    background: rgba(255, 253, 249, .88);
    border: 1px solid var(--ux-line);
    border-radius: 20px;
    box-shadow: var(--ux-shadow);
  }

  #venta .sale-editor-top > div:first-child {
    min-width: 0;
  }

  #venta .sale-editor-top h1 {
    display: inline-block;
    margin-right: 9px;
    vertical-align: middle;
  }

  .version-pill {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 4px 9px;
    border: 1px solid #cdb99f;
    border-radius: 999px;
    background: #f7eee2;
    color: #745b43;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .045em;
    vertical-align: middle;
  }

  #venta .sale-editor-top .top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    gap: 8px;
  }

  #venta .sale-editor-top .top-actions button {
    min-height: 44px;
    white-space: nowrap;
  }

  #venta #saveSale.sale-save-button {
    min-width: 170px;
    background: linear-gradient(135deg, #65503d, #80664a);
    border: 1px solid #5e4937;
    box-shadow: 0 5px 12px rgba(74, 55, 38, .15);
  }

  #venta #saveSale.sale-save-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #574432, #72583f);
    box-shadow: 0 7px 16px rgba(74, 55, 38, .18);
  }

  #venta #saveSale.sale-save-button.is-pending {
    box-shadow: 0 0 0 3px rgba(192, 148, 92, .2), 0 6px 14px rgba(74, 55, 38, .16);
  }

  #venta #saveSale.sale-save-button.is-pending .button-icon {
    color: #f1ca90;
  }

  #venta .sale-editor-status {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    margin-top: 8px;
    color: var(--ux-muted);
    font-size: 12px;
  }

  #venta .sale-editor-status::before {
    content: '';
    width: 7px;
    height: 7px;
    margin-right: 7px;
    border-radius: 50%;
    background: #a99a89;
  }

  #venta .sale-editor-status.has-pending::before {
    background: #c58c43;
    box-shadow: 0 0 0 3px rgba(197, 140, 67, .14);
  }

  #venta .current-sale-cards {
    gap: 10px;
    margin: 14px 0 20px;
  }

  #venta .current-sale-cards .mini-card {
    min-width: 0;
    padding: 14px 16px;
    background: rgba(255, 253, 249, .88);
    border-color: var(--ux-line);
    border-radius: 15px;
    box-shadow: none;
  }

  #venta .current-sale-cards .mini-card span {
    color: var(--ux-muted);
    font-size: 11px;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  #venta .current-sale-cards .mini-card strong {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ux-ink);
    font-size: 19px;
    font-variant-numeric: tabular-nums;
  }

  #venta .workgrid {
    grid-template-columns: minmax(500px, 600px) minmax(0, 1fr);
    gap: clamp(18px, 2.4vw, 32px);
  }

  #venta .form-stack {
    gap: 14px;
  }

  #venta .form-card,
  #venta .paper-wrap {
    min-width: 0;
  }

  #venta .form-card {
    padding: 20px 21px 21px;
    background: rgba(255, 253, 249, .94);
    border-color: var(--ux-line);
    border-radius: var(--ux-radius);
    box-shadow: var(--ux-shadow);
  }

  #venta .form-card .section-head {
    min-height: 42px;
    padding-bottom: 11px;
    border-bottom: 1px solid #eee7de;
  }

  #venta .form-card .section-head h2 {
    color: var(--ux-ink);
    font-size: 19px;
    letter-spacing: -.02em;
  }

  #venta .form-card .section-head > div {
    min-width: 0;
  }

  #venta .form-card .section-head > div > span:last-child {
    flex: 0 0 auto;
  }

  #venta .step-badge {
    width: 31px;
    height: 31px;
    background: var(--ux-accent-soft);
    color: var(--ux-accent);
    border: 1px solid #dfcfbc;
    font-size: 13px;
  }

  #venta .form-card .help {
    max-width: 68ch;
    margin: 10px 0 15px;
    font-size: 12px;
    line-height: 1.55;
  }

  #venta .form-card label {
    color: #665b51;
    font-size: 12px;
    font-weight: 650;
  }

  #venta .form-card input,
  #venta .form-card select,
  #venta .form-card textarea {
    min-height: 45px;
    border-color: #ddd2c5;
    border-radius: 11px;
    background: var(--ux-surface-strong);
    transition: border-color .15s, box-shadow .15s, background-color .15s;
  }

  #venta .form-card input:hover,
  #venta .form-card select:hover,
  #venta .form-card textarea:hover {
    border-color: #cbb9a5;
  }

  #venta .form-card input:focus,
  #venta .form-card select:focus,
  #venta .form-card textarea:focus {
    border-color: #9d7c59;
    box-shadow: 0 0 0 3px rgba(157, 124, 89, .14);
  }

  #venta #items {
    display: grid;
    gap: 11px;
  }

  #venta #items .item {
    position: relative;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border-color: var(--ux-line);
    border-radius: 15px;
    background: var(--ux-surface-strong);
    box-shadow: 0 2px 7px rgba(54, 41, 28, .025);
  }

  #venta #items .item-grid {
    padding: 16px 16px 5px;
    gap: 9px;
  }

  #venta #items .item-grid > label:nth-child(1),
  #venta #items .item-grid > label:nth-child(2) {
    font-weight: 700;
  }

  #venta #items .item-grid > label:nth-child(2) {
    align-self: start;
  }

  #venta #items .item-spec {
    min-height: 82px;
    line-height: 1.45;
    resize: vertical;
    white-space: pre-wrap;
  }

  .spec-list-text {
    white-space: pre-line;
    line-height: 1.5;
  }

/* v73.20 — ficha técnica inteligente */
.item-tech-sheet,
.catalog-tech-sheet,
.q-tech-sheet {
  margin: 10px 0 0;
  padding: 13px 14px 14px;
  border: 1px solid #eadfd3;
  border-radius: 14px;
  background: #fbf8f3;
}
.item-tech-head,
.catalog-tech-head,
.q-tech-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.item-tech-head strong,
.catalog-tech-head strong,
.q-tech-head strong { color: #4e4034; font-size: 13px; }
.item-tech-head small,
.catalog-tech-head small,
.q-tech-head small { display: block; margin-top: 2px; color: #918276; font-size: 11px; font-weight: 500; }
.item-category-badge,
#prodCategoryHint {
  padding: 5px 9px;
  border-radius: 999px;
  background: #eee4d8;
  color: #6e5947;
  font-size: 11px;
  font-weight: 800;
}
.component-editor { display: grid; gap: 8px; }
.component-row { display: grid; grid-template-columns: minmax(0, 1fr) 32px; gap: 7px; align-items: end; }
.component-row label { display: grid; grid-template-columns: 112px minmax(100px, .8fr) minmax(0, 1.7fr); gap: 7px; align-items: center; margin: 0; color: #83776c; font-size: 11px; font-weight: 800; }
.component-row label span { white-space: nowrap; }
.component-row input { min-width: 0; margin: 0; min-height: 38px; padding: 9px 10px; border-radius: 10px; font-size: 12px; }
.component-label { color: #5d5044; font-weight: 700; }
.component-remove { width: 32px; height: 38px; padding: 0; border: 1px solid #e9c9c1; border-radius: 10px; background: #fff4f1; color: #a13d36; font-size: 19px; line-height: 1; }
.component-add { justify-self: start; padding: 7px 10px; border: 1px dashed #cdbda9; border-radius: 9px; background: transparent; color: #765f4c; font-size: 11px; font-weight: 800; }
.item-spec-notes,
.catalog-tech-sheet > label,
.q-tech-sheet > label { margin: 11px 0 0; }
.item-spec-notes textarea,
.catalog-tech-sheet textarea,
.q-tech-sheet textarea { min-height: 68px; line-height: 1.45; }
.catalog-tech-sheet { margin-top: 2px; }
.catalog-category-cell { display: block; margin-top: 3px; color: #8b7a6c; font-size: 10px; }
.product-card-meta { min-height: 20px; margin-bottom: 3px; }
.product-category-badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: #eee4d8; color: #6e5947; font-size: 10px; font-weight: 800; }

@media (max-width: 720px) {
  .component-row label { grid-template-columns: 1fr 1fr; gap: 6px; }
  .component-row label span { grid-column: 1 / -1; }
  .component-row label .component-value { grid-column: 1 / -1; }
  .item-tech-sheet,
  .catalog-tech-sheet,
  .q-tech-sheet { padding: 12px; }
}

  #venta #items .item-grid > label:nth-child(3),
  #venta #items .item-grid > label:nth-child(4),
  #venta #items .item-grid > label:nth-child(5) {
    min-width: 0;
  }

  #venta #items .item-grid > label:nth-child(5) input {
    background: #f7f2eb;
    color: #5e5143;
    font-weight: 700;
  }

  #venta #items .item-photo-field {
    min-width: 0;
  }

  #venta #items .item-internal-cost {
    grid-template-columns: minmax(150px, .9fr) minmax(0, 1.4fr);
    gap: 10px;
    margin: 4px 0 0;
    padding: 14px 16px 16px;
    border: 0;
    border-top: 1px solid #eee7de;
    border-radius: 0;
    background: #fbf8f3;
  }

  #venta #items .item-internal-cost label {
    margin-bottom: 0;
  }

  #venta #items .item-internal-cost label:first-child {
    color: #805d35;
  }

  #venta #items .item-internal-cost input,
  #venta #items .item-internal-cost select {
    min-height: 43px;
  }

  #venta #items .item-internal-cost .item-cost-summary {
    grid-column: 1 / -1;
    margin-top: 1px;
    padding: 10px 11px;
    border: 1px solid #eadcc9;
    border-radius: 10px;
    background: #fff8ed;
    color: #715738;
    font-size: 12px;
    line-height: 1.45;
  }

  #venta #items .item-internal-cost small {
    grid-column: 1 / -1;
    color: #897b6c;
    font-size: 11px;
    line-height: 1.4;
  }

  #productsGrid .spec-list-text {
    margin-top: 6px;
  }

  #venta #items .item .remove {
    min-height: 43px;
    border-radius: 10px;
    font-size: 12px;
  }

  #venta .totals-mini {
    gap: 8px;
    margin-top: 14px;
  }

  #venta .totals-mini div {
    padding: 12px;
    border-color: var(--ux-line);
    border-radius: 13px;
    background: #fbf8f3;
  }

  #venta .totals-mini div:last-child {
    background: #f0e7dc;
    border-color: #decdb9;
  }

  #venta .totals-mini span {
    font-size: 11px;
  }

  #venta .totals-mini strong {
    font-size: 17px;
    font-variant-numeric: tabular-nums;
  }

  #venta .paper-wrap {
    align-items: stretch;
  }

  #venta .preview-top {
    gap: 8px;
    padding: 13px 15px;
    margin-bottom: 8px;
    border: 1px solid var(--ux-line);
    border-radius: 15px;
    background: rgba(255, 253, 249, .84);
  }

  #venta .preview-top h2 {
    margin-right: auto;
    color: var(--ux-ink);
    font-size: 16px;
    letter-spacing: -.015em;
  }

  #venta .preview-top button {
    min-height: 39px;
    padding: 8px 11px;
    border-radius: 10px;
    font-size: 11px;
  }

  #venta .pdf-action-hint {
    margin: 0 2px 10px;
    padding: 8px 11px;
    color: #786d62;
    font-size: 11px;
    line-height: 1.4;
  }

  #venta .enterprise-preview {
    border: 1px solid #ded4c8;
    border-radius: 17px;
    box-shadow: var(--ux-shadow-raised);
    background: #fff;
  }

  #venta .sale-bottom-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 2px 8px;
  }

  #venta .sale-bottom-actions .sale-editor-status {
    margin: 0;
  }

  #venta .sale-bottom-actions button {
    min-height: 43px;
    flex: 0 0 auto;
  }

  .kpi,
  .mini-card,
  .cards .panel {
    border-color: var(--ux-line);
    border-radius: 16px;
    box-shadow: var(--ux-shadow);
  }

  .kpi strong,
  .mini-card strong,
  .portal-money strong,
  .project-finance-grid strong {
    font-variant-numeric: tabular-nums;
  }

  .tablebox {
    border: 1px solid var(--ux-line);
    border-radius: 15px;
    background: var(--ux-surface);
    box-shadow: var(--ux-shadow);
  }

  .tablebox table {
    background: transparent;
  }

  .tablebox th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f0e9df;
    color: #695846;
    font-size: 11px;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .tablebox td {
    color: #40382f;
  }

  .tablebox tbody tr:hover {
    background: #fcf8f2;
  }

  dialog.erp-form-dialog,
  dialog.enterprise-pdf-dialog,
  dialog#postSavePdfChoice {
    border-color: #d6c6b2;
    border-radius: 20px;
    box-shadow: 0 24px 70px rgba(45, 34, 24, .25);
  }

  dialog::backdrop {
    background: rgba(45, 34, 24, .42);
    backdrop-filter: blur(2px);
  }

  :focus-visible {
    outline: 2px solid #9d7c59;
    outline-offset: 2px;
  }
}

@media screen and (max-width: 1100px) {
  #venta .workgrid {
    grid-template-columns: minmax(0, 1fr);
  }

  #venta .paper-wrap {
    order: 2;
  }

  #venta .form-stack {
    order: 1;
  }
}

@media screen and (max-width: 760px) {
  main {
    padding: 13px 12px 24px;
  }

  .app-utility {
    top: 6px;
    min-height: 52px;
    padding: 6px 8px;
    border-radius: 14px;
  }

  .utility-right #quickNewSale,
  .utility-right #quickQuotation,
  .utility-right .utility-install,
  .utility-right .utility-health,
  .utility-right .utility-cloud,
  .utility-right .local-chip {
    display: none !important;
  }

  .section-context #currentSectionSubtitle,
  .section-context .breadcrumb > span,
  .section-context .breadcrumb > b {
    display: none;
  }

  #venta .sale-editor-top {
    position: sticky;
    top: 66px;
    z-index: 24;
    display: block;
    padding: 14px;
    margin-top: 10px;
    border-radius: 17px;
  }

  #venta .sale-editor-top h1 {
    max-width: 100%;
    margin: 0 0 7px;
    font-size: 25px;
  }

  #venta .version-pill {
    display: inline-flex;
    margin-bottom: 6px;
  }

  #venta .sale-editor-top p:not(.sale-editor-status) {
    display: none;
  }

  #venta .sale-editor-top .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-top: 11px;
  }

  #venta .sale-editor-top .top-actions button {
    width: 100%;
    min-height: 44px;
    padding: 9px 8px;
    font-size: 12px;
  }

  #venta .sale-editor-top .top-actions #saveSale {
    grid-column: 1 / -1;
    min-height: 50px;
    font-size: 14px;
  }

  #venta .current-sale-cards {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin: 10px 0 14px;
  }

  #venta .current-sale-cards .mini-card {
    padding: 11px 12px;
    border-radius: 13px;
  }

  #venta .current-sale-cards .mini-card strong {
    font-size: 16px;
  }

  #venta .form-card {
    padding: 16px 14px 17px;
    border-radius: 16px;
  }

  #venta .form-card .section-head {
    align-items: flex-start;
  }

  #venta .form-card .section-head h2 {
    font-size: 18px;
  }

  #venta .form-card .section-head > button {
    min-height: 42px;
    padding: 8px 10px;
    font-size: 12px;
  }

  #venta #items .item-grid {
    grid-template-columns: 1fr 1fr;
    padding: 14px 13px 4px;
  }

  #venta #items .item-spec {
    min-height: 90px;
  }

  #venta #items .item-grid > label:nth-child(1),
  #venta #items .item-grid > label:nth-child(2),
  #venta #items .item-grid > .item-photo-field,
  #venta #items .item-grid > .remove {
    grid-column: 1 / -1;
  }

  #venta #items .item-grid > label:nth-child(3),
  #venta #items .item-grid > label:nth-child(4),
  #venta #items .item-grid > label:nth-child(5) {
    grid-column: span 1;
  }

  #venta #items .item-internal-cost {
    grid-template-columns: 1fr;
    padding: 13px;
  }

  #venta #items .item-internal-cost .item-cost-summary,
  #venta #items .item-internal-cost small {
    grid-column: auto;
  }

  #venta .totals-mini {
    grid-template-columns: 1fr 1fr;
  }

  #venta .totals-mini strong {
    font-size: 16px;
  }

  #venta .preview-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    padding: 11px;
  }

  #venta .preview-top h2 {
    grid-column: 1 / -1;
    margin: 0 0 2px;
  }

  #venta .preview-top button {
    width: 100%;
    min-height: 44px;
    font-size: 11px;
  }

  #venta .sale-bottom-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding-top: 2px;
  }

  #venta .sale-bottom-actions button {
    width: 100%;
  }

  #venta .sale-bottom-actions .sale-editor-status {
    order: 2;
  }

  dialog.erp-form-dialog,
  dialog.enterprise-pdf-dialog,
  dialog#postSavePdfChoice {
    max-width: calc(100vw - 20px);
    border-radius: 17px;
  }
}

@media screen and (max-width: 390px) {
  #venta .current-sale-cards {
    grid-template-columns: 1fr;
  }

  #venta .version-pill {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #venta .preview-top {
    grid-template-columns: 1fr;
  }

  #venta .preview-top h2 {
    grid-column: auto;
  }
}

@media print {
  .ux-quality-only { display: none !important; }
}
