:root {
    --bs-primary: #004d5a;
    --bs-primary-rgb: 0, 77, 90;
    --brand-primary: #004d5a;
    --brand-primary-light: #baf3e6;
    --brand-success: #27ae60;
    --brand-warning: #ff9f43;
    --brand-danger: #ff5b5c;
    --brand-info: #00cfe8;
    --page-bg: #f9fafb;
    --surface-bg: #ffffff;
    --border-color: #edf2f4;
    --text-primary: #111827;
    --text-muted: #8299a1;
    --shadow-low: 0 2px 10px rgba(0, 77, 90, 0.05);
    --shadow-high: 0 10px 30px rgba(0, 0, 0, 0.1);
    --radius-card: 12px;
    --radius-pill: 50px;
    --radius-input: 8px;
    --navbar-height: 64px;
    --sidebar-width: 280px;
}
.modal-dialog-scrollable .modal-content {
   
    overflow: scroll !important;
}
html,
body {
    min-height: 100%;
}

html {
    scroll-padding-top: calc(var(--navbar-height) + 16px);
}

body {
    background:
        radial-gradient(circle at top left, rgba(186, 243, 230, 0.7), transparent 30%),
        linear-gradient(180deg, rgba(0, 207, 232, 0.05), transparent 35%),
        var(--page-bg);
    color: var(--text-primary);
    font-family: 'Tajawal', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    padding-top: var(--navbar-height);
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 77, 90, 0.08);
}

a {
    text-decoration: none;
}

.skip-link {
    background: var(--brand-primary);
    border-radius: var(--radius-pill);
    color: #fff;
    padding: 10px 18px;
    position: fixed;
    right: 16px;
    top: 12px;
    transform: translateY(-180%);
    z-index: 1080;
}

.skip-link:focus-visible {
    transform: translateY(0);
}

.page-container {
    margin: 0 auto;
    max-width: 1200px;
    padding-left: 16px;
    padding-right: 16px;
}

.app-navbar {
    backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(237, 242, 244, 0.85);
    box-shadow: 0 8px 24px rgba(0, 77, 90, 0.03);
    height: var(--navbar-height);
    z-index: 1045;
}

.navbar-shell {
    align-items: center;
    display: flex;
    height: var(--navbar-height);
    justify-content: space-between;
    gap: 16px;
}

.brand-link {
    align-items: center;
    color: var(--text-primary);
    display: inline-flex;
    gap: 12px;
    min-width: 0;
}

.brand-link small {
    color: var(--text-muted);
    display: block;
    font-size: 12px;
}

.brand-icon,
.brand-mark,
.metric-icon,
.soft-icon,
.user-chip__icon {
    align-items: center;
    background: linear-gradient(135deg, rgba(186, 243, 230, 0.95), rgba(0, 207, 232, 0.16));
    border-radius: 50%;
    color: var(--brand-primary);
    display: inline-flex;
    height: 44px;
    justify-content: center;
    width: 44px;
}

.top-actions {
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    justify-content: flex-end;
    min-width: 0;
    overflow: hidden;
}

.user-chip {
    align-items: center;
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    display: inline-flex;
    gap: 10px;
    min-width: 0;
    padding: 8px 14px;
}

.user-chip small {
    color: var(--text-muted);
    display: block;
    font-size: 12px;
}

.app-stage {
    min-height: calc(100vh - var(--navbar-height));
}

.app-stage.is-admin {
    display: flex;
    gap: 20px;
    padding: 20px 16px 40px;
}

.app-content {
    flex: 1;
    min-width: 0;
}

.app-sidebar {
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(237, 242, 244, 0.95);
    border-radius: 24px;
    box-shadow: var(--shadow-low);
    height: calc(100vh - 104px);
    padding: 24px 18px;
    position: sticky;
    top: 84px;
    width: min(100%, var(--sidebar-width));
}

.app-sidebar--desktop {
    flex: 0 0 var(--sidebar-width);
}

