:root {
--scn-link: #2563eb;
--scn-link-hover: #1d4ed8;
--scn-focus-ring: rgba(59, 130, 246, 0.25);
--scn-btn-primary: #3b82f6;
--scn-btn-primary-hover: #2563eb;
--scn-btn-secondary-bg: #eff6ff;
--scn-btn-secondary-text: #1e40af;
--scn-btn-border: #bfdbfe;
--scn-btn-danger: #ef4444;
--scn-btn-danger-hover: #dc2626;
--scn-header-bg: #ffffff;
--scn-header-border: #dbeafe;
--scn-sidebar-bg: #f8fbff;
--scn-sidebar-border: #dbeafe;
--scn-sidebar-text: #1e3a8a;
--scn-sidebar-muted: #475569;
--scn-sidebar-active-bg: #dbeafe;
--scn-sidebar-active-text: #1e40af;
--scn-tbl-bg: #ffffff;
--scn-tbl-border: #e2e8f0;
--scn-tbl-head-bg: #eff6ff;
--scn-tbl-head-color: #1e3a8a;
--scn-tbl-head-border: #bfdbfe;
--scn-tbl-cell-color: #0f172a;
--scn-tbl-row-hover: #f0f7ff;
}

h2, h4 {
  border-radius: 0;
  background: transparent;
  color: #1e293b;
}
h2 { font-size: 1.5rem; font-weight: 700; }
h4 { font-size: 1.125rem; font-weight: 600; }

/* ── Table Wrapper ───────────────────────────── */
.table-responsive {
border-radius: 10px;
border: 1px solid var(--scn-tbl-border);
box-shadow: 0 1px 8px rgba(15, 23, 42, 0.06);
overflow: visible !important;
background: var(--scn-tbl-bg);
}

/* ── Table Base Reset ────────────────────────── */
table {
width: 100%;
border-collapse: collapse;
background: var(--scn-tbl-bg);
margin-bottom: 0;
}

.table-responsive > table,
.table-responsive > .table {
border: none;
border-radius: 0;
margin-bottom: 0;
}

/* ── Bootstrap 5 CSS variable overrides ──────── */
.table,
.table-striped,
.table-hover,
.table-bordered,
.table-sm {
--bs-table-bg: var(--scn-tbl-bg);
--bs-table-striped-bg: var(--scn-tbl-bg);
--bs-table-hover-bg: var(--scn-tbl-row-hover);
--bs-table-border-color: var(--scn-tbl-border);
--bs-table-color: var(--scn-tbl-cell-color);
--bs-table-striped-color: var(--scn-tbl-cell-color);
--bs-table-hover-color: var(--scn-tbl-cell-color);
--bs-table-accent-bg: transparent;
}

.table-primary {
--bs-table-bg: var(--scn-tbl-head-bg);
--bs-table-border-color: var(--scn-tbl-border);
--bs-table-striped-bg: var(--scn-tbl-head-bg);
--bs-table-hover-bg: var(--scn-tbl-head-bg);
--bs-table-color: var(--scn-tbl-head-color);
--bs-table-striped-color: var(--scn-tbl-head-color);
}

/* ── thead (uses <td> not <th> in many templates) */
table thead tr th,
table thead tr td {
background: var(--scn-tbl-head-bg) !important;
color: var(--scn-tbl-head-color) !important;
font-size: 0.8rem;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
border-bottom: 2px solid var(--scn-tbl-head-border) !important;
border-top: none;
padding: 0.58rem 0.85rem;
white-space: nowrap;
}

/* ── tbody cells ─────────────────────────────── */
table td {
font-size: 0.875rem;
color: var(--scn-tbl-cell-color);
background: transparent;
border-bottom: 1px solid var(--scn-tbl-border);
padding: 0.58rem 0.85rem;
vertical-align: middle;
}

table th {
font-size: 0.8rem;
font-weight: 700;
color: var(--scn-tbl-head-color);
background: var(--scn-tbl-head-bg);
border-bottom: 2px solid var(--scn-tbl-head-border);
padding: 0.58rem 0.85rem;
}

/* ── rows ────────────────────────────────────── */
table tbody tr {
background: var(--scn-tbl-bg);
transition: background-color 0.12s ease-in-out;
}

table tbody tr:nth-child(even) td,
table tbody tr:nth-child(odd) td {
background: transparent;
}

table tbody tr:hover td {
background: var(--scn-tbl-row-hover) !important;
}

/* Inactive rows have inline style="background-color:…" on <tr>.
   Keep td transparent so the tr color shows; dim on hover. */
table tbody tr[style*="background"] td { background: transparent; }
table tbody tr[style*="background"]:hover td { filter: brightness(0.96); background: transparent !important; }

table tbody tr:last-child td { border-bottom: none; }

.table-bordered > :not(caption) > * > * { border-color: var(--scn-tbl-border); }

