:root {
    --system-primary: #0F766E;
    --system-primary-hover: #115E59;
    --system-success: #15803D;
    --system-success-hover: #166534;
    --system-danger: #DC2626;
    --system-danger-hover: #B91C1C;
    --system-warning: #D97706;
    --system-warning-hover: #B45309;
    --system-info: #2563EB;
    --system-info-hover: #1D4ED8;
    --system-neutral: #4B5563;
    --system-neutral-hover: #374151;
    --system-button-text: #FFFFFF;
    --system-link: #4B5563;
    --system-link-hover: #1F2937;
    --system-primary-soft: #F3F4F6;
    --system-navy: #374151;
    --system-slate-950: #1F2937;
    --system-slate-900: #1F2937;
    --system-slate-800: #1F2937;
    --system-slate-700: #1F2937;
    --system-slate-600: #6B7280;
    --system-slate-500: #9CA3AF;
    --system-slate-300: #D1D5DB;
    --system-slate-200: #E5E7EB;
    --system-slate-100: #F3F4F6;
    --system-surface: #FFFFFF;
    --system-page: #F3F4F6;
    --system-shadow: 0 12px 30px rgba(31, 41, 55, 0.08);
}

html,
body {
    background: var(--system-page);
    color: var(--system-slate-900);
}

body.bg-gray-100,
.min-h-screen.bg-gray-100 {
    background: var(--system-page) !important;
}

body,
button,
input,
select,
textarea {
    font-family: "Figtree", "Segoe UI", sans-serif;
}

body {
    color: var(--system-slate-900);
}

body .bg-white.overflow-hidden,
body .bg-white,
body header.bg-white,
body nav.bg-white,
body .modal-content,
body .table,
body table,
body .form-control,
body .form-select,
body .card,
body .panel {
    background-color: var(--system-surface) !important;
    color: var(--system-slate-900) !important;
    border-color: var(--system-slate-200) !important;
    box-shadow: var(--system-shadow);
}

body .bg-white.overflow-hidden {
    border-radius: 14px;
}

body .bg-white.overflow-hidden > .p-6[style*="background-color: #6c757d"],
body .bg-white.overflow-hidden > div[style*="background-color: #6c757d"],
body .p-6[style*="background-color: #6c757d"],
body .header[style*="background-color: #6c757d"] {
    background: var(--system-navy) !important;
    color: #FFFFFF !important;
}

body .bg-white.overflow-hidden > div[style*="background-color: #6c757d"] *,
body .p-6[style*="background-color: #6c757d"] *,
body .header[style*="background-color: #6c757d"] * {
    color: #FFFFFF !important;
}

body .sidebar,
body .top-nav {
    background: var(--system-navy) !important;
    border-color: rgba(255, 255, 255, 0.12);
}

body .sidebar a:not(.btn):not(.nav-link),
body .sidebar .dropdown-btn,
body .top-nav a:not(.btn):not(.nav-link) {
    color: #FFFFFF !important;
}

body .sidebar a:not(.btn):not(.nav-link):hover,
body .sidebar .dropdown-btn:hover,
body .sidebar a.active,
body .top-nav a:not(.btn):not(.nav-link):hover {
    background-color: var(--system-primary) !important;
    color: #FFFFFF !important;
}

body .sidebar a .icon,
body .sidebar .dropdown-btn .icon {
    color: #FFFFFF;
}

body .sidebar a.active .icon,
body .sidebar a:hover .icon,
body .sidebar .dropdown-btn:hover .icon {
    color: #FFFFFF;
}

body nav.bg-white {
    background-color: var(--system-navy) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
}

body nav.bg-white > div,
body nav.bg-white .text-gray-500,
body nav.bg-white .text-gray-700,
body nav.bg-white .text-gray-800 {
    color: #FFFFFF !important;
}

body nav.bg-white .absolute.z-50 .text-gray-700 {
    color: var(--system-slate-900) !important;
}

body nav.bg-white .absolute.z-50 a:hover,
body nav.bg-white .absolute.z-50 a:focus {
    background-color: var(--system-slate-100) !important;
    color: var(--system-slate-900) !important;
}

body nav.bg-white button {
    border-color: rgba(255, 255, 255, 0.24) !important;
    background-color: var(--system-slate-900) !important;
    color: #FFFFFF !important;
}

