:root {
    --rp-primary: #2563eb;
    --rp-primary-dark: #1d4ed8;
    --rp-accent: #f97316;
    --rp-danger: #dc2626;
    --rp-success: #16a34a;
    --rp-ink: #0f172a;
    --rp-muted: #64748b;
    --rp-line: #e2e8f0;
    --rp-soft: #f8fafc;
    --rp-panel: #ffffff;
}

body {
    color: var(--rp-ink);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(180deg, rgba(37, 99, 235, .06), rgba(248, 250, 252, 0) 260px),
        #f6f8fb;
}

.app-header {
    min-height: 68px;
    border-bottom: 1px solid rgba(226, 232, 240, .85);
}

.app-sidebar {
    border-right: 0;
}

.sidebar-brand {
    min-height: 68px;
}

.brand-text {
    letter-spacing: 0;
}

.sidebar-menu .nav-link {
    margin: .15rem .75rem;
    color: #334155;
    border-radius: .85rem;
    font-weight: 600;
}

.sidebar-menu .nav-link:hover {
    background: rgba(37, 99, 235, .08);
    color: var(--rp-primary);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--rp-primary), var(--rp-primary-dark)) !important;
    color: #fff !important;
    box-shadow: 0 12px 30px rgba(37, 99, 235, .24);
}

.app-content-header {
    padding-top: 1.35rem;
}

.app-content-header h1 {
    font-weight: 800;
    letter-spacing: 0;
}

.card, .small-box, .modal-content {
    border: 1px solid rgba(226, 232, 240, .85);
    border-radius: 1rem;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .07);
}

.card-header {
    border-bottom: 1px solid var(--rp-line);
    border-radius: 1rem 1rem 0 0 !important;
    padding: 1rem 1.15rem;
}

.stat-card {
    overflow: hidden;
    position: relative;
}

.stat-card::after {
    content: "";
    position: absolute;
    width: 104px;
    height: 104px;
    right: -28px;
    bottom: -32px;
    background: rgba(249, 115, 22, .14);
    border-radius: 50%;
}

.stat-icon {
    align-items: center;
    background: rgba(37, 99, 235, .1);
    border-radius: 18px;
    color: var(--rp-primary);
    display: inline-flex;
    height: 52px;
    justify-content: center;
    width: 52px;
}

.erp-hero {
    background:
        linear-gradient(135deg, rgba(37, 99, 235, .98), rgba(15, 23, 42, .96)),
        var(--rp-primary);
    color: #fff;
    overflow: hidden;
    position: relative;
}

.erp-hero::after {
    background: rgba(249, 115, 22, .35);
    border-radius: 50%;
    content: "";
    height: 210px;
    position: absolute;
    right: -70px;
    top: -60px;
    width: 210px;
}

.erp-hero > * {
    position: relative;
    z-index: 1;
}

.quick-action {
    align-items: center;
    border: 1px solid var(--rp-line);
    border-radius: .9rem;
    color: var(--rp-ink);
    display: flex;
    font-weight: 700;
    gap: .75rem;
    padding: .85rem;
    text-decoration: none;
    transition: .18s ease;
}

.quick-action:hover {
    border-color: rgba(37, 99, 235, .4);
    box-shadow: 0 14px 34px rgba(15, 23, 42, .08);
    color: var(--rp-primary);
    transform: translateY(-1px);
}

.quick-action i {
    align-items: center;
    background: #eff6ff;
    border-radius: .75rem;
    color: var(--rp-primary);
    display: inline-flex;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.btn {
    border-radius: .75rem;
    font-weight: 700;
}

.btn-primary {
    --bs-btn-bg: var(--rp-primary);
    --bs-btn-border-color: var(--rp-primary);
    --bs-btn-hover-bg: var(--rp-primary-dark);
    --bs-btn-hover-border-color: var(--rp-primary-dark);
}

.btn-accent {
    --bs-btn-bg: var(--rp-accent);
    --bs-btn-border-color: var(--rp-accent);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: #ea580c;
    --bs-btn-hover-border-color: #ea580c;
    --bs-btn-hover-color: #fff;
}

.btn-whatsapp {
    --bs-btn-bg: #16a34a;
    --bs-btn-border-color: #16a34a;
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: #15803d;
    --bs-btn-hover-border-color: #15803d;
    --bs-btn-hover-color: #fff;
}

.form-control, .form-select {
    border-color: var(--rp-line);
    border-radius: .75rem;
    min-height: 42px;
}

.form-control:focus, .form-select:focus {
    border-color: rgba(37, 99, 235, .65);
    box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .12);
}

.badge-soft {
    background: #eff6ff;
    color: var(--rp-primary);
}

.tenant-photo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: cover;
    background: #e5e7eb;
}

.profile-photo {
    width: 132px;
    height: 132px;
    border-radius: 24px;
    object-fit: cover;
    background: #e5e7eb;
}