.admin-offcanvas {
    background: rgba(249, 250, 251, 0.98);
    width: min(88vw, 340px);
}

.admin-offcanvas .offcanvas-header {
    align-items: start;
    border-bottom: 1px solid var(--border-color);
}

.admin-offcanvas .offcanvas-body {
    padding: 20px 16px 24px;
}

.sidebar-brand {
    align-items: center;
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
}

.sidebar-subtitle {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 0;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-link {
    align-items: center;
    border-radius: 14px;
    color: var(--text-primary);
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: linear-gradient(135deg, rgba(186, 243, 230, 0.55), rgba(0, 207, 232, 0.08));
    color: var(--brand-primary);
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
    padding-top: 16px;
}

.app-alert {
    border: 0;
    border-radius: 16px;
    margin-bottom: 16px;
}

.hero-card,
.soft-card,
.metric-card,
.login-card,
.timeline-card,
.table-card {
    background: var(--surface-bg);
    border: 1px solid rgba(237, 242, 244, 0.95);
    border-radius: 24px;
    box-shadow: var(--shadow-low);
}

.hero-card {
    overflow: hidden;
    padding: 28px;
    position: relative;
}

.hero-card::before {
    background: linear-gradient(135deg, rgba(186, 243, 230, 0.8), rgba(0, 207, 232, 0.16));
    border-radius: 999px;
    content: '';
    height: 220px;
    left: -20px;
    position: absolute;
    top: -90px;
    width: 220px;
}

.hero-content,
.hero-actions,
.hero-points {
    position: relative;
    z-index: 1;
}

.section-eyebrow {
    color: var(--brand-warning);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
}

.hero-title,
.page-title {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 12px;
    text-wrap: balance;
}

.hero-text,
.section-description,
.muted-copy {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 0;
    overflow-wrap: anywhere;
    text-wrap: pretty;
}

.hero-actions,
.stats-grid,
.feature-grid,
.dashboard-grid,
.user-info-grid {
    display: grid;
    gap: 16px;
}

.hero-actions {
    grid-template-columns: repeat(auto-fit, minmax(160px, max-content));
    margin-top: 24px;
}

.hero-points {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.badge-soft {
    background: rgba(255, 159, 67, 0.12);
    border-radius: var(--radius-pill);
    color: var(--brand-warning);
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
}

.feature-grid,
.stats-grid,
.dashboard-grid,
.user-info-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

.feature-card,
.metric-card,
.soft-card,
.table-card,
.timeline-card {
    padding: 20px 24px;
}

.feature-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 22px;
    box-shadow: var(--shadow-low);
    grid-column: span 4;
}

.feature-card h3,
.soft-card h3,
.table-card h3,
.timeline-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 14px 0 10px;
}

.metric-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    grid-column: span 3;
}

