/* Work OS 1.11 — persistent dark appearance layered over every module. */
.topbar-actions{display:flex;align-items:center;gap:8px;flex:0 0 auto}
.theme-toggle{display:grid;place-items:center;color:var(--text-2)}
.theme-toggle span{display:block;font-size:17px;line-height:1;transform:translateY(-1px)}

html[data-theme="dark"]{
  color-scheme:dark;
  --ui-bg:#0f1218;
  --ui-surface:#181c24;
  --ui-surface-soft:#1d222c;
  --ui-surface-hover:#242a35;
  --ui-text:#edf0f6;
  --ui-text-secondary:#c1c8d3;
  --ui-text-muted:#8e98a8;
  --ui-border:#323947;
  --ui-border-strong:#465061;
  --ui-accent:#918aff;
  --ui-accent-hover:#a29cff;
  --ui-accent-soft:#292747;
  --ui-accent-border:#57518f;
  --ui-danger:#ed8585;
  --ui-danger-soft:#3a2329;
  --ui-success:#62bd8d;
  --ui-warning:#d7a15a;
  --ui-shadow-popover:0 18px 54px rgba(0,0,0,.48);
  --ui-focus-ring:0 0 0 3px rgba(145,138,255,.20);
  --bg:var(--ui-bg);
  --panel:var(--ui-surface);
  --panel-soft:var(--ui-surface-soft);
  --text:var(--ui-text);
  --text-2:var(--ui-text-secondary);
  --muted:var(--ui-text-muted);
  --border:var(--ui-border);
  --line:#282f3b;
  --accent:var(--ui-accent);
  --accent-soft:var(--ui-accent-soft);
  --red:var(--ui-danger);
  --red-soft:var(--ui-danger-soft);
  --green:var(--ui-success);
  --orange:var(--ui-warning);
  --shadow:var(--ui-shadow-popover);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .main{background:var(--bg);color:var(--text)}
html[data-theme="dark"] .sidebar{background:#141820;border-color:var(--border)}
html[data-theme="dark"] .topbar{border-color:var(--border)}
html[data-theme="dark"] .brand{color:var(--text)}
html[data-theme="dark"] .brand-mark{box-shadow:0 6px 18px rgba(104,95,255,.28)}
html[data-theme="dark"] .nav-btn{color:#aab3c0}
html[data-theme="dark"] .nav-btn:hover{background:#1c212b;color:var(--text)}
html[data-theme="dark"] .nav-btn.active{background:var(--accent-soft);color:#aaa5ff;border-color:#3f3b69}

html[data-theme="dark"] :is(.icon-btn,.ghost-btn,.month-picker-shell,.month-picker-month,.situation-btn,.calendar-mode,.calendar-quick-row button,.experience-chip,.experience-choice,.experience-custom-add,.experience-custom-input,.experience-custom-save,.experience-custom-cancel,.bjd-related-topic){
  background:var(--panel);border-color:var(--border);color:var(--text-2)
}
html[data-theme="dark"] :is(.icon-btn,.ghost-btn,.month-picker-month,.situation-btn,.calendar-mode,.calendar-quick-row button,.experience-chip,.experience-choice,.bjd-related-topic):hover{
  background:var(--ui-surface-hover);border-color:var(--ui-border-strong);color:var(--text)
}
html[data-theme="dark"] .primary-btn{background:var(--accent);border-color:var(--accent);color:#11131a}
html[data-theme="dark"] .primary-btn:hover{filter:brightness(1.08)}
html[data-theme="dark"] .theme-toggle{background:#1b2029;color:#d6d9ff}

html[data-theme="dark"] :is(input[type="text"],input[type="search"],input[type="date"],input[type="number"],input[type="email"],input[type="url"],select,textarea,.experience-search,.bjd-knowledge-tools input,.bjd-knowledge-tools select,.bjd-list-tools input){
  background:#151922!important;border-color:var(--border)!important;color:var(--text)!important;caret-color:#aaa5ff
}
html[data-theme="dark"] :is(input,select,textarea):focus{border-color:#7770d8!important;box-shadow:var(--ui-focus-ring)!important}
html[data-theme="dark"] ::placeholder{color:#6f7989}
html[data-theme="dark"] input:-webkit-autofill{-webkit-text-fill-color:var(--text);box-shadow:0 0 0 1000px #151922 inset}
html[data-theme="dark"] .field-label{color:#aab3c1}

html[data-theme="dark"] :is(.overview-strip,.today-card,.completed-list,.gantt-wrap,.summary-kpis,.summary-panel,.archive-table,.experience-table,.experience-auto-panel,.idea-card,.collection-card,.tag-filter,.bjd-product-card,.bjd-piece-summary,.bjd-lifecycle,.bjd-panel,.bjd-version-card,.bjd-step,.bjd-finish-empty,.bjd-finished-hero,.bjd-finish-metrics>div,.bjd-library-card,.bjd-knowledge-card,.bjd-relation-card,.idea-bjd-link){
  background:var(--panel);border-color:var(--border)
}
html[data-theme="dark"] :is(.gantt-head,.archive-head,.experience-head,.calendar-weekday){background:var(--panel-soft)}
html[data-theme="dark"] :is(.item-cell,.day-cell,.calendar-day){background:var(--panel)}
html[data-theme="dark"] :is(.gantt-head .item-cell,.calendar-day.blank){background:var(--panel-soft)}
html[data-theme="dark"] :is(.month-tab.active,.idea-tab.active,.experience-tab.active,.experience-type-btn.active){background:#292e39;color:var(--text)}
html[data-theme="dark"] :is(.month-tab,.idea-tab,.experience-tab,.experience-type-btn){color:var(--text-2)}
html[data-theme="dark"] .segmented{background:#202631}
html[data-theme="dark"] .seg-btn{color:#aeb6c3}
html[data-theme="dark"] .seg-btn.active{background:#343b49;color:var(--text);box-shadow:none}
html[data-theme="dark"] :is(.situation,.experience-kind,.experience-status,.bjd-state-tag){background:#272d37;color:#b7c0cd}
html[data-theme="dark"] :is(.situation.waiting,.experience-status.pending){background:#3b3023;color:#e1b16f}
html[data-theme="dark"] :is(.situation.blocked,.experience-status.open,.bjd-state-tag.rejected){background:#3b2429;color:#e79696}
html[data-theme="dark"] :is(.experience-status.resolved){background:#20362c;color:#7bcca0}
html[data-theme="dark"] :is(.experience-kind.discovery){background:#232d43;color:#91a9df}
html[data-theme="dark"] :is(.experience-kind.difficulty){background:#392b23;color:#d5a27f}
html[data-theme="dark"] :is(.progress-line,.item-progress-track,.bjd-progress,.experience-mini-bar){background:#2a303b}
html[data-theme="dark"] .range-bar{background:#3b4252}
html[data-theme="dark"] .marker{box-shadow:0 0 0 2px var(--panel)}
html[data-theme="dark"] .marker.multi:after{background:var(--panel)}
html[data-theme="dark"] :is(.gantt-group-row .item-cell,.gantt-group-row .day-cell,.summary-project-head,.summary-progress-meta span,.summary-output-chips span,.summary-issue-body .summary-resolution){background:var(--panel-soft);border-color:var(--border)}
html[data-theme="dark"] .gantt-group-row .range-bar{background:#514c88}
html[data-theme="dark"] .tree-toggle:hover{background:var(--accent-soft);color:#aaa5ff}
html[data-theme="dark"] .summary-issue-status{background:#3b2429;color:#e79696}
html[data-theme="dark"] .summary-issue-status.resolved{background:#20362c;color:#7bcca0}

html[data-theme="dark"] :is(.drawer,.modal-card,.idea-detail-modal-card,.idea-detail-layout.text-only,.bjd-record-text-only,.month-picker-panel,.menu-pop){
  background:var(--panel);color:var(--text);border-color:var(--border)
}
html[data-theme="dark"] :is(.drawer-head,.modal-head,.idea-detail-head){background:var(--panel);border-color:var(--border)}
html[data-theme="dark"] :is(.modal,.backdrop){background:rgba(3,5,9,.70)}
html[data-theme="dark"] :is(.modal-actions,.calendar-modal-actions,.calendar-detail-actions,.experience-modal-card .modal-actions,.bjd-modal-card .modal-actions){
  background:rgba(24,28,36,.98);border-color:var(--border);box-shadow:none
}
html[data-theme="dark"] :is(.menu-pop button){background:var(--panel);color:var(--text-2)}
html[data-theme="dark"] :is(.menu-pop button:hover){background:var(--ui-surface-hover)}
html[data-theme="dark"] .more-menu summary{background:var(--panel);border-color:var(--border)}

html[data-theme="dark"] :is(.history-notice,.timeline-problem,.revision-entry,.idea-note,.experience-lesson-box,.experience-choice-grid,.experience-optional-body,.experience-lesson-suggest,.calendar-mode-panel,.idea-media-review,.progress-editor,.bjd-review-grid>div,.bjd-linked-card){
  background:var(--panel-soft);border-color:var(--line);color:var(--text-2)
}
html[data-theme="dark"] :is(.idea-card-image-wrap,.collection-cover-empty,.idea-detail-image-button,.idea-detail-image-button img,.idea-detail-inline-canvas,.bjd-product-cover,.bjd-piece-cover,.bjd-photo-grid img,.bjd-version-images,.bjd-linked-placeholder,.bjd-library-placeholder,.bjd-preview-item,.bjd-preview-item img,.bjd-link-thumb,.bjd-relation-placeholder,.bjd-knowledge-detail-media button,.bjd-knowledge-detail-media img){
  background:#11151c
}
html[data-theme="dark"] .idea-detail-media-panel{background:#11151c;border-color:var(--border)}
html[data-theme="dark"] .idea-detail-thumbs{background:#151922;border-color:var(--border)}
html[data-theme="dark"] .idea-detail-thumb{background:#202631;border-color:#333b49}
html[data-theme="dark"] .idea-detail-thumb.active{border-color:var(--accent)}
html[data-theme="dark"] .idea-detail-zoom-toolbar{background:rgba(24,28,36,.92);border-color:var(--border);box-shadow:0 8px 24px rgba(0,0,0,.35)}
html[data-theme="dark"] :is(.idea-detail-zoom-btn,.idea-detail-zoom-scale,.idea-detail-zoom-text){color:var(--text)}
html[data-theme="dark"] :is(.idea-detail-zoom-btn,.idea-detail-zoom-scale,.idea-detail-zoom-text):hover{background:#2a303b}
html[data-theme="dark"] .idea-image-viewer{background:rgba(5,7,11,.97)}
html[data-theme="dark"] .idea-viewer-toolbar{background:rgba(20,24,31,.88);border-color:var(--border)}

html[data-theme="dark"] :is(.bjd-form-advanced,.bjd-upload-block){background:transparent;border-color:var(--line)}
html[data-theme="dark"] :is(.bjd-image-preview.empty,.bjd-check-list,.bjd-link-option){background:var(--panel);border-color:var(--border)}
html[data-theme="dark"] .bjd-check-row:hover{background:var(--ui-surface-hover)}
html[data-theme="dark"] .bjd-link-search{background:#151922!important;border-color:var(--border)!important;color:var(--text)!important}
html[data-theme="dark"] .bjd-link-option:has(input:checked){background:var(--accent-soft);border-color:var(--accent)}
html[data-theme="dark"] .bjd-lifecycle>div:before{background:#343b47}
html[data-theme="dark"] .bjd-lifecycle i{background:#343b47;border-color:var(--panel)}
html[data-theme="dark"] .bjd-lifecycle .current i{background:var(--panel)}
html[data-theme="dark"] .bjd-material-dots i{background:#4a5361}

html[data-theme="dark"] .toast{background:#e7eaf1;color:#171a20;box-shadow:0 12px 30px rgba(0,0,0,.4)}

/* Complete dark-surface pass: pages, detail views and every editor dialog. */
html[data-theme="dark"] :is(.app-shell,.page,.content,.view,.view-body){color:var(--text)}
html[data-theme="dark"] :is(.month-picker-shell:hover,.month-picker-shell[aria-expanded="true"],.tag-filter:hover,.experience-custom-add:hover){
  background:var(--ui-surface-hover);border-color:var(--ui-border-strong);color:var(--text)
}
html[data-theme="dark"] :is(.situation.paused,.experience-mini-action.active){background:#2d2a3d;color:#c2bce9;border-color:var(--border)}

/* Empty states, list rows and content cards that use literal light colors. */
html[data-theme="dark"] :is(
  .bjd-empty,.bjd-image-preview.empty,.bjd-check-list,
  .classic-summary-kpis .summary-kpi,.classic-summary .summary-card
){background:var(--panel);border-color:var(--border);color:var(--text-2)}
html[data-theme="dark"] :is(
  .idea-card-tags span,.idea-detail-tag,.bjd-step-check,.bjd-reuse-row span,
  .idea-preview-actions button
){background:#272d37;color:#c2cad5;border-color:var(--border)}
html[data-theme="dark"] :is(.bjd-step-check.done,.bjd-reuse-row .yes){background:var(--accent);color:#11131a;border-color:var(--accent)}
html[data-theme="dark"] .bjd-check-row:hover{background:var(--ui-surface-hover)}

/* Media placeholders and import previews stay neutral instead of flashing white. */
html[data-theme="dark"] :is(
  .idea-preview-item,.idea-detail-images img,.idea-detail-mixed-grid,
  .idea-detail-inline-canvas,.bjd-step-check:not(.done),
  .bjd-finished-placeholder,.bjd-knowledge-cover,
  .idea-bjd-link img,.idea-bjd-link>span,.bjd-relation-card img,
  .collection-card img
){background:#11151c;border-color:var(--border)}
html[data-theme="dark"] :is(
  .bjd-product-cover img,.bjd-piece-cover img,.bjd-photo-grid img,
  .bjd-version-images img,.bjd-linked-card img,.bjd-library-card>img,
  .bjd-finished-hero>img,.bjd-preview-item img,
  .bjd-record-detail-thumbs .idea-detail-thumb img
){background:#11151c}
html[data-theme="dark"] :is(.idea-media-review,.bjd-upload-block,.bjd-form-advanced){
  background:var(--panel-soft);border-color:var(--border)
}

/* Inspiration details: the right information column and text-only records were missed before. */
html[data-theme="dark"] :is(
  .idea-detail-modal,.idea-detail-body,.idea-detail-info-panel,
  .idea-detail-layout.text-only,.idea-detail-thumbs,
  .bjd-record-detail-modal,.bjd-record-text-only
){background:var(--panel);color:var(--text);border-color:var(--border)}
html[data-theme="dark"] :is(.idea-detail-modal-card,.bjd-record-detail-card){background:var(--panel);border-color:var(--border)}
html[data-theme="dark"] :is(.idea-detail-side-section,.bjd-record-field){border-color:var(--line)}
html[data-theme="dark"] :is(.idea-detail-tag,.idea-detail-collection,.idea-bjd-link,.bjd-linked-card){
  background:var(--panel-soft);color:var(--text-2);border-color:var(--border)
}
html[data-theme="dark"] .idea-back{background:var(--panel-soft);color:var(--text-2)}
html[data-theme="dark"] :is(.idea-detail-tag:hover,.idea-detail-collection:hover,.idea-bjd-link:hover,.bjd-linked-card:hover){
  background:var(--ui-surface-hover);border-color:var(--ui-border-strong)
}
html[data-theme="dark"] .idea-detail-mixed-grid{background:#11151c}
html[data-theme="dark"] .idea-detail-thumb{background:#202631;border-color:var(--border)}

/* Experience editor, including analysis blocks and its fixed header/footer. */
html[data-theme="dark"] :is(.experience-modal-card .modal-head,.experience-modal-card .modal-actions){
  background:var(--panel);border-color:var(--border)
}
html[data-theme="dark"] .experience-candidate-note{
  background:#302c20;border-color:#554b2f;color:#d5c589
}
html[data-theme="dark"] :is(.experience-mini-action.active,.experience-custom-add,.experience-custom-save,.experience-custom-cancel){
  background:var(--panel);border-color:var(--border);color:var(--text-2)
}

/* Calendar editor and detail drawer. */
html[data-theme="dark"] :is(.calendar-modal-card .modal-head,.calendar-modal-actions,.calendar-detail-actions){
  background:var(--panel);border-color:var(--border)
}
html[data-theme="dark"] :is(.calendar-mode.active,.calendar-day.today){border-color:var(--ui-accent-border)}

/* BJD pages, relation pickers and all long form dialogs. */
html[data-theme="dark"] :is(
  .bjd-modal-card,.bjd-modal-card>.modal-head,.bjd-record-detail-card>.modal-head,
  .bjd-modal-card .modal-actions,.bjd-record-detail-card .modal-actions
){background:var(--panel);color:var(--text);border-color:var(--border)}
html[data-theme="dark"] :is(
  .bjd-empty,.bjd-image-preview.empty,.bjd-check-list,.bjd-link-option,
  .bjd-relation-card,.bjd-related-topic,.idea-bjd-link
){background:var(--panel);border-color:var(--border);color:var(--text-2)}
html[data-theme="dark"] .bjd-link-option:has(input:checked){background:var(--accent-soft);border-color:var(--accent)}
html[data-theme="dark"] :is(.bjd-step-check,.bjd-state-tag,.bjd-reuse-row span){background:#272d37;color:#b7c0cd}
html[data-theme="dark"] :is(.bjd-form-section,.bjd-advanced-body){border-color:var(--line)}
html[data-theme="dark"] :is(
  .bjd-form-advanced>summary,.bjd-form-section-title,.bjd-upload-head strong,
  .bjd-link-field-head strong
){color:var(--text-2)}
html[data-theme="dark"] :is(.bjd-link-thumb,.bjd-relation-placeholder,.bjd-finished-placeholder){background:#11151c;color:var(--muted)}

/* Native and browser-painted controls. */
html[data-theme="dark"] :is(option,optgroup){background:#151922;color:var(--text)}
html[data-theme="dark"] input[type="checkbox"],
html[data-theme="dark"] input[type="radio"],
html[data-theme="dark"] input[type="range"]{accent-color:var(--accent)}
html[data-theme="dark"] input[type="file"]{color:var(--text-2)}
html[data-theme="dark"] input[type="file"]::file-selector-button{
  background:var(--panel);border:1px solid var(--border);color:var(--text-2)
}

html{scrollbar-gutter:stable}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-track{background:var(--bg)}
::-webkit-scrollbar-thumb{background:#c4cad3;border:2px solid var(--bg);border-radius:999px}
::-webkit-scrollbar-thumb:hover{background:#aab2bf}
html[data-theme="dark"]::-webkit-scrollbar-track,html[data-theme="dark"] ::-webkit-scrollbar-track{background:#11151c}
html[data-theme="dark"]::-webkit-scrollbar-thumb,html[data-theme="dark"] ::-webkit-scrollbar-thumb{background:#3c4452;border:2px solid #11151c;border-radius:999px}
html[data-theme="dark"]::-webkit-scrollbar-thumb:hover,html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover{background:#505a6a}

@media(max-width:700px){
  .topbar-actions{gap:6px}
  .theme-toggle{width:34px;height:36px}
  html[data-theme="dark"] .sidebar{background:rgba(20,24,32,.96)}
  html[data-theme="dark"] :is(.idea-detail-modal,.bjd-record-detail-modal){background:var(--panel)!important}
  html[data-theme="dark"] :is(.bjd-modal-card>.modal-head,.bjd-record-detail-card>.modal-head,.bjd-modal-card .modal-actions){background:var(--panel)}
  html[data-theme="dark"] :is(.idea-detail-info-panel,.idea-detail-thumbs,.bjd-record-text-only){background:var(--panel)}
}

@media(prefers-reduced-motion:no-preference){
  html,body,.sidebar,.modal-card,.drawer,input,select,textarea,button{transition:background-color .18s ease,border-color .18s ease,color .18s ease}
}