/* ── action buttons inside tables ────────────── */
table .btn, table a.btn {
font-size: 0.74rem !important;
padding: 0.15rem 0.48rem !important;
height: 26px;
line-height: 1.6;
border-radius: 7px !important;
font-weight: 600;
}

table .btn + .btn,
table a.btn + a.btn,
table .btn + a.btn,
table a.btn + .btn { margin-left: 2px; }

/* ── badges inside tables ────────────────────── */
table .badge, table p.badge {
font-size: 0.72rem !important;
font-weight: 600;
border-radius: 999px !important;
padding: 0.28em 0.65em !important;
display: inline-block;
}

table .badge-success,   table p.badge-success   { background-color: #16a34a !important; color: #fff !important; }
table .badge-danger,    table p.badge-danger     { background-color: #dc2626 !important; color: #fff !important; }
table .badge-warning,   table p.badge-warning    { background-color: #d97706 !important; color: #fff !important; }
table .badge-info,      table p.badge-info       { background-color: #0ea5e9 !important; color: #fff !important; }
table .badge-primary,   table p.badge-primary    { background-color: #2563eb !important; color: #fff !important; }
table .badge-secondary, table p.badge-secondary  { background-color: #64748b !important; color: #fff !important; }
table .badge-dark,      table p.badge-dark       { background-color: #1e293b !important; color: #fff !important; }
table .badge-light,     table p.badge-light      { background-color: #f1f5f9 !important; color: #334155 !important; }

/* ── Sortable columns ────────────────────────── */
table thead .scn-sortable {
cursor: pointer;
user-select: none;
}

table thead .scn-sortable:hover {
background: #e0edff !important;
}

i.scn-sort-icon {
font-size: 0.65rem;
opacity: 0.28;
margin-left: 3px;
vertical-align: middle;
transition: opacity 0.12s ease, color 0.12s ease;
}

table thead .scn-sortable:hover i.scn-sort-icon { opacity: 0.65; }

i.scn-sort-icon.scn-sort-active {
opacity: 1;
color: var(--scn-btn-primary);
}

/* ── Column header icons ─────────────────────── */
i.scn-col-icon {
font-size: 0.73rem;
opacity: 0.5;
margin-right: 4px;
vertical-align: middle;
}

/* ── Empty state ─────────────────────────────── */
.scn-empty-cell {
text-align: center !important;
padding: 3rem 1rem !important;
color: #94a3b8;
font-size: 0.88rem;
background: #fafcff !important;
}

.scn-empty-icon {
display: block;
font-size: 2rem;
opacity: 0.25;
margin-bottom: 0.5rem;
}

/* ── Row selection ───────────────────────────── */
table tbody tr.scn-row-selected td {
background: #eff6ff !important;
}

table tbody tr.scn-row-selected {
box-shadow: inset 3px 0 0 var(--scn-btn-primary);
}

/* ── Badge icons ─────────────────────────────── */
table .badge i.bi, table p.badge i.bi {
font-size: 0.7rem;
vertical-align: middle;
margin-right: 3px;
}

/* ── Row-count badge ─────────────────────────── */
.table-responsive { position: relative; }

.scn-row-count {
position: absolute;
bottom: 0;
right: 0;
background: #eff6ff;
color: #1e40af;
font-size: 0.7rem;
font-weight: 700;
padding: 0.18rem 0.55rem;
border-radius: 8px 0 10px 0;
border-top: 1px solid var(--scn-tbl-border);
border-left: 1px solid var(--scn-tbl-border);
letter-spacing: 0.02em;
pointer-events: none;
}

/* ── Mobile card view ────────────────────────── */
@media (max-width: 575px) {
  .table-responsive {
    border: none !important;
    box-shadow: none !important;
    background: none !important;
    overflow: visible !important;
    padding-bottom: 0;
  }

  .scn-row-count { display: none; }

  table, thead, tbody, tr, th, td { display: block !important; }

  table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
    visibility: hidden;
  }

  table tbody tr {
    border: 1px solid var(--scn-tbl-border) !important;
    border-radius: 10px;
    margin-bottom: 0.65rem;
    padding: 0.35rem 0;
    background: var(--scn-tbl-bg) !important;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    transition: box-shadow 0.12s ease;
  }

  table tbody tr:hover {
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.1);
  }

  /* Inactive rows get a left accent strip */
  table tbody tr[style*="background"] {
    border-left: 3px solid #f87171 !important;
    background: #fff8f8 !important;
  }

  table tbody td {
    border: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 0.38rem 0.75rem !important;
    display: flex !important;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.83rem;
    background: transparent !important;
    min-height: 0;
  }

  table tbody td:last-child { border-bottom: none !important; }

  table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 88px;
    flex-shrink: 0;
    padding-top: 0.1rem;
  }

  table tbody td:first-child::before { content: "#"; }
}

/* ── Print ───────────────────────────────────── */
@media print {
  .table-responsive {
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  table {
    font-size: 9.5pt;
    border-collapse: collapse !important;
  }

  table thead tr th,
  table thead tr td {
    background: #dbeafe !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    position: static !important;
    box-shadow: none !important;
  }

  table tbody tr:hover td { background: transparent !important; }

  table .btn, table a.btn { display: none !important; }

  .scn-row-count { display: none !important; }
}

/* ── Sticky thead ────────────────────────────── */
.table-responsive table thead,
.table-responsive .table thead {
position: sticky;
top: 0;
z-index: 2;
}

/* Re-paint head bg so content doesn't bleed through during scroll */
.table-responsive table thead tr th,
.table-responsive table thead tr td {
background: var(--scn-tbl-head-bg) !important;
box-shadow: 0 1px 0 var(--scn-tbl-head-border);
}

/* ── Checkbox alignment in table ─────────────── */
table thead input[type="checkbox"],
table tbody input[type="checkbox"] {
margin: 0;
vertical-align: middle;
accent-color: var(--scn-btn-primary);
width: 14px;
height: 14px;
cursor: pointer;
}

/* ── Row cursor for rows containing action links ─*/
table tbody tr { cursor: default; }
table tbody tr td a.btn { cursor: pointer; }

/* ── Row counter cell (narrow first col) ─────── */
table tbody tr td:first-child {
color: #94a3b8;
font-size: 0.78rem;
white-space: nowrap;
}

/* ── Pagination ──────────────────────────────── */
.pagination {
gap: 3px;
flex-wrap: wrap;
margin-top: 0.75rem;
}

.page-item .page-link {
border-radius: 8px !important;
border: 1px solid var(--scn-tbl-border);
color: var(--scn-link);
font-size: 0.82rem;
font-weight: 600;
padding: 0.28rem 0.62rem;
min-width: 34px;
text-align: center;
line-height: 1.45;
transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
background: #ffffff;
box-shadow: none !important;
}

.page-item.active .page-link {
background: var(--scn-btn-primary) !important;
border-color: var(--scn-btn-primary) !important;
color: #ffffff !important;
}

.page-item.disabled .page-link {
color: #94a3b8 !important;
border-color: #e2e8f0 !important;
background: #f8fafc !important;
pointer-events: none;
}

.page-item .page-link:hover:not([aria-current]) {
background: var(--scn-tbl-row-hover) !important;
border-color: #93c5fd !important;
color: var(--scn-link-hover) !important;
}

/* Record count text below pagination */
.pagination ~ b,
nav b.pagination {
display: block;
text-align: center;
font-size: 0.8rem;
color: #64748b;
margin-top: 0.4rem;
font-weight: 500;
}

a,
.link,
.page-link {
color: var(--scn-link);
text-decoration-color: rgba(37, 99, 235, 0.3);
text-underline-offset: 2px;
transition: color 0.15s ease-in-out, text-decoration-color 0.15s ease-in-out;
}

a:hover,
.link:hover,
.page-link:hover {
color: var(--scn-link-hover);
text-decoration-color: rgba(29, 78, 216, 0.6);
}

a:focus-visible,
.btn:focus-visible,
button:focus-visible {
outline: none;
box-shadow: 0 0 0 0.2rem var(--scn-focus-ring);
border-radius: 8px;
}

.btn,
button,
input[type="button"],
input[type="submit"] {
border-radius: 10px !important;
font-weight: 600;
transition: all 0.15s ease-in-out;
}

.btn-primary,
button.btn-primary {
background-color: var(--scn-btn-primary) !important;
border-color: var(--scn-btn-primary) !important;
color: #ffffff !important;
}

.btn-primary:hover,
.btn-primary:focus,
button.btn-primary:hover,
button.btn-primary:focus {
background-color: var(--scn-btn-primary-hover) !important;
border-color: var(--scn-btn-primary-hover) !important;
}

.btn-secondary,
button.btn-secondary,
.btn-light {
background-color: var(--scn-btn-secondary-bg) !important;
border-color: var(--scn-btn-border) !important;
color: var(--scn-btn-secondary-text) !important;
}

.btn-secondary:hover,
.btn-light:hover,
button.btn-secondary:hover {
background-color: #dbeafe !important;
border-color: #93c5fd !important;
color: #1d4ed8 !important;
}

.btn-danger,
button.btn-danger {
background-color: var(--scn-btn-danger) !important;
border-color: var(--scn-btn-danger) !important;
}

.btn-danger:hover,
.btn-danger:focus,
button.btn-danger:hover,
button.btn-danger:focus {
background-color: var(--scn-btn-danger-hover) !important;
border-color: var(--scn-btn-danger-hover) !important;
}

form label,
.form-label,
.control-label {
color: #334155;
font-size: 0.88rem;
font-weight: 600;
margin-bottom: 0.35rem;
}

form input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
form select,
form textarea,
.form-control:not([type="checkbox"]):not([type="radio"]),
.form-select,
.form-control-sm:not([type="checkbox"]):not([type="radio"]),
.form-control-lg:not([type="checkbox"]):not([type="radio"]) {
background-color: #ffffff !important;
border: 1px solid #cbd5e1 !important;
border-radius: 8px !important;
color: #0f172a !important;
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

form input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
form select,
.form-control:not([type="checkbox"]):not([type="radio"]),
.form-select {
min-height: 36px;
}

form textarea,
textarea.form-control {
min-height: 84px;
resize: vertical;
}

form input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):focus,
form select:focus,
form textarea:focus,
.form-control:not([type="checkbox"]):not([type="radio"]):focus,
.form-select:focus {
background-color: #ffffff !important;
border-color: #3b82f6 !important;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18) !important;
outline: none !important;
}

form input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"])::placeholder,
form textarea::placeholder,
.form-control::placeholder {
color: #94a3b8 !important;
opacity: 1;
}

form input:not([type="checkbox"]):not([type="radio"]):disabled,
form select:disabled,
form textarea:disabled,
.form-control:disabled,
.form-select:disabled {
background-color: #f1f5f9 !important;
border-color: #e2e8f0 !important;
color: #64748b !important;
cursor: not-allowed;
opacity: 1;
}

form input:not([type="checkbox"]):not([type="radio"])[readonly],
form textarea[readonly],
.form-control[readonly] {
background-color: #f8fafc !important;
border-color: #e2e8f0 !important;
color: #475569 !important;
}

.is-invalid,
.form-control.is-invalid,
.form-select.is-invalid,
.was-validated .form-control:invalid,
.was-validated .form-select:invalid {
border-color: #ef4444 !important;
box-shadow: none !important;
}

.is-invalid:focus,
.form-control.is-invalid:focus,
.form-select.is-invalid:focus,
.was-validated .form-control:invalid:focus,
.was-validated .form-select:invalid:focus {
border-color: #ef4444 !important;
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16) !important;
}

.is-valid,
.form-control.is-valid,
.form-select.is-valid,
.was-validated .form-control:valid,
.was-validated .form-select:valid {
border-color: #22c55e !important;
box-shadow: none !important;
}

.is-valid:focus,
.form-control.is-valid:focus,
.form-select.is-valid:focus,
.was-validated .form-control:valid:focus,
.was-validated .form-select:valid:focus {
border-color: #22c55e !important;
box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16) !important;
}

.input-group-text {
background-color: #f8fafc !important;
border: 1px solid #cbd5e1 !important;
border-radius: 8px !important;
color: #475569 !important;
font-weight: 600;
}

.input-group > .form-control:not(:first-child),
.input-group > .form-select:not(:first-child),
.input-group > .input-group-text:not(:first-child) {
border-top-left-radius: 0 !important;
border-bottom-left-radius: 0 !important;
}

.input-group > .form-control:not(:last-child),
.input-group > .form-select:not(:last-child),
.input-group > .input-group-text:not(:last-child) {
border-top-right-radius: 0 !important;
border-bottom-right-radius: 0 !important;
}

.form-check-input,
input[type="checkbox"],
input[type="radio"] {
box-shadow: none;
}

.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
min-height: 36px;
background-color: #ffffff !important;
border: 1px solid #cbd5e1 !important;
border-radius: 8px !important;
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
color: #0f172a !important;
transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
color: #0f172a !important;
line-height: 34px !important;
padding-left: 0.75rem !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
min-height: 34px;
}

.select2-container--default .select2-selection--multiple {
padding: 0.12rem 0.35rem;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: #eff6ff !important;
border: 1px solid #bfdbfe !important;
border-radius: 6px !important;
color: #1e40af !important;
font-weight: 600;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default .select2-selection--single:focus,
.select2-container--default .select2-selection--multiple:focus {
border-color: #3b82f6 !important;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18) !important;
outline: none !important;
}

.select2-dropdown {
border: 1px solid #cbd5e1 !important;
border-radius: 8px !important;
box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12) !important;
overflow: hidden;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color: #eff6ff !important;
color: #1e40af !important;
}

/* Remove shadcn theme on tabs/pills (even when tab anchors carry btn classes) */
.nav-tabs,
.nav-pills {
gap: 0.35rem;
}

.nav-tabs .nav-item,
.nav-pills .nav-item {
margin-bottom: 0.2rem;
}

.nav-tabs .nav-link,
.nav-pills .nav-link,
.nav-tabs .btn,
.nav-pills .btn,
.nav-tabs a[class*="btn"],
.nav-pills a[class*="btn"] {
border-radius: 0 !important;
font-weight: 500 !important;
font-size: 0.82rem !important;
letter-spacing: 0.01em;
line-height: 1.15;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.28rem;
white-space: nowrap;
text-decoration: none !important;
box-shadow: none !important;
background: transparent !important;
border: none !important;
color: #495057 !important;
padding: 0.5rem 0.75rem !important;
}

.nav-tabs .nav-link i,
.nav-pills .nav-link i,
.nav-tabs .btn i,
.nav-pills .btn i {
font-size: 0.78rem;
opacity: 0.9;
}

.nav-tabs .nav-link:hover,
.nav-pills .nav-link:hover,
.nav-tabs .btn:hover,
.nav-pills .btn:hover,
.nav-tabs a[class*="btn"]:hover,
.nav-pills a[class*="btn"]:hover {
background: #f8f9fa !important;
color: #212529 !important;
box-shadow: none !important;
}

.nav-tabs .nav-link.active,
.nav-pills .nav-link.active,
.nav-tabs .active[class*="btn"],
.nav-pills .active[class*="btn"],
.nav-tabs .nav-item.active > a,
.nav-pills .nav-item.active > a {
color: #ffffff !important;
background: #0d6efd !important;
border: 1px solid #0d6efd !important;
border-bottom: 1px solid #0d6efd !important;
border-radius: 0.375rem !important;
font-weight: 600 !important;
}

/* Inner status tabs: lighter highlight than outer tabs */
#ex1 .nav-link.active,
#ex1 .active[class*="btn"],
#ex1 .nav-item.active > a {
color: #0f3f8f !important;
background: #bfdbfe !important;
border: 1px solid #93c5fd !important;
border-bottom: 1px solid #93c5fd !important;
}

#ex1 .nav-link,
#ex1 .btn,
#ex1 a[class*="btn"] {
font-size: 0.8rem !important;
padding: 0.42rem 0.68rem !important;
}

#header.header {
background: var(--scn-header-bg) !important;
border-bottom: 1px solid var(--scn-header-border) !important;
box-shadow: 0 2px 12px rgba(37, 99, 235, 0.07);
}

