:root {
    --sidebar-width: 268px;
    --sidebar-collapsed-width: 76px;
    --app-primary: #0f766e;
    --app-sidebar: #0f172a;
    --app-bg: #f8fafc;
    --app-success: #22c55e;
    --app-warning: #f59e0b;
    --app-danger: #ef4444;
    --app-text: #172033;
    --app-muted: #64748b;
    --app-border: #e2e8f0;
    --app-card: #ffffff;
    --app-input: #ffffff;
    --app-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
    --app-shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.06);
}

[data-bs-theme="dark"] {
    --app-bg: #0b1220;
    --app-card: #111827;
    --app-input: #0f172a;
    --app-text: #e5e7eb;
    --app-muted: #94a3b8;
    --app-border: #263244;
    --app-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
    --app-shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.22);
}

* {
    letter-spacing: 0;
}

body {
    background: var(--app-bg);
    color: var(--app-text);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    margin: 0;
}

a {
    color: var(--app-primary);
}

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

.app-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.2s ease;
}

body.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-collapsed-width);
}

.content-wrap {
    padding: 24px;
}

.app-sidebar {
    background: var(--app-sidebar);
    color: #e2e8f0;
    height: 100vh;
    left: 0;
    overflow-y: auto;
    position: fixed;
    top: 0;
    transition: width 0.2s ease;
    width: var(--sidebar-width);
    z-index: 1030;
}

body.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-brand {
    align-items: center;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    display: flex;
    gap: 10px;
    min-height: 68px;
    padding: 14px 18px;
}

.brand-mark,
.auth-logo {
    align-items: center;
    background: var(--app-primary);
    border-radius: 12px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 42px;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.brand-title {
    color: #fff;
    display: block;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.2;
}

.brand-subtitle {
    color: #94a3b8;
    display: block;
    font-size: 12px;
    margin-top: 2px;
}

.sidebar-section-title {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin: 20px 18px 8px;
    text-transform: uppercase;
}

.sidebar-nav {
    padding: 8px 10px 18px;
}

.sidebar-link {
    align-items: center;
    border-radius: 10px;
    color: #cbd5e1;
    display: flex;
    gap: 10px;
    min-height: 42px;
    padding: 9px 10px;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(15, 118, 110, 0.24);
    color: #fff;
}

.sidebar-link i {
    flex: 0 0 22px;
    font-size: 18px;
    text-align: center;
}

.sidebar-submenu {
    margin: 5px 0 10px 32px;
}

.sidebar-submenu .sidebar-link {
    font-size: 14px;
    min-height: 36px;
    padding: 7px 10px;
}

.sidebar-chevron {
    font-size: 12px;
    margin-left: auto;
    transition: transform 0.2s ease;
}

.sidebar-link[aria-expanded="true"] .sidebar-chevron {
    transform: rotate(180deg);
}

body.sidebar-collapsed .app-sidebar .brand-text,
body.sidebar-collapsed .app-sidebar .sidebar-section-title,
body.sidebar-collapsed .app-sidebar .sidebar-text,
body.sidebar-collapsed .app-sidebar .sidebar-chevron {
    display: none;
}

body.sidebar-collapsed .app-sidebar .sidebar-brand,
body.sidebar-collapsed .app-sidebar .sidebar-link {
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
}

body.sidebar-collapsed .app-sidebar .sidebar-submenu {
    display: none;
}

.top-navbar {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--app-border);
    min-height: 68px;
    position: sticky;
    top: 0;
    z-index: 1020;
    backdrop-filter: blur(12px);
}

[data-bs-theme="dark"] .top-navbar {
    background: rgba(17, 24, 39, 0.92);
}

.navbar-search {
    max-width: 440px;
}

.notification-menu {
    min-width: min(360px, calc(100vw - 32px));
}

.notification-item {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    white-space: normal;
}

