/* Screen-only palette shared by the customer shells. Source rules retain their
 * existing light values as fallbacks. A receipt therefore prints in light mode. */
:root {
  --ninja-control-border: var(--ninja-dark-control-border, #7a879a);
  --ninja-control-focus: var(--ninja-dark-focus, #174ea6);
}

:root[data-ninja-theme="dark"] {
  --ninja-dark-page: #101318;
  --ninja-dark-surface: #191e26;
  --ninja-dark-raised: #222933;
  --ninja-dark-muted-surface: #272f3a;
  --ninja-dark-border: #354050;
  --ninja-dark-border-soft: #2b3441;
  --ninja-dark-control-border: #69788e;
  --ninja-dark-title: #eef2f7;
  --ninja-dark-text: #d4dce7;
  --ninja-dark-muted: #aab7c9;
  --ninja-dark-subtle: #8b9bb1;
  --ninja-dark-link: #a5c6ff;
  --ninja-dark-link-hover: #d5e5ff;
  --ninja-dark-focus: #a5c6ff;
  --ninja-dark-blue-surface: #1e2d46;
  --ninja-dark-blue-hover: #293d5d;
  --ninja-dark-blue-border: #435f88;
  --ninja-dark-green-text: #8de5b3;
  --ninja-dark-green-surface: #19352c;
  --ninja-dark-green-border: #386951;
  --ninja-dark-amber-text: #ffd094;
  --ninja-dark-amber-surface: #382c21;
  --ninja-dark-amber-border: #795337;
  --ninja-dark-red-text: #ffadb9;
  --ninja-dark-red-surface: #3a252e;
  --ninja-dark-red-border: #804252;
  --ninja-dark-cyan-text: #8ddfed;
  --ninja-dark-cyan-surface: #1b333d;
  --ninja-dark-cyan-border: #376579;
  --ninja-dark-violet-text: #d1bdff;
  --ninja-dark-violet-surface: #2f2848;
  --ninja-dark-violet-border: #615080;
  --ninja-dark-shadow: rgba(0, 0, 0, .3);
  --ninja-dark-focus-ring: 0 0 0 3px #8bb7ff;
}

:root[data-ninja-theme="dark"] body {
  color: var(--ninja-dark-text);
}

.ninja-theme-picker:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ninja-dark-text, #4b5563);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.ninja-theme-picker select {
  min-height: 44px;
  max-width: 100%;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid var(--ninja-control-border);
  border-radius: 8px;
  background-color: var(--ninja-dark-surface, #fff);
  color: var(--ninja-dark-title, #1f2937);
  font: inherit;
}

.ninja-theme-picker select:focus-visible {
  outline: 2px solid var(--ninja-control-focus);
  outline-offset: 2px;
}

/* Legacy widgets come from Bootstrap and the bundled alert libraries. */
:root[data-ninja-theme="dark"] :where(.modal-content, .dropdown-menu, .popover, .list-group-item, .page-link, .card, .card-header, .card-footer, .swal-modal, .swal2-popup) {
  background-color: var(--ninja-dark-surface);
  border-color: var(--ninja-dark-border);
  color: var(--ninja-dark-text);
}

:root[data-ninja-theme="dark"] :where(.swal-title, .swal-text, .swal2-title, .swal2-content, .swal2-html-container, .popover-header, .popover-body, .dropdown-item, .close, .swal2-close) {
  color: var(--ninja-dark-title);
}

:root[data-ninja-theme="dark"] :where(.swal2-popup) :is(.swal2-title, .swal2-content, .swal2-html-container, .swal2-close) {
  color: var(--ninja-dark-title);
}

:root[data-ninja-theme="dark"] div:where(.swal2-container) div:where(.swal2-popup) {
  background-color: var(--ninja-dark-surface);
  color: var(--ninja-dark-text);
}

:root[data-ninja-theme="dark"] :where(.modal-header, .modal-footer, .dropdown-divider, .table th, .table td, .swal-footer) {
  border-color: var(--ninja-dark-border);
}

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

:root[data-ninja-theme="dark"] :where(.table-striped tbody tr:nth-of-type(odd), .table-hover tbody tr:hover, .dropdown-item:hover, .dropdown-item:focus, .page-link:hover, .popover-header) {
  background-color: var(--ninja-dark-raised);
  color: var(--ninja-dark-title);
}

:root[data-ninja-theme="dark"] :where(.form-control, .custom-select, .custom-file-label, .input-group-text, .swal-content__input, .swal2-input, .swal2-textarea),
:root[data-ninja-theme="dark"] .custom-control-label::before {
  background-color: var(--ninja-dark-surface);
  border-color: var(--ninja-dark-control-border);
  color: var(--ninja-dark-title);
}

:root[data-ninja-theme="dark"] :where(.form-control, .custom-select, .custom-file-label, .swal2-input, .swal2-textarea):focus {
  background-color: var(--ninja-dark-surface);
  border-color: var(--ninja-dark-focus);
  color: var(--ninja-dark-title);
}

:root[data-ninja-theme="dark"] :where(.form-control, .custom-select, .swal2-input, .swal2-textarea):focus-visible {
  outline: 2px solid var(--ninja-dark-focus);
  outline-offset: 2px;
}

:root[data-ninja-theme="dark"] .custom-control-input:checked ~ .custom-control-label::before {
  border-color: var(--ninja-dark-focus);
  background-color: #3868b9;
}

:root[data-ninja-theme="dark"] .custom-control-input:focus-visible ~ .custom-control-label::before {
  outline: 2px solid var(--ninja-dark-focus);
  outline-offset: 2px;
}

:root[data-ninja-theme="dark"] :where(.form-control, .swal2-input, .swal2-textarea)::placeholder {
  color: var(--ninja-dark-subtle);
  opacity: 1;
}

:root[data-ninja-theme="dark"] :where(.form-control, .custom-select):is(:disabled, [readonly]) {
  background-color: var(--ninja-dark-raised);
  color: var(--ninja-dark-muted);
}

:root[data-ninja-theme="dark"] .swal-icon--success::before,
:root[data-ninja-theme="dark"] .swal-icon--success::after,
:root[data-ninja-theme="dark"] .swal-icon--success__hide-corners {
  background-color: var(--ninja-dark-surface);
}

:root[data-ninja-theme="dark"] :where(.c3 text) {
  fill: var(--ninja-dark-muted);
}

:root[data-ninja-theme="dark"] :where(.c3-axis path, .c3-axis line, .c3-grid line) {
  stroke: var(--ninja-dark-border);
}

:root[data-ninja-theme="dark"] :where(.c3-tooltip td, .c3-tooltip th) {
  background: var(--ninja-dark-raised);
  border-color: var(--ninja-dark-border);
  color: var(--ninja-dark-text);
}

:root[data-ninja-theme="dark"] :where(.note-editor .note-editing-area, .note-editor .note-editable, .note-editor .note-toolbar, .note-editor .note-statusbar, .note-editor .note-btn) {
  background-color: var(--ninja-dark-surface);
  border-color: var(--ninja-dark-border);
  color: var(--ninja-dark-text);
}

:root[data-ninja-theme="dark"] :where(.note-editor .note-btn):is(:hover, :focus-visible, .active) {
  background-color: var(--ninja-dark-raised);
  color: var(--ninja-dark-title);
}

/* Bootstrap/Stisla utility rules already use !important. */
:root[data-ninja-theme="dark"] :where(.text-muted) {
  color: var(--ninja-dark-muted) !important;
}

:root[data-ninja-theme="dark"] :where(.bg-white, .bg-light, .bg-whitesmoke) {
  background-color: var(--ninja-dark-raised) !important;
}