body nav.bg-white button:hover,
body nav.bg-white button:focus {
    border-color: var(--system-slate-600) !important;
    background-color: var(--system-slate-800) !important;
    color: #FFFFFF !important;
}

body .btn,
body :where(button:not(.btn-close):not(.btn-link)),
body input[type="submit"],
body input[type="button"],
body .custom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45em;
    vertical-align: middle;
    border-color: var(--system-neutral);
    background: var(--system-primary) !important;
    color: var(--system-button-text) !important;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

body :where(
    .btn:hover:not(.btn-link):not(.btn-close):not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-info):not(.btn-secondary):not(.btn-light):not(.custom-btn),
    button:hover:not(.btn-close):not(.btn-link):not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-info):not(.btn-secondary):not(.btn-light):not(.custom-btn),
    input[type="submit"]:hover:not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-info):not(.btn-secondary):not(.btn-light):not(.custom-btn),
    input[type="button"]:hover:not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-info):not(.btn-secondary):not(.btn-light):not(.custom-btn)
) {
    border-color: var(--system-primary-hover) !important;
    background: var(--system-primary-hover) !important;
    color: #FFFFFF !important;
}

body .btn > i,
body .btn > svg,
body .btn > span > i,
body .btn > span > svg {
    flex: 0 0 auto;
    line-height: 1;
    color: inherit !important;
}

body .btn:focus-visible {
    outline: 3px solid rgba(107, 114, 128, 0.28);
    outline-offset: 2px;
    box-shadow: 0 0 0 0.15rem rgba(107, 114, 128, 0.18);
}

body .btn:disabled,
body .btn.disabled {
    cursor: not-allowed;
}

body .btn-primary,
body input.btn-primary,
body button.btn-primary,
body input[type="submit"] {
    border-color: var(--system-primary) !important;
    background: var(--system-primary) !important;
    color: var(--system-button-text);
    font-weight: 600;
}

body .btn-primary:hover,
body input.btn-primary:hover,
body button.btn-primary:hover,
body input[type="submit"]:hover {
    border-color: var(--system-primary-hover) !important;
    background: var(--system-primary-hover) !important;
    color: #fff !important;
}

body .btn-success,
body input.btn-success,
body button.btn-success {
    border-color: var(--system-success) !important;
    background: var(--system-success) !important;
    color: #fff !important;
}

body .btn-success:hover,
body input.btn-success:hover,
body button.btn-success:hover {
    border-color: var(--system-success-hover) !important;
    background: var(--system-success-hover) !important;
    color: #fff !important;
}

body .btn-danger,
body input.btn-danger,
body button.btn-danger,
body .btn:has(.fa-trash, .fa-trash-o, .fa-times, .fa-times-circle),
body button:has(.fa-trash, .fa-trash-o, .fa-times, .fa-times-circle) {
    border-color: var(--system-danger) !important;
    background: var(--system-danger) !important;
    color: #fff !important;
}

body .btn-danger:hover,
body input.btn-danger:hover,
body button.btn-danger:hover,
body .btn:has(.fa-trash, .fa-trash-o, .fa-times, .fa-times-circle):hover,
body button:has(.fa-trash, .fa-trash-o, .fa-times, .fa-times-circle):hover {
    border-color: var(--system-danger-hover) !important;
    background: var(--system-danger-hover) !important;
    color: #fff !important;
}

body .btn-warning,
body input.btn-warning,
body button.btn-warning {
    border-color: var(--system-warning) !important;
    background: var(--system-warning) !important;
    color: #fff !important;
}

body .btn-warning:hover,
body input.btn-warning:hover,
body button.btn-warning:hover {
    border-color: var(--system-warning-hover) !important;
    background: var(--system-warning-hover) !important;
    color: #fff !important;
}

body .btn-info,
body input.btn-info,
body button.btn-info,
body .btn:has(.fa-edit, .fa-pencil, .fa-pencil-square-o),
body button:has(.fa-edit, .fa-pencil, .fa-pencil-square-o) {
    border-color: var(--system-info) !important;
    background: var(--system-info) !important;
    color: #fff !important;
}

