/* v3.48 personal themes — loaded after the legacy styles so no existing layout is changed. */
body[data-theme="dark"] { color-scheme: dark; }

body[data-theme="medium"] {
  --bg:#20252b; --panel:#2b3138; --line:#48515c; --text:#f2f3f4; --muted:#b6bdc6;
  color-scheme:dark; background:#20252b !important; color:#f2f3f4 !important;
}
body[data-theme="medium"] .topbar, body[data-theme="medium"] .nav, body[data-theme="medium"] .mobile-quick-dock {background:#252b31 !important;border-color:#46505a !important}
body[data-theme="medium"] .panel, body[data-theme="medium"] .card, body[data-theme="medium"] .stat, body[data-theme="medium"] .modal-card, body[data-theme="medium"] .board-card, body[data-theme="medium"] .form-section {background:#2b3138 !important;border-color:#48515c !important}
body[data-theme="medium"] input,body[data-theme="medium"] select,body[data-theme="medium"] textarea {background:#242a30 !important;color:#f2f3f4 !important;border-color:#515c67 !important}
body[data-theme="medium"] .muted,body[data-theme="medium"] small {color:#b6bdc6}

body[data-theme="light"] {
  --bg:#f3f5f7; --panel:#ffffff; --line:#d6dce3; --text:#20252b; --muted:#66717d;
  color-scheme:light; background:#f3f5f7 !important;color:#20252b !important;
}
body[data-theme="light"] .topbar,body[data-theme="light"] .nav,body[data-theme="light"] .mobile-quick-dock {background:#fff !important;border-color:#d6dce3 !important;box-shadow:0 1px 8px #15202b12}
body[data-theme="light"] .brand,body[data-theme="light"] .brand b,body[data-theme="light"] .nav a.active,body[data-theme="light"] .mobile-quick-dock a.active {color:#20252b !important}
body[data-theme="light"] .nav a,body[data-theme="light"] .userbox a {color:#65717d !important}
body[data-theme="light"] .panel,body[data-theme="light"] .card,body[data-theme="light"] .stat,body[data-theme="light"] .modal-card,body[data-theme="light"] .board-card,body[data-theme="light"] .form-section,body[data-theme="light"] .dashboard-card {background:#fff !important;color:#20252b !important;border-color:#d6dce3 !important;box-shadow:0 3px 14px #15202b0d}
body[data-theme="light"] input,body[data-theme="light"] select,body[data-theme="light"] textarea {background:#fff !important;color:#20252b !important;border-color:#cbd3dc !important}
body[data-theme="light"] .muted,body[data-theme="light"] small {color:#66717d !important}
body[data-theme="light"] table,body[data-theme="light"] th,body[data-theme="light"] td {color:#20252b;border-color:#d6dce3}

body[data-theme="pastel"] {
  --bg:#f5f2f6; --panel:#fffafd; --line:#ddd3df; --text:#37313b; --muted:#796f7d;
  color-scheme:light; background:linear-gradient(145deg,#f5f2f6,#eef5f3) fixed !important;color:#37313b !important;
}
body[data-theme="pastel"] .topbar,body[data-theme="pastel"] .nav,body[data-theme="pastel"] .mobile-quick-dock {background:#fffafd !important;border-color:#ddd3df !important;box-shadow:0 1px 10px #624f6812}
body[data-theme="pastel"] .brand,body[data-theme="pastel"] .brand b,body[data-theme="pastel"] .nav a.active,body[data-theme="pastel"] .mobile-quick-dock a.active {color:#37313b !important}
body[data-theme="pastel"] .nav a,body[data-theme="pastel"] .userbox a {color:#766c7b !important}
body[data-theme="pastel"] .panel,body[data-theme="pastel"] .card,body[data-theme="pastel"] .stat,body[data-theme="pastel"] .modal-card,body[data-theme="pastel"] .board-card,body[data-theme="pastel"] .form-section,body[data-theme="pastel"] .dashboard-card {background:#fffafd !important;color:#37313b !important;border-color:#ddd3df !important;box-shadow:0 4px 15px #725f7810}
body[data-theme="pastel"] input,body[data-theme="pastel"] select,body[data-theme="pastel"] textarea {background:#fff !important;color:#37313b !important;border-color:#d8cedb !important}
body[data-theme="pastel"] .muted,body[data-theme="pastel"] small {color:#796f7d !important}
body[data-theme="pastel"] table,body[data-theme="pastel"] th,body[data-theme="pastel"] td {color:#37313b;border-color:#ddd3df}
body[data-theme="pastel"] button:not(.danger),body[data-theme="pastel"] .btn:not(.danger){filter:saturate(.72)}

.theme-preference-help{margin:-3px 0 12px}.theme-choice-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}.theme-choice-card{position:relative;display:flex;flex-direction:column;gap:4px;border:1px solid var(--ui-border);border-radius:12px;padding:10px;cursor:pointer;min-width:0}.theme-choice-card input{position:absolute;opacity:0;pointer-events:none}.theme-choice-card:has(input:checked){outline:2px solid #c89c4b;outline-offset:1px}.theme-choice-card b{font-size:14px}.theme-choice-card small{font-size:11px;white-space:normal}.theme-preview{height:34px;border-radius:8px;padding:6px;display:flex;gap:4px;align-items:flex-end;border:1px solid #0002}.theme-preview i{display:block;width:28%;border-radius:3px;height:55%;background:#ffffff88}.theme-preview i:nth-child(2){height:85%}.theme-preview i:nth-child(3){height:68%}.theme-preview-dark{background:#11161d}.theme-preview-medium{background:#343b43}.theme-preview-light{background:#f5f7f9}.theme-preview-light i{background:#8793a066}.theme-preview-pastel{background:linear-gradient(135deg,#eadfea,#dfece7)}.theme-preview-pastel i{background:#ffffffaa}@media(max-width:640px){.theme-choice-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* v3.51 — complete surface theming.  Legacy CSS contains many hard-coded dark
   surfaces, so personal themes must override the actual cards/panels as well as body. */
body[data-theme="medium"]{
  --theme-surface:#2b3138;--theme-surface-2:#252b31;--theme-surface-3:#343b43;
  --theme-input:#242a30;--theme-border:#48515c;--theme-fg:#f2f3f4;--theme-sub:#b6bdc6;
}
body[data-theme="light"]{
  --theme-surface:#ffffff;--theme-surface-2:#f7f9fb;--theme-surface-3:#eef2f6;
  --theme-input:#ffffff;--theme-border:#d6dce3;--theme-fg:#20252b;--theme-sub:#66717d;
}
body[data-theme="pastel"]{
  --theme-surface:#fffafd;--theme-surface-2:#f8f2f8;--theme-surface-3:#eef6f2;
  --theme-input:#fffefe;--theme-border:#ddd3df;--theme-fg:#37313b;--theme-sub:#796f7d;
}
body[data-theme="medium"] :is(
  .member-list article,.notice-cards a,.skills-board section,.important-top>*,.activity-panel,.improved-activity-panel,
  .class-count-grid>div,.level-card-button,.skill-card,.news-item,.quick-link-card,.admin-only-link,
  .clan-search-box,.clan-member-card,.clan-member-summary>div,.skill-selector,.selected-skill-box,.selected-skill-tag,
  .armor-slot-card,.weapon-slot-card,.equipment-preview,.member-profile-panel,.profile-popup-equipment>div,.profile-popup-stats>div,
  .profile-popup-skills span,.boss-code-panel,.skill-member-row,.class-member-panel,.class-member-row,.admin-user-card,
  .boss-issue-panel,.admin-backup-form,.admin-account-card,.boss-code-history,.boss-code-history-row,.dashboard-profile-panel,
  .notice-check-item,.board-list-card,.board-empty-card,.admin-menu-card,.attendance-panel,.admin-code-list article,
  .admin-stats-grid>section,.admin-event-list article,.attendance-member-card,.my-boss-time-list article,
  .distribution-write-hint,.distribution-history-list>div,.my-distribution-summary,.distribution-compose-fields,
  .distribution-target-grid label,.distribution-live-calc,.distribution-member-picker,.distribution-detail-panel,
  .admin-distribution-card,.compact-ledger,.clan-item-stock-summary,.tab-compose-box .tab-compose-form,
  .notice-unread-list,.clan-item-stock-modal-card,.clan-item-stock-group,.clan-item-stock-group-list>div,.clan-item-stock-item,
  .admin-log-tabs,.access-log-list,.default-profile-option,.board-manager-block,.board-system-row,.board-custom-row,
  .global-search-input-wrap,.global-search-detail,.gs-char-eq,.gs-drop-history-row,.siege-entry-form,.siege-card,.siege-report-card,
  .siege-notice-box,.siege-participation-section,.siege-participation-form,.siege-member-picker label,.siege-report-row,
  .siege-my-summary>div,.siege-my-row,.siege-event-dialog,.siege-back-list,.siege-detail-stats>div,.embedded-manage-tabs
){background:var(--theme-surface)!important;color:var(--theme-fg)!important;border-color:var(--theme-border)!important}

body[data-theme="light"] :is(
  .member-list article,.notice-cards a,.skills-board section,.important-top>*,.activity-panel,.improved-activity-panel,
  .class-count-grid>div,.level-card-button,.skill-card,.news-item,.quick-link-card,.admin-only-link,
  .clan-search-box,.clan-member-card,.clan-member-summary>div,.skill-selector,.selected-skill-box,.selected-skill-tag,
  .armor-slot-card,.weapon-slot-card,.equipment-preview,.member-profile-panel,.profile-popup-equipment>div,.profile-popup-stats>div,
  .profile-popup-skills span,.boss-code-panel,.skill-member-row,.class-member-panel,.class-member-row,.admin-user-card,
  .boss-issue-panel,.admin-backup-form,.admin-account-card,.boss-code-history,.boss-code-history-row,.dashboard-profile-panel,
  .notice-check-item,.board-list-card,.board-empty-card,.admin-menu-card,.attendance-panel,.admin-code-list article,
  .admin-stats-grid>section,.admin-event-list article,.attendance-member-card,.my-boss-time-list article,
  .distribution-write-hint,.distribution-history-list>div,.my-distribution-summary,.distribution-compose-fields,
  .distribution-target-grid label,.distribution-live-calc,.distribution-member-picker,.distribution-detail-panel,
  .admin-distribution-card,.compact-ledger,.clan-item-stock-summary,.tab-compose-box .tab-compose-form,
  .notice-unread-list,.clan-item-stock-modal-card,.clan-item-stock-group,.clan-item-stock-group-list>div,.clan-item-stock-item,
  .admin-log-tabs,.access-log-list,.default-profile-option,.board-manager-block,.board-system-row,.board-custom-row,
  .global-search-input-wrap,.global-search-detail,.gs-char-eq,.gs-drop-history-row,.siege-entry-form,.siege-card,.siege-report-card,
  .siege-notice-box,.siege-participation-section,.siege-participation-form,.siege-member-picker label,.siege-report-row,
  .siege-my-summary>div,.siege-my-row,.siege-event-dialog,.siege-back-list,.siege-detail-stats>div,.embedded-manage-tabs
){background:var(--theme-surface)!important;color:var(--theme-fg)!important;border-color:var(--theme-border)!important;box-shadow:0 2px 12px rgba(24,35,48,.05)}

body[data-theme="pastel"] :is(
  .member-list article,.notice-cards a,.skills-board section,.important-top>*,.activity-panel,.improved-activity-panel,
  .class-count-grid>div,.level-card-button,.skill-card,.news-item,.quick-link-card,.admin-only-link,
  .clan-search-box,.clan-member-card,.clan-member-summary>div,.skill-selector,.selected-skill-box,.selected-skill-tag,
  .armor-slot-card,.weapon-slot-card,.equipment-preview,.member-profile-panel,.profile-popup-equipment>div,.profile-popup-stats>div,
  .profile-popup-skills span,.boss-code-panel,.skill-member-row,.class-member-panel,.class-member-row,.admin-user-card,
  .boss-issue-panel,.admin-backup-form,.admin-account-card,.boss-code-history,.boss-code-history-row,.dashboard-profile-panel,
  .notice-check-item,.board-list-card,.board-empty-card,.admin-menu-card,.attendance-panel,.admin-code-list article,
  .admin-stats-grid>section,.admin-event-list article,.attendance-member-card,.my-boss-time-list article,
  .distribution-write-hint,.distribution-history-list>div,.my-distribution-summary,.distribution-compose-fields,
  .distribution-target-grid label,.distribution-live-calc,.distribution-member-picker,.distribution-detail-panel,
  .admin-distribution-card,.compact-ledger,.clan-item-stock-summary,.tab-compose-box .tab-compose-form,
  .notice-unread-list,.clan-item-stock-modal-card,.clan-item-stock-group,.clan-item-stock-group-list>div,.clan-item-stock-item,
  .admin-log-tabs,.access-log-list,.default-profile-option,.board-manager-block,.board-system-row,.board-custom-row,
  .global-search-input-wrap,.global-search-detail,.gs-char-eq,.gs-drop-history-row,.siege-entry-form,.siege-card,.siege-report-card,
  .siege-notice-box,.siege-participation-section,.siege-participation-form,.siege-member-picker label,.siege-report-row,
  .siege-my-summary>div,.siege-my-row,.siege-event-dialog,.siege-back-list,.siege-detail-stats>div,.embedded-manage-tabs
){background:linear-gradient(145deg,var(--theme-surface),var(--theme-surface-3))!important;color:var(--theme-fg)!important;border-color:var(--theme-border)!important;box-shadow:0 3px 14px rgba(91,73,96,.06)}

body[data-theme="light"] :is(.boss-table th,.board-head,.compact-ledger-head,.access-log-head,.admin-log-tabs button,.embedded-manage-tabs button),
body[data-theme="pastel"] :is(.boss-table th,.board-head,.compact-ledger-head,.access-log-head,.admin-log-tabs button,.embedded-manage-tabs button),
body[data-theme="medium"] :is(.boss-table th,.board-head,.compact-ledger-head,.access-log-head,.admin-log-tabs button,.embedded-manage-tabs button){background:var(--theme-surface-2)!important;color:var(--theme-fg)!important;border-color:var(--theme-border)!important}

body[data-theme="light"] :is(.auth input,.form input,.form select,.form textarea,.searchbar input,.searchbar select,.armor-control-row input,.armor-control-row select,.weapon-control-row select,.accessory-select-grid select),
body[data-theme="pastel"] :is(.auth input,.form input,.form select,.form textarea,.searchbar input,.searchbar select,.armor-control-row input,.armor-control-row select,.weapon-control-row select,.accessory-select-grid select),
body[data-theme="medium"] :is(.auth input,.form input,.form select,.form textarea,.searchbar input,.searchbar select,.armor-control-row input,.armor-control-row select,.weapon-control-row select,.accessory-select-grid select){background:var(--theme-input)!important;color:var(--theme-fg)!important;border-color:var(--theme-border)!important}

body[data-theme="light"] :is(.mobile-quick-dock,.mobile-bottom-nav),
body[data-theme="pastel"] :is(.mobile-quick-dock,.mobile-bottom-nav),
body[data-theme="medium"] :is(.mobile-quick-dock,.mobile-bottom-nav){background:var(--theme-surface)!important;border-color:var(--theme-border)!important}

/* v3.54 Accessory: row 1 = labels, row 2 = selectors. */
.profile-entry-form .accessory-select-grid{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  grid-template-rows:auto auto!important;
  column-gap:6px!important;
  row-gap:5px!important;
  align-items:center!important;
}
.profile-entry-form .accessory-select-grid .accessory-item{
  display:contents!important;
}
.profile-entry-form .accessory-select-grid .accessory-label{
  grid-row:1!important;
  text-align:center!important;
  min-width:0!important;
  white-space:nowrap!important;
  word-break:keep-all!important;
  font-size:12px!important;
  font-weight:700!important;
}
.profile-entry-form .accessory-select-grid .accessory-item:nth-child(1) .accessory-label,
.profile-entry-form .accessory-select-grid .accessory-item:nth-child(1) select{grid-column:1!important}
.profile-entry-form .accessory-select-grid .accessory-item:nth-child(2) .accessory-label,
.profile-entry-form .accessory-select-grid .accessory-item:nth-child(2) select{grid-column:2!important}
.profile-entry-form .accessory-select-grid .accessory-item:nth-child(3) .accessory-label,
.profile-entry-form .accessory-select-grid .accessory-item:nth-child(3) select{grid-column:3!important}
.profile-entry-form .accessory-select-grid .accessory-item select{
  grid-row:2!important;
  margin:0!important;
  width:100%!important;
  min-width:0!important;
  height:36px!important;
  padding:5px 4px!important;
  font-size:12px!important;
}
@media(max-width:600px){
  .profile-entry-form .accessory-select-grid{column-gap:4px!important;row-gap:4px!important}
  .profile-entry-form .accessory-select-grid .accessory-label{font-size:11px!important}
  .profile-entry-form .accessory-select-grid .accessory-item select{height:34px!important;font-size:11px!important;padding:3px 2px!important}
}


/* v3.52 pastel: full light-surface system with deliberate text contrast. */
body[data-theme="pastel"]{background:#f7f0f5!important;color:#312d35!important;--theme-fg:#312d35;--theme-sub:#665f6b;--theme-border:#d9ccd7;--theme-surface:#fffafc;--theme-surface-2:#f5edf4;--theme-surface-3:#edf5f1;--theme-input:#fffefe;--card:#fffafc;--panel:#fffafc;--line:#d9ccd7;--muted:#665f6b}
body[data-theme="pastel"] :is(main,section,article,aside,nav,header,footer,div)[class*="panel"],
body[data-theme="pastel"] :is(section,article,div)[class*="card"],
body[data-theme="pastel"] :is(div,section)[class*="box"],
body[data-theme="pastel"] :is(div,section)[class*="modal"],
body[data-theme="pastel"] :is(div,section)[class*="dialog"]{border-color:var(--theme-border)!important}
body[data-theme="pastel"] :is(.panel,.card,.modal,.modal-card,.popup,.dialog,.content-card,.form-section,.profile-section,.admin-section,.dashboard-section,.board-panel,.boss-panel,.siege-page .panel,.clan-code-admin-card){background:#fffafc!important;color:#312d35!important;box-shadow:0 4px 18px rgba(86,65,82,.07)!important}
body[data-theme="pastel"] :is(input,select,textarea){background:#fff!important;color:#312d35!important;border-color:#d5c8d2!important;caret-color:#514a55!important}
body[data-theme="pastel"] :is(input,select,textarea)::placeholder{color:#827783!important;opacity:1}
body[data-theme="pastel"] :is(h1,h2,h3,h4,h5,h6,b,strong,label,th,td,p,span,a,small,em){text-shadow:none}
body[data-theme="pastel"] :is(.muted,small,.sub,.hint,.help,.meta){color:#665f6b!important}
body[data-theme="pastel"] :is(.topbar,.desktop-topbar,.site-header,.mobile-bottom-nav,.mobile-quick-dock){background:#f3e8f0!important;color:#312d35!important;border-color:#d4c4d0!important}
body[data-theme="pastel"] :is(table,tbody,tr,td,th){background-color:transparent;color:#312d35;border-color:#ded3dc}
body[data-theme="pastel"] :is(thead th,.table-head,.board-head){background:#eee3ec!important;color:#312d35!important}
body[data-theme="pastel"] a{color:#4d596f} body[data-theme="pastel"] a:hover{color:#2f3c55}
body[data-theme="pastel"] :is(button,.btn){color:#312d35;border-color:#cdbdcc} body[data-theme="pastel"] :is(button,.btn):not(.danger):not(.delete-btn){background:#eee5ee}
body[data-theme="pastel"] :is(button.primary,.btn.primary,button[type="submit"]){background:#d9c4d7!important;color:#2f2932!important;border-color:#c5aec2!important}
body[data-theme="pastel"] :is(.danger,.delete-btn){color:#8a2e40!important}

/* v3.52 clan-code card */
.clan-code-polished{position:relative;display:grid!important;grid-template-columns:minmax(0,1fr) auto;align-items:center!important;gap:12px!important;padding:16px 18px!important;overflow:hidden}.clan-code-polished:before{content:"";position:absolute;inset:0 auto 0 0;width:4px;background:linear-gradient(#d8b46a,#9f7741)}
.clan-code-copy-main{display:grid;gap:3px;min-width:0}.clan-code-copy-main strong{font-size:23px;letter-spacing:.11em;line-height:1.2;overflow-wrap:anywhere}.clan-code-actions{display:flex;gap:7px;align-items:center}.clan-code-actions button{height:38px;padding:0 13px;border-radius:9px}.clan-code-copy-btn.copied{transform:scale(.98)}.clan-code-edit-form{grid-column:1/-1;display:grid;grid-template-columns:minmax(160px,1fr) auto auto;gap:8px;align-items:center;padding-top:12px;border-top:1px solid var(--line,#33404d)}.clan-code-edit-form[hidden]{display:none!important}.clan-code-edit-form input{height:40px;text-transform:uppercase;letter-spacing:.08em}.clan-code-edit-form small{grid-column:1/-1}.clan-code-feedback{margin:-6px 0 14px}
@media(max-width:640px){.clan-code-polished{grid-template-columns:1fr}.clan-code-actions{justify-content:stretch}.clan-code-actions button{flex:1}.clan-code-edit-form{grid-template-columns:1fr 1fr}.clan-code-edit-form input{grid-column:1/-1}}

/* v3.52 siege detail compaction */
.siege-detail-stats-inline{display:grid!important;grid-template-columns:1fr 1fr!important;gap:8px!important}.siege-detail-stats-inline>div{display:flex!important;align-items:center!important;justify-content:center!important;gap:7px!important;min-height:52px!important;padding:8px 10px!important}.siege-detail-stats-inline span,.siege-detail-stats-inline b,.siege-detail-stats-inline small{white-space:nowrap!important}.siege-detail-stats-inline small{margin-left:2px}.siege-section-actions{display:flex;align-items:center;gap:7px;flex-wrap:wrap}.siege-toggle-details{min-height:36px;padding:7px 12px;border-radius:9px}.siege-report-list[hidden]{display:none!important}
@media(max-width:520px){.siege-detail-stats-inline{grid-template-columns:1fr 1fr!important}.siege-detail-stats-inline>div{gap:4px!important;padding:7px 5px!important}.siege-detail-stats-inline small{display:none}.siege-section-actions{width:100%;display:grid;grid-template-columns:1fr 1fr}.siege-section-actions button{width:100%;min-width:0}}


/* v3.57 light/pastel contrast: member search and hard-coded legacy surfaces */
body[data-theme="light"] .clan-member-card,body[data-theme="pastel"] .clan-member-card{background:#fff!important;border-color:#cbd3dc!important;color:#20252b!important;box-shadow:0 2px 10px rgba(24,35,48,.06)!important}
body[data-theme="pastel"] .clan-member-card{background:#fffafc!important;border-color:#d3c4d0!important;color:#312d35!important}
body[data-theme="light"] :is(.clan-member-main span,.member-class-line,.member-joined-line,.clan-member-summary span),body[data-theme="pastel"] :is(.clan-member-main span,.member-class-line,.member-joined-line,.clan-member-summary span){color:#5f6975!important}
body[data-theme="light"] :is(.clan-member-summary>div,.skills-all),body[data-theme="pastel"] :is(.clan-member-summary>div,.skills-all){background:#f3f6f8!important;border:1px solid #d9e0e6!important}
body[data-theme="pastel"] :is(.clan-member-summary>div,.skills-all){background:#f5edf4!important;border-color:#ddd0da!important}
body[data-theme="light"] :is(.clan-member-summary b,.weapon-text,.member-inline-level),body[data-theme="pastel"] :is(.clan-member-summary b,.weapon-text,.member-inline-level){color:#27313b!important}
body[data-theme="pastel"] :is(.clan-member-summary b,.weapon-text,.member-inline-level){color:#3c3440!important}
body[data-theme="light"] .skill-chip-list i{background:#26313d!important;color:#f7f9fb!important}
body[data-theme="pastel"] .skill-chip-list i{background:#514654!important;color:#fffafd!important}
body[data-theme="light"] :is(.clan-search-box,.active-search-info),body[data-theme="pastel"] :is(.clan-search-box,.active-search-info){background:#fff!important;color:#20252b!important;border-color:#cbd3dc!important}
body[data-theme="pastel"] :is(.clan-search-box,.active-search-info){background:#fffafc!important;color:#312d35!important;border-color:#d3c4d0!important}
body[data-theme="light"] .clan-search-modes button:not(.active),body[data-theme="pastel"] .clan-search-modes button:not(.active){background:#26313d!important;color:#eef3f7!important;border-color:#26313d!important}
body[data-theme="pastel"] .clan-search-modes button:not(.active){background:#514654!important;color:#fffafd!important;border-color:#514654!important}

/* v3.72 profile accessory readability */
.profile-entry-form .accessory-select-grid .accessory-label{font-size:15px!important;font-weight:900!important;line-height:1.25!important}
.profile-entry-form .accessory-select-grid .accessory-item select{text-align:center!important;text-align-last:center!important;font-size:14px!important;font-weight:700!important}
.profile-entry-form .accessory-select-grid .accessory-item select option{text-align:center!important}
@media(max-width:600px){.profile-entry-form .accessory-select-grid .accessory-label{font-size:14px!important}.profile-entry-form .accessory-select-grid .accessory-item select{font-size:13px!important;height:38px!important}}

/* =========================================================
   v3.119 - full theme contrast normalization
   The legacy UI contains many hard-coded dark surfaces.  This final layer is
   intentionally loaded last and maps common controls/surfaces to semantic
   theme variables so light/pastel/medium never inherit black backgrounds or
   low-contrast text from older rules.
   ========================================================= */
body[data-theme="dark"]{
  --ui-bg:#0b1118;--ui-surface:#111a23;--ui-surface-2:#18232e;--ui-surface-3:#202d39;
  --ui-fg:#f1f5f8;--ui-muted:#a8b4bf;--ui-border:#334452;--ui-input:#0d161f;
  --ui-button:#24313d;--ui-button-fg:#f3f6f8;--ui-button-hover:#2d3c49;
  --ui-active:#7f2b34;--ui-active-fg:#fff7f7;--ui-accent:#d3a85b;--ui-link:#a9c9ea;
}
body[data-theme="medium"]{
  --ui-bg:#20252b;--ui-surface:#2b3138;--ui-surface-2:#343b43;--ui-surface-3:#3c444d;
  --ui-fg:#f3f5f7;--ui-muted:#c0c7cf;--ui-border:#56616c;--ui-input:#252b31;
  --ui-button:#3a434c;--ui-button-fg:#f7f9fa;--ui-button-hover:#46515c;
  --ui-active:#8b343d;--ui-active-fg:#fff;--ui-accent:#e0b666;--ui-link:#b9d8f2;
}
body[data-theme="light"]{
  --ui-bg:#f2f5f7;--ui-surface:#ffffff;--ui-surface-2:#f4f7f9;--ui-surface-3:#e8edf1;
  --ui-fg:#202830;--ui-muted:#5e6974;--ui-border:#cbd4dc;--ui-input:#ffffff;
  --ui-button:#e8edf1;--ui-button-fg:#25303a;--ui-button-hover:#dbe3e9;
  --ui-active:#8d3039;--ui-active-fg:#ffffff;--ui-accent:#8a6127;--ui-link:#315f8c;
}
body[data-theme="pastel"]{
  --ui-bg:#f6f1f5;--ui-surface:#fffafd;--ui-surface-2:#f5edf3;--ui-surface-3:#e9f1ed;
  --ui-fg:#332e36;--ui-muted:#675f69;--ui-border:#d6cad3;--ui-input:#fffefe;
  --ui-button:#eadfe8;--ui-button-fg:#3a323c;--ui-button-hover:#dfd1dc;
  --ui-active:#8a3d58;--ui-active-fg:#fff;--ui-accent:#765528;--ui-link:#465f7a;
}

body[data-theme]{background:var(--ui-bg)!important;color:var(--ui-fg)!important}
body[data-theme] :is(h1,h2,h3,h4,h5,h6,strong,b,label,legend,td,th){color:var(--ui-fg)}
body[data-theme] :is(.muted,.sub,.hint,.help,.meta,.description,.subtitle,small){color:var(--ui-muted)!important}
body[data-theme] a:not(.btn):not(.board-tab):not(.mobile-quick-dock a):not(.mobile-more-menu-grid a){color:var(--ui-link)}

/* primary chrome */
body[data-theme] :is(.topbar,.nav,.mobile-quick-dock,.mobile-bottom-nav,.user-id-dropdown){background:var(--ui-surface)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}
body[data-theme] :is(.topbar,.nav,.mobile-quick-dock,.mobile-bottom-nav) a{color:var(--ui-muted)!important}
body[data-theme] :is(.topbar,.nav,.mobile-quick-dock,.mobile-bottom-nav) a.active{color:var(--ui-fg)!important}
body[data-theme] .brand,body[data-theme] .brand b,body[data-theme] .user-id-button{color:var(--ui-fg)!important}

/* surfaces: explicit high-traffic classes plus conservative class-name fallbacks */
body[data-theme] :is(
  .panel,.card,.stat,.modal-card,.board-card,.form-section,.dashboard-card,.content-card,.profile-section,
  .admin-section,.dashboard-section,.board-panel,.boss-panel,.attendance-panel,.member-profile-panel,.equipment-preview,
  .clan-member-card,.clan-search-box,.active-search-info,.skill-selector,.selected-skill-box,.armor-slot-card,.weapon-slot-card,
  .admin-menu-card,.admin-user-card,.admin-account-card,.admin-backup-form,.admin-distribution-card,.compact-ledger,
  .siege-card,.siege-report-card,.siege-participation-section,.siege-event-dialog,.distribution-detail-panel,
  .public-legal-v3118,.contact-form-v3118,.clan-code-polished,.mobile-more-menu-sheet
){background:var(--ui-surface)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}
body[data-theme] :is(.clan-member-summary>div,.skills-all,.selected-skill-tag,.profile-popup-stats>div,.profile-popup-equipment>div,.siege-detail-stats>div,.siege-my-summary>div,.my-distribution-summary){background:var(--ui-surface-2)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}

/* forms */
body[data-theme] :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea){background:var(--ui-input)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}
body[data-theme] :is(input,textarea)::placeholder{color:var(--ui-muted)!important;opacity:.9}
body[data-theme] select option{background:var(--ui-surface)!important;color:var(--ui-fg)!important}

/* generic controls: eliminate inherited black buttons in bright themes */
body[data-theme] :is(button,.btn,input[type="button"],input[type="submit"]):not(.danger):not(.delete-btn):not(.mobile-more-menu-backdrop){background:var(--ui-button)!important;color:var(--ui-button-fg)!important;border-color:var(--ui-border)!important}
body[data-theme] :is(button,.btn,input[type="button"],input[type="submit"]):not(.danger):not(.delete-btn):not(.mobile-more-menu-backdrop):hover{background:var(--ui-button-hover)!important;color:var(--ui-button-fg)!important}
body[data-theme] :is(button.primary,.btn.primary,.primary-button,button[type="submit"].primary,.auth button[type="submit"]){background:var(--ui-active)!important;color:var(--ui-active-fg)!important;border-color:color-mix(in srgb,var(--ui-active) 80%,#000)!important}
body[data-theme] :is(.danger,.delete-btn,.btn-danger){background:#7f2932!important;color:#fff!important;border-color:#9a3a45!important}
body[data-theme] :is(button,.btn):disabled{opacity:.55!important;color:var(--ui-muted)!important}

/* tabs / segmented controls */
body[data-theme] :is(
  .tabs button,.board-tab,.embedded-manage-tabs button,.attendance-mode-tabs button,.member-trend-tabs button,
  .boss-top-tabs button,.boss-info-mode-tabs button,.boss-analysis-tabs button,.combined-member-rank-tabs button,
  .site-manage-tabs button,.admin-log-tabs button,.member-search-tabs button,.clan-search-modes button
){background:var(--ui-surface-2)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}
body[data-theme] :is(
  .tabs button.active,.board-tab.active,.embedded-manage-tabs button.active,.attendance-mode-tabs button.active,
  .member-trend-tabs button.active,.boss-top-tabs button.active,.boss-info-mode-tabs button.active,
  .boss-analysis-tabs button.active,.combined-member-rank-tabs button.active,.site-manage-tabs button.active,
  .admin-log-tabs button.active,.member-search-tabs button.active,.clan-search-modes button.active,
  [aria-selected="true"]
){background:var(--ui-active)!important;color:var(--ui-active-fg)!important;border-color:var(--ui-active)!important}

/* tables and list rows */
body[data-theme] :is(table,tbody,tr,td,th){color:var(--ui-fg);border-color:var(--ui-border)!important}
body[data-theme] :is(thead th,.table-head,.board-head){background:var(--ui-surface-3)!important;color:var(--ui-fg)!important}
body[data-theme] tbody tr:nth-child(even){background:color-mix(in srgb,var(--ui-surface-2) 55%,transparent)}

/* mobile menu: legacy rules used dark gradients with !important */
body[data-theme] .mobile-more-menu-sheet.menu-v390{background:var(--ui-surface)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}
body[data-theme] .mobile-more-menu-head button{background:var(--ui-button)!important;color:var(--ui-button-fg)!important}
body[data-theme] .mobile-more-menu-grid.menu-v390-grid a{background:var(--ui-surface-2)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}
body[data-theme] .mobile-more-menu-grid.menu-v390-grid a .mobile-menu-copy b{color:var(--ui-fg)!important}
body[data-theme] .mobile-more-menu-grid.menu-v390-grid a .mobile-menu-copy small{color:var(--ui-muted)!important}
body[data-theme] .mobile-more-menu-grid.menu-v390-grid a em{color:var(--ui-muted)!important}
body[data-theme] .mobile-more-menu-grid.menu-v390-grid a::before{opacity:.5!important}
body[data-theme] .mobile-quick-dock>.mobile-more-menu-button{background:var(--ui-surface)!important;color:var(--ui-muted)!important;border-color:var(--ui-border)!important}
body[data-theme] .mobile-quick-dock>.mobile-more-menu-button.active{background:var(--ui-surface-2)!important;color:var(--ui-fg)!important}

/* support/legal in mobile menu */
.mobile-menu-support-v3119{display:none}
@media(max-width:820px){
  .auth-footer-v3119{display:none!important}
  .mobile-menu-support-v3119{display:grid;gap:9px;margin:18px 2px 4px;padding:16px 4px 4px;border-top:1px solid var(--ui-border);text-align:center}
  .mobile-menu-support-links-v3119{display:flex;justify-content:center;align-items:center;gap:0;flex-wrap:wrap}
  .mobile-menu-support-links-v3119 a{padding:5px 10px;color:var(--ui-link)!important;font-size:12px;font-weight:750;text-decoration:none}
  .mobile-menu-support-links-v3119 a+a{border-left:1px solid var(--ui-border)}
  .mobile-menu-support-v3119 small{font-size:11px!important;color:var(--ui-muted)!important}
}

/* legal/contact pages follow the active theme instead of hard-coded black inputs */
body[data-theme] .public-footer-v3118{color:var(--ui-muted)!important}
body[data-theme] .public-footer-v3118 a{color:var(--ui-link)!important}
body[data-theme] .contact-form-v3118 :is(input,select,textarea){background:var(--ui-input)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}
body[data-theme] :is(.contact-direct-v3118,.legal-date-v3118){color:var(--ui-muted)!important}

/* readability guard for status chips/badges that use colored fills */
body[data-theme="light"] :is(.badge,.chip,.tag,.status-badge,.official-feed-badge,.official-status-badge),
body[data-theme="pastel"] :is(.badge,.chip,.tag,.status-badge,.official-feed-badge,.official-status-badge){text-shadow:none!important}


/* =========================================================
   v3.122 - bright theme contrast audit and visual separation
   Light is neutral/white with high-contrast charcoal text.
   Pastel is intentionally tinted and still uses dark readable text.
   This final block overrides legacy mobile rules that hard-code dark-theme
   text colours (including the dashboard level cards shown in the audit).
   ========================================================= */
body[data-theme="light"]{
  --ui-bg:#eef2f5;--ui-surface:#ffffff;--ui-surface-2:#f3f6f8;--ui-surface-3:#e4e9ee;
  --ui-fg:#17212b;--ui-muted:#53606d;--ui-border:#c5ced7;--ui-input:#ffffff;
  --ui-button:#e1e7ec;--ui-button-fg:#1c2833;--ui-button-hover:#d4dde4;
  --ui-active:#9e303b;--ui-active-fg:#ffffff;--ui-accent:#775321;--ui-link:#225d91;
  --theme-surface:#ffffff;--theme-surface-2:#f3f6f8;--theme-surface-3:#e4e9ee;
  --theme-input:#ffffff;--theme-border:#c5ced7;--theme-fg:#17212b;--theme-sub:#53606d;
  background:#eef2f5!important;color:#17212b!important;
}
body[data-theme="pastel"]{
  --ui-bg:#f3ecf1;--ui-surface:#fff9fc;--ui-surface-2:#f4e8f0;--ui-surface-3:#e6f0eb;
  --ui-fg:#302a33;--ui-muted:#625867;--ui-border:#d4c3cf;--ui-input:#fffdfd;
  --ui-button:#e7d9e3;--ui-button-fg:#352d38;--ui-button-hover:#dccbd7;
  --ui-active:#8e3d59;--ui-active-fg:#ffffff;--ui-accent:#725027;--ui-link:#3b5876;
  --theme-surface:#fff9fc;--theme-surface-2:#f4e8f0;--theme-surface-3:#e6f0eb;
  --theme-input:#fffdfd;--theme-border:#d4c3cf;--theme-fg:#302a33;--theme-sub:#625867;
  background:#f3ecf1!important;color:#302a33!important;
}

/* Bright-theme text must never inherit dark-theme pale/white literals. */
body[data-theme="light"] :is(
  .level-card-button span,.level-card-button strong,.level-card-button em,.level-card-button small,
  .class-count-grid span,.class-count-grid b,.class-count-name,.improved-class-card b,
  .compact-total-card span,.compact-total-card b,.active-member-number strong,.active-member-number em,
  .skill-card,.skill-card span,.skill-card b,.skill-card strong,.skills-board h3,.skills-board span,.skills-board b,
  .news-item,.news-item span,.news-item b,.quick-link-card,.quick-link-card b,
  .top-notice-head a,.top-notice-head h2,.major-title,
  .attendance-member-card,.attendance-member-card span,.attendance-member-card b,
  .member-card-meta,.member-class-line,.member-inline-level,.member-joined-line,
  .board-list-card,.board-list-card span,.board-list-card small,.board-list-card b,
  .admin-menu-card,.admin-menu-card span,.admin-menu-card small,.admin-menu-card b
){color:#17212b!important}
body[data-theme="light"] :is(.muted,.sub,.hint,.help,.meta,.description,.subtitle,.no-skill-selected,.selected-skill-box>span){color:#53606d!important}

body[data-theme="pastel"] :is(
  .level-card-button span,.level-card-button strong,.level-card-button em,.level-card-button small,
  .class-count-grid span,.class-count-grid b,.class-count-name,.improved-class-card b,
  .compact-total-card span,.compact-total-card b,.active-member-number strong,.active-member-number em,
  .skill-card,.skill-card span,.skill-card b,.skill-card strong,.skills-board h3,.skills-board span,.skills-board b,
  .news-item,.news-item span,.news-item b,.quick-link-card,.quick-link-card b,
  .top-notice-head a,.top-notice-head h2,.major-title,
  .attendance-member-card,.attendance-member-card span,.attendance-member-card b,
  .member-card-meta,.member-class-line,.member-inline-level,.member-joined-line,
  .board-list-card,.board-list-card span,.board-list-card small,.board-list-card b,
  .admin-menu-card,.admin-menu-card span,.admin-menu-card small,.admin-menu-card b
){color:#302a33!important}
body[data-theme="pastel"] :is(.muted,.sub,.hint,.help,.meta,.description,.subtitle,.no-skill-selected,.selected-skill-box>span){color:#625867!important}

/* Dashboard: legacy mobile style.css forced a nearly black card and pale text. */
body[data-theme="light"] .level-card-button{
  background:#ffffff!important;border-color:#c5ced7!important;color:#17212b!important;
  box-shadow:0 2px 8px rgba(31,44,56,.07)!important;
}
body[data-theme="pastel"] .level-card-button{
  background:linear-gradient(145deg,#fff9fc,#f2e8ef)!important;border-color:#d4c3cf!important;color:#302a33!important;
  box-shadow:0 2px 9px rgba(72,51,67,.07)!important;
}
body[data-theme="light"] .level-card-button:hover{background:#f7f9fa!important;border-color:#9daab5!important;filter:none!important}
body[data-theme="pastel"] .level-card-button:hover{background:#f0e3ec!important;border-color:#bda8b7!important;filter:none!important}
body[data-theme="light"] .level-card-button::before,body[data-theme="pastel"] .level-card-button::before{opacity:.95!important}

/* Home class summary and skill cards - keep surfaces different between light/pastel. */
body[data-theme="light"] :is(.improved-activity-panel,.improved-class-grid,.improved-class-card,.skills-board section,.skill-card,.news-item,.quick-link-card,.important-top>.empty){
  background:#ffffff!important;border-color:#c5ced7!important;color:#17212b!important;
}
body[data-theme="pastel"] :is(.improved-activity-panel,.improved-class-grid,.improved-class-card,.skills-board section,.skill-card,.news-item,.quick-link-card,.important-top>.empty){
  background:#fff9fc!important;border-color:#d4c3cf!important;color:#302a33!important;
}
body[data-theme="light"] .class-count-inner{background:#f6f8fa!important;color:#17212b!important}
body[data-theme="pastel"] .class-count-inner{background:#f4e8f0!important;color:#302a33!important}

/* Selection controls: readable normal/selected/disabled states. */
body[data-theme="light"] :is(.skill-choice,.selected-skill-tag,.default-profile-option,.armor-slot-card,.weapon-slot-card){
  background:#f3f6f8!important;color:#17212b!important;border-color:#c5ced7!important;
}
body[data-theme="pastel"] :is(.skill-choice,.selected-skill-tag,.default-profile-option,.armor-slot-card,.weapon-slot-card){
  background:#f4e8f0!important;color:#302a33!important;border-color:#d4c3cf!important;
}
body[data-theme="light"] .skill-choice.selected,body[data-theme="pastel"] .skill-choice.selected{
  background:var(--ui-active)!important;color:#fff!important;border-color:var(--ui-active)!important;
}
body[data-theme="light"] :is(button,.btn,.skill-choice):disabled,body[data-theme="pastel"] :is(button,.btn,.skill-choice):disabled{
  opacity:1!important;background:var(--ui-surface-3)!important;color:var(--ui-muted)!important;border-color:var(--ui-border)!important;
}

/* Footer/menu/legal and form readability in bright themes. */
body[data-theme="light"] :is(.public-footer-v3118,.mobile-menu-support-v3119,.public-legal-v3118){color:#53606d!important}
body[data-theme="pastel"] :is(.public-footer-v3118,.mobile-menu-support-v3119,.public-legal-v3118){color:#625867!important}
body[data-theme="light"] :is(.contact-form-v3118 input,.contact-form-v3118 select,.contact-form-v3118 textarea){background:#fff!important;color:#17212b!important;border-color:#c5ced7!important}
body[data-theme="pastel"] :is(.contact-form-v3118 input,.contact-form-v3118 select,.contact-form-v3118 textarea){background:#fffdfd!important;color:#302a33!important;border-color:#d4c3cf!important}

/* Keep the mobile fixed search control readable without a dark block in bright themes. */
body[data-theme="light"] .global-search-fab,body[data-theme="light"] .global-search-open{background:#ffffff!important;color:#17212b!important;border-color:#bfc8d1!important}
body[data-theme="pastel"] .global-search-fab,body[data-theme="pastel"] .global-search-open{background:#fff9fc!important;color:#302a33!important;border-color:#d4c3cf!important}

@media(max-width:600px){
  body[data-theme="light"] .level-card-button,body[data-theme="pastel"] .level-card-button{min-height:72px!important}
  body[data-theme="light"] .skills-board section{background:#ffffff!important;border-color:#c5ced7!important}
  body[data-theme="pastel"] .skills-board section{background:#fff9fc!important;border-color:#d4c3cf!important}
  body[data-theme="light"] .quick-link-card{background:#ffffff!important;border-color:#c5ced7!important}
  body[data-theme="pastel"] .quick-link-card{background:#fff9fc!important;border-color:#d4c3cf!important}
}

/* =========================================================
   v3.127 - topbar account/role controls follow the active theme
   Do not let the generic themed button rule paint the user id as a block.
   The role badge also uses semantic theme surfaces instead of legacy brown.
   ========================================================= */
body[data-theme] .topbar .user-id-button{
  background:transparent!important;
  color:var(--ui-fg)!important;
  border:1px solid transparent!important;
  box-shadow:none!important;
  filter:none!important;
  border-radius:9px!important;
}
body[data-theme] .topbar .user-id-button:hover,
body[data-theme] .topbar .user-id-button:focus-visible{
  background:var(--ui-surface-2)!important;
  color:var(--ui-fg)!important;
  border-color:var(--ui-border)!important;
}
body[data-theme] .topbar .user-id-caret{color:var(--ui-muted)!important}
body[data-theme] .topbar .top-role-badge{
  background:var(--ui-surface-2)!important;
  color:var(--ui-fg)!important;
  border:1px solid var(--ui-border)!important;
  box-shadow:none!important;
  filter:none!important;
}

/* =========================================================
   v3.129 - canonical four-theme palette + full neutral-surface audit
   One palette owns page/chrome/surface/control/text colours.  Legacy dark
   literals are normalized here instead of being repaired screen-by-screen.
   Semantic red/green/gold states remain intentional accents.
   ========================================================= */
body[data-theme="dark"]{
  --ui-bg:#0d1218;--ui-surface:#151c24;--ui-surface-2:#1b2530;--ui-surface-3:#25313d;
  --ui-input:#111820;--ui-border:#344352;--ui-fg:#f1f4f7;--ui-muted:#a8b3bf;
  --ui-button:#25313d;--ui-button-fg:#f1f4f7;--ui-button-hover:#303e4c;
  --ui-active:#972d38;--ui-active-fg:#fff;--ui-accent:#d1a85a;--ui-link:#a9cae8;
  --ui-shadow:rgba(0,0,0,.30);
}
body[data-theme="medium"]{
  --ui-bg:#252a30;--ui-surface:#30363d;--ui-surface-2:#3a4149;--ui-surface-3:#454e57;
  --ui-input:#2a3036;--ui-border:#59646f;--ui-fg:#f3f5f7;--ui-muted:#c1c7ce;
  --ui-button:#414a53;--ui-button-fg:#f5f7f8;--ui-button-hover:#4c5661;
  --ui-active:#963742;--ui-active-fg:#fff;--ui-accent:#dfb566;--ui-link:#bad8f0;
  --ui-shadow:rgba(0,0,0,.20);
}
body[data-theme="light"]{
  --ui-bg:#eef2f5;--ui-surface:#ffffff;--ui-surface-2:#f5f7f9;--ui-surface-3:#e8edf1;
  --ui-input:#ffffff;--ui-border:#c6d0d9;--ui-fg:#18232d;--ui-muted:#596674;
  --ui-button:#e7ecf0;--ui-button-fg:#1e2a35;--ui-button-hover:#d9e1e7;
  --ui-active:#a3313d;--ui-active-fg:#fff;--ui-accent:#77531f;--ui-link:#255f91;
  --ui-shadow:rgba(31,43,54,.09);
}
body[data-theme="pastel"]{
  --ui-bg:#f4eef3;--ui-surface:#fffafd;--ui-surface-2:#f5eaf1;--ui-surface-3:#e8f0ec;
  --ui-input:#fffdfd;--ui-border:#d5c7d1;--ui-fg:#332d36;--ui-muted:#665d69;
  --ui-button:#eadde6;--ui-button-fg:#382f3b;--ui-button-hover:#decfda;
  --ui-active:#93415d;--ui-active-fg:#fff;--ui-accent:#715026;--ui-link:#405f7c;
  --ui-shadow:rgba(75,52,69,.09);
}

body[data-theme]{background:var(--ui-bg)!important;color:var(--ui-fg)!important}
body[data-theme] main,body[data-theme] .container,body[data-theme] .page-wrap{color:var(--ui-fg)}

/* chrome and fixed navigation */
body[data-theme] :is(.topbar,.nav,.mobile-quick-dock,.mobile-bottom-nav,.mobile-more-menu-sheet,.user-id-dropdown){
  background:var(--ui-surface)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important;
}
body[data-theme] :is(.topbar,.nav,.mobile-quick-dock,.mobile-bottom-nav){box-shadow:0 1px 0 var(--ui-border)!important}

/* neutral surfaces. Only existing surface tokens are recoloured; layout is untouched. */
body[data-theme] :is(
  .panel,.card,.stat,.modal-card,.board-card,.form-section,.dashboard-card,.content-card,.profile-section,
  .admin-section,.dashboard-section,.board-panel,.boss-panel,.attendance-panel,.member-profile-panel,.equipment-preview,
  .clan-member-card,.clan-search-box,.active-search-info,.skill-selector,.selected-skill-box,.armor-slot-card,.weapon-slot-card,
  .admin-menu-card,.admin-user-card,.admin-account-card,.admin-backup-form,.admin-distribution-card,.compact-ledger,
  .siege-card,.siege-report-card,.siege-participation-section,.siege-event-dialog,.distribution-detail-panel,
  .distribution-write-hint,.distribution-compose-fields,.distribution-member-picker,.distribution-live-calc,
  .clan-item-stock-summary,.clan-item-stock-modal-card,.clan-item-stock-group,.notice-unread-list,
  .board-manager-block,.global-search-detail,.gs-char-eq,.access-log-list,.admin-log-tabs,
  .boss-register-panel,.boss-time-info-card,.boss-drop-panel,.boss-analysis-modal-card,.boss-participant-modal-card,
  .my-boss-summary,.clan-boss-summary,.boss-info-summary,.boss-info-card,.boss-analysis-card,
  .public-legal-v3118,.contact-form-v3118,.clan-code-polished,.mobile-more-menu-sheet
){background:var(--ui-surface)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important;box-shadow:none}

body[data-theme] :is(
  .clan-member-summary>div,.selected-skill-tag,.profile-popup-stats>div,.profile-popup-equipment>div,
  .siege-detail-stats>div,.siege-my-summary>div,.my-distribution-summary,.class-count-inner,
  .board-list-card,.news-item,.quick-link-card,.skill-card,.attendance-member-card,.admin-event-list article,
  .distribution-history-list>div,.clan-item-stock-group-list>div,.clan-item-stock-item,.boss-period-list>div,
  .boss-click-row,.boss-drop-row,.my-boss-time-list article,.boss-analysis-row,.boss-ranking-row
){background:var(--ui-surface-2)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}

/* forms and neutral controls */
body[data-theme] :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea){background:var(--ui-input)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}
body[data-theme] :is(input,textarea)::placeholder{color:var(--ui-muted)!important;opacity:.92}
body[data-theme] select option{background:var(--ui-surface)!important;color:var(--ui-fg)!important}
body[data-theme] :is(button,.btn,input[type="button"],input[type="submit"]):not(.danger):not(.delete-btn):not(.boss-floating-save):not(.board-compose-fab):not(.mobile-more-menu-backdrop){
  background:var(--ui-button)!important;color:var(--ui-button-fg)!important;border-color:var(--ui-border)!important;filter:none!important
}
body[data-theme] :is(button,.btn):not(.danger):not(.delete-btn):not(.boss-floating-save):not(.board-compose-fab):hover{background:var(--ui-button-hover)!important;color:var(--ui-button-fg)!important}

/* all segmented/tab systems */
body[data-theme] :is(
  .tabs,.board-tabs,.boss-top-tabs,.boss-main-tabs,.boss-info-mode-tabs,.boss-analysis-tabs,.attendance-mode-tabs,
  .member-trend-tabs,.combined-member-rank-tabs,.site-manage-tabs,.boss-time-admin-tabs,.member-search-tabs,
  .clan-search-modes,.embedded-manage-tabs,.admin-log-tabs,.ledger-tabs,.relations-tabs
){background:var(--ui-surface)!important;border-color:var(--ui-border)!important}
body[data-theme] :is(
  .tabs button,.tabs a,.board-tab,.boss-top-tabs button,.boss-top-tabs a,.boss-info-mode-tabs button,.boss-info-mode-tabs a,
  .boss-analysis-tabs button,.attendance-mode-tabs button,.member-trend-tabs button,.combined-member-rank-tabs button,
  .site-manage-tabs button,.boss-time-admin-tabs a,.member-search-tabs button,.clan-search-modes button,
  .embedded-manage-tabs button,.admin-log-tabs button,.ledger-tabs button,.relations-tabs button
){background:var(--ui-surface-2)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important;filter:none!important}
body[data-theme] :is(
  .tabs button.active,.tabs a.active,.board-tab.active,.boss-top-tabs button.active,.boss-top-tabs a.active,
  .boss-info-mode-tabs button.active,.boss-info-mode-tabs a.active,.boss-analysis-tabs button.active,
  .attendance-mode-tabs button.active,.member-trend-tabs button.active,.combined-member-rank-tabs button.active,
  .site-manage-tabs button.active,.boss-time-admin-tabs a.active,.member-search-tabs button.active,
  .clan-search-modes button.active,.embedded-manage-tabs button.active,.admin-log-tabs button.active,
  .ledger-tabs button.active,.relations-tabs button.active,[aria-selected="true"]
){background:var(--ui-active)!important;color:var(--ui-active-fg)!important;border-color:var(--ui-active)!important}

/* boss screen: remove the dark-only island visible in light/pastel themes */
body[data-theme] .boss-register-panel{background:var(--ui-surface)!important}
body[data-theme] .boss-click-row{background:var(--ui-surface-2)!important;border-color:var(--ui-border)!important}
body[data-theme] .boss-time-cell{background:transparent!important;color:var(--ui-fg)!important;border-color:transparent!important}
body[data-theme] .boss-time-cell>strong,body[data-theme] .boss-click-row>strong{color:var(--ui-fg)!important}
body[data-theme] .boss-time-cell small,body[data-theme] .boss-register-guide{color:var(--ui-muted)!important}
body[data-theme] .boss-select-label{background:var(--ui-button)!important;color:var(--ui-button-fg)!important;border-color:var(--ui-border)!important}
body[data-theme] .boss-select-label:has(input:checked),body[data-theme] .boss-click-row button.joined{
  background:var(--ui-active)!important;color:var(--ui-active-fg)!important;border-color:var(--ui-active)!important
}
body[data-theme] .boss-select-label:has(input:checked) :is(span,b,strong),body[data-theme] .boss-click-row button.joined :is(span,b,strong){color:var(--ui-active-fg)!important}
body[data-theme] :is(.boss-section-title,.boss-drop-head h2,.boss-register-date-center strong,.date-head strong){color:var(--ui-fg)!important}
body[data-theme] :is(.boss-register-date>a,.boss-calendar-button){background:var(--ui-button)!important;color:var(--ui-button-fg)!important;border-color:var(--ui-border)!important}
body[data-theme] .boss-row-locked{opacity:.66}
body[data-theme] .boss-select-label.locked{opacity:.52}

/* tables/list headers and empty states */
body[data-theme] :is(table,tbody,tr,td,th){color:var(--ui-fg);border-color:var(--ui-border)!important}
body[data-theme] :is(thead th,.table-head,.board-head,.compact-ledger-head){background:var(--ui-surface-3)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}
body[data-theme] :is(.empty,.empty-state,.board-empty-card,.gs-empty,.no-data,.no-result){color:var(--ui-muted)!important;border-color:var(--ui-border)!important}

/* text hierarchy: prevent pale dark-theme literals on bright surfaces */
body[data-theme] :is(h1,h2,h3,h4,h5,h6,.page-title,.major-title,.card-title,.panel-title,strong,b,label,legend,td,th){color:var(--ui-fg)}
body[data-theme] :is(.muted,.sub,.hint,.help,.meta,.description,.subtitle,.caption,small,.member-card-meta,.member-class-line,.member-joined-line){color:var(--ui-muted)!important}
body[data-theme] a:not(.btn):not(.board-tab):not(.boss-top-tabs a):not(.mobile-quick-dock a):not(.mobile-more-menu-grid a){color:var(--ui-link)}

/* top account and role badge */
body[data-theme] .topbar .user-id-button{background:transparent!important;color:var(--ui-fg)!important;border-color:transparent!important;box-shadow:none!important}
body[data-theme] .topbar .user-id-button:is(:hover,:focus-visible){background:var(--ui-surface-2)!important;border-color:var(--ui-border)!important}
body[data-theme] .topbar .user-id-caret{color:var(--ui-muted)!important}
body[data-theme] .topbar .top-role-badge{background:var(--ui-surface-2)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important;box-shadow:none!important}

/* fixed actions: intentional accent, never theme-neutral black */
body[data-theme] :is(.boss-floating-save,.board-compose-fab,.tab-compose-open.primary){background:var(--ui-active)!important;color:var(--ui-active-fg)!important;border-color:color-mix(in srgb,var(--ui-active) 75%,#000)!important;filter:none!important}
body[data-theme] :is(.global-search-fab,.global-search-open){background:var(--ui-surface)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important;box-shadow:0 8px 22px var(--ui-shadow)!important}

/* keep semantic status colours semantic, but force readable foregrounds */
body[data-theme] :is(.danger,.delete-btn,.btn-danger,.error,.status-error){color:#fff!important}
body[data-theme] :is(.boss-save-result,.success,.status-success){color:inherit}

/* bright-theme final contrast guard for known legacy text islands */
body[data-theme="light"] :is(.boss-register-panel,.boss-click-row,.boss-select-label,.boss-time-cell,.boss-top-tabs,.boss-time-info-card,.boss-drop-panel) *,
body[data-theme="pastel"] :is(.boss-register-panel,.boss-click-row,.boss-select-label,.boss-time-cell,.boss-top-tabs,.boss-time-info-card,.boss-drop-panel) *{text-shadow:none}


/* =========================================================
   v3.131 - theme system completion / contrast audit
   All four themes own status surfaces, profile controls, file controls and
   legacy dark islands. This layer intentionally wins over old hard-coded CSS.
   ========================================================= */
body[data-theme="dark"]{
  --ui-success-bg:#163b2c;--ui-success-fg:#d8f6e6;--ui-success-border:#2c7354;
  --ui-warning-bg:#493817;--ui-warning-fg:#ffe8ad;--ui-warning-border:#8c6c2d;
  --ui-error-bg:#55242a;--ui-error-fg:#ffe1e4;--ui-error-border:#9f4751;
}
body[data-theme="medium"]{
  --ui-success-bg:#244737;--ui-success-fg:#e0f7ea;--ui-success-border:#4f8068;
  --ui-warning-bg:#554723;--ui-warning-fg:#fff0bf;--ui-warning-border:#92783c;
  --ui-error-bg:#63333a;--ui-error-fg:#ffe6e8;--ui-error-border:#a75b64;
}
body[data-theme="light"]{
  --ui-success-bg:#e6f4ec;--ui-success-fg:#205b3e;--ui-success-border:#9bc7ae;
  --ui-warning-bg:#fff4d9;--ui-warning-fg:#6a5015;--ui-warning-border:#ddc178;
  --ui-error-bg:#fbe9eb;--ui-error-fg:#852f39;--ui-error-border:#dfa6ad;
}
body[data-theme="pastel"]{
  --ui-success-bg:#e8f3ed;--ui-success-fg:#315d49;--ui-success-border:#aecdbd;
  --ui-warning-bg:#f7efd9;--ui-warning-fg:#6c5624;--ui-warning-border:#d8c38d;
  --ui-error-bg:#f7e6ea;--ui-error-fg:#7f3a4c;--ui-error-border:#d8aab7;
}

/* semantic notices: never dark text on dark green/red */
body[data-theme] :is(.success,.status-success,.boss-save-result,.ok,.notice-success){
  background:var(--ui-success-bg)!important;color:var(--ui-success-fg)!important;
  border-color:var(--ui-success-border)!important;box-shadow:none!important;
}
body[data-theme] :is(.success,.status-success,.boss-save-result,.ok,.notice-success) :is(span,b,strong,small,p){color:var(--ui-success-fg)!important}
body[data-theme] :is(.warning,.status-warning,.notice-warning){
  background:var(--ui-warning-bg)!important;color:var(--ui-warning-fg)!important;border-color:var(--ui-warning-border)!important;
}
body[data-theme] :is(.warning,.status-warning,.notice-warning) :is(span,b,strong,small,p){color:var(--ui-warning-fg)!important}
body[data-theme] :is(.error,.status-error,.notice-error){
  background:var(--ui-error-bg)!important;color:var(--ui-error-fg)!important;border-color:var(--ui-error-border)!important;
}
body[data-theme] :is(.error,.status-error,.notice-error) :is(span,b,strong,small,p){color:var(--ui-error-fg)!important}

/* profile image controls had old #121c26/#182532 literals */
body[data-theme] .profile-photo-action-details>summary,
body[data-theme] .profile-photo-reset-btn,
body[data-theme] .profile-photo-file,
body[data-theme] .admin-file-picker{
  background:var(--ui-button)!important;color:var(--ui-button-fg)!important;
  border-color:var(--ui-border)!important;filter:none!important;box-shadow:none!important;
}
body[data-theme] .profile-photo-action-details[open]>summary,
body[data-theme] .profile-photo-action-details>summary:hover,
body[data-theme] .profile-photo-reset-btn:hover{
  background:var(--ui-button-hover)!important;color:var(--ui-button-fg)!important;border-color:var(--ui-border)!important;
}
body[data-theme] .profile-photo-side-head span,
body[data-theme] .profile-photo-copy p,
body[data-theme] .admin-file-picker>em{color:var(--ui-muted)!important}
body[data-theme] .admin-file-picker>span{background:var(--ui-surface-3)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}

/* profile/forms: pastel is intentionally warm blush, not 'light + pink page'. */
body[data-theme="pastel"] :is(.profile-photo-panel,.profile-entry-form,.profile-entry-form .form-section,.equipment-preview,.default-profile-picker){
  background:var(--ui-surface)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important;
}
body[data-theme="pastel"] :is(.profile-entry-form input,.profile-entry-form select,.profile-entry-form textarea){
  background:var(--ui-input)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important;
}
body[data-theme="pastel"] :is(.default-profile-option,.selected-skill-tag,.armor-slot-card,.weapon-slot-card){
  background:var(--ui-surface-2)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important;
}

/* rank badges keep rank meaning but avoid dark-only member badge in bright themes. */
body[data-theme="light"] .clan-rank-badge.rank-member{background:#edf1f4!important;color:#52606d!important;border-color:#c4cdd5!important}
body[data-theme="pastel"] .clan-rank-badge.rank-member{background:#f0e6ed!important;color:#675b68!important;border-color:#d2c0cc!important}

/* final neutral-island sweep for legacy controls that are not generic .btn/.panel */
body[data-theme] :is(
  .profile-password-shortcut,.distribution-picker-head,.default-profile-picker-head,.admin-file-picker,
  .global-search-input-wrap,.global-search-detail-head,.gs-result-card,.gs-result-row,.notice-check-item,
  .board-system-row,.board-custom-row,.access-log-row,.audit-log-row,.admin-code-list article,
  .boss-code-history,.boss-code-history-row,.class-member-panel,.class-member-row,.skill-member-row
){background:var(--ui-surface-2)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}

/* text children of neutral components must follow semantic hierarchy. */
body[data-theme] :is(
  .profile-photo-panel,.profile-entry-form,.default-profile-picker,.clan-member-card,.admin-file-picker,
  .global-search-detail,.board-system-row,.board-custom-row,.access-log-row,.audit-log-row
) :is(h1,h2,h3,h4,b,strong,label){color:var(--ui-fg)!important}
body[data-theme] :is(
  .profile-photo-panel,.profile-entry-form,.default-profile-picker,.clan-member-card,.admin-file-picker,
  .global-search-detail,.board-system-row,.board-custom-row,.access-log-row,.audit-log-row
) :is(small,.muted,.meta,.hint,.sub){color:var(--ui-muted)!important}

/* =========================================================
   v3.131 - bright/pastel contrast and surface normalization
   Screenshot audit: no legacy dark/brown islands in light themes.
   ========================================================= */
body[data-theme="light"]{
  --ui-bg:#eef2f5;--ui-surface:#ffffff;--ui-surface-2:#f4f7f9;--ui-surface-3:#e8edf1;
  --ui-input:#ffffff;--ui-border:#c5cfd8;--ui-fg:#1f2933;--ui-muted:#64717e;
  --ui-button:#edf1f4;--ui-button-fg:#27333d;--ui-button-hover:#e1e7ec;
}
body[data-theme="pastel"]{
  --ui-bg:#f5eef3;--ui-surface:#fffafd;--ui-surface-2:#f3e7ef;--ui-surface-3:#eaf3ee;
  --ui-input:#fffdfd;--ui-border:#d6c5d1;--ui-fg:#352f38;--ui-muted:#706673;
  --ui-button:#eadce6;--ui-button-fg:#3d3440;--ui-button-hover:#dfceda;
}

/* Profile skill and equipment screens */
body[data-theme="light"] :is(.skill-selector,.selected-skill-box,.selected-skill-count,.weapon-slot-card,.armor-slot-card,.equipment-preview,.profile-password-shortcut){
  background:#f7f9fb!important;color:#1f2933!important;border-color:#cbd4dc!important;box-shadow:none!important;
}
body[data-theme="pastel"] :is(.skill-selector,.selected-skill-box,.selected-skill-count,.weapon-slot-card,.armor-slot-card,.equipment-preview,.profile-password-shortcut){
  background:#f7edf3!important;color:#352f38!important;border-color:#d8c8d3!important;box-shadow:none!important;
}
body[data-theme="light"] .selected-skill-count b,
body[data-theme="pastel"] .selected-skill-count b{color:var(--ui-fg)!important}
body[data-theme="light"] :is(.weapon-slot-title,.armor-slot-card>span,.equipment-section-head h2,.profile-skill-head h2),
body[data-theme="pastel"] :is(.weapon-slot-title,.armor-slot-card>span,.equipment-section-head h2,.profile-skill-head h2){color:var(--ui-fg)!important}
body[data-theme="light"] :is(.equipment-section-head p,.profile-skill-head p,.selected-skill-box>span),
body[data-theme="pastel"] :is(.equipment-section-head p,.profile-skill-head p,.selected-skill-box>span){color:var(--ui-muted)!important}
body[data-theme="light"] :is(.weapon-control-row select,.armor-control-row select,.armor-control-row input,.accessory-item select),
body[data-theme="pastel"] :is(.weapon-control-row select,.armor-control-row select,.armor-control-row input,.accessory-item select){
  background:var(--ui-input)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important;
}
body[data-theme="light"] .profile-password-shortcut a,
body[data-theme="pastel"] .profile-password-shortcut a{
  background:var(--ui-button)!important;color:var(--ui-button-fg)!important;border-color:var(--ui-border)!important;filter:none!important;
}
body[data-theme="light"] .profile-password-shortcut a:hover,
body[data-theme="pastel"] .profile-password-shortcut a:hover{background:var(--ui-button-hover)!important;color:var(--ui-button-fg)!important}
body[data-theme="light"] .profile-password-shortcut strong,
body[data-theme="pastel"] .profile-password-shortcut strong{color:var(--ui-fg)!important}
body[data-theme="light"] .profile-password-shortcut span,
body[data-theme="pastel"] .profile-password-shortcut span{color:var(--ui-muted)!important}

/* Skill chips: keep readable but theme-consistent neutral tint until selected. */
body[data-theme="light"] .skill-choice:not(.selected){background:#edf1f4!important;color:#4d5965!important;border-color:#d1d8df!important;opacity:1!important;filter:none!important}
body[data-theme="pastel"] .skill-choice:not(.selected){background:#eee3ea!important;color:#514653!important;border-color:#dacbd5!important;opacity:1!important;filter:none!important}

/* Member search */
body[data-theme="light"] :is(.clan-search-box,.clan-search-modes button,.clan-sort-row button,.clan-reset-btn,.clan-submit-btn){filter:none!important}
body[data-theme="pastel"] :is(.clan-search-box,.clan-search-modes button,.clan-sort-row button,.clan-reset-btn,.clan-submit-btn){filter:none!important}
body[data-theme="light"] .clan-search-box{background:#ffffff!important;border-color:#c5cfd8!important}
body[data-theme="pastel"] .clan-search-box{background:linear-gradient(135deg,#fff9fc,#f4eeeF)!important;border-color:#d6c5d1!important}
body[data-theme="light"] .clan-search-modes button,
body[data-theme="light"] .clan-sort-row button,
body[data-theme="light"] .clan-reset-btn{background:#edf1f4!important;color:#2d3741!important;border-color:#ccd4db!important}
body[data-theme="pastel"] .clan-search-modes button,
body[data-theme="pastel"] .clan-sort-row button,
body[data-theme="pastel"] .clan-reset-btn{background:#eadde6!important;color:#403642!important;border-color:#d7c6d2!important}
body[data-theme="light"] :is(.clan-search-modes button.active,.clan-sort-row button.active,.clan-submit-btn){background:#dfe5ea!important;color:#1f2933!important;border-color:#aeb9c3!important}
body[data-theme="pastel"] :is(.clan-search-modes button.active,.clan-sort-row button.active,.clan-submit-btn){background:#dfcfd9!important;color:#352f38!important;border-color:#c6afbd!important}
body[data-theme="light"] .clan-reset-btn:hover,body[data-theme="light"] .clan-search-modes button:hover,body[data-theme="light"] .clan-sort-row button:hover{background:#e2e8ed!important;color:#1f2933!important}
body[data-theme="pastel"] .clan-reset-btn:hover,body[data-theme="pastel"] .clan-search-modes button:hover,body[data-theme="pastel"] .clan-sort-row button:hover{background:#dfd0da!important;color:#352f38!important}
body[data-theme="light"] .clan-sort-row{border-color:#d4dbe1!important}
body[data-theme="pastel"] .clan-sort-row{border-color:#ddcfd8!important}

/* Member cards and their internal cells */
body[data-theme="light"] .clan-member-card{background:#ffffff!important;color:#1f2933!important;border-color:#c9d2da!important;box-shadow:0 2px 8px rgba(35,48,60,.06)!important}
body[data-theme="pastel"] .clan-member-card{background:linear-gradient(145deg,#fffafd,#f8f1f6)!important;color:#352f38!important;border-color:#d8c7d2!important;box-shadow:0 2px 9px rgba(75,52,69,.06)!important}
body[data-theme="light"] .clan-member-summary>div{background:#f8fafb!important;border-color:#d6dde3!important;color:#1f2933!important}
body[data-theme="pastel"] .clan-member-summary>div{background:linear-gradient(135deg,#f9f1f6,#eef5f1)!important;border-color:#dccfd7!important;color:#352f38!important}
body[data-theme="light"] :is(.member-weapon-row-v397>span,.member-weapon-row-v397 .weapon-short-v397,.member-stats-stacked-v3103 .member-stat-pair){background:#f8fafb!important;border-color:#d6dde3!important;color:#1f2933!important}
body[data-theme="pastel"] :is(.member-weapon-row-v397>span,.member-weapon-row-v397 .weapon-short-v397,.member-stats-stacked-v3103 .member-stat-pair){background:linear-gradient(135deg,#fbf4f8,#f0f6f2)!important;border-color:#ddd0d8!important;color:#352f38!important}
body[data-theme="light"] .clan-member-summary.expanded .skill-chip-list.member-skill-four-v397 i{background:#e9edf1!important;color:#3f4b57!important;border-color:#cdd6de!important}
body[data-theme="pastel"] .clan-member-summary.expanded .skill-chip-list.member-skill-four-v397 i{background:#5b4c5d!important;color:#fff!important;border-color:#6b5a6d!important}
body[data-theme="light"] :is(.member-weapon-row-v397>span,.member-stats-stacked-v3103 small){color:#5f6b77!important}
body[data-theme="pastel"] :is(.member-weapon-row-v397>span,.member-stats-stacked-v3103 small){color:#675d69!important}
body[data-theme="light"] :is(.member-weapon-row-v397 .weapon-short-v397,.member-stats-stacked-v3103 b){color:#1f2933!important}
body[data-theme="pastel"] :is(.member-weapon-row-v397 .weapon-short-v397,.member-stats-stacked-v3103 b){color:#352f38!important}

/* Top account: username and role are same height and use the same family of surfaces. */
body[data-theme="light"] .topbar .user-id-button{background:#f2f5f7!important;color:#1f2933!important;border-color:#d2d9df!important}
body[data-theme="light"] .topbar .top-role-badge{background:#edf1f4!important;color:#34404b!important;border-color:#ccd4db!important}
body[data-theme="pastel"] .topbar .user-id-button{background:#eee2ea!important;color:#352f38!important;border-color:#d8c7d2!important}
body[data-theme="pastel"] .topbar .top-role-badge{background:#f3e9ef!important;color:#493e4b!important;border-color:#dbcbd5!important}


/* =========================================================
   v3.132 - full bright-theme audit for admin/settings pages
   Fixes legacy dark islands that survived v3.131 due to template-local CSS.
   ========================================================= */
body[data-theme="light"] :is(
  .dashboard-config-block,.profile-skill-class-picker-v3108,.profile-skill-admin-group,
  .profile-option-db-summary,.site-option-group-chooser,.site-settings-tabs-v3108,
  .site-settings-card-v369,.site-name-preview-v369,.profile-mode-choice-v372,
  .profile-update-cycle-v3121,.rank-permission-table-wrap,.backup-switch-v369,
  .excel-export-check-grid-v380 label,.bottom-tab-choice-v381,.clan-code-admin-card
){background:#f7f9fb!important;color:#1f2933!important;border-color:#cbd4dc!important;box-shadow:none!important}
body[data-theme="pastel"] :is(
  .dashboard-config-block,.profile-skill-class-picker-v3108,.profile-skill-admin-group,
  .profile-option-db-summary,.site-option-group-chooser,.site-settings-tabs-v3108,
  .site-settings-card-v369,.site-name-preview-v369,.profile-mode-choice-v372,
  .profile-update-cycle-v3121,.rank-permission-table-wrap,.backup-switch-v369,
  .excel-export-check-grid-v380 label,.bottom-tab-choice-v381,.clan-code-admin-card
){background:#f7edf3!important;color:#352f38!important;border-color:#d8c8d3!important;box-shadow:none!important}

body[data-theme="light"] :is(.profile-skill-admin-grid label,.dashboard-level-row,.dashboard-skill-row,.audit-log-row,.access-log-row){background:#fff!important;color:#1f2933!important;border-color:#d2dae1!important}
body[data-theme="pastel"] :is(.profile-skill-admin-grid label,.dashboard-level-row,.dashboard-skill-row,.audit-log-row,.access-log-row){background:#fffafd!important;color:#352f38!important;border-color:#dccfd7!important}

body[data-theme="light"] :is(.dashboard-config-block,.profile-skill-class-picker-v3108,.profile-skill-admin-group,.site-settings-card-v369,.audit-log-row,.access-log-row) :is(h2,h3,b,strong,label,span){color:#1f2933!important}
body[data-theme="pastel"] :is(.dashboard-config-block,.profile-skill-class-picker-v3108,.profile-skill-admin-group,.site-settings-card-v369,.audit-log-row,.access-log-row) :is(h2,h3,b,strong,label,span){color:#352f38!important}
body[data-theme="light"] :is(.dashboard-config-note,.profile-skill-class-picker-v3108 span,.profile-skill-class-head-v3108 span,.audit-log-row time){color:#6b7783!important}
body[data-theme="pastel"] :is(.dashboard-config-note,.profile-skill-class-picker-v3108 span,.profile-skill-class-head-v3108 span,.audit-log-row time){color:#746a76!important}

body[data-theme="light"] :is(.dashboard-level-row input,.dashboard-skill-row input,.dashboard-skill-row select,.dashboard-skill-add input,.dashboard-skill-add select,.dashboard-level-add input,.profile-skill-admin-search){background:#fff!important;color:#1f2933!important;border-color:#c5cfd8!important}
body[data-theme="pastel"] :is(.dashboard-level-row input,.dashboard-skill-row input,.dashboard-skill-row select,.dashboard-skill-add input,.dashboard-skill-add select,.dashboard-level-add input,.profile-skill-admin-search){background:#fffdfd!important;color:#352f38!important;border-color:#d6c5d1!important}
body[data-theme="light"] .dashboard-skill-icon-preview{background:#eef2f5!important;border-color:#cbd4dc!important}
body[data-theme="pastel"] .dashboard-skill-icon-preview{background:#efe4eb!important;border-color:#d8c8d3!important}

/* Audit operation badges: preserve meaning without unreadable dark olive/brown blocks. */
body[data-theme="light"] .audit-action{background:#e7edf2!important;color:#34414d!important;border:1px solid #c8d1d9!important}
body[data-theme="light"] .audit-action.update{background:#f1ead7!important;color:#6a541f!important;border-color:#ddd0a9!important}
body[data-theme="light"] .audit-action.delete{background:#f4e1e4!important;color:#7b3038!important;border-color:#dfbcc1!important}
body[data-theme="pastel"] .audit-action{background:#eee4eb!important;color:#4c414e!important;border:1px solid #d8c8d3!important}
body[data-theme="pastel"] .audit-action.update{background:#f2ead8!important;color:#6c5728!important;border-color:#dfd1ad!important}
body[data-theme="pastel"] .audit-action.delete{background:#f4dfe5!important;color:#7d3345!important;border-color:#dfbcc7!important}

/* Local admin tabs/buttons must not retain dark template-local colors. */
body[data-theme="light"] :is(.site-settings-tabs-v3108 button,.combined-member-rank-tabs button){background:#edf1f4!important;color:#2d3741!important;border-color:#ccd4db!important}
body[data-theme="pastel"] :is(.site-settings-tabs-v3108 button,.combined-member-rank-tabs button){background:#eadde6!important;color:#403642!important;border-color:#d7c6d2!important}
body[data-theme="light"] :is(.site-settings-tabs-v3108 button.active,.combined-member-rank-tabs button.active){background:#dfe5ea!important;color:#1f2933!important;border-color:#aeb9c3!important;box-shadow:inset 0 -3px 0 #c93649!important}
body[data-theme="pastel"] :is(.site-settings-tabs-v3108 button.active,.combined-member-rank-tabs button.active){background:#dfcfd9!important;color:#352f38!important;border-color:#c6afbd!important;box-shadow:inset 0 -3px 0 #c93649!important}

/* Account name + role: same visual height/baseline on mobile and desktop. */
.topbar .user-id-button,.topbar .top-role-badge{height:44px!important;min-height:44px!important;box-sizing:border-box!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;margin:0!important}
.topbar .user-id-button{padding:0 12px!important}
.topbar .top-role-badge{padding:0 12px!important;line-height:1!important}
@media(max-width:640px){.topbar .user-id-button,.topbar .top-role-badge{height:42px!important;min-height:42px!important;padding-left:10px!important;padding-right:10px!important}}

/* Member skill 4-chip cell: fixed 2x2 area, never crop the second row. */
.clan-member-summary.expanded .skills-all.member-skills-fixed-v397{min-height:86px!important;height:auto!important;overflow:visible!important;align-items:stretch!important}
.clan-member-summary.expanded .skill-chip-list.member-skill-four-v397{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(32px,auto))!important;gap:6px!important;min-height:70px!important;height:auto!important;overflow:visible!important;align-content:center!important}
.clan-member-summary.expanded .skill-chip-list.member-skill-four-v397 i{min-height:32px!important;height:auto!important;display:flex!important;align-items:center!important;justify-content:center!important;box-sizing:border-box!important}
@media(max-width:640px){.clan-member-summary.expanded .skills-all.member-skills-fixed-v397{min-height:82px!important}.clan-member-summary.expanded .skill-chip-list.member-skill-four-v397{min-height:66px!important;grid-template-rows:repeat(2,minmax(30px,auto))!important}.clan-member-summary.expanded .skill-chip-list.member-skill-four-v397 i{min-height:30px!important}}

/* Profile update reminder: action group supports an explicit shortcut button. */
.profile-update-reminder-actions-v3132{display:flex;align-items:center;gap:8px;flex:0 0 auto}
.profile-update-reminder-actions-v3132 a{white-space:nowrap}
.profile-update-reminder-actions-v3132 .profile-update-direct-v3132{background:var(--ui-button)!important;color:var(--ui-button-fg)!important;border:1px solid var(--ui-border)!important}
@media(max-width:640px){.profile-update-reminder-v3121{align-items:flex-start!important}.profile-update-reminder-actions-v3132{flex-direction:column;align-items:stretch}.profile-update-reminder-actions-v3132 a{text-align:center}}

/* =========================================================
   v3.133 - full bright/pastel audit layer
   Rule: bright themes never inherit legacy dark-only panels.
   Covers public tabs, detail modals, boss screens and all admin panels.
   ========================================================= */
body[data-theme="light"],body[data-theme="pastel"]{
  --legacy-panel:var(--ui-surface);
  --legacy-panel-2:var(--ui-surface-2);
  --legacy-panel-3:var(--ui-surface-3);
  --legacy-text:var(--ui-fg);
  --legacy-muted:var(--ui-muted);
  --legacy-line:var(--ui-border);
}

/* Common semantic containers used throughout tabs/admin pages */
body[data-theme="light"] :is(.panel,.admin-section,.admin-detail-panel,.form-section,.settings-card,.manage-card,.summary-card,.info-card),
body[data-theme="pastel"] :is(.panel,.admin-section,.admin-detail-panel,.form-section,.settings-card,.manage-card,.summary-card,.info-card){
  background:var(--ui-surface)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important;
}
body[data-theme="light"] :is(.admin-subcard,.admin-menu-card,.site-option-row,.site-option-card,.setting-row,.config-row,.stat-card,.summary-row),
body[data-theme="pastel"] :is(.admin-subcard,.admin-menu-card,.site-option-row,.site-option-card,.setting-row,.config-row,.stat-card,.summary-row){
  background:var(--ui-surface-2)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important;
}

/* Boss admin - every box in 시즌/혈원수정/시간대별 보스 */
body[data-theme="light"] :is(.boss-input-settings-form>label,.boss-count-mode-card>span,.boss-main-weight-settings,.boss-time-batch-row,.boss-time-batch-add,.boss-season-row,.boss-admin-event,.boss-admin-card,.boss-status-cell),
body[data-theme="pastel"] :is(.boss-input-settings-form>label,.boss-count-mode-card>span,.boss-main-weight-settings,.boss-time-batch-row,.boss-time-batch-add,.boss-season-row,.boss-admin-event,.boss-admin-card,.boss-status-cell){
  background:var(--ui-surface-2)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important;box-shadow:none!important;
}
body[data-theme="light"] :is(.boss-input-settings-form input,.boss-input-settings-form select,.boss-time-batch-row input,.boss-time-batch-add input,.boss-time-batch-add select,.boss-main-weight-settings input),
body[data-theme="pastel"] :is(.boss-input-settings-form input,.boss-input-settings-form select,.boss-time-batch-row input,.boss-time-batch-add input,.boss-time-batch-add select,.boss-main-weight-settings input){
  background:var(--ui-input)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important;
}
body[data-theme="light"] :is(.boss-input-settings-form span,.boss-input-settings-form em,.boss-count-mode-card small,.boss-main-weight-settings small),
body[data-theme="pastel"] :is(.boss-input-settings-form span,.boss-input-settings-form em,.boss-count-mode-card small,.boss-main-weight-settings small){color:var(--ui-muted)!important}
body[data-theme="light"] .boss-count-mode-card input:checked+span,
body[data-theme="pastel"] .boss-count-mode-card input:checked+span{background:color-mix(in srgb,var(--ui-active) 10%,var(--ui-surface-2))!important;color:var(--ui-fg)!important;border-color:var(--ui-active)!important}

/* Boss public pages - my/clan/day/week/month/season */
body[data-theme="light"] :is(.boss-info-period-row,.boss-public-stat-cards>div,.boss-clan-rate-row,.boss-my-period-list article,.boss-drop-panel,.boss-drop-row,.boss-participants-card,.boss-rate-modal-card),
body[data-theme="pastel"] :is(.boss-info-period-row,.boss-public-stat-cards>div,.boss-clan-rate-row,.boss-my-period-list article,.boss-drop-panel,.boss-drop-row,.boss-participants-card,.boss-rate-modal-card){
  background:var(--ui-surface-2)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important;box-shadow:none!important;
}
body[data-theme="light"] .boss-clan-rate-head,
body[data-theme="pastel"] .boss-clan-rate-head{background:var(--ui-surface-3)!important;color:var(--ui-muted)!important}
body[data-theme="light"] :is(.boss-public-stat-cards span,.boss-info-period-row span,.boss-rate-name small,.boss-section-title small,.boss-drop-head span),
body[data-theme="pastel"] :is(.boss-public-stat-cards span,.boss-info-period-row span,.boss-rate-name small,.boss-section-title small,.boss-drop-head span){color:var(--ui-muted)!important}
body[data-theme="light"] :is(.boss-public-stat-cards strong,.boss-clan-rate-row b,.boss-period-copy b),
body[data-theme="pastel"] :is(.boss-public-stat-cards strong,.boss-clan-rate-row b,.boss-period-copy b){color:var(--ui-fg)!important}
body[data-theme="light"] :is(.boss-season-select-form select,.boss-period-calendar-form input,.boss-drop-register-form input,.boss-drop-register-form select),
body[data-theme="pastel"] :is(.boss-season-select-form select,.boss-period-calendar-form input,.boss-drop-register-form input,.boss-drop-register-form select){background:var(--ui-input)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}

/* Global search: panel, detail, chips and result rows must follow theme */
body[data-theme="light"] :is(.global-search-panel,.global-search-head,.global-search-detail,.global-search-results,.global-search-input-wrap),
body[data-theme="pastel"] :is(.global-search-panel,.global-search-head,.global-search-detail,.global-search-results,.global-search-input-wrap){background:var(--ui-surface)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}
body[data-theme="light"] :is(.gs-result-row,.gs-char-eq,.gs-drop-history-row,.gs-chip-list span,.gs-link-chip,.gs-back),
body[data-theme="pastel"] :is(.gs-result-row,.gs-char-eq,.gs-drop-history-row,.gs-chip-list span,.gs-link-chip,.gs-back){background:var(--ui-surface-2)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}
body[data-theme="light"] :is(.gs-result-row small,.gs-result-row i,.gs-detail-field span,.gs-detail-block>span,.gs-char-eq span,.gs-drop-history-row time,.global-search-hint),
body[data-theme="pastel"] :is(.gs-result-row small,.gs-result-row i,.gs-detail-field span,.gs-detail-block>span,.gs-char-eq span,.gs-drop-history-row time,.global-search-hint){color:var(--ui-muted)!important}
body[data-theme="light"] .global-search-input-wrap input,
body[data-theme="pastel"] .global-search-input-wrap input{color:var(--ui-fg)!important}
body[data-theme="light"] .global-search-input-wrap input::placeholder,
body[data-theme="pastel"] .global-search-input-wrap input::placeholder{color:var(--ui-muted)!important}

/* Admin controls and logs: eliminate remaining old #08/#0b/#0f dark islands */
body[data-theme="light"] :is(.clan-code-admin-card,.profile-skill-class-picker-v3108,.bottom-tab-choice-v381,.excel-export-sheet-list-v379 span,.excel-export-check-grid-v380 label,.admin-code-list article,.audit-log-row,.access-log-row,.site-option-list article,.dashboard-config-row,.rank-permission-card,.trash-row),
body[data-theme="pastel"] :is(.clan-code-admin-card,.profile-skill-class-picker-v3108,.bottom-tab-choice-v381,.excel-export-sheet-list-v379 span,.excel-export-check-grid-v380 label,.admin-code-list article,.audit-log-row,.access-log-row,.site-option-list article,.dashboard-config-row,.rank-permission-card,.trash-row){background:var(--ui-surface-2)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}
body[data-theme="light"] :is(.excel-export-tools-v380 button,.combined-member-rank-tabs button,.site-settings-tabs-v3108 button),
body[data-theme="pastel"] :is(.excel-export-tools-v380 button,.combined-member-rank-tabs button,.site-settings-tabs-v3108 button){background:var(--ui-button)!important;color:var(--ui-button-fg)!important;border-color:var(--ui-border)!important}
body[data-theme="light"] :is(.bottom-tab-choice-v381:has(input:checked),.excel-export-check-grid-v380 label:has(input:checked)),
body[data-theme="pastel"] :is(.bottom-tab-choice-v381:has(input:checked),.excel-export-check-grid-v380 label:has(input:checked)){background:color-mix(in srgb,var(--ui-active) 10%,var(--ui-surface-2))!important;border-color:var(--ui-active)!important;color:var(--ui-fg)!important}

/* Detail/modal/popup surfaces */
body[data-theme="light"] :is(.profile-popup,.profile-popup-equipment>div,.profile-popup-stats>div,.tab-compose-box.open,.tab-compose-form,.modal-card,.dialog-card),
body[data-theme="pastel"] :is(.profile-popup,.profile-popup-equipment>div,.profile-popup-stats>div,.tab-compose-box.open,.tab-compose-form,.modal-card,.dialog-card){background:var(--ui-surface)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important}

/* Final bright-theme text guard: legacy selectors often leave near-black text on overridden panels */
body[data-theme="light"] :is(.admin-detail-panel,.boss-public-info-panel,.boss-register-panel,.global-search-panel,.profile-popup) :is(h1,h2,h3,h4,h5,b,strong,label),
body[data-theme="pastel"] :is(.admin-detail-panel,.boss-public-info-panel,.boss-register-panel,.global-search-panel,.profile-popup) :is(h1,h2,h3,h4,h5,b,strong,label){color:var(--ui-fg)!important;text-shadow:none!important}
body[data-theme="light"] :is(.admin-detail-panel,.boss-public-info-panel,.boss-register-panel,.global-search-panel,.profile-popup) :is(.muted,.sub,.hint,small),
body[data-theme="pastel"] :is(.admin-detail-panel,.boss-public-info-panel,.boss-register-panel,.global-search-panel,.profile-popup) :is(.muted,.sub,.hint,small){color:var(--ui-muted)!important;text-shadow:none!important}


/* =========================================================
   v3.134 - light/pastel complete board + relations audit
   No legacy dark table/card remains on bright themes.
   ========================================================= */
body[data-theme="light"] :is(
  .board-card-list,.board-list-card,.board-click-card-inner,.clan-name-only-card,
  .kill-list-table-wrap,.kill-list-table,.kill-list-tr,.tab-compose-box,.board-compose-form,
  .info-compose-category-chip
),
body[data-theme="pastel"] :is(
  .board-card-list,.board-list-card,.board-click-card-inner,.clan-name-only-card,
  .kill-list-table-wrap,.kill-list-table,.kill-list-tr,.tab-compose-box,.board-compose-form,
  .info-compose-category-chip
){
  background:var(--ui-surface)!important;
  color:var(--ui-fg)!important;
  border-color:var(--ui-border)!important;
  box-shadow:none!important;
}
body[data-theme="light"] :is(.kill-list-th,.board-card-meta,.board-last-edit),
body[data-theme="pastel"] :is(.kill-list-th,.board-card-meta,.board-last-edit){
  background:var(--ui-surface-2)!important;
  color:var(--ui-muted)!important;
  border-color:var(--ui-border)!important;
}
body[data-theme="light"] :is(.kill-list-tr>div,.kill-name,.kill-reason,.clan-name-only-card h3,.board-list-card h3,.board-list-card p),
body[data-theme="pastel"] :is(.kill-list-tr>div,.kill-name,.kill-reason,.clan-name-only-card h3,.board-list-card h3,.board-list-card p){
  color:var(--ui-fg)!important;
  text-shadow:none!important;
}
body[data-theme="light"] :is(.kill-list-th>div,.board-card-meta,.board-last-edit),
body[data-theme="pastel"] :is(.kill-list-th>div,.board-card-meta,.board-last-edit){color:var(--ui-muted)!important}
body[data-theme="light"] .clan-relation-mark-empty,
body[data-theme="pastel"] .clan-relation-mark-empty{
  background:var(--ui-surface-3)!important;
  color:var(--ui-muted)!important;
  border-color:var(--ui-border)!important;
}
body[data-theme="light"] .board-edit-link,
body[data-theme="pastel"] .board-edit-link{
  background:var(--ui-button)!important;
  color:var(--ui-button-fg)!important;
  border:1px solid var(--ui-border)!important;
}
body[data-theme="light"] :is(.kill-search-wrap input,.board-compose-form input,.board-compose-form textarea,.board-compose-form select),
body[data-theme="pastel"] :is(.kill-search-wrap input,.board-compose-form input,.board-compose-form textarea,.board-compose-form select){
  background:var(--ui-input)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important;
}
body[data-theme="light"] :is(.kill-search-wrap input,.board-compose-form input,.board-compose-form textarea)::placeholder,
body[data-theme="pastel"] :is(.kill-search-wrap input,.board-compose-form input,.board-compose-form textarea)::placeholder{color:var(--ui-muted)!important}

/* Generic bright-theme safeguard for repeated admin/list rows that still use dark legacy CSS. */
body[data-theme="light"] :is(.admin-card,.admin-row,.admin-list-row,.admin-table-row,.admin-table-head,.list-row,.table-row,.table-head,.data-row,.data-head),
body[data-theme="pastel"] :is(.admin-card,.admin-row,.admin-list-row,.admin-table-row,.admin-table-head,.list-row,.table-row,.table-head,.data-row,.data-head){
  background:var(--ui-surface-2)!important;color:var(--ui-fg)!important;border-color:var(--ui-border)!important;
}
body[data-theme="light"] :is(.admin-card,.admin-row,.admin-list-row,.admin-table-row,.admin-table-head,.list-row,.table-row,.table-head,.data-row,.data-head) *,
body[data-theme="pastel"] :is(.admin-card,.admin-row,.admin-list-row,.admin-table-row,.admin-table-head,.list-row,.table-row,.table-head,.data-row,.data-head) *{text-shadow:none}
