/* This file changes existing pages only when dark mode is explicitly selected. */
.sb-theme-toggle[hidden] { display: none !important; }
.sb-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 44px;
  padding: .35rem .65rem;
  border: 1px solid #c8d3dc;
  border-radius: .45rem;
  background: transparent;
  color: #172b3b;
  font: inherit;
  cursor: pointer;
}
.sb-theme-toggle:hover { background: #e7f3ef; }
.sb-theme-toggle:focus-visible { outline: 3px solid #007e6b; outline-offset: 3px; }
.sb-theme-toggle [data-sb-theme-icon] { font-size: 1.25em; line-height: 1; }
.sb-home-topbar > .sb-theme-toggle { order: 2; min-height: 40px; }
.sb-home-topbar > .navbar-collapse { order: 1; }
@media (max-width: 991.98px) {
  .sb-home-topbar > .sb-theme-toggle { order: 0; margin-left: auto; }
  .sb-home-topbar > .navbar-collapse { order: 3; }
}

html[data-sb-theme="dark"] {
  color-scheme: dark;
  --sb-bg: #0f172a;
  --sb-surface: #111827;
  --sb-surface-subtle: #162238;
  --sb-sidebar: #0b1220;
  --sb-text: #e5e7eb;
  --sb-text-muted: #a9b4c4;
  --sb-gold: #e1b65f;
  --sb-gold-light: #e1b65f;
  --sb-emerald: #34d3b4;
  --sb-emerald-dark: #6ee7ce;
  --sb-border: #334155;
  --sb-border-strong: #64748b;
  --sb-focus: #6ee7ce;
  --sb-shadow: 0 9px 26px rgba(0, 0, 0, .3);
  --sb-hover: #193b3b;
  --sb-value-bg: #173c3a;
  --sb-hero-text: #eefbf7;
  --sb-hero-overlay: rgba(11, 18, 32, .78);
  --sb-track: #334155;
}
html[data-sb-theme="dark"] body {
  color: var(--sb-text);
  background: var(--sb-bg);
}
html[data-sb-theme="dark"] #page-content-wrapper { min-width: 0; width: 100%; }
html[data-sb-theme="dark"] :is(a, .font-teal, .card-header-button) { color: #6ee7ce; }
html[data-sb-theme="dark"] a:hover { color: #a7f3e2; }
html[data-sb-theme="dark"] :is(.text-muted, .text-secondary, .gray, .help-text) { color: var(--sb-text-muted) !important; }
html[data-sb-theme="dark"] :is(.text-dark, .text-body, .text-black-50, .font-nav, .font-black) { color: var(--sb-text) !important; }
html[data-sb-theme="dark"] :is(.bg-light, .bg-white, .card, .card-header, .card-footer,
  .list-group-item, .modal-content, .dropdown-menu, .popover, .popover-header, .popover-body,
  .select-pure__select, .select-pure__options, .select-pure__option, .lines-wrapper, .bottom-title,
  .copy-button, .bbcodetable, .content-border, .content-border-head, .tribalwarsbg, .fading-, .fading-paint) {
  color: var(--sb-text) !important;
  background: var(--sb-surface) !important;
  border-color: var(--sb-border) !important;
}
html[data-sb-theme="dark"] :is(.navbar, #sidebar-wrapper, .footer-center) {
  color: var(--sb-text);
  background: var(--sb-sidebar) !important;
  border-color: var(--sb-border) !important;
}
html[data-sb-theme="dark"] :is(.navbar-light .navbar-nav .nav-link, .dropdown-item, .list-group-item-action) {
  color: var(--sb-text);
}
html[data-sb-theme="dark"] :is(.navbar-light .navbar-nav .nav-link:hover, .navbar-light .navbar-nav .nav-link:focus) {
  color: var(--sb-emerald-dark);
}
html[data-sb-theme="dark"] .navbar-toggler { border-color: var(--sb-border-strong); }
html[data-sb-theme="dark"] .navbar-light .navbar-toggler-icon { filter: invert(1) grayscale(1) brightness(2); }
html[data-sb-theme="dark"] :is(.dropdown-divider, hr, .border, .border-top, .border-bottom, .border-right, .border-left) {
  border-color: var(--sb-border) !important;
}
html[data-sb-theme="dark"] :is(.dropdown-item, .list-group-item-action):is(:hover, :focus),
html[data-sb-theme="dark"] :is(.focus-side-link, .selected, .select-pure__option--selected) {
  color: var(--sb-text) !important;
  background: var(--sb-hover) !important;
}
html[data-sb-theme="dark"] :is(input:not([type="submit"]):not([type="button"]), textarea, select,
  .form-control, .custom-select, .select-pure__autocomplete, .bootstrap-timepicker-widget) {
  color: var(--sb-text);
  background-color: var(--sb-sidebar);
  border-color: var(--sb-border-strong);
}
html[data-sb-theme="dark"] :is(input, textarea)::placeholder { color: var(--sb-text-muted); opacity: 1; }
html[data-sb-theme="dark"] :is(.form-control, .custom-select):disabled,
html[data-sb-theme="dark"] .form-control[readonly] { background-color: #233046; color: #bac4d1; }
html[data-sb-theme="dark"] :is(.input-group-text, .page-link, .btn-light, .btn-light-no-border, .btn-outline-secondary) {
  background: var(--sb-surface);
  color: var(--sb-text);
  border-color: var(--sb-border-strong);
}
html[data-sb-theme="dark"] :is(.btn-light, .page-link, .btn-outline-secondary):hover { background: var(--sb-hover); }
html[data-sb-theme="dark"] :is(.btn-ocean, .btn-primary, .btn-success, .page-item.active .page-link) {
  background: #007462; border-color: #168d79; color: #fff;
}
html[data-sb-theme="dark"] :is(.btn-ocean, .btn-primary, .btn-success):hover { background: #005f50; color: #fff; }
html[data-sb-theme="dark"] :is(.btn-secondary, .badge-secondary, .select-pure__selected-label) {
  background: #334155; color: #f1f5f9; border-color: #64748b;
}
html[data-sb-theme="dark"] :is(.btn-info, .badge-info, .bg-info, .bg-primary) {
  background: #006b5a !important; color: white !important; border-color: #168b78;
}
html[data-sb-theme="dark"] .bg-success { background: #176b46 !important; color: white !important; }
html[data-sb-theme="dark"] .bg-warning { background: #544015 !important; color: #fff1bb !important; }
html[data-sb-theme="dark"] .bg-danger { color: white !important; }
html[data-sb-theme="dark"] :is(.btn-outline-ocean, .text-info, .text-success, .check2-green, .lock-green) { color: #6ee7ce !important; }
html[data-sb-theme="dark"] :is(.font-red, .text-danger, .md-error, .xcircle-red, .nobleman-blocked-value,
  .invalid-feedback, .errorlist, .error-text) { color: #fda4af !important; }
html[data-sb-theme="dark"] :is(.md-correct, .md-correct2) { color: #86efac !important; }
html[data-sb-theme="dark"] :is(.md-blue, .text-primary) { color: #93c5fd !important; }
html[data-sb-theme="dark"] :is(.is-invalid, .CodeMirror-Invalid) { border-color: #fb7185 !important; }
html[data-sb-theme="dark"] :is(.alert-danger, .bg-error, .line-error, .table-danger) { background: #491e2c !important; color: #fecdd3 !important; border-color: #be526b; }
html[data-sb-theme="dark"] .alert-warning { background: #422f15; color: #fde68a; border-color: #a57829; }
html[data-sb-theme="dark"] :is(.alert-success, .alert-info, .alert-primary, .table-success, .table-info, .table-primary) { background: #163c38; color: #b1f3e3; border-color: #337e70; }
html[data-sb-theme="dark"] :is(.alert-light, .alert-dark, .alert-secondary, .table-light) {
  background: var(--sb-surface); color: var(--sb-text); border-color: var(--sb-border);
}
html[data-sb-theme="dark"] :is(.close, .close:hover) { color: var(--sb-text); text-shadow: none; }
html[data-sb-theme="dark"] .table { color: var(--sb-text); }
html[data-sb-theme="dark"] .table :is(th, td),
html[data-sb-theme="dark"] table.dataTable :is(th, td) { border-color: var(--sb-border) !important; }
html[data-sb-theme="dark"] .table-striped tbody tr:nth-of-type(odd) { background: rgba(148, 163, 184, .07); }
html[data-sb-theme="dark"] .table-hover tbody tr:hover { color: var(--sb-text); background: var(--sb-hover); }
html[data-sb-theme="dark"] :is(.th-front, .front-True, .paint, .fancy-th-btn, .fancy-building-btn) {
  color: var(--sb-text) !important; background: #193b3b !important;
}
html[data-sb-theme="dark"] :is(.row-expired, .table-secondary) { background: #293449 !important; color: #cbd5e1 !important; }
html[data-sb-theme="dark"] .night-shipment { background: #30394d !important; }
html[data-sb-theme="dark"] .fancy-building-True { background: #24554e !important; }
html[data-sb-theme="dark"] :is(.sb-exact-order, .table-warning) { background: #543718 !important; color: #ffedc2 !important; }
html[data-sb-theme="dark"] .sb-inline-surface { background-color: var(--sb-surface) !important; color: var(--sb-text) !important; }
html[data-sb-theme="dark"] .sb-inline-heading { background-color: #115e59 !important; color: #fff !important; }
html[data-sb-theme="dark"] .sb-inline-text { color: var(--sb-text) !important; }
html[data-sb-theme="dark"] .sb-inline-link { color: #6ee7ce !important; }
html[data-sb-theme="dark"] .sb-inline-danger { color: #fda4af !important; }
html[data-sb-theme="dark"] .sb-inline-success { color: #86efac !important; }
html[data-sb-theme="dark"] .sb-inline-info { color: #93c5fd !important; }
html[data-sb-theme="dark"] .sb-inline-warning { background: #422f15 !important; color: #fde68a !important; }
html[data-sb-theme="dark"] .sb-inline-muted { color: var(--sb-text-muted) !important; }
html[data-sb-theme="dark"] .sb-inline-danger-bg { background-color: #9f1239 !important; color: #fff !important; }
/* Bootstrap outline buttons keep their meaning instead of inheriting the global link color. */
html[data-sb-theme="dark"] .btn-outline-ocean:is(:hover, :active, .active) { background: #007462 !important; color: #fff !important; }
html[data-sb-theme="dark"] :is(a, button).btn-outline-danger { color: #fda4af; border-color: #fb7185; }
html[data-sb-theme="dark"] :is(a, button).btn-outline-primary { color: #93c5fd; border-color: #60a5fa; }
html[data-sb-theme="dark"] :is(a, button).btn-outline-danger:is(:hover, :active, .active) { color: #fff; background: #be123c; border-color: #be123c; }
html[data-sb-theme="dark"] :is(a, button).btn-outline-primary:is(:hover, :active, .active) { color: #fff; background: #1d4ed8; border-color: #1d4ed8; }
html[data-sb-theme="dark"] .nav-tabs { border-color: var(--sb-border); }
html[data-sb-theme="dark"] .nav-tabs .nav-link:hover { border-color: var(--sb-border); }
html[data-sb-theme="dark"] .nav-tabs :is(.nav-link.active, .nav-item.show .nav-link) {
  background: var(--sb-surface); color: var(--sb-text); border-color: var(--sb-border) var(--sb-border) var(--sb-surface);
}
html[data-sb-theme="dark"] :is(.t-tab-teal, .t-tab-teal:hover, .nav-link.ocean-tab-left,
  .nav-link.ocean-tab-mid, .nav-link.ocean-tab-right) {
  background: var(--sb-surface); color: var(--sb-text) !important; border-color: var(--sb-border); box-shadow: none;
}
html[data-sb-theme="dark"] :is(.t-tab-teal.t-tab-teal-active, .nav-link.active.ocean-tab-left,
  .nav-link.active.ocean-tab-mid, .nav-link.active.ocean-tab-right) {
  background: #155e56; color: #fff !important; box-shadow: inset 0 3px var(--sb-emerald);
}
html[data-sb-theme="dark"] .CodeMirror { background: var(--sb-sidebar); color: var(--sb-text); border-color: var(--sb-border) !important; }
html[data-sb-theme="dark"] :is(.CodeMirror.CodeMirror-Invalid, .border-invalid) { border-color: #fb7185 !important; }
html[data-sb-theme="dark"] .CodeMirror-gutters { background: var(--sb-surface); border-color: var(--sb-border); }
html[data-sb-theme="dark"] .CodeMirror-linenumber { color: #a9b4c4; }
html[data-sb-theme="dark"] .CodeMirror-cursor { border-left-color: #f1f5f9; }
html[data-sb-theme="dark"] .CodeMirror-selected { background: #334b64 !important; }
html[data-sb-theme="dark"] .CodeMirror-activeline-background { background: #1a2a40; }
html[data-sb-theme="dark"] .cm-error { color: #fecdd3; background: #491e2c; }
html[data-sb-theme="dark"] .cm-number { color: #e1b65f; }
html[data-sb-theme="dark"] .cm-string { color: #86efac; }
html[data-sb-theme="dark"] .cm-comment { color: #a9b4c4; }
html[data-sb-theme="dark"] :is(.cm-keyword, .cm-atom) { color: #c4b5fd; }
html[data-sb-theme="dark"] :is(.cm-variable, .cm-property, .cm-def) { color: #93c5fd; }
html[data-sb-theme="dark"] .datepicker { color: var(--sb-text); background: var(--sb-surface); }
html[data-sb-theme="dark"] .datepicker table tr :is(td.day:hover, td.focused, th:hover) { background: var(--sb-hover); color: var(--sb-text); }
html[data-sb-theme="dark"] .datepicker table tr td:is(.old, .new, .disabled) { color: var(--sb-text-muted); }
html[data-sb-theme="dark"] .datepicker table tr td:is(.active, .active:hover, .selected) {
  background: #007462; color: white; text-shadow: none;
}
html[data-sb-theme="dark"] .datepicker table tr td.today { background: #543718; color: #fde68a; }
html[data-sb-theme="dark"] .bootstrap-timepicker-widget table td a:hover {
  color: var(--sb-text); background: var(--sb-hover); border-color: var(--sb-border);
}
html[data-sb-theme="dark"] :is(.progress, .sb-home-progress) { background: var(--sb-track); }
html[data-sb-theme="dark"] .progress-bar { background-color: #007462; color: white; }
html[data-sb-theme="dark"] .sb-theme-toggle { border-color: var(--sb-border-strong); color: var(--sb-text); }
html[data-sb-theme="dark"] .sb-theme-toggle:hover { background: var(--sb-hover); }
html[data-sb-theme="dark"] .bi-bell[fill="rgba(0,0,0,.5)"] { fill: var(--sb-text-muted); }
html[data-sb-theme="dark"] .bi-bell[fill="red"] { fill: #fda4af; }
html[data-sb-theme="dark"] .bi-bell[style*="rgba"] { fill: var(--sb-text-muted) !important; }
html[data-sb-theme="dark"] #reset-span[style*="rgba"] { color: var(--sb-text-muted) !important; }
html[data-sb-theme="dark"] :is(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 3px solid var(--sb-focus); outline-offset: 3px;
}
/* Homepage keeps the same geometry; only its palette changes. */
html[data-sb-theme="dark"] body.sb-home-light :is(.sb-home-stats-panel, .sb-home-stats-table th) {
  background: var(--sb-surface);
}
html[data-sb-theme="dark"] body.sb-home-light .sb-home-hero { background-color: var(--sb-sidebar); }
html[data-sb-theme="dark"] body.sb-home-light .sb-home-hero::before { background: var(--sb-hero-overlay); }
html[data-sb-theme="dark"] body.sb-home-light :is(.sb-home-hero-title, .sb-home-register) {
  color: var(--sb-hero-text); text-shadow: 0 1px 5px #0b1220;
}
html[data-sb-theme="dark"] body.sb-home-light .sb-home-hero span { background: transparent !important; }
html[data-sb-theme="dark"] body.sb-home-light .sb-home-hero-title .sb-home-gold-text { color: var(--sb-gold); }
html[data-sb-theme="dark"] body.sb-home-light :is(.sb-home-register a, .sb-home-footer a) { color: var(--sb-emerald-dark); }
html[data-sb-theme="dark"] body.sb-home-light .sb-home-stats-title { color: var(--sb-text); }
html[data-sb-theme="dark"] body.sb-home-light .sb-home-stat-value { color: #d4fff2; background: var(--sb-value-bg); }
html[data-sb-theme="dark"] body.sb-home-light .sb-home-stats-table tbody tr:hover th { background: var(--sb-hover); }
html[data-sb-theme="dark"] body.sb-home-light .sb-home-main { background: var(--sb-bg); }
html[data-sb-theme="dark"] body.sb-home-light .sb-home-stats-table th:first-child img {
  filter: invert(83%) sepia(47%) saturate(506%) hue-rotate(345deg) brightness(95%);
}
@media (prefers-reduced-motion: reduce) {
  .sb-theme-toggle { transition: none; }
  body.sb-home-light #sidebar-wrapper,
  html[data-sb-theme="dark"] #sidebar-wrapper { transition: none; }
}
