/* Bootstrap components and the app's shared surfaces use the same palette. */
[data-bs-theme="dark"] {
  --lt-ink: #e6eaf2;
  --lt-ink-soft: #c3cad8;
  --lt-accent: #9fb6f2;
  --lt-accent-hover: #bccdf7;
  --lt-accent-soft: #24335a;
  --lt-paper: #1a2338;
  --lt-inset: #1f2a42;
  --lt-hover: #27334e;
  --lt-hairline: #2b3753;
  --lt-field-bg: #141c30;
  --lt-field-border: #6d7891;
  --lt-control-border: #3e4b69;
  --lt-success: #92c99d;
  --lt-success-soft: #1f3a29;
  --lt-attention: #f5c451;
  --lt-attention-bg: #3a2c0b;
  --lt-attention-border: #6b5212;
  --lt-danger: #f19a92;
  --lt-danger-soft: #3d1c1a;
  --lt-chevron: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2395a0b5' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  --bs-body-bg: #10172a;
  --bs-body-bg-rgb: 16, 23, 42;
  --bs-body-color: var(--lt-ink);
  --bs-body-color-rgb: 230, 234, 242;
  --bs-emphasis-color: #f5f7fb;
  --bs-emphasis-color-rgb: 245, 247, 251;
  --bs-secondary-color: #95a0b5;
  --bs-secondary-color-rgb: 149, 160, 181;
  --bs-secondary-rgb: 149, 160, 181;
  --bs-secondary-bg: var(--lt-paper);
  --bs-secondary-bg-rgb: 26, 35, 56;
  --bs-tertiary-bg: var(--lt-inset);
  --bs-tertiary-bg-rgb: 31, 42, 66;
  --bs-border-color: #34415f;
  --bs-primary: var(--lt-accent);
  --bs-primary-rgb: 159, 182, 242;
  --bs-primary-text-emphasis: #c9d6f9;
  --bs-primary-bg-subtle: var(--lt-accent-soft);
  --bs-primary-border-subtle: #3a4d7e;
  --bs-link-color: var(--lt-accent);
  --bs-link-color-rgb: 159, 182, 242;
  --bs-link-hover-color: #c9d6f9;
  --bs-link-hover-color-rgb: 201, 214, 249;
  --bs-focus-ring-color: #9fb6f255;
  --bs-danger-rgb: 240, 142, 138;
  color-scheme: dark;
}

/* Primary buttons on the dark palette are soft gold -- a gold tint, border and
   label rather than a solid fill, the same treatment as the header's New
   session -- since solid gold glares against the dark surfaces. */
[data-bs-theme="dark"] .btn-primary {
  --bs-btn-color: var(--lt-gold);
  --bs-btn-bg: rgba(255, 197, 61, .16);
  --bs-btn-border-color: rgba(255, 197, 61, .6);
  --bs-btn-hover-color: var(--lt-gold-hover);
  --bs-btn-hover-bg: rgba(255, 197, 61, .24);
  --bs-btn-hover-border-color: rgba(255, 197, 61, .8);
  --bs-btn-active-color: var(--lt-gold-hover);
  --bs-btn-active-bg: rgba(255, 197, 61, .3);
  --bs-btn-active-border-color: var(--lt-gold);
  --bs-btn-disabled-color: var(--lt-gold);
  --bs-btn-disabled-bg: rgba(255, 197, 61, .16);
  --bs-btn-disabled-border-color: rgba(255, 197, 61, .6);
  --bs-btn-focus-shadow-rgb: 255, 197, 61;
}

[data-bs-theme="dark"] .btn-outline-secondary {
  --bs-btn-color: var(--lt-ink);
  --bs-btn-border-color: var(--lt-field-border);
  --bs-btn-hover-border-color: var(--lt-accent);
  --bs-btn-active-border-color: var(--lt-accent);
}

[data-bs-theme="dark"] .btn-outline-primary {
  --bs-btn-color: var(--lt-accent);
  --bs-btn-border-color: var(--lt-accent);
  --bs-btn-hover-color: #0b1220;
  --bs-btn-hover-bg: var(--lt-accent);
  --bs-btn-hover-border-color: var(--lt-accent);
  --bs-btn-active-color: #0b1220;
  --bs-btn-active-bg: #c9d6f9;
  --bs-btn-active-border-color: #c9d6f9;
}