.notification-icon {
    align-items: center;
    border-radius: 10px;
    display: inline-flex;
    flex: 0 0 36px;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.page-header {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-kicker {
    color: var(--app-primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.page-title {
    font-size: clamp(26px, 3vw, 34px);
    font-weight: 850;
    margin: 0;
}

.page-description {
    color: var(--app-muted);
    margin: 6px 0 0;
    max-width: 720px;
}

.page-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.breadcrumb {
    --bs-breadcrumb-margin-bottom: 0;
    font-size: 13px;
}

.card,
.content-card {
    background: var(--app-card);
    border: 1px solid var(--app-border);
    border-radius: 8px;
    box-shadow: var(--app-shadow-sm);
    margin-bottom: 18px;
}

.card {
    padding: 0;
}

.content-card .card-header,
.card > .card-header {
    background: transparent;
    border-bottom: 1px solid var(--app-border);
    padding: 17px 20px;
}

.content-card .card-body,
.card > .card-body {
    padding: 20px;
}

.section-card {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 18px;
}

.btn {
    border-radius: 8px;
    font-weight: 700;
    padding: 8px 13px;
}

.btn-success {
    --bs-btn-bg: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: #115e59;
    --bs-btn-hover-border-color: #115e59;
}

.btn-primary {
    --bs-btn-bg: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: #115e59;
    --bs-btn-hover-border-color: #115e59;
}

.form-shell {
    max-width: 1060px;
}

.form-label {
    color: var(--app-text);
    font-weight: 750;
}

.required::after {
    color: var(--app-danger);
    content: " *";
}

.form-control,
.form-select,
.input-group-text {
    background-color: var(--app-input);
    border-color: #cbd5e1;
    border-radius: 8px;
    color: var(--app-text);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
    border-color: #334155;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 0.22rem rgba(15, 118, 110, 0.16);
}

.form-floating > label {
    color: var(--app-muted);
}

.input-icon-group .input-group-text {
    border-bottom-right-radius: 0;
    border-top-right-radius: 0;
    color: var(--app-primary);
    min-width: 44px;
    justify-content: center;
}

.input-icon-group .form-floating > .form-control,
.input-icon-group .form-floating > .form-select {
    border-bottom-left-radius: 0;
    border-top-left-radius: 0;
}

.form-hint,
.invalid-feedback,
.valid-feedback {
    font-size: 12px;
}

.alert {
    border: 0;
    border-radius: 8px;
    box-shadow: var(--app-shadow-sm);
}

.metric-tile,
.summary-card {
    background: var(--app-card);
    border: 1px solid var(--app-border);
    border-radius: 8px;
    box-shadow: var(--app-shadow-sm);
    height: 100%;
    padding: 18px;
}

.summary-card {
    align-items: center;
    display: flex;
    gap: 14px;
}

.summary-icon,
.quick-icon,
.metric-icon {
    align-items: center;
    border-radius: 12px;
    display: inline-flex;
    flex: 0 0 46px;
    font-size: 20px;
    height: 46px;
    justify-content: center;
    width: 46px;
}

.summary-value {
    font-size: 24px;
    font-weight: 850;
    line-height: 1.15;
}

.table-responsive {
    max-height: 68vh;
    overflow: auto;
}

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

.table-modern thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 850;
    position: sticky;
    text-transform: uppercase;
    top: 0;
    z-index: 2;
}

[data-bs-theme="dark"] .table-modern thead th,
[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] .dt-container .dt-scroll-head {
    background: #172033;
    color: #cbd5e1;
}

.table-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.dt-container .dt-search input,
.dt-container .dt-length select {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 7px 10px;
}

.dt-container .dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.empty-state {
    align-items: center;
    background: color-mix(in srgb, var(--app-card) 72%, var(--app-bg));
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: var(--app-muted);
    display: flex;
    justify-content: center;
    min-height: 150px;
    padding: 24px;
    text-align: center;
}

.quick-action {
    align-items: center;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    color: var(--app-text);
    display: flex;
    gap: 12px;
    height: 100%;
    padding: 14px;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.quick-action:hover {
    border-color: var(--app-primary);
    box-shadow: var(--app-shadow);
    color: var(--app-primary);
    transform: translateY(-1px);
}

.quick-action.disabled {
    color: var(--app-muted);
    cursor: default;
    opacity: 0.76;
    pointer-events: none;
}

.chart-box {
    height: 320px;
    min-height: 260px;
    position: relative;
}

.dashboard-stat {
    border: 0;
    color: #fff;
    overflow: hidden;
    position: relative;
}

.dashboard-stat .stat-icon {
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: inline-flex;
    font-size: 24px;
    height: 48px;
    justify-content: center;
    width: 48px;
}

.dashboard-stat .stat-number {
    font-size: clamp(24px, 2.4vw, 34px);
    font-weight: 850;
    line-height: 1.1;
    margin: 14px 0 6px;
    overflow-wrap: anywhere;
}

.dashboard-stat .stat-button {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #fff;
}

.dash-card-blue { background: linear-gradient(135deg, #2563eb, #0ea5e9); }
.dash-card-green { background: linear-gradient(135deg, #16a34a, #059669); }
.dash-card-amber { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.dash-card-purple { background: linear-gradient(135deg, #7c3aed, #0891b2); }
.dash-card-teal { background: linear-gradient(135deg, #0f766e, #0891b2); }
.dash-card-slate { background: linear-gradient(135deg, #334155, #475569); }

.dashboard-alert {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    height: 100%;
    padding: 16px;
}

.alert-list {
    min-height: 92px;
}

.activity-line {
    border-left: 2px solid var(--app-border);
    margin-left: 14px;
    padding: 0 0 14px 18px;
    position: relative;
}

.activity-line:last-child {
    padding-bottom: 0;
}

.activity-line .activity-dot {
    align-items: center;
    background: var(--app-primary);
    border-radius: 50%;
    color: #fff;
    display: inline-flex;
    height: 28px;
    justify-content: center;
    left: -15px;
    position: absolute;
    top: 0;
    width: 28px;
}

.auth-page {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.92), rgba(15, 23, 42, 0.92)),
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.35), transparent 34%),
        #0f172a;
    color: #111827;
    display: flex;
    min-height: 100vh;
    padding: 28px 14px;
}

.auth-wrap {
    margin: 0 auto;
    max-width: 1120px;
    width: 100%;
}

.auth-card {
    background: #fff;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(2, 6, 23, 0.34);
    overflow: hidden;
}

.auth-hero {
    background: linear-gradient(160deg, #0f766e, #0f172a);
    color: #e2e8f0;
    min-height: 100%;
    padding: 32px;
}

.auth-form {
    padding: 32px;
}

.auth-logo {
    height: 52px;
    width: 52px;
}

.footer-bar {
    border-top: 1px solid var(--app-border);
    color: var(--app-muted);
}

@media (max-width: 991.98px) {
    .app-main,
    body.sidebar-collapsed .app-main {
        margin-left: 0;
    }

    .content-wrap {
        padding: 16px;
    }
}

@media (max-width: 575.98px) {
    .content-card .card-header,
    .content-card .card-body,
    .card > .card-header,
    .card > .card-body,
    .auth-form,
    .auth-hero {
        padding: 18px;
    }

    .page-title {
        font-size: 25px;
    }

    .table-actions {
        justify-content: flex-start;
    }
}

@media print {
    .app-sidebar,
    .top-navbar,
    .no-print,
    .dt-buttons,
    .dt-search,
    .dt-length,
    .dt-info,
    .dt-paging,
    footer {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .app-main {
        margin-left: 0;
    }

    .content-wrap {
        padding: 0;
    }

    .card,
    .content-card {
        border: 0;
        box-shadow: none;
    }
}
