@font-face {
    font-family: "Vazirmatn";
    src: local("Vazirmatn"), local("Vazir");
    font-display: swap;
}

:root {
    color-scheme: light;
    --navy-900: #101f3d;
    --navy-800: #19345b;
    --navy-700: #294977;
    --blue: #315f9e;
    --ink: #29394f;
    --muted: #718098;
    --line: #e3eaf3;
    --canvas: #f2f5fa;
    --green: #237451;
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-width: 320px;
}

body {
    min-height: 100vh;
    margin: 0;
    background: radial-gradient(ellipse at 85% 0%, #e6edf8, transparent 48%), var(--canvas);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
}

button {
    font: inherit;
    cursor: pointer;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid #9fc2f0;
    outline-offset: 5px;
}

::selection {
    background: #dce8f9;
    color: var(--navy-900);
}

.page {
    width: min(1120px, calc(100% - 48px));
    margin: 32px auto;
    padding: 32px 36px 24px;
    border: 1px solid #e0e7f1;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 18px 60px rgb(16 31 61 / 6%);
}

.document-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.brand-logo-wrap {
    display: grid;
    place-items: center;
    flex: 0 0 88px;
    width: 88px;
    height: 88px;
    overflow: hidden;
    border: 1px solid #e2e9f2;
    border-radius: 18px;
    background: #fff;
}

.brand-logo-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    padding: 6px;
    object-fit: contain;
}

.brand-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #274873, #101f3d);
    color: #fff;
}

.brand-fallback>span {
    font-size: 42px;
    font-weight: 850;
    line-height: 1;
}

.brand-copy {
    display: grid;
    gap: 5px;
}

.brand-copy>strong {
    color: var(--navy-900);
    font-size: 33px;
    font-weight: 900;
    line-height: 1.4;
}

.brand-copy>small {
    color: var(--muted);
    font-size: 12px;
}

.header-website {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.qr-frame {
    display: grid;
    place-items: center;
    width: 96px;
    height: 96px;
    flex: 0 0 96px;
    padding: 3px;
    border: 1px solid #dce5f1;
    border-radius: 12px;
    background: #fff;
}

.qr-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.qr-fallback {
    padding: 5px;
    color: #667b99;
    font-size: 10px;
    line-height: 1.6;
    text-align: center;
}

.website-copy {
    display: grid;
    justify-items: start;
    gap: 5px;
}

.website-label {
    color: var(--navy-800);
    font-size: 12px;
    font-weight: 750;
}

.website-url {
    color: var(--blue);
    font-family: Arial, sans-serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
}

.qr-caption {
    color: #8190a4;
    font-size: 10px;
}

.actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 9px;
    margin-top: 18px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 43px;
    padding: 9px 17px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.6;
    white-space: nowrap;
    transition: background 180ms ease, transform 180ms ease;
}

.button svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.button-print {
    background: var(--navy-900);
    color: #fff;
}

.button-excel {
    border-color: #d2e8dc;
    background: #eef8f2;
    color: var(--green);
}

.button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.catalog {
    margin-top: 20px;
}

.catalog-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 15px;
}

.catalog-heading h1 {
    margin: 0;
    color: var(--navy-900);
    font-size: 22px;
    font-weight: 850;
    line-height: 1.6;
}

.document-date {
    flex-shrink: 0;
    padding: 5px 11px;
    border: 1px solid #e4eaf3;
    border-radius: 7px;
    background: #f7f9fd;
    color: #657893;
    font-size: 11px;
    white-space: nowrap;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    scrollbar-width: thin;
    scrollbar-color: #bdcce0 #f5f8fc;
}

.price-table {
    width: 100%;
    min-width: 690px;
    border-collapse: collapse;
    table-layout: fixed;
}

.col-code {
    width: 10%;
}

.col-name {
    width: 42%;
}

.col-price {
    width: 23%;
}

.col-consumer {
    width: 25%;
}

.price-table th,
.price-table td {
    padding: 12px 17px;
    vertical-align: middle;
}

