/* Dark values for the Cassie (Bootstrap 4) and main.css rules the dashboard renders.
   Both load after Bootstrap 5 and hard-code light colours, so data-bs-theme alone leaves
   these components light. Each rule repeats Cassie's selector inside
   :where([data-bs-theme="dark"]), which adds no specificity, and this file loads after
   Cassie: it replaces Cassie's value and nothing else (globals.css rules that already
   beat Cassie still win). Rules found by matching cassie.css and main.css against every
   page, open modals and menus included. Colours come from the --dash-* tokens in
   app/globals.css. */

:where([data-bs-theme="dark"]) body {
  color: var(--dash-text);
  background-color: var(--dash-page);
}

:where([data-bs-theme="dark"]) ::selection {
  color: #fff;
  background-color: var(--dash-primary);
}

/* --- Links --- */
:where([data-bs-theme="dark"]) a,
:where([data-bs-theme="dark"]) .btn-link,
:where([data-bs-theme="dark"]) .sidebar-logo,
:where([data-bs-theme="dark"]) .sidebar-logo:hover,
:where([data-bs-theme="dark"]) .sidebar-logo:focus {
  color: var(--dash-primary-ink);
}

:where([data-bs-theme="dark"]) a:hover,
:where([data-bs-theme="dark"]) .btn-link:hover {
  color: var(--dash-primary-text);
}

/* --- Shell --- */
:where([data-bs-theme="dark"]) .sidebar {
  background-color: var(--dash-surface);
  border-right-color: var(--dash-line);
}

:where([data-bs-theme="dark"]) .sidebar-header {
  border-bottom-color: var(--dash-line);
}

:where([data-bs-theme="dark"]) .component-section {
  border-top-color: var(--dash-line);
}

:where([data-bs-theme="dark"]) .content-title,
:where([data-bs-theme="dark"]) .card-title,
:where([data-bs-theme="dark"]) .modal-title {
  color: var(--dash-ink);
}

:where([data-bs-theme="dark"]) .content-body-components,
:where([data-bs-theme="dark"]) .component-section > h5,
:where([data-bs-theme="dark"]) .modal-body,
:where([data-bs-theme="dark"]) pre,
:where([data-bs-theme="dark"]) .breadcrumb .breadcrumb-item {
  color: var(--dash-text);
}

/* --- Cards, tables, pagination --- */
:where([data-bs-theme="dark"]) .card {
  background-color: var(--dash-surface);
  border-color: var(--dash-line);
}

:where([data-bs-theme="dark"]) .card-header,
:where([data-bs-theme="dark"]) .card-footer {
  background-color: var(--dash-surface-alt);
  border-color: var(--dash-line);
}

:where([data-bs-theme="dark"]) .table {
  color: var(--dash-text);
}

:where([data-bs-theme="dark"]) .table th,
:where([data-bs-theme="dark"]) .table td,
:where([data-bs-theme="dark"]) .table thead th,
:where([data-bs-theme="dark"]) .table tbody + tbody,
:where([data-bs-theme="dark"]) .table-bordered,
:where([data-bs-theme="dark"]) hr,
:where([data-bs-theme="dark"]) pre {
  border-color: var(--dash-line);
}

:where([data-bs-theme="dark"]) .table-bordered th,
:where([data-bs-theme="dark"]) .table-bordered td,
:where([data-bs-theme="dark"]) .border-top {
  border-color: var(--dash-line) !important;
}

:where([data-bs-theme="dark"]) caption {
  color: var(--dash-muted);
}

:where([data-bs-theme="dark"]) mark {
  color: var(--dash-warning-text);
  background-color: var(--dash-warning-bg);
}

:where([data-bs-theme="dark"]) .table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(255, 255, 255, 0.04);
}

:where([data-bs-theme="dark"]) .table-hover tbody tr:hover {
  color: var(--dash-ink);
  background-color: rgba(255, 255, 255, 0.07);
}

