@font-face {
    font-family: "KJino";
    src: url("../Assets/fonts/KJino.TTF") format("truetype");
    font-weight: 400 800;
    font-style: normal;
    font-display: swap;
}

:root {
    --re-primary: #063B3B;
    --re-sidebar: #062F35;
    --re-accent: #13C6C7;
    --re-accent-hover: #0FA7A8;
    --re-bg: #F3F8F8;
    --re-card: #FFFFFF;
    --re-text: #102027;
    --re-muted: #607D80;
    --re-border: #DCEBEC;
    --re-danger: #B42318;
}

html, body {
    min-height: 100%;
}

html, body {
    overflow-x: hidden;
}

html,
body,
input,
select,
textarea,
button,
table,
.sidebar,
.topbar,
.card,
.btn,
.form-control,
.form-select {
    font-family: "KJino","Noto Kufi Arabic","Tahoma","Arial",sans-serif;
}

body {
    margin: 0;
    background: var(--re-bg);
    color: var(--re-text);
    direction: rtl;
    font-weight: 700;
}

input,
select,
textarea,
table,
.form-control,
.form-select {
    font-weight: 600;
}

h1, h2, h3, h4, h5, h6,
.brand,
.nav-link,
.form-label,
.btn {
    font-weight: 800;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--re-sidebar) 0%, var(--re-primary) 100%);
    color: #fff;
    padding: 18px 14px;
    flex: 0 0 260px;
    box-shadow: -10px 0 24px rgba(6,47,53,.16) inset;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    margin-bottom: 18px;
    line-height: 1.35;
}

.brand-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    padding: 4px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--re-accent);
    color: var(--re-primary);
    box-shadow: 0 10px 22px rgba(19,198,199,.28);
}

.brand-name {
    min-width: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #D9F4F4;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: background-color .16s ease, color .16s ease, transform .16s ease;
}

.menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    min-width: 24px;
    height: 24px;
    font-size: 17px;
    line-height: 1;
    color: #fff;
    opacity: .94;
    margin-left: 2px;
}

.sidebar .menu-icon,
.btn .menu-icon {
    color: #fff;
}

    .sidebar .menu-icon:before,
    .btn .menu-icon:before {
        display: block;
        font-size: 17px;
        line-height: 1;
        color: currentColor;
    }

.menu-icon-dashboard:before {
    content: "⌂";
}

.menu-icon-properties:before {
    content: "▣";
}

.menu-icon-customers:before {
    content: "◉";
}

.menu-icon-rent-contracts:before {
    content: "▤";
}

.menu-icon-sale-contracts:before {
    content: "▥";
}

.menu-icon-payments:before {
    content: "◍";
}

.menu-icon-finance:before {
    content: "▦";
}

.menu-icon-report:before {
    content: "⌁";
}

.menu-icon-projects:before {
    content: "▧";
}

.menu-icon-map:before {
    content: "◎";
}

.menu-icon-users:before {
    content: "◌";
}

.menu-icon-roles:before {
    content: "◈";
}

.menu-icon-permissions:before {
    content: "✓";
}

.menu-icon-settings:before {
    content: "⚙";
}

.menu-icon-logs:before {
    content: "◷";
}

.menu-icon-logout:before {
    content: "↪";
}

.menu-icon-partners:before {
    content: "◬";
}

.menu-icon-partner-cash:before {
    content: "▩";
}

.menu-icon-transfer:before {
    content: "⇄";
}

.menu-icon-loans:before {
    content: "◇";
}

.menu-icon-trades:before {
    content: "▨";
}

.menu-icon-trade-buy:before {
    content: "＋";
}

.menu-icon-trade-sale:before {
    content: "−";
}

.menu-icon-partner-report:before {
    content: "▤";
}

.menu-text {
    min-width: 0;
}

.nav-link:hover,
.nav-link:focus {
    background: rgba(19,198,199,.16);
    color: #fff;
    transform: translateX(-2px);
}

.main {
    flex: 1;
    min-width: 0;
}

