/* Glass material layer. Only paint properties: existing layout remains authoritative. */
html[data-theme-style="glass"][data-theme="light"] {
  color-scheme: light;
  --color-primary: #7352bc; --color-primary-hover: #593898; --color-on-primary: #ffffff;
  --color-primary-light: #ece5ff; --color-primary-lighter: #e3d7ff; --color-primary-bg: #ede7fb;
  --color-primary-text: #6743aa; --color-primary-border: #baa4ec; --color-primary-ring: #9673d840;
  --color-focus: #7654bd; --color-focus-ring: #9673d840;
  --color-bg: #dce0e9; --color-bg-card: #f2f4fb55; --color-bg-hover: #ffffff80; --color-white: #f5f6fc80;
  --color-text: #191d2b; --color-text-secondary: #43495e; --color-text-muted: #596174; --color-text-placeholder: #646b7c;
  --color-gray-50: #f6f7fb90; --color-gray-100: #edf0f780; --color-gray-200: #d5dbea; --color-gray-300: #b6bfd3;
  --color-gray-400: #707b90; --color-gray-500: #606b80; --color-gray-600: #475267; --color-gray-700: #364155; --color-gray-800: #232c3e; --color-gray-900: #161c29;
  --color-border: #ffffffd9; --color-border-light: #a5aec34d; --color-border-hover: #b8a1e4;
  --color-heat-0: #e5e7f180; --color-heat-1: #e0d7f4; --color-heat-2: #ccbbef; --color-heat-3: #b198e9; --color-heat-4: #9470d4;
  --color-danger: #b32642; --color-danger-light: #fbe6ec; --color-success: #237453; --color-success-light: #e2f4eb; --color-warning: #946011; --color-warning-light: #fff2d5;
  --glass-panel: radial-gradient(ellipse at 8% 0,#ffffff70,transparent 44%),linear-gradient(120deg,#eafaff38,#d7dce830 48%,#e9ddff45);
  --glass-control: linear-gradient(150deg,#ffffffb8,#f3f6ff52 43%,#cceffb55 85%,#ffffffc9);
  --glass-selected: linear-gradient(135deg,#e7ddff,#c9b4f4 48%,#e9e0ff);
  --glass-shadow: inset 0 2px 1px #fff,inset 2px 0 2px #ffffffed,inset -2px 0 2px #c9ebff,inset 0 -2px 2px #fff,inset 0 4px 5px #7e8ca557,inset 0 -5px 5px #bdeaff99,inset 5px 0 5px #acbdd34d,inset -5px 0 5px #e2cbff66,0 0 0 1px #bac5d070,0 9px 18px #53617c38;
  --glass-input: #f3f5fb66;
  --surface-border: var(--color-border);
  --radius-lg: 14px; --radius-xl: 20px;
  --glass-backdrop: radial-gradient(ellipse at 72% 16%,#dcd5f5a6,transparent 46%),linear-gradient(148deg,transparent 32%,#e9e4fb70 39%,transparent 48%,#d5f5fc80 58%,transparent 66%),linear-gradient(28deg,#d4d9e3,#e2e5ed 48%,#d4d9e5);
}
html[data-theme-style="glass"][data-theme="light"] body {
  background: var(--glass-backdrop) center / cover fixed !important;
  color: var(--color-text);
}
/* Keep optional scientific drawings unobtrusive without changing the preference. */
html[data-theme-style="glass"][data-theme="light"] .bookstark-science-bg { opacity: .15; }
html[data-theme-style="glass"][data-theme="light"] .bookstark-science-bg::before,
html[data-theme-style="glass"][data-theme="light"] .bookstark-science-bg::after { background: none; }
html[data-theme-style="glass"][data-theme="light"] #personal-background { opacity: .12; }
html[data-theme-style="glass"][data-theme="light"] :where(body > header,body > footer,.home-bottom-nav,.local-tools-header,#editor-toolbar,#sidebar,.editor-toolbar,.cherry-toolbar) {
  background: var(--glass-panel),#edf1f660 !important;
  border-color: var(--color-border) !important;
  box-shadow: var(--glass-shadow) !important;
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
html[data-theme-style="glass"][data-theme="light"] :where(.bg-white,.home-card,.home-heading-card,.home-side-card,.calendar-card,.tag-card,.note-card,.article-card,.task-card,.bk-card,.topic-list,.topic-detail,.topic-rail,.label-left,.label-right,.member-card,.setting-section,.system-section,.webdav-card,.search-card,.public-feed-card,.public-feed-sidebar,.local-tools-sidebar,:where(.local-tool-grid) a,.dialog-box,.dialog-content,.bs-dialog,.modal-content,.header-dropdown-panel,.home-assistant-panel,.ai-dlg,.news-source-card,.tv-panel,.tv-channel-panel,.tv-detail-panel) {
  background: var(--glass-panel),var(--color-bg-card) !important;
  border-color: var(--color-border) !important;
  box-shadow: var(--glass-shadow) !important;
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
html[data-theme-style="glass"][data-theme="light"] :where(.home-card,.calendar-card,.tag-card) { border-radius: var(--radius-xl); }
html[data-theme-style="glass"][data-theme="light"] :where(.topics-page,.topic-detail-content,.topic-detail-body,.local-tools-main,.editor-shell,.share-view-shell,#content-scroll,.bg-slate-50) { background-color: transparent !important; }
html[data-theme-style="glass"][data-theme="light"] :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),textarea,select,.dialog-input) {
  background: var(--glass-control),var(--glass-input) !important; color:var(--color-text) !important;
  border-color:var(--color-border) !important; box-shadow:inset 0 1px 2px #ffffffb3,inset 0 1px 0 #ffffff25;
}
html[data-theme-style="glass"][data-theme="light"] :where(input,textarea)::placeholder { color:var(--color-text-placeholder); }
html[data-theme-style="glass"][data-theme="light"] select option { background:var(--color-bg); color:var(--color-text); }
html[data-theme-style="glass"][data-theme="light"] :where(.home-button,.main-tabs,.main-tab,.btn,.dialog-btn,.setting-btn,.save-btn,.bg-blue-600,.bg-blue-500,.calendar-nav-btn,.pagination-btn,.page-btn,.book-view-btn,.bs-dialog-btn,.home-primary,.local-tool-button) {
  background:var(--glass-control) !important; color:var(--color-text) !important;
  border-color:var(--color-border) !important; box-shadow:inset 0 1px 0 #ffffffed,0 2px 6px #53617c26;
}
html[data-theme-style="glass"][data-theme="light"] :where(.main-tab.active,.bg-blue-600,.bg-blue-500,.save-btn,.home-primary,.calendar-day.selected,.book-view-btn.active,.ai-subtab.active,.system-tab.active) {
  background:var(--glass-selected) !important; color:var(--color-on-primary) !important;
  box-shadow:inset 0 1px 0 #ffffff,inset 0 0 0 1px #bca5eb80,0 0 12px #9980cb30;
}
html[data-theme-style="glass"][data-theme="light"] :where(.text-blue-500,.text-blue-600,.text-blue-700) { color:var(--color-primary-text) !important; }
html[data-theme-style="glass"][data-theme="light"] :where(button,a,input,textarea,select,summary):focus-visible { outline:2px solid var(--color-focus); outline-offset:2px; }
html[data-theme-style="glass"][data-theme="light"] button:disabled { opacity:.45; }
html[data-theme-style="glass"][data-theme="light"] :where(.dialog-overlay,.modal-overlay,.bs-dialog-overlay) { background:#737b934d !important; }
html[data-theme-style="glass"][data-theme="light"] :where(.dialog-box,.dialog-content,.modal-content,.bs-dialog,.header-dropdown-panel,.home-assistant-panel) { background:var(--glass-panel),#eff1f8f5 !important; }
html[data-theme-style="glass"][data-theme="light"] :where(.cherry,.cherry-editor,.cherry-previewer,.cherry.theme__dark,.cherry.theme__dark .cherry-editor,.cherry.theme__dark .cherry-previewer,.CodeMirror,.cm-editor,.cm-scroller,.editor-content) {
  background: #f6f7fc80 !important; color:var(--color-text) !important;
}
html[data-theme-style="glass"][data-theme="light"] :where(.CodeMirror-gutters,.cherry-sidebar,.cherry-statusbar) { background:var(--glass-input) !important; border-color:var(--color-border) !important; }
html[data-theme-style="glass"][data-theme="light"] :where(.cherry-previewer a,.cherry.theme__dark .cherry-previewer a) { color:var(--color-primary-text) !important; }
html[data-theme-style="glass"][data-theme="light"] .book-cover { background:linear-gradient(130deg,#ffffff26,#ffffff04),color-mix(in srgb,var(--book-cover-color,#68587e) 42%,transparent) !important; border-color:var(--color-border); box-shadow:var(--glass-shadow); backdrop-filter:blur(12px); }
html[data-theme-style="glass"][data-theme="light"] .book-list.book-view-shelf::before,
html[data-theme-style="glass"][data-theme="light"] .book-shelf-row::after { background:var(--glass-control) !important; }
html[data-theme-style="glass"][data-theme="light"] ::-webkit-scrollbar-thumb { background:#b4b7e250; border-radius:var(--radius-full); }
html[data-theme-style="glass"][data-theme="light"] ::-webkit-scrollbar-track { background:transparent; }
@media (max-width:640px) {
  html[data-theme-style="glass"][data-theme="light"] { --glass-shadow:inset 0 2px 2px #fff,inset 0 -2px 3px #fff,0 4px 12px #53617c26; }
  html[data-theme-style="glass"][data-theme="light"] :where(.home-card,.note-card,.article-card,.task-card,.bk-card,.member-card,:where(.local-tool-grid) a) { -webkit-backdrop-filter:none; backdrop-filter:none; }
}
@media (prefers-reduced-transparency:reduce) {
  html[data-theme-style="glass"][data-theme="light"] { --color-bg-card:#e8ebf3; --glass-input:#f3f5fa; }
}
/* Review pass 1: match the prototype's surface grouping and thin luminous rim. */
html[data-theme-style="glass"][data-theme="light"] { --color-bg-card:#f2f4fb55;  }
html[data-theme-style="glass"][data-theme="light"] :where(.home-stats,:where(.home-recent) .home-recent-row,.home-quick,.sidebar-tags,.compose-card,.admin-tabs,.ai-action-section,.ai-usage-card,.tv-work,.tv-side,.tv-editor,.tv-world-settings,.tv-world-detail,.tv-world-side,.bs-dialog-box,.editor-modal,.nav-card) {
 background:var(--glass-panel),var(--color-bg-card) !important; border-color:var(--color-border) !important; box-shadow:var(--glass-shadow) !important; backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px);
}
html[data-theme-style="glass"][data-theme="light"] :where(.home-stat) { background:transparent !important; box-shadow:none !important; backdrop-filter:none; -webkit-backdrop-filter:none; border-radius:0; }
html[data-theme-style="glass"][data-theme="light"] :where(.logo-text,.local-tools-brand) { color:var(--color-text) !important; text-shadow:0 0 12px #b18aff60; }
html[data-theme-style="glass"][data-theme="light"] :where(.nav-link.active) { filter:drop-shadow(0 0 4px #b18aff60); }
html[data-theme-style="glass"][data-theme="light"] :where(.bs-btn,.tab-btn,.home-knowledge-tab,.compose-submit,.home-assistant-fab,.home-assistant-open) { background:var(--glass-control) !important; color:var(--color-text) !important; border-color:var(--color-border) !important; box-shadow:var(--glass-shadow); }
html[data-theme-style="glass"][data-theme="light"] :where(.bs-btn-primary,.tab-btn.active,.home-knowledge-tab.active,.compose-submit,.home-assistant-fab,.home-assistant-open) { background:var(--glass-selected) !important; color:var(--color-on-primary) !important; }
html[data-theme-style="glass"][data-theme="light"] #panel-ai { background:var(--glass-panel),var(--color-bg-card) !important; box-shadow:var(--glass-shadow); backdrop-filter:blur(18px); }
html[data-theme-style="glass"][data-theme="light"] :where(.setting-row,.ai-usage-card,.ai-action-section) { border-color:var(--color-border-light) !important; }
html[data-theme-style="glass"][data-theme="light"] :where(.local-tool-grid) a { border-radius:var(--radius-lg); }
html[data-theme-style="glass"][data-theme="light"] .book-cover { background:var(--glass-panel),color-mix(in srgb,var(--book-cover,#68587e) 40%,transparent) !important; }
html[data-theme-style="glass"][data-theme="light"] .book-list.book-view-shelf {
 --shelf-board-top:#eef0ff90; --shelf-board-edge:#b5c8ff30; --shelf-board-front:#b5c8ff20; --shelf-board-bottom:#b5c8ff48; --shelf-board-shadow:#00051940;
}


html[data-theme-style="glass"][data-theme="light"] :where(.btn-create,.article-create-btn,.note-ai-go,.home-assistant-trigger,.bs-btn-confirm) { background:var(--glass-selected)!important; color:var(--color-on-primary)!important; border-color:var(--color-primary-border)!important; box-shadow:var(--glass-shadow); }
html[data-theme-style="glass"][data-theme="light"] :where(.home-assistant-dialog,.editor-modal,.bs-dialog-box) { background:var(--glass-panel),#eff1f8f5!important; box-shadow:var(--glass-shadow); backdrop-filter:blur(24px); }
html[data-theme-style="glass"][data-theme="light"] :where(.label-left,.label-right,.tab-btn,.home-sort-btn,:where(.local-tool-grid) a) { border-radius:var(--radius-lg); }
html[data-theme-style="glass"][data-theme="light"] .ai-action-section { background:var(--glass-control),#edf0f640!important; }


html[data-theme-style="glass"][data-theme="light"] :where(.topbar-save-btn,.topbar-ai-btn,.tb-btn,.mode-toggle-btn,.assistant-launcher) { background:var(--glass-control)!important; color:var(--color-text)!important; border-color:var(--color-border)!important; box-shadow:var(--glass-shadow); }
html[data-theme-style="glass"][data-theme="light"] :where(.assistant-launcher,.mode-toggle-btn.active) { background:var(--glass-selected)!important; }
html[data-theme-style="glass"][data-theme="light"] .topbar-save-btn.saved { background:linear-gradient(130deg,#58c79540,#236b5240)!important; }
html[data-theme-style="glass"][data-theme="light"] :where(.cherry-editor,.cherry-previewer) { box-shadow:inset 0 1px 0 #e2e7ff40,inset 1px 0 0 #c5ceff40; border-radius:var(--radius-lg); }
/* Review pass 2: public feed and topic summary use the same material as the home cards. */
html[data-theme-style="glass"][data-theme="light"] :where(.public-feed,.public-info section,.topic-overview-stat,.topic-comments-panel) { background:var(--glass-panel),var(--color-bg-card)!important; box-shadow:var(--glass-shadow); border-color:var(--color-border)!important; backdrop-filter:blur(18px); }
html[data-theme-style="glass"][data-theme="light"] :where(.topic-primary-btn,.public-radio-play) { background:var(--glass-selected)!important; color:var(--color-text)!important; box-shadow:var(--glass-shadow); }
/* Review pass 3: dialogs need a denser surface; list and storage panels retain a visible glass edge. */
html[data-theme-style="glass"][data-theme="light"] :where(.asset-modal,.book-modal,.dav-modal,.bs-dialog-panel) { background:var(--glass-panel),#eff1f8f5!important; border-color:var(--color-border)!important; box-shadow:var(--glass-shadow); backdrop-filter:blur(24px); }
html[data-theme-style="glass"][data-theme="light"] :where(.asset-modal-head,.asset-modal-body,.asset-modal-foot) { background:transparent!important; }
html[data-theme-style="glass"][data-theme="light"] :where(.stat-card,.list-row,.task-item,.tasks-stats,.dav-connection,.dav-table-wrap,.asset-table-wrap) { background:var(--glass-panel),var(--color-bg-card)!important; border-color:var(--color-border)!important; box-shadow:var(--glass-shadow); backdrop-filter:blur(16px); }
html[data-theme-style="glass"][data-theme="light"] :where(.asset-tab.active,.tasks-btn-primary) { background:var(--glass-selected)!important; color:var(--color-on-primary)!important; box-shadow:var(--glass-shadow); }
/* Selected labels remain readable over the light ribbons. */
html[data-theme-style="glass"][data-theme="light"] .range-btn.active { background:var(--glass-selected)!important; color:var(--color-on-primary)!important; box-shadow:var(--glass-shadow); }
html[data-theme-style="glass"][data-theme="light"] .home-date-layout .calendar-day[data-level="4"] { background:#9470d4!important; }
html[data-theme-style="glass"][data-theme="light"] .home-date-layout .calendar-day[data-level="4"] .calendar-day-num { color:var(--color-on-primary)!important; }

/* Floating surfaces have their own material: page-card alpha is not suitable
   above readable content. Keep layout and stacking owned by each component. */
html[data-theme-style="glass"][data-theme="light"] {
  --glass-scrim: #6c73865c;
  --glass-floating-base: #eff1f8;
  --glass-floating-rim: #fffffff0;
  --glass-floating-fill: radial-gradient(ellipse at 0 0,#c9cfff30,transparent 58%),linear-gradient(135deg,#9184d51a,transparent 55%,#6687c922);
  --glass-floating-shadow: inset 0 2px 3px #fff,inset 2px 0 3px #fff,inset 0 -3px 4px #fff,0 20px 56px #59617945,0 0 0 1px #ffffffd9;
  --glass-field-base: #ffffff80;
  --glass-field-shadow: inset 0 2px 3px #fff,inset 0 -2px 3px #ffffffb3,0 2px 6px #53617c1f;
  --glass-focus-shadow: 0 0 0 2px #bba3ff30,0 0 16px #a285ff35;
  --glass-section-tint: linear-gradient(110deg,#bbc8ff12,#c2a8ff05);
}
html[data-theme-style="glass"][data-theme="light"] :where(.asset-modal-backdrop,.editor-overlay,.bs-dialog-overlay,.bs-dialog-form-overlay,.dialog-overlay,.modal-overlay,.ai-dlg-overlay,.cmdk-overlay,.tag-input-sheet-backdrop,.resource-create-backdrop,.asset-preview-backdrop,.asset-session-backdrop,.richdoc-overlay-backdrop,.mobile-drawer-overlay,.task-mobile-drawer-overlay,.bm-drawer-overlay,.local-drawer-backdrop) {
  background:var(--glass-scrim)!important;
  -webkit-backdrop-filter:blur(10px) saturate(.7); backdrop-filter:blur(10px) saturate(.7);
}
html[data-theme-style="glass"][data-theme="light"] dialog::backdrop {
  background:var(--glass-scrim)!important;
  -webkit-backdrop-filter:blur(10px) saturate(.7); backdrop-filter:blur(10px) saturate(.7);
}
html[data-theme-style="glass"][data-theme="light"] :where(.asset-modal,.book-modal,.dav-modal,.editor-modal,.bs-dialog-box,.bs-dialog-panel,.bs-dialog-form,.dialog-box,.dialog-content,.modal-content,.home-dialog,.home-assistant-dialog,.home-assistant-panel,.preview-ai-panel,.ai-dlg-box,.cmdk-panel,.note-viewer-panel,.resource-create-modal,.richdoc-modal,.topic-modal,.topic-resource-modal) {
  background:var(--glass-floating-fill),var(--glass-floating-base)!important;
  color:var(--color-text); border-color:var(--glass-floating-rim)!important;
  box-shadow:var(--glass-floating-shadow)!important;
  -webkit-backdrop-filter:blur(28px); backdrop-filter:blur(28px);
}
/* Small floating menus need the same isolation, including menus inside a
   parent that already creates a backdrop-filter boundary. Dense tint is the fallback. */
html[data-theme-style="glass"][data-theme="light"] :where(:where(#user-menu-dropdown,#lang-dropdown) > div,.header-dropdown-panel,.bs-action-dd-menu,.bs-action-menu,.bs-action-submenu-panel,.tag-input-dropdown,.tag-popover,.tag-input-sheet,.asset-floating-dropdown,.asset-row-menu-panel,.asset-combobox-dropdown,.dropdown-menu,.context-menu,.dav-row-menu,.dav-menu,.nav-view-menu,.note-ai-popover,.share-popover,.color-picker-popover,.richdoc-popover,.richdoc-color-popover,.richdoc-font-popover,.tb-dropdown,.cherry-dropdown,.cherry-floatmenu,.bs-selection-popover,.offline-status-popover) {
  background:var(--glass-floating-fill),var(--glass-floating-base)!important;
  color:var(--color-text); border-color:var(--glass-floating-rim)!important;
  box-shadow:var(--glass-floating-shadow)!important;
  -webkit-backdrop-filter:blur(24px); backdrop-filter:blur(24px);
}
html[data-theme-style="glass"][data-theme="light"] :where(.asset-modal-head,.asset-modal-foot,.editor-modal-header,.editor-modal-footer,.ai-dlg-header,.ai-dlg-footer,.tag-popover-header) {
  background:var(--glass-section-tint)!important; border-color:var(--color-border-light)!important;
}
html[data-theme-style="glass"][data-theme="light"] :where(.asset-modal,.editor-modal,.home-dialog,.home-assistant-dialog,.bs-dialog-box,.ai-dlg-box,.cmdk-panel,.tag-popover) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),textarea,select) {
  background:var(--glass-control),var(--glass-field-base)!important;
  box-shadow:var(--glass-field-shadow);
}
html[data-theme-style="glass"][data-theme="light"] :where(input:not([type="checkbox"]):not([type="radio"]),textarea,select):focus-visible {
  outline:1px solid var(--color-focus); outline-offset:0;
  border-color:var(--color-focus)!important; box-shadow:var(--glass-field-shadow),var(--glass-focus-shadow)!important;
}
html[data-theme-style="glass"][data-theme="light"] :where(.header-menu-item,.bs-action-menu-item,.tag-dropdown-item):hover {
  background:var(--glass-control)!important; color:var(--color-text)!important;
}
@media (prefers-reduced-transparency:reduce) {
  html[data-theme-style="glass"][data-theme="light"] { --glass-floating-base:#eff1f8; --glass-scrim:#6c7386bb; --glass-field-base:#f4f5fa; }
}
/* The command search is one field, with focus on its containing row. */
html[data-theme-style="glass"][data-theme="light"] .cmdk-panel .cmdk-search .cmdk-input {
  background:transparent!important; box-shadow:none!important;
}
html[data-theme-style="glass"][data-theme="light"] .cmdk-panel .cmdk-search .cmdk-input:focus-visible {
  outline:none; box-shadow:none!important;
}
html[data-theme-style="glass"][data-theme="light"] .cmdk-search:focus-within {
  background:var(--glass-section-tint); box-shadow:inset 0 -2px 0 var(--color-focus);
}
html[data-theme-style="glass"][data-theme="light"] .bs-action-menu-item-danger:hover { color:var(--color-danger)!important; }
/* Header menus live inside a filtered sticky header: a solid tint prevents
   sharp calendar/text bleed where nested backdrop sampling is unavailable. */
html[data-theme-style="glass"][data-theme="light"] :where(#user-menu-dropdown,#lang-dropdown) > div {
  --glass-floating-base: #eff1f8;
}

/* Approved imagegen set: pearl panels, refracted rims and obsidian actions. */
html[data-theme-style="glass"][data-theme="light"] :where(body > header,.home-stats,.home-quick,.home-card,.calendar-card,.compose-card,.sidebar-tags,.label-left,.label-right,.topic-list,.topic-detail,.topic-rail,.admin-tabs,.setting-section,.system-section,#panel-ai,.asset-table-wrap,.dav-table-wrap,.public-feed,.public-info section,.asset-modal,.editor-modal,.bs-dialog-box,.home-assistant-dialog,.article-setting-modal) { border-radius:var(--radius-xl); }
html[data-theme-style="glass"][data-theme="light"] body > header { border-radius:0 0 18px 18px; }
html[data-theme-style="glass"][data-theme="light"] :where(.main-tab,.tab-btn,.btn,.bs-btn,.dialog-btn,.bs-dialog-btn,.book-view-btn,.home-knowledge-tab,.home-sort-btn,.home-button,.calendar-nav-btn,.page-btn,.pagination-btn,.system-tab,.ai-subtab,.asset-tab) { border-radius:14px; }
html[data-theme-style="glass"][data-theme="light"] :where(.main-tab:not(.active),.tab-btn:not(.active),.system-tab,.ai-subtab,.home-knowledge-tab) { background:var(--glass-control)!important; box-shadow:var(--glass-shadow); }
html[data-theme-style="glass"][data-theme="light"] :where(.main-tab.active,.tab-btn.active,.system-tab.active,.ai-subtab.active,.asset-tab.active,.home-knowledge-tab.active,.book-view-btn.active,.range-btn.active) { background:var(--glass-selected)!important; color:#302244!important; box-shadow:var(--glass-shadow)!important; }
html[data-theme-style="glass"][data-theme="light"] :where(.home-sort-btn,.btn-create,.article-create-btn,.compose-submit,.bs-btn-primary,.bs-btn-confirm,button.bg-blue-600,button.bg-blue-500,.tasks-btn-primary,.save-btn,.home-primary) { background:linear-gradient(178deg,#737681 0%,#282b34 19%,#0c0d12 52%,#1a1c25 83%,#535563 100%)!important; color:#fff!important; border-color:#6f7380!important; box-shadow:inset 0 2px 2px #ffffffb3,inset 0 -2px 2px #9698a6,0 4px 9px #30344240!important; }
html[data-theme-style="glass"][data-theme="light"] :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),textarea,select) { border-radius:12px; box-shadow:var(--glass-field-shadow); }
html[data-theme-style="glass"][data-theme="light"] :where(.logo-text,.local-tools-brand) { color:#4278e9!important; -webkit-text-fill-color:#4278e9!important; text-shadow:none; }
html[data-theme-style="glass"][data-theme="light"] :where(.home-assistant-fab,.home-assistant-open,.home-assistant-trigger,.assistant-launcher) { background:var(--glass-selected)!important; color:#4d2e82!important; box-shadow:var(--glass-shadow)!important; }
html[data-theme-style="glass"][data-theme="light"] :where(.article-setting-modal,.profile-tabs,.profile-card,.auth-card) { background:var(--glass-panel),var(--glass-floating-base)!important; box-shadow:var(--glass-shadow); border-color:var(--color-border)!important; }
/* Recent visits form a soft group; individual links use a lighter edge than content panels. */
html[data-theme-style="glass"][data-theme="light"] .home-recent {
  background:var(--glass-panel),var(--color-bg-card)!important;
  border:1px solid var(--color-border); border-radius:var(--radius-lg);
  padding:var(--spacing-sm); box-shadow:var(--glass-field-shadow);
}
html[data-theme-style="glass"][data-theme="light"] .home-recent .home-recent-row {
  box-shadow:var(--glass-tab-edge)!important;
}
html[data-theme-style="glass"][data-theme="light"] .home-recent .home-recent-row::before { content:none; }
html[data-theme-style="glass"][data-theme="light"] :where(.home-recent-row,.note-card,.article-card,.task-card,.bk-card,.list-row,.task-item) { border-radius:var(--radius-lg); }
html[data-theme-style="glass"][data-theme="light"] :where(.cherry,.cherry-previewer,.cherry-editor,.CodeMirror,.cm-editor) { color:var(--color-text)!important; }
@media (prefers-reduced-transparency:reduce) { html[data-theme-style="glass"][data-theme="light"] { --glass-panel:linear-gradient(#edf0f8,#edf0f8); --glass-control:linear-gradient(#f5f6fa,#e7eaf3); } }
@media (prefers-reduced-motion:reduce) { html[data-theme-style="glass"][data-theme="light"] *,html[data-theme-style="glass"][data-theme="light"] *::before,html[data-theme-style="glass"][data-theme="light"] *::after { animation:none!important; transition:none!important; } }

/* Match the actual homepage controls and profile sections in the approved frames. */
html[data-theme-style="glass"][data-theme="light"] .home-filter { background:var(--glass-control)!important; color:var(--color-text)!important; border-radius:14px!important; box-shadow:var(--glass-shadow)!important; }
html[data-theme-style="glass"][data-theme="light"] .home-filter[aria-pressed="true"] { background:var(--glass-selected)!important; color:#302244!important; }
html[data-theme-style="glass"][data-theme="light"] .home-toolbar .main-tabs { background:transparent!important; box-shadow:none!important; }
html[data-theme-style="glass"][data-theme="light"] :where(.profile-panel,.profile-background,.profile-tabs,.music-volume-row,.profile-panel .bg-slate-50) { border-radius:20px!important; box-shadow:var(--glass-shadow)!important; background:var(--glass-panel),var(--color-bg-card)!important; }
html[data-theme-style="glass"][data-theme="light"] :where(.ai-dlg-btn,.tag-input-container,.tag-input-wrapper) { border-radius:12px; background:var(--glass-control)!important; box-shadow:var(--glass-shadow)!important; }
html[data-theme-style="glass"][data-theme="light"] :where(.book-cover,.book-cover-title,.book-cover-kicker,.book-cover-foot) { color:#252a39!important; }
html[data-theme-style="glass"][data-theme="light"] .book-cover { border-radius:8px!important; }
html[data-theme-style="glass"][data-theme="light"] .fl-toggle .slider::before { background:#fff; box-shadow:0 1px 4px #55597040; }

html[data-theme-style="glass"][data-theme="light"] .logo-text { background:none!important; color:#4278e9!important; -webkit-text-fill-color:#4278e9!important; }
html[data-theme-style="glass"][data-theme="light"] :where(.task-row,.sidebar-stats,.tasks-stat-card,.month-stats,.note-stats-card) { background:var(--glass-panel),var(--color-bg-card)!important; border-color:var(--color-border)!important; box-shadow:var(--glass-shadow)!important; border-radius:20px; }

html[data-theme-style="glass"][data-theme="light"] :where(.ai-stat-card,.sidebar-stats,.task-row) { background:var(--glass-panel),var(--color-bg-card)!important; border-color:var(--color-border)!important; box-shadow:var(--glass-shadow)!important; border-radius:18px!important; }
html[data-theme-style="glass"][data-theme="light"] :where(.ai-stat-value) { color:var(--color-primary)!important; }
html[data-theme-style="glass"][data-theme="light"] :where(.text-slate-400,.setting-desc,.ai-stat-label) { color:var(--color-text-muted)!important; }
html[data-theme-style="glass"][data-theme="light"] :where(.bg-white,.calendar-card,.home-card,.home-quick,.home-stats,.sidebar-tags,.compose-card,.public-feed,.public-info section,.ai-stat-card,.asset-modal,.editor-modal,.article-setting-modal) { border-radius:20px!important; }
html[data-theme-style="glass"][data-theme="light"] :where(button.bg-blue-600,button.bg-blue-500,.btn-create,.compose-submit,.main-tab,.tab-btn,.book-view-btn,.topbar-save-btn,.topbar-ai-btn,.mode-toggle-btn,.tb-btn,.tasks-btn-primary) { border-radius:12px!important; }
html[data-theme-style="glass"][data-theme="light"] .main-tab:not(.active) { background:var(--glass-control)!important; box-shadow:var(--glass-shadow)!important; }
/* Dense collections retain their existing row geometry inside the crystal surface. */
html[data-theme-style="glass"][data-theme="light"] :where(.bm-row,.dav-drop-zone,.img-card,.tv-side,.tv-editor,.tv-work,.tv-world-settings,.tv-world-side,.tv-world-detail,.system-section,.news-source-card) { background:var(--glass-panel),var(--color-bg-card)!important; border-color:var(--color-border)!important; border-radius:16px!important; box-shadow:var(--glass-shadow)!important; }
html[data-theme-style="glass"][data-theme="light"] :where(.share-topbar,#sidebar,.share-reader-fullscreen #content-scroll) { border-radius:16px; box-shadow:var(--glass-shadow)!important; }
/* English labels need the compact header at tablet widths as well. */
@media (min-width:641px) and (max-width:900px) {
  html[lang="en"][data-theme-style="glass"] .header-home-link .nav-text,
  html[lang="en"][data-theme-style="glass"] #user-menu-trigger > .hidden { display:none!important; }
}

/* Optical edge: a transparent eight-pixel bevel, not a uniform white outline.
   The masked rim never covers content or receives pointer events. */
html[data-theme-style="glass"][data-theme="light"] {
  --color-border: #ffffff80;
  --glass-control: linear-gradient(180deg,#ffffffb3 0%,#f8faff55 22%,#d9e2f238 60%,#c7effb80 87%,#ffffffc9 100%);
  --glass-panel: radial-gradient(ellipse at 14% 0,#ffffff85,transparent 40%),linear-gradient(125deg,#e7f5fa2e,#cbd3e225 46%,#e7ddfa38);
  --glass-shadow: inset 0 1px 0 #ffffffed,inset 1px 0 0 #ffffff99,inset -1px 0 0 #aebacf70,inset 0 -1px 0 #ffffffed,inset 0 3px 5px #73849d38,inset 0 -4px 6px #cdf5ff80,0 0 0 1px #9eacc151,0 7px 14px #53617c2b,0 20px 32px -22px #36476170;
  --glass-floating-shadow: inset 0 1px 0 #fff,inset 1px 0 0 #ffffffb3,inset 0 -1px 0 #fff,0 0 0 1px #a8b3c780,0 20px 48px #59617945;
  --glass-field-shadow: inset 0 1px 0 #fff,inset 1px 0 1px #ffffffc0,inset 0 3px 4px #7587a020,inset 0 -2px 1px #fff,inset 0 -4px 5px #c5f3fc80,0 0 0 1px #b8c1d14d,0 3px 7px #53617c20;
  --glass-rim: radial-gradient(ellipse 25px 18px at 1% 0%,#fff 10%,#e3fdffcc 31%,#6b93b580 51%,transparent 76%),radial-gradient(ellipse 36px 16px at 99% 100%,#fff 9%,#cef8ffde 35%,#8199bb66 59%,transparent 78%),radial-gradient(ellipse 65px 14px at 74% 0%,#ffffffed,transparent 75%),conic-gradient(from 135deg at 50% 50%,#b1ebff99 0deg,#ffffffee 35deg,#8d9aaf55 67deg,#faffffdd 95deg,#d1c0f580 125deg,#fff 156deg,#a1ddec80 190deg,#ffffffd9 222deg,#a1aec566 260deg,#e5d3ffb3 290deg,#ffffffed 320deg,#b1ebff99 360deg);
  --glass-edge-reflection: radial-gradient(ellipse 28px 32px at 0 14px,#ffffff99 12%,#b4eaf5a6 26%,#64819b73 43%,#ffffffb3 61%,transparent 82%),
      radial-gradient(ellipse 34px 22px at 100% 100%,#fff 12%,#bcf1ffdd 34%,#7187a273 49%,transparent 74%),
      linear-gradient(95deg,#a7c9df80,#fff 12%,#e8d7ff8c 38%,#fff 65%,#9ddcefc0 89%,#fff) top / 100% 3px no-repeat,
      linear-gradient(95deg,#68aac77d,#e4fdff 14%,#fff 35%,#d6bdffab 58%,#fff 78%,#93d9efb3) bottom / 100% 5px no-repeat,
      var(--glass-rim);
  --glass-edge-contour: inset 0 0 0 1px #ffffffed,inset 0 0 0 3px #edfaff33,inset 0 0 0 5px #8a9fb43d,inset 0 0 0 6px #ffffffb3,inset 0 -3px 4px #c4f5ff99;
}
/* These surfaces are static in the base layout. Fixed dialogs keep their own positioning. */
html[data-theme-style="glass"][data-theme="light"] :where(.asset-table-wrap,.dav-drop-zone,.news-source-card,.public-feed,.label-right,.topic-list,.topic-detail,.tv-work,.tv-side,.tv-editor,.tv-world-side,.tv-world-detail,.tv-world-settings,.home-stats,.home-card,.home-quick,.home-recent-row,.calendar-card,.compose-card,.sidebar-tags,.sidebar-stats,.note-card,.article-card,.task-row,.bm-row,.nav-card,.profile-panel,.profile-background,.ai-stat-card,.asset-modal,.article-setting-modal,.editor-modal,.bs-dialog-box,.public-info section) { position:relative; }
@supports ((mask-composite:exclude) or (-webkit-mask-composite:xor)) {
  html[data-theme-style="glass"][data-theme="light"] :where(.asset-table-wrap,.dav-drop-zone,.news-source-card,.public-feed,.label-right,.topic-list,.topic-detail,.tv-work,.tv-side,.tv-editor,.tv-world-side,.tv-world-detail,.tv-world-settings,.home-stats,.home-card,.home-quick,.home-recent-row,.calendar-card,.compose-card,.sidebar-tags,.sidebar-stats,.note-card,.article-card,.task-row,.bm-row,.nav-card,.profile-panel,.profile-background,.ai-stat-card,.asset-modal,.article-setting-modal,.bs-dialog-box,.home-assistant-dialog,.topic-rail,.public-info section)::before,
  html[data-theme-style="glass"][data-theme="light"] .editor-modal::after {
    content:""; position:absolute; inset:0; box-sizing:border-box; border-radius:inherit; padding:8px;
    background:var(--glass-edge-reflection);
    -webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);
    mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);
    -webkit-mask-composite:xor; mask-composite:exclude;
    box-shadow:var(--glass-edge-contour);
    pointer-events:none;
  }
}
/* Narrow edge reflections on native controls, which cannot host pseudo-elements. */
html[data-theme-style="glass"][data-theme="light"] :where(.home-filter,.main-tab,.tab-btn,.book-view-btn,.calendar-nav-btn,.bs-btn-cancel,.dialog-btn,.ai-dlg-btn) {
  box-shadow:inset 0 1px 0 #fff,inset 1px 0 1px #ffffffcc,inset -1px 0 1px #a5b1ca80,inset 0 -2px 1px #fff,inset 0 -4px 4px #c4f1ff80,0 0 0 1px #b1bdcf73,0 4px 7px #53617c26!important;
}
@media (max-width:640px) {
  html[data-theme-style="glass"][data-theme="light"] { --glass-shadow:inset 0 1px 0 #fff,inset 0 -1px 0 #fff,0 0 0 1px #afbdd066,0 4px 10px #53617c29; }
}

/* Shared tab material: includes page-specific tabs and dynamically created pickers.
   Shadows form the narrow optical rim without changing hit areas or using pseudo-elements. */
html[data-theme-style="glass"][data-theme="light"] {
  --glass-tab-radius: 12px;
  --glass-tab-highlight: linear-gradient(180deg,#ffffffb3,transparent 40%,transparent 70%,#c8f4ff66);
  --glass-tab-hover: linear-gradient(#ffffff40,#ffffff40);
  --glass-tab-ink: #302244;
  --glass-tab-edge: inset 0 0 0 1px #fffffff0,inset 0 0 0 3px #bdcbe54d,inset 1px 3px 3px #ffffffb3,inset -1px -3px 3px #c5f2ffb3,0 2px 5px #53617c30;
  --glass-tab-pressed: inset 0 0 0 1px #ffffffed,inset 0 2px 5px #725c9250,inset 0 -2px 2px #e2f9ffcc;
}
html[data-theme-style="glass"][data-theme="light"] :is(button[role="tab"],a[role="tab"],.main-tab,.tab-btn,.system-tab,.ai-subtab,.asset-tab,.asset-docker-subtab,.asset-settings-tab,.asset-docker-create-tab,.search-tab,.filter-tab,.bm-panel-tab,.sidebar-tab,.pager-tab,.label-right .tab,.expand-tab,.topic-expand-tabs > button,.tv-subtabs > button,.asset-segmented > button,.home-knowledge-tab,.book-view-btn,.range-btn,.mode-toggle-btn,.note-emoji-tab,.editor-emoji-tab,.topic-emoji-tab,.icon-tab,.filter-chip,.topic-comment-scope > button) {
  --glass-tab-fill: var(--glass-control);
  background:var(--glass-tab-highlight),var(--glass-tab-fill)!important;
  color:var(--color-text-secondary)!important;
  border-color:transparent!important;
  border-radius:var(--glass-tab-radius)!important;
  box-shadow:var(--glass-tab-edge)!important;
}
html[data-theme-style="glass"][data-theme="light"] :is(button[role="tab"],a[role="tab"],.main-tab,.tab-btn,.system-tab,.ai-subtab,.asset-tab,.asset-docker-subtab,.asset-settings-tab,.asset-docker-create-tab,.search-tab,.filter-tab,.bm-panel-tab,.sidebar-tab,.pager-tab,.label-right .tab,.expand-tab,.topic-expand-tabs > button,.tv-subtabs > button,.asset-segmented > button,.home-knowledge-tab,.book-view-btn,.range-btn,.mode-toggle-btn,.note-emoji-tab,.editor-emoji-tab,.topic-emoji-tab,.icon-tab,.filter-chip,.topic-comment-scope > button):is(.active,.chosen,.selected,[aria-selected="true"],[aria-pressed="true"],[data-state="active"]) {
  --glass-tab-fill:var(--glass-selected);
  background:var(--glass-tab-highlight),var(--glass-tab-fill)!important;
  color:var(--glass-tab-ink)!important;
}
@media (hover:hover) {
  html[data-theme-style="glass"][data-theme="light"] :is(button[role="tab"],a[role="tab"],.main-tab,.tab-btn,.system-tab,.ai-subtab,.asset-tab,.asset-docker-subtab,.asset-settings-tab,.asset-docker-create-tab,.search-tab,.filter-tab,.bm-panel-tab,.sidebar-tab,.pager-tab,.label-right .tab,.expand-tab,.topic-expand-tabs > button,.tv-subtabs > button,.asset-segmented > button,.home-knowledge-tab,.book-view-btn,.range-btn,.mode-toggle-btn,.note-emoji-tab,.editor-emoji-tab,.topic-emoji-tab,.icon-tab,.filter-chip,.topic-comment-scope > button):hover:not(:disabled):not([aria-disabled="true"]) {
    background:var(--glass-tab-hover),var(--glass-tab-highlight),var(--glass-tab-fill)!important;
  }
}
html[data-theme-style="glass"][data-theme="light"] :is(button[role="tab"],a[role="tab"],.main-tab,.tab-btn,.system-tab,.ai-subtab,.asset-tab,.asset-docker-subtab,.asset-settings-tab,.asset-docker-create-tab,.search-tab,.filter-tab,.bm-panel-tab,.sidebar-tab,.pager-tab,.label-right .tab,.expand-tab,.topic-expand-tabs > button,.tv-subtabs > button,.asset-segmented > button,.home-knowledge-tab,.book-view-btn,.range-btn,.mode-toggle-btn,.note-emoji-tab,.editor-emoji-tab,.topic-emoji-tab,.icon-tab,.filter-chip,.topic-comment-scope > button):active:not(:disabled):not([aria-disabled="true"]) { box-shadow:var(--glass-tab-pressed)!important; }
html[data-theme-style="glass"][data-theme="light"] :is(button[role="tab"],a[role="tab"],.main-tab,.tab-btn,.system-tab,.ai-subtab,.asset-tab,.asset-docker-subtab,.asset-settings-tab,.asset-docker-create-tab,.search-tab,.filter-tab,.bm-panel-tab,.sidebar-tab,.pager-tab,.label-right .tab,.expand-tab,.topic-expand-tabs > button,.tv-subtabs > button,.asset-segmented > button,.home-knowledge-tab,.book-view-btn,.range-btn,.mode-toggle-btn,.note-emoji-tab,.editor-emoji-tab,.topic-emoji-tab,.icon-tab,.filter-chip,.topic-comment-scope > button):focus-visible { outline:2px solid var(--color-focus); outline-offset:-2px; }
html[data-theme-style="glass"][data-theme="light"] :is(.ai-subtabs,.tv-subtabs,.asset-segmented,.bm-panel-tabs,.sidebar-tabs,.pager-tabs) {
  background:var(--glass-panel)!important; border-color:var(--color-border-light)!important;
}

/* Remaining toolbar and pagination controls use the same optical material as tabs. */
html[data-theme-style="glass"][data-theme="light"] :is(.images-view-toggle > button,.btn-upload,.btn-select,.btn-select-all,.btn-cancel-select,.btn-batch-del,.bm-tool-btn,.bm-batch-btn,.bm-page-btn,.page-btn,.pagination-btn,.nav-view-btn,.asset-refresh-button,.asset-create-button,.asset-prune-button,.topic-primary-btn,.topic-secondary-btn,.topic-resource-filter-btn,.topic-comment-layout-btn,.topic-summary-save-btn,.mobile-filter-btn,.ai-test-btn,.bs-btn-cancel,.bs-btn-danger,.note-ai-go,.note-ai-quick-actions > button) {
  --glass-action-fill:var(--glass-control);
  background:var(--glass-tab-highlight),var(--glass-action-fill)!important;
  color:var(--color-text-secondary)!important; border-color:var(--color-border)!important;
  border-radius:var(--glass-tab-radius)!important; box-shadow:var(--glass-tab-edge)!important;
}
html[data-theme-style="glass"][data-theme="light"] :is(.images-view-toggle > button,.btn-upload,.btn-select,.btn-select-all,.btn-cancel-select,.btn-batch-del,.bm-tool-btn,.bm-batch-btn,.bm-page-btn,.page-btn,.pagination-btn,.nav-view-btn,.asset-refresh-button,.asset-create-button,.asset-prune-button,.topic-primary-btn,.topic-secondary-btn,.topic-resource-filter-btn,.topic-comment-layout-btn,.topic-summary-save-btn,.mobile-filter-btn,.ai-test-btn,.bs-btn-cancel,.bs-btn-danger,.note-ai-go,.note-ai-quick-actions > button):is(.active,.selected,.bm-tag-btn-active,.bm-edit-btn-active,.bm-batch-btn-active,.has-active,[aria-pressed="true"],[aria-current="page"]),
html[data-theme-style="glass"][data-theme="light"] :is(.btn-upload,.asset-create-button:not(.asset-prune-button),.topic-primary-btn,.note-ai-go) {
  --glass-action-fill:var(--glass-selected);
  color:var(--glass-tab-ink)!important;
}
@media (hover:hover) {
  html[data-theme-style="glass"][data-theme="light"] :is(.images-view-toggle > button,.btn-upload,.btn-select,.btn-select-all,.btn-cancel-select,.btn-batch-del,.bm-tool-btn,.bm-batch-btn,.bm-page-btn,.page-btn,.pagination-btn,.nav-view-btn,.asset-refresh-button,.asset-create-button,.asset-prune-button,.topic-primary-btn,.topic-secondary-btn,.topic-resource-filter-btn,.topic-comment-layout-btn,.topic-summary-save-btn,.mobile-filter-btn,.ai-test-btn,.bs-btn-cancel,.bs-btn-danger,.note-ai-go,.note-ai-quick-actions > button):hover:not(:disabled):not([aria-disabled="true"]) {
    background:var(--glass-tab-hover),var(--glass-tab-highlight),var(--glass-action-fill)!important;
  }
}
html[data-theme-style="glass"][data-theme="light"] :is(.images-view-toggle > button,.btn-upload,.btn-select,.btn-select-all,.btn-cancel-select,.btn-batch-del,.bm-tool-btn,.bm-batch-btn,.bm-page-btn,.page-btn,.pagination-btn,.nav-view-btn,.asset-refresh-button,.asset-create-button,.asset-prune-button,.topic-primary-btn,.topic-secondary-btn,.topic-resource-filter-btn,.topic-comment-layout-btn,.topic-summary-save-btn,.mobile-filter-btn,.ai-test-btn,.bs-btn-cancel,.bs-btn-danger,.note-ai-go,.note-ai-quick-actions > button):active:not(:disabled):not([aria-disabled="true"]) { box-shadow:var(--glass-tab-pressed)!important; }
html[data-theme-style="glass"][data-theme="light"] :is(.images-view-toggle > button,.btn-upload,.btn-select,.btn-select-all,.btn-cancel-select,.btn-batch-del,.bm-tool-btn,.bm-batch-btn,.bm-page-btn,.page-btn,.pagination-btn,.nav-view-btn,.asset-refresh-button,.asset-create-button,.asset-prune-button,.topic-primary-btn,.topic-secondary-btn,.topic-resource-filter-btn,.topic-comment-layout-btn,.topic-summary-save-btn,.mobile-filter-btn,.ai-test-btn,.bs-btn-cancel,.bs-btn-danger,.note-ai-go,.note-ai-quick-actions > button):disabled { cursor:not-allowed; }
html[data-theme-style="glass"][data-theme="light"] :is(.images-view-toggle) { border-radius:var(--glass-tab-radius); }
/* Danger and warning actions retain their meaning on the pearl surface. */
html[data-theme-style="glass"][data-theme="light"] :is(button,a):is(.bs-btn-danger,.btn-batch-del,.bm-batch-btn-danger) {
  --glass-action-fill:linear-gradient(var(--color-danger-light),var(--color-danger-light));
  color:var(--color-danger)!important; border-color:var(--color-danger)!important;
}
html[data-theme-style="glass"][data-theme="light"] button.asset-prune-button {
  --glass-action-fill:linear-gradient(var(--color-warning-light),var(--color-warning-light));
  color:var(--color-warning)!important; border-color:var(--color-warning)!important;
}

/* Native switches and file inputs retain their dimensions and checked mechanics. */
html[data-theme-style="glass"][data-theme="light"] {
  --glass-switch-off:linear-gradient(180deg,#bdc7db99,#edf4ff99);
  --glass-switch-on:linear-gradient(180deg,#aa8be0,#d6c4f8);
  --glass-switch-knob:linear-gradient(160deg,#fff,#e4f5ff 70%,#d5d8ed);
  --glass-switch-knob-shadow:inset 0 0 0 1px #ffffffeb,0 1px 3px #47526760;
}
html[data-theme-style="glass"][data-theme="light"] :is(.fl-toggle .slider,.toggle-switch .toggle-track,.toggle-switch .toggle-slider) {
  background:var(--glass-switch-off)!important; box-shadow:var(--glass-tab-pressed); transition:none;
}
html[data-theme-style="glass"][data-theme="light"] :is(.fl-toggle,.toggle-switch) input:checked + :is(.slider,.toggle-track,.toggle-slider) {
  background:var(--glass-switch-on)!important;
}
html[data-theme-style="glass"][data-theme="light"] :is(.fl-toggle .slider,.toggle-switch .toggle-slider)::before,
html[data-theme-style="glass"][data-theme="light"] .toggle-switch .toggle-track::after {
  background:var(--glass-switch-knob); box-shadow:var(--glass-switch-knob-shadow); transition:transform .15s ease;
}
html[data-theme-style="glass"][data-theme="light"] :is(.fl-toggle,.toggle-switch) input:focus-visible + :is(.slider,.toggle-track,.toggle-slider) {
  outline:2px solid var(--color-focus); outline-offset:2px;
}
html[data-theme-style="glass"][data-theme="light"] :is(.fl-toggle,.toggle-switch) input:disabled + :is(.slider,.toggle-track,.toggle-slider) { opacity:.45; cursor:not-allowed; }
html[data-theme-style="glass"][data-theme="light"] input:is([type="checkbox"],[type="radio"],[type="range"]) { accent-color:var(--color-primary); }
html[data-theme-style="glass"][data-theme="light"] input[type="file"]::file-selector-button {
  color:var(--color-text); background:var(--glass-control); border:1px solid var(--color-border);
  border-radius:var(--radius-md); box-shadow:var(--glass-tab-edge); cursor:pointer;
}
/* Selected images need a visible boundary above the shared card rim. */
html[data-theme-style="glass"][data-theme="light"] :is(.img-card.selected,.img-row.selected) {
  border-color:var(--color-primary)!important;
  box-shadow:var(--glass-shadow),0 0 0 2px var(--color-focus)!important;
}
/* Utility-class secondary actions, including the reminder test-mail button. */
html[data-theme-style="glass"][data-theme="light"] button.border-slate-300:not(.bg-blue-600):not(.bg-blue-500) {
  background:var(--glass-tab-highlight),var(--glass-control)!important;
  color:var(--color-text-secondary)!important; border-color:var(--color-border)!important;
  border-radius:var(--glass-tab-radius)!important; box-shadow:var(--glass-tab-edge)!important;
}

/* Selected heatmap cells must remain readable at every activity level. */
html[data-theme-style="glass"][data-theme="light"] .home-date-layout .calendar-day.selected {
  background:var(--glass-selected)!important; color:var(--glass-tab-ink)!important;
  border-color:var(--color-primary)!important; box-shadow:0 0 0 2px var(--color-focus-ring)!important;
}
html[data-theme-style="glass"][data-theme="light"] .home-date-layout .calendar-day.selected :is(.calendar-day-num,small) { color:var(--glass-tab-ink)!important; }
/* Preference overrides come after material tokens so later paint rules cannot undo them. */
@media (prefers-reduced-transparency:reduce) {
  html[data-theme-style="glass"][data-theme="light"] {
    --glass-panel:linear-gradient(#edf0f8,#edf0f8);
    --glass-control:linear-gradient(#f5f6fa,#e7eaf3);
    --glass-input:#f3f5fa; --color-bg-card:#e8ebf3;
    --glass-floating-base:#eff1f8; --glass-field-base:#f4f5fa;
  }
}

/* Composite search: the form owns the glass surface and focus ring. */
html[data-theme-style="glass"][data-theme="light"] :is(.public-search,.header-search-field) {
  background:var(--glass-control),var(--glass-input); border-radius:var(--glass-tab-radius);
  border-color:var(--color-border); box-shadow:var(--glass-field-shadow);
}
html[data-theme-style="glass"][data-theme="light"] :is(.public-search,.header-search-field):focus-within {
  border-color:var(--color-focus); box-shadow:var(--glass-field-shadow),var(--glass-focus-shadow);
}
html[data-theme-style="glass"][data-theme="light"] .public-search input[type="search"],
html[data-theme-style="glass"][data-theme="light"] .public-search input[type="search"]:focus-visible {
  background:transparent!important; border-color:transparent!important; box-shadow:none!important;
}
html[data-theme-style="glass"][data-theme="light"] .public-search input[type="search"]:focus-visible {
  outline:none; /* The enclosing form supplies the visible focus indicator. */
}
html[data-theme-style="glass"][data-theme="light"] .home-toolbar .main-tab[data-home-sort] {
  padding-inline:var(--spacing-md); white-space:nowrap;
}

/* Public bookmarks share one feed surface; rows are not independent glass cards. */
html[data-theme-style="glass"][data-theme="light"] .public-items-bookmark :is(.bm-row,.bm-row-content) {
  background:transparent!important; box-shadow:none!important; border-radius:0!important;
  -webkit-backdrop-filter:none; backdrop-filter:none;
}
html[data-theme-style="glass"][data-theme="light"] .public-items-bookmark .bm-row {
  border-color:var(--color-border-light)!important;
}
html[data-theme-style="glass"][data-theme="light"] .public-items-bookmark .bm-row::before { content:none; }

/* A mobile swipe foreground must occlude its action tray, even while moving. */
@media (max-width:640px) {
  html[data-theme-style="glass"][data-theme="light"] #bm-list { --glass-bookmark-base:#edf0f8; }
  html[data-theme-style="glass"][data-theme="light"] #bm-list .bm-row-content {
    background:var(--glass-bookmark-fill,var(--glass-panel)),var(--glass-bookmark-base)!important;
    border-radius:inherit; box-shadow:var(--glass-tab-edge);
  }
  html[data-theme-style="glass"][data-theme="light"] #bm-list :is(.bm-row-selected,.bm-row-highlight) {
    --glass-bookmark-fill:var(--glass-selected);
  }
  html[data-theme-style="glass"][data-theme="light"] #bm-list .bm-row-swipe-action { color:var(--color-on-primary); }
  html[data-theme-style="glass"][data-theme="light"] #bm-list .bm-row-swipe-actions {
    visibility:hidden; pointer-events:none;
  }
  html[data-theme-style="glass"][data-theme="light"] #bm-list :is(.bm-row-swiping,.bm-row-swipe-open) .bm-row-swipe-actions {
    visibility:visible; pointer-events:auto;
  }
}

/* Topic workbench controls need space inside the optical rim. Keep scrolling
   and sticky positioning on their existing containers. */
html[data-theme-style="glass"][data-theme="light"] :is(.topic-rail,.topic-detail) {
  padding:var(--spacing-md); box-sizing:border-box;
}
html[data-theme-style="glass"][data-theme="light"] :is(.topic-toolbar,.topic-list) {
  background:transparent!important; box-shadow:none!important;
  backdrop-filter:none; -webkit-backdrop-filter:none;
}
html[data-theme-style="glass"][data-theme="light"] .topic-list {
  border-radius:0; border:0;
}
html[data-theme-style="glass"][data-theme="light"] .topic-list::before { content:none; }
html[data-theme-style="glass"][data-theme="light"] .topic-detail-tabs-row {
  flex-wrap:wrap; min-width:0; margin:0;
}
html[data-theme-style="glass"][data-theme="light"] .topic-detail-tabs {
  flex:0 1 280px; min-width:0; display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr)); gap:var(--spacing-xs);
  background:transparent!important; box-shadow:none!important; border:0; overflow:visible;
}
html[data-theme-style="glass"][data-theme="light"] .topic-detail-tab.main-tab {
  min-width:0; padding:var(--spacing-sm) var(--spacing-xs); white-space:normal; overflow-wrap:anywhere;
}
html[data-theme-style="glass"][data-theme="light"] .topic-detail-tabs-actions { margin-left:auto; }
html[data-theme-style="glass"][data-theme="light"] .topic-toolbar .topic-search-input { min-width:0; width:0; }

/* A segmented bar must reserve space for the glass button edges. */
html[data-theme-style="glass"][data-theme="light"] .asset-tabs {
  padding:var(--spacing-sm); gap:var(--spacing-xs);
  border-radius:var(--radius-lg); overflow-x:auto; overflow-y:hidden;
}
/* The TV workbench owns the outer glass surface; its columns are subdivisions. */
html[data-theme-style="glass"][data-theme="light"] .tv-work { padding:var(--spacing-sm); }
html[data-theme-style="glass"][data-theme="light"] .tv-work :is(.tv-side,.tv-editor) {
  background:transparent!important; box-shadow:none!important; border-radius:0!important;
  backdrop-filter:none; -webkit-backdrop-filter:none;
}
html[data-theme-style="glass"][data-theme="light"] .tv-work :is(.tv-side,.tv-editor)::before { content:none; }

/* AI windows sit directly over readable documents. Their body must occlude
   underlying text; the gradient and rim provide the glass appearance. */
html[data-theme-style="glass"][data-theme="light"] :is(.preview-ai-panel,.home-assistant-dialog,.ai-dlg-box) {
  --glass-floating-base:#eff1f8;
}

/* Floating drawers and native dialogs must not inherit translucent page-card
   paint. State selectors keep ordinary desktop sidebars unchanged. */
html[data-theme-style="glass"][data-theme="light"] :is(.mobile-drawer,.task-mobile-drawer,.bm-drawer,#sidebar.drawer-open,.local-tools-sidebar.is-open,body.topic-mobile-topic-open .topic-rail,.share-comments-panel,#panel-tv dialog) {
  background:var(--glass-floating-fill),var(--glass-floating-base)!important;
  color:var(--color-text); border-color:var(--glass-floating-rim)!important;
  box-shadow:var(--glass-floating-shadow)!important;
}
html[data-theme-style="glass"][data-theme="light"] :is(.note-emoji-picker,.editor-emoji-picker,.topic-emoji-picker,.asset-autocomplete-options) {
  background:var(--glass-floating-fill),var(--glass-floating-base)!important;
  color:var(--color-text); border-color:var(--glass-floating-rim)!important;
  box-shadow:var(--glass-floating-shadow)!important;
}
