:root {
    --surface-bg: #f2f2f2;
    --surface-card: #ffffff;
    --surface-panel: #fcf9f8;
    --surface-muted: #f0eded;
    --surface-hover: #f6f3f2;
    --border: #c7c5d3;
    --outline: #777683;
    --text: #1b1b1b;
    --muted: #464651;
    --primary: #191b76;
    --primary-strong: #31358c;
    --primary-soft: #bfc1ff;
    --secondary: #69596c;
    --success: #107c10;
    --warning: #d83b01;
    --danger: #a80000;
    --info: #0078d4;
    --sidebar-width: 260px;
    --radius-sm: 4px;
    --radius-md: 4px;
    --radius-lg: 4px;
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

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

body {
    background: var(--surface-bg);
    color: var(--text);
    font: 14px/1.55 "IBM Plex Sans", sans-serif;
}

html[dir="rtl"] body {
    font-family: "Tajawal", sans-serif;
}

h1,
h2,
h3,
h4,
h5 {
    margin: 0;
    font-family: "Be Vietnam Pro", sans-serif;
    letter-spacing: -0.02em;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] .sidebar-brand h1,
html[dir="rtl"] .page-title,
html[dir="rtl"] .auth-copy h1,
html[dir="rtl"] .metric-card strong,
html[dir="rtl"] .hero-title {
    font-family: "Tajawal", sans-serif;
    letter-spacing: 0;
}

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

img {
    max-width: 100%;
    height: auto;
}

input,
select,
textarea,
button {
    font: inherit;
}

button {
    cursor: pointer;
}

.material-symbols-outlined {
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
    vertical-align: middle;
}

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

.app-sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--surface-card);
    border-inline-end: 1px solid var(--border);
    z-index: 40;
    padding: 20px 14px 14px;
}

html[dir="rtl"] .app-sidebar {
    inset-inline-start: auto;
    inset-inline-end: 0;
    border-inline-end: 0;
    border-inline-start: 1px solid var(--border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 10px 18px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand img {
    width: 42px;
}

.sidebar-brand h1 {
    font-size: 20px;
    color: var(--primary);
    font-weight: 800;
}

.sidebar-brand p {
    margin: 2px 0 0;
    color: var(--muted);
    opacity: 0.8;
    font-size: 12px;
}

.sidebar-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 18px 8px 10px;
    padding: 14px 16px;
    background: var(--primary-strong);
    color: #fff;
    border-radius: var(--radius-lg);
    font-weight: 600;
}

.sidebar-nav {
    display: grid;
    gap: 4px;
    padding: 8px 0;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 6px;
    padding: 12px 14px;
    border-radius: var(--radius-lg);
    color: var(--muted);
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.sidebar-link:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.sidebar-link.is-active {
    background: var(--primary-soft);
    color: #050369;
    font-weight: 700;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.sidebar-version {
    padding: 12px 20px 4px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.04em;
}

.sidebar-link.is-logout {
    color: var(--danger);
}

.app-stage {
    margin-inline-start: var(--sidebar-width);
    min-height: 100vh;
}

html[dir="rtl"] .app-stage {
    margin-inline-start: 0;
    margin-inline-end: var(--sidebar-width);
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 32px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(6px);
}

.search-wrap {
    flex: 1;
    max-width: 480px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-muted);
}

.search-wrap input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    padding: 11px 0;
}

.search-wrap button {
    border: 0;
    background: transparent;
    color: var(--primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
}

.icon-btn:hover,
.lang-btn:hover {
    background: var(--surface-hover);
}

.lang-btn {
    border-color: var(--border);
    background: var(--surface-card);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-inline-start: 10px;
    margin-inline-start: 6px;
    border-inline-start: 1px solid var(--border);
}

.user-chip strong {
    display: block;
    font-size: 13px;
    color: var(--primary);
}

.user-chip small {
    color: var(--muted);
}

.avatar-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--primary-strong);
    color: #fff;
}

.app-content {
    padding: 32px;
}

.flash {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-card);
    font-weight: 600;
}

.flash-success {
    border-color: rgba(16, 124, 16, 0.2);
    background: rgba(16, 124, 16, 0.08);
    color: var(--success);
}

.flash-error {
    border-color: rgba(168, 0, 0, 0.2);
    background: rgba(168, 0, 0, 0.08);
    color: var(--danger);
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 28px;
}

.page-title {
    font-size: 20px;
    color: var(--primary);
    font-weight: 400;
}

.page-subtitle {
    margin-top: 4px;
    color: var(--muted);
    font-size: 15px;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-card);
    color: var(--text);
    font-weight: 600;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

.page-head .btn,
.app-content form .btn[type="submit"] {
    padding: 8px 14px;
    font-size: 13px;
}

