/* Eastmark Quotations - main styles */
:root {
    --eastmark-dark: #001028;
    --eastmark-mid: #5D6975;
    --eastmark-border: #C1CED9;
    --eastmark-bg: #F5F5F5;
    --eastmark-red: #B20000;
    --eastmark-green: #4CAF50;
    --eastmark-blue: #2b8fde;
    --eastmark-blue-hover: #1f7ad4;
    --eastmark-blue-pressed: #186bb8;
    /* Customer-facing / translation UI headings (quotation edit) */
    --eastmark-magenta: #a30077;
    --eastmark-toggle-track-off: #c62828;
    --eastmark-toggle-track-on: #2e7d32;
}

* { box-sizing: border-box; }
body {
    font-family: Arial, sans-serif;
    font-size: 14px;
    color: var(--eastmark-dark);
    background: #fff;
    margin: 0;
    padding: 20px;
    max-width: 1320px;
    margin-left: auto;
    margin-right: auto;
}
/* Quotation edit/create: wider canvas so the items table breathes */
body:has(#quotation-form) {
    max-width: min(100%, 1520px);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

h1 { font-size: 1.5rem; color: var(--eastmark-mid); margin-bottom: 1rem; }
a { color: var(--eastmark-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
}
.btn-primary { background: var(--eastmark-blue); color: #fff; }
.btn-primary:hover { background: var(--eastmark-blue-hover); color: #fff; }
.btn-primary:active { background: var(--eastmark-blue-pressed); color: #fff; }
.btn-success { background: var(--eastmark-green); color: #fff; }
.btn-danger { background: var(--eastmark-red); color: #fff; }
.btn-secondary { background: var(--eastmark-mid); color: #fff; }
.btn-info { background: #17a2b8; color: #fff; }
.btn-info:hover { background: #138496; color: #fff; }

button[data-save-shortcut] {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.btn-save-changes-kbd {
    display: inline;
    font-family: inherit;
    font-size: inherit;
    font-weight: 700;
    line-height: inherit;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: inherit;
    opacity: 0.92;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}
table.data-table > thead > tr > th,
table.data-table > tbody > tr > td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--eastmark-border);
}
/* Scope dark header styling to this table only — avoids nested specs tables (<th>) inside cells */
table.data-table > thead > tr > th {
    background: var(--eastmark-dark);
    color: #fff;
}
/* Zebra only body rows so header never counts as “even” */
table.data-table tbody tr:nth-child(even) { background: var(--eastmark-bg); }
/* Soft green / orange: set td as well so row color shows reliably (e.g. border-collapse tables) */
table.data-table tbody tr.data-table-row--paid,
table.data-table tbody tr.data-table-row--paid td {
  background-color: #e8f5e9 !important;
}
table.data-table tbody tr.data-table-row--paid:hover {
  filter: brightness(0.96);
}
table.data-table tbody tr.data-table-row--partial,
table.data-table tbody tr.data-table-row--partial td {
  background-color: #fdebd0 !important;
}
table.data-table tbody tr.data-table-row--partial:hover {
  filter: brightness(0.96);
}
table.data-table .num { text-align: right; }
table.data-table .col-item {
    width: 180px;
    max-width: 180px;
    overflow-x: auto;
    white-space: nowrap;
    box-sizing: border-box;
}
/* Product register: title + search + actions stay under fixed nav; height drives table thead sticky offset */
body.products-register-page .products-register-sticky-head {
    position: sticky;
    top: 64px;
    z-index: 1025;
    background: #fff;
    margin-bottom: 1rem;
    padding-bottom: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}
body.products-register-page .products-register-sticky-head .page-header {
    margin-bottom: 0;
}
body.products-register-page .products-register-sticky-head .page-header h1 {
    margin-bottom: 0;
}
@media print {
    body.products-register-page .products-register-sticky-head {
        position: static;
        box-shadow: none;
    }
}
/* Product register (and similar): keep column headers visible under fixed nav while scrolling */
table.data-table.data-table--sticky-head > thead > tr > th {
    position: sticky;
    top: calc(64px + var(--products-sticky-head-height, 4.75rem));
    z-index: 1020;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}
@media print {
    table.data-table.data-table--sticky-head > thead > tr > th {
        position: static;
        box-shadow: none;
    }
}
table.data-table thead th.actions { text-align: left; }
table.data-table .actions {
    white-space: nowrap;
    text-align: right !important;
    min-width: 200px;
    width: auto;
    max-width: none;
    overflow: visible;
    vertical-align: middle;
}
/* Let row actions’ CSS tooltips (if any) stack above the next row */
table.data-table tbody tr:hover {
    position: relative;
    z-index: 2;
}
.btn-icon {
    display: inline-block;
    position: relative;
    padding: 4px 5px;
    margin: 0 1px;
    text-decoration: none;
    font-size: 18px;
    border-radius: 4px;
    transition: background-color 0.2s;
}
.btn-icon:hover {
    background-color: rgba(0, 0, 0, 0.05);
}
.btn-icon i {
    display: inline-block;
}

/* Custom tooltips (Bootstrap-like): white text on black, appear 2s after hover, CSS-only */
.btn-icon .tooltip,
table.data-table .btn-icon .tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    padding: 6px 10px;
    background-color: #000000;
    background: #000000;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease 0s;
    z-index: 1070;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.btn-icon .tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border: 5px solid transparent;
    border-top-color: #000;
}
.btn-icon:hover .tooltip {
    opacity: 1;
    transition: opacity 0.15s ease 2s;
}

/* When JS moves the label to data-app-styled-tooltip, hide the old inline .tooltip span (avoids double tooltip). */
.app-js-tooltip > .tooltip {
    display: none !important;
}

/* Global styled tooltip (black bubble + red arrow toward target) — JS, 2s hover + short fade */
#app-styled-tooltip {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 99999;
    pointer-events: none;
    display: none;
    flex-direction: column;
    align-items: center;
    max-width: 280px;
    opacity: 0;
    transition: opacity 0.15s ease;
    background: transparent;
    padding: 0;
    box-shadow: none;
}
#app-styled-tooltip.app-styled-tooltip--pos-top {
    flex-direction: column;
}
#app-styled-tooltip.app-styled-tooltip--pos-bottom {
    flex-direction: column-reverse;
}
#app-styled-tooltip .app-styled-tooltip__bubble {
    background: #000;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
}
#app-styled-tooltip .app-styled-tooltip__arrow {
    width: 0;
    height: 0;
    flex-shrink: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
}
#app-styled-tooltip.app-styled-tooltip--pos-top .app-styled-tooltip__arrow {
    border-top: 9px solid var(--eastmark-red, #B20000);
    border-bottom: 0;
    margin-top: -1px;
}
#app-styled-tooltip.app-styled-tooltip--pos-bottom .app-styled-tooltip__arrow {
    border-bottom: 9px solid var(--eastmark-red, #B20000);
    border-top: 0;
    margin-bottom: -1px;
}
#app-styled-tooltip.app-styled-tooltip--visible {
    opacity: 1;
}

/* Company settings: logo preview (transparency-friendly) */
.company-logo-preview {
    margin: 0 0 1rem 0;
}
.company-logo-preview__label {
    display: block;
    font-weight: 600;
    color: var(--eastmark-mid);
    margin-bottom: 0.5rem;
    font-size: 13px;
}
.company-logo-preview__canvas {
    display: inline-block;
    max-width: 100%;
    padding: 1rem 1.25rem;
    border: 1px solid var(--eastmark-border);
    border-radius: 10px;
    background-color: #e2e2e2;
    background-image:
        linear-gradient(45deg, #d0d0d0 25%, transparent 25%),
        linear-gradient(-45deg, #d0d0d0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #d0d0d0 75%),
        linear-gradient(-45deg, transparent 75%, #d0d0d0 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    line-height: 0;
}
.company-logo-preview__img {
    max-width: min(560px, 100%);
    max-height: 120px;
    width: auto;
    height: auto;
    vertical-align: middle;
    object-fit: contain;
}
.company-logo-preview__caption {
    margin: 0.5rem 0 0 0;
    font-size: 12px;
    color: var(--eastmark-mid);
}

.company-stamp-preview .company-stamp-preview__img {
    max-height: 110px;
}

/* Company settings: logo drag-and-drop */
.company-logo-dropzone {
    position: relative;
    border: 2px dashed var(--eastmark-border);
    border-radius: 10px;
    background: var(--eastmark-bg, #f5f5f5);
    min-height: 140px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.company-logo-dropzone:hover,
.company-logo-dropzone:focus {
    border-color: var(--eastmark-mid);
    outline: none;
}
.company-logo-dropzone--active {
    border-color: var(--eastmark-red, #b00);
    background: #fff5f5;
}
.company-logo-dropzone__input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}
.company-logo-dropzone__inner {
    padding: 1.25rem 1rem;
    text-align: center;
    pointer-events: none;
}
.company-logo-dropzone__preview {
    max-width: 220px;
    max-height: 80px;
    width: auto;
    height: auto;
    vertical-align: middle;
    object-fit: contain;
}
.company-logo-dropzone__hint {
    margin: 0.75rem 0 0 0;
    font-size: 13px;
    color: var(--eastmark-mid);
}

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 4px; color: var(--eastmark-mid); font-weight: 600; }
.form-group input,
.form-group textarea,
.form-group select,
select.customer-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--eastmark-border);
    border-radius: 4px;
    font-size: 14px;
}
.form-group textarea { min-height: 80px; resize: vertical; }

/* Product create/edit: picture slot — empty = light panel + optional tile art; with image = white + preview + remove */
.product-image-drop-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    box-sizing: border-box;
    position: relative;
    width: 150px;
    height: 200px;
    border: 2px dashed #b8b8b8;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}
.product-image-drop-zone--empty {
    background-color: #e4e6ea;
    background-image: url(../../include/img/drag_drop.png);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;
}
/* Drag over (JS toggles; keeps background-color + image from --empty) */
.product-image-drop-zone--empty.product-image-drop-zone--dropping {
    background-color: #d6e8f5;
    border-color: #3498db;
}
.product-image-drop-zone--with-image {
    background-color: #fff;
    background-image: none;
}
.product-image-drop-zone--with-image.product-image-drop-zone--dropping {
    background-color: #eef7fd;
    border-color: #3498db;
}
.product-image-drop-zone__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem;
    text-align: center;
    color: var(--eastmark-mid, #5a5a5a);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    /* Let drag/drop hit the parent .product-image-drop-zone (child overlay otherwise steals targets in some browsers) */
    pointer-events: none;
}
.product-image-drop-zone__empty .bi {
    font-size: 1.6rem;
    opacity: 0.4;
}
.product-image-drop-zone__preview {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 140px;
    padding: 5px;
    box-sizing: border-box;
    display: none;
    align-items: center;
    justify-content: center;
}
.product-image-drop-zone__preview.is-showing {
    display: flex;
}
.product-image-drop-zone__preview .product-image-drop-zone__remove {
    z-index: 2;
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 2px 5px;
    font-size: 10px;
}
/* Product register: TinyMCE toolbar hint */
.product-tech-preview-hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: #666;
    max-width: 52rem;
}
.product-tech-preview-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--eastmark-mid, #5D6975);
    margin-top: 10px;
}
iframe.product-tech-preview-frame {
    display: block;
    width: 100%;
    min-height: 140px;
    max-height: 380px;
    border: 1px solid var(--eastmark-border, #C1CED9);
    border-radius: 6px;
    background: #fafbfc;
    margin-top: 4px;
}
/* TinyMCE replaces technical textareas */
.tox-tinymce {
    margin-top: 4px;
    border-radius: 6px !important;
}
.quotation-line-tech-preview-block {
    margin-top: 4px;
}
/* Quotation: parallel translation fields + previews (shown when “use translations” is Yes) */
.quotation-line-translation-block {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed var(--eastmark-border, #C1CED9);
}
.quotation-notes-translation-block .product-tech-preview-label {
    color: var(--eastmark-magenta);
}
.quotation-notes-translation-block {
    margin-top: 0.35rem;
}
.item-product-register-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}
.item-product-register-actions .btn {
    padding: 2px 6px;
    font-size: 12px;
    line-height: 1.2;
}
.item-product-register-actions .item-sync-register .bi {
    font-size: 14px;
    vertical-align: -0.1em;
}
/* Embedded TinyMCE / pasted spec tables — parity with quotation PDF (export/pdf_quotation.php `.tech-info--html`).
   PDF applies zebra via global `tr:nth-child(even) td` scoped per tbody; browsers need the same explicitly here. */
.tech-info div { margin: 1px 0; }
.tech-info--html {
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-width: 100%;
    color: #111;
}
/* Title + URL as <p> (looser); Qty / dims / MOQ as stacked <div> (tight) — same rhythm as quotation PDF */
.tech-info.tech-info--html p {
    margin: 0.62em 0;
    padding: 0;
    line-height: 1.38;
}
.tech-info.tech-info--html p:first-child {
    margin-top: 0.25em;
}
.tech-info.tech-info--html div {
    margin: 0;
    padding: 0;
    line-height: 1.22;
}
.tech-info.tech-info--html div + div {
    margin-top: 0;
}
.tech-info--html a {
    word-break: break-word;
}
.tech-info--html table {
    border-collapse: collapse;
    width: 100%;
    max-width: 100%;
    margin-top: 2px;
    table-layout: fixed;
    background: #fff;
}
.tech-info--html th,
.tech-info--html td {
    border: 1px solid #ccc;
    padding: 2px 5px;
    text-align: left;
    vertical-align: top;
    font-size: 10px;
    color: #111;
    word-break: normal;
    overflow-wrap: break-word;
}
.tech-info--html thead th {
    background: #f2f4f7;
    color: #111;
    font-weight: 700;
    padding: 7px 8px;
    line-height: 1.35;
}
.tech-info--html tbody tr:nth-child(odd) td {
    background: #ffffff;
}
.tech-info--html tbody tr:nth-child(even) td {
    background: #f5f5f5;
}
.tech-info--html table:not(:has(thead)) tbody tr:first-child td {
    background: #f2f4f7;
    color: #111;
    font-weight: 700;
    padding: 7px 8px;
    line-height: 1.35;
}
/* Customer quotation HTML view: wrappers only (table chrome from .tech-info--html above) */
.quotation-item-tech,
.quotation-notes-body {
    min-width: 0;
    max-width: 100%;
}
.product-register-tech-plain {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    line-height: 1.35;
}
.product-register-tech-html {
    font-size: 11px;
    color: #111;
    margin-top: 6px;
    max-height: 220px;
    overflow: auto;
    border: 1px solid var(--eastmark-border, #C1CED9);
    border-radius: 6px;
    padding: 8px;
    background: #fff;
    line-height: 1.3;
}

.product-image-drop-zone__preview #image-preview {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    object-fit: contain;
}

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }

/* Customer create/edit: one row — phone, email, tax id, EORI */
.form-row-customer-contact {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 0.9fr);
    align-items: start;
}
.form-row-customer-contact .form-group {
    min-width: 0;
}
.form-row-customer-contact .iti {
    width: 100%;
}
@media (max-width: 1100px) {
    .form-row-customer-contact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 520px) {
    .form-row-customer-contact {
        grid-template-columns: 1fr;
    }
}

/* Customer create/edit: country + postal + city on one row when postal lookup is active */
.customer-location-hint {
    margin: 0 0 8px 0;
    color: #666;
    font-weight: normal;
    font-size: 13px;
}
/* Quotation edit: country + postal + region + city on one flex row (no ZIP lookup). */
.quotation-client-location-line {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
    margin-bottom: 1rem;
}
.quotation-client-location-line > .form-group {
    margin-bottom: 0;
}
.quotation-client-location-line .form-group--quotation-country {
    flex: 1.55 1 176px;
    min-width: 176px;
}
.quotation-client-location-line .form-group--quotation-street {
    flex: 2 1 160px;
    min-width: 140px;
    max-width: min(100%, 22rem);
}
.quotation-client-location-line input.quotation-client-street {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 38px;
    height: 38px;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 14px;
}
.quotation-client-location-line .form-group--quotation-zip {
    flex: 0 0 auto;
    width: 7.25rem;
    min-width: 7.25rem;
    max-width: 7.25rem;
}
.quotation-client-location-line .form-group--quotation-zip input {
    max-width: 100%;
    text-align: center;
}
.quotation-client-location-line .quotation-loc-bairro {
    flex: 1.6 1 150px;
    min-width: 120px;
}
.quotation-client-location-line .quotation-loc-br:not(.quotation-loc-bairro),
.quotation-client-location-line .quotation-loc-us,
.quotation-client-location-line .quotation-loc-ca,
.quotation-client-location-line .quotation-loc-au {
    flex: 0 1 64px;
    min-width: 52px;
}
.quotation-client-location-line .form-group--quotation-city {
    flex: 2 1 180px;
    min-width: 140px;
}
.quotation-client-location-line input[type="text"],
.quotation-client-location-line .ts-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.quotation-client-location-line .quotation-client-city-manual,
.quotation-client-location-line .form-group--quotation-city select.form-select {
    min-height: 38px;
    height: 38px;
}
.quotation-client-location-line .ts-wrapper .ts-control {
    min-height: 38px;
}
/* Two-column row: country | (postal [+ BR: bairro, UF] + city). */
.customer-location-row {
    display: grid;
    gap: 1rem;
    align-items: start;
    margin-bottom: 1rem;
    grid-template-columns: minmax(0, 1fr);
}
.customer-location-row.customer-location-row--has-postal {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 2.2fr);
}
@media (max-width: 720px) {
    .customer-location-row.customer-location-row--has-postal {
        grid-template-columns: 1fr;
    }
}
.customer-location-row > .form-group,
.customer-location-row > .customer-postal-lookup .form-group {
    margin-bottom: 0;
}
.customer-location-row .customer-location-country {
    min-width: 0;
}
.customer-location-row #postal-lookup-block.customer-postal-lookup {
    display: none;
}
.customer-location-row #postal-lookup-block.customer-postal-lookup[hidden] {
    display: none !important;
}
.customer-location-row #postal-lookup-block.customer-postal-lookup.is-visible {
    display: grid;
    grid-template-columns: minmax(80px, 0.95fr) minmax(0, 1.35fr);
    gap: 0.65rem 0.75rem;
    align-items: start;
    min-width: 0;
}
/* Brazil: same row — postal | neighborhood | state | city */
.customer-location-row #postal-lookup-block.customer-postal-lookup.is-visible.customer-postal-lookup--br {
    grid-template-columns: minmax(72px, 0.75fr) minmax(88px, 1.1fr) minmax(44px, 0.35fr) minmax(100px, 1.1fr);
}
/* US / Canada / Australia: postal | province or state | city */
.customer-location-row #postal-lookup-block.customer-postal-lookup.is-visible.customer-postal-lookup--region {
    grid-template-columns: minmax(88px, 1fr) minmax(44px, 0.35fr) minmax(100px, 1.35fr);
}
.customer-postal-lookup:not(.customer-postal-lookup--br) .customer-br-only {
    display: none !important;
}
.customer-postal-lookup:not(.customer-postal-lookup--region) .customer-us-only,
.customer-postal-lookup:not(.customer-postal-lookup--region) .customer-ca-only,
.customer-postal-lookup:not(.customer-postal-lookup--region) .customer-au-only {
    display: none !important;
}
/* Explicit guards: grid would wrap “extra” fields onto a second row if they stayed visible */
.customer-postal-lookup.customer-postal-lookup--br .customer-us-only,
.customer-postal-lookup.customer-postal-lookup--br .customer-ca-only,
.customer-postal-lookup.customer-postal-lookup--br .customer-au-only {
    display: none !important;
}
.customer-postal-lookup.customer-postal-lookup--region .customer-br-only {
    display: none !important;
}
.customer-postal-lookup--region .customer-us-only,
.customer-postal-lookup--region .customer-ca-only,
.customer-postal-lookup--region .customer-au-only {
    display: none !important;
}
.customer-postal-lookup--region.customer-postal-lookup--sub-us .customer-us-only,
.customer-postal-lookup--region.customer-postal-lookup--sub-ca .customer-ca-only,
.customer-postal-lookup--region.customer-postal-lookup--sub-au .customer-au-only {
    display: block !important;
}
@media (max-width: 720px) {
    .customer-location-row #postal-lookup-block.customer-postal-lookup.is-visible,
    .customer-location-row #postal-lookup-block.customer-postal-lookup.is-visible.customer-postal-lookup--br,
    .customer-location-row #postal-lookup-block.customer-postal-lookup.is-visible.customer-postal-lookup--region {
        grid-template-columns: 1fr;
    }
}
.customer-postal-lookup--awaiting .customer-location-postal input[disabled] {
    cursor: not-allowed;
    opacity: 0.88;
}
.customer-postal-lookup--awaiting .customer-location-city .ts-wrapper.disabled .ts-control,
.customer-postal-lookup--awaiting .customer-location-city select[disabled] {
    cursor: not-allowed;
    opacity: 0.88;
}
.customer-postal-lookup--awaiting .customer-br-only input[disabled] {
    cursor: not-allowed;
    opacity: 0.88;
}
.customer-postal-lookup--awaiting .customer-us-only input[disabled],
.customer-postal-lookup--awaiting .customer-ca-only input[disabled],
.customer-postal-lookup--awaiting .customer-au-only input[disabled] {
    cursor: not-allowed;
    opacity: 0.88;
}
.customer-location-row .customer-location-postal,
.customer-location-row .customer-location-bairro,
.customer-location-row .customer-location-uf,
.customer-location-row .customer-location-us-state,
.customer-location-row .customer-location-ca-province,
.customer-location-row .customer-location-au-state,
.customer-location-row .customer-location-city {
    min-width: 0;
}
.customer-location-bairro input,
.customer-location-uf input,
.customer-location-us-state input,
.customer-location-ca-province input,
.customer-location-au-state input {
    text-transform: uppercase;
}
/* Customer postal lookup row: postal, region, and city share one control height. */
.customer-location-row #postal-lookup-block.customer-postal-lookup.is-visible input[type="text"],
.customer-location-row #postal-lookup-block.customer-postal-lookup.is-visible select.form-select {
    width: 100%;
    min-height: 38px;
    height: 38px;
    padding: 8px 10px;
    box-sizing: border-box;
    line-height: 1.4;
    font-size: 14px;
    border: 1px solid var(--eastmark-border);
    border-radius: 4px;
    background: #fff;
}
.customer-location-postal #postal-code-input {
    min-width: 9ch;
}
.customer-location-row #postal-lookup-block.customer-postal-lookup.is-visible select.form-select {
    padding-right: 2.25rem;
    -webkit-appearance: none;
    appearance: none;
}
.customer-location-postal #postal-code-input:focus,
.customer-location-city #city-single-input:focus,
.customer-location-city select.form-select:focus {
    outline: none;
    border-color: var(--eastmark-mid);
    box-shadow: 0 0 0 2px rgba(93, 105, 117, 0.2);
}
.customer-location-city #city-single-input {
    width: 100%;
    box-sizing: border-box;
    text-transform: uppercase;
}
.customer-city-select-wrap .ts-wrapper { margin-bottom: 0; }
/* City / locality: display and typeahead in uppercase (values normalized in customer_form_postal.js) */
.customer-location-city .ts-control,
.customer-location-city .ts-dropdown .option,
.customer-location-city .ts-control input {
    text-transform: uppercase;
}
.customer-location-city select {
    text-transform: uppercase;
}
/* Postal state hook for quotation client line (no extra box; Tom Select city matches customer form) */
#quotation-postal-lookup-block.quotation-postal-lookup-sentinel:not([hidden]) {
    display: contents;
}
.form-group--quotation-city .ts-control,
.form-group--quotation-city .ts-dropdown .option,
.form-group--quotation-city .ts-control input,
.form-group--quotation-city .quotation-client-city-manual {
    text-transform: uppercase;
}
/*
 * Tom Select: draw the frame on .ts-control, not .ts-wrapper.
 * The control has z-index:1 and fills the flex wrapper — a border on the wrapper is often hidden on the bottom edge.
 */