:where([data-bs-theme="dark"]) .page-link,
:where([data-bs-theme="dark"]) .page-item.disabled .page-link {
  color: var(--dash-primary-ink);
  background-color: var(--dash-surface);
  border-color: var(--dash-line);
}

:where([data-bs-theme="dark"]) .page-link:hover {
  color: var(--dash-primary-text);
  background-color: var(--dash-primary-tint);
  border-color: var(--dash-line);
}

:where([data-bs-theme="dark"]) .page-link:focus {
  color: var(--dash-ink);
  background-color: var(--dash-surface-alt);
}

:where([data-bs-theme="dark"]) .page-item.disabled .page-link {
  color: var(--dash-muted);
}

/* --- Fields --- */
:where([data-bs-theme="dark"]) input,
:where([data-bs-theme="dark"]) input[type="text"],
:where([data-bs-theme="dark"]) .form-control,
:where([data-bs-theme="dark"]) .form-control:focus,
:where([data-bs-theme="dark"]) .custom-select,
:where([data-bs-theme="dark"]) .header-search,
:where([data-bs-theme="dark"]) .header-search.active {
  color: var(--dash-text);
  background-color: var(--dash-surface);
  border-color: var(--dash-field-line);
}

:where([data-bs-theme="dark"]) .form-control:focus {
  border-color: var(--dash-primary);
}

:where([data-bs-theme="dark"]) .form-control::placeholder,
:where([data-bs-theme="dark"]) .header-search .form-control::placeholder {
  color: var(--dash-muted);
}

:where([data-bs-theme="dark"]) .header-search svg,
:where([data-bs-theme="dark"]) .header-search .form-control:focus {
  color: var(--dash-ink);
}

:where([data-bs-theme="dark"]) .form-control:disabled,
:where([data-bs-theme="dark"]) .form-control[readonly],
:where([data-bs-theme="dark"]) .custom-select:disabled {
  color: var(--dash-muted);
  background-color: var(--dash-surface-alt);
}

:where([data-bs-theme="dark"]) .input-group-text {
  color: var(--dash-text);
  background-color: var(--dash-secondary-bg);
  border-color: var(--dash-field-line);
}

:where([data-bs-theme="dark"]) .form-check-input:disabled ~ .form-check-label,
:where([data-bs-theme="dark"]) .btn-link:disabled,
:where([data-bs-theme="dark"]) .dropdown-item:disabled,
:where([data-bs-theme="dark"]) .breadcrumb .breadcrumb-item a,
:where([data-bs-theme="dark"]) .breadcrumb-item.active,
:where([data-bs-theme="dark"]) .breadcrumb-item + .breadcrumb-item::before {
  color: var(--dash-muted);
}

:where([data-bs-theme="dark"]) .progress,
:where([data-bs-theme="dark"]) .breadcrumb {
  background-color: var(--dash-secondary-bg);
}

/* --- Buttons: fills keep their light shades (white text 4.5:1+); outline buttons take
   the -ink shades for their text. A plain .btn (no btn-* variant) gets the body text;
   the :where() keeps this from outranking a variant. --- */
:where([data-bs-theme="dark"]) .btn:where(:not([class*="btn-"])),
:where([data-bs-theme="dark"]) .btn:where(:not([class*="btn-"])):hover {
  color: var(--dash-text);
}

:where([data-bs-theme="dark"]) .btn-outline-primary,
:where([data-bs-theme="dark"]) .btn-outline-primary:disabled {
  color: var(--dash-primary-ink);
}

:where([data-bs-theme="dark"]) .btn-outline-secondary,
:where([data-bs-theme="dark"]) .btn-outline-secondary:disabled {
  color: var(--dash-muted);
  border-color: var(--dash-field-line);
}

:where([data-bs-theme="dark"]) .btn-outline-danger,
:where([data-bs-theme="dark"]) .btn-outline-danger:disabled {
  color: var(--dash-danger-ink);
}

/* --- Menus, modals, alerts --- */
:where([data-bs-theme="dark"]) .dropdown-menu,
:where([data-bs-theme="dark"]) .modal-content {
  color: var(--dash-text);
  background-color: var(--dash-surface);
  border-color: var(--dash-line);
}

