:root {
    --bg-main: #f4f7fb;
    --bg-panel: rgba(255, 255, 255, 0.9);
    --bg-panel-strong: #ffffff;
    --line-soft: rgba(16, 24, 40, 0.08);
    --text-main: #10233b;
    --text-muted: #5b6b82;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --brand-soft: #d7f5f0;
    --accent: #f59e0b;
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
    --radius-xl: 24px;
    --radius-lg: 18px;
}

[x-cloak] {
    display: none !important;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: "Cairo", sans-serif;
    background:
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.14), transparent 28%),
        radial-gradient(circle at left center, rgba(245, 158, 11, 0.12), transparent 24%),
        var(--bg-main);
    color: var(--text-main);
}

a {
    text-decoration: none;
}

.businessos-body {
    overflow-x: hidden;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 310px;
    background: linear-gradient(180deg, #0f172a 0%, #132238 100%);
    color: #fff;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.5rem 1rem;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    overflow-y: auto;
    transition: transform 0.25s ease, width 0.25s ease;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.app-sidebar.collapsed {
    width: 110px;
}

.app-sidebar.collapsed .sidebar-group-title,
.app-sidebar.collapsed .sidebar-link span,
.app-sidebar.collapsed .sidebar-section-btn span,
.app-sidebar.collapsed .sidebar-submenu,
.app-sidebar.collapsed .chevron,
.app-sidebar.collapsed .brand-copy {
    display: none;
}

.app-main {
    flex: 1;
    margin-right: 310px;
    transition: margin-right 0.25s ease;
}

.app-sidebar.collapsed + .app-main {
    margin-right: 110px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.5rem 0.75rem 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-badge {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.9), rgba(245, 158, 11, 0.9));
    font-size: 1.2rem;
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 14px;
}

.brand-copy {
    display: flex;
    flex-direction: column;
}

.brand-copy strong {
    font-size: 1.1rem;
}

.brand-copy span {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.9rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar-group-title {
    padding: 0 0.75rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: rgba(255, 255, 255, 0.88);
    padding: 0.8rem 0.9rem;
    border-radius: 16px;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: translateX(-2px);
}

.sidebar-link.active {
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.95), rgba(18, 51, 84, 0.95));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.sidebar-link i {
    font-size: 1rem;
    min-width: 22px;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar-section-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    color: rgba(255, 255, 255, 0.88);
    background: transparent;
    border: 0;
    padding: 0.8rem 0.9rem;
    border-radius: 16px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-section-btn:hover,
.sidebar-section-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar-section-label {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.sidebar-submenu {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-inline-start: 0.5rem;
}

.sidebar-submenu .sidebar-link,
.sidebar-submenu a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: rgba(255, 255, 255, 0.82);
    padding: 0.7rem 0.9rem;
    border-radius: 14px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-submenu a:hover,
.sidebar-submenu .active {
    background: rgba(15, 118, 110, 0.32);
    color: #fff;
}

.chevron {
    transition: transform 0.2s ease;
}

.chevron.rotated {
    transform: rotate(180deg);
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(244, 247, 251, 0.85);
    backdrop-filter: blur(14px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--line-soft);
}

.topbar-title {
    font-size: 1.3rem;
    font-weight: 800;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-panel);
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    padding: 0.5rem 0.8rem;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 1.1rem;
}

.app-content {
    padding: 2rem;
}

.hero-panel,
.surface-panel,
.module-hero,
.metric-card {
    background: var(--bg-panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.hero-panel {
    display: grid;
    grid-template-columns: 1.5fr 180px;
    gap: 1.5rem;
    align-items: center;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.hero-panel h2,
.module-hero h2 {
    font-size: 2rem;
    font-weight: 800;
    margin: 0.5rem 0;
}

.hero-accent {
    width: 100%;
    min-height: 160px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.15), rgba(245, 158, 11, 0.22));
    color: var(--brand-dark);
    font-size: 4rem;
}

.mini-badge,
.code-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-weight: 700;
    font-size: 0.85rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    padding: 1.25rem;
}

.metric-label {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 800;
    margin-top: 0.35rem;
}

.metric-meta {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-top: 0.5rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.surface-panel {
    padding: 1.5rem;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.panel-heading .panel-title {
    margin-bottom: 0;
}

.list-stack {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.list-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--text-main);
}

.quick-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.quick-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-panel-strong);
    color: var(--text-main);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    padding: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.quick-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
}

.module-hero {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.feature-icon {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.9), rgba(245, 158, 11, 0.85));
    color: #fff;
    font-size: 1.8rem;
    flex-shrink: 0;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    background: var(--bg-panel-strong);
    color: var(--text-main);
}

.mobile-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1040;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.18), transparent 26%),
        radial-gradient(circle at bottom right, rgba(245, 158, 11, 0.14), transparent 28%),
        #eff5fb;
}

.login-shell {
    width: min(100%, 1120px);
    padding: 1.5rem;
}

.login-card {
    max-width: 520px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(16, 24, 40, 0.08);
    box-shadow: var(--shadow-lg);
    border-radius: 32px;
    padding: 2rem;
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin: 0.75rem 0 0.5rem;
}

.login-header p,
.credentials-note,
.text-secondary {
    color: var(--text-muted) !important;
}

.credentials-note {
    background: #f8fafc;
    border: 1px dashed rgba(15, 118, 110, 0.25);
    border-radius: 18px;
    padding: 1rem;
    margin: 1.25rem 0 1.5rem;
}