body .btn-info:hover,
body input.btn-info:hover,
body button.btn-info:hover,
body .btn:has(.fa-edit, .fa-pencil, .fa-pencil-square-o):hover,
body button:has(.fa-edit, .fa-pencil, .fa-pencil-square-o):hover {
    border-color: var(--system-info-hover) !important;
    background: var(--system-info-hover) !important;
    color: #fff !important;
}

body .btn-secondary,
body .custom-btn,
body .btn:has(.fa-eye, .fa-search, .fa-download, .fa-print),
body button:has(.fa-eye, .fa-search, .fa-download, .fa-print) {
    border-color: var(--system-neutral) !important;
    background: var(--system-neutral) !important;
    color: #fff !important;
}

body .btn-secondary:hover,
body .custom-btn:hover,
body .btn:has(.fa-eye, .fa-search, .fa-download, .fa-print):hover,
body button:has(.fa-eye, .fa-search, .fa-download, .fa-print):hover {
    border-color: var(--system-neutral-hover) !important;
    background: var(--system-neutral-hover) !important;
    color: #fff !important;
}

body .btn-light,
body .btn-outline-primary,
body .btn-outline-secondary,
body .btn-outline-success,
body .btn-outline-danger,
body .btn-outline-warning,
body .btn-outline-info {
    border-color: var(--system-slate-300) !important;
    background: #fff !important;
    color: var(--system-slate-800) !important;
}

body .btn-light:hover,
body .btn-outline-primary:hover,
body .btn-outline-secondary:hover,
body .btn-outline-success:hover,
body .btn-outline-danger:hover,
body .btn-outline-warning:hover,
body .btn-outline-info:hover {
    border-color: var(--system-slate-500) !important;
    background: var(--system-slate-100) !important;
    color: var(--system-slate-900) !important;
}

body .btn-outline-primary {
    border-color: var(--system-primary) !important;
    color: var(--system-primary) !important;
}

body .btn-outline-success {
    border-color: var(--system-success) !important;
    color: var(--system-success) !important;
}

body .btn-outline-danger {
    border-color: var(--system-danger) !important;
    color: var(--system-danger) !important;
}

body .btn-outline-warning {
    border-color: var(--system-warning) !important;
    color: var(--system-warning) !important;
}

body .btn-outline-info {
    border-color: var(--system-info) !important;
    color: var(--system-info) !important;
}

body .btn-outline-primary:hover {
    border-color: var(--system-primary) !important;
    background: var(--system-primary-soft) !important;
    color: var(--system-primary-hover) !important;
}

body .btn-outline-success:hover {
    border-color: var(--system-success) !important;
    background: #F0FDF4 !important;
    color: var(--system-success-hover) !important;
}

body .btn-outline-danger:hover {
    border-color: var(--system-danger) !important;
    background: #FEF2F2 !important;
    color: var(--system-danger-hover) !important;
}

body .btn-outline-warning:hover {
    border-color: var(--system-warning) !important;
    background: #FFFBEB !important;
    color: var(--system-warning-hover) !important;
}

body .btn-outline-info:hover {
    border-color: var(--system-info) !important;
    background: #EFF6FF !important;
    color: var(--system-info-hover) !important;
}

body .btn-link,
body button.btn-link {
    border-color: transparent !important;
    background: transparent !important;
    color: var(--system-primary) !important;
    box-shadow: none !important;
}

body .btn-link:hover,
body button.btn-link:hover {
    border-color: transparent !important;
    background: var(--system-primary-soft) !important;
    color: var(--system-primary-hover) !important;
}

body i[class*="fa-"] {
    color: var(--system-slate-600);
}

body .btn i[class*="fa-"],
body button i[class*="fa-"],
body .icon-wrapper i,
body .admin-quick-action-icon i,
body .sidebar i[class*="fa-"],
body .top-nav i[class*="fa-"] {
    color: inherit !important;
}

body .sidebar i[class*="fa-"],
body .top-nav i[class*="fa-"] {
    color: #fff !important;
}

body .text-success i[class*="fa-"] {
    color: var(--system-success) !important;
}

body .text-danger i[class*="fa-"] {
    color: var(--system-danger) !important;
}

body .text-warning i[class*="fa-"] {
    color: var(--system-warning) !important;
}

body .text-info i[class*="fa-"],
body .text-primary i[class*="fa-"] {
    color: var(--system-info) !important;
}

