/* ==========================================================================
   Tahseel Admin Dashboard — Professional Enterprise Design System Tokens & Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens & CSS Variables
   -------------------------------------------------------------------------- */
:root {
    --th-primary: #2563eb;
    --th-primary-hover: #1d4ed8;
    --th-primary-light: #eff6ff;
    --th-primary-border: #bfdbfe;

    --th-gray-50: #f8fafc;
    --th-gray-100: #f1f5f9;
    --th-gray-200: #e2e8f0;
    --th-gray-300: #cbd5e1;
    --th-gray-400: #94a3b8;
    --th-gray-500: #64748b;
    --th-gray-600: #475569;
    --th-gray-700: #334155;
    --th-gray-800: #1e293b;
    --th-gray-900: #0f172a;

    --th-success: #10b981;
    --th-success-light: #ecfdf5;
    --th-success-border: #a7f3d0;
    --th-warning: #f59e0b;
    --th-warning-light: #fffbeb;
    --th-warning-border: #fde68a;
    --th-danger: #ef4444;
    --th-danger-light: #fef2f2;
    --th-danger-border: #fecaca;
    --th-info: #0284c7;
    --th-info-light: #f0f9ff;
    --th-info-border: #bae6fd;

    --th-card-bg: #ffffff;
    --th-card-border: #e2e8f0;
    --th-card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --th-input-height: 38px;
    --th-input-radius: 6px;
    --th-card-radius: 8px;
    --th-font-sans: 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-bs-theme="dark"] {
    --th-card-bg: #1e1e2d;
    --th-card-border: #2b2b40;
    --th-gray-50: #151521;
    --th-gray-100: #1a1a27;
    --th-gray-200: #2b2b40;
    --th-gray-700: #b5b5c3;
    --th-gray-800: #e4e6ef;
    --th-gray-900: #ffffff;
    --th-primary-light: #1b283f;
    --th-primary-border: #214177;
    --th-card-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2);
}

/* --------------------------------------------------------------------------
   2. Base Typography & Body
   -------------------------------------------------------------------------- */