#header .logo img {
filter: saturate(1.02);
}

#header .toggle-sidebar-btn {
color: #1d4ed8;
border-radius: 8px;
padding: 0.25rem 0.4rem;
transition: background-color 0.15s ease, color 0.15s ease;
}

#header .toggle-sidebar-btn:hover {
background: #eff6ff;
color: #1e40af;
}

#header .nav-profile {
border: 1px solid var(--scn-header-border);
border-radius: 999px;
padding: 0.25rem 0.55rem !important;
background: #f8fbff;
}

#header .nav-profile b,
#header .nav-profile span {
color: #0f172a !important;
}

#header .dropdown-menu.profile {
border: 1px solid var(--scn-header-border);
border-radius: 12px;
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

#sidebar.sidebar {
background: var(--scn-sidebar-bg) !important;
border-right: 1px solid var(--scn-sidebar-border);
box-shadow: inset -1px 0 0 rgba(219, 234, 254, 0.65);
overflow-y: auto !important;
scrollbar-width: thin !important;
}

#sidebar .sidebar-nav .nav-link {
color: var(--scn-sidebar-text) !important;
border-radius: 10px;
margin: 2px 8px;
padding: 0.55rem 0.75rem;
transition: all 0.15s ease-in-out;
}

#sidebar .sidebar-nav .nav-link i,
#sidebar .sidebar-nav .nav-link span {
color: inherit !important;
}