.btn-primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

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

.hero-banner,
.panel,
.metric-card,
.stat-card,
.form-card {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.hero-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 22px 24px;
    margin-bottom: 24px;
}

.hero-title {
    font-size: 24px;
    color: var(--primary);
}

.hero-banner input {
    width: 320px;
    max-width: 100%;
}

.metric-grid,
.stat-grid {
    display: grid;
    gap: 16px;
}

.metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin-bottom: 24px;
}

.stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 24px;
}

.metric-card,
.stat-card {
    padding: 18px;
    border-top: 4px solid var(--primary);
}

.metric-card.is-danger,
.stat-card.is-danger {
    border-top-color: var(--danger);
}

.metric-card.is-info,
.stat-card.is-info {
    border-top-color: var(--info);
}

.metric-card.is-success,
.stat-card.is-success {
    border-top-color: var(--success);
}

.metric-card.is-warning,
.stat-card.is-warning {
    border-top-color: var(--warning);
}

.metric-card header,
.stat-card header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    margin-bottom: 12px;
}

.metric-card strong,
.stat-card strong {
    display: block;
    font-size: 28px;
    margin-bottom: 4px;
}

.metric-meta,
.stat-meta {
    color: var(--success);
    font-weight: 600;
    font-size: 12px;
}

.panel {
    padding: 20px;
    margin-bottom: 24px;
}

.panel-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.panel h3 {
    font-size: 20px;
    color: var(--primary);
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.module-card {
    display: grid;
    gap: 12px;
    padding: 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: linear-gradient(135deg, #ffffff, #f7f7fb);
}

.module-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--primary-strong);
    color: #fff;
}

.content-split {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 16px;
}

.feed-list,
.alert-list,
.plain-list {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.feed-list li,
.alert-list li {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-panel);
}

.feed-list small,
.alert-list small {
    color: var(--muted);
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 180px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-panel);
    color: var(--muted);
}

.filter-chip select,
.filter-chip input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
}

.data-table-wrap {
    overflow: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 12px 14px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: start;
}

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

.data-table td {
    padding: 14px;
    border-bottom: 1px solid #eceaf4;
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge.is-success { background: rgba(16, 124, 16, 0.12); color: var(--success); }
.badge.is-warning { background: rgba(216, 59, 1, 0.12); color: var(--warning); }
.badge.is-danger { background: rgba(168, 0, 0, 0.1); color: var(--danger); }
.badge.is-info { background: rgba(0, 120, 212, 0.1); color: var(--info); }
.badge.is-muted { background: rgba(105, 89, 108, 0.12); color: var(--secondary); }

.form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
}

.form-card {
    padding: 18px;
}

.form-card.col-4 { grid-column: span 4; }
.form-card.col-8 { grid-column: span 8; }
.form-card.col-12 { grid-column: span 12; }

.field-group {
    display: grid;
    gap: 14px;
}

.customer-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.customer-active-field {
    grid-column: 1 / -1;
}

.field {
    display: grid;
    gap: 6px;
}