@font-face {
    font-family: 'Cairo';
    src: url('/admin/assets/plugins/global/fonts/Cairo/Cairo-VariableFont_slnt,wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
}

html {
    font-size: 14.5px;
}

body {
    font-family: var(--th-font-sans) !important;
    font-size: 1rem !important;
    color: var(--th-gray-800);
    letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   3. Form Controls & Sizing
   -------------------------------------------------------------------------- */
.form-label {
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    color: var(--th-gray-800) !important;
    margin-bottom: 0.4rem !important;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.form-label .label-icon {
    color: var(--th-gray-500);
    font-size: 1rem;
}

/* Form input sizing */
.form-control,
.input-group > .form-control {
    height: var(--th-input-height) !important;
    min-height: var(--th-input-height) !important;
    padding: 0.45rem 0.85rem !important;
    font-size: 0.925rem !important;
    line-height: 1.4 !important;
    border-radius: var(--th-input-radius) !important;
    border: 1px solid var(--th-gray-200) !important;
    background-color: #ffffff;
    color: var(--th-gray-800);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-select,
.input-group > .form-select {
    height: var(--th-input-height) !important;
    min-height: var(--th-input-height) !important;
    padding-top: 0.45rem !important;
    padding-bottom: 0.45rem !important;
    padding-inline-start: 0.85rem !important;
    padding-inline-end: 2.25rem !important;
    font-size: 0.925rem !important;
    line-height: 1.4 !important;
    border-radius: var(--th-input-radius) !important;
    border: 1px solid var(--th-gray-200) !important;
    background-color: #ffffff;
    color: var(--th-gray-800);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: var(--th-gray-100) !important;
    border-color: var(--th-gray-200) !important;
    color: var(--th-gray-800) !important;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--th-primary) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
    outline: none !important;
}

/* Textarea height exception */
textarea.form-control {
    height: auto !important;
    min-height: 80px !important;
    padding-top: 0.6rem !important;
    padding-bottom: 0.6rem !important;
}

/* Input group with field icons */
.input-group-compact {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
}

.input-group-compact .input-group-text {
    height: var(--th-input-height);
    background-color: var(--th-gray-50);
    border: 1px solid var(--th-gray-200);
    color: var(--th-gray-500);
    font-size: 0.95rem;
    padding: 0 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-bs-theme="dark"] .input-group-compact .input-group-text {
    background-color: var(--th-gray-100);
    border-color: var(--th-gray-200);
    color: var(--th-gray-400);
}

.input-group-compact .form-control:focus ~ .input-group-text,
.input-group-compact .form-control:focus + .input-group-text {
    border-color: var(--th-primary);
}

/* Select2 styling */
.select2-container--bootstrap5 .select2-selection--single,
.select2-container--bootstrap5 .select2-selection--multiple {
    min-height: var(--th-input-height) !important;
    padding: 0.35rem 0.85rem !important;
    border: 1px solid var(--th-gray-200) !important;
    border-radius: var(--th-input-radius) !important;
    font-size: 0.95rem !important;
    background-color: #ffffff;
}

.select2-container--bootstrap5 .select2-selection--single {
    height: var(--th-input-height) !important;
}

.select2-container--bootstrap5 .select2-selection--multiple {
    height: auto !important;
}

.select2-container--bootstrap5 .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

[data-bs-theme="dark"] .select2-container--bootstrap5 .select2-selection--single,
[data-bs-theme="dark"] .select2-container--bootstrap5 .select2-selection--multiple {
    background-color: var(--th-gray-100) !important;
    border-color: var(--th-gray-200) !important;
}

.select2-container--bootstrap5 .select2-selection--single .select2-selection__rendered {
    line-height: calc(var(--th-input-height) - 14px) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    color: var(--th-gray-800) !important;
    font-size: 0.95rem !important;
}

.select2-container--bootstrap5 .select2-selection--single .select2-selection__arrow {
    height: var(--th-input-height) !important;
    top: 0 !important;
}

.select2-results__option {
    font-size: 0.95rem !important;
}

.select2-container--bootstrap5 .select2-dropdown {
    border: 1px solid #bfdbfe !important;
    border-radius: 8px !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16) !important;
    overflow: hidden;
}

.select2-container--bootstrap5 .select2-results__option {
    padding: 0.7rem 0.95rem !important;
    color: var(--th-gray-700) !important;
    transition: background-color 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
}

.select2-container--bootstrap5 .select2-results__option--highlighted[aria-selected] {
    background: #dbeafe !important;
    color: #1d4ed8 !important;
    padding-left: 1.2rem !important;
}

.select2-container--bootstrap5 .select2-results__option[aria-selected="true"] {
    background: #eff6ff !important;
    color: #1d4ed8 !important;
    font-weight: 700;
}

/* Form Row tighter margins */
.form-compact-row {
    row-gap: 0.75rem;
}

.form-compact-group {
    margin-bottom: 0.85rem !important;
}

/* --------------------------------------------------------------------------
   3.1 Logical Form Sections & Visual Grouping
   -------------------------------------------------------------------------- */
.form-section {
    position: relative;
    background-color: var(--th-gray-50);
    border: 1px solid var(--th-gray-200);
    border-radius: var(--th-card-radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    animation: form-section-enter 0.45s ease both;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.form-section:hover {
    border-color: var(--th-primary-border);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

[data-bs-theme="dark"] .form-section {
    background-color: var(--th-gray-100);
    border-color: var(--th-gray-200);
}

.form-section-clean {
    border-bottom: 1px solid var(--th-gray-200);
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
}

.form-section-header {
    margin-bottom: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.form-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--th-gray-800);
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section-title i {
    color: var(--th-primary);
    font-size: 1.2rem;
}

.form-section-desc {
    font-size: 0.875rem;
    color: var(--th-gray-500);
    margin-top: 0.25rem;
    margin-bottom: 0;
}

/* Logical input widths & max limits */
.form-max-width,
.form-container-constrained {
    max-width: 1100px !important;
}

/* Lease creation keeps the primary form and its actions visually separate. */
.lease-create-layout > .col-lg-8 > .card {
    max-width: none !important;
}

.lease-actions-card {
    position: sticky;
    top: 1.5rem;
}

.lease-actions-card .card-header {
    min-height: auto;
    padding: 1.5rem;
    border-bottom: 1px solid var(--th-gray-200);
}

.lease-actions-card .card-title {
    margin: 0;
    font-size: 1.25rem;
}

.lease-actions-card .card-body {
    padding: 1.5rem;
}

@media (max-width: 991.98px) {
    .lease-actions-card {
        position: static;
    }
}

/* User creation keeps the primary form and its actions visually separate. */
.user-create-layout > .col-lg-9 > .user-form-main > .card {
    max-width: none !important;
}

.user-actions-card {
    position: sticky;
    top: 1.5rem;
    max-width: 260px;
    margin-inline-start: auto;
}

.user-actions-card .card-header {
    min-height: auto;
    padding: 1.5rem;
    border-bottom: 1px solid var(--th-gray-200);
}

.user-actions-card .card-title {
    margin: 0;
    font-size: 1.25rem;
}

.user-actions-card .card-body {
    padding: 1.5rem;
}

/* Property settings sidebar: image sits flush under the heading and is centred. */
.user-actions-card .property-image-field > div {
    margin-bottom: 0 !important;
}

.user-actions-card .property-image-field > div:first-child {
    margin-top: 0 !important;
}

.user-actions-card .property-image-field > div:last-child {
    display: flex;
    justify-content: center;
    margin-top: 0.75rem !important;
}

@media (max-width: 991.98px) {
    .user-actions-card {
        position: static;
        max-width: none;
        margin-inline-start: 0;
    }
}

@media (min-width: 768px) {
    .user-create-layout .user-phone-field .row > .col-md-4 {
        width: 40%;
    }

    .user-create-layout .user-phone-field .row > .col-md-8 {
        width: 60%;
    }
}

.input-width-xs {
    max-width: 180px !important;
}

.input-width-compact,
.form-control-compact {
    max-width: 260px !important;
}

.input-width-medium {
    max-width: 380px !important;
}

/* Rows that open a record on click should say so. */
tr.dt-row-clickable {
    cursor: pointer;
}

/* A deleted row should read as muted, not alarming — it still has a Restore
   button on it, so a solid red block was far louder than the state warrants. */
tr.datatable-row-deleted > td {
    background-color: rgba(var(--bs-danger-rgb), 0.05) !important;
    color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] tr.datatable-row-deleted > td {
    background-color: rgba(var(--bs-danger-rgb), 0.12) !important;
}

/* The country code belongs on the left of the number, in both directions. */
body[dir="rtl"] .phone-input-row > .phone-code-col {
    order: 2;
}

body[dir="rtl"] .phone-input-row > .phone-number-col {
    order: 1;
}

.input-width-large {
    max-width: 520px !important;
}

.input-width-full {
    max-width: 100% !important;
}

.input-width-full .form-compact-group {
    max-width: 100% !important;
}

.owner-lang-tabs .nav-line-tabs {
    justify-content: center;
    gap: 0.75rem;
    border-bottom: none;
    margin-bottom: 1.25rem !important;
}

.owner-lang-tabs .nav-item .nav-link {
    min-width: 7.5rem;
    padding: 0.65rem 1.5rem;
    border: 1px solid var(--th-gray-200) !important;
    border-radius: 999px !important;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--th-gray-600);
    background: #ffffff;
    text-align: center;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.owner-lang-tabs .nav-item .nav-link:hover {
    color: var(--th-primary);
    border-color: var(--th-primary-border) !important;
    background: var(--th-primary-light);
}

.owner-lang-tabs .nav-item .nav-link.active {
    color: #ffffff !important;
    background: var(--th-primary) !important;
    border-color: var(--th-primary) !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
}

[data-bs-theme="dark"] .owner-lang-tabs .nav-item .nav-link {
    background: var(--th-gray-100);
    border-color: var(--th-gray-200) !important;
    color: var(--th-gray-700);
}

[data-bs-theme="dark"] .owner-lang-tabs .nav-item .nav-link.active {
    color: #ffffff !important;
}

/* Ensure form controls do not stretch unboundedly by default in form sections */
.form-section .form-compact-group {
    max-width: 380px;
}

/* The vendor contact phone control should use the full contact column. */
.form-section .vendor-phone-input .form-compact-group {
    max-width: 100%;
}

/* Keep the country-code text clear of Select2's clear (X) button. */
[dir="rtl"] .vendor-phone-input .select2-container--bootstrap5 .select2-selection--single .select2-selection__rendered {
    padding-left: 2rem !important;
    padding-right: 0 !important;
}

[dir="ltr"] .vendor-phone-input .select2-container--bootstrap5 .select2-selection--single .select2-selection__rendered {
    padding-right: 2rem !important;
    padding-left: 0 !important;
}

/* Give the country-code selector enough room for its longer labels. */
@media (min-width: 768px) {
    .vendor-phone-input .row > .col-md-4 {
        width: 50%;
        flex: 0 0 50%;
        max-width: 50%;
    }

    .vendor-phone-input .row > .col-md-8 {
        width: 50%;
        flex: 0 0 50%;
        max-width: 50%;
    }
}

.form-section .form-compact-group.w-sm {
    max-width: 240px;
}

.form-section .form-compact-group.w-md {
    max-width: 340px;
}

.form-section .select2-container {
    max-width: 100% !important;
}

/* Shared create/update form treatment */
.dashboard-form-shell {
    width: 100%;
    max-width: 1180px;
    margin-inline: auto;
}

.dashboard-form-shell > form > .card,
.dashboard-form-shell > form > .card.card-flush {
    max-width: 1100px;
    margin-inline: auto;
}

.dashboard-form-shell .form-compact-group {
    max-width: 380px;
}

.dashboard-form-shell .form-compact-group.w-100 {
    max-width: 100%;
}

.dashboard-form-shell .form-control,
.dashboard-form-shell .form-select,
.dashboard-form-shell .select2-container {
    width: 100%;
}

.unit-select-featured {
    border: 1px solid #b8c8e2 !important;
    background-color: #f8fbff !important;
    background-image: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%), var(--bs-form-select-bg-img);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.07);
    font-weight: 600;
    color: var(--th-gray-700) !important;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.unit-form-grid .form-group {
    height: 100%;
}

.unit-form-grid .form-control,
.unit-form-grid .form-select {
    width: 100%;
}

.unit-select-featured:hover {
    border-color: #60a5fa !important;
    box-shadow: 0 5px 14px rgba(37, 99, 235, 0.14);
    transform: translateY(-1px);
}

.unit-select-featured:focus {
    border-color: #2563eb !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14), 0 6px 16px rgba(37, 99, 235, 0.12) !important;
    transform: translateY(-1px);
}

/* Consistent option styling for the property location and unit selectors */
.property-option-select {
    font-weight: 600;
    color: var(--th-gray-700) !important;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.property-option-select:hover:not(:disabled) {
    border-color: #60a5fa !important;
    background-color: #f8fbff !important;
}

.property-option-select option {
    padding: 0.75rem 1rem;
    background: #ffffff;
    color: #1e293b;
    font-weight: 500;
}

.property-option-select option:checked {
    background: #dbeafe linear-gradient(0deg, #dbeafe 0%, #dbeafe 100%);
    color: #1d4ed8;
    font-weight: 700;
}

[data-bs-theme="dark"] .property-option-select option {
    background: #202c43;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .property-option-select option:checked {
    background: #29466f linear-gradient(0deg, #29466f 0%, #29466f 100%);
    color: #ffffff;
}

[data-bs-theme="dark"] .unit-select-featured {
    border-color: #3b5278 !important;
    background-color: #202c43 !important;
    background-image: linear-gradient(135deg, #263653 0%, #1d2940 100%), var(--bs-form-select-bg-img);
    color: #e2e8f0 !important;
}

@media (prefers-reduced-motion: reduce) {
    .unit-select-featured {
        transition: none;
    }

    .unit-select-featured:hover,
    .unit-select-featured:focus {
        transform: none;
    }
}

@keyframes form-section-enter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .form-section {
        animation: none;
        transition: none;
    }
}

/* --------------------------------------------------------------------------
   4. Tables & Datatables Polish
   -------------------------------------------------------------------------- */
.properties-page-shell {
    max-width: 1180px;
    margin-inline: auto;
}

.properties-page-intro {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1.25rem 1.5rem;
    border-radius: var(--th-card-radius);
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 72%);
    border: 1px solid #dbeafe;
}

.properties-page-intro-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 12px;
    background: #2563eb;
    color: #ffffff;
    font-size: 1.35rem;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.2);
}

.properties-page-intro h2 {
    margin: 0;
    color: var(--th-gray-900);
    font-size: 1.35rem;
    font-weight: 700;
}

.properties-page-intro p {
    margin: 0.25rem 0 0;
    color: var(--th-gray-500);
}

.properties-filter-card,
/* Layout wrapper only — the datatable inside already renders its own card,
   and stacking two of them read as a card inside a card. */
.properties-table-card {
    padding: 0;
}

.properties-filter-card {
    margin-bottom: 1.25rem;
}

.properties-filter-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.25rem 0 0.75rem;
    color: var(--th-gray-800);
    font-size: 0.95rem;
    font-weight: 700;
}

.properties-filter-heading i {
    color: var(--th-primary);
}

.properties-create-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.properties-create-btn:hover,
.properties-create-btn:focus-visible {
    color: #ffffff !important;
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

.properties-create-btn:active {
    transform: translateY(0);
}

.property-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem !important;
    border: 1px solid #f59e0b !important;
    border-radius: 8px !important;
    background: #fffbeb !important;
    color: #b45309 !important;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.12);
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.property-edit-btn:hover,
.property-edit-btn:focus-visible {
    background: #f59e0b !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(245, 158, 11, 0.24);
}

.property-edit-btn:active {
    transform: translateY(0);
}

.owner-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem !important;
    border: 1px solid #f59e0b !important;
    border-radius: 8px !important;
    background: #fffbeb !important;
    color: #b45309 !important;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.12);
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.owner-edit-btn:hover,
.owner-edit-btn:focus-visible {
    background: #f59e0b !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(245, 158, 11, 0.24);
}

.owner-edit-btn:active {
    transform: translateY(0);
}

.tenant-payment-link-btn,
.tenant-copy-payment-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem !important;
    border-radius: 8px !important;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.tenant-payment-link-btn {
    border: 1px solid #0ea5e9 !important;
    background: #f0f9ff !important;
    color: #0369a1 !important;
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.12);
}

.tenant-payment-link-btn:hover,
.tenant-payment-link-btn:focus-visible {
    background: #0ea5e9 !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(14, 165, 233, 0.24);
}

.tenant-copy-payment-link-btn {
    border: 1px solid #6366f1 !important;
    background: #eef2ff !important;
    color: #4338ca !important;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.12);
}

.tenant-copy-payment-link-btn:hover,
.tenant-copy-payment-link-btn:focus-visible {
    background: #6366f1 !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.24);
}

.tenant-payment-link-btn:active,
.tenant-copy-payment-link-btn:active {
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .properties-create-btn,
    .property-edit-btn,
    .owner-edit-btn,
    .tenant-payment-link-btn,
    .tenant-copy-payment-link-btn {
        transition: none;
    }

    .properties-create-btn:hover,
    .properties-create-btn:focus-visible,
    .property-edit-btn:hover,
    .property-edit-btn:focus-visible,
    .owner-edit-btn:hover,
    .owner-edit-btn:focus-visible,
    .tenant-payment-link-btn:hover,
    .tenant-payment-link-btn:focus-visible,
    .tenant-copy-payment-link-btn:hover,
    .tenant-copy-payment-link-btn:focus-visible {
        transform: none;
    }
}

/* Keep the properties listing compact enough to avoid horizontal scrolling. */
.properties-table-card .custom-datatable {
    width: 100% !important;
    table-layout: fixed;
}

.properties-table-card .custom-datatable th,
.properties-table-card .custom-datatable td {
    padding: 0.65rem 0.55rem !important;
    font-size: 0.875rem !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.properties-table-card .custom-datatable th:nth-child(1),
.properties-table-card .custom-datatable td:nth-child(1) { width: 34px !important; }
.properties-table-card .custom-datatable th:nth-child(2),
.properties-table-card .custom-datatable td:nth-child(2) { width: 50px !important; }
.properties-table-card .custom-datatable th:nth-child(3),
.properties-table-card .custom-datatable td:nth-child(3) { width: 21%; }
.properties-table-card .custom-datatable th:nth-child(4),
.properties-table-card .custom-datatable td:nth-child(4) { width: 18%; }
.properties-table-card .custom-datatable th:nth-child(5),
.properties-table-card .custom-datatable td:nth-child(5),
.properties-table-card .custom-datatable th:nth-child(6),
.properties-table-card .custom-datatable td:nth-child(6),
.properties-table-card .custom-datatable th:nth-child(7),
.properties-table-card .custom-datatable td:nth-child(7) { width: 10%; }
.properties-table-card .custom-datatable th:nth-child(8),
.properties-table-card .custom-datatable td:nth-child(8) { width: 12%; }
.properties-table-card .custom-datatable th:nth-child(9),
.properties-table-card .custom-datatable td:nth-child(9) { width: 105px !important; }

.properties-table-card .custom-datatable .datatable-row-actions {
    overflow: visible;
    white-space: normal;
}

.properties-page-shell .properties-table-card .custom-datatable {
    table-layout: auto;
    width: 100% !important;
}

.properties-page-shell .properties-table-card .custom-datatable th,
.properties-page-shell .properties-table-card .custom-datatable td {
    padding: 0.65rem 0.75rem !important;
    font-size: 0.875rem !important;
    vertical-align: middle !important;
}

.properties-page-shell .properties-table-card .custom-datatable th:nth-child(1),
.properties-page-shell .properties-table-card .custom-datatable td:nth-child(1) {
    width: 42px;
    padding-inline: 0.35rem !important;
}

.properties-page-shell .properties-table-card .custom-datatable th:nth-child(2),
.properties-page-shell .properties-table-card .custom-datatable td:nth-child(2) {
    width: 56px;
    padding-inline: 0.45rem !important;
    white-space: nowrap;
}

.properties-page-shell .properties-table-card .custom-datatable th:nth-child(4),
.properties-page-shell .properties-table-card .custom-datatable td:nth-child(4) {
    width: 150px !important;
    max-width: 150px !important;
}

.properties-page-shell .properties-table-card .custom-datatable th:nth-child(3),
.properties-page-shell .properties-table-card .custom-datatable td:nth-child(3),
.properties-page-shell .properties-table-card .custom-datatable th:nth-child(5),
.properties-page-shell .properties-table-card .custom-datatable td:nth-child(5),
.properties-page-shell .properties-table-card .custom-datatable th:nth-child(6),
.properties-page-shell .properties-table-card .custom-datatable td:nth-child(6),
.properties-page-shell .properties-table-card .custom-datatable th:nth-child(7),
.properties-page-shell .properties-table-card .custom-datatable td:nth-child(7) {
    width: auto !important;
    max-width: none !important;
}

.properties-page-shell .properties-table-card .custom-datatable .properties-title-col {
    min-width: 120px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.properties-page-shell .properties-table-card .custom-datatable .properties-address-col {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    white-space: normal !important;
    overflow: hidden !important;
    word-break: break-word;
    line-height: 1.35 !important;
    font-size: 0.8125rem !important;
    vertical-align: middle !important;
}

.properties-page-shell .properties-table-card .custom-datatable td.properties-address-col {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.properties-page-shell .properties-table-card .custom-datatable .properties-units-col,
.properties-page-shell .properties-table-card .custom-datatable .properties-rented-col,
.properties-page-shell .properties-table-card .custom-datatable .properties-available-col {
    width: 1%;
    white-space: nowrap !important;
    text-align: center !important;
}

.properties-page-shell .properties-table-card .custom-datatable th:nth-child(8),
.properties-page-shell .properties-table-card .custom-datatable td:nth-child(8) {
    width: 1%;
    white-space: nowrap !important;
}

.properties-page-shell .properties-table-card .custom-datatable .properties-options-col {
    width: 1%;
    white-space: nowrap !important;
    overflow: visible !important;
}

.properties-page-shell .properties-table-card .custom-datatable .properties-options-col .datatable-row-actions {
    flex-wrap: nowrap !important;
    justify-content: center !important;
    gap: 0.25rem !important;
}

.property-show-shell,
.property-show-filters,
.property-units-table {
    max-width: 1180px;
    margin-inline: auto;
}

.property-overview-card {
    overflow: hidden;
    border-top: 3px solid var(--th-primary) !important;
}

.property-show-heading {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--th-gray-200);
}

.property-show-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
    border-radius: 14px;
    background: var(--th-primary-light);
    color: var(--th-primary);
    font-size: 1.45rem;
}

.property-show-kicker {
    color: var(--th-primary);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.property-show-heading h2 {
    margin: 0.15rem 0 0;
    color: var(--th-gray-900);
    font-size: 1.45rem;
    font-weight: 700;
}

.property-show-heading p {
    margin: 0.25rem 0 0;
    color: var(--th-gray-500);
}

.property-show-shell .separator {
    border-color: var(--th-gray-200) !important;
}

.property-units-table {
    margin-top: 1.25rem;
}

.property-units-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding: 0 0.25rem;
}

.property-units-heading h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    color: var(--th-gray-900);
    font-size: 1.15rem;
    font-weight: 700;
}

.property-units-heading h3 i {
    color: var(--th-primary);
}

.property-units-heading p {
    margin: 0.25rem 0 0;
    color: var(--th-gray-500);
    font-size: 0.875rem;
}

.badge.property-tenant-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.4rem 0.35rem !important;
    border-radius: 999px !important;
    font-weight: 600 !important;
    text-align: center;
    white-space: nowrap;
}

