.ti-math-icon-button{display:inline-flex;align-items:center;justify-content:center;min-width:42px;min-height:38px;padding:8px 11px!important;flex:none}
/* Math view is an Edit action; its pressed state remains visible when reopening the menu. */
#xml-edit-menu #xml-math-view-btn[aria-pressed=true]::after{content:'✓';float:right;color:#65a30d;font-weight:900}
/* Give every math popup a coherent light palette, including inactive catalog entries. */
[data-theme=light] .ti-math-tool-popup button{background:#e8eff7;color:#20344c;border-color:#b5c5d8;box-shadow:none}
[data-theme=light] .ti-math-tool-popup button:hover:not(:disabled){background:#d8e6f5;color:#12283f;border-color:#8ca9c8}
[data-theme=light] .ti-math-tool-popup button:disabled{color:#758395;opacity:.65}
[data-theme=light] .ti-math-tool-popup .green-tool-button,[data-theme=light] .ti-math-tool-popup .ti-math-catalog-tabs button.active{background:#a5ed32;color:#17250b;border-color:#8ac923}
[data-theme=light] .ti-math-tool-popup .green-tool-button:hover:not(:disabled),[data-theme=light] .ti-math-tool-popup .ti-math-catalog-tabs button.active:hover{background:#b7f34d;color:#17250b}
[data-theme=light] .ti-math-tool-popup .ti-math-catalog-entry[aria-selected=true]{background:#d4e5f8;color:#142b43;border-color:#86a9cd}
[data-theme=light] .ti-math-tool-popup .ti-math-catalog-entry small{opacity:1;color:#566d88}
[data-theme=light] .ti-math-tool-popup .ti-math-catalog-tabs img{filter:none}
[data-theme=light] .ti-math-tool-popup input,[data-theme=light] .ti-math-tool-popup select{background:#fff;color:#14243b;border-color:#9eb4cd}
[data-theme=light] .ti-math-tool-popup input::placeholder{color:#64748b;opacity:1}
[data-theme=light] .ti-math-tool-popup .ti-math-catalog-formula,[data-theme=light] .ti-math-tool-popup .ti-math-dimension-preview{background:#fff;color:#111;border:1px solid #d2deec}
[data-theme=light] .ti-math-tool-popup .ti-math-view-option{border-color:#c6d3e3}
[data-theme=light] .ti-math-tool-popup .ti-math-wizard-status{color:#8a5300}
[data-theme=light] .ti-math-tool-popup .ti-math-template-grid button{background:#fff;color:#111;border-color:#c0cfdf}
[data-theme=light] .ti-math-tool-popup .ti-math-template-grid button:hover{background:#eef5fc;color:#111;border-color:#87a7ca}
.green-tool-button.ti-math-icon-button,.prgm-preview-modal .green-tool-button.ti-math-icon-button{border:0;background:linear-gradient(135deg,var(--lime,#b7f34d),var(--lime2,#8de62a));color:#2d3d17;box-shadow:0 0 20px rgb(183 243 77 / 25%)}
.green-tool-button.ti-math-icon-button:hover:not(:disabled),.prgm-preview-modal .green-tool-button.ti-math-icon-button:hover:not(:disabled){background:linear-gradient(135deg,var(--lime,#b7f34d),var(--lime2,#8de62a));box-shadow:0 0 30px rgb(183 243 77 / 35%)}
.ti-math-catalog-popup{display:flex;flex-direction:column;overflow:hidden}.ti-math-catalog-popup>header{flex:none}.ti-math-catalog-popup>.ti-math-popup-content{display:flex;flex-direction:column;min-height:0;flex:1}.ti-math-catalog-popup .ti-math-catalog-tabs,.ti-math-catalog-popup .ti-math-catalog-search,.ti-math-catalog-popup .ti-math-catalog-breadcrumb{flex:none}.ti-math-catalog-popup .ti-math-catalog-body{min-height:0;flex:1;overflow:hidden}.ti-math-catalog-popup .ti-math-catalog-list,.ti-math-catalog-popup .ti-math-catalog-detail{height:auto;min-height:0;max-height:none;overflow:auto;padding-bottom:10px;scroll-padding-bottom:10px}.ti-math-variable-list{max-height:300px;overflow:auto;display:grid;gap:6px;padding:2px 0 10px}.ti-math-variable-entry{display:flex;align-items:center;justify-content:space-between;width:100%;gap:12px;text-align:left}.ti-math-variable-entry span{display:grid;gap:3px}.ti-math-variable-entry small{opacity:.7}.ti-math-variable-entry code{max-width:60%;overflow-wrap:anywhere}.ti-math-library-selection{display:grid;gap:9px}.ti-math-library-selection code,.ti-math-library-status{overflow-wrap:anywhere}.ti-math-library-entry span{overflow-wrap:anywhere}
.ti-math-tool-icon{display:block;width:25px;height:25px;background:currentColor;mask:var(--math-tool-icon) center/contain no-repeat;-webkit-mask:var(--math-tool-icon) center/contain no-repeat;filter:drop-shadow(.28px 0 currentColor) drop-shadow(-.28px 0 currentColor) drop-shadow(0 .28px currentColor) drop-shadow(0 -.28px currentColor)}
.ti-math-icon-templates{--math-tool-icon:url('../assets/math-tools/templates.svg')}.ti-math-icon-catalog{--math-tool-icon:url('../assets/math-tools/catalog.svg')}
.ti-math-tool-popup{position:fixed;box-sizing:border-box;z-index:12000;border:1px solid #405675;border-radius:15px;background:#111d30;color:#e6edf8;box-shadow:0 18px 65px #0008;font:13px/1.45 Arial,sans-serif;overflow:auto;overscroll-behavior:contain;padding:14px}
.ti-math-tool-popup *{box-sizing:border-box}.ti-math-tool-popup>header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.ti-math-tool-popup button{border:1px solid #334962;border-radius:8px;padding:8px 10px;background:#203e63;color:#e1edff;cursor:pointer;font:600 12px Arial,sans-serif;max-width:100%;white-space:normal}.ti-math-tool-popup button:focus-visible,.ti-math-tool-popup input:focus-visible{outline:2px solid #a5ed32;outline-offset:2px}.ti-math-tool-popup .green-tool-button{color:#17250b;background:#a5ed32}.ti-math-popup-close{font-size:18px!important;padding:3px 10px!important}
.ti-math-template-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:7px}.ti-math-template-grid button{position:relative;display:grid;place-items:center;min-height:51px;background:#f8faff;color:#111;padding:5px}.ti-math-template-grid img{width:100%;max-width:53px;height:40px;object-fit:contain}.ti-math-size-mark{position:absolute;right:3px;bottom:0;font-size:14px;color:#244a83}.ti-math-view-option{display:flex;align-items:center;gap:9px;margin-top:13px;padding-top:10px;border-top:1px solid #34465e}
.ti-math-dimensions{display:grid;gap:12px}.ti-math-dimensions label{display:flex;align-items:center;justify-content:space-between;gap:12px}.ti-math-dimensions input{width:85px;padding:8px;border:1px solid #627e9c;border-radius:6px;background:#08111f;color:#eef4ff}.ti-math-dimension-preview{max-height:230px;overflow:auto;text-align:center;padding:12px;background:#fff;color:#111;border-radius:7px}.ti-math-popup-actions{display:flex;justify-content:flex-end;gap:8px}.ti-math-tool-popup math{font:20px 'Cambria Math','STIX Two Math',serif;max-width:100%}
.ti-math-catalog-tabs{display:grid;grid-template-columns:repeat(6,1fr);gap:5px;margin-bottom:10px}.ti-math-catalog-tabs button{display:flex;flex-direction:column;align-items:center;gap:3px;font-size:10px}.ti-math-catalog-tabs img{width:29px;height:29px;filter:invert(1)}.ti-math-catalog-tabs button.active{background:#a5ed32;color:#17250b}.ti-math-catalog-tabs button.active img{filter:none}.ti-math-catalog-search{width:100%;border:1px solid #4a607e;border-radius:8px;padding:10px;background:#08111f;color:#e8f0ff;margin-bottom:10px}.ti-math-catalog-body{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:13px}.ti-math-catalog-list{height:275px;overflow:auto;overscroll-behavior:contain}.ti-math-catalog-entry{display:flex;width:100%;justify-content:space-between;gap:10px;text-align:left;margin-bottom:4px}.ti-math-catalog-entry small{opacity:.6;font-size:10px}.ti-math-catalog-entry[aria-selected=true]{background:#365a88}.ti-math-catalog-detail{overflow:auto;max-height:275px;overflow-wrap:anywhere}.ti-math-catalog-detail code{display:block;white-space:pre-wrap;font:11px/1.6 monospace;margin:4px 0 10px}.ti-math-catalog-formula{background:#fff;color:#111;padding:10px;overflow:auto;border-radius:7px;margin:9px 0}.ti-math-catalog-detail p{margin:8px 0}.ti-math-placeholder{color:#72829b}
.inspector-preview-action[data-preview-kind=widgets]::before{content:'+';font-size:22px;line-height:12px;font-weight:900;color:#7c2d12;margin-right:6px;vertical-align:-1px}
.ti-math-tool-popup{display:flex;flex-direction:column;overflow:hidden;min-height:0}.ti-math-tool-popup>header{flex:none}.ti-math-popup-content{min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;padding:2px}
.ti-math-catalog-breadcrumb{display:flex;align-items:center;gap:9px;margin-bottom:8px;font-size:11px;color:#b4c7de;overflow-wrap:anywhere}.ti-math-catalog-breadcrumb:empty{display:none}.ti-math-catalog-breadcrumb button{flex:none;font-size:11px;padding:6px 8px}.ti-math-catalog-category span{font-weight:700}.ti-math-catalog-category small{font-size:19px;opacity:1;line-height:14px}.ti-math-catalog-category{align-items:center;min-height:36px}.ti-math-catalog-list,.ti-math-catalog-detail{scrollbar-width:thin}
.ti-math-symbol-body{grid-template-columns:minmax(0,1fr)}.ti-math-catalog-list.ti-math-symbol-grid{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));align-content:start;gap:6px;height:236px;padding:2px}.ti-math-symbol-grid .ti-math-catalog-entry{display:grid;place-items:center;min-height:43px;margin:0;padding:5px;font:23px/1.2 'Cambria Math','STIX Two Math',serif}.ti-math-symbol-body .ti-math-catalog-detail{max-height:140px}.ti-math-symbol-body .ti-math-catalog-formula{float:left;min-width:65px;min-height:42px;margin:0 12px 0 0;text-align:center}.ti-math-symbol-body .ti-math-catalog-detail>strong,.ti-math-symbol-body .ti-math-catalog-detail>p,.ti-math-symbol-body .ti-math-catalog-detail>small,.ti-math-symbol-body .ti-math-catalog-detail>code{display:none}
.ti-math-symbol-grid .ti-math-catalog-entry{justify-content:center;grid-template-columns:minmax(0,1fr);text-align:center}.ti-math-symbol-grid .ti-math-catalog-entry>span{display:block;width:100%;text-align:center}
.ti-math-catalog-wizard{display:grid;gap:9px}.ti-math-wizard-fields{display:grid;gap:9px}.ti-math-wizard-fields label{display:grid;gap:4px;font-size:12px}.ti-math-wizard-fields input,.ti-math-wizard-fields select{width:100%;max-width:100%;border:1px solid #526b8c;border-radius:7px;padding:8px;background:#08111f;color:#e8f0ff;font:13px/1.35 Arial,sans-serif}.ti-math-wizard-fields code{white-space:pre-wrap;overflow-wrap:anywhere;font:11px/1.5 monospace}.ti-math-wizard-status:empty{display:none}.ti-math-wizard-status{color:#fbbf24;font-size:12px;margin:0}.ti-math-catalog-wizard .ti-math-popup-actions{position:sticky;bottom:0;padding:7px 0;background:#111d30}.ti-math-catalog-wizard .ti-math-popup-actions button{flex:1}
[data-theme=light] .ti-math-catalog-wizard select{background:#fff;color:#14243b}[data-theme=light] .ti-math-catalog-wizard .ti-math-popup-actions{background:#f7faff}[data-theme=light] .ti-math-catalog-breadcrumb{color:#4d6580}
@media(max-width:500px){.ti-math-catalog-list.ti-math-symbol-grid{grid-template-columns:repeat(6,minmax(0,1fr));height:190px}.ti-math-symbol-body .ti-math-catalog-detail{max-height:90px}}
[data-theme=light] .ti-math-tool-popup{background:#f7faff;color:#1c2c41;border-color:#a7bacf;box-shadow:0 18px 65px #172f4533}[data-theme=light] .ti-math-tool-popup input{background:#fff;color:#14243b}[data-theme=light] .ti-math-catalog-tabs img{filter:none}
@media(max-width:500px){.ti-math-catalog-body{grid-template-columns:minmax(0,1fr)}.ti-math-catalog-list{height:160px}.ti-math-catalog-detail{max-height:160px}.ti-math-catalog-tabs button{padding:6px 2px}.ti-math-catalog-tabs span{max-width:100%;overflow:hidden;font-size:8px}.ti-math-catalog-tabs img{width:23px;height:23px}}