.metric-card strong {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.metric-card span {
    color: var(--text-muted);
    font-size: 13px;
}

.metric-icon {
    border-radius: 16px;
}

.content-section {
    margin-bottom: 24px;
}

.section-head {
    align-items: flex-end;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.form-control,
.form-select,
.input-group-text {
    background-color: #f9fafb;
    border-color: var(--border-color);
    border-radius: var(--radius-input);
    min-height: 48px;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--surface-bg);
    border-color: rgba(0, 77, 90, 0.35);
    box-shadow: 0 0 0 0.2rem rgba(186, 243, 230, 0.45);
}

.form-select {
    background-image: none;
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-select:hover {
    background-color: var(--surface-bg);
}

.form-select option {
    background-color: var(--surface-bg);
    color: var(--text-primary);
}

.select-shell {
    position: relative;
}

.select-shell::after {
    color: var(--text-muted);
    content: '\F282';
    font-family: 'bootstrap-icons';
    font-size: 14px;
    inset-inline-start: 16px;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: color 0.2s ease, transform 0.2s ease;
}

.select-shell:focus-within::after {
    color: var(--brand-primary);
    transform: translateY(-50%) scale(1.05);
}

.select-shell .form-select {
    padding-inline-start: 44px;
}

.btn {
    border-radius: var(--radius-pill);
    font-weight: 700;
    min-height: 48px;
    padding: 10px 22px;
}

.btn-primary,
.btn-soft {
    background: var(--brand-primary-light);
    border-color: var(--brand-primary-light);
    color: var(--brand-primary);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-soft:hover,
.btn-soft:focus {
    background: #a2e5d6;
    border-color: #a2e5d6;
    color: var(--brand-primary);
}

.btn-outline-primary {
    border-color: rgba(0, 77, 90, 0.18);
    color: var(--brand-primary);
}

.btn-outline-danger {
    border-color: rgba(255, 91, 92, 0.25);
    color: var(--brand-danger);
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
    background: rgba(255, 91, 92, 0.08);
    color: var(--brand-danger);
}

.btn-pill {
    border-radius: var(--radius-pill);
}

.table-modern thead th {
    border-bottom-color: var(--border-color);
    color: var(--text-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.table-modern tbody td {
    border-bottom-color: var(--border-color);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
    vertical-align: middle;
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
    border-radius: 18px;
    overflow-x: auto;
}

.subnovaa-import-form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.subnovaa-import-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    overflow-y: auto;
}

.subnovaa-import-table-wrapper {
    flex: 1 1 auto;
    max-height: calc(100vh - 340px);
    min-height: 260px;
    overflow: auto;
}

.subnovaa-import-table-wrapper thead th {
    background: var(--surface-bg);
    position: sticky;
    top: 0;
    z-index: 1;
}

.table-modern tbody tr:last-child td {
    border-bottom: 0;
}

.status-badge {
    align-items: center;
    border-radius: var(--radius-pill);
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    gap: 6px;
    padding: 6px 12px;
}

.status-badge.is-success {
    background: rgba(39, 174, 96, 0.12);
    color: var(--brand-success);
}

.status-badge.is-warning {
    background: rgba(255, 159, 67, 0.14);
    color: var(--brand-warning);
}

.status-badge.is-danger {
    background: rgba(255, 91, 92, 0.12);
    color: var(--brand-danger);
}

.timeline-list,
.quick-list {
    display: grid;
    gap: 12px;
}

.timeline-item,
.quick-item {
    align-items: start;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    display: grid;
    gap: 10px;
    padding: 14px 16px;
}

.quick-item {
    grid-template-columns: auto 1fr;
}

.timeline-item time,
.muted-label,
.quick-item p,
.list-meta {
    color: var(--text-muted);
    font-size: 12px;
    margin: 0;
    overflow-wrap: anywhere;
}

.timeline-item strong,
.quick-item strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.page-head {
    margin-bottom: 20px;
}

.page-head .page-title {
    margin-bottom: 6px;
}

.login-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: calc(100vh - 180px);
    padding: 40px 0;
}

.login-card {
    max-width: 520px;
    padding: 28px;
    width: 100%;
}

.site-footer {
    background: rgba(255, 255, 255, 0.75);
    border-top: 1px solid rgba(237, 242, 244, 0.85);
    margin-top: 40px;
}

.footer-shell {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 20px;
    padding-top: 20px;
}

.footer-shell p,
.footer-meta {
    color: var(--text-muted);
    font-size: 12px;
    margin: 0;
}

.footer-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.page-toolbar {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.page-toolbar__actions form {
    margin: 0;
}

.page-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.page-chip {
    align-items: center;
    background: rgba(186, 243, 230, 0.22);
    border: 1px solid rgba(0, 77, 90, 0.08);
    border-radius: var(--radius-pill);
    color: var(--brand-primary);
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    gap: 8px;
    min-height: 40px;
    padding: 8px 14px;
}

.detail-stack {
    display: grid;
    gap: 18px;
}

.section-panel {
    background: var(--surface-bg);
    border: 1px solid rgba(237, 242, 244, 0.95);
    border-radius: 24px;
    box-shadow: var(--shadow-low);
    padding: 20px 24px;
}

.section-panel__head {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 16px;
}

.inline-form > * {
    min-width: 0;
}

.split-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

.split-grid > *:first-child {
    grid-column: span 7;
}

.split-grid > *:last-child {
    grid-column: span 5;
}

.user-summary {
    align-items: center;
    display: flex;
    gap: 14px;
}

.list-card {
    border: 1px solid var(--border-color);
    border-radius: 18px;
    min-width: 0;
    padding: 16px;
}

.list-card strong,
.list-card p,
.list-card div,
.app-alert,
.status-badge,
.user-chip,
.brand-link span {
    overflow-wrap: anywhere;
}

.app-flash-stack {
    margin-bottom: 16px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn-close:focus-visible {
    outline: 3px solid rgba(0, 77, 90, 0.22);
    outline-offset: 2px;
}

.empty-state {
    border: 1px dashed rgba(130, 153, 161, 0.4);
    border-radius: 18px;
    color: var(--text-muted);
    padding: 20px;
    text-align: center;
}

@media (max-width: 991.98px) {
    .app-stage.is-admin {
        display: block;
        overflow-x: hidden;
        padding: 16px 12px 32px;
    }

    .app-sidebar {
        height: auto;
        position: static;
        width: 100%;
    }

    .feature-card,
    .metric-card {
        grid-column: span 6;
    }

    .user-chip {
        display: none;
    }

    .split-grid > *:first-child,
    .split-grid > *:last-child {
        grid-column: span 12;
    }
}

@media (max-width: 767.98px) {
    .footer-shell,
    .section-head {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .section-head > .btn,
    .section-head > a.btn,
    .section-head > form {
        align-self: flex-start;
    }

    .navbar-shell {
        gap: 8px;
    }

    .brand-link small {
        display: none;
    }

    .top-actions {
        gap: 6px;
    }

    .btn {
        min-height: 44px;
        padding: 10px 16px;
    }

    .feature-card {
        grid-column: span 12;
    }

    .metric-card {
        grid-column: span 6;
    }

    .hero-card,
    .feature-card,
    .metric-card,
    .soft-card,
    .section-panel,
    .table-card,
    .timeline-card,
    .login-card {
        border-radius: 18px;
        padding: 18px;
    }

    .hero-actions {
        grid-template-columns: 1fr;
    }

    .inline-form {
        flex-wrap: wrap;
    }

    .inline-form > .form-control,
    .inline-form > .form-select {
        flex: 1 1 140px;
    }

    .table-modern th,
    .table-modern td {
        white-space: normal;
    }
}

@media (max-width: 575.98px) {
    .page-container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .app-stage.is-admin {
        padding: 12px 8px 20px;
    }

    .content-section {
        margin-bottom: 16px;
    }

    .stats-grid,
    .user-info-grid {
        gap: 10px;
    }

    .split-grid {
        gap: 14px;
    }

    .metric-card {
        border-radius: 14px;
        padding: 14px 12px;
    }

    .metric-card strong {
        font-size: 22px;
    }

    .page-title,
    .hero-title {
        font-size: 20px;
    }

    .feature-card,
    .soft-card,
    .table-card,
    .timeline-card {
        border-radius: 14px;
        padding: 16px;
    }

    .list-card {
        border-radius: 12px;
        padding: 12px;
    }

    .section-head {
        gap: 8px;
    }

    .inline-form {
        flex-direction: column;
    }

    .inline-form > * {
        width: 100%;
    }

    .btn {
        min-height: 42px;
        padding: 9px 14px;
    }

    .sidebar-brand {
        margin-bottom: 16px;
    }

    .timeline-item,
    .quick-item {
        padding: 10px 12px;
    }

    .table-card h3,
    .soft-card h3,
    .timeline-card h3 {
        font-size: 16px;
        margin-top: 8px;
    }

    .footer-shell {
        flex-direction: column;
        gap: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 767.98px) {
    .subnovaa-import-table-wrapper {
        max-height: calc(100vh - 280px);
        min-height: 220px;
    }
}