.unit-create-shell {
    max-width: 1180px;
    margin-inline: auto;
}

.unit-create-intro {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid #dbeafe;
    border-radius: var(--th-card-radius);
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 72%);
}

.unit-create-intro-icon {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    flex: 0 0 auto;
    border-radius: 13px;
    background: #2563eb;
    color: #ffffff;
    font-size: 1.35rem;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.2);
}

.unit-create-kicker {
    color: var(--th-primary);
    font-size: 0.8rem;
    font-weight: 700;
}

.unit-create-intro h2 {
    margin: 0.15rem 0 0;
    color: var(--th-gray-900);
    font-size: 1.35rem;
    font-weight: 700;
}

.unit-create-intro p {
    margin: 0.25rem 0 0;
    color: var(--th-gray-500);
}

[data-bs-theme="dark"] .unit-create-intro {
    border-color: #2b3852;
    background: linear-gradient(135deg, #1b2d4b 0%, #1e1e2d 72%);
}

@media (max-width: 767.98px) {
    .unit-create-intro { padding: 1rem; }
    .unit-create-intro p { font-size: 0.875rem; }
}

.unit-types-page-shell .properties-table-card .custom-datatable th,
.unit-types-page-shell .properties-table-card .custom-datatable td {
    padding: 0.7rem 0.75rem !important;
}

.unit-types-page-shell .properties-table-card .custom-datatable {
    table-layout: fixed;
    width: 100% !important;
    /* The date and options columns hold hard widths, so on a narrow screen the
       auto-width name columns were the ones squeezed — down to nothing, taking
       the actual data with them. Keep the table wide enough for every column and
       let the .table-responsive wrapper scroll instead. */
    min-width: 720px;
}

.unit-types-page-shell .properties-table-card .custom-datatable th:nth-child(1),
.unit-types-page-shell .properties-table-card .custom-datatable td:nth-child(1) {
    width: 42px !important;
    max-width: 42px !important;
    padding-inline: 0.35rem !important;
}

.unit-types-page-shell .properties-table-card .custom-datatable th:nth-child(2),
.unit-types-page-shell .properties-table-card .custom-datatable td:nth-child(2) {
    width: 56px !important;
    max-width: 56px !important;
}

.unit-types-page-shell .properties-table-card .custom-datatable th:nth-child(3),
.unit-types-page-shell .properties-table-card .custom-datatable td:nth-child(3),
.unit-types-page-shell .properties-table-card .custom-datatable th:nth-child(4),
.unit-types-page-shell .properties-table-card .custom-datatable td:nth-child(4) {
    width: auto !important;
}

.unit-types-page-shell .properties-table-card .custom-datatable th:nth-child(5),
.unit-types-page-shell .properties-table-card .custom-datatable td:nth-child(5) {
    width: 170px !important;
    max-width: 170px !important;
}

.unit-types-page-shell .properties-table-card .custom-datatable th:nth-child(6),
.unit-types-page-shell .properties-table-card .custom-datatable td:nth-child(6) {
    width: 190px !important;
    max-width: 190px !important;
}

.unit-types-page-shell .properties-table-card .custom-datatable .unit-types-id-col {
    width: 56px !important;
    max-width: 56px !important;
    padding-inline: 0.35rem !important;
    white-space: nowrap !important;
}

.unit-types-page-shell .properties-table-card .custom-datatable .unit-types-name-col {
    width: auto !important;
    min-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.unit-types-page-shell .properties-table-card .custom-datatable .unit-types-date-col {
    width: 170px !important;
    min-width: 170px !important;
    max-width: 170px !important;
    white-space: nowrap !important;
}

.unit-types-page-shell .properties-table-card .custom-datatable .unit-types-options-col {
    width: 190px !important;
    min-width: 190px !important;
    max-width: 190px !important;
    padding-inline: 0.45rem !important;
}

.unit-types-page-shell .properties-table-card .custom-datatable .unit-types-options-col .datatable-row-actions {
    flex-wrap: nowrap !important;
    justify-content: center !important;
}

.unit-types-page-shell .properties-table-card .custom-datatable .unit-types-options-col .datatable-row-actions .btn {
    padding-inline: 0.55rem !important;
}

[data-bs-theme="dark"] .properties-page-intro {
    background: linear-gradient(135deg, #1b2d4b 0%, #1e1e2d 72%);
    border-color: #2b3852;
}

@media (max-width: 767.98px) {
    .properties-page-intro { padding: 1rem; }
    .properties-page-intro p { font-size: 0.875rem; }
}

.card .table-responsive {
    border-radius: 0 0 var(--th-card-radius) var(--th-card-radius);
}

#kt_app_body .table {
    margin-bottom: 0;
    vertical-align: middle;
}

#kt_app_body .table thead th {
    text-transform: uppercase !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    letter-spacing: 0.04em !important;
    color: var(--th-gray-600) !important;
    background-color: var(--th-gray-50) !important;
    border-bottom: 1px solid var(--th-gray-200) !important;
    padding: 0.85rem 1rem !important;
    white-space: nowrap;
}

[data-bs-theme="dark"] #kt_app_body .table thead th {
    background-color: #1b1b28 !important;
    border-bottom-color: var(--th-gray-200) !important;
    color: var(--th-gray-400) !important;
}