body a:not(.btn):not(.nav-link) {
    color: var(--system-link);
}

body a:not(.btn):not(.nav-link):hover {
    color: var(--system-link-hover);
}

body input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
body select,
body textarea,
body .form-control,
body .form-select {
    background-color: #FFFFFF !important;
    border-color: var(--system-slate-300);
    color: var(--system-slate-900);
}

body input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):focus,
body select:focus,
body textarea:focus,
body .form-control:focus,
body .form-select:focus {
    border-color: var(--system-primary);
    box-shadow: 0 0 0 0.2rem rgba(107, 114, 128, 0.18);
}

body input[type="checkbox"],
body input[type="radio"],
body .form-check-input {
    accent-color: var(--system-primary);
}

body .table,
body table {
    color: var(--system-slate-900);
}

body .table > thead,
body table > thead {
    background-color: var(--system-slate-100);
    color: var(--system-slate-900);
}

body .table > :not(caption) > * > *,
body table > :not(caption) > * > * {
    border-color: var(--system-slate-200);
}

body .table-hover > tbody > tr:hover > *,
body table tbody tr:hover > td {
    background-color: var(--system-primary-soft);
}

body .dataTables_wrapper .dataTables_paginate .paginate_button.current,
body .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    border-color: var(--system-primary) !important;
    background: var(--system-primary) !important;
    color: var(--system-button-text) !important;
}

body .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    border-color: var(--system-slate-300) !important;
    background: var(--system-primary-soft) !important;
    color: var(--system-slate-900) !important;
}

body .modal-content {
    border-color: var(--system-slate-200);
    border-radius: 12px;
    box-shadow: 0 16px 44px rgba(22, 50, 79, 0.12);
}

body .modal-header {
    border: 0;
    border-left: 4px solid var(--system-primary);
    background: var(--system-primary-soft);
    color: var(--system-slate-900);
}

body .modal-header .modal-title,
body .modal-header b {
    color: var(--system-slate-900);
    font-weight: 700;
}

body .modal-header .btn-close {
    opacity: 0.8;
}

body .modal-header .btn-close:hover {
    opacity: 1;
}

body .modal-body {
    background-color: var(--system-surface);
}

body .modal-footer {
    border-top-color: var(--system-slate-200);
    background-color: var(--system-slate-100);
}

body .alert-success {
    border-color: var(--system-slate-300);
    background-color: var(--system-slate-100);
    color: var(--system-slate-900);
}

body .alert-danger {
    border-color: var(--system-slate-300);
    background-color: var(--system-slate-100);
    color: var(--system-slate-900);
}

body .text-muted {
    color: var(--system-slate-500) !important;
}

body .content {
    color: var(--system-slate-800);
}

body .content h1,
body .content h2,
body .content h3,
body .content h4,
body .content h5,
body .content h6 {
    color: var(--system-slate-900);
    font-weight: 700;
}

body .content .card,
body .content .panel,
body .content .stats-box,
body .content .stat-card {
    border: 1px solid var(--system-slate-200);
    border-radius: 14px;
    background-color: var(--system-surface);
    box-shadow: var(--system-shadow);
}

body .content .card-header,
body .content .panel-heading {
    border-bottom: 1px solid var(--system-slate-200);
    background: var(--system-surface);
    color: var(--system-slate-900);
    font-weight: 700;
}

body .content .table-responsive,
body .content .table-container {
    border-radius: 10px;
}

body .content table thead th {
    background-color: var(--system-slate-100);
    color: var(--system-slate-700);
    font-weight: 700;
    vertical-align: middle;
}

body .content table tbody td {
    vertical-align: middle;
}

body .content .btn {
    min-height: 36px;
    border-radius: 8px;
    font-weight: 600;
}

body .content .btn-sm {
    min-height: 30px;
    border-radius: 7px;
}

body .content .btn-success,
body .content button.btn-success,
body .content input.btn-success {
    border-color: var(--system-success) !important;
    background: var(--system-success) !important;
    color: #fff !important;
}

body .content .btn-success:hover,
body .content button.btn-success:hover,
body .content input.btn-success:hover {
    border-color: var(--system-success-hover) !important;
    background: var(--system-success-hover) !important;
    color: #fff !important;
}

