/* ════════════════════════════════════════════════
   Dark Mode
   Applied when <html data-theme="dark"> is set.
   ════════════════════════════════════════════════ */

/* ── CSS variable overrides (covers all builder pages) ── */
[data-theme="dark"] {
    --parchment:        #1e1e2e;
    --parchment-dark:   #181825;
    --parchment-border: #45475a;

    --ink:       #cdd6f4;
    --ink-muted: #a6adc8;

    --blue:    #e8c87a;
    --blue-dk: #74a8f5;
    --blue-bg: rgba(232, 200, 122, 0.12);

    --green:  #a6e3a1;
    --red:    #f38ba8;
}

/* ── Global body & page ── */
[data-theme="dark"] body {
    background: #1e1e2e;
    color: #cdd6f4;
}

/* ── Sidebar / menu ── */
[data-theme="dark"] .sidebar {
    background:
        radial-gradient(ellipse at 50% 0%, rgba(184, 146, 42, 0.14) 0%, transparent 55%),
        linear-gradient(180deg, #120b04 0%, #1a1008 55%, #0d0d1a 100%);
    border-right-color: rgba(184, 146, 42, 0.22);
    box-shadow: 2px 0 18px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .sidebar-brand,
[data-theme="dark"] .sidebar-user,
[data-theme="dark"] .sidebar-guest {
    border-color: rgba(184, 146, 42, 0.15);
}

[data-theme="dark"] .sidebar-divider {
    background: rgba(184, 146, 42, 0.15);
}

[data-theme="dark"] .sidebar-ornament,
[data-theme="dark"] .sidebar-user-icon {
    color: #b8922a;
}

[data-theme="dark"] .sidebar-title {
    color: #f5e6c8;
}

[data-theme="dark"] .sidebar-subtitle {
    color: rgba(245, 230, 200, 0.42);
}

[data-theme="dark"] .sidebar-nav ul li a {
    color: rgba(245, 230, 200, 0.60);
}

[data-theme="dark"] .sidebar-nav ul li a i {
    color: rgba(184, 146, 42, 0.60);
}

[data-theme="dark"] .sidebar-nav ul li a:hover {
    background: rgba(184, 146, 42, 0.10);
    color: #f5e6c8;
}

[data-theme="dark"] .sidebar-nav ul li a:hover i {
    color: #b8922a;
}

[data-theme="dark"] .sidebar-soon a:hover {
    color: rgba(245, 230, 200, 0.45) !important;
}

[data-theme="dark"] .sidebar-soon a:hover i {
    color: rgba(184, 146, 42, 0.45) !important;
}

[data-theme="dark"] .sidebar-user-info {
    color: rgba(245, 230, 200, 0.75);
}

[data-theme="dark"] .sidebar-user-badge {
    background: rgba(184, 146, 42, 0.25);
    color: #b8922a;
    border-color: rgba(184, 146, 42, 0.40);
}

[data-theme="dark"] .sidebar-user-action {
    color: rgba(245, 230, 200, 0.50);
}

[data-theme="dark"] .sidebar-user-action:hover {
    background: rgba(184, 146, 42, 0.10);
    color: #f5e6c8;
}

[data-theme="dark"] .sidebar-guest-btn {
    color: rgba(245, 230, 200, 0.65);
    border-color: rgba(184, 146, 42, 0.20);
}

[data-theme="dark"] .sidebar-guest-btn:hover {
    background: rgba(184, 146, 42, 0.10);
    color: #f5e6c8;
    border-color: rgba(184, 146, 42, 0.40);
}

[data-theme="dark"] .sidebar-guest-primary {
    background: rgba(184, 146, 42, 0.15);
    border-color: rgba(184, 146, 42, 0.35);
    color: #f5e6c8;
}

[data-theme="dark"] .sidebar-guest-primary:hover {
    background: rgba(184, 146, 42, 0.25) !important;
}

/* ── Dark mode toggle button in sidebar ── */
[data-theme="dark"] .dark-mode-toggle {
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.dark-mode-toggle .toggle-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* ── Bootstrap overrides ── */
[data-theme="dark"] .alert {
    background: #313244;
    border-color: #45475a;
    color: #cdd6f4;
}

/* ── Character view: tab container ── */
[data-theme="dark"] .tab-container {
    background: #1e1e2e;
    border-color: #45475a;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .character-tabs .tab-button {
    background: #181825;
    border-color: #45475a;
    color: #a6adc8;
}

[data-theme="dark"] .character-tabs .tab-button:hover {
    background: #313244;
    color: #e8c87a;
    border-color: #e8c87a;
}

[data-theme="dark"] .character-tabs .tab-button.active {
    background: #e8c87a;
    color: #1e1e2e;
    border-color: #e8c87a;
    border-bottom-color: #1e1e2e;
}

[data-theme="dark"] .character-tabs ul {
    border-bottom-color: #45475a;
}

[data-theme="dark"] .character-info h1 { color: #cdd6f4; }
[data-theme="dark"] .character-info p  { color: #a6adc8; }

[data-theme="dark"] .character-avatar { border-color: #e8c87a; }
[data-theme="dark"] .action-btn { background: #3d2a06; }
[data-theme="dark"] .action-btn:hover { background: #78601a; box-shadow: 0 2px 8px rgba(232, 200, 122, 0.3); }

[data-theme="dark"] .character-avatar-placeholder {
    background: #313244;
    color: #6c7086;
}

[data-theme="dark"] .character-avatar-placeholder:hover {
    background: #45475a;
    color: #a6adc8;
}

/* ── Dropdown menu ── */
[data-theme="dark"] .dropdown-menu {
    background: #313244;
    border-color: #45475a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .dropdown-menu li {
    color: #cdd6f4;
}

[data-theme="dark"] .dropdown-menu li:hover {
    background: #45475a;
}

[data-theme="dark"] .dropdown-menu hr {
    background: #45475a;
}

[data-theme="dark"] .dropdown-menu i {
    color: #a6adc8;
}

/* ── Level viewer ── */
[data-theme="dark"] .level-viewer {
    background: #313244;
    border-color: rgba(232, 200, 122, 0.2);
}

[data-theme="dark"] .level-viewer-label { color: #e8c87a; }

[data-theme="dark"] #level-viewer-select {
    background: #1e1e2e;
    border-color: rgba(232, 200, 122, 0.35);
    color: #e8c87a;
}

[data-theme="dark"] .level-viewer-reset {
    background: #313244;
    border-color: #45475a;
    color: #a6adc8;
}

/* ── Character list ── */
[data-theme="dark"] .character-card {
    background: #313244;
    border-color: #45475a;
    color: #cdd6f4;
}

/* ── General white/light hardcoded overrides ── */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: #313244;
    border-color: #45475a;
    color: #cdd6f4;
}

[data-theme="dark"] input[type="text"]::placeholder,
[data-theme="dark"] input[type="email"]::placeholder,
[data-theme="dark"] input[type="number"]::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #6c7086;
}

/* ── Builder: white backgrounds on cards/slots ── */
[data-theme="dark"] .spell-slot  { background: #313244; border-color: #45475a; color: #cdd6f4; }
[data-theme="dark"] .spell-slot:not(.empty) .spell-name { color: #cdd6f4; }

[data-theme="dark"] .options-card {
    background: var(--parchment);
    border-color: var(--parchment-border);
    color: var(--ink);
}

[data-theme="dark"] .options-card h3,
[data-theme="dark"] .options-card h4 { color: var(--ink); }

[data-theme="dark"] .options-card p   { color: var(--ink-muted); }

[data-theme="dark"] .options-card:hover {
    background: var(--parchment-dark);
}

[data-theme="dark"] .details-container {
    background: var(--parchment);
}

[data-theme="dark"] .instruction-bar {
    background: #181825;
    border-color: #45475a;
    color: #cdd6f4;
}

[data-theme="dark"] .details-container,
[data-theme="dark"] #class-details {
    background: #181825;
    border-color: #45475a;
    color: #cdd6f4;
}

[data-theme="dark"] .details-content,
[data-theme="dark"] .details-title,
[data-theme="dark"] .class-details-title,
[data-theme="dark"] .feature-name,
[data-theme="dark"] .feature-description strong {
    color: #f5e0dc;
}

[data-theme="dark"] #class-details p,
[data-theme="dark"] .instruction-bar p,
[data-theme="dark"] .feature-description,
[data-theme="dark"] .class-skills,
[data-theme="dark"] .details-description,
[data-theme="dark"] .stat-dl dd {
    color: #cdd6f4;
}

[data-theme="dark"] .stat-dl dt,
[data-theme="dark"] .details-ornament {
    color: #a6adc8;
}

[data-theme="dark"] .details-section,
[data-theme="dark"] .feature-card {
    background: #313244;
    border-color: #45475a;
}

[data-theme="dark"] .class-details-hero {
    background: linear-gradient(
        160deg,
        color-mix(in srgb, var(--accent, #e8c87a) 20%, #181825) 0%,
        #181825 68%
    );
    border-color: color-mix(in srgb, var(--accent, #e8c87a) 28%, #45475a);
}

[data-theme="dark"] .class-details-prestige-badge {
    color: #f9e2af;
    background: rgba(249, 226, 175, 0.12);
    border-color: rgba(249, 226, 175, 0.28);
}

[data-theme="dark"] .class-details-ornament {
    color: color-mix(in srgb, var(--accent, #e8c87a) 55%, #cdd6f4);
}

[data-theme="dark"] .section-heading {
    color: #e8c87a;
    border-bottom-color: rgba(232, 200, 122, 0.22);
}

[data-theme="dark"] .collapsible-heading {
    background: rgba(232, 200, 122, 0.12);
    color: #e8c87a;
}

[data-theme="dark"] .collapsible-heading:hover {
    background: rgba(232, 200, 122, 0.18);
}

[data-theme="dark"] .prereq-item {
    border-bottom-color: #45475a;
}

[data-theme="dark"] .class-table,
[data-theme="dark"] .class-table th,
[data-theme="dark"] .class-table td {
    color: #cdd6f4;
    border-color: #45475a;
}

[data-theme="dark"] .class-table th {
    background: #313244;
}

[data-theme="dark"] .class-table td {
    background: #1e1e2e;
}

[data-theme="dark"] #favored-class-card {
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--accent, #e8c87a) 18%, #1e1e2e) 0%,
        #1e1e2e 72%
    );
    border-color: color-mix(in srgb, var(--accent, #e8c87a) 28%, #45475a);
}

[data-theme="dark"] .fav-text p {
    color: #cdd6f4;
}

[data-theme="dark"] .fav-btn-no {
    background: #313244;
    color: #cdd6f4;
    border-color: #585b70;
}

[data-theme="dark"] .fav-btn-no:hover,
[data-theme="dark"] .fav-btn-no.active {
    background: #45475a;
    color: #f5f5f5;
    border-color: #7f849c;
}

[data-theme="dark"] .class-card {
    background-color: color-mix(in srgb, var(--accent, #e8c87a) 16%, #1e1e2e) !important;
}

[data-theme="dark"] .class-card:hover {
    background-color: color-mix(in srgb, var(--accent, #e8c87a) 24%, #181825) !important;
}

[data-theme="dark"] .class-card-header,
[data-theme="dark"] .class-card-header h3,
[data-theme="dark"] .class-card-chevron,
[data-theme="dark"] .class-taken-badge {
    color: #cdd6f4;
}

[data-theme="dark"] .class-card.selected .class-card-header,
[data-theme="dark"] .class-card.selected .class-card-header h3,
[data-theme="dark"] .class-card.selected .class-card-chevron {
    color: #f8fafc !important;
}

[data-theme="dark"] .class-card[data-is-prestige="1"] {
    background: repeating-linear-gradient(
        135deg,
        rgba(184, 134, 11, 0.22),
        rgba(184, 134, 11, 0.22) 10px,
        rgba(49, 50, 68, 0.94) 10px,
        rgba(49, 50, 68, 0.94) 20px
    ) !important;
}

[data-theme="dark"] .class-card[data-is-prestige="1"] .class-card-header,
[data-theme="dark"] .class-card[data-is-prestige="1"] .class-card-header h3,
[data-theme="dark"] .class-card[data-is-prestige="1"] .class-card-chevron {
    color: #f9fafb !important;
}

[data-theme="dark"] .class-card[data-is-prestige="1"]:hover {
    background: repeating-linear-gradient(
        135deg,
        rgba(184, 134, 11, 0.3),
        rgba(184, 134, 11, 0.3) 10px,
        rgba(30, 41, 59, 0.96) 10px,
        rgba(30, 41, 59, 0.96) 20px
    ) !important;
}

[data-theme="dark"] .class-card[data-is-prestige="1"].selected {
    background: repeating-linear-gradient(
        135deg,
        rgba(184, 134, 11, 0.34),
        rgba(184, 134, 11, 0.34) 10px,
        rgba(17, 24, 39, 0.98) 10px,
        rgba(17, 24, 39, 0.98) 20px
    ) !important;
}

[data-theme="dark"] .archetype-table {
    border-top-color: #45475a;
}

[data-theme="dark"] .archetype-row {
    background: linear-gradient(180deg, #313244, #1e1e2e);
    border-color: #45475a;
    border-left-color: #585b70;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .archetype-row:hover {
    border-color: rgba(232, 200, 122, 0.35);
    border-left-color: #e8c87a;
    background: linear-gradient(180deg, rgba(49,50,68,0.98), rgba(24,24,37,0.98));
}

[data-theme="dark"] .archetype-row.selected {
    border-color: rgba(232, 200, 122, 0.45);
    border-left-color: #e8c87a;
    background: linear-gradient(180deg, rgba(30,41,59,0.98), rgba(17,24,39,0.98));
}

[data-theme="dark"] .archetype-name {
    color: #f5e0dc;
}

[data-theme="dark"] .archetype-table-title,
[data-theme="dark"] .archetype-select-hint {
    color: #cdd6f4;
}

[data-theme="dark"] .archetype-table-count {
    background: rgba(232, 200, 122, 0.22);
    border-color: rgba(232, 200, 122, 0.45);
    color: #dbeafe;
    box-shadow: none;
}

/* ── Tooltip ── */
[data-theme="dark"] .info-tooltip .tooltip-text {
    background: #313244;
    color: #cdd6f4;
}

/* ── Builder prereq list ── */
[data-theme="dark"] .prereq-met      { color: #a6e3a1; }
[data-theme="dark"] .prereq-met .fas { color: #a6e3a1; }
[data-theme="dark"] .prereq-fail      { color: #f38ba8; }
[data-theme="dark"] .prereq-fail .fas { color: #f38ba8; }

/* ── Stats / attributes / skills in character view ── */
[data-theme="dark"] .stat-box,
[data-theme="dark"] .attribute-card,
[data-theme="dark"] .skill-row {
    background: #313244;
    border-color: #45475a;
    color: #cdd6f4;
}

/* ── Tables ── */
[data-theme="dark"] table { color: #cdd6f4; }
[data-theme="dark"] th    { background: #313244; color: #a6adc8; }
[data-theme="dark"] td    { border-color: #45475a; }

/* ── Compendium ── */
[data-theme="dark"] .compendium-section-title {
    color: #6c7086;
    border-bottom-color: #45475a;
}

[data-theme="dark"] .compendium-card,
[data-theme="dark"] .compendium-section {
    background: #313244;
    border-color: #45475a;
    color: #cdd6f4;
}

/* ── Admin page ── */
[data-theme="dark"] .admin-container,
[data-theme="dark"] .admin-card {
    background: #313244;
    border-color: #45475a;
    color: #cdd6f4;
}

/* ── Levelup resume banner ── */
[data-theme="dark"] .levelup-resume-banner {
    background: #2a2520;
    border-color: #d97706;
    color: #fde68a;
}

[data-theme="dark"] .levelup-resume-banner a { color: #fbbf24; }

/* ── Compendium spell search ── */
[data-theme="dark"] .compendium-search-wrap input {
    background: #313244;
    border-color: #45475a;
    color: #cdd6f4;
}

[data-theme="dark"] .compendium-school-btn {
    background: #1e1e2e;
    border-color: #45475a;
    color: #a6adc8;
}

[data-theme="dark"] .compendium-school-btn:hover {
    background: #313244;
    color: #cdd6f4;
}

[data-theme="dark"] .compendium-school-btn.active {
    background: #cdd6f4;
    color: #1e1e2e;
    border-color: #cdd6f4;
}

/* ── Shop ── */
[data-theme="dark"] .shop-filter-btn:hover,
[data-theme="dark"] .shop-sort-btn:hover {
    background: #313244;
}

[data-theme="dark"] .shop-sort-btn.active {
    background: #e8c87a;
    color: #1e1e2e;
    border-color: #e8c87a;
}

[data-theme="dark"] .shop-item:hover {
    background: #313244;
}

[data-theme="dark"] .shop-item-price {
    color: #a6e3a1;
}

[data-theme="dark"] .shop-item-price-unaffordable {
    color: #f38ba8;
}

[data-theme="dark"] .shop-proficient {
    background: rgba(166, 227, 161, 0.15);
    color: #a6e3a1;
}

[data-theme="dark"] .shop-not-proficient {
    background: rgba(243, 139, 168, 0.15);
    color: #f38ba8;
}

[data-theme="dark"] .shop-buy-btn:disabled {
    background: #45475a;
    color: #6c7086;
}

[data-theme="dark"] .shop-spell-level-badge {
    background: rgba(232, 200, 122, 0.15);
    color: #e8c87a;
    border-color: rgba(232, 200, 122, 0.3);
}

[data-theme="dark"] .item-icon-potion,
[data-theme="dark"] .item-icon-wand {
    color: #e8c87a;
}

[data-theme="dark"] .item-icon-staff {
    color: #f9e2af;
}

/* ── Shop enhancement select ── */
[data-theme="dark"] .shop-enh-select {
    background: #313244;
    border-color: #45475a;
    color: #cdd6f4;
}

/* ── Shop modal ── */
[data-theme="dark"] .shop-modal {
    background: #1e1e2e;
    border-color: #45475a;
}

/* ── Shop qty input ── */
[data-theme="dark"] .shop-qty-input {
    background: #313244;
    border-color: #45475a;
    color: #cdd6f4;
}

/* ── Stat cards (HP, AC, BAB, etc.) ── */
[data-theme="dark"] .stat-item {
    background: #313244;
    border-color: #45475a;
}

[data-theme="dark"] .stat-value { color: #cdd6f4; }
[data-theme="dark"] .stat-label { color: #a6adc8; }
[data-theme="dark"] .stat-unit  { color: #6c7086; }
[data-theme="dark"] .section-header { color: #a6adc8; }

[data-theme="dark"] .breakdown-chip em,
[data-theme="dark"] .detail-mod-chip em { color: #a6adc8; }

[data-theme="dark"] .breakdown-chip em a.breakdown-link:hover { color: #e8c87a; }

/* ── Attributes table ── */
[data-theme="dark"] .attr-val.pos { color: #cdd6f4; }

/* ── Skills table ── */
[data-theme="dark"] .skill-header-label  { color: #a6adc8; }
[data-theme="dark"] .skill-header-right  { color: #6c7086; }
[data-theme="dark"] .skill-breakdown-label { color: #6c7086; }
[data-theme="dark"] .skill-detail-name   { color: #cdd6f4; }
[data-theme="dark"] .skill-detail-desc   { color: #a6adc8; }
[data-theme="dark"] .skill-info-btn      { color: #6c7086; border-color: #45475a; }
[data-theme="dark"] .cs-no               { background: #45475a; }
[data-theme="dark"] .col-other           { color: #a6adc8; }
[data-theme="dark"] .attr-abbr-badge     { color: #6c7086; }

/* ── Equipment tab bar ── */
[data-theme="dark"] .equipment-tabs ul { border-bottom-color: #45475a; }

[data-theme="dark"] .equipment-tabs .eq-tab-button {
    background: #181825;
    border-color: #45475a;
    color: #a6adc8;
}

[data-theme="dark"] .equipment-tabs .eq-tab-button:hover {
    background: #313244;
    color: #e8c87a;
    border-color: #e8c87a;
}

[data-theme="dark"] .equipment-tabs .eq-tab-button.active {
    background: #e8c87a;
    color: #1e1e2e;
    border-color: #e8c87a;
    border-bottom-color: #1e1e2e;
}

[data-theme="dark"] .equipment-tab-container {
    background: #1e1e2e;
    border-color: #45475a;
}

/* ── Inventory panels ── */
[data-theme="dark"] .inventory-overview .inventory-left,
[data-theme="dark"] .inventory-overview .inventory-right {
    background: #313244;
    border-color: #45475a;
}

[data-theme="dark"] .inventory-overview .inventory-item-table td { border-color: #45475a; }

[data-theme="dark"] .inventory-overview .inventory-item-table tbody tr:nth-child(even) {
    background: #1e1e2e;
}

[data-theme="dark"] .inventory-overview .inventory-item-table tbody tr:hover {
    background: rgba(232, 200, 122, 0.07);
}

/* ── Inventory sub-tabs (Item List / Wondrous Slots) ── */
[data-theme="dark"] .inventory-overview .inventory-left .inventory-tab-buttons {
    border-bottom-color: #45475a;
}

[data-theme="dark"] .inventory-overview .inventory-left .inventory-tab-button {
    background: #181825;
    border-color: #45475a;
    color: #a6adc8;
}

[data-theme="dark"] .inventory-overview .inventory-left .inventory-tab-button:hover {
    background: #313244;
    color: #e8c87a;
}

[data-theme="dark"] .inventory-overview .inventory-left .inventory-tab-button.active {
    background: #e8c87a;
    color: #1e1e2e;
    border-color: #e8c87a;
    border-bottom-color: #313244;
}

[data-theme="dark"] .inventory-overview .inventory-left .inventory-tab-content {
    background: #313244;
    border-color: #45475a;
}

[data-theme="dark"] .item-creation-intro {
    background: linear-gradient(180deg, #2c2630 0%, #221f28 100%);
    border-color: #4b4253;
}

[data-theme="dark"] .item-creation-title,
[data-theme="dark"] .item-creation-money-value {
    color: #f5e8c8;
}

[data-theme="dark"] .item-creation-copy,
[data-theme="dark"] .item-creation-category-head p,
[data-theme="dark"] .item-creation-more {
    color: #a6adc8;
}

[data-theme="dark"] .item-creation-money {
    background: rgba(232, 200, 122, 0.12);
    border-color: rgba(232, 200, 122, 0.24);
}

[data-theme="dark"] .item-creation-money-label,
[data-theme="dark"] .item-creation-badge {
    color: #e8c87a;
}

[data-theme="dark"] .item-creation-category {
    background: #313244;
    border-color: #45475a;
}

[data-theme="dark"] .item-creation-category-head {
    background: #1e1e2e;
    border-bottom-color: #45475a;
}

[data-theme="dark"] .item-creation-category-head h4 {
    color: #f5e8c8;
}

[data-theme="dark"] .item-creation-badge {
    background: rgba(232, 200, 122, 0.12);
}

[data-theme="dark"] .item-creation-table th {
    background: rgba(232, 200, 122, 0.2);
    color: #f5e8c8;
}

[data-theme="dark"] .item-creation-table th,
[data-theme="dark"] .item-creation-table td {
    border-bottom-color: #45475a;
}

[data-theme="dark"] .item-creation-table tbody tr:nth-child(even) {
    background: #1e1e2e;
}

[data-theme="dark"] .item-creation-afford-yes {
    background: rgba(166, 227, 161, 0.12);
    color: #a6e3a1;
}

[data-theme="dark"] .item-creation-afford-no {
    background: rgba(243, 139, 168, 0.12);
    color: #f38ba8;
}

[data-theme="dark"] .item-craft-btn {
    background: #9a7820;
    color: #fde68a;
}

[data-theme="dark"] .item-craft-btn:hover:not(:disabled) {
    background: #7d6018;
}

[data-theme="dark"] .item-craft-btn:disabled {
    background: #313244;
    color: #6c7086;
}

[data-theme="dark"] .item-crafted-badge {
    background: rgba(253, 230, 138, 0.1);
    color: #fde68a;
    border-color: rgba(253, 230, 138, 0.25);
}

/* ── Money chip ── */
[data-theme="dark"] .inventory-money {
    background: #2a2010;
    border-color: #6b4a10;
    color: #fde68a;
}

[data-theme="dark"] .inventory-money i          { color: #f59e0b; }
[data-theme="dark"] .inventory-money .money-spent { color: #fbbf24; }

/* ── Encumbrance card ── */
[data-theme="dark"] .inventory-encumbrance-card {
    background: #313244;
    border-color: #45475a;
    color: #cdd6f4;
}

[data-theme="dark"] .enc-icon          { color: #a6adc8; }
[data-theme="dark"] .enc-weight-text   { color: #cdd6f4; }
[data-theme="dark"] .enc-bar           { background: #45475a; }
[data-theme="dark"] .enc-threshold     { background: rgba(255, 255, 255, 0.25); }
[data-theme="dark"] .enc-label-light   { color: #a6e3a1; }
[data-theme="dark"] .enc-label-medium  { color: #f9e2af; }
[data-theme="dark"] .enc-label-heavy   { color: #f38ba8; }

/* ── Item group headers ── */
[data-theme="dark"] .group-equipped .item-group-header {
    background: rgba(166, 227, 161, 0.12);
    color: #a6e3a1;
    border-bottom-color: rgba(166, 227, 161, 0.3);
}

[data-theme="dark"] .group-carried .item-group-header {
    background: rgba(137, 180, 250, 0.12);
    color: #89b4fa;
    border-bottom-color: rgba(137, 180, 250, 0.3);
}

[data-theme="dark"] .group-not-carried .item-group-header {
    background: #313244;
    color: #a6adc8;
    border-bottom-color: #45475a;
}

[data-theme="dark"] .item-group-empty { border-color: #45475a; color: #6c7086; }

/* ── Table column headers match group color (dark mode) ── */
[data-theme="dark"] .group-equipped .inventory-item-table th {
    background: rgba(166, 227, 161, 0.2);
    color: #a6e3a1;
}

[data-theme="dark"] .group-carried .inventory-item-table th {
    background: rgba(137, 180, 250, 0.2);
    color: #89b4fa;
}

[data-theme="dark"] .group-not-carried .inventory-item-table th {
    background: rgba(166, 173, 200, 0.12);
    color: #a6adc8;
}

/* ── Armor chips ── */
[data-theme="dark"] .armor-chip {
    background: rgba(232, 200, 122, 0.15);
    color: #e8c87a;
}

[data-theme="dark"] .armor-chip-warn {
    background: rgba(249, 168, 37, 0.15);
    color: #fbbf24;
}

[data-theme="dark"] .armor-chip-neg {
    background: rgba(243, 139, 168, 0.15);
    color: #f38ba8;
}

/* ── Status radio buttons ── */
[data-theme="dark"] .status-radio-group { border-color: #45475a; }

[data-theme="dark"] .status-radio-btn {
    background: #313244;
    color: #6c7086;
    border-right-color: #45475a;
}

[data-theme="dark"] .status-radio-btn:hover {
    background: #45475a;
    color: #cdd6f4;
}

/* ── Item remove button ── */
[data-theme="dark"] .item-remove-btn {
    background: rgba(243, 139, 168, 0.1);
    border-color: rgba(243, 139, 168, 0.3);
    color: #f38ba8;
}

/* ── Level notice ── */
[data-theme="dark"] .level-notice {
    background: rgba(232, 200, 122, 0.1);
    border-color: rgba(232, 200, 122, 0.3);
    border-left-color: #e8c87a;
    color: #e8c87a;
}

/* ── Item detail page ── */
[data-theme="dark"] .item-detail-card {
    background: var(--parchment);
    border-color: var(--parchment-border);
}

[data-theme="dark"] .item-detail-description {
    color: var(--ink);
}

[data-theme="dark"] .item-detail-stat {
    background: #181825;
    border-color: var(--parchment-border);
}

/* ── Spells panels ── */
[data-theme="dark"] .spells-left,
[data-theme="dark"] .spells-middle,
[data-theme="dark"] .spells-right,
[data-theme="dark"] .spells-legend {
    background: #313244;
    border-color: #45475a;
    color: #cdd6f4;
}

[data-theme="dark"] .spells-left h2,
[data-theme="dark"] .spells-middle h2,
[data-theme="dark"] .spells-right h2 {
    color: #a6adc8;
    border-bottom-color: #e8c87a;
}

[data-theme="dark"] .spells-left p,
[data-theme="dark"] .spells-middle p { color: #cdd6f4; }

[data-theme="dark"] .spells-subtabs ul { border-bottom-color: #45475a; }

[data-theme="dark"] .spells-subtabs .subtab {
    background: #181825;
    border-color: #45475a;
    color: #a6adc8;
}

[data-theme="dark"] .spells-subtabs .subtab:hover {
    background: #313244;
    color: #e8c87a;
}

[data-theme="dark"] .spells-subtabs .subtab.active {
    background: #e8c87a;
    color: #1e1e2e;
    border-color: #e8c87a;
    border-bottom-color: #313244;
}

[data-theme="dark"] .spell-level-tabs ul { border-bottom-color: #45475a; }

[data-theme="dark"] .spell-level-tab {
    background: #181825;
    border-color: #45475a;
    color: #a6adc8;
}

[data-theme="dark"] .spell-level-tab:hover {
    background: #313244;
    color: #e8c87a;
}

[data-theme="dark"] .spell-level-tab.active {
    background: #e8c87a;
    color: #1e1e2e;
    border-color: #e8c87a;
    border-bottom-color: #313244;
}

[data-theme="dark"] .spell-card {
    background: #1e1e2e;
    border-color: #45475a;
}

[data-theme="dark"] .spell-card-header h4 { color: #cdd6f4; }

[data-theme="dark"] .spell-card-body {
    background: #313244;
    color: #cdd6f4;
    border-top-color: #45475a;
}

[data-theme="dark"] .spell-dc-breakdown summary { color: #f5e0dc; }

[data-theme="dark"] .spell-dc-breakdown ul { color: #cdd6f4; }

[data-theme="dark"] .spell-class-separator { border-top-color: #45475a; }

[data-theme="dark"] .spell-class-separator::after {
    background: #313244;
    color: #6c7086;
}

[data-theme="dark"] .spell-school-filter-bar { border-bottom-color: #45475a; }

[data-theme="dark"] .legend-item { color: #cdd6f4; }

[data-theme="dark"] .legend-title { color: #a6adc8; }

[data-theme="dark"] .spell-pagination-btn {
    background: #313244;
    border-color: #e8c87a;
    color: #e8c87a;
}

[data-theme="dark"] .spell-pagination-btn:hover:not(:disabled) {
    background: #e8c87a;
    color: #1e1e2e;
}

[data-theme="dark"] .spell-pagination-btn:disabled {
    border-color: #45475a;
    color: #6c7086;
}

[data-theme="dark"] .spell-pagination-info { color: #a6adc8; }

/* ── Character view: Spells missing coverage ── */
[data-theme="dark"] .spells-subtemplate h1 { color: #a6adc8; }

[data-theme="dark"] .spells-per-day-table th,
[data-theme="dark"] .known-spells-table th {
    background-color: #2a1800;
}

[data-theme="dark"] .spells-per-day-table td,
[data-theme="dark"] .known-spells-table td {
    border-color: #45475a;
    color: #cdd6f4;
}

[data-theme="dark"] .spells-per-day-table tbody tr:nth-child(even),
[data-theme="dark"] .known-spells-table tbody tr:nth-child(even) {
    background-color: #252538;
}

/* ── Builder: Class detail panel ── */
[data-theme="dark"] .class-table { border-color: #45475a; }
[data-theme="dark"] .class-table th, [data-theme="dark"] .class-table td { border-color: #45475a; }
[data-theme="dark"] .class-table tbody tr:nth-child(even) { background: #252538; }
[data-theme="dark"] .class-table tbody tr:hover { background: rgba(232, 200, 122, 0.08); }
[data-theme="dark"] .gained-feature-tag { color: #a6e3a1; border-color: rgba(166, 227, 161, 0.25); background: rgba(166, 227, 161, 0.08); }
[data-theme="dark"] .prereq-item { color: #cdd6f4; }
[data-theme="dark"] .unchained-info-box { background: rgba(166, 227, 161, 0.06); border-color: rgba(166, 227, 161, 0.20); }

/* ── Builder: Skill points page ── */
[data-theme="dark"] .skill-table-wrapper { border-color: #45475a; }
[data-theme="dark"] .skill-table thead th { background: #2a1800; }
[data-theme="dark"] .skill-table tbody td { border-color: #45475a; color: #cdd6f4; }
[data-theme="dark"] .skill-table tbody tr:nth-child(even) { background: #252538; }
[data-theme="dark"] .breakdown-chip { background: rgba(232, 200, 122, 0.10); border-color: rgba(232, 200, 122, 0.25); }
[data-theme="dark"] .breakdown-chip em { color: #a6adc8; }

/* ── Builder: navigation buttons ── */
[data-theme="dark"] .builder-navigation button:first-child {
    background: linear-gradient(180deg, #313244 0%, #252538 100%);
    border-color: #45475a;
    color: #cdd6f4;
}

[data-theme="dark"] .builder-navigation button:first-child:hover {
    background: linear-gradient(180deg, #3a3c53 0%, #313244 100%);
    border-color: #6c7086;
    color: #f5e0dc;
}

[data-theme="dark"] .builder-navigation button:last-child {
    background: linear-gradient(180deg, #e8c87a 0%, #d7b35f 100%);
    border-color: #b8922a;
    color: #1e1e2e;
}

[data-theme="dark"] .builder-navigation button:last-child:hover {
    background: linear-gradient(180deg, #f2d492 0%, #e8c87a 100%);
    border-color: #e8c87a;
    color: #11111b;
}

[data-theme="dark"] .builder-navigation button:disabled,
[data-theme="dark"] .builder-navigation button[disabled],
[data-theme="dark"] .builder-navigation button.class-continue-blocked {
    background: #262334;
    border-color: #403c52;
    color: #817a92;
}

/* ── Toast notifications ── */
[data-theme="dark"] .toast-info    { background: #1e2a3a; border-left-color: #e8c87a; color: #cdd6f4; }
[data-theme="dark"] .toast-warning { background: #2a2010; border-left-color: #f9e2af; color: #fde68a; }
[data-theme="dark"] .toast-error   { background: #2a1020; border-left-color: #f38ba8; color: #fecdd3; }
[data-theme="dark"] .toast-success { background: #102a10; border-left-color: #a6e3a1; color: #bbf7d0; }

[data-theme="dark"] .toast-info    .toast-icon { color: #e8c87a; }
[data-theme="dark"] .toast-warning .toast-icon { color: #f9e2af; }
[data-theme="dark"] .toast-error   .toast-icon { color: #f38ba8; }
[data-theme="dark"] .toast-success .toast-icon { color: #a6e3a1; }

/* ── Equipment: Hand slot badges ── */
[data-theme="dark"] .hand-slot-badge-main { background: rgba(5, 150, 105, 0.15); color: #a6e3a1; }
[data-theme="dark"] .hand-slot-badge-off  { background: rgba(8, 145, 178, 0.15); color: #89dceb; }
[data-theme="dark"] .hand-slot-badge-both { background: rgba(184, 146, 42, 0.15); color: #e8c87a; }
[data-theme="dark"] .status-radio-group { border-color: #45475a; }
[data-theme="dark"] .status-radio-btn { background: #1e1e2e; color: #6c7086; border-right-color: #45475a; }
[data-theme="dark"] .status-radio-btn:hover { background: #313244; color: #cdd6f4; }

/* ── Animal Companion archetype (character view) ── */
[data-theme="dark"] .companion-archetype-badge { background: rgba(232, 200, 122, 0.12); border-color: rgba(232, 200, 122, 0.25); color: #e8c87a; }
[data-theme="dark"] .companion-archetype-block { background: #181825; border-color: #45475a; border-left-color: #e8c87a; }
[data-theme="dark"] .companion-archetype-desc { color: #cdd6f4; }
[data-theme="dark"] .companion-archetype-gained-item { background: #1e1e2e; border-color: #45475a; }
[data-theme="dark"] .companion-archetype-gained-name { color: #cdd6f4; }
[data-theme="dark"] .companion-archetype-gained-edl { color: #e8c87a; }
[data-theme="dark"] .companion-archetype-gained-desc { color: #a6adc8; }

/* ── Animal Companion archetype (builder) ── */
[data-theme="dark"] .archetype-card { background: #1e1e2e; border-color: #45475a; }
[data-theme="dark"] .archetype-card:hover { background: #181825; border-left-color: #e8c87a; }
[data-theme="dark"] .archetype-card.selected { background: #e8c87a; border-left-color: #b8922a; }
[data-theme="dark"] .archetype-card.selected .archetype-card-name { color: #11111b; }
[data-theme="dark"] .archetype-none-card.selected { background: #181825; border-left-color: #45475a; }
[data-theme="dark"] .archetype-none-card.selected .archetype-card-name { color: #cdd6f4; }
[data-theme="dark"] .archetype-card-name { color: #cdd6f4; }
[data-theme="dark"] .archetype-details-panel { background: #1e1e2e; border-color: #45475a; }
[data-theme="dark"] .archetype-detail-name { color: #cdd6f4; }
[data-theme="dark"] .archetype-detail-description { color: #a6adc8; }
[data-theme="dark"] .archetype-gained-item { background: #181825; border-color: #45475a; }
[data-theme="dark"] .archetype-gained-header { color: #cdd6f4; }
[data-theme="dark"] .archetype-gained-edl { color: #e8c87a; }
[data-theme="dark"] .archetype-gained-desc { color: #a6adc8; }
[data-theme="dark"] .archetype-section-title { color: #cdd6f4; }
[data-theme="dark"] .archetype-section-hint { color: #a6adc8; }