.table {
    margin-bottom: 0;
}

.table td, .table th {
    vertical-align: middle;
}

.table thead th {
    color: var(--rp-muted);
    font-size: .78rem;
    letter-spacing: 0;
    text-transform: uppercase;
}

.table-hover tbody tr:hover {
    background: #f8fafc;
}

.empty-state {
    border: 1px dashed var(--rp-line);
    border-radius: 1rem;
    color: var(--rp-muted);
    padding: 2rem;
    text-align: center;
}

.metric-label {
    color: var(--rp-muted);
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
}

@media (max-width: 575.98px) {
    .card-body {
        padding: 1rem;
    }

    .btn-group-responsive {
        display: grid;
        grid-template-columns: 1fr;
        gap: .5rem;
    }
}

.landing-page {
    background: #f8fafc;
}

.landing-nav {
    background: rgba(15, 23, 42, .72);
    backdrop-filter: blur(16px);
}

.landing-nav .nav-link {
    color: rgba(255, 255, 255, .86);
    font-weight: 700;
}

.landing-nav .nav-link:hover {
    color: #fff;
}

.landing-hero {
    background-image:
        linear-gradient(90deg, rgba(15, 23, 42, .92) 0%, rgba(15, 23, 42, .78) 42%, rgba(15, 23, 42, .18) 100%),
        url("../img/saas-hero.png");
    background-position: center;
    background-size: cover;
    min-height: 92vh;
}

.text-white-75 {
    color: rgba(255, 255, 255, .78);
}

.landing-stats strong,
.landing-stats span {
    display: block;
}

.landing-stats strong {
    color: #fff;
    font-size: 1.35rem;
}

.landing-stats span {
    color: rgba(255, 255, 255, .68);
    font-size: .85rem;
}

.landing-section {
    padding: 5rem 0;
}

.landing-card {
    transition: .18s ease;
}

.landing-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 24px 60px rgba(15, 23, 42, .11);
}

.landing-footer {
    background: #0f172a;
    color: rgba(255, 255, 255, .72);
}

.landing-footer a {
    color: #fff;
    text-decoration: none;
}

.language-form {
    min-width: 116px;
}

.auth-page {
    min-height: 100vh;
}

.auth-shell {
    min-height: 100vh;
    padding-bottom: 1.5rem;
    padding-top: 1.5rem;
}

.auth-card {
    max-width: 520px;
    width: 100%;
}

.auth-card-wide {
    max-width: 860px;
}

[dir="rtl"] .sidebar-menu .nav-link .nav-icon {
    margin-left: .5rem;
    margin-right: 0;
}

[dir="rtl"] .ms-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

@media (max-width: 991.98px) {
    .landing-nav {
        background: rgba(15, 23, 42, .94);
    }

    .landing-nav .navbar-collapse {
        background: rgba(15, 23, 42, .98);
        border: 1px solid rgba(255, 255, 255, .12);
        border-radius: 1rem;
        margin-top: .75rem;
        padding: 1rem;
    }

    .landing-nav .navbar-nav {
        align-items: stretch !important;
        gap: .55rem;
    }

    .landing-nav .btn,
    .landing-nav .language-form,
    .landing-nav .language-form select {
        width: 100%;
    }

    .landing-hero {
        background-image:
            linear-gradient(180deg, rgba(15, 23, 42, .94) 0%, rgba(15, 23, 42, .82) 100%),
            url("../img/saas-hero.png");
        background-position: 66% center;
        min-height: auto;
        padding-bottom: 3rem;
        padding-top: 5.5rem;
    }

    .landing-hero .min-vh-100 {
        min-height: auto !important;
    }

    .landing-hero .display-4 {
        font-size: 2.25rem;
        line-height: 1.12;
    }

    .landing-hero .lead {
        font-size: 1rem;
    }

    .landing-cta {
        display: grid !important;
        grid-template-columns: 1fr;
    }

    .landing-cta .btn {
        width: 100%;
    }

    .landing-section {
        padding: 3rem 0;
    }
}

@media (max-width: 575.98px) {
    .auth-shell {
        align-items: flex-start !important;
        padding: 1rem .75rem;
    }

    .auth-card {
        border-radius: .9rem;
    }

    .auth-card .card-body {
        padding: 1.15rem !important;
    }

    .auth-card .form-control-lg,
    .auth-card .btn-lg {
        font-size: 1rem;
        min-height: 46px;
    }

    .auth-card h1 {
        font-size: 1.45rem;
    }

    .landing-hero .display-4 {
        font-size: 1.85rem;
    }

    .landing-stats .col-4 {
        width: 100%;
    }

    .landing-stats strong {
        font-size: 1.1rem;
    }

    .landing-footer .container {
        display: grid !important;
        text-align: center;
    }
}