#kt_app_body .table tbody td {
    padding: 0.85rem 1rem !important;
    font-size: 0.95rem !important;
    color: var(--th-gray-800) !important;
    border-bottom: 1px solid var(--th-gray-100) !important;
    transition: background-color 0.15s ease;
}

[data-bs-theme="dark"] #kt_app_body .table tbody td {
    border-bottom-color: var(--th-gray-200) !important;
    color: var(--th-gray-800) !important;
}

/* Restrained, elegant row hover */
.custom-datatable tbody tr:hover td,
#kt_app_body .table-hover tbody tr:hover td {
    background-color: #f8fafc !important;
    color: var(--th-gray-900) !important;
}

[data-bs-theme="dark"] .custom-datatable tbody tr:hover td,
[data-bs-theme="dark"] #kt_app_body .table-hover tbody tr:hover td {
    background-color: #232336 !important;
    color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   5. Executive Cards & Metrics
   -------------------------------------------------------------------------- */
.card {
    border: 1px solid var(--th-card-border) !important;
    box-shadow: var(--th-card-shadow) !important;
    border-radius: var(--th-card-radius) !important;
    background-color: var(--th-card-bg) !important;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.kpi-metric-card {
    position: relative;
    padding: 1.25rem 1.5rem;
    border-radius: var(--th-card-radius);
    border: 1px solid var(--th-card-border);
    background: var(--th-card-bg);
    box-shadow: var(--th-card-shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.08);
}

.kpi-metric-card .kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.kpi-metric-card .kpi-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--th-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0;
}