.form-label {
    font-weight: 700;
    color: var(--text-main);
}

.form-control,
.form-select,
.input-group-text {
    border-radius: 16px;
    min-height: 58px;
}

.form-control,
.form-select,
.input-group-text,
.modal-content {
    border-color: rgba(148, 163, 184, 0.35);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(15, 118, 110, 0.45);
    box-shadow: 0 0 0 0.25rem rgba(15, 118, 110, 0.12);
}

.input-group > .form-control {
    border-start-start-radius: 0;
    border-end-start-radius: 0;
}

.input-group > .input-group-text {
    border-start-end-radius: 0;
    border-end-end-radius: 0;
    background: #fff;
}

.form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

.table > :not(caption) > * > * {
    padding: 0.95rem 0.85rem;
    vertical-align: middle;
}

.table thead th {
    background: #f8fbff;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
}

.table-hover > tbody > tr:hover > * {
    background-color: rgba(15, 118, 110, 0.03);
}

.table-warning > * {
    --bs-table-bg: #fff7d6;
    --bs-table-striped-bg: #fff7d6;
    --bs-table-active-bg: #ffefae;
    --bs-table-hover-bg: #fff1bf;
}

.badge {
    border-radius: 999px;
    padding: 0.55rem 0.8rem;
    font-weight: 700;
}

.modal-content {
    border-radius: 26px;
    box-shadow: var(--shadow-lg);
}

.modal-header,
.modal-footer {
    border-color: var(--line-soft);
}

.progress {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.2);
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--brand), #22c55e);
}

.dataTables_wrapper .row {
    margin-left: 0;
    margin-right: 0;
    align-items: center;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    min-height: 44px;
    padding: 0.45rem 0.75rem;
    background: #fff;
}

.dataTables_wrapper .pagination .page-link {
    border-radius: 12px !important;
    margin: 0 0.15rem;
    border-color: rgba(148, 163, 184, 0.24);
    color: var(--text-main);
}

.dataTables_wrapper .pagination .page-item.active .page-link {
    background-color: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.select2-container {
    width: 100% !important;
}

.select2-container--bootstrap-5 .select2-selection {
    min-height: 58px;
    border-radius: 16px;
    border-color: rgba(148, 163, 184, 0.35);
    display: flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    background-color: #fff;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    color: var(--text-main);
    line-height: 1.8;
    padding: 0;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    inset-inline-end: 0.85rem;
    inset-inline-start: auto;
    top: 50%;
    transform: translateY(-50%);
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-color: rgba(148, 163, 184, 0.35);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--brand);
}

.js-submit-btn.is-loading {
    opacity: 0.9;
    pointer-events: none;
}

.alert {
    border-radius: 20px;
}

.btn {
    font-weight: 700;
}

.chart-card {
    min-height: 380px;
}

.dashboard-chart-grid {
    grid-template-columns: 1.4fr 1fr;
}

.dashboard-table-grid,
.dashboard-alert-grid,
.feature-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.dashboard-table-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.alert-stack,
.feature-list,
.permission-groups {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.alert-link-card,
.feature-row,
.permission-group-card,
.asset-preview,
.empty-state {
    background: var(--bg-panel-strong);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
}

.alert-link-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: var(--text-main);
    padding: 1rem;
}

.feature-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
}

.feature-copy {
    flex: 1;
}

.permission-group-card {
    padding: 1rem;
}

.permission-group-card h4 {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 0.9rem;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0;
}

.empty-state {
    padding: 1.25rem;
    text-align: center;
    color: var(--text-muted);
}

.asset-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    padding: 1rem;
}

.asset-preview img {
    max-width: 100%;
    max-height: 150px;
    object-fit: contain;
}

.settings-grid {
    grid-template-columns: 1fr 1.4fr;
}

.disabled-feature-panel {
    text-align: center;
    max-width: 720px;
    margin: 2rem auto 0;
}

.error-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.18), transparent 28%),
        radial-gradient(circle at left center, rgba(245, 158, 11, 0.18), transparent 24%),
        var(--bg-main);
}

.error-shell {
    width: min(92vw, 560px);
    text-align: center;
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line-soft);
    border-radius: 32px;
    box-shadow: var(--shadow-lg);
}

.error-code {
    font-size: 5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--brand-dark);
    margin-bottom: 1rem;
}

.report-header-print {
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.print-table th,
.print-table td {
    font-size: 0.9rem;
    padding: 0.55rem;
}

@media (max-width: 1199.98px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .kpi-grid,
    .dashboard-table-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(100%);
        width: 310px;
    }

    .app-sidebar.mobile-open {
        transform: translateX(0);
    }

    .app-main,
    .app-sidebar.collapsed + .app-main {
        margin-right: 0;
    }

    .content-grid,
    .hero-panel {
        grid-template-columns: 1fr;
    }

    .hero-accent {
        min-height: 120px;
    }

    .settings-grid,
    .dashboard-chart-grid,
    .dashboard-alert-grid,
    .feature-groups {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .app-topbar,
    .app-content {
        padding: 1rem;
    }

    .topbar-user {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .stats-grid,
    .content-grid,
    .quick-links,
    .kpi-grid,
    .dashboard-table-grid {
        grid-template-columns: 1fr;
    }

    .hero-panel h2,
    .module-hero h2,
    .login-header h1 {
        font-size: 1.55rem;
    }

    .feature-row,
    .alert-link-card {
        flex-direction: column;
        align-items: flex-start;
    }
}