#sidebar .sidebar-nav .nav-link:hover,
#sidebar .sidebar-nav .nav-link.active {
background: var(--scn-sidebar-active-bg) !important;
color: var(--scn-sidebar-active-text) !important;
}

#sidebar .sidebar-nav .nav-content a {
color: var(--scn-sidebar-muted) !important;
border-radius: 8px;
margin: 1px 8px;
}

#sidebar .sidebar-nav .nav-content a:hover,
#sidebar .sidebar-nav .nav-content a.active {
background: #eff6ff !important;
color: #1e40af !important;
}

#sidebar .sidebar-nav .nav-content a i {
color: #60a5fa !important;
}

.select2-close-mask{
z-index: 2099;
}
.select2-dropdown{
z-index: 3051;
}

.select2-container {
width: 100% !important;
}

/* ── Main content background ──────────────────── */
#main {
  background: #f1f5f9;
  min-height: 100vh;
}

/* ── Card enhancements ───────────────────────── */
.card {
  border: 1px solid #e2e8f0;
  border-radius: 14px !important;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}

.card-header {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
  border-radius: 14px 14px 0 0 !important;
  padding: 0.8rem 1.2rem;
  font-weight: 700;
  color: #1e293b;
  font-size: 0.9rem;
}

.card-body { padding: 1.1rem 1.2rem; }