[data-bs-theme="dark"] .btn-outline-danger {
  --bs-btn-color: #f09e99;
  --bs-btn-border-color: #f09e99;
  --bs-btn-hover-color: #0b1220;
  --bs-btn-hover-bg: #f09e99;
  --bs-btn-hover-border-color: #f09e99;
  --bs-btn-active-color: #0b1220;
  --bs-btn-active-bg: #f6bdb9;
  --bs-btn-active-border-color: #f6bdb9;
}

/* Bootstrap pairs its light secondary fill with white text, which fails on the dark palette. */
[data-bs-theme="dark"] .text-bg-secondary {
  color: #0b1220 !important;
}

[data-bs-theme="dark"] .dropdown-menu {
  --bs-dropdown-link-active-color: #0b1220;
}

[data-bs-theme="dark"] .form-check-input:checked {
  background-color: #3a54a0;
  border-color: var(--lt-accent);
}

[data-bs-theme="dark"] :is(.form-control, .form-select):hover {
  border-color: var(--lt-accent);
}

[data-bs-theme="dark"] :is(.form-control, .form-select, trix-editor):focus {
  box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color);
}

[data-bs-theme="dark"] form.card {
  --bs-card-border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] :is(.resource-list-item:hover, .activity-row:hover) {
  background: var(--lt-inset);
}

[data-bs-theme="dark"] :is(.milestone-row, .note-row, .progress-log-row, .session-editor .practice-chip) {
  background: var(--lt-field-bg);
  border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] :is(.resource-focus-primary #notes, .template-focus-chip, .template-skill-focus) {
  border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] :is(.char-count.is-near-limit, .char-count-compact) {
  color: #e1b778;
}

[data-bs-theme="dark"] :is(.char-count.is-over-limit, .char-count-compact.is-over-limit) {
  color: #f09e99;
}

[data-bs-theme="dark"] .up-next-action.is-done { color: #92c99d; }
[data-bs-theme="dark"] .stone-current { color: #0b1220; }
[data-bs-theme="dark"] .un-page { --un-flame: #ffc53d; --un-flame-soft: #3a2c0b; --un-done: #92c99d; }

/* Trix uses black SVG icons and fixed light dialog colours. */
[data-bs-theme="dark"] .trix-button--icon::before { filter: invert(1); }
[data-bs-theme="dark"] .trix-dialog {
  background: var(--lt-paper);
  color: var(--lt-ink);
  border-color: var(--bs-border-color);
}
[data-bs-theme="dark"] .trix-dialog input {
  background: var(--lt-field-bg);
  color: var(--lt-ink);
}

/* The vendored grid theme predates Bootstrap's colour-mode variables. */
[data-bs-theme="dark"] .tabulator,
[data-bs-theme="dark"] .tabulator :is(.tabulator-header, .tabulator-col, .tabulator-footer, .tabulator-row, .tabulator-table) {
  background: var(--lt-paper);
  color: var(--lt-ink);
  border-color: var(--bs-border-color);
}
[data-bs-theme="dark"] .tabulator .tabulator-row:nth-child(even) { background: var(--lt-field-bg); }
[data-bs-theme="dark"] .tabulator .tabulator-row:hover { background: var(--lt-inset); }
[data-bs-theme="dark"] .tabulator :is(.tabulator-cell, .tabulator-header-contents) { border-color: var(--bs-border-color); }
[data-bs-theme="dark"] :is(.tabulator input, .tabulator select, .tabulator-edit-list) {
  background: var(--lt-field-bg);
  color: var(--lt-ink);
  border-color: var(--lt-field-border);
}

/* Unrated stars are a fixed light grey that reads as "filled" on the dark palette. */
[data-bs-theme="dark"] .skill-rating-star:not(.is-active) { color: #3e4a63; }
[data-bs-theme="dark"] .skill-rating-star:not(.is-active):hover { color: #7b88a3; }

[data-bs-theme="dark"] .skill-state-icon.is-scheduled { color: #6cc48a; }

/* Goals: the navy letter discs would vanish into the dark page. */
[data-bs-theme="dark"] :is(.goal-smart-letter, .goal-timeline-node.is-finish .goal-timeline-dot) {
  background: var(--lt-accent-soft);
  color: var(--lt-gold);
}
[data-bs-theme="dark"] :is(.btn-check:checked + .goal-confidence-option, .goal-preset[aria-pressed="true"]) { color: #10172a; }
