:root {
    --primary: #1f5eff;
    --primary-dark: #153eaa;
    --surface: #ffffff;
    --surface-soft: #f4f7fb;
    --border: #d8e0ec;
    --text: #122033;
    --muted: #62748a;
    --success: #12805c;
    --danger: #d92d20;
    --shadow: 0 14px 30px rgba(15, 35, 95, 0.08);
}

body.app-body {
    background: linear-gradient(180deg, #f7fafe 0%, #eef3f9 100%);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
}

body.app-body.rtl {
    font-family: 'Cairo', sans-serif;
}

.topbar {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(216, 224, 236, 0.7);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), #5f8dff);
    color: white;
    box-shadow: var(--shadow);
}

.brand small {
    font-size: 0.78rem;
}

.page-title {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.card,
.stat-card,
.auth-card,
.contact-card {
    border-radius: 20px;
}

.auth-card,
.stat-card,
.signature-box,
.card,
.contact-card {
    box-shadow: var(--shadow);
}

.auth-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--primary), #82a6ff);
    color: #fff;
    font-size: 1.65rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.25rem 1.4rem;
    border: 1px solid rgba(216, 224, 236, 0.65);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-card small {
    display: block;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.stat-card h3 {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 700;
}

.stat-card i {
    font-size: 1.85rem;
    color: var(--primary);
}

.stat-card.accent-green i {
    color: var(--success);
}

.stat-card.accent-blue i {
    color: #1177cc;
}

.admin-chip {
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    background: #eef4ff;
    color: var(--primary-dark);
    font-size: 0.92rem;
    font-weight: 600;
}

.form-control,
.form-select {
    min-height: 48px;
    border-radius: 14px;
    border-color: var(--border);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(31, 94, 255, 0.45);
    box-shadow: 0 0 0 0.25rem rgba(31, 94, 255, 0.12);
}

.btn {
    border-radius: 14px;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #4a80ff);
    border-color: transparent;
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #194fe0, #3d6fe0);
}

.table thead th {
    background: #f2f6fb;
    color: #4e6076;
    font-size: 0.9rem;
    white-space: nowrap;
}

.visitor-table td,
.visitor-table th {
    padding: 1rem;
    vertical-align: middle;
}

.signature-box {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1rem 1.1rem;
    background: var(--surface-soft);
}

.is-invalid-border {
    border-color: rgba(217, 45, 32, 0.5);
}

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

.footer-link-button {
    border: 0;
    background: transparent;
    color: var(--primary-dark);
    font-weight: 600;
    text-decoration: underline;
}

.contact-card {
    background: linear-gradient(180deg, #f9fbff, #eef4ff);
    border: 1px solid var(--border);
    padding: 1rem 1.15rem;
}

.contact-line {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0;
}

.contact-line a {
    color: var(--primary-dark);
    text-decoration: none;
}

.contact-line a:hover {
    text-decoration: underline;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.min-vh-70 {
    min-height: 70vh;
}

.cin-match-message {
    min-height: 1.2rem;
}

.visitor-form-card {
    position: relative;
}

body.rtl .brand,
body.rtl .page-header,
body.rtl .table,
body.rtl .form-label,
body.rtl .card,
body.rtl .dropdown-menu,
body.rtl .alert,
body.rtl .pagination,
body.rtl .navbar,
body.rtl .btn,
body.rtl .form-check,
body.rtl .modal {
    direction: rtl;
}

body.rtl .ms-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

body.rtl .me-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}

body.rtl .dropdown-menu-end {
    --bs-position: start;
}

@media (max-width: 991.98px) {
    .brand small {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .visitor-table {
        min-width: 980px;
    }

    .page-header {
        align-items: flex-start !important;
    }

    .stat-card h3 {
        font-size: 1.6rem;
    }
}


.standalone-body {
    background: linear-gradient(180deg, #f6f8fc 0%, #edf2f8 100%);
}

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

.standalone-card {
    max-width: 1280px;
    margin: 0 auto;
    border-radius: 28px;
}

.standalone-head {
    max-width: 720px;
}

.standalone-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    background: #eef4ff;
    color: var(--primary-dark);
    font-weight: 700;
}

.standalone-title {
    font-size: clamp(1.9rem, 3vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}

@media (max-width: 767.98px) {
    .standalone-card {
        border-radius: 20px;
    }
}


.root-action-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.root-exit-card {
    border: 1px solid var(--border);
    border-radius: 22px;
    background: linear-gradient(180deg, #fff6f4, #fffefe);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.root-tab-btn {
    min-width: 180px;
}