.topbar {
    min-height: 66px;
    background: #fff;
    border-bottom: 1px solid var(--re-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 8px 22px rgba(6,59,59,.05);
}

.topbar-title {
    color: var(--re-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.topbar-brand-name {
    color: var(--re-muted);
    margin-left: 8px;
}

.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--re-border);
    border-radius: 8px;
    background: #fff;
    color: var(--re-primary);
    font-size: 22px;
    line-height: 1;
}

.sidebar-backdrop {
    display: none;
}

.content {
    padding: 24px;
}

.currency-select {
    width: 95px;
}

.re-card,
.card {
    border: 1px solid var(--re-border);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(6,59,59,.07);
    background: var(--re-card);
}

.kpi {
    background: #fff;
    border: 1px solid var(--re-border);
    border-radius: 8px;
    padding: 18px;
    min-height: 108px;
    box-shadow: 0 10px 24px rgba(6,59,59,.06);
    border-top: 4px solid var(--re-accent);
}

    .kpi .label {
        color: var(--re-muted);
        font-size: 13px;
    }

    .kpi .value {
        font-size: 25px;
        font-weight: 800;
        margin-top: 8px;
        color: var(--re-primary);
    }

    .kpi.kpi-card {
        position: relative;
        overflow: hidden;
        border: 0;
        border-radius: 18px;
        padding: 22px 24px;
        min-height: 126px;
        color: #fff;
        box-shadow: 0 16px 32px rgba(6,59,59,.18);
    }

.kpi-card:before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 12% 88%, rgba(255,255,255,.24) 0, rgba(255,255,255,.08) 28%, transparent 58%);
    z-index: 1;
}

.kpi-card .kpi-title {
    color: rgba(255,255,255,.9);
    font-size: 20px;
    font-weight: 800;
    position: relative;
    z-index: 2;
    max-width: 78%;
}

.kpi-card .kpi-value {
    color: #fff;
    font-size: 30px;
    font-weight: 900;
    margin-top: 12px;
    position: relative;
    z-index: 2;
    letter-spacing: 0;
}

.kpi-card .kpi-art {
    position: absolute;
    left: 18px;
    bottom: 4px;
    font-size: 62px;
    line-height: 1;
    color: rgba(255,255,255,.22);
    z-index: 1;
    font-weight: 900;
}