.price-table thead th {
    height: 59px;
    background: var(--navy-900);
    color: #edf3fb;
    text-align: right;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.5;
    white-space: nowrap;
}

.price-table thead th:first-child {
    text-align: center;
}

.header-unit {
    display: block;
    margin-top: 3px;
    color: #b4c8e3;
    font-size: 10px;
    font-weight: 400;
}

.price-table tbody td {
    height: 51px;
    border-bottom: 1px solid #e9eff6;
    font-size: 13px;
    line-height: 1.6;
}

.price-table tbody tr:nth-child(even) {
    background: #f7f9fd;
}

.price-table tbody tr:last-child td {
    border-bottom: 0;
}

.product-code {
    text-align: center;
}

.code-badge {
    display: inline-block;
    min-width: 45px;
    padding: 3px 8px;
    border: 1px solid #dfe7f2;
    border-radius: 6px;
    background: #f0f4fa;
    color: #627895;
    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
    direction: ltr;
}

.product-name {
    color: var(--navy-800);
    text-align: right;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.price-value {
    color: #52657f;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.consumer-value {
    color: var(--blue);
    font-weight: 850;
}

.document-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 19px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
}

.document-footer>span {
    color: var(--navy-800);
    font-weight: 750;
}

.document-footer bdi {
    margin-right: 4px;
    color: var(--navy-800);
    font-weight: 800;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    z-index: 100;
    width: max-content;
    max-width: calc(100vw - 32px);
    padding: 13px 20px;
    border: 1px solid #dce6f2;
    border-radius: 12px;
    background: #fff;
    color: var(--navy-800);
    box-shadow: 0 10px 35px rgb(16 31 61 / 12%);
    font-size: 12px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity 200ms ease, transform 200ms ease;
}

.toast.visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.noscript-message {
    padding: 12px;
    border-radius: 9px;
    background: #fff2f2;
    color: #a34141;
    text-align: center;
}

@media (hover: hover) {
    .button-print:hover {
        background: var(--navy-700);
        transform: translateY(-1px);
    }
    .button-excel:hover {
        background: #e2f2e9;
        transform: translateY(-1px);
    }
    .price-table tbody tr:hover {
        background: #edf3fc;
    }
}

@media screen and (max-width: 760px) {
    .page {
        width: calc(100% - 28px);
        margin: 18px auto;
        padding: 24px 18px 20px;
    }
    .document-header {
        gap: 15px;
    }
    .brand {
        gap: 12px;
    }
    .brand-logo-wrap {
        width: 70px;
        height: 70px;
        flex-basis: 70px;
    }
    .brand-copy>strong {
        font-size: 27px;
    }
    .brand-copy>small {
        font-size: 10px;
    }
    .header-website {
        gap: 9px;
    }
    .qr-frame {
        width: 80px;
        height: 80px;
        flex-basis: 80px;
    }
    .website-url {
        font-size: 12px;
    }
    .website-label {
        font-size: 10px;
    }
    .qr-caption {
        font-size: 9px;
    }
    .catalog-heading h1 {
        font-size: 19px;
    }
    .document-date {
        font-size: 10px;
    }
}