.card-title {
  font-size: 1rem !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin-bottom: 0.6rem !important;
}

/* ── Alert / Django messages ─────────────────── */
.alert {
  border-radius: 10px !important;
  border: none !important;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.7rem 1rem 0.7rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.alert-success { background: #f0fdf4 !important; color: #166534 !important; border-left: 4px solid #22c55e !important; }
.alert-danger  { background: #fef2f2 !important; color: #991b1b !important; border-left: 4px solid #ef4444 !important; }
.alert-warning { background: #fffbeb !important; color: #92400e !important; border-left: 4px solid #f59e0b !important; }
.alert-info    { background: #eff6ff !important; color: #1e40af !important; border-left: 4px solid #3b82f6 !important; }
.alert .btn-close { margin-left: auto; }

/* ── Modal ───────────────────────────────────── */
.modal-content {
  border: 1px solid #e2e8f0 !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.15) !important;
}
.modal-header {
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 1.3rem 0.9rem;
  border-radius: 16px 16px 0 0;
}
.modal-footer {
  border-top: 1px solid #e2e8f0;
  padding: 0.8rem 1.3rem;
  border-radius: 0 0 16px 16px;
  background: #f8fafc;
}
.modal-title { font-weight: 700; font-size: 1rem; color: #0f172a; }
.btn-close { opacity: 0.45; transition: opacity 0.12s ease; }
.btn-close:hover { opacity: 1; }

/* ── Dropdown menu ───────────────────────────── */
.dropdown-menu:not(.profile) {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.09);
  padding: 0.35rem 0;
}
.dropdown-item {
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
  padding: 0.42rem 0.9rem;
  border-radius: 6px;
  margin: 0.08rem 0.3rem;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.dropdown-item:hover, .dropdown-item:focus {
  background: #eff6ff;
  color: #1e40af;
}
.dropdown-item i, .dropdown-item .bi {
  font-size: 0.82rem;
  opacity: 0.65;
  margin-right: 0.42rem;
  width: 1rem;
  text-align: center;
}
.dropdown-divider { border-color: #e2e8f0; margin: 0.3rem 0; }

/* ── Badge (global) ──────────────────────────── */
:not(table) > .badge, :not(table) > p > .badge {
  font-size: 0.73rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.28em 0.65em;
  letter-spacing: 0.01em;
}

/* ── Progress bars ───────────────────────────── */
.progress {
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.progress-bar { border-radius: 999px; }

/* ── Back to top ─────────────────────────────── */
.back-to-top {
  background: var(--scn-btn-primary) !important;
  border-radius: 10px !important;
  width: 38px !important;
  height: 38px !important;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35) !important;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease !important;
}
.back-to-top:hover {
  background: var(--scn-btn-primary-hover) !important;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45) !important;
  transform: translateY(-2px);
}
.back-to-top i { color: #fff; font-size: 1.1rem; }

/* ── Thin elegant scrollbar ──────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }

/* ── List group ──────────────────────────────── */
.list-group-item {
  border-color: #e2e8f0;
  font-size: 0.875rem;
  color: #334155;
  padding: 0.55rem 0.9rem;
}
.list-group-item:first-child { border-radius: 10px 10px 0 0 !important; }
.list-group-item:last-child  { border-radius: 0 0 10px 10px !important; }
.list-group-item.active {
  background: var(--scn-btn-primary) !important;
  border-color: var(--scn-btn-primary) !important;
}
.list-group-item-action:hover { background: #eff6ff; color: #1e40af; }

/* ── Page title (NiceAdmin .pagetitle) ───────── */
.pagetitle { margin-bottom: 1rem; }
.pagetitle h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 0.15rem;
  background: transparent;
  border-radius: 0;
}
.pagetitle .breadcrumb { margin: 0; font-size: 0.8rem; }
.breadcrumb-item + .breadcrumb-item::before { color: #94a3b8; }
.breadcrumb-item a { color: var(--scn-link); }
.breadcrumb-item.active { color: #64748b; }

/* ── Divider ─────────────────────────────────── */
hr {
  border-color: #e2e8f0;
  opacity: 1;
  margin: 0.85rem 0;
}

/* ── Dashboard tab strip ─────────────────────── */
.nav-tabs.nav-tabs-bordered {
  border-bottom: 2px solid #e2e8f0;
  gap: 0;
  margin-bottom: 1.2rem;
  background: #fff;
  border-radius: 10px 10px 0 0;
  padding: 0.3rem 0.5rem 0;
}

.nav-tabs.nav-tabs-bordered .nav-link {
  border-radius: 8px 8px 0 0 !important;
  border: 1px solid transparent !important;
  border-bottom: none !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  color: #64748b !important;
  padding: 0.55rem 1rem !important;
  transition: color 0.15s ease, background-color 0.15s ease !important;
}

.nav-tabs.nav-tabs-bordered .nav-link:hover {
  color: #1e40af !important;
  background: #eff6ff !important;
}

.nav-tabs.nav-tabs-bordered .nav-link.active {
  color: #1e40af !important;
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  border-bottom-color: #ffffff !important;
  box-shadow: 0 -2px 0 0 #3b82f6 inset !important;
  font-weight: 700 !important;
}

/* ── Section dividers inside cards ──────────── */
.card .card-body + .card-body {
  border-top: 1px solid #e2e8f0;
}

/* ── Tooltip ─────────────────────────────────── */
.tooltip .tooltip-inner {
  background: #1e293b;
  border-radius: 7px;
  font-size: 0.78rem;
  padding: 0.32rem 0.62rem;
}
.tooltip.bs-tooltip-top .tooltip-arrow::before  { border-top-color: #1e293b; }
.tooltip.bs-tooltip-bottom .tooltip-arrow::before { border-bottom-color: #1e293b; }

/* ── Sidebar category headings ───────────────── */
#sidebar .sidebar-nav .nav-heading {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #94a3b8;
  padding: 0.65rem 0.9rem 0.25rem;
}

/* ── Interactive dashboard filter bar ────────── */
.filter-bar {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.04);
}

/* ════════════════════════════════════════════════════════
   Second pass — typography, stat cards, tables, forms
   ════════════════════════════════════════════════════════ */

/* ── Body base ───────────────────────────────── */
body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── h3, h5, h6 typography ───────────────────── */
h3, h5, h6 {
  background: transparent !important;
  border-radius: 0 !important;
  color: #1e293b;
}
h3 { font-size: 1.25rem; font-weight: 700; }
h5 { font-size: 0.9375rem; font-weight: 600; }
h6 { font-size: 0.8125rem; font-weight: 600; color: #475569; }

/* .card-title is typically an h5 in NiceAdmin */
.card-title {
  font-size: 0.9375rem !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  background: transparent !important;
  margin-bottom: 0.2rem;
  letter-spacing: -0.01em;
}

/* ── Text colour utilities — shadcn-aligned ──── */
.text-primary   { color: #2563eb !important; }
.text-secondary { color: #64748b !important; }
.text-success   { color: #16a34a !important; }
.text-danger    { color: #dc2626 !important; }
.text-warning   { color: #d97706 !important; }
.text-info      { color: #0284c7 !important; }
.text-muted     { color: #94a3b8 !important; }

/* ── NiceAdmin home stat cards ───────────────── */
.info-card,
.revenue-card,
.sales-card,
.customers-card {
  border-radius: 16px !important;
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.06) !important;
  border: 1px solid #e2e8f0 !important;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.info-card:hover,
.revenue-card:hover,
.sales-card:hover,
.customers-card:hover {
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.10) !important;
  transform: translateY(-2px);
}

/* Stat card icon circle */
.card-icon {
  width: 52px !important;
  height: 52px !important;
  border-radius: 14px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.5rem !important;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

/* Stat card h4 value number */
.info-card h4,
.revenue-card h4,
.sales-card h4,
.customers-card h4 {
  font-size: 1.75rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em !important;
  color: #0f172a !important;
  background: transparent !important;
  line-height: 1.1;
}

/* Stat card three-dots menu */
.info-card .filter,
.revenue-card .filter,
.sales-card .filter,
.customers-card .filter {
  color: #94a3b8;
  transition: color 0.12s;
}
.info-card .filter:hover,
.revenue-card .filter:hover,
.sales-card .filter:hover,
.customers-card .filter:hover {
  color: #475569;
}

/* ── Buttons ─────────────────────────────────── */
.btn {
  border-radius: 8px !important;
  font-size: 0.82rem !important;
  font-weight: 500 !important;
  letter-spacing: 0.01em;
  transition: all 0.15s ease !important;
}
.btn:active { transform: translateY(1px); }

/* Pill variant */
.btn-pill { border-radius: 9999px !important; }

/* Button group — round the end caps only */
.btn-group > .btn:first-child  { border-top-left-radius: 8px !important; border-bottom-left-radius: 8px !important; }
.btn-group > .btn:last-child   { border-top-right-radius: 8px !important; border-bottom-right-radius: 8px !important; }
.btn-group > .btn:not(:first-child):not(:last-child) { border-radius: 0 !important; }

/* Primary button */
.btn-primary {
  background: #2563eb !important;
  border-color: #2563eb !important;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.25) !important;
}
.btn-primary:hover {
  background: #1d4ed8 !important;
  border-color: #1d4ed8 !important;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.35) !important;
}

/* Secondary / outline */
.btn-outline-primary { color: #2563eb !important; border-color: #2563eb !important; }
.btn-outline-primary:hover { background: #2563eb !important; color: #fff !important; }

/* ── Badges ──────────────────────────────────── */
.badge {
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  padding: 0.28em 0.65em !important;
  letter-spacing: 0.01em;
}
.badge-success, .bg-success { background: #dcfce7 !important; color: #15803d !important; }
.badge-danger,  .bg-danger  { background: #fee2e2 !important; color: #b91c1c !important; }
.badge-warning, .bg-warning { background: #fef9c3 !important; color: #a16207 !important; }
.badge-info,    .bg-info    { background: #dbeafe !important; color: #1d4ed8 !important; }
.badge-primary, .bg-primary { background: #2563eb !important; color: #fff !important; }
.badge-secondary,.bg-secondary{ background: #f1f5f9 !important; color: #475569 !important; }

/* ── Tables ──────────────────────────────────── */
.table {
  font-size: 0.82rem;
  border-collapse: separate;
  border-spacing: 0;
}
.table thead th {
  background: #f8fafc !important;
  color: #475569 !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid #e2e8f0 !important;
  padding: 0.6rem 0.85rem !important;
  white-space: nowrap;
}
.table tbody td {
  padding: 0.55rem 0.85rem !important;
  vertical-align: middle !important;
  border-bottom: 1px solid #f1f5f9 !important;
  color: #334155;
}
.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: #f8fafc !important;
}
.table-striped > tbody > tr:nth-of-type(even) > * {
  background-color: #ffffff !important;
}
.table-hover tbody tr:hover > * {
  background: #eff6ff !important;
  color: #1e40af !important;
  transition: background 0.1s;
}
.table-sm td, .table-sm th { padding: 0.35rem 0.75rem !important; }

/* ── Forms (outside filter widget) ──────────── */
.form-control,
.form-select {
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  font-size: 0.85rem !important;
  color: #1e293b !important;
  background-color: #fff !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
  padding: 0.42rem 0.75rem !important;
}
.form-control:focus,
.form-select:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
  outline: none !important;
}
.form-control::placeholder { color: #94a3b8 !important; }
.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.3rem;
}

/* Input group search */
.input-group .form-control { border-right: none !important; }
.input-group .btn { border-left: none; }

/* ── Pagination ───────────────────────────────── */
.pagination .page-link {
  border-radius: 8px !important;
  border: 1px solid #e2e8f0 !important;
  color: #475569 !important;
  font-size: 0.82rem !important;
  font-weight: 500;
  padding: 0.38rem 0.72rem !important;
  margin: 0 2px;
  transition: all 0.13s ease !important;
}
.pagination .page-link:hover {
  background: #eff6ff !important;
  color: #2563eb !important;
  border-color: #bfdbfe !important;
}
.pagination .page-item.active .page-link {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3) !important;
}
.pagination .page-item.disabled .page-link {
  color: #cbd5e1 !important;
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

/* ── Alert overrides ─────────────────────────── */
.alert {
  border-radius: 10px !important;
  border: none !important;
  font-size: 0.85rem !important;
  padding: 0.8rem 1.1rem !important;
  margin-top: 0 !important;
}
.alert-success  { background: #f0fdf4 !important; color: #15803d !important; border-left: 4px solid #22c55e !important; }
.alert-danger   { background: #fef2f2 !important; color: #b91c1c !important; border-left: 4px solid #ef4444 !important; }
.alert-warning  { background: #fffbeb !important; color: #b45309 !important; border-left: 4px solid #f59e0b !important; }
.alert-info     { background: #f0f9ff !important; color: #0369a1 !important; border-left: 4px solid #38bdf8 !important; }

/* ── Semantic underline — border-bottom ──────── */
u, ins {
  text-decoration: none !important;
  border-bottom: 2px solid currentColor;
  padding-bottom: 1px;
}

/* ── Select2 global polish ───────────────────── */
.select2-container--default .select2-selection--single {
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  height: 36px !important;
  background: #fff !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 34px !important;
  font-size: 0.85rem !important;
  color: #1e293b !important;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}
.select2-dropdown {
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.10) !important;
  overflow: hidden;
}
.select2-container--default .select2-results__option--highlighted {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
}
.select2-container--default .select2-results__option--selected {
  background: #dbeafe !important;
  color: #1e40af !important;
}

/* ── Modal polish ────────────────────────────── */
.modal-content {
  border-radius: 16px !important;
  border: none !important;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18) !important;
  overflow: hidden;
}
.modal-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 1rem 1.25rem !important;
}
.modal-footer {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0 !important;
  padding: 0.8rem 1.25rem !important;
}
.modal-title { font-size: 1rem !important; font-weight: 700; color: #1e293b; }

/* ── Page header pagetitle ────────────────────── */
.pagetitle h1 {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  background: transparent !important;
  border-radius: 0 !important;
  margin-bottom: 0;
}
.pagetitle nav ol.breadcrumb {
  font-size: 0.78rem;
}
.breadcrumb-item + .breadcrumb-item::before { color: #94a3b8; }
.breadcrumb-item.active { color: #64748b; }
.breadcrumb-item a { color: #2563eb; text-decoration: none; }
.breadcrumb-item a:hover { color: #1d4ed8; }

/* ── Sidebar nav items ───────────────────────── */
#sidebar .nav-link {
  border-radius: 8px !important;
  font-size: 0.82rem !important;
  font-weight: 500;
  transition: background 0.13s, color 0.13s !important;
}
#sidebar .nav-link:hover {
  background: rgba(37, 99, 235, 0.07) !important;
  color: #2563eb !important;
}
#sidebar .nav-link.active {
  background: rgba(37, 99, 235, 0.10) !important;
  color: #2563eb !important;
  font-weight: 700 !important;
}