.kpi-metric-card .kpi-icon-badge {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.kpi-metric-card .kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--th-gray-900);
    line-height: 1.2;
    margin: 0;
}

.kpi-metric-card .kpi-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--th-gray-500);
}

/* Metric Colors */
.kpi-icon-primary { background-color: var(--th-primary-light); color: var(--th-primary); }
.kpi-icon-success { background-color: var(--th-success-light); color: var(--th-success); }
.kpi-icon-warning { background-color: var(--th-warning-light); color: var(--th-warning); }
.kpi-icon-info { background-color: var(--th-info-light); color: var(--th-info); }
.kpi-icon-danger { background-color: var(--th-danger-light); color: var(--th-danger); }

/* --------------------------------------------------------------------------
   6. Sidebar Navigation Polish
   -------------------------------------------------------------------------- */
/* Keep the sidebar compact while preserving the layout's linked offsets. */
@media (min-width: 992px) {
    :root {
        --bs-app-sidebar-width: 220px;
        --bs-app-sidebar-width-actual: 220px;
    }
}

@media (max-width: 991.98px) {
    :root {
        --bs-app-sidebar-width: 220px;
        --bs-app-sidebar-width-actual: 220px;
    }
}

.app-sidebar {
    background: #172033 !important;
    border-right: 1px solid #2b3852;
    box-shadow: 8px 0 24px rgba(15, 23, 42, 0.08);
}

[dir="rtl"] .app-sidebar {
    border-right: none;
    border-left: 1px solid #2b3852;
    box-shadow: -8px 0 24px rgba(15, 23, 42, 0.08);
}

.app-sidebar .app-sidebar-logo {
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.app-sidebar .menu-link {
    padding: 0.55rem 0.85rem !important;
    border-radius: 6px !important;
    margin-bottom: 2px;
    color: #cbd5e1 !important;
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.app-sidebar .menu-sub .menu-link {
    font-size: 0.8125rem !important;
    padding-left: 1.75rem !important;
}

[dir="rtl"] .app-sidebar .menu-sub .menu-link {
    padding-left: 0.85rem !important;
    padding-right: 1.75rem !important;
}

/* Expanded accordion headers — open, but not the current page */
.app-sidebar .menu-accordion.show > .menu-link {
    background: transparent !important;
    color: #e2e8f0 !important;
    font-weight: 600 !important;
    box-shadow: none !important;
    transform: none !important;
}

.app-sidebar .menu-accordion.show > .menu-link .menu-icon i {
    color: #94a3b8 !important;
}

/* Parent group when it contains the active page */
.app-sidebar .menu-accordion:has(.menu-link.active) > .menu-link {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #f8fafc !important;
    box-shadow: none !important;
}

.app-sidebar .menu-accordion:has(.menu-link.active) > .menu-link .menu-icon i {
    color: #93c5fd !important;
}

.app-sidebar .menu-link:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.06) !important;
    color: #f1f5f9 !important;
    transform: translateX(4px);
}

.app-sidebar .menu-accordion.show > .menu-link:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.06) !important;
    transform: none;
}

/* Current page — clear, focused highlight */
.app-sidebar .menu-link.active {
    background: rgba(37, 99, 235, 0.24) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: inset 3px 0 0 #60a5fa !important;
}

.app-sidebar .menu-sub .menu-link.active {
    background: rgba(37, 99, 235, 0.2) !important;
    box-shadow: inset 3px 0 0 #3b82f6 !important;
}

.app-sidebar .menu-link:hover .menu-icon i,
.app-sidebar .menu-link:hover .menu-title {
    color: inherit !important;
}

.app-sidebar .menu-link.active .menu-icon i {
    color: #93c5fd !important;
}

.app-sidebar .menu-link.active .menu-title,
.app-sidebar .menu-link.active .menu-title strong {
    color: #ffffff !important;
    font-weight: 600 !important;
}

[dir="rtl"] .app-sidebar .menu-link:hover:not(.active) {
    transform: translateX(-4px);
}