.quotation-client-location-line .ts-wrapper.single {
    width: 100%;
    box-sizing: border-box;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    min-height: 0;
    height: auto;
    max-height: none;
}
.quotation-client-location-line .ts-wrapper.single .ts-control {
    border: 1px solid var(--eastmark-border) !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    background: #fff !important;
    background-image: none !important;
    min-height: 38px;
    height: 38px;
    max-height: 38px;
    padding: 0 2.25rem 0 10px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    font-size: 14px;
}
.quotation-client-location-line .ts-wrapper.single.focus .ts-control,
.quotation-client-location-line .ts-wrapper.single.dropdown-active .ts-control {
    border-color: var(--eastmark-mid) !important;
}
.quotation-client-location-line .ts-wrapper.single.dropdown-active .ts-control {
    border-radius: 4px 4px 0 0 !important;
}
.quotation-client-location-line .ts-wrapper.single .ts-control .item {
    line-height: 1.3;
}
/* Customer create/edit: country + city Tom Select */
.customer-location-row .customer-location-country .ts-wrapper.single,
.customer-location-row .customer-location-city .ts-wrapper.single {
    width: 100%;
    box-sizing: border-box;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    min-height: 38px;
    height: 38px;
    max-height: 38px;
}
.customer-location-row .customer-location-country .ts-wrapper.single .ts-control,
.customer-location-row .customer-location-city .ts-wrapper.single .ts-control {
    border: 1px solid var(--eastmark-border) !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    background: #fff !important;
    background-image: none !important;
    min-height: 38px;
    height: 38px;
    max-height: 38px;
    padding: 8px 2.25rem 8px 10px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    font-size: 14px;
    line-height: 1.4;
}
.customer-location-row .customer-location-country .ts-wrapper.single.focus .ts-control,
.customer-location-row .customer-location-country .ts-wrapper.single.dropdown-active .ts-control,
.customer-location-row .customer-location-city .ts-wrapper.single.focus .ts-control,
.customer-location-row .customer-location-city .ts-wrapper.single.dropdown-active .ts-control {
    border-color: var(--eastmark-mid) !important;
    box-shadow: 0 0 0 2px rgba(93, 105, 117, 0.2) !important;
}
.customer-location-row .customer-location-country .ts-wrapper.single.dropdown-active .ts-control,
.customer-location-row .customer-location-city .ts-wrapper.single.dropdown-active .ts-control {
    border-radius: 4px 4px 0 0 !important;
}
/* Quotation create/edit: compact number + dates, wider customer (Tom Select); min-width 0 avoids grid blowout */
.form-row-quotation-meta .form-group { min-width: 0; }
.form-row-quotation-meta {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
@media (min-width: 960px) {
    .form-row-quotation-meta {
        grid-template-columns: minmax(0, 0.5fr) minmax(0, 0.55fr) minmax(0, 0.55fr) minmax(220px, 2.6fr);
        align-items: start;
    }
}
/* Quotation number + date + validity: centered labels and values */
.form-row-quotation-meta > .form-group:nth-child(-n+3) label {
    text-align: center;
}
.form-row-quotation-meta > .form-group:nth-child(-n+3) input {
    text-align: center;
}
/* Quotation meta row (incl. Select customer): border on .ts-control — see note above */
.form-row-quotation-meta .ts-wrapper.single {
    width: 100%;
    box-sizing: border-box;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    min-height: 0;
    height: auto;
    max-height: none;
}
.form-row-quotation-meta .ts-wrapper.single .ts-control {
    border: 1px solid var(--eastmark-border) !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    background: #fff !important;
    background-image: none !important;
    min-height: 38px;
    height: 38px;
    max-height: 38px;
    padding: 0 2.25rem 0 10px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    font-size: 14px;
}
.form-row-quotation-meta .ts-wrapper.single.focus .ts-control,
.form-row-quotation-meta .ts-wrapper.single.dropdown-active .ts-control {
    border-color: var(--eastmark-mid) !important;
}
.form-row-quotation-meta .ts-wrapper.single.dropdown-active .ts-control {
    border-radius: 4px 4px 0 0 !important;
}
.form-row-quotation-meta .ts-wrapper.single .ts-control .item {
    line-height: 1.3;
}
/* Terms row Tom Selects */
.form-row-terms .ts-wrapper.single {
    width: 100%;
    box-sizing: border-box;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    min-height: 0;
    height: auto;
    max-height: none;
}
.form-row-terms .ts-wrapper.single .ts-control {
    border: 1px solid var(--eastmark-border) !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    background: #fff !important;
    background-image: none !important;
    min-height: 34px;
    height: 34px;
    max-height: 34px;
    padding: 0 1.75rem 0 6px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    font-size: 14px;
}
.form-row-terms .ts-wrapper.single.focus .ts-control,
.form-row-terms .ts-wrapper.single.dropdown-active .ts-control {
    border-color: var(--eastmark-mid) !important;
}
.form-row-terms .ts-wrapper.single.dropdown-active .ts-control {
    border-radius: 4px 4px 0 0 !important;
}
.form-row-terms > .form-group:first-child .ts-wrapper.single .ts-control {
    padding-left: 6px;
    padding-right: 1.65rem;
    font-size: 12px;
}
.form-row-terms > .form-group:first-child .ts-wrapper.single .ts-control .item {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
/* Quotation client: name + tax ID on one row */
.form-row-client-name-tax .form-group { min-width: 0; }
.form-row-client-name-tax {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
@media (min-width: 720px) {
    .form-row-client-name-tax {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    }
}
/* Client: Address | Address line 2 | Country */
.form-row-client-address .form-group { min-width: 0; }
.form-row-client-address {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
@media (min-width: 900px) {
    .form-row-client-address {
        grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr);
        align-items: start;
    }
}
.form-row-terms .form-group { min-width: 0; }
.form-row-terms .form-group input[type="text"],
.form-row-terms .form-group select { min-height: 34px; box-sizing: border-box; }
.form-row-terms > .form-group:first-child select.form-select { font-size: 12px; padding-left: 6px; padding-right: 1.65rem; min-height: 34px; }
/* Terms row: six columns (incl. country of origin); tighter payment / profit / currency */
.form-row-terms {
    grid-template-columns:
        minmax(0, 0.5fr)
        minmax(0, 0.72fr)
        minmax(0, 0.88fr)
        minmax(0, 0.28fr)
        minmax(0, 0.36fr)
        minmax(0, 0.82fr);
    gap: 0.45rem 0.5rem;
    min-width: 0;
    align-items: end;
}
@media (max-width: 1099px) {
    .form-row-terms {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem;
    }
}
@media (max-width: 520px) {
    .form-row-terms {
        grid-template-columns: 1fr;
    }
}
.form-row-terms .form-group--terms-tight label {
    font-size: 11px;
    line-height: 1.2;
}
.form-row-terms .form-group--terms-tight select.form-select {
    font-size: 12px;
    padding: 5px 1.5rem 5px 5px;
    min-height: 34px;
}
.form-row-terms .form-group--terms-tight .ts-wrapper.single .ts-control {
    font-size: 12px !important;
    min-height: 34px !important;
    height: 34px !important;
    max-height: 34px !important;
    padding: 0 1.5rem 0 5px !important;
}
.form-row-terms .form-group--terms-tight .ts-wrapper.single .ts-control .item {
    font-size: 12px;
}
.form-row-terms .form-group--terms-tight input#quotation-profit-pct {
    font-size: 12px;
    min-height: 34px;
    padding: 5px 4px;
}
.form-row-terms .form-group--terms-coo label {
    font-size: 12px;
}
.form-row-terms .form-group--terms-coo select.form-select {
    font-size: 12px;
    padding: 5px 1.6rem 5px 5px;
    min-height: 34px;
}
.form-row-terms .form-group--terms-coo .ts-wrapper.single .ts-control {
    font-size: 12px !important;
    min-height: 34px !important;
    height: 34px !important;
    max-height: 34px !important;
    padding: 0 1.6rem 0 5px !important;
}
.form-row-terms .form-group--terms-coo .ts-wrapper.single .ts-control .item {
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
/* Quotation-level % profit (Terms & currency) */
#quotation-profit-pct {
    text-align: center;
    font-weight: 700;
    color: #cc00cc;
}

.items-table { width: 100%; border-collapse: collapse; }
.items-table th { background: var(--eastmark-mid); color: #fff; padding: 8px; font-size: 12px; }
.items-table td { padding: 6px 8px; border: 1px solid var(--eastmark-border); }
.items-table input { width: 100%; padding: 4px 6px; border: 1px solid #ddd; }
.items-table { table-layout: auto; width: 100%; }
.items-table th.col-product-register,
.items-table td.col-product-register { width: 52px !important; min-width: 52px; max-width: 60px; text-align: center; vertical-align: middle; }
.items-table th.col-product-register { white-space: normal; font-size: 18px; line-height: 1; padding: 6px 4px; }
.item-product-register-actions .item-line-number {
    display: block;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--eastmark-mid, #5D6975);
    line-height: 1.1;
    margin: 0 0 1px;
}
.items-table .item-add-product {
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 22px;
    font-weight: 600;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}
/* Catalogue save — distinct from grey outline buttons */
.items-table .item-save-to-register.btn-catalog-save {
    padding: 2px 8px;
    color: #fff;
    background: linear-gradient(180deg, #43a047 0%, #2e7d32 100%);
    border: 1px solid #1b5e20;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.items-table .item-save-to-register.btn-catalog-save:hover:not(:disabled):not(.disabled) {
    color: #fff;
    background: linear-gradient(180deg, #4caf50 0%, #388e3c 100%);
    border-color: #145214;
}
.items-table .item-save-to-register.btn-catalog-save:active:not(:disabled):not(.disabled) {
    color: #fff;
    background: #2e7d32;
    border-color: #1b5e20;
}
.items-table .item-save-to-register.btn-catalog-save:disabled,
.items-table .item-save-to-register.btn-catalog-save[disabled] {
    opacity: 0.42;
    cursor: not-allowed;
}
.items-table .item-save-to-register.btn-catalog-save i {
    color: inherit;
}
.items-table td.col-image {
    position: relative;
    vertical-align: middle;
}
/* Quotation line image cell (50×50): match adm.eastmarkhk.com line preview + drag_drop.png */
.item-image-preview {
    width: 50px;
    height: 50px;
    box-sizing: border-box;
    border: 1px solid #b8b8b8;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    background: #e9ecef;
    transition: border-color 0.15s, background-color 0.15s;
}
.item-image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: none;
}
.item-image-preview.item-image-preview--has-image {
    background-color: #fff;
    background-image: none;
    cursor: pointer;
}
.item-image-preview.item-image-preview--has-image img {
    display: block;
}
.item-image-preview .bi-image {
    color: #aaa;
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}
.item-image-preview.item-image-preview--has-image .bi-image {
    display: none;
}
.item-image-preview.item-image-preview--free.item-image-preview--slot-empty {
    background-color: #e4e6ea;
    background-image: url(../../include/img/drag_drop.png);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}
.item-image-preview.item-image-preview--free.item-image-preview--slot-empty.item-image-preview--dropping {
    background-color: #d6e8f5;
    border-color: #3498db;
}
.item-image-preview.item-image-preview--free.item-image-preview--has-image.item-image-preview--dropping {
    background-color: #eef7fd;
    border-color: #3498db;
}
.item-image-preview .item-quotation-image-remove {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 4;
    padding: 0 3px;
    font-size: 10px;
    line-height: 1.1;
    border: none;
    background: rgba(220, 53, 69, 0.95);
    color: #fff;
    cursor: pointer;
    border-radius: 0 0 0 4px;
}
.items-table .item-quotation-image-file {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

/* Modal: load product from register (+ on quotation line) */
.quotation-product-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}
.quotation-product-modal--open {
    display: flex;
}
body.quotation-product-modal-open {
    overflow: hidden;
}
.quotation-product-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    cursor: pointer;
}
.quotation-product-modal__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    /* Tall enough for title + hint + Tom Select control + open dropdown list inside the same panel */
    min-height: min(56vh, 520px);
    max-height: min(88vh, 720px);
    overflow: visible;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    padding: 2.75rem 1.5rem min(32vh, 280px);
    border: 1px solid var(--eastmark-border, #ddd);
    box-sizing: border-box;
}
@media (max-height: 640px) {
    .quotation-product-modal__dialog {
        min-height: min(48vh, 420px);
        padding-bottom: min(28vh, 220px);
    }
}
.quotation-product-modal__close {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--eastmark-mid, #5d6975);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.quotation-product-modal__close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--eastmark-dark, #001028);
}
.quotation-product-modal__title {
    margin: 0 0 0.5rem;
    padding-right: 2.5rem;
    font-size: 1.15rem;
    color: var(--eastmark-mid, #333);
}
.quotation-product-modal__hint {
    margin: 0 0 1.25rem;
    font-size: 13px;
    color: #555;
    line-height: 1.45;
}
.quotation-product-modal__field {
    margin-bottom: 0;
}
.quotation-product-modal__dialog .form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    font-size: 13px;
}
.quotation-product-modal__dialog .tom-select-wrap,
.quotation-product-modal__dialog .tom-select-wrap .ts-wrapper {
    width: 100%;
}
.items-table th.col-desc { width: auto; min-width: 320px; }
.items-table td.col-desc { width: auto; min-width: 320px; }
.items-table th.col-comment,
.items-table td.col-comment { width: 200px !important; min-width: 200px; vertical-align: top; }
.items-table th.col-comment { white-space: normal; }
.items-table .item-comment { width: 100% !important; box-sizing: border-box; font-size: 12px; color: #555; min-height: 112px; resize: vertical; display: block; padding: 4px 6px; border: 1px solid #ddd; }
.items-table th.col-hs,
.items-table td.col-hs { width: 110px !important; min-width: 110px; }
.items-table th.col-qty,
.items-table td.col-qty {
    width: 104px !important;
    min-width: 104px;
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
}
.items-table td.col-qty input.item-qty {
    text-align: center;
}
.items-table th.col-unit,
.items-table td.col-unit { width: 82px !important; min-width: 82px; white-space: nowrap; }
.items-table th.col-buy-price,
.items-table td.col-buy-price { width: 110px !important; min-width: 110px; white-space: nowrap; }
.items-table th.col-sell-price {
    font-weight: 700;
}
.items-table th.col-sell-price,
.items-table td.col-sell-price { width: 110px !important; min-width: 110px; white-space: nowrap; }
.items-table td.col-buy-price input.item-buy-price { text-align: center; }
.items-table td.col-sell-price input.item-sell-price { text-align: center; font-weight: 700; }
.item-sell-price.item-sell-price--readonly {
    background-color: #e9ecef;
    cursor: not-allowed;
}
#product-unit-price { text-align: center; max-width: 12rem; }

/* Product register list: name + internal ref in parentheses */
.product-register-name {
    font-weight: 600;
    color: var(--eastmark-dark);
}
.product-register-ref {
    font-weight: 400;
    font-size: 12px;
    color: #6b7785;
    white-space: nowrap;
}
.items-table th.col-total,
.items-table td.col-total { width: 110px !important; min-width: 110px; text-align: right; white-space: nowrap; }
.items-table th.col-actions,
.items-table td.col-actions { width: 50px !important; white-space: nowrap; }
.items-table .item-desc { width: 100% !important; box-sizing: border-box; display: block; font-weight: 700; }
.items-table .item-tech { width: 100% !important; box-sizing: border-box; font-size: 12px; color: #666; min-height: 60px; resize: vertical; display: block; }
/* Tom Select in items table unit column */
.items-table .col-unit .ts-wrapper { width: 100%; }

.form-actions-right { display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; }

/* Toast slide-in/out (used with SweetAlert2) */
.swal2-popup.swal2-slide-toast {
    animation: toastSlideIn 0.4s ease forwards;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #a3d9a5;
    box-shadow: 0 4px 12px rgba(27, 94, 32, 0.15);
}
/* Contrast: darker green success icon on light green background */
.swal2-popup.swal2-slide-toast .swal2-success .swal2-success-ring { border-color: rgba(27, 94, 32, 0.3); }
.swal2-popup.swal2-slide-toast .swal2-success [class^='swal2-success-line'] { border-color: #1b5e20; }
.swal2-popup.swal2-slide-toast .swal2-icon.swal2-success::after { border-color: #1b5e20; }
.swal2-popup.swal2-slide-toast.toast-slide-out { animation: toastSlideOut 0.4s ease forwards !important; }
.swal2-container:has(.swal2-slide-toast) { overflow: visible !important; }

/* Error toast: red background, contrast for error icon */
.swal2-popup.swal2-slide-toast-error {
    animation: toastSlideIn 0.4s ease forwards;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border: 1px solid #f1aeb5;
    box-shadow: 0 4px 12px rgba(176, 0, 32, 0.15);
}
.swal2-popup.swal2-slide-toast-error .swal2-icon.swal2-error { border-color: #b02a37; }
.swal2-popup.swal2-slide-toast-error .swal2-icon.swal2-error [class^='swal2-x-mark-line'] { background-color: #b02a37; }
.swal2-popup.swal2-slide-toast-error.toast-slide-out { animation: toastSlideOut 0.4s ease forwards !important; }
.swal2-container:has(.swal2-slide-toast-error) { overflow: visible !important; }

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ===== Main navigation (Le Pélican-style: fixed bar + hover dropdown) ===== */
.ns-nav {
    --ns-primary-color: var(--eastmark-blue);
    --ns-text-color: var(--eastmark-dark);
    --ns-dropdown-bg: #fff;
    --ns-hover-bg: var(--eastmark-bg);
    --ns-border-color: var(--eastmark-border);
    --ns-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
.ns-nav * { margin: 0; padding: 0; box-sizing: border-box; }
.ns-nav ul { list-style: none; }

.ns-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: #fff;
    box-shadow: var(--ns-shadow);
    height: 64px;
    min-height: 64px;
    overflow: visible;
}
.ns-nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    width: 100%;
    height: 100%;
    position: relative;
}
.ns-navbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--ns-text-color);
    font-weight: 600;
    font-size: 1.05rem;
    gap: 0.5rem;
}
.ns-navbar-brand:hover { color: var(--ns-primary-color); text-decoration: none; }
.ns-navbar-brand img {
    max-height: 40px;
    width: auto;
    height: auto;
    display: block;
}

.ns-navbar-toggle {
    display: none;
    background: var(--ns-primary-color);
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    font-size: 1.5rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.ns-navbar-menu {
    display: flex;
    flex-direction: row;
    align-items: center;
}
.ns-navbar-nav {
    display: flex;
    flex-direction: row;
    margin: 0;
    padding: 0;
    gap: 0.15rem;
}
.ns-nav-item { position: relative; }
.ns-nav-link {
    color: var(--ns-text-color);
    font-size: 14px;
    padding: 0.5rem 1rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}
.ns-nav-link:hover { color: var(--ns-primary-color); text-decoration: none; }
.ns-nav-link.active { color: var(--ns-primary-color); font-weight: 600; }
.ns-nav-link > .bi:not(.bi-chevron-down) { margin-right: 6px; }
.ns-nav-link.ns-dropdown-toggle { padding-right: 1.5rem; cursor: pointer; }
.ns-nav-link.ns-dropdown-toggle .bi-chevron-down {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    transition: transform 0.2s;
}
.ns-nav-item.ns-dropdown:hover .ns-nav-link.ns-dropdown-toggle .bi-chevron-down {
    transform: translateY(-50%) rotate(180deg);
}

/* Dropdown: invisible bridge so hover doesn't break between trigger and menu */
.ns-nav-item.ns-dropdown::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 12px;
    background: transparent;
    pointer-events: auto;
    z-index: 1000;
}
.ns-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 260px;
    width: max-content;
    max-width: 95vw;
    padding: 0.4rem 0;
    margin-top: 5px;
    background: var(--ns-dropdown-bg);
    border: 1px solid var(--ns-border-color);
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}
.ns-dropdown-menu li {
    white-space: nowrap;
}
.ns-nav-item.ns-dropdown:hover .ns-dropdown-menu,
.ns-nav-item.ns-dropdown .ns-dropdown-menu:hover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}
.ns-nav-item.ns-dropdown:last-child .ns-dropdown-menu,
.ns-nav-item.ns-dropdown:nth-last-child(2) .ns-dropdown-menu {
    left: auto;
    right: 0;
}
.ns-dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1.25rem;
    color: var(--ns-text-color);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
    white-space: nowrap;
}
.ns-dropdown-item:hover {
    background: var(--ns-hover-bg);
    text-decoration: none;
    color: var(--ns-primary-color);
}
.ns-dropdown-item .bi { margin-right: 8px; font-size: 1em; }
.ns-dropdown-divider {
    height: 1px;
    margin: 0.25rem 0;
    background: var(--eastmark-border, #ddd);
    list-style: none;
}

.ns-navbar-menu .ns-btn-logout {
    margin-left: 1rem;
    padding: 6px 14px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid var(--eastmark-mid);
    background: transparent;
    color: var(--eastmark-mid);
    cursor: pointer;
    text-decoration: none;
}
.ns-navbar-menu .ns-btn-logout:hover {
    background: var(--eastmark-mid);
    color: #fff;
}

/* Context actions in nav (quotation / proforma view) */
.ns-nav-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: 0.75rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--eastmark-border);
}
.ns-nav-action-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--eastmark-mid);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}
.ns-nav-action-link:hover {
    background: var(--eastmark-bg);
    color: var(--eastmark-dark);
}
.ns-nav-action-link .bi {
    font-size: 1.1rem;
}
.ns-nav-action-link[href*="pdf"] .bi { color: var(--eastmark-red); }
.ns-nav-action-link[href*="excel"] .bi { color: var(--eastmark-green); }
.ns-nav-action-link[href*="javascript:window.print"] .bi { color: var(--eastmark-mid); }

/* Mobile */
@media (max-width: 991px) {
    .ns-navbar-toggle { display: flex; }
    .ns-navbar-menu {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: #fff;
        z-index: 1029;
        box-shadow: 0 4px 20px rgba(0,0,0,0.15);
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        flex-direction: column;
        align-items: stretch;
        display: none;
        padding: 0.5rem 0;
    }
    .ns-navbar-menu.open { display: flex; }
    .ns-navbar-nav { flex-direction: column; gap: 0; }
    .ns-nav-link {
        padding: 12px 1.25rem;
        justify-content: space-between;
    }
    .ns-dropdown-menu {
        position: static !important;
        display: none;
        width: 100%;
        max-width: none;
        margin-top: 0;
        background: var(--eastmark-bg);
        padding: 0.25rem 0;
        border-left: 4px solid var(--ns-primary-color);
        border-radius: 0;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: none !important;
        box-shadow: none;
    }
    .ns-dropdown-menu.open { display: block; }
    .ns-dropdown-item { padding: 10px 1.25rem 10px 2rem; }
    .ns-nav-item.ns-dropdown::before { display: none; }
    .ns-nav-actions {
        margin: 0.5rem 1rem 0;
        padding: 0.5rem 0;
        padding-left: 1rem;
        border-left: 4px solid var(--ns-primary-color);
        gap: 6px;
    }
    .ns-nav-action-link span { display: inline; }
    .ns-navbar-menu .ns-btn-logout {
        margin: 0.5rem 1rem 0;
        display: block;
        text-align: center;
    }
}

body.has-fixed-nav { padding-top: 84px; padding-bottom: 3.5rem; }

/* App footer: pinned to viewport bottom, distinct band from page content */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1010;
    margin: 0;
    padding: 0.55rem 1rem;
    text-align: center;
    background: linear-gradient(180deg, #1a3350 0%, var(--eastmark-dark) 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -6px 24px rgba(0, 16, 40, 0.18);
    /* Let clicks reach inputs above the strip; link stays clickable */
    pointer-events: none;
}
.site-footer__inner {
    margin: 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
    letter-spacing: 0.03em;
}
.site-footer a {
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    pointer-events: auto;
}
.site-footer a:hover {
    color: #c5dcf0;
    text-decoration: underline;
}

.page-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.page-header__toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.quotations-search-wrap input[type="search"] {
    width: min(22rem, 100%);
    min-width: 12rem;
    padding: 10px 14px;
    border: 1px solid var(--eastmark-border);
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
}
.quotations-filter-empty {
    margin-top: 0;
    margin-bottom: 1rem;
}

.products-search-field {
    position: relative;
    display: flex;
    align-items: center;
}
.products-search-field .bi-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--eastmark-mid);
    opacity: 0.7;
    pointer-events: none;
    font-size: 1rem;
}
.products-search-field input[type="search"] {
    width: min(22rem, 100%);
    min-width: 12rem;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--eastmark-border);
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
}
.notice { color: var(--eastmark-mid); font-size: 13px; margin-top: 1rem; }

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