body .content .btn-danger,
body .content button.btn-danger {
    border-radius: 8px;
    font-weight: 600;
}

body .content .form-label,
body .content label {
    color: var(--system-slate-700);
    font-weight: 600;
}

body .content .form-control,
body .content .form-select,
body .content input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
body .content select,
body .content textarea {
    min-height: 38px;
    border: 1px solid var(--system-slate-300);
    border-radius: 8px;
    background-color: #fff;
    color: var(--system-slate-800);
}

body .content textarea {
    min-height: 96px;
}

body .content .form-control:focus,
body .content .form-select:focus,
body .content input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):focus,
body .content select:focus,
body .content textarea:focus {
    border-color: var(--system-primary);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.16);
}

body .modal .modal-content {
    overflow: hidden;
    border: 1px solid var(--system-slate-200) !important;
    border-radius: 16px !important;
    background: #fff !important;
    box-shadow: 0 20px 56px rgba(31, 41, 55, 0.2) !important;
}

/* Match legacy ID-scoped modal rules so every role uses the same header treatment. */
:is(body, #system-theme-specificity) .modal .modal-header {
    min-height: 64px;
    padding: 1rem 1.35rem !important;
    border: 0 !important;
    border-bottom: 1px solid var(--system-slate-200) !important;
    border-left: 4px solid var(--system-primary) !important;
    background: var(--system-primary-soft) !important;
    color: var(--system-slate-900) !important;
}

:is(body, #system-theme-specificity) .modal .modal-header * {
    color: var(--system-slate-900) !important;
}

:is(body, #system-theme-specificity) .modal .modal-header .modal-title,
:is(body, #system-theme-specificity) .modal .modal-header h1,
:is(body, #system-theme-specificity) .modal .modal-header h2,
:is(body, #system-theme-specificity) .modal .modal-header h3,
:is(body, #system-theme-specificity) .modal .modal-header h4,
:is(body, #system-theme-specificity) .modal .modal-header h5,
:is(body, #system-theme-specificity) .modal .modal-header h6 {
    margin-bottom: 0;
    color: var(--system-slate-900) !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
}

body .modal .modal-header .btn-close {
    border-radius: 8px;
    opacity: 0.65;
    filter: none;
}

body .modal .modal-header .btn-close:hover {
    opacity: 1;
}

body .modal .modal-body {
    padding: 1.35rem;
    background-color: #fff;
}

body .modal .modal-footer {
    gap: 0.5rem;
    padding: 0.9rem 1.35rem;
    border-top: 1px solid var(--system-slate-200);
    background-color: var(--system-slate-100);
}

body .modal .modal-footer .btn {
    min-width: 88px;
    border-radius: 8px;
    font-weight: 600;
}

body .notification-modal {
    position: fixed !important;
    inset: 0;
    z-index: 20000 !important;
    isolation: isolate;
}

body .notification-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(31, 41, 55, 0.62);
}

body .notification-modal-panel {
    position: relative;
    z-index: 1;
    max-height: min(38rem, calc(100vh - 2rem));
    overflow: hidden;
    border: 1px solid var(--system-slate-200);
    border-radius: 16px;
    background: var(--system-surface);
    box-shadow: 0 20px 56px rgba(31, 41, 55, 0.24);
}

body .notification-modal-list {
    min-height: 0;
    overflow-y: auto;
}

body .modal .modal-body .card,
body .modal .modal-body .panel {
    border-radius: 10px;
    box-shadow: none;
}

body .content .alert {
    border-radius: 10px;
}

body .content .dataTables_wrapper {
    color: var(--system-slate-700);
}

body .content .dataTables_wrapper .dataTables_filter input,
body .content .dataTables_wrapper .dataTables_length select {
    min-height: 36px;
    border: 1px solid var(--system-slate-300);
    border-radius: 8px;
    background: #fff;
}

body .content .dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 7px;
}

@media (max-width: 767.98px) {
    body .bg-white.overflow-hidden {
        border-radius: 12px;
    }

    body .modal .modal-dialog {
        margin: 0.75rem;
    }

    body .modal .modal-body {
        padding: 1rem;
    }

    body .modal .modal-footer {
        padding: 0.75rem 1rem;
    }
}