[dir="rtl"] .app-sidebar .menu-link.active,
[dir="rtl"] .app-sidebar .menu-sub .menu-link.active {
    box-shadow: inset -3px 0 0 #3b82f6 !important;
}

@media (prefers-reduced-motion: reduce) {
    .app-sidebar .menu-link {
        transition: none;
    }

    .app-sidebar .menu-link:hover {
        transform: none;
    }
}

.app-sidebar-section-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    padding: 0.65rem 0.85rem 0.2rem 0.85rem;
}

/* --------------------------------------------------------------------------
   7. Buttons & Badges
   -------------------------------------------------------------------------- */
.btn {
    border-radius: var(--th-input-radius) !important;
    font-weight: 600 !important;
    font-size: 0.9375rem !important;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, transform 0.15s ease-in-out;
}

/* Normalize text/icon buttons across the dashboard */
.btn:not(.btn-link):not(.btn-icon):not(.btn-flush):not(.btn-circle) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    line-height: 1.25;
}

.btn:not(.btn-link):not(.btn-icon):not(.btn-flush):not(.btn-circle):not(.btn-sm):not(.btn-lg) {
    min-height: var(--th-input-height);
    height: auto;
    padding: 0.45rem 1rem;
}

.btn-sm:not(.btn-link):not(.btn-icon):not(.btn-flush):not(.btn-circle) {
    min-height: 34px !important;
    height: auto !important;
    padding: 0.375rem 0.85rem !important;
    font-size: 0.875rem !important;
}

.btn-lg:not(.btn-link):not(.btn-icon):not(.btn-flush):not(.btn-circle) {
    min-height: 44px !important;
    height: auto !important;
    padding: 0.5rem 1.25rem !important;
    font-size: 1rem !important;
}

/* Metronic adds left padding on icons; flex gap handles spacing instead */
.btn:not(.btn-icon) > i,
.btn:not(.btn-icon) > .svg-icon {
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1;
    flex-shrink: 0;
}

.btn .indicator-label,
.btn .indicator-progress {
    align-items: center;
    gap: 0.375rem;
    line-height: 1.25;
}

.btn .indicator-label {
    display: inline-flex;
}

.btn .indicator-progress {
    display: none;
}

.btn[data-kt-indicator="on"] > .indicator-label {
    display: none;
}

.btn[data-kt-indicator="on"] > .indicator-progress {
    display: inline-flex;
}

.badge {
    border-radius: 4px !important;
    font-weight: 600 !important;
    font-size: 0.8125rem !important;
    padding: 0.35em 0.7em !important;
    letter-spacing: 0.02em;
}

/* --------------------------------------------------------------------------
   8. Modal Polish
   -------------------------------------------------------------------------- */
.modal-content {
    border: 1px solid var(--th-card-border);
    border-radius: var(--th-card-radius);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    border-bottom: 1px solid var(--th-gray-100);
    padding: 1rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--th-gray-100);
    padding: 0.85rem 1.5rem;
}

#expense_type_modal .expense-type-name-field .form-compact-group,
#expense_type_modal .expense-type-name-field .form-control {
    max-width: 140px !important;
    width: 100%;
}

/* --------------------------------------------------------------------------
   9. Backward compatibility hooks
   -------------------------------------------------------------------------- */
.image-input-placeholder {
    background-image: url('/admin/assets/media/svg/avatars/blank.svg') !important;
}

.image-input-id-card-placeholder {
    background-image: none !important;
}

.image-input-id-card .image-input-id-card-wrapper {
    width: 175px;
    height: 110px;
    border-radius: 0.475rem;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.image-input-id-card.image-input-empty .image-input-id-card-wrapper {
    background-image: url('/admin/assets/media/svg/files/blank-image.svg');
    background-size: contain;
    background-color: var(--bs-gray-100);
}

[data-bs-theme="dark"] .image-input-placeholder {
    background-image: url('/admin/assets/media/svg/avatars/blank-dark.svg');
}

[data-bs-theme="dark"] .image-input-id-card-placeholder {
    background-image: none !important;
}

[data-bs-theme="dark"] .image-input-id-card.image-input-empty .image-input-id-card-wrapper {
    background-image: url('/admin/assets/media/svg/files/blank-image-dark.svg');
    background-color: #1e2129;
}

.remove-xmark {
    color: var(--th-danger) !important;
    cursor: pointer !important;
    font-size: 1.25rem !important;
}

.add-new-plus {
    border: 1px solid var(--th-primary-border);
    background-color: var(--th-primary-light);
    border-radius: 6px;
    padding: 3px 6px;
    color: var(--th-primary) !important;
    cursor: pointer;
    margin: 0px 4px;
    font-size: 0.875rem;
}

.custom-datatable .datatable-row-actions {
    align-items: center;
    flex-wrap: nowrap !important;
    justify-content: center !important;
}

.custom-datatable .datatable-row-actions .btn {
    white-space: nowrap;
    margin: 0 !important;
}

.custom-datatable td.text-center,
.custom-datatable th.text-center {
    vertical-align: middle;
}

.leases-page-shell .btn.btn-light-orange {
    color: #c45100 !important;
    background-color: #ffd4a8 !important;
    border-color: #ffb366 !important;
}

.btn.btn-orange {
    color: #ffffff !important;
    background-color: #ff7700 !important;
    border-color: #ff7700 !important;
}

.btn.btn-orange:hover,
.btn.btn-orange:focus,
.btn.btn-orange:active {
    color: #ffffff !important;
    background-color: #e66a00 !important;
    border-color: #e66a00 !important;
}

.leases-page-shell .btn.btn-light-orange:hover,
.leases-page-shell .btn.btn-light-orange:focus,
.leases-page-shell .btn.btn-light-orange.active {
    color: #ffffff !important;
    background-color: #ff7700 !important;
    border-color: #ff7700 !important;
}

.leases-page-shell .custom-datatable.table-striped > tbody > tr.lease-expiring-soon > * {
    background-color: #ff922b !important;
    --bs-table-bg-type: #ff922b;
    --bs-table-striped-bg: #ff922b;
    --bs-table-hover-bg: #ff7700;
    color: #1a1208 !important;
}

.leases-page-shell .custom-datatable.table-striped > tbody > tr.lease-expiring-soon:hover > * {
    background-color: #ff7700 !important;
    color: #1a1208 !important;
}

[data-bs-theme="dark"] .leases-page-shell .custom-datatable.table-striped > tbody > tr.lease-expiring-soon > * {
    background-color: rgba(255, 122, 0, 0.42) !important;
    --bs-table-bg-type: rgba(255, 122, 0, 0.42);
    --bs-table-striped-bg: rgba(255, 122, 0, 0.42);
    color: #fff7ed !important;
}

[data-bs-theme="dark"] .leases-page-shell .custom-datatable.table-striped > tbody > tr.lease-expiring-soon:hover > * {
    background-color: rgba(255, 122, 0, 0.58) !important;
    color: #fff7ed !important;
}

/* Datatable filter action buttons */
.datatable-filter-actions-col {
    padding-top: 2rem;
}

.datatable-filter-actions {
    flex-wrap: nowrap;
}

.datatable-filter-actions .datatable-filter-btn,
#filter-form #submit-filters,
#filter-form #reset-filters {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.375rem !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
}

.datatable-filter-actions .datatable-filter-btn i,
#filter-form #submit-filters i,
#filter-form #reset-filters i {
    margin: 0 !important;
    line-height: 1 !important;
    flex-shrink: 0;
}