:where([data-bs-theme="dark"]) .dropdown-item,
:where([data-bs-theme="dark"]) .dropdown-item-text {
  color: var(--dash-text);
}

:where([data-bs-theme="dark"]) .dropdown-item:hover,
:where([data-bs-theme="dark"]) .dropdown-item:focus {
  color: var(--dash-ink);
  background-color: var(--dash-primary-tint);
}

:where([data-bs-theme="dark"]) .dropdown-divider,
:where([data-bs-theme="dark"]) .modal-header,
:where([data-bs-theme="dark"]) .modal-footer {
  border-color: var(--dash-line);
}

:where([data-bs-theme="dark"]) .toast {
  background-color: var(--dash-surface);
  border-color: var(--dash-line);
}

:where([data-bs-theme="dark"]) .close {
  color: var(--dash-ink);
}

:where([data-bs-theme="dark"]) .alert-success {
  color: var(--dash-success-text);
  background-color: var(--dash-success-bg);
  border-color: var(--dash-success-bg);
}

:where([data-bs-theme="dark"]) .alert-info {
  color: var(--dash-info-text);
  background-color: var(--dash-info-bg);
  border-color: var(--dash-info-bg);
}

:where([data-bs-theme="dark"]) .alert-warning {
  color: var(--dash-warning-text);
  background-color: var(--dash-warning-bg);
  border-color: var(--dash-warning-bg);
}

:where([data-bs-theme="dark"]) .alert-danger {
  color: var(--dash-danger-text);
  background-color: var(--dash-danger-bg);
  border-color: var(--dash-danger-bg);
}

:where([data-bs-theme="dark"]) .alert-light {
  color: var(--dash-text);
  background-color: var(--dash-surface-alt);
  border-color: var(--dash-line);
}

:where([data-bs-theme="dark"]) .alert .alert-link {
  color: inherit;
}

/* --- Utilities (Cassie sets these !important) --- */
:where([data-bs-theme="dark"]) .text-muted {
  color: var(--dash-muted) !important;
}

:where([data-bs-theme="dark"]) .text-dark {
  color: var(--dash-ink) !important;
}

:where([data-bs-theme="dark"]) .text-primary {
  color: var(--dash-primary-ink) !important;
}

:where([data-bs-theme="dark"]) .text-danger {
  color: var(--dash-danger-ink) !important;
}

:where([data-bs-theme="dark"]) a.text-primary:hover,
:where([data-bs-theme="dark"]) a.text-primary:focus,
:where([data-bs-theme="dark"]) a.text-dark:hover,
:where([data-bs-theme="dark"]) a.text-dark:focus {
  color: var(--dash-primary-text) !important;
}

:where([data-bs-theme="dark"]) a.text-success:hover,
:where([data-bs-theme="dark"]) a.text-success:focus {
  color: var(--dash-success-text) !important;
}

:where([data-bs-theme="dark"]) a.text-info:hover,
:where([data-bs-theme="dark"]) a.text-info:focus {
  color: var(--dash-info-text) !important;
}

:where([data-bs-theme="dark"]) a.text-warning:hover,
:where([data-bs-theme="dark"]) a.text-warning:focus {
  color: var(--dash-warning-text) !important;
}

:where([data-bs-theme="dark"]) a.text-danger:hover,
:where([data-bs-theme="dark"]) a.text-danger:focus {
  color: var(--dash-danger-text) !important;
}

:where([data-bs-theme="dark"]) .bg-white {
  background-color: var(--dash-surface) !important;
}

:where([data-bs-theme="dark"]) .bg-light {
  background-color: var(--dash-surface-alt) !important;
}

:where([data-bs-theme="dark"]) .border,
:where([data-bs-theme="dark"]) .border-bottom {
  border-color: var(--dash-line) !important;
}

/* --- main.css --- */
:where([data-bs-theme="dark"]) .search_region {
  border-color: var(--dash-line);
}
