/* Light and dark are reading surfaces; character themes continue to own the accent. */
.quick-appearance,.appearance-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.quick-appearance label{display:grid;grid-template-columns:18px 44px minmax(0,1fr);align-items:center;gap:7px;min-width:0;margin:0;padding:8px;border:1px solid var(--line);border-radius:9px;background:var(--paper,#fff);color:var(--ink);cursor:pointer}
.quick-appearance label:has(input:checked){border-color:var(--green,var(--accent));background:var(--soft)}
.quick-appearance input{width:16px;height:16px;margin:0;accent-color:var(--green,var(--accent))}
.quick-appearance label>span:last-child{display:grid;gap:2px;min-width:0}.quick-appearance strong{font-size:12px}.quick-appearance small{font-size:11px;line-height:1.25;color:var(--muted)}
.quick-appearance-art,.appearance-preview{display:grid;align-content:start;gap:4px;border:1px solid #b5c4cb;border-radius:5px;padding:7px}
.quick-appearance-art{width:42px;height:34px}.quick-appearance-art i,.appearance-preview i{height:3px;border-radius:2px;background:currentColor}.quick-appearance-art i:nth-child(2),.appearance-preview i:nth-child(2){width:66%}
[data-appearance-art=light],.appearance-preview-light{background:#fff;color:#546874}
[data-appearance-art=dark],.appearance-preview-dark{background:#17232c;color:#cbd9df;border-color:#536571}
.appearance-panel{margin-bottom:20px}.appearance-panel legend{padding:0 8px;font-size:20px;font-weight:650}.appearance-panel>p{margin:0 0 13px}
.student-appearance-panel{margin-bottom:20px!important;padding-bottom:20px!important;border-bottom:1px solid var(--line)!important}
.student-appearance-panel>p{margin:-4px 0 10px;color:var(--muted);font-size:12px}
.appearance-choices{max-width:520px}
.appearance-choice{position:relative;display:grid;grid-template-columns:86px minmax(0,1fr);grid-template-rows:auto auto;align-content:center;gap:2px 12px;min-height:72px;margin:0;padding:11px 35px 11px 11px;border:1px solid var(--line);border-radius:10px;background:var(--paper,#fff);color:var(--ink);cursor:pointer}
.appearance-choice:has(input:checked){border-color:var(--green,var(--accent));box-shadow:0 0 0 1px var(--green,var(--accent))}
.appearance-choice:has(input:focus-visible),.quick-appearance label:has(input:focus-visible){outline:2px solid var(--green,var(--accent));outline-offset:3px}
.appearance-choice input{position:absolute;right:12px;top:13px;width:18px;height:18px;margin:0;accent-color:var(--green,var(--accent))}
.appearance-preview{grid-row:1/3;width:86px;height:49px}.appearance-preview i{height:4px}.appearance-preview i:last-child{width:80%;height:10px;opacity:.4}
.appearance-choice strong{font-size:14px}.appearance-choice small{font-size:11px;color:var(--muted)}

html[data-appearance=dark]{color-scheme:dark;--ink:#e8eef1;--muted:#b3c0c8;--line:#40505a;--bg:#111b22;--soft:#26343d;--paper:#1a2730;--surface:#1a2730;--surface-raised:#22313b;--field:#17242d;--motif:none;--theme-motif:none;scrollbar-color:#526573 #111b22}
html[data-appearance=dark][data-theme=builder]{--green:#f0bf74;--accent:#f0bf74;--action-bg:#87500a}
html[data-appearance=dark][data-theme=panda]{--green:#9ad7ab;--accent:#9ad7ab;--action-bg:#32633f}
html[data-appearance=dark][data-theme=spider]{--green:#f3a0a8;--accent:#f3a0a8;--action-bg:#9a3140}
html[data-appearance=dark][data-theme=avengers]{--green:#c5adef;--accent:#c5adef;--action-bg:#655092}
html[data-appearance=dark][data-theme=captain]{--green:#9bc5ee;--accent:#9bc5ee;--action-bg:#2b527e}
html[data-appearance=dark] body{background:var(--bg);color:var(--ink)}
html[data-appearance=dark] :is(.sidebar,.student-header,.panel,.rendered-question,.question,.stat,.paper-card,.theme-choice,.student-theme-choice,.density-choice,.identity-choice,.concept-card,.quick-settings-panel,.advanced-filter-drawer,.advanced-filter-header,.advanced-filter-tools,.advanced-filter-footer,.advanced-save-panel,.advanced-field-menu,.quick-settings-trigger,.quick-settings-all,.personalize-trigger,.multi-filter-button,.multi-filter-menu,.concept-suggestions,.concept-suggestion,.advanced-concept-options,.advanced-concept-options button,.advanced-parameter-list button,.advanced-delete-view,.advanced-add,.print-select-label,.print-template){background:var(--surface);color:var(--ink)}
html[data-appearance=dark] .sidebar{background:linear-gradient(180deg,var(--soft),var(--surface) 220px)}
html[data-appearance=dark] .theme-choice[data-theme]{--ink:inherit;--muted:inherit;--line:inherit;--bg:inherit;--soft:inherit;--green:inherit;--accent:inherit;--motif:none}
html[data-appearance=dark] .nav-button{color:var(--muted)}
html[data-appearance=dark] .nav-button.active{background:var(--soft);color:var(--ink)}
html[data-appearance=dark] :is(.header-search,.student-header-search){background:var(--field);border-color:var(--line)}
html[data-appearance=dark] .header-search:focus-within{background:var(--field)}
html[data-appearance=dark] .header-search kbd{background:var(--surface-raised);color:var(--muted)}
html[data-appearance=dark] :is(input,select,textarea,.button.secondary,.search-field input,.advanced-rule-fields select,.advanced-rule-value,.advanced-concept-input,.concept-match button,.quick-themes button,.quick-equation-sizes label){background-color:var(--field);border-color:var(--line);color:var(--ink)}
html[data-appearance=dark] input::placeholder,html[data-appearance=dark] textarea::placeholder{color:#a9b7c0;opacity:1}
html[data-appearance=dark] :is(.button:not(.secondary),.mobile-filter-badge,.advanced-trigger-count){background:var(--action-bg);border-color:var(--action-bg);color:#fff}
html[data-appearance=dark] :is(.button.secondary,.quick-settings-trigger,.quick-settings-all,.multi-filter-button,.concept-suggestion,.advanced-parameter-list button,.advanced-delete-view,.advanced-add,.nav-button,.text-button,.print-select-label):hover{background:var(--soft)}
html[data-appearance=dark] :is(.option,.option-cell,.passage,.stimulus-body,.advanced-rule,.advanced-logic-preview,.quick-density-art,.density-mini,.student-header-search,.concept-chip,.concept,.badge,.selected-concept-chip,.welcome-quote,.motivation-prop){background-color:var(--surface-raised);color:var(--ink);border-color:var(--line)}
html[data-appearance=dark] :is(.concept-chip,.concept,.option>strong,.option-number,.question-share,.question-heading .badge,.selected-concept-chip,.motivation-next,.motivation-heading){color:var(--green,var(--accent))}
html[data-appearance=dark] .student-header-search:focus-within{background:var(--field)}
html[data-appearance=dark] .student-header-search kbd{background:var(--surface-raised);color:var(--muted)}
html[data-appearance=dark] :is(.search-clear:hover,.concept-suggestion:hover,.concept-suggestion.is-active,.multi-filter-option:hover,.quick-density label:hover,.quick-themes button:hover,.quick-settings-close:hover,.advanced-concept-options button:hover){background:var(--soft)}
html[data-appearance=dark] .advanced-concept-options .advanced-concept-done{background:var(--green,var(--accent,#176b52));color:#fff}
html[data-appearance=dark] .advanced-concept-choices .advanced-option-checkbox{background:var(--surface);border-color:var(--line)}
html[data-appearance=dark] .advanced-concept-choices .is-selected .advanced-option-checkbox{background:var(--green,var(--accent,#176b52));border-color:var(--green,var(--accent,#176b52))}
html[data-appearance=dark] :is(.question-filter-dock,.student-motivation,.motivation,.question-filter-dock .mobile-filter-panel){background-color:var(--bg);background-image:none;color:var(--ink)}
html[data-appearance=dark] :is(.student-motivation,.motivation){background-color:var(--soft)}
html[data-appearance=dark] :is(.question-list .empty,#message,#notice,.source-ambiguity){background:var(--surface);color:var(--ink);border-color:var(--line)}
html[data-appearance=dark] :is(.review-note,.render-pending,.source-ambiguity summary){color:#efc386}
html[data-appearance=dark] :is(.account-edit-status.error,.row-save-status.error,#user-create-status.error,.advanced-filter-error){color:#ffaaa8}
html[data-appearance=dark] :is(th,.concept-table-wrap thead){background:var(--surface-raised);color:var(--muted)}
html[data-appearance=dark] :is(td,.catalogue-pagination,.question-footer){border-color:var(--line)}
html[data-appearance=dark] .quick-settings-panel{box-shadow:0 16px 36px #050b10a8}
html[data-appearance=dark] .quick-settings-panel header{background:transparent}
html[data-appearance=dark] .quick-appearance label:has(input:checked),html[data-appearance=dark] .print-template:has(input:checked){background:var(--soft)}
html[data-appearance=dark] .advanced-filter-drawer select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23e8eef1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E")}
html[data-appearance=dark] .user-management-panel .account-table td select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23e8eef1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E")}
html[data-appearance=dark] .print-dialog{background:var(--surface);color:var(--ink);border-color:var(--line)}
html[data-appearance=dark] .print-dialog :is(p,small){color:var(--muted)}
html[data-appearance=dark] .classification-editor{background:var(--surface-raised);color:var(--ink);border:1px solid var(--line)}
html[data-appearance=dark] .classification-editor :is(summary,label,.classification-hint,.classification-summary-hint){color:var(--ink)}
html[data-appearance=dark] .classification-editor :is(.classification-hint,.classification-summary-hint){color:var(--muted)}
html[data-appearance=dark] :is(.view-toggle,.concept-table-wrap,.advanced-filter-trigger){background:var(--surface);color:var(--ink);border-color:var(--line)}
html[data-appearance=dark] #concept-table :is(td[data-column=concept_id],th[data-column=concept_id],.catalogue-filter-row th:nth-child(2)){background:var(--surface)}
html[data-appearance=dark] #concept-table thead :is(th[data-column=concept_id],.catalogue-filter-row th:nth-child(2)){background:var(--soft)}
html[data-appearance=dark] #concept-table .catalogue-filter-row input{background:var(--field);color:var(--ink);border-color:var(--line)}
html[data-appearance=dark] .view-toggle button[aria-pressed=true]{background:var(--action-bg);color:#fff}
html[data-appearance=dark] .print-dialog .print-title-label{color:var(--ink)}
html[data-appearance=dark] .print-dialog .print-title-label input{background:var(--field);border-color:var(--line);color:var(--ink)}
html[data-appearance=dark] .print-dialog #share-status{color:var(--green,var(--accent))}
html[data-appearance=dark] .print-dialog :is(input[type=radio],input[type=checkbox]){accent-color:var(--green,var(--accent))}
html[data-appearance=dark] .print-sheet{color:#111;background:#fff}
@media(max-width:650px){.quick-appearance label{grid-template-columns:16px 32px minmax(0,1fr);gap:5px}.quick-appearance-art{width:32px}.appearance-choices{grid-template-columns:1fr}.appearance-choice{max-width:350px}}