.datatable-filter-actions .datatable-filter-btn span,
#filter-form #submit-filters span,
#filter-form #reset-filters span {
    line-height: 1.2 !important;
}

/* Datatable card search */
.datatable-search {
    position: relative;
    width: 250px;
    max-width: 100%;
}

.datatable-search-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    inset-inline-start: 1rem;
    font-size: 1.125rem;
    line-height: 1;
    color: var(--th-gray-500);
    pointer-events: none;
    z-index: 1;
}

.datatable-search-input {
    width: 100%;
    padding-inline-start: 2.75rem !important;
    padding-inline-end: 1rem !important;
}

/* Hide duplicate DataTables search when card header search exists */
.card:has([data-kt-docs-table-filter="search"]) div.dt-container div.dt-search {
    display: none !important;
}

/* Datatable footer toolbar — page length, info, and pagination alignment */
div.dt-container .dt-toolbar {
    gap: 0.75rem 1.25rem;
    flex-wrap: wrap;
}

div.dt-container .dt-toolbar > div:first-child {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

div.dt-container .dt-toolbar > div:first-child label {
    margin: 0;
    white-space: nowrap;
    line-height: 1.4;
    font-weight: 500;
    color: var(--th-gray-600);
}

div.dt-container .dt-toolbar > div:first-child select,
div.dt-container .dt-toolbar .form-select {
    width: auto !important;
    min-width: 4.75rem;
    height: var(--th-input-height) !important;
    min-height: var(--th-input-height) !important;
    margin: 0 !important;
    padding-top: 0.3rem !important;
    padding-bottom: 0.3rem !important;
    padding-inline-start: 0.75rem !important;
    padding-inline-end: 2rem !important;
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
    border: 1px solid var(--th-gray-200) !important;
    border-radius: var(--th-input-radius) !important;
}

[dir="rtl"] div.dt-container .dt-toolbar > div:first-child select,
[dir="rtl"] div.dt-container .dt-toolbar .form-select {
    background-position: left 0.65rem center;
}

div.dt-container .dt-toolbar .dt-info {
    padding-top: 0 !important;
    margin: 0 !important;
    display: inline-flex;
    align-items: center;
    line-height: 1.4;
    font-weight: 500;
    color: var(--th-gray-600);
}

div.dt-container .dt-paging {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    display: flex;
    align-items: center;
}

div.dt-container .dt-paging .pagination {
    margin: 0 !important;
    align-items: center;
}

div.dt-container > .row:last-child {
    align-items: center;
}

/* Per-page length dropdown (legacy dt-length wrapper) */
div.dt-container div.dt-length {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

div.dt-container div.dt-length label {
    margin: 0;
    white-space: nowrap;
    font-weight: 500;
    color: var(--th-gray-600);
}

div.dt-container div.dt-length select {
    width: auto !important;
    min-width: 4.75rem;
    height: var(--th-input-height) !important;
    min-height: var(--th-input-height) !important;
    padding-top: 0.3rem !important;
    padding-bottom: 0.3rem !important;
    padding-inline-start: 0.75rem !important;
    padding-inline-end: 2rem !important;
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
    border: 1px solid var(--th-gray-200) !important;
    border-radius: var(--th-input-radius) !important;
    background-color: #ffffff;
    background-image: var(--bs-form-select-bg-img);
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 14px 10px;
    appearance: none;
    -webkit-appearance: none;
    margin: 0 !important;
}

[dir="rtl"] div.dt-container div.dt-length select {
    background-position: left 0.65rem center;
}

[data-bs-theme="dark"] div.dt-container div.dt-length select,
[data-bs-theme="dark"] div.dt-container .dt-toolbar .form-select {
    background-color: var(--th-gray-100) !important;
    border-color: var(--th-gray-200) !important;
    color: var(--th-gray-800) !important;
}

.dashboard-development-banner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid #f1c40f;
    border-radius: 0.375rem;
    background-color: #fff3cd;
    color: #664d03;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.dashboard-development-banner__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #664d03;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.dashboard-development-banner__close:hover,
.dashboard-development-banner__close:focus-visible {
    background-color: rgba(102, 77, 3, 0.12);
}

/* --------------------------------------------------------------------------
   10. Dashboard Navbar & Light Workspace Background
   -------------------------------------------------------------------------- */
.dashboard-navbar {
    background: rgba(255, 255, 255, 0.88) !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 8px 28px rgba(30, 64, 175, 0.08);
    backdrop-filter: blur(14px);
}

.dashboard-navbar .app-navbar-item {
    position: relative;
    display: flex;
    align-items: center;
    overflow: visible;
}

.dashboard-navbar #kt_auth_lang_menu,
.dashboard-navbar [data-kt-element="theme-mode-menu"],
.dashboard-navbar #kt_header_user_menu_toggle .menu-sub-dropdown {
    z-index: 110;
}

.dashboard-navbar,
.dashboard-navbar .app-container,
.dashboard-navbar .app-navbar {
    overflow: visible !important;
}

.dashboard-navbar .btn-link,
.dashboard-navbar .btn-custom {
    min-height: 40px;
    padding: 0.45rem 0.75rem;
    border-radius: 10px;
    color: var(--th-gray-600) !important;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.dashboard-navbar .btn-link:hover,
.dashboard-navbar .btn-custom:hover {
    background: var(--th-primary-light);
    color: var(--th-primary) !important;
}

.dashboard-navbar .dashboard-development-banner {
    border-color: #f1c40f;
    background: #fff3cd;
    color: #664d03;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(102, 77, 3, 0.08);
}

[data-bs-theme="dark"] .dashboard-navbar {
    background: rgba(26, 26, 39, 0.92) !important;
    border-bottom: 1px solid var(--th-gray-200);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

[data-bs-theme="dark"] .dashboard-navbar .btn-link,
[data-bs-theme="dark"] .dashboard-navbar .btn-custom {
    color: var(--th-gray-700) !important;
}

[data-bs-theme="dark"] .dashboard-navbar .btn-link:hover,
[data-bs-theme="dark"] .dashboard-navbar .btn-custom:hover {
    background: var(--th-primary-light);
    color: var(--th-primary) !important;
}

[data-bs-theme="dark"] .dashboard-navbar .btn-color-gray-700 {
    color: var(--th-gray-700) !important;
}

[data-bs-theme="dark"] .dashboard-navbar .btn-icon-muted {
    color: var(--th-gray-400) !important;
}

[data-bs-theme="dark"] .dashboard-navbar .btn-icon-muted:hover,
[data-bs-theme="dark"] .dashboard-navbar .btn-icon-muted:focus,
[data-bs-theme="dark"] .dashboard-navbar .btn-icon-muted.active {
    color: var(--th-primary) !important;
}

[data-bs-theme="dark"] .dashboard-development-banner,
[data-bs-theme="dark"] .dashboard-navbar .dashboard-development-banner {
    border-color: #ca8a04;
    background: rgba(234, 179, 8, 0.14);
    color: #fde68a;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

[data-bs-theme="dark"] .dashboard-development-banner__close {
    color: #fde68a;
}

[data-bs-theme="dark"] .dashboard-development-banner__close:hover,
[data-bs-theme="dark"] .dashboard-development-banner__close:focus-visible {
    background-color: rgba(253, 230, 138, 0.12);
}

#kt_app_main,
#kt_app_content {
    background:
        radial-gradient(circle at 90% 0%, rgba(147, 197, 253, 0.07), transparent 23rem),
        linear-gradient(135deg, #fcfdff 0%, #f5f8fc 100%);
}

[data-bs-theme="dark"] #kt_app_main,
[data-bs-theme="dark"] #kt_app_content {
    background: var(--th-gray-50);
}

@media (max-width: 767.98px) {
    .dashboard-development-banner {
        max-width: 190px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* --------------------------------------------------------------------------
   11. Global Date Picker (Flatpickr wrap)
   -------------------------------------------------------------------------- */
.th-date-picker-wrap .th-date-picker-input {
    cursor: pointer;
    background-color: #ffffff;
}

.th-date-picker-wrap .th-date-picker-input:focus {
    cursor: pointer;
}

[data-bs-theme="dark"] .th-date-picker-wrap .th-date-picker-input {
    background-color: var(--th-gray-100) !important;
}

/* --------------------------------------------------------------------------
   12. Global File Upload
   -------------------------------------------------------------------------- */
.th-file-upload-zone {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 148px;
    padding: 1.25rem 1.5rem;
    border: 1.5px dashed var(--th-gray-300);
    border-radius: calc(var(--th-input-radius) + 2px);
    background: linear-gradient(180deg, #ffffff 0%, var(--th-gray-50) 100%);
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    overflow: hidden;
}

.th-file-upload-zone:hover,
.th-file-upload-zone:focus {
    border-color: var(--th-primary-border);
    background: var(--th-primary-light);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
    outline: none;
}

.th-file-upload-zone.is-dragover {
    border-color: var(--th-primary);
    background: var(--th-primary-light);
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.12);
}

.th-file-upload-zone.has-file {
    min-height: 92px;
    border-style: solid;
    border-color: var(--th-primary-border);
    background: #ffffff;
}

.th-file-upload-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.th-file-upload-placeholder,
.th-file-upload-selected {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    pointer-events: none;
}

.th-file-upload-placeholder {
    flex-direction: column;
    text-align: center;
}

.th-file-upload-zone.has-file .th-file-upload-placeholder {
    display: none !important;
}

.th-file-upload-icon,
.th-file-upload-selected-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
}

.th-file-upload-copy,
.th-file-upload-selected-copy {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    flex: 1;
}

.th-file-upload-title,
.th-file-upload-selected-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--th-gray-800);
}

.th-file-upload-hint,
.th-file-upload-filename {
    font-size: 0.85rem;
    color: var(--th-gray-500);
    word-break: break-word;
}

.th-file-upload-browse,
.th-file-upload-clear {
    pointer-events: auto;
}

.th-file-upload-selected {
    justify-content: space-between;
}

.th-file-upload-existing {
    margin-bottom: 0.75rem;
}

.th-file-upload-existing-link {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--th-primary-border);
    border-radius: var(--th-input-radius);
    background: var(--th-primary-light);
    color: var(--th-primary);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.th-file-upload-existing-link:hover {
    background: #dbeafe;
    color: var(--th-primary-hover);
}

[data-bs-theme="dark"] .th-file-upload-zone {
    background: linear-gradient(180deg, var(--th-gray-100) 0%, var(--th-gray-50) 100%);
    border-color: var(--th-gray-200);
}

[data-bs-theme="dark"] .th-file-upload-zone.has-file {
    background: var(--th-gray-100);
}

/* --------------------------------------------------------------------------
   Admin Auth — Sign In
   -------------------------------------------------------------------------- */
.th-auth-page {
    min-height: 100vh;
    margin: 0;
    background: #eef2f7;
    color: var(--th-gray-900);
    font-family: var(--th-font-sans);
    -webkit-font-smoothing: antialiased;
}

.th-auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.th-auth-card {
    width: 100%;
    max-width: 340px;
    background: #ffffff;
    border: 1px solid #e8edf3;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
    padding: 1.75rem 1.65rem 1.5rem;
}

.th-auth-brand {
    text-align: center;
    margin-bottom: 1.15rem;
}

.th-auth-brand-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.th-auth-logo {
    max-width: 130px;
    max-height: 44px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.th-auth-title {
    margin: 0 0 1.25rem;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    color: var(--th-gray-900);
    letter-spacing: -0.02em;
}

.th-auth-subtitle {
    margin: -0.75rem 0 1.15rem;
    font-size: 0.875rem;
    line-height: 1.5;
    text-align: center;
    color: var(--th-gray-500);
}

.th-auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.th-auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.th-auth-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.th-auth-label {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--th-gray-800);
}

.th-auth-required {
    color: #ef4444;
    margin-inline-start: 0.1rem;
}

.th-auth-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--th-primary);
    text-decoration: none;
    white-space: nowrap;
}