/* Packing list box dimensions table: center text, grey readonly (e.g. W when cylinder) */
#edit-pl-boxes th {
    white-space: nowrap;
}
#edit-pl-boxes td {
    text-align: center;
}
#edit-pl-boxes input[type="text"],
#edit-pl-boxes input[type="number"],
#edit-pl-boxes select {
    text-align: center !important;
}
#edit-pl-boxes input[readonly] {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

/* Sliding toast: in from right, stays 3s, slides back out */
.toast-slide {
    position: fixed;
    top: 120px;
    right: 0;
    transform: translateX(100%);
    padding: 14px 20px 14px 16px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-right: none;
    border-radius: 8px 0 0 8px;
    box-shadow: -2px 2px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #155724;
    transition: transform 0.35s ease-out;
    max-width: 90vw;
}
.toast-slide.toast-show {
    transform: translateX(0);
}
.toast-slide.toast-hide {
    transform: translateX(100%);
}
.toast-slide .toast-icon {
    font-size: 1.25rem;
    color: #28a745;
    flex-shrink: 0;
}

/* Email confirmation modal (no Bootstrap/jQuery) */
.email-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.email-modal-overlay.is-open {
    display: flex;
}
.email-modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
}
.email-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--eastmark-border, #C1CED9);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--eastmark-dark, #001028);
}
.email-modal-body {
    padding: 20px;
}
.email-modal-body p {
    margin: 0 0 12px 0;
}
.email-modal-body label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: var(--eastmark-mid, #5D6975);
    font-size: 13px;
}
.email-modal-body input,
.email-modal-body textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--eastmark-border, #C1CED9);
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}
.email-modal-body textarea {
    min-height: 80px;
    resize: vertical;
}
.email-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--eastmark-border, #C1CED9);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.email-modal-footer .btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
}
/* Cancel button: grey border (form and modal) */
.btn-cancel,
.email-modal-footer .btn-cancel {
    background: var(--eastmark-bg, #F5F5F5);
    color: var(--eastmark-dark, #001028);
    border: 1px solid var(--eastmark-border, #C1CED9);
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    font-size: 14px;
}
.btn-cancel:hover,
.email-modal-footer .btn-confirm {
    background: var(--eastmark-red, #B20000);
    color: #fff;
}
.email-modal-footer .btn-confirm:hover {
    background: #9a0000;
}
.email-modal-footer .btn-cancel:hover {
    background: #e8e8e8;
}

/* Quotation edit/create — parallel translation fields */
.quotation-tr-field-label {
    font-size: 11px;
    color: var(--eastmark-magenta);
    margin-top: 8px;
    font-weight: 600;
}
.quotation-tr-field-label--tight {
    margin-top: 6px;
}
.items-table input.item-desc {
    font-weight: 700;
    color: var(--eastmark-blue);
    border-color: rgba(43, 143, 222, 0.35);
}
input.item-desc-tr {
    color: var(--eastmark-blue);
    border-color: rgba(43, 143, 222, 0.45);
    font-weight: 700;
}
textarea.quotation-tr-input {
    color: var(--eastmark-blue);
    border-color: rgba(43, 143, 222, 0.45);
    font-weight: normal;
}
label.quotation-notes-tr-label {
    color: var(--eastmark-magenta);
    font-weight: 600;
}

.quotation-use-translation-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    margin: 0.5rem 0 0;
}
.quotation-use-translation-row__label {
    margin: 0;
    margin-left: auto;
    text-align: right;
    flex: 0 1 min(100%, 26rem);
    font-weight: normal;
    line-height: 1.35;
}
.btn-quotation-translate {
    flex-shrink: 0;
    height: 36px;
    min-width: 118px;
    padding: 0 14px;
    box-sizing: border-box;
    border: none;
    border-radius: 18px;
    background: var(--eastmark-blue);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: background 0.2s ease, filter 0.15s ease;
}
.btn-quotation-translate:hover {
    background: var(--eastmark-blue-hover);
    color: #fff;
}
.btn-quotation-translate:active {
    background: var(--eastmark-blue-pressed);
}
.btn-quotation-translate:focus-visible {
    outline: 2px solid var(--eastmark-blue);
    outline-offset: 3px;
}
.btn-quotation-translate:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    filter: none;
}

.eastmark-use-translation-switch {
    flex-shrink: 0;
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
    cursor: pointer;
    line-height: 0;
}
.eastmark-use-translation-switch:focus-visible {
    outline: 2px solid var(--eastmark-blue);
    outline-offset: 3px;
    border-radius: 20px;
}
.eastmark-use-translation-switch__track {
    display: block;
    width: 118px;
    height: 36px;
    border-radius: 18px;
    background: var(--eastmark-toggle-track-off);
    position: relative;
    transition: background 0.2s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}
.eastmark-use-translation-switch.is-on .eastmark-use-translation-switch__track {
    background: var(--eastmark-toggle-track-on);
}
.eastmark-use-translation-switch__knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 52px;
    height: 30px;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--eastmark-dark);
    transition: transform 0.22s ease;
}
.eastmark-use-translation-switch.is-on .eastmark-use-translation-switch__knob {
    transform: translateX(60px);
}