.kpi-card-teal {
    background: linear-gradient(135deg, #063B3B 0%, #13C6C7 100%);
}

.kpi-card-green {
    background: linear-gradient(135deg, #0B6B55 0%, #23C483 100%);
}

.kpi-card-blue {
    background: linear-gradient(135deg, #0B3D91 0%, #19B5FE 100%);
}

.kpi-card-purple {
    background: linear-gradient(135deg, #4B2E83 0%, #9B5DE5 100%);
}

.kpi-card-info {
    background: linear-gradient(135deg, #0891B2 0%, #2563EB 100%);
}

.kpi-card-orange {
    background: linear-gradient(135deg, #C05621 0%, #F472B6 100%);
}

.kpi-card-indigo {
    background: linear-gradient(135deg, #3730A3 0%, #9333EA 100%);
}

.kpi-card-red {
    background: linear-gradient(135deg, #C2410C 0%, #BE185D 100%);
}

.kpi-card-money {
    background: linear-gradient(135deg, #047857 0%, #064E3B 100%);
}

.kpi-card-expense {
    background: linear-gradient(135deg, #B45309 0%, #DC2626 100%);
}

.kpi-card-profit {
    background: linear-gradient(135deg, #1D4ED8 0%, #7E22CE 100%);
}

.kpi-card-navy {
    background: linear-gradient(135deg, #102027 0%, #0FA7A8 100%);
}

.table {
    color: var(--re-text);
}

    .table thead th {
        background: var(--re-primary);
        color: #fff;
        border-color: var(--re-primary);
    }

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: #F8FCFC;
}

.table img.thumb {
    width: 68px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
}

.form-label {
    color: var(--re-primary);
}

.form-control,
.form-select {
    border-color: #CFE2E3;
    border-radius: 8px;
}

    .form-control:focus,
    .form-select:focus {
        border-color: var(--re-accent);
        box-shadow: 0 0 0 .18rem rgba(19,198,199,.18);
    }

.btn {
    border-radius: 8px;
}

.btn-primary {
    background: var(--re-accent);
    border-color: var(--re-accent);
    color: #062F35;
}

    .btn-primary:hover,
    .btn-primary:focus {
        background: var(--re-accent-hover);
        border-color: var(--re-accent-hover);
        color: #fff;
    }

.btn-outline-primary {
    color: var(--re-primary);
    border-color: var(--re-accent);
}

    .btn-outline-primary:hover {
        background: var(--re-accent);
        border-color: var(--re-accent);
        color: #062F35;
    }

.btn-outline-danger {
    color: var(--re-danger);
    border-color: #F0B8B2;
}

.badge-status-available,
.status-available {
    background: #DDF8EA;
    color: #087443;
}

.badge-status-rented,
.status-rented {
    background: #DCF7F8;
    color: #0B6870;
}

.badge-status-sold,
.status-sold {
    background: #E8ECEF;
    color: #263238;
}

.badge-status-reserved,
.status-reserved {
    background: #FFF0D8;
    color: #B54708;
}

.actions {
    white-space: nowrap;
}

.rent-contract-form {
    overflow: hidden;
}

.rent-form-section {
    border: 1px solid #f4b45e;
    background: #fffaf2;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

    .rent-form-section h2 {
        margin: 0 0 14px;
        color: var(--re-primary);
        font-size: 19px;
        font-weight: 900;
    }

.rent-form-section-owner {
    background: #fff7e7;
}

.rent-form-section-tenant {
    background: #f6fbff;
    border-color: #93c5fd;
}

.rent-form-section-property {
    background: #fff;
    border-color: var(--re-border);
}

.sale-contract-form {
    overflow: hidden;
}

.sale-party-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 18px;
}

.sale-party-panel,
.sale-detail-panel {
    border: 1px solid var(--re-border);
    border-radius: 8px;
    background: #fff;
    padding: 16px;
}

    .sale-party-panel h2 {
        margin: 0 0 14px;
        font-size: 18px;
        font-weight: 900;
    }

.sale-party-seller {
    border-color: #f0b8b2;
    background: #fff8f7;
}

.sale-party-buyer {
    border-color: #a7e6c4;
    background: #f6fffa;
}

.sale-label-seller {
    color: #b42318;
}

.sale-label-buyer {
    color: #087443;
}

.sale-witness-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

    .sale-witness-row .form-control {
        min-width: 0;
    }

.sale-suggestion-chip {
    white-space: nowrap;
}

.sale-notes-template {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px dashed #f9a12b;
    border-radius: 8px;
    padding: 10px 12px;
    background: #fffaf2;
}

.settings-witness-defaults {
    border: 1px solid var(--re-border);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 16px;
    background: #F8FCFC;
}

.print-sheet {
    background: #fff;
    max-width: 820px;
    margin: 0 auto;
    padding: 28px;
    border: 1px solid var(--re-border);
}

.contract-brand-logo {
    width: 76px;
    height: 76px;
    object-fit: contain;
    margin-bottom: 8px;
}

.contract-print-actions {
    max-width: 920px;
    margin: 0 auto 14px;
}

.contract-print-page {
    width: 210mm;
    min-height: 297mm;
    max-width: 100%;
    margin: 0 auto;
    padding: 9mm 9mm 11mm;
    background: #fff;
    color: #000;
    border: 1px solid #dedede;
    box-shadow: 0 16px 44px rgba(0,0,0,.12);
    font-family: "KJino","Noto Kufi Arabic","Tahoma","Arial",sans-serif;
    font-size: 18px;
    line-height: 1.85;
    font-weight: 700;
}

.contract-banner {
    width: 100%;
    border: 2px solid #111;
    border-radius: 14px;
    margin-bottom: 15px;
}

.contract-logo-wrap {
    text-align: center;
}

.contract-logo {
    max-width: 150px;
    max-height: 96px;
    object-fit: contain;
}

.contract-logo-fallback {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 148px;
    height: 88px;
    border: 0;
    color: #003B75;
    font-size: 24px;
    font-weight: 900;
    line-height: 1.05;
    text-transform: uppercase;
}

    .contract-logo-fallback span {
        color: #1d3f7a;
        font-size: 18px;
        font-style: italic;
    }

.contract-office-title {
    text-align: center;
}

    .contract-office-title h1 {
        margin: 0;
        color: #111;
        font-size: 44px;
        line-height: 1.1;
        font-weight: 900;
        text-shadow: 1px 1px 0 #f9a12b;
    }

    .contract-office-title p {
        margin: 6px 0 0;
        color: #000;
    }

    .contract-office-title small {
        display: block;
        color: #000;
    }

.contract-office-kicker {
    color: #003B75;
    font-weight: 900;
    font-size: 19px;
}

.contract-contact {
    color: #003B75;
    text-align: right;
    font-size: 20px;
    font-weight: 900;
}

    .contract-contact strong,
    .contract-contact span {
        display: block;
    }

.contract-meta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 14px;
    margin: 10px 0 12px;
    font-weight: 900;
}

.contract-title-pill,
.contract-section-title {
    width: max-content;
    margin: 3px auto 10px;
    padding: 4px 20px 5px;
    border: 1.5px solid #5f594e;
    border-radius: 7px;
    background: #f5ecd5;
    box-shadow: 0 1px 2px rgba(0,0,0,.15);
    color: #111;
    text-align: center;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.35;
}

.contract-title-pill {
    display: block;
    width: max-content;
    margin: 0 auto 18px;
}

.contract-section-title {
    width: 60%;
    margin: 12px auto 12px;
    padding: 7px 20px;
}

.contract-number {
    color: #d60000;
    text-align: right;
}

.contract-date {
    text-align: left;
}

    .contract-date span {
        color: #000;
    }

.contract-number span {
    color: #d60000;
}

.contract-party-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 14px;
}

.contract-party-box {
    border: 2px solid #f9a12b;
    background: #ffe6bd;
    min-height: 120px;
    padding: 14px 18px;
}

    .contract-party-box h2 {
        margin: 0 0 8px;
        font-size: 17px;
        font-weight: 900;
    }

    .contract-party-box p {
        margin: 4px 0;
    }

.contract-terms {
    padding: 2px 18px;
}

.contract-term {
    margin: 0 0 6px;
    color: #000;
}

.contract-blue {
    color: #003bd1;
    font-weight: 900;
}

.contract-warning {
    color: #d60000;
    font-weight: 900;
    margin: 8px 0 4px;
    text-align: right;
    float: right
}

.contract-notes-text {
    color: #000;
    padding-top: 10px;
    padding-right: 10px;
    overflow: hidden;
    text-align: right;
    font-weight: 800;
    float: right
}

.contract-signature-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin-top: 12px;
    page-break-inside: avoid;
}

    .contract-signature-table th {
        background: #ffa62b;
        border: 2px solid #111;
        color: #000;
        text-align: center;
        padding: 7px;
        font-weight: 900;
    }

    .contract-signature-table td {
        border: 2px solid #111;
        text-align: center;
        padding: 14px 7px;
        min-height: 42px;
        font-weight: 900;
    }

    .contract-signature-table .signature-space td {
        height: 46px;
        padding: 0;
    }

    .contract-signature-table .contract-signature-blank-row td {
        height: 46px;
        padding: 0;
    }

.sale-contract-print-page {
    padding: 7mm 8mm 8mm;
    font-size: 16px;
    line-height: 1.55;
}

    .sale-contract-print-page .contract-banner {
        margin-bottom: 8px;
    }

.sale-contract-meta-row {
    grid-template-columns: 1fr auto 1fr;
    margin: 6px 0 8px;
}

    .sale-contract-meta-row .contract-number {
        grid-column: 1;
        text-align: right;
        color: #d60000;
    }

    .sale-contract-meta-row .contract-title-pill {
        grid-column: 2;
    }

    .sale-contract-meta-row .contract-date {
        grid-column: 3;
        text-align: left;
    }

.sale-contract-lawyer-line {
    margin: 4px 0 6px;
    font-weight: 900;
}

.sale-contract-cardholder-line {
    margin: 2px 0 6px;
    font-weight: 900;
}

.contract-selector-preview {
    border: 1px solid var(--re-border);
    border-radius: 8px;
    background: #F8FCFC;
    padding: 10px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 13px;
}

    .contract-selector-preview span {
        white-space: normal;
    }

.sale-contract-clause-heading {
    margin: 6px auto;
}

.sale-contract-clause-list {
    padding: 0 10px;
}

    .sale-contract-clause-list .contract-term {
        margin-bottom: 2px;
    }

.sale-contract-notes {
    color: #d60000;
    font-weight: 900;
    margin-top: 7px;
}

    .sale-contract-notes span {
        color: #000;
    }

@media screen and (max-width: 991px) {
    .sale-party-grid {
        grid-template-columns: 1fr;
    }

    .sale-witness-row,
    .sale-notes-template {
        align-items: stretch;
        flex-direction: column;
    }

    .contract-print-page {
        width: 100%;
        min-height: 0;
        padding: 14px;
        font-size: 13px;
    }

    .contract-header,
    .contract-meta-row,
    .contract-party-grid {
        grid-template-columns: 1fr;
    }

    .contract-number,
    .contract-date,
    .contract-contact {
        text-align: center;
    }

    .contract-section-title {
        width: 100%;
    }
}

.settings-preview {
    border: 1px dashed var(--re-border);
    border-radius: 8px;
    padding: 18px;
    min-height: 170px;
    background: #F8FCFC;
}

.settings-logo-preview {
    max-width: 100%;
    max-height: 150px;
    object-fit: contain;
}

.default-logo-preview {
    display: flex;
    align-items: center;
    gap: 12px;
}

    .default-logo-preview span {
        width: 58px;
        height: 58px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        background: var(--re-accent);
        color: var(--re-primary);
        font-size: 28px;
    }

.login-page {
    background-color: #063B3B;
    background-image: linear-gradient(135deg, rgba(6,59,59,.88), rgba(6,47,53,.72)), linear-gradient(45deg, #F3F8F8, #DDF8EA);
    background-size: cover;
    background-position: center;
    min-height: 100vh;
}

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 14px;
}

.login-panel {
    width: 100%;
    max-width: 460px;
    border: 1px solid rgba(255,255,255,.38);
    border-radius: 8px;
    background: rgba(255,255,255,.88);
    box-shadow: 0 28px 80px rgba(0,0,0,.28);
    backdrop-filter: blur(14px);
}

    .login-panel .card-body {
        padding: 30px;
    }

    .login-panel h1 {
        color: var(--re-primary);
        font-size: 28px;
    }

    .login-panel .login-company {
        color: var(--re-muted);
    }

    .login-panel .form-control {
        min-height: 46px;
    }

.login-logo-mark {
    width: 58px;
    height: 58px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--re-accent);
    color: var(--re-primary);
    font-size: 28px;
    margin-bottom: 14px;
}

.login-logo-img {
    max-width: 90px;
    max-height: 90px;
    object-fit: contain;
    display: block;
    margin: 0 auto 12px;
}

.login-logo-fallback {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(19,198,199,.18);
    color: #13C6C7;
    font-size: 34px;
    font-weight: 700;
}

.map-layout {
    min-height: 620px;
}

.property-map {
    width: 100%;
    min-height: 560px;
    border-radius: 8px;
    border: 1px solid var(--re-border);
    overflow: hidden;
    background: #EAF4F4;
}

.map-offline-message {
    position: absolute;
    z-index: 500;
    left: 20px;
    right: 20px;
    bottom: 20px;
    display: none;
}

.map-coordinate-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.security-letter-section {
    border: 1px solid var(--re-border);
    border-radius: 8px;
    background: #F8FCFC;
    padding: 14px;
    margin-bottom: 14px;
}

    .security-letter-section h2 {
        color: var(--re-primary);
        font-size: 18px;
        font-weight: 800;
        margin: 0 0 12px;
    }

.security-letter-search {
    max-width: 520px;
    width: 100%;
}

@media (max-width: 991px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 280px;
        max-width: 86vw;
        flex-basis: auto;
        z-index: 1040;
        overflow-y: auto;
        transform: translateX(105%);
        transition: transform .22s ease;
    }

        .sidebar.is-open,
        .sidebar-open .sidebar {
            transform: translateX(0);
        }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(6,47,53,.48);
        z-index: 1030;
        display: none;
    }

        .sidebar-backdrop.is-visible,
        .sidebar-open .sidebar-backdrop,
        .mobile-sidebar-open .sidebar-backdrop {
            display: block;
        }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .main {
        width: 100%;
    }

    .topbar {
        position: static;
        height: auto;
        gap: 12px;
        flex-wrap: wrap;
        padding: 12px;
    }

    .topbar-actions {
        flex-wrap: wrap;
    }

    .content {
        padding: 12px;
    }

    .property-map {
        min-height: 430px;
    }

    .map-coordinate-grid {
        grid-template-columns: 1fr;
    }
}

/* Sale Contract print body — reference layout.
   Scoped to SaleContractPrint only so the shared site header/footer and other pages remain unchanged. */
.sale-contract-print-page .sale-reference-body {
    direction: rtl;
    color: #111;
    margin: 2px 0 8px;
    font-size: 15px;
    line-height: 1.72;
    font-weight: 800;
}

.sale-contract-print-page .sale-reference-title {
    width: max-content;
    max-width: 50%;
    margin: 3px auto 10px;
    padding: 4px 20px 5px;
    border: 1.5px solid #5f594e;
    border-radius: 7px;
    background: #f5ecd5;
    box-shadow: 0 1px 2px rgba(0,0,0,.15);
    color: #111;
    text-align: center;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.35;
}

.sale-contract-print-page .sale-reference-contact-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    column-gap: 24px;
    row-gap: 3px;
    margin: 0 0 5px;
}

.sale-contract-print-page .sale-reference-field {
    display: flex;
    align-items: flex-end;
    min-width: 0;
    gap: 6px;
    white-space: nowrap;
}

.sale-contract-print-page .sale-reference-field-label {
    flex: 0 0 auto;
    color: #111;
    font-weight: 900;
}

.sale-contract-print-page .sale-reference-field-line,
.sale-contract-print-page .sale-reference-inline-line {
    position: relative;
    display: inline-flex;
    align-items: flex-end;
    justify-content: center;
    min-width: 72px;
    min-height: 23px;
    padding: 0 5px 1px;
    border-bottom: 1px dotted #777;
    vertical-align: baseline;
}

.sale-contract-print-page .sale-reference-field-line {
    flex: 1 1 auto;
    min-width: 0;
}

.sale-contract-print-page .sale-reference-dynamic {
    position: relative;
    z-index: 1;
    display: inline-block;
    max-width: 100%;
    color: #111;
    background: #fff;
    padding: 0 3px;
    overflow-wrap: anywhere;
    font-weight: 900;
}

.sale-contract-print-page .sale-reference-clauses {
    margin-top: 3px;
}

.sale-contract-print-page .sale-reference-clause {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 2px 4px;
    margin: 1px 0;
    color: #111;
    text-align: right;
    break-inside: avoid;
    page-break-inside: avoid;
}

.sale-contract-print-page .sale-reference-number {
    flex: 0 0 auto;
    color: #154acb;
    font-weight: 900;
}

.sale-contract-print-page .sale-reference-clause-label,
.sale-contract-print-page .sale-reference-clause-text {
    color: #111;
    font-weight: 800;
}

.sale-contract-print-page .sale-reference-clause-property {
    display: block;
}

    .sale-contract-print-page .sale-reference-clause-property .sale-reference-clause-text {
        margin-bottom: 2px;
    }

.sale-contract-print-page .sale-reference-property-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, .9fr) minmax(0, .8fr) minmax(0, 1fr);
    gap: 8px 12px;
    margin: 0 8px 2px 0;
}

    .sale-contract-print-page .sale-reference-property-grid .sale-reference-field {
        gap: 4px;
    }

    .sale-contract-print-page .sale-reference-property-grid .sale-reference-field-line {
        min-width: 34px;
    }

.sale-contract-print-page .sale-reference-inline-line {
    flex: 1 1 125px;
    max-width: 310px;
}

.sale-contract-print-page .sale-reference-money-line {
    min-width: 150px;
}

.sale-contract-print-page .sale-reference-date-line {
    flex: 0 1 112px;
    min-width: 96px;
    max-width: 135px;
}

.sale-contract-print-page .sale-reference-date-label {
    margin-right: 5px;
}

.sale-contract-print-page .sale-reference-red-note {
    color: #e01818;
    font-weight: 900;
    white-space: nowrap;
    margin: 0 3px;
}

.sale-contract-print-page .sale-reference-remaining-row {
    align-items: baseline;
}

.sale-contract-print-page .sale-reference-remaining-money {
    flex-basis: 145px;
    max-width: 235px;
}

@media screen and (max-width: 991px) {
    .sale-contract-print-page .sale-reference-body {
        font-size: 13px;
    }

    .sale-contract-print-page .sale-reference-title {
        width: auto;
        max-width: 100%;
    }

    .sale-contract-print-page .sale-reference-contact-grid,
    .sale-contract-print-page .sale-reference-property-grid {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .sale-contract-print-page .sale-reference-inline-line {
        flex-basis: 110px;
    }
}

@media print {
    .sale-contract-print-page .sale-reference-body {
        font-size: 14px;
        line-height: 1.56;
        margin-top: 0;
    }

    .sale-contract-print-page .sale-reference-title {
        margin-top: 1px;
        margin-bottom: 7px;
        padding-top: 3px;
        padding-bottom: 4px;
        box-shadow: none;
    }

    .sale-contract-print-page .sale-reference-contact-grid {
        row-gap: 1px;
        margin-bottom: 3px;
    }

    .sale-contract-print-page .sale-reference-clause {
        margin: 0;
    }

    .sale-contract-print-page .sale-reference-field-line,
    .sale-contract-print-page .sale-reference-inline-line {
        min-height: 20px;
    }
}

/* Security Letter print preview — table layout based on the official paper form.
   Fully scoped so other contract/print pages remain unchanged. */
.security-letter-reference-page {
    direction: rtl;
}

    .security-letter-reference-page .security-letter-reference-intro {
        margin: 4px 0 12px;
        font-size: 16px;
        font-weight: 800;
        line-height: 1.7;
    }

    .security-letter-reference-page .security-letter-reference-intro-line {
        min-height: 27px;
    }

    .security-letter-reference-page .security-letter-reference-table {
        width: 100%;
        border-collapse: collapse;
        table-layout: fixed;
        margin: 0 0 18px;
        color: #111;
        background: #fff;
        font-size: 16px;
        line-height: 1.45;
        page-break-inside: avoid;
    }

        .security-letter-reference-page .security-letter-reference-table th,
        .security-letter-reference-page .security-letter-reference-table td {
            border: 1.4px solid #666;
            padding: 5px 8px;
            height: 35px;
            vertical-align: middle;
        }

        .security-letter-reference-page .security-letter-reference-table th {
            width: 27%;
            background: #fff;
            color: #111;
            text-align: right;
            font-weight: 900;
            white-space: nowrap;
        }

        .security-letter-reference-page .security-letter-reference-table td {
            color: #111;
            text-align: right;
            font-weight: 800;
            overflow-wrap: anywhere;
        }

        .security-letter-reference-page .security-letter-reference-table tr:last-child th:nth-of-type(2) {
            width: 18%;
        }

    .security-letter-reference-page .security-letter-current-table {
        margin-top: 2px;
    }

    .security-letter-reference-page .security-letter-previous-table {
        margin-top: 26px;
        margin-bottom: 5px;
    }

    .security-letter-reference-page .security-letter-nationality-line {
        margin: 2px 4px 38px;
        text-align: right;
        font-size: 15px;
        font-weight: 800;
    }

    .security-letter-reference-page .security-letter-owner-table {
        margin-bottom: 5px;
    }

    .security-letter-reference-page .security-letter-reference-notes {
        margin: 2px 3px 0;
        color: #111;
        page-break-inside: avoid;
    }

        .security-letter-reference-page .security-letter-reference-notes h2 {
            margin: 0 0 3px;
            color: #111;
            font-size: 17px;
            font-weight: 900;
        }

        .security-letter-reference-page .security-letter-reference-notes div {
            min-height: 48px;
            padding: 1px 4px;
            color: #111;
            font-size: 15px;
            font-weight: 800;
            line-height: 1.55;
            white-space: normal;
        }

    .security-letter-reference-page .security-letter-reference-bottom {
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        gap: 24px;
        margin-top: 12px;
        padding: 0 4px;
        page-break-inside: avoid;
    }

    .security-letter-reference-page .security-letter-reference-seal {
        min-height: 54px;
        display: flex;
        align-items: flex-end;
        justify-content: flex-start;
        font-weight: 900;
    }

    .security-letter-reference-page .security-letter-reference-date {
        min-height: 30px;
        display: flex;
        align-items: flex-end;
        gap: 5px;
        font-weight: 900;
        white-space: nowrap;
    }

@media (max-width: 991px) {
    .security-letter-reference-page .security-letter-reference-intro {
        font-size: 13px;
    }

    .security-letter-reference-page .security-letter-reference-table {
        font-size: 12px;
    }

        .security-letter-reference-page .security-letter-reference-table th,
        .security-letter-reference-page .security-letter-reference-table td {
            padding: 4px 5px;
            height: 31px;
        }

        .security-letter-reference-page .security-letter-reference-table th {
            width: 31%;
            white-space: normal;
        }

    .security-letter-reference-page .security-letter-reference-bottom {
        align-items: stretch;
        flex-direction: column;
        gap: 4px;
    }
}