.th-auth-link:hover {
    color: var(--th-primary-hover);
    text-decoration: underline;
}

.th-auth-input {
    width: 100%;
    height: 34px;
    padding: 0 0.65rem;
    border: 1px solid #d8dee8;
    border-radius: 6px;
    background: #ffffff;
    color: var(--th-gray-900);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.th-auth-input:focus {
    outline: none;
    border-color: var(--th-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.th-auth-input.is-invalid {
    border-color: #ef4444;
}

.th-auth-password-wrap {
    position: relative;
}

.th-auth-password-wrap .th-auth-input {
    padding-inline-end: 2.35rem;
}

.th-auth-password-toggle {
    position: absolute;
    top: 50%;
    inset-inline-end: 0.45rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--th-gray-400);
    cursor: pointer;
    border-radius: 6px;
}

.th-auth-password-toggle:hover {
    color: var(--th-gray-600);
    background: var(--th-gray-100);
}

.th-auth-password-toggle i {
    font-size: 0.95rem;
    line-height: 1;
}

.th-auth-remember {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0.15rem 0 0.35rem;
    font-size: 0.9rem;
    color: var(--th-gray-700);
    cursor: pointer;
    user-select: none;
}

.th-auth-remember input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--th-primary);
    cursor: pointer;
}

.th-auth-submit {
    width: 100%;
    height: 36px;
    margin-top: 0.15rem;
    border: 0;
    border-radius: 6px;
    background: var(--th-primary);
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.th-auth-submit:hover:not(:disabled) {
    background: var(--th-primary-hover);
}

.th-auth-submit:active:not(:disabled) {
    transform: translateY(1px);
}

.th-auth-submit:disabled {
    opacity: 0.85;
    cursor: wait;
}

.th-auth-error {
    font-size: 0.82rem;
    color: #ef4444;
}

.th-auth-success {
    margin-bottom: 1rem;
    padding: 0.65rem 0.75rem;
    border-radius: 6px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    font-size: 0.82rem;
    color: #047857;
    text-align: center;
}

.th-auth-footer-link {
    display: flex;
    justify-content: center;
    margin-top: 0.85rem;
}

.th-auth-lang {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.15rem;
    padding-top: 1rem;
    border-top: 1px solid #eef2f7;
}

.th-auth-lang-link {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--th-gray-500);
    text-decoration: none;
}

.th-auth-lang-link:hover {
    color: var(--th-primary);
}

@media (max-width: 480px) {
    .th-auth-card {
        max-width: 320px;
        padding: 1.5rem 1.25rem 1.35rem;
        border-radius: 9px;
    }

    .th-auth-title {
        font-size: 1.1rem;
    }
}