@media screen and (max-width: 540px) {
    .page {
        width: calc(100% - 20px);
        margin: 10px auto;
        padding: 20px 14px 16px;
        border-radius: 14px;
    }
    .document-header {
        flex-wrap: wrap;
        gap: 18px;
        padding-bottom: 18px;
    }
    .brand,
    .header-website {
        width: 100%;
    }
    .header-website {
        padding-top: 14px;
        border-top: 1px solid #edf1f7;
    }
    .website-url {
        font-size: 15px;
    }
    .website-label {
        font-size: 12px;
    }
    .actions .button {
        flex: 1;
    }
    .catalog-heading {
        flex-wrap: wrap;
        gap: 8px;
    }
    .catalog-heading h1 {
        font-size: 18px;
    }
    .document-footer {
        flex-wrap: wrap;
        gap: 7px;
        font-size: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}

@page {
    size: A4 portrait;
    margin: 10mm;
}

@media print {
    html,
    body {
        width: auto !important;
        min-width: 0 !important;
        min-height: 0 !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }
    body {
        color: #1a2c46;
        font-size: 9pt;
        line-height: 1.4;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .no-print,
    .toast,
    #qr-generator,
    .noscript-message {
        display: none !important;
    }
    .page {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
    .document-header {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 5mm;
        padding-bottom: 4mm;
        border-bottom: 0.8pt solid #cfd9e7;
        break-inside: avoid;
        page-break-inside: avoid;
        break-after: avoid;
    }
    .brand {
        width: auto;
        gap: 4mm;
    }
    .brand-logo-wrap {
        width: 23mm;
        height: 23mm;
        flex: 0 0 23mm;
        border-radius: 3mm;
    }
    .brand-logo-wrap img {
        padding: 1mm;
    }
    .brand-fallback>span {
        font-size: 28pt;
    }
    .brand-copy {
        gap: 1.5mm;
    }
    .brand-copy>strong {
        font-size: 24pt;
        line-height: 1.3;
    }
    .brand-copy>small {
        font-size: 8pt;
        line-height: 1.4;
    }
    .header-website {
        width: auto;
        gap: 3mm;
        margin: 0;
        padding: 0;
        border: 0;
    }
    .qr-frame {
        width: 25mm;
        height: 25mm;
        flex: 0 0 25mm;
        padding: 0.5mm;
        border: 0.6pt solid #d5dfed;
        border-radius: 2mm;
        background: #fff;
    }
    .qr-frame img {
        width: 100%;
        height: 100%;
        image-rendering: pixelated;
    }
    .website-copy {
        gap: 1.5mm;
    }
    .website-label {
        font-size: 8pt;
    }
    .website-url {
        font-size: 10pt;
        line-height: 1.4;
    }
    .qr-caption {
        font-size: 7pt;
    }
    .qr-fallback {
        font-size: 7pt;
    }
    .catalog {
        margin-top: 4mm;
    }
    .catalog-heading {
        flex-wrap: nowrap;
        gap: 4mm;
        margin-bottom: 3mm;
        break-inside: avoid;
        break-after: avoid;
    }
    .catalog-heading h1 {
        font-size: 14pt;
        line-height: 1.4;
    }
    .document-date {
        padding: 1mm 2mm;
        border-radius: 1.5mm;
        font-size: 8pt;
        line-height: 1.4;
    }
    .table-scroll {
        overflow: visible;
        border: 0;
        border-radius: 0;
    }
    .price-table {
        width: 100%;
        min-width: 0;
        border: 0.5pt solid #dce4ef;
        table-layout: fixed;
    }
    .price-table thead {
        display: table-header-group;
    }
    .price-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    .price-table th,
    .price-table td {
        padding: 2mm 2.5mm;
    }
    .price-table thead th {
        height: 12mm;
        font-size: 8.5pt;
        line-height: 1.3;
    }
    .header-unit {
        margin-top: 1mm;
        font-size: 7pt;
        line-height: 1.2;
    }
    .price-table tbody td {
        height: 11mm;
        font-size: 9pt;
        line-height: 1.4;
        border-bottom: 0.5pt solid #e3eaf3;
    }
    .code-badge {
        min-width: 9mm;
        padding: 0.5mm 1mm;
        border-radius: 1mm;
        font-size: 8pt;
        line-height: 1.3;
        letter-spacing: 0.6px;
    }
    .product-name {
        overflow-wrap: normal;
    }
    .price-value {
        color: #425b7b;
    }
    .consumer-value {
        color: #244d85;
    }
    .price-table tbody tr:nth-child(even) {
        background: #f5f8fc;
    }
    .document-footer {
        position: static;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 4mm;
        margin-top: 4mm;
        padding-top: 3mm;
        border-top: 0.7pt solid #d8e1ed;
        font-size: 8pt;
        line-height: 1.4;
        break-inside: avoid;
        page-break-inside: avoid;
    }
}