.field.is-required input,
.field.is-required select,
.field.is-required textarea {
    border-inline-end: 4px solid var(--danger);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field.is-valid input,
.field.is-valid select,
.field.is-valid textarea {
    border-inline-end-color: var(--success);
}

.field.is-invalid input,
.field.is-invalid select,
.field.is-invalid textarea {
    border-inline-end-color: var(--danger);
}

.field label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.field-label-row .mini-link {
    font-size: 12px;
    white-space: nowrap;
}

.inline-link-button {
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.searchable-combobox {
    position: relative;
}

.combobox-options {
    position: absolute;
    inset: calc(100% + 4px) 0 auto;
    z-index: 30;
    max-height: 240px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.combobox-options button {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    text-align: start;
    cursor: pointer;
}

.combobox-options button:hover,
.combobox-options button:focus {
    background: rgba(49, 53, 140, 0.08);
    outline: none;
}

.combobox-options button[hidden] {
    display: none;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 18, 45, 0.5);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-card {
    width: min(520px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 20px;
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
}

.form-hint {
    margin: -4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.modal-error {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: rgba(168, 0, 0, 0.08);
    color: var(--danger);
    font-size: 13px;
}

body.has-modal {
    overflow: hidden;
}

.milestone-list {
    display: grid;
    gap: 10px;
}

.cost-item-list {
    display: grid;
    gap: 10px;
}

.milestone-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(130px, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.cost-item-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(130px, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.milestone-remove {
    color: var(--danger);
}

.cost-item-remove {
    color: var(--danger);
}

.milestone-table {
    width: 100%;
    border-collapse: collapse;
}

.milestone-table th,
.milestone-table td {
    padding: 10px 12px;
    border: 1px solid var(--border);
    text-align: start;
}

.milestone-table th {
    background: rgba(49, 53, 140, 0.06);
    color: var(--primary);
}

.field input,
.field select,
.field textarea,
.hero-banner input,
.auth-form input,
.auth-form select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--text);
}

.field textarea {
    min-height: 110px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.hero-banner input:focus,
.auth-form input:focus,
.auth-form select:focus {
    outline: none;
    border-color: var(--primary-strong);
    box-shadow: 0 0 0 3px rgba(49, 53, 140, 0.12);
}

.table-actions {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.table-actions form {
    margin: 0;
}

.table-actions button {
    padding: 0;
    border: 0;
    background: transparent;
}

.mini-link {
    color: var(--primary);
    font-weight: 600;
}

.table-record-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.table-record-link:hover {
    text-decoration: underline;
}

.table-actions .table-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--primary);
    cursor: pointer;
}

.table-actions .table-icon-btn:hover {
    border-color: var(--primary);
    background: rgba(49, 53, 140, 0.07);
}

.table-actions .table-icon-btn.is-danger {
    color: var(--danger);
}

.table-actions .table-icon-btn.is-danger:hover {
    border-color: var(--danger);
    background: rgba(168, 0, 0, 0.07);
}

.table-icon-btn .material-symbols-outlined {
    font-size: 17px;
}

.auth-main {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 480px) 1fr;
    background: var(--surface-panel);
}

.auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px;
    background: #fcf9f8;
}

.auth-copy h1 {
    font-size: 32px;
    color: var(--primary);
    margin-bottom: 8px;
}

.auth-copy p {
    color: var(--muted);
    margin: 0 0 28px;
}

.auth-form {
    display: grid;
    gap: 18px;
}

.auth-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.auth-submit {
    width: 100%;
    justify-content: center;
}

.auth-side {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: #fff;
    background: linear-gradient(145deg, #191b76, #31358c 58%, #5155ad);
    overflow: hidden;
}

.auth-side::before,
.auth-side::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    opacity: 0.16;
}

.auth-side::before {
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, #ffffff 0%, transparent 68%);
    inset-inline-end: -140px;
    inset-block-start: -120px;
}

.auth-side::after {
    width: 620px;
    height: 620px;
    background: radial-gradient(circle, #eed9f0 0%, transparent 60%);
    inset-inline-start: -180px;
    inset-block-end: -220px;
}

.auth-side-inner {
    position: relative;
    z-index: 1;
    max-width: 520px;
    text-align: center;
}

.auth-logo-card {
    display: inline-flex;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 28px;
}

.auth-logo-card img {
    width: 220px;
}

.auth-kpis {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-top: 24px;
}

.auth-kpi {
    padding: 16px;
    text-align: start;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(6px);
}

.auth-kpi strong {
    display: block;
    margin: 8px 0 2px;
    font-size: 22px;
}

.muted {
    color: var(--muted);
}

.mobile-only {
    display: none;
}

.dashboard-actions {
    width: 100%;
    justify-content: flex-start;
}

.document-sheet {
    position: relative;
    overflow: hidden;
    padding: 28px 32px 24px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
    isolation: isolate;
}

.print-letterhead {
    display: none;
}

.document-header {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    min-height: 82px;
}

.document-header img {
    width: min(260px, 42%);
    object-fit: contain;
}

.document-rule {
    position: relative;
    z-index: 1;
    width: 100%;
    background: var(--primary);
}

.document-rule-lg {
    height: 5px;
    margin-bottom: 24px;
}

.document-rule-sm {
    height: 2px;
    margin-top: 28px;
    margin-bottom: 12px;
}

.document-body,
.document-footer {
    position: relative;
    z-index: 1;
}

.document-body {
    display: grid;
    gap: 24px;
}

.document-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
}

.document-meta div {
    padding: 12px 14px;
    background: rgba(25, 27, 118, 0.04);
    border: 1px solid rgba(25, 27, 118, 0.1);
    border-radius: var(--radius-md);
}

.document-sheet .data-table thead th {
    position: static;
    background: rgba(25, 27, 118, 0.08);
    color: var(--primary);
}

.document-sheet .data-table tbody tr:nth-child(even) {
    background: rgba(25, 27, 118, 0.025);
}

.document-totals {
    display: grid;
    justify-content: end;
    gap: 8px;
    margin-top: 8px;
    text-align: end;
}

.document-totals div {
    min-width: 240px;
}

.document-details {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid rgba(25, 27, 118, 0.12);
    border-radius: var(--radius-md);
    background: rgba(25, 27, 118, 0.03);
}

.document-details h3 {
    font-size: 18px;
    color: var(--primary);
}

.document-rich-text {
    display: grid;
    gap: 10px;
}

.document-title-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
}

.document-title-row h1 {
    font-size: 28px;
    color: var(--primary);
}

.document-title-row p {
    margin: 4px 0 0;
    color: var(--muted);
}

.document-section {
    display: grid;
    gap: 12px;
}

.document-section h3 {
    font-size: 18px;
    color: var(--primary);
}

.signature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.signature-box {
    min-height: 120px;
    padding: 16px;
    border: 1px dashed rgba(25, 27, 118, 0.3);
    border-radius: var(--radius-md);
    background: rgba(25, 27, 118, 0.02);
}

.signature-box strong {
    display: block;
    margin-bottom: 48px;
    color: var(--primary);
}

.signature-box span {
    display: block;
    color: var(--muted);
    padding-top: 8px;
    border-top: 1px solid rgba(25, 27, 118, 0.18);
}

.document-footer {
    color: var(--primary);
    font-weight: 600;
    text-align: center;
}

.document-watermark {
    position: absolute;
    top: 50%;
    right: -18%;
    z-index: 0;
    width: min(680px, 72vw);
    height: min(680px, 72vw);
    transform: translateY(-48%);
    background: url("../img/logo_watermark.jpeg") no-repeat center / contain;
    opacity: 0.07;
    pointer-events: none;
}

html[dir="rtl"] .document-header {
    justify-content: flex-start;
}

html[dir="rtl"] .document-watermark {
    right: auto;
    left: -18%;
}

html[dir="rtl"] .dashboard-actions {
    justify-content: flex-end;
}

@media (max-width: 1100px) {
    .content-split,
    .auth-main,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-card.col-4,
    .form-card.col-8,
    .form-card.col-12 {
        grid-column: span 12;
    }

    .auth-side {
        min-height: 340px;
    }
}

@media (max-width: 920px) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    html[dir="rtl"] .app-sidebar {
        transform: translateX(100%);
    }

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

    .app-stage,
    html[dir="rtl"] .app-stage {
        margin: 0;
    }

    .app-topbar,
    .app-content,
    .auth-panel,
    .auth-side {
        padding-inline: 18px;
    }

    .mobile-only {
        display: inline-flex;
    }

    .user-chip {
        display: none;
    }

    .dashboard-actions {
        justify-content: stretch;
    }

    .dashboard-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .customer-field-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .action-row,
    .topbar-actions,
    .auth-actions,
    .panel-header {
        width: 100%;
    }

    .search-wrap {
        min-width: 0;
    }

    .app-topbar {
        padding: 0 14px;
    }

    .app-content {
        padding: 18px 14px 28px;
    }

    .hero-banner {
        padding: 18px;
    }

    .auth-panel {
        padding-block: 28px;
    }

    .document-sheet {
        padding: 20px 16px 18px;
    }

    .document-meta {
        grid-template-columns: 1fr;
    }

    .document-totals {
        justify-content: stretch;
        text-align: start;
    }

    .document-totals div {
        min-width: 0;
    }

    .document-watermark {
        width: 110vw;
        height: 110vw;
        right: -34%;
        opacity: 0.05;
    }

    html[dir="rtl"] .document-watermark {
        left: -34%;
    }

    .signature-grid {
        grid-template-columns: 1fr;
    }

    .milestone-row {
        grid-template-columns: 1fr auto;
    }

    .cost-item-row {
        grid-template-columns: 1fr auto;
    }

    .milestone-row input:first-child {
        grid-column: 1 / -1;
    }

    .cost-item-row input:first-child {
        grid-column: 1 / -1;
    }
}

@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }

    html,
    body {
        width: 210mm;
        min-height: 297mm;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    body {
        background: #fff;
    }

    .app-sidebar,
    .app-topbar,
    .page-head,
    .flash,
    .print-hidden {
        display: none !important;
    }

    .app-stage,
    html[dir="rtl"] .app-stage {
        margin: 0;
    }

    .app-content {
        padding: 0;
    }

    .document-sheet {
        margin: 0;
        border: 0;
        box-shadow: none;
    }

    .delivery-note-sheet {
        width: 210mm;
        min-height: 297mm;
        padding: 38mm 18mm 30mm;
        border-radius: 0;
        isolation: isolate;
    }

    .delivery-note-sheet .print-letterhead {
        position: absolute;
        inset: 0;
        z-index: 0;
        display: block;
        width: 210mm;
        height: 297mm;
        object-fit: fill;
    }

    .delivery-note-sheet .document-header,
    .delivery-note-sheet > .document-rule,
    .delivery-note-sheet > .document-footer,
    .delivery-note-sheet > .document-watermark {
        display: none;
    }

    .delivery-note-sheet .document-body {
        position: relative;
        z-index: 1;
    }
}
