[data-toantin-tool="equation_composer"] {
  --ec-primary: var(--toantin-primary, #0D5BEF);
  --ec-primary-2: var(--toantin-primary-2, #2477EF);
  --ec-text: var(--toantin-text, #0F1F4B);
  --ec-muted: #64748B;
  --ec-border: var(--toantin-border, #D8E5F5);
  --ec-surface: var(--toantin-surface, #FFFFFF);
  --ec-soft: var(--toantin-surface-soft, #F4F8FF);
  --ec-soft-2: #EEF5FF;
  --ec-focus: #60A5FA;
  color: var(--ec-text);
  background: var(--ec-surface);
  border: 1px solid var(--ec-border);
  border-radius: 16px;
  box-shadow: 0 14px 36px rgba(15,31,75,.10);
  min-width: 0;
  overflow: hidden;
  font-family: var(--toantin-font, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif);
}
[data-toantin-tool="equation_composer"] .ec-shell { min-width: 0; background: linear-gradient(180deg,#fff 0,#fbfdff 100%); }
[data-toantin-tool="equation_composer"] .ec-topbar { min-height: 52px; padding: 8px 10px; border-bottom: 1px solid var(--ec-border); background: rgba(255,255,255,.96); }
[data-toantin-tool="equation_composer"] .ec-action-btn,
[data-toantin-tool="equation_composer"] .ec-icon-btn,
[data-toantin-tool="equation_composer"] .ec-category-btn { color: var(--ec-text); border: 1px solid transparent; box-shadow: none; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
[data-toantin-tool="equation_composer"] .ec-action-btn { width: 38px; height: 38px; padding: 0; border-radius: 10px; }
[data-toantin-tool="equation_composer"] .ec-action-btn:hover,
[data-toantin-tool="equation_composer"] .ec-icon-btn:hover,
[data-toantin-tool="equation_composer"] .ec-category-btn:hover { background: var(--ec-soft-2); border-color: #C9DCF7; color: var(--ec-primary); }
[data-toantin-tool="equation_composer"] button:focus-visible { outline: 3px solid color-mix(in srgb, var(--ec-focus) 45%, transparent); outline-offset: 2px; }
[data-toantin-tool="equation_composer"] .ec-math-icon { font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif; font-size: 1.15rem; line-height: 1; white-space: nowrap; }
[data-toantin-tool="equation_composer"] .ec-toolbar-title { font-weight: 700; font-size: .84rem; color: #334155; align-items: center; gap: 7px; }
[data-toantin-tool="equation_composer"] .ec-status-dot { width: 8px; height: 8px; background: #22C55E; border-radius: 999px; box-shadow: 0 0 0 3px #DCFCE7; }
[data-toantin-tool="equation_composer"] .ec-strip-wrap { padding: 8px 10px 9px; border-bottom: 1px solid var(--ec-border); background: var(--ec-soft); }
[data-toantin-tool="equation_composer"] .ec-section-label { font-size: .69rem; text-transform: uppercase; letter-spacing: .055em; font-weight: 800; color: #64748B; margin: 0 0 5px 2px; }
[data-toantin-tool="equation_composer"] .ec-favorites { scrollbar-width: thin; padding-bottom: 1px; }
[data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn { min-width: 43px; height: 39px; padding: 0 8px; border-radius: 9px; background: #fff; border-color: #DFE8F5; }
[data-toantin-tool="equation_composer"] .ec-workspace { display: grid; grid-template-columns: minmax(286px, 36%) minmax(0,1fr); min-height: 390px; }
[data-toantin-tool="equation_composer"] .ec-palette { border-right: 1px solid var(--ec-border); background: #FBFDFF; min-width: 0; }
[data-toantin-tool="equation_composer"] .ec-category-tabs { display: flex; align-items: center; gap: 3px; overflow-x: auto; padding: 8px; border-bottom: 1px solid var(--ec-border); scrollbar-width: thin; }
[data-toantin-tool="equation_composer"] .ec-category-btn { width: 38px; height: 38px; padding: 0; border-radius: 9px; background: transparent; }
[data-toantin-tool="equation_composer"] .ec-category-btn.active { background: #E9F2FF; border-color: #BBD5FA; color: var(--ec-primary); box-shadow: inset 0 -2px 0 var(--ec-primary); }
[data-toantin-tool="equation_composer"] .ec-template-panel { padding: 10px; }
[data-toantin-tool="equation_composer"] .ec-panel-title { font-weight: 800; font-size: .83rem; color: #334155; margin: 1px 2px 8px; }
[data-toantin-tool="equation_composer"] .ec-template-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(54px,1fr)); gap: 6px; align-content: start; }
[data-toantin-tool="equation_composer"] .ec-template-grid .ec-icon-btn { height: 52px; min-width: 0; padding: 4px; border-radius: 10px; background: #fff; border-color: #DFE8F5; }
[data-toantin-tool="equation_composer"] .ec-template-grid .ec-math-icon { font-size: 1.22rem; }
[data-toantin-tool="equation_composer"] .ec-empty-state { grid-column: 1/-1; padding: 22px 16px; border: 1px dashed #C8D8EB; border-radius: 12px; text-align: center; color: var(--ec-muted); background: #fff; }
[data-toantin-tool="equation_composer"] .ec-empty-state strong { display: block; color: #334155; margin-bottom: 4px; }
[data-toantin-tool="equation_composer"] .ec-empty-state p { margin: 0; font-size: .82rem; }
[data-toantin-tool="equation_composer"] .ec-edit-area { min-width: 0; padding: 18px; display: flex; flex-direction: column; background: #fff; }
[data-toantin-tool="equation_composer"] .ec-editor-heading { margin-bottom: 10px; }
[data-toantin-tool="equation_composer"] .ec-editor-heading strong { display: block; font-size: .95rem; }
[data-toantin-tool="equation_composer"] .ec-editor-heading small { display: block; color: var(--ec-muted); margin-top: 2px; }
[data-toantin-tool="equation_composer"] .ec-mode-badge { color: #28558F !important; background: #F3F8FF !important; }
[data-toantin-tool="equation_composer"] .ec-editor-canvas { flex: 1; min-height: 230px; padding: 18px; border: 1px solid #CFE0F3; border-radius: 14px; background: linear-gradient(145deg,#fff,#F8FBFF); box-shadow: inset 0 1px 0 #fff, 0 7px 20px rgba(15,31,75,.05); display: flex; align-items: center; }
[data-toantin-tool="equation_composer"] .ec-a2-editor-fallback,
[data-toantin-tool="equation_composer"] .ec-mathfield { width: 100%; min-height: 150px; border: 0; background: transparent; padding: 16px; font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif; font-size: clamp(1.35rem,2.5vw,2rem); line-height: 1.6; resize: none; color: #111827; box-shadow: none; }
[data-toantin-tool="equation_composer"] .ec-a2-editor-fallback:focus,
[data-toantin-tool="equation_composer"] .ec-mathfield:focus { outline: none; box-shadow: none; }
[data-toantin-tool="equation_composer"] .ec-editor-canvas:focus-within { border-color: #7EB3F5; box-shadow: 0 0 0 4px rgba(59,130,246,.10), inset 0 1px 0 #fff; }
[data-toantin-tool="equation_composer"] .ec-shortcut-hint { margin-top: 9px; color: var(--ec-muted); font-size: .74rem; line-height: 1.45; }
[data-toantin-tool="equation_composer"] .ec-surface { border: 1px solid var(--ec-border); border-radius: 12px; padding: 12px; background: var(--ec-surface); }
@media (max-width: 767.98px) {
  [data-toantin-tool="equation_composer"] { border-radius: 12px; }
  [data-toantin-tool="equation_composer"] .ec-workspace { grid-template-columns: 1fr; }
  [data-toantin-tool="equation_composer"] .ec-palette { border-right: 0; border-bottom: 1px solid var(--ec-border); }
  [data-toantin-tool="equation_composer"] .ec-template-panel { padding: 8px; }
  [data-toantin-tool="equation_composer"] .ec-template-grid { grid-template-columns: repeat(5,minmax(48px,1fr)); }
  [data-toantin-tool="equation_composer"] .ec-template-grid .ec-icon-btn { min-height: 48px; height: 48px; }
  [data-toantin-tool="equation_composer"] .ec-edit-area { padding: 12px; }
  [data-toantin-tool="equation_composer"] .ec-editor-canvas { min-height: 190px; padding: 8px; }
  [data-toantin-tool="equation_composer"] .ec-action-btn { width: 44px; height: 44px; }
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn { min-width: 46px; height: 44px; }
  [data-toantin-tool="equation_composer"] .ec-shortcut-hint { display: none; }
}
@media (max-width: 390px) {
  [data-toantin-tool="equation_composer"] .ec-topbar { gap: 4px !important; padding: 6px; }
  [data-toantin-tool="equation_composer"] .ec-strip-wrap { padding-inline: 7px; }
  [data-toantin-tool="equation_composer"] .ec-category-tabs { padding: 6px; }
  [data-toantin-tool="equation_composer"] .ec-template-grid { grid-template-columns: repeat(4,minmax(48px,1fr)); }
}
@media (min-width: 1400px) {
  [data-toantin-tool="equation_composer"] .ec-template-grid .ec-icon-btn { min-height: 58px; }
  [data-toantin-tool="equation_composer"] .ec-editor-canvas { min-height: 300px; }
}
@media (prefers-reduced-motion: reduce) {
  [data-toantin-tool="equation_composer"] *, [data-toantin-tool="equation_composer"] *::before, [data-toantin-tool="equation_composer"] *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; }
}

[data-toantin-tool="equation_composer"] .ec-editor-controls { flex-wrap: wrap; justify-content: flex-end; }
[data-toantin-tool="equation_composer"] .ec-mode-btn { width: auto; min-width: 50px; height: 36px; padding: 0 9px; border-radius: 9px; border: 1px solid var(--ec-border); background: #fff; white-space: nowrap; line-height: 1; flex: 0 0 auto; }
[data-toantin-tool="equation_composer"] .ec-mode-btn.active { color: var(--ec-primary); background: #EAF3FF; border-color: #AFCDF6; box-shadow: inset 0 -2px 0 var(--ec-primary); }
[data-toantin-tool="equation_composer"] .ec-profile-select { width: auto; min-width: 116px; max-width: 160px; color: #334155; border-color: var(--ec-border); background-color: #fff; }
[data-toantin-tool="equation_composer"] .ec-template-grid button[hidden], [data-toantin-tool="equation_composer"] .ec-category-tabs button[hidden] { display: none !important; }
@media (max-width: 575.98px) {
  [data-toantin-tool="equation_composer"] .ec-editor-heading { align-items: flex-start !important; flex-direction: column; }
  [data-toantin-tool="equation_composer"] .ec-editor-controls { width: 100%; justify-content: flex-start; }
  [data-toantin-tool="equation_composer"] .ec-mode-btn { width: auto; min-width: 56px; height: 44px; padding: 0 10px; }
  [data-toantin-tool="equation_composer"] .ec-profile-select { min-height: 44px; flex: 1 1 150px; }
}
[data-toantin-tool="equation_composer"] .ec-context-bar{display:flex;gap:5px;align-items:center;overflow-x:auto;padding:7px 8px;margin-bottom:8px;border:1px solid var(--ec-border);border-radius:11px;background:#F8FBFF;scrollbar-width:thin}
[data-toantin-tool="equation_composer"] .ec-context-btn{min-width:42px;height:36px;padding:0 8px;border:1px solid #DFE8F5;border-radius:9px;background:#fff}
[data-toantin-tool="equation_composer"] .ec-matrix-picker{grid-column:1/-1;margin-top:8px;padding:10px;border:1px solid #D8E5F5;border-radius:12px;background:#F8FBFF}
[data-toantin-tool="equation_composer"] .ec-matrix-picker-grid{display:grid;grid-template-columns:repeat(5,24px);gap:3px;width:max-content;padding:6px;border:1px solid #D8E5F5;border-radius:9px;background:#fff}
[data-toantin-tool="equation_composer"] .ec-matrix-cell{width:24px;height:24px;border:1px solid #C9D8EC;border-radius:4px;background:#fff;padding:0}
[data-toantin-tool="equation_composer"] .ec-matrix-cell.active{background:#DCEBFF;border-color:#6EA8F4}
[data-toantin-tool="equation_composer"] .ec-matrix-custom{margin-top:8px}
[data-toantin-tool="equation_composer"] .ec-matrix-custom input{width:62px}
[data-toantin-tool="equation_composer"] .ec-matrix-picker-status{min-width:52px;font-weight:800;color:#28558F}
[data-toantin-tool="equation_composer"] .ec-virtual-keyboard{border-top:1px solid var(--ec-border);background:#F7FAFF;padding:9px 10px 11px}
[data-toantin-tool="equation_composer"] .ec-keyboard-header{margin-bottom:8px}
[data-toantin-tool="equation_composer"] .ec-keyboard-title{font-weight:800;font-size:.82rem;color:#334155}
[data-toantin-tool="equation_composer"] .ec-keyboard-grid{display:grid;grid-template-columns:repeat(8,minmax(46px,1fr));gap:5px}
[data-toantin-tool="equation_composer"] .ec-key{min-height:46px;border-color:#D8E5F5;font-family:"Cambria Math","STIX Two Math",serif;font-size:1.1rem;background:#fff}
[data-toantin-tool="equation_composer"] .ec-keyboard-tab.active{background:#E8F2FF;border-color:#9CC3F6;color:var(--ec-primary)}
[data-toantin-tool="equation_composer"] .ec-context-menu{position:absolute;z-index:20;min-width:188px;padding:6px;border:1px solid #D8E5F5;border-radius:12px;background:#fff;box-shadow:0 14px 34px rgba(15,31,75,.16)}
[data-toantin-tool="equation_composer"] .ec-context-menu-item{display:block;width:100%;padding:9px 10px;border:0;border-radius:8px;background:transparent;text-align:left;color:#1E293B}
[data-toantin-tool="equation_composer"] .ec-context-menu-item:hover,[data-toantin-tool="equation_composer"] .ec-context-menu-item:focus-visible{background:#EEF5FF;color:var(--ec-primary);outline:none}
[data-toantin-tool="equation_composer"]{position:relative}
@media(max-width:767.98px){[data-toantin-tool="equation_composer"] .ec-keyboard-grid{grid-template-columns:repeat(4,minmax(48px,1fr))}[data-toantin-tool="equation_composer"] .ec-key{min-height:48px}[data-toantin-tool="equation_composer"] .ec-context-btn{min-width:44px;height:44px}[data-toantin-tool="equation_composer"] .ec-matrix-picker-grid{grid-template-columns:repeat(5,30px)}[data-toantin-tool="equation_composer"] .ec-matrix-cell{width:30px;height:30px}}
[data-toantin-tool="equation_composer"] .ec-tex-panel{margin:0 .75rem .75rem;border-color:var(--ec-border,#d8e5f5);border-radius:14px;background:var(--ec-bg,#fff);overflow:hidden}
[data-toantin-tool="equation_composer"] .ec-tex-head{padding:.65rem .75rem;border-bottom:1px solid var(--ec-border,#d8e5f5);background:#f8fafc}
[data-toantin-tool="equation_composer"] .ec-tex-source{margin:.75rem;width:calc(100% - 1.5rem);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;min-height:7rem}
[data-toantin-tool="equation_composer"] .ec-tex-profile{max-width:20rem;margin-left:.75rem}
[data-toantin-tool="equation_composer"] .ec-tex-panel>.d-flex{padding:0 .75rem .65rem}
[data-toantin-tool="equation_composer"] .ec-tex-diagnostic{margin:0 .75rem .65rem;padding:.55rem .7rem;border-radius:10px;background:#fff7ed;color:#9a3412;font-size:.875rem;min-height:2.2rem}
[data-toantin-tool="equation_composer"] .ec-tex-diagnostic.is-ok{background:#f0fdf4;color:#166534}
[data-toantin-tool="equation_composer"] .ec-tex-preview{margin:0 .75rem .75rem;padding:.7rem;border:1px solid var(--ec-border,#d8e5f5);border-radius:10px;background:#f8fafc;white-space:pre-wrap;overflow:auto;max-height:15rem}
[data-toantin-tool="equation_composer"] .ec-tex-action{min-width:40px}
@media (max-width:390px){[data-toantin-tool="equation_composer"] .ec-tex-panel{margin:.5rem}[data-toantin-tool="equation_composer"] .ec-tex-source{font-size:.9rem}}
[data-toantin-tool="equation_composer"] .ec-library-panel{margin:0 .75rem .75rem;border-color:var(--ec-border);border-radius:14px;background:#fff;overflow:hidden}
[data-toantin-tool="equation_composer"] .ec-library-head{padding:.65rem .75rem;border-bottom:1px solid var(--ec-border);background:#f8fafc}
[data-toantin-tool="equation_composer"] .ec-library-status{padding:.6rem .75rem .2rem}
[data-toantin-tool="equation_composer"] .ec-library-list{padding:.55rem .75rem .75rem;max-height:280px;overflow:auto}
[data-toantin-tool="equation_composer"] .ec-library-item{border:1px solid #dfe8f5;border-radius:10px;background:#fff;min-height:44px}
[data-toantin-tool="equation_composer"] .ec-domain-surface{border:1px solid var(--ec-border);border-radius:12px;background:#fff;padding:12px;min-width:0}
[data-toantin-tool="equation_composer"] .ec-compact-editor,[data-toantin-tool="equation_composer"] .ec-static-formula{font-family:"Cambria Math","STIX Two Math","Times New Roman",serif;font-size:1.2rem;line-height:1.5;padding:12px;border:1px solid #d8e5f5;border-radius:10px;background:#f8fbff;overflow:auto}
[data-toantin-tool="equation_composer"] .ec-presentation-preview{display:flex;align-items:center;justify-content:center;min-height:120px}
[data-toantin-tool="equation_composer"] .ec-presentation-preview .ec-static-formula{border:0;background:transparent;font-size:clamp(1.4rem,3vw,2.4rem)}
@media(max-width:390px){[data-toantin-tool="equation_composer"] .ec-library-panel{margin:.5rem}[data-toantin-tool="equation_composer"] .ec-library-list{padding:.45rem}}

/* A7 — responsive/accessibility/full-tool polish. Fully scoped. */
[data-toantin-tool="equation_composer"] .ec-editor-canvas .ec-mathfield,
[data-toantin-tool="equation_composer"] .ec-editor-canvas .ec-a2-editor-fallback{transform:scale(var(--ec-view-zoom,1));transform-origin:center left;transition:transform .16s ease}
[data-toantin-tool="equation_composer"] .ec-zoom-controls{padding-left:4px;border-left:1px solid var(--ec-border)}
[data-toantin-tool="equation_composer"] .ec-zoom-btn{width:36px;height:36px;padding:0;border-color:var(--ec-border)}
[data-toantin-tool="equation_composer"] .ec-zoom-label{min-width:56px;height:36px;border-color:var(--ec-border);font-variant-numeric:tabular-nums}
[data-toantin-tool="equation_composer"] .ec-fit-btn{height:36px;border-color:var(--ec-border)}
[data-toantin-tool="equation_composer"] .ec-help-toggle{width:36px;height:36px;padding:0;border-radius:999px;border-color:#bfd6f4;color:var(--ec-primary);font-weight:800;background:#f4f8ff}
[data-toantin-tool="equation_composer"] .ec-help-panel{margin:0 .75rem .75rem;border-color:var(--ec-border);border-radius:14px;overflow:hidden;background:#fff}
[data-toantin-tool="equation_composer"] .ec-help-head{padding:.75rem .85rem;border-bottom:1px solid var(--ec-border);background:linear-gradient(180deg,#f8fbff,#f4f8ff)}
[data-toantin-tool="equation_composer"] .ec-help-close{width:38px;height:38px;padding:0}
[data-toantin-tool="equation_composer"] .ec-help-quick{margin:.75rem .85rem;padding:.8rem .9rem;border:1px solid #cfe0f3;border-radius:12px;background:#f4f8ff;color:#28558f}
[data-toantin-tool="equation_composer"] .ec-help-quick strong{display:block;color:#173b73;margin-bottom:.25rem}
[data-toantin-tool="equation_composer"] .ec-help-body{padding:0 .85rem .85rem;display:grid;gap:6px;max-height:360px;overflow:auto}
[data-toantin-tool="equation_composer"] .ec-help-item{border:1px solid #dfe8f5;border-radius:10px;background:#fff}
[data-toantin-tool="equation_composer"] .ec-help-item summary{cursor:pointer;padding:.7rem .8rem;font-weight:700;color:#243b64;outline:none}
[data-toantin-tool="equation_composer"] .ec-help-item summary:focus-visible{box-shadow:inset 0 0 0 3px rgba(96,165,250,.35);border-radius:9px}
[data-toantin-tool="equation_composer"] .ec-help-item p{margin:0;padding:0 .8rem .8rem;color:#52627a;line-height:1.55;font-size:.9rem}
[data-toantin-tool="equation_composer"] .ec-full-tool{padding:0;overflow:hidden}
[data-toantin-tool="equation_composer"] .ec-full-header{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:18px 20px;border-bottom:1px solid var(--ec-border);background:linear-gradient(135deg,#f8fbff,#eef5ff)}
[data-toantin-tool="equation_composer"] .ec-full-header h2{font-size:1.1rem;margin:0;color:#163b73}
[data-toantin-tool="equation_composer"] .ec-full-header p{margin:.25rem 0 0;color:var(--ec-muted);font-size:.86rem}
[data-toantin-tool="equation_composer"] .ec-full-grid{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(220px,.8fr) minmax(220px,.8fr);gap:12px;padding:14px;background:#f8fbff}
[data-toantin-tool="equation_composer"] .ec-full-card{border-color:var(--ec-border);border-radius:14px;overflow:hidden;box-shadow:0 5px 16px rgba(15,31,75,.05)}
[data-toantin-tool="equation_composer"] .ec-full-card-head{padding:.65rem .8rem;font-weight:800;border-bottom:1px solid var(--ec-border);background:#fff}
[data-toantin-tool="equation_composer"] .ec-full-card-body{padding:.8rem;background:#fff;min-height:120px}
[data-toantin-tool="equation_composer"] .ec-full-formula{min-height:150px;display:flex;align-items:center;justify-content:center;padding:18px;border:1px solid #d8e5f5;border-radius:12px;background:linear-gradient(145deg,#fff,#f7fbff);font-family:"Cambria Math","STIX Two Math","Times New Roman",serif;font-size:clamp(1.35rem,3vw,2.2rem);overflow:auto}
[data-toantin-tool="equation_composer"] .ec-full-quick{grid-template-columns:repeat(2,minmax(0,1fr))}
[data-toantin-tool="equation_composer"] .ec-full-quick-btn{min-height:44px;border-color:#dfe8f5}
[data-toantin-tool="equation_composer"] .ec-full-help-list{margin:0;padding-left:1.25rem;color:#52627a;font-size:.88rem;line-height:1.6}
[data-toantin-tool="equation_composer"] .ec-full-note{padding:9px 14px;border-top:1px solid var(--ec-border);background:#fff;color:var(--ec-muted);font-size:.78rem}
@media(max-width:991.98px){[data-toantin-tool="equation_composer"] .ec-full-grid{grid-template-columns:1fr 1fr}[data-toantin-tool="equation_composer"] .ec-full-card:first-child{grid-column:1/-1}}
@media(max-width:767.98px){[data-toantin-tool="equation_composer"] .ec-zoom-controls{order:20;width:100%;padding:.5rem 0 0;border-left:0;border-top:1px solid var(--ec-border);justify-content:center}[data-toantin-tool="equation_composer"] .ec-zoom-btn,[data-toantin-tool="equation_composer"] .ec-zoom-label,[data-toantin-tool="equation_composer"] .ec-fit-btn,[data-toantin-tool="equation_composer"] .ec-help-toggle{min-height:44px}[data-toantin-tool="equation_composer"] .ec-full-header{align-items:flex-start;flex-direction:column}[data-toantin-tool="equation_composer"] .ec-full-grid{grid-template-columns:1fr}}
@media(max-width:390px){[data-toantin-tool="equation_composer"] .ec-help-panel{margin:.5rem}[data-toantin-tool="equation_composer"] .ec-help-body{max-height:300px}[data-toantin-tool="equation_composer"] .ec-full-grid{padding:8px;gap:8px}[data-toantin-tool="equation_composer"] .ec-full-header{padding:14px}[data-toantin-tool="equation_composer"] .ec-full-quick{grid-template-columns:1fr 1fr}}
@media(min-width:1600px){[data-toantin-tool="equation_composer"] .ec-editor-canvas{min-height:360px}[data-toantin-tool="equation_composer"] .ec-template-grid .ec-icon-btn{min-height:62px}[data-toantin-tool="equation_composer"] .ec-action-btn,[data-toantin-tool="equation_composer"] .ec-category-btn{width:44px;height:44px}}
@media(forced-colors:active){[data-toantin-tool="equation_composer"] .ec-action-btn,[data-toantin-tool="equation_composer"] .ec-icon-btn,[data-toantin-tool="equation_composer"] .ec-category-btn,[data-toantin-tool="equation_composer"] .ec-mode-btn{border:1px solid CanvasText}[data-toantin-tool="equation_composer"] .ec-status-dot{forced-color-adjust:none}}

/* V1.1 B3 — deterministic semantic math-template previews. Fully scoped. */
[data-toantin-tool="equation_composer"] .ec-math-preview{display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%;min-width:44px;min-height:36px;pointer-events:none;color:var(--ec-navy,#102a56)}
[data-toantin-tool="equation_composer"] .ec-math-preview-svg{display:block;width:58px;height:36px;overflow:visible;color:currentColor;shape-rendering:geometricPrecision;text-rendering:geometricPrecision}
[data-toantin-tool="equation_composer"] .ec-math-preview-svg .ec-preview-stroke{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}
[data-toantin-tool="equation_composer"] .ec-math-preview-svg .ec-preview-slot{fill:#f8fbff;stroke:#9fb7d3;stroke-width:1;stroke-dasharray:2 2;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}
[data-toantin-tool="equation_composer"] .ec-math-preview-svg .ec-preview-text{fill:currentColor;font-family:"Cambria Math","STIX Two Math","Times New Roman",serif;dominant-baseline:auto}
[data-toantin-tool="equation_composer"] .ec-icon-btn.ec-has-math-preview{min-width:64px;min-height:48px;padding:.18rem .28rem;border-color:#dfe8f5;background:#fff}
[data-toantin-tool="equation_composer"] .ec-icon-btn.ec-has-math-preview:hover{background:#f4f8ff;border-color:#bfd6f4}
[data-toantin-tool="equation_composer"] .ec-icon-btn.ec-has-math-preview:focus-visible{outline:0;box-shadow:0 0 0 3px rgba(59,130,246,.24);border-color:#7db1f4}
[data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn.ec-has-math-preview{min-width:56px;width:56px;height:44px;min-height:44px;padding:.1rem}
[data-toantin-tool="equation_composer"] .ec-favorites .ec-math-preview-svg{width:50px;height:32px}
[data-toantin-tool="equation_composer"] .ec-math-preview-test-fallback{font-family:"Cambria Math","STIX Two Math","Times New Roman",serif}
@media(max-width:767.98px){[data-toantin-tool="equation_composer"] .ec-icon-btn.ec-has-math-preview{min-width:70px;min-height:52px}[data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn.ec-has-math-preview{min-width:60px;width:60px;height:48px}}
@media (prefers-reduced-motion: reduce){[data-toantin-tool="equation_composer"] .ec-icon-btn.ec-has-math-preview{transition:none}}

/* V1.1 B7 — Search + Command Palette + Discovery UX. Fully scoped. */
[data-toantin-tool="equation_composer"] .ec-discovery-overlay{position:absolute;inset:0;z-index:40;display:flex;align-items:flex-start;justify-content:center;padding:clamp(12px,5vh,48px) 12px;background:rgba(15,31,75,.16);backdrop-filter:blur(3px)}
[data-toantin-tool="equation_composer"] .ec-discovery-overlay[hidden]{display:none}
[data-toantin-tool="equation_composer"] .ec-discovery-panel{width:min(760px,calc(100% - 16px));max-height:min(72vh,650px);display:flex;flex-direction:column;border:1px solid #cfe0f3;border-radius:18px;background:#fff;box-shadow:0 20px 55px rgba(15,31,75,.22);overflow:hidden}
[data-toantin-tool="equation_composer"] .ec-discovery-head{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:10px;padding:12px 14px;border-bottom:1px solid var(--ec-border);background:linear-gradient(180deg,#fff,#f8fbff)}
[data-toantin-tool="equation_composer"] .ec-discovery-search-icon{font-size:1.35rem;color:var(--ec-primary);font-weight:800}
[data-toantin-tool="equation_composer"] .ec-discovery-input{border:0;box-shadow:none!important;background:transparent;font-size:1rem;min-height:42px}
[data-toantin-tool="equation_composer"] .ec-discovery-esc{border:1px solid #d7e4f3;border-bottom-width:2px;border-radius:7px;padding:3px 7px;background:#fff;color:#60708b;font-size:.72rem}
[data-toantin-tool="equation_composer"] .ec-discovery-hint{padding:8px 14px;color:var(--ec-muted);font-size:.76rem;background:#f8fbff;border-bottom:1px solid var(--ec-border)}
[data-toantin-tool="equation_composer"] .ec-discovery-results{display:grid;gap:4px;padding:8px;overflow:auto;min-height:0}
[data-toantin-tool="equation_composer"] .ec-discovery-result{display:grid;grid-template-columns:66px minmax(0,1fr) minmax(0,180px);align-items:center;gap:10px;width:100%;min-height:56px;padding:5px 10px;border:1px solid transparent;border-radius:12px;background:#fff;color:var(--ec-text);text-align:left;transition:background .14s ease,border-color .14s ease,box-shadow .14s ease,transform .14s ease}
[data-toantin-tool="equation_composer"] .ec-discovery-result:hover,[data-toantin-tool="equation_composer"] .ec-discovery-result.active{background:#f2f7ff;border-color:#9bc4f5;box-shadow:0 0 0 2px rgba(22,103,232,.08);transform:translateY(-1px)}
[data-toantin-tool="equation_composer"] .ec-discovery-result:focus-visible{outline:0;box-shadow:0 0 0 3px rgba(59,130,246,.28);border-color:#6ea7ee}
[data-toantin-tool="equation_composer"] .ec-discovery-preview{display:flex;align-items:center;justify-content:center;min-width:60px;min-height:42px;border-radius:9px;background:#f8fbff;color:var(--ec-navy);font-family:"Cambria Math","STIX Two Math","Times New Roman",serif;font-size:1.2rem}
[data-toantin-tool="equation_composer"] .ec-discovery-preview .ec-math-preview-svg{width:54px;height:34px}
[data-toantin-tool="equation_composer"] .ec-discovery-copy{display:flex;flex-direction:column;min-width:0;gap:2px}
[data-toantin-tool="equation_composer"] .ec-discovery-copy strong{font-size:.9rem;color:#173b73;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
[data-toantin-tool="equation_composer"] .ec-discovery-meta{font-size:.74rem;color:var(--ec-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
[data-toantin-tool="equation_composer"] .ec-discovery-tail{justify-self:end;max-width:180px;color:#60708b;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.72rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
[data-toantin-tool="equation_composer"] .ec-discovery-empty{padding:28px 18px;text-align:center;color:var(--ec-muted)}
[data-toantin-tool="equation_composer"] .ec-discovery-empty[hidden]{display:none}
[data-toantin-tool="equation_composer"] .ec-discovery-foot{padding:8px 14px;border-top:1px solid var(--ec-border);background:#f8fbff;color:#60708b;font-size:.72rem;text-align:center}
@media(max-width:575.98px){[data-toantin-tool="equation_composer"] .ec-discovery-overlay{padding:8px}[data-toantin-tool="equation_composer"] .ec-discovery-panel{width:100%;max-height:88vh;border-radius:14px}[data-toantin-tool="equation_composer"] .ec-discovery-result{grid-template-columns:58px minmax(0,1fr)}[data-toantin-tool="equation_composer"] .ec-discovery-tail{display:none}[data-toantin-tool="equation_composer"] .ec-discovery-hint{font-size:.72rem}}
@media(prefers-reduced-motion:reduce){[data-toantin-tool="equation_composer"] .ec-discovery-result{transition:none}[data-toantin-tool="equation_composer"] .ec-discovery-result:hover,[data-toantin-tool="equation_composer"] .ec-discovery-result.active{transform:none}}


/* V1.1 B8 — personalization density foundation */
[data-toantin-tool="equation_composer"][data-density="compact"] .ec-icon-btn,
[data-toantin-tool="equation_composer"] [data-density="compact"] .ec-icon-btn{min-width:36px;min-height:36px;padding:.25rem}
[data-toantin-tool="equation_composer"][data-density="teaching"] .ec-icon-btn,
[data-toantin-tool="equation_composer"] [data-density="teaching"] .ec-icon-btn{min-width:48px;min-height:48px;padding:.5rem}

/* V1.1 B8 — personalization panel */
[data-toantin-tool="equation_composer"] .ec-personalization-panel{display:grid;gap:.75rem}
[data-toantin-tool="equation_composer"] .ec-pref-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem}
[data-toantin-tool="equation_composer"] .ec-pref-field{display:grid;gap:.25rem;font-size:.78rem;color:var(--tt-host-text,#14213d)}
[data-toantin-tool="equation_composer"] .ec-pref-section-head{display:flex;align-items:center;justify-content:space-between;gap:.5rem}
[data-toantin-tool="equation_composer"] .ec-pref-favorites{display:grid;gap:.35rem;max-height:230px;overflow:auto}
[data-toantin-tool="equation_composer"] .ec-pref-favorite-row{display:grid;grid-template-columns:22px 42px 1fr 34px;align-items:center;gap:.4rem;padding:.35rem;border:1px solid var(--tt-host-border,#dce7f5);border-radius:.65rem;background:#fff}
[data-toantin-tool="equation_composer"] .ec-pref-favorite-row[data-dragging="true"]{opacity:.55}
[data-toantin-tool="equation_composer"] .ec-pref-drag{cursor:grab;color:#7085a3}
[data-toantin-tool="equation_composer"] .ec-pref-preview svg{width:36px;height:26px}
[data-toantin-tool="equation_composer"] .ec-pref-label{font-size:.82rem;font-weight:600}
[data-toantin-tool="equation_composer"] .ec-pref-recent{display:flex;flex-wrap:wrap;gap:.35rem}
[data-toantin-tool="equation_composer"] .ec-pref-recent-btn{width:44px;height:40px;padding:.2rem}
[data-toantin-tool="equation_composer"] .ec-pref-recent-btn svg{width:34px;height:26px}
@media(max-width:575.98px){[data-toantin-tool="equation_composer"] .ec-pref-controls{grid-template-columns:1fr}}

/* V1.1 B9 — Virtual Math Keyboard V2. Fully scoped. */
[data-toantin-tool="equation_composer"] .ec-vk-v2{position:relative;margin:.65rem;border:1px solid var(--ec-border,#dce7f5);border-radius:16px;background:rgba(255,255,255,.98);box-shadow:0 16px 40px rgba(15,31,75,.16);overflow:hidden;z-index:32;touch-action:none}
[data-toantin-tool="equation_composer"] .ec-vk-v2[hidden]{display:none}
[data-toantin-tool="equation_composer"] .ec-vk-v2[data-placement="docked"]{position:sticky;left:auto!important;top:auto!important;bottom:0;width:auto}
[data-toantin-tool="equation_composer"] .ec-vk-v2[data-placement="floating"]{position:absolute;right:16px;bottom:16px;width:min(620px,calc(100% - 32px));max-height:min(46vh,360px)}
[data-toantin-tool="equation_composer"] .ec-vk-head{display:grid;grid-template-columns:40px auto minmax(0,1fr) 40px 40px;align-items:center;gap:.4rem;padding:.45rem .5rem;border-bottom:1px solid var(--ec-border,#dce7f5);background:linear-gradient(180deg,#fff,#f7fbff)}
[data-toantin-tool="equation_composer"] .ec-vk-title{font-size:.82rem;color:var(--ec-navy,#102a56);white-space:nowrap}
[data-toantin-tool="equation_composer"] .ec-vk-grip,[data-toantin-tool="equation_composer"] .ec-vk-placement,[data-toantin-tool="equation_composer"] .ec-vk-close{width:38px;height:38px;padding:0;border-color:#dce7f5;font-weight:700}
[data-toantin-tool="equation_composer"] .ec-vk-grip:not(:disabled){cursor:grab}
[data-toantin-tool="equation_composer"] .ec-vk-grip:not(:disabled):active{cursor:grabbing}
[data-toantin-tool="equation_composer"] .ec-vk-tabs{display:flex;align-items:center;gap:.25rem;overflow:auto;scrollbar-width:thin}
[data-toantin-tool="equation_composer"] .ec-vk-tab{min-height:38px;padding:.3rem .65rem;white-space:nowrap;border-color:transparent;color:#415978}
[data-toantin-tool="equation_composer"] .ec-vk-tab.active{background:#eaf3ff;border-color:#9fc8f5;color:#0d5bef;font-weight:700}
[data-toantin-tool="equation_composer"] .ec-vk-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(58px,1fr));gap:.42rem;padding:.6rem;overflow:auto;max-height:280px}
[data-toantin-tool="equation_composer"] .ec-vk-key{position:relative;min-width:58px;min-height:50px;padding:.2rem;border:1px solid #dce7f5;border-bottom-width:2px;border-radius:11px;background:#fff;color:var(--ec-navy,#102a56);box-shadow:0 1px 2px rgba(15,31,75,.05);transition:transform .12s ease,border-color .12s ease,box-shadow .12s ease,background .12s ease}
[data-toantin-tool="equation_composer"] .ec-vk-key:hover{background:#f1f7ff;border-color:#9bc4f5;box-shadow:0 0 0 2px rgba(22,103,232,.07);transform:translateY(-1px)}
[data-toantin-tool="equation_composer"] .ec-vk-key:active{transform:translateY(1px) scale(.985)}
[data-toantin-tool="equation_composer"] .ec-vk-key:focus-visible{outline:0;border-color:#5f9fea;box-shadow:0 0 0 3px rgba(22,103,232,.22)}
[data-toantin-tool="equation_composer"] .ec-vk-key[data-has-alternates="true"]::after{content:"";position:absolute;right:5px;top:5px;width:0;height:0;border-left:4px solid transparent;border-top:4px solid #6f84a0}
[data-toantin-tool="equation_composer"] .ec-vk-key .ec-math-preview-svg{width:54px;height:34px}
[data-toantin-tool="equation_composer"] .ec-vk-alternates{position:absolute;z-index:35;display:flex;gap:.35rem;max-width:min(340px,calc(100% - 16px));padding:.4rem;border:1px solid #bcd3ef;border-radius:12px;background:#fff;box-shadow:0 16px 36px rgba(15,31,75,.2)}
[data-toantin-tool="equation_composer"] .ec-vk-alternates[hidden]{display:none}
[data-toantin-tool="equation_composer"] .ec-vk-alt-key{min-width:58px;min-height:50px}
@media(max-width:575.98px){[data-toantin-tool="equation_composer"] .ec-vk-v2{margin:.35rem;border-radius:13px}[data-toantin-tool="equation_composer"] .ec-vk-head{grid-template-columns:36px minmax(0,1fr) 36px 36px}[data-toantin-tool="equation_composer"] .ec-vk-title{display:none}[data-toantin-tool="equation_composer"] .ec-vk-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:.35rem;padding:.45rem;max-height:42vh}[data-toantin-tool="equation_composer"] .ec-vk-key{min-width:0;min-height:52px}[data-toantin-tool="equation_composer"] .ec-vk-v2[data-placement="floating"]{right:6px;bottom:6px;width:calc(100% - 12px)}}
@media(min-width:1200px){[data-toantin-tool="equation_composer"] .ec-vk-grid{grid-template-columns:repeat(auto-fit,minmax(64px,1fr))}[data-toantin-tool="equation_composer"] .ec-vk-key{min-height:54px}}
@media(prefers-reduced-motion:reduce){[data-toantin-tool="equation_composer"] .ec-vk-key{transition:none}[data-toantin-tool="equation_composer"] .ec-vk-key:hover,[data-toantin-tool="equation_composer"] .ec-vk-key:active{transform:none}}

/* V1.1 B10 — Full Tool UX/IA redesign */
[data-toantin-tool="equation_composer"] .ec-full-tool-v11{min-height:560px;background:#f6f9fe;color:var(--ec-text);}
[data-toantin-tool="equation_composer"] .ec-full-appbar{display:grid;grid-template-columns:minmax(240px,1fr) auto auto;align-items:center;gap:14px;padding:14px 16px;border-bottom:1px solid var(--ec-border);background:#fff;}
[data-toantin-tool="equation_composer"] .ec-full-brand{display:flex;align-items:center;gap:10px;min-width:0;}
[data-toantin-tool="equation_composer"] .ec-full-brand-mark{width:42px;height:42px;border-radius:12px;display:grid;place-items:center;font-family:"Cambria Math","STIX Two Math",serif;font-weight:800;color:#fff;background:linear-gradient(145deg,var(--ec-primary),#4f8df5);box-shadow:0 8px 20px rgba(13,91,239,.2);}
[data-toantin-tool="equation_composer"] .ec-full-brand h2{margin:0;font-size:1.03rem;color:#163b73;letter-spacing:-.01em;}
[data-toantin-tool="equation_composer"] .ec-full-brand p{margin:2px 0 0;color:var(--ec-muted);font-size:.76rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
[data-toantin-tool="equation_composer"] .ec-full-header-status{display:flex;align-items:center;gap:6px;}
[data-toantin-tool="equation_composer"] .ec-full-status-pill{display:inline-flex;align-items:center;gap:5px;min-height:28px;padding:3px 8px;border:1px solid #dbe7f5;border-radius:999px;background:#f8fbff;color:#52627a;font-size:.7rem;white-space:nowrap;}
[data-toantin-tool="equation_composer"] .ec-full-status-pill strong{font-size:.72rem;color:#173b70;}
[data-toantin-tool="equation_composer"] .ec-full-status-ok{background:#f1fbf5;border-color:#ccebd8;}
[data-toantin-tool="equation_composer"] .ec-full-status-warn{background:#fff9ed;border-color:#f4dfb5;}
[data-toantin-tool="equation_composer"] .ec-full-status-label{color:#74849a;}
[data-toantin-tool="equation_composer"] .ec-full-primary-actions{display:flex;align-items:center;justify-content:flex-end;gap:6px;}
[data-toantin-tool="equation_composer"] .ec-full-primary-actions .btn{min-height:38px;border-radius:10px;}
[data-toantin-tool="equation_composer"] .ec-full-insert{min-width:82px;font-weight:700;box-shadow:0 6px 14px rgba(13,91,239,.18);}
[data-toantin-tool="equation_composer"] .ec-full-commandbar{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:10px;padding:8px 12px;border-bottom:1px solid var(--ec-border);background:linear-gradient(180deg,#fff,#fbfdff);}
[data-toantin-tool="equation_composer"] .ec-full-command-utility{display:flex;align-items:center;gap:4px;padding-right:10px;border-right:1px solid var(--ec-border);}
[data-toantin-tool="equation_composer"] .ec-full-command-btn{width:38px;height:38px;padding:0;border-radius:10px;border-color:transparent;}
[data-toantin-tool="equation_composer"] .ec-full-quick-strip{display:flex;gap:5px;align-items:center;overflow-x:auto;scrollbar-width:thin;padding:1px;}
[data-toantin-tool="equation_composer"] .ec-full-template-btn{width:46px;height:42px;flex:0 0 46px;padding:2px;display:grid;place-items:center;border:1px solid #dbe7f5;border-radius:10px;background:#fff;transition:transform .14s ease,border-color .14s ease,box-shadow .14s ease,background .14s ease;}
[data-toantin-tool="equation_composer"] .ec-full-template-btn:hover{background:#f2f7ff;border-color:#9fc5f4;box-shadow:0 0 0 2px rgba(13,91,239,.07);transform:translateY(-1px);}
[data-toantin-tool="equation_composer"] .ec-full-template-btn:focus-visible{outline:0;border-color:#6da5eb;box-shadow:0 0 0 3px rgba(13,91,239,.18);}
[data-toantin-tool="equation_composer"] .ec-full-template-btn .ec-math-preview-svg{max-width:40px;max-height:30px;}
[data-toantin-tool="equation_composer"] .ec-full-workspace-v11{display:grid;grid-template-columns:minmax(0,1fr) minmax(278px,330px);gap:12px;padding:12px;min-height:470px;}
[data-toantin-tool="equation_composer"] .ec-full-editor-stage{min-width:0;display:flex;flex-direction:column;gap:10px;}
[data-toantin-tool="equation_composer"] .ec-full-section{min-width:0;border:1px solid var(--ec-border);border-radius:15px;background:#fff;box-shadow:0 7px 22px rgba(15,31,75,.055);overflow:hidden;}
[data-toantin-tool="equation_composer"] .ec-full-section-head{padding:12px 14px;border-bottom:1px solid var(--ec-border);background:linear-gradient(180deg,#fff,#fbfdff);}
[data-toantin-tool="equation_composer"] .ec-full-section-head h3{margin:0;color:#173b70;font-size:.9rem;font-weight:800;}
[data-toantin-tool="equation_composer"] .ec-full-section-head p{margin:2px 0 0;color:var(--ec-muted);font-size:.75rem;}
[data-toantin-tool="equation_composer"] .ec-full-section-body{padding:14px;}
[data-toantin-tool="equation_composer"] .ec-full-stage-canvas{position:relative;min-height:320px;display:grid;place-items:center;padding:26px;border:1px solid #cfe0f3;border-radius:14px;background:radial-gradient(circle at 50% 0,#fff 0,#fbfdff 55%,#f6faff 100%);box-shadow:inset 0 1px 0 #fff;overflow:auto;}
[data-toantin-tool="equation_composer"] .ec-full-stage-canvas:focus-within{border-color:#7eb3f5;box-shadow:0 0 0 4px rgba(59,130,246,.09),inset 0 1px 0 #fff;}
[data-toantin-tool="equation_composer"] .ec-full-stage-formula{max-width:100%;font-family:"Cambria Math","STIX Two Math","Times New Roman",serif;font-size:clamp(1.5rem,3vw,2.45rem);line-height:1.6;color:#101b35;overflow:auto;}
[data-toantin-tool="equation_composer"] .ec-full-stage-hint{position:absolute;left:50%;bottom:18px;transform:translateX(-50%);padding:6px 10px;border-radius:999px;background:#f5f9ff;color:#75869c;font-size:.72rem;white-space:nowrap;}
[data-toantin-tool="equation_composer"] .ec-full-editor-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:2px 2px 0;}
[data-toantin-tool="equation_composer"] .ec-full-editor-meta,[data-toantin-tool="equation_composer"] .ec-full-editor-secondary{display:flex;align-items:center;gap:6px;flex-wrap:wrap;}
[data-toantin-tool="equation_composer"] .ec-full-context{min-width:0;border:1px solid var(--ec-border);border-radius:15px;background:#fff;box-shadow:0 7px 22px rgba(15,31,75,.055);overflow:hidden;align-self:start;}
[data-toantin-tool="equation_composer"] .ec-full-context-tabs{display:flex;gap:2px;padding:7px;overflow-x:auto;border-bottom:1px solid var(--ec-border);background:#f8fbff;scrollbar-width:thin;}
[data-toantin-tool="equation_composer"] .ec-full-context-tab{border:1px solid transparent;background:transparent;color:#5a6e88;white-space:nowrap;border-radius:8px;}
[data-toantin-tool="equation_composer"] .ec-full-context-tab.active{background:#fff;border-color:#bdd5f1;color:var(--ec-primary);font-weight:700;box-shadow:0 1px 3px rgba(15,31,75,.06);}
[data-toantin-tool="equation_composer"] .ec-full-context-panel{padding:12px;max-height:430px;overflow:auto;}
[data-toantin-tool="equation_composer"] .ec-full-context-panel[hidden]{display:none;}
[data-toantin-tool="equation_composer"] .ec-full-context-hint,[data-toantin-tool="equation_composer"] .ec-full-panel-lead span{display:block;margin:.35rem 0 .7rem;color:var(--ec-muted);font-size:.78rem;line-height:1.45;}
[data-toantin-tool="equation_composer"] .ec-full-context-actions{display:grid;grid-template-columns:1fr 1fr;gap:6px;}
[data-toantin-tool="equation_composer"] .ec-full-context-actions .btn{min-height:38px;text-align:left;border-color:#e0e8f3;}
[data-toantin-tool="equation_composer"] .ec-full-recent-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;}
[data-toantin-tool="equation_composer"] .ec-full-recent-grid .ec-full-template-btn{width:100%;min-width:0;}
[data-toantin-tool="equation_composer"] .ec-full-empty-mini{padding:20px 12px;text-align:center;color:var(--ec-muted);border:1px dashed #cbd9ea;border-radius:11px;background:#fbfdff;font-size:.8rem;}
[data-toantin-tool="equation_composer"] .ec-full-diagnostic-result{margin-top:9px;min-height:28px;padding:7px 8px;border-radius:8px;background:#f8fbff;color:#53657e;font-size:.76rem;}
[data-toantin-tool="equation_composer"] .ec-full-statusbar{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 13px;border-top:1px solid var(--ec-border);background:#fff;color:#7a899c;font-size:.69rem;}
@media(max-width:991.98px){
  [data-toantin-tool="equation_composer"] .ec-full-appbar{grid-template-columns:minmax(0,1fr) auto;} 
  [data-toantin-tool="equation_composer"] .ec-full-header-status{display:none;}
  [data-toantin-tool="equation_composer"] .ec-full-workspace-v11{grid-template-columns:1fr;}
  [data-toantin-tool="equation_composer"] .ec-full-context{order:2;}
  [data-toantin-tool="equation_composer"] .ec-full-context-panels{max-height:none;}
  [data-toantin-tool="equation_composer"] .ec-full-context-panel{max-height:320px;}
  [data-toantin-tool="equation_composer"] .ec-full-stage-canvas{min-height:270px;}
}
@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"] .ec-full-appbar{grid-template-columns:1fr;padding:11px 12px;}
  [data-toantin-tool="equation_composer"] .ec-full-primary-actions{justify-content:flex-start;overflow-x:auto;}
  [data-toantin-tool="equation_composer"] .ec-full-primary-actions .btn{min-height:44px;}
  [data-toantin-tool="equation_composer"] .ec-full-commandbar{grid-template-columns:1fr;padding:7px;}
  [data-toantin-tool="equation_composer"] .ec-full-command-utility{padding:0 0 6px;border-right:0;border-bottom:1px solid var(--ec-border);}
  [data-toantin-tool="equation_composer"] .ec-full-template-btn{width:48px;height:46px;flex-basis:48px;}
  [data-toantin-tool="equation_composer"] .ec-full-workspace-v11{padding:8px;gap:8px;}
  [data-toantin-tool="equation_composer"] .ec-full-section-body{padding:9px;}
  [data-toantin-tool="equation_composer"] .ec-full-stage-canvas{min-height:230px;padding:14px;}
  [data-toantin-tool="equation_composer"] .ec-full-editor-footer{align-items:flex-start;flex-direction:column;}
  [data-toantin-tool="equation_composer"] .ec-full-context-tabs{position:sticky;top:0;z-index:1;}
  [data-toantin-tool="equation_composer"] .ec-full-statusbar{align-items:flex-start;flex-direction:column;}
}
@media(max-width:390px){
  [data-toantin-tool="equation_composer"] .ec-full-brand-mark{width:38px;height:38px;border-radius:10px;}
  [data-toantin-tool="equation_composer"] .ec-full-brand p{display:none;}
  [data-toantin-tool="equation_composer"] .ec-full-primary-actions .btn{flex:1 0 auto;}
  [data-toantin-tool="equation_composer"] .ec-full-stage-canvas{min-height:210px;}
  [data-toantin-tool="equation_composer"] .ec-full-context-actions{grid-template-columns:1fr;}
  [data-toantin-tool="equation_composer"] .ec-full-context-panel{max-height:280px;}
}
@media(min-width:1600px){
  [data-toantin-tool="equation_composer"] .ec-full-workspace-v11{grid-template-columns:minmax(0,1fr) 360px;gap:16px;padding:16px;}
  [data-toantin-tool="equation_composer"] .ec-full-stage-canvas{min-height:410px;}
  [data-toantin-tool="equation_composer"] .ec-full-template-btn{width:50px;height:46px;flex-basis:50px;}
}
@media(prefers-reduced-motion:reduce){[data-toantin-tool="equation_composer"] .ec-full-template-btn{transition:none}[data-toantin-tool="equation_composer"] .ec-full-template-btn:hover{transform:none}}

/* V1.1 B12 — accessibility / responsive / LCD-projector quality */
[data-toantin-tool="equation_composer"] .ec-sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
[data-toantin-tool="equation_composer"] .ec-skip-link{position:absolute;left:10px;top:8px;z-index:60;transform:translateY(-160%);padding:.5rem .75rem;border-radius:9px;background:#102a56;color:#fff;font-weight:700;text-decoration:none}
[data-toantin-tool="equation_composer"] .ec-skip-link:focus-visible{transform:translateY(0);outline:3px solid #7dd3fc;outline-offset:2px}
[data-toantin-tool="equation_composer"] [role="tab"]:focus-visible,[data-toantin-tool="equation_composer"] [role="grid"] button:focus-visible{outline:3px solid rgba(22,103,232,.30);outline-offset:2px}
[data-toantin-tool="equation_composer"] .ec-full-stage-canvas:focus-visible{outline:3px solid rgba(22,103,232,.30);outline-offset:3px}
[data-toantin-tool="equation_composer"] .ec-full-tool-v11[data-density="teaching"] .ec-full-template-btn{width:54px;height:52px;flex-basis:54px}
[data-toantin-tool="equation_composer"] .ec-full-tool-v11[data-density="teaching"] .ec-full-primary-actions .btn,[data-toantin-tool="equation_composer"] .ec-full-tool-v11[data-density="teaching"] .ec-full-context-actions .btn{min-height:48px;font-size:.9rem}
[data-toantin-tool="equation_composer"] .ec-full-tool-v11[data-density="teaching"] .ec-full-stage-formula{font-size:clamp(1.8rem,3.4vw,2.8rem)}
[data-toantin-tool="equation_composer"] .ec-full-tool-v11[data-density="teaching"] .ec-full-context-tab{min-height:46px;padding:.55rem .75rem}
@media(max-width:360px){[data-toantin-tool="equation_composer"] .ec-full-primary-actions{display:grid;grid-template-columns:1fr 1fr;width:100%}[data-toantin-tool="equation_composer"] .ec-full-primary-actions .btn{width:100%}[data-toantin-tool="equation_composer"] .ec-full-template-btn{width:46px;height:46px;flex-basis:46px}[data-toantin-tool="equation_composer"] .ec-vk-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(min-width:1200px) and (pointer:coarse){[data-toantin-tool="equation_composer"] .ec-full-template-btn,[data-toantin-tool="equation_composer"] .ec-vk-key{min-width:52px;min-height:52px}[data-toantin-tool="equation_composer"] .ec-full-context-tab{min-height:48px}}
@media(min-width:1600px){[data-toantin-tool="equation_composer"] .ec-full-tool-v11{font-size:1.05rem}[data-toantin-tool="equation_composer"] .ec-full-stage-formula{font-size:clamp(2rem,2.7vw,3rem)}[data-toantin-tool="equation_composer"] .ec-full-primary-actions .btn{min-height:44px}[data-toantin-tool="equation_composer"] .ec-full-template-btn{width:54px;height:50px;flex-basis:54px}}
@media(prefers-contrast:more){[data-toantin-tool="equation_composer"] .ec-full-tool-v11,[data-toantin-tool="equation_composer"] .ec-vk-v2{--ec-border:#718096;--ec-muted:#374151}[data-toantin-tool="equation_composer"] .ec-full-template-btn,[data-toantin-tool="equation_composer"] .ec-vk-key{border-width:2px}}
@media(forced-colors:active){[data-toantin-tool="equation_composer"] .ec-full-template-btn,[data-toantin-tool="equation_composer"] .ec-full-context-tab,[data-toantin-tool="equation_composer"] .ec-vk-key,[data-toantin-tool="equation_composer"] .ec-full-primary-actions .btn{forced-color-adjust:auto;border:1px solid ButtonText}[data-toantin-tool="equation_composer"] .ec-full-context-tab.active{outline:2px solid Highlight;color:HighlightText;background:Highlight}[data-toantin-tool="equation_composer"] .ec-skip-link{background:Canvas;color:CanvasText;border:1px solid CanvasText}}
@media(prefers-reduced-motion:reduce){[data-toantin-tool="equation_composer"] .ec-skip-link{transition:none}[data-toantin-tool="equation_composer"] *{scroll-behavior:auto}}

/* V1.1 B14 — Visual Excellence / premium polish layer */
[data-toantin-tool="equation_composer"]{
  --ec-v14-shadow-soft:0 10px 30px rgba(15,31,75,.07);
  --ec-v14-shadow-float:0 18px 46px rgba(15,31,75,.12);
  --ec-v14-glow:0 0 0 3px rgba(56,189,248,.10),0 8px 24px rgba(13,91,239,.10);
  --ec-v14-radius-sm:10px;
  --ec-v14-radius-md:14px;
  --ec-v14-radius-lg:18px;
}
[data-toantin-tool="equation_composer"] .ec-full-tool-v11{
  background:
    radial-gradient(circle at 84% -10%,rgba(56,189,248,.10),transparent 30%),
    radial-gradient(circle at 12% 0,rgba(13,91,239,.055),transparent 27%),
    #f7faff;
}
[data-toantin-tool="equation_composer"] .ec-full-appbar{
  position:relative;
  background:rgba(255,255,255,.97);
  box-shadow:0 1px 0 rgba(255,255,255,.85) inset;
}
[data-toantin-tool="equation_composer"] .ec-full-appbar::after{
  content:"";position:absolute;left:16px;right:16px;bottom:-1px;height:1px;
  background:linear-gradient(90deg,transparent,rgba(13,91,239,.22),rgba(56,189,248,.18),transparent);
  pointer-events:none;
}
[data-toantin-tool="equation_composer"] .ec-full-brand-mark{
  position:relative;isolation:isolate;border:1px solid rgba(255,255,255,.55);
  box-shadow:0 10px 24px rgba(13,91,239,.20),inset 0 1px 0 rgba(255,255,255,.35);
}
[data-toantin-tool="equation_composer"] .ec-full-brand-mark::after{
  content:"";position:absolute;inset:4px;border-radius:9px;border:1px solid rgba(255,255,255,.24);pointer-events:none;
}
[data-toantin-tool="equation_composer"] .ec-full-commandbar{
  background:rgba(255,255,255,.88);backdrop-filter:blur(10px);
}
[data-toantin-tool="equation_composer"] .ec-full-template-btn,
[data-toantin-tool="equation_composer"] .ec-full-command-btn,
[data-toantin-tool="equation_composer"] .ec-full-context-tab,
[data-toantin-tool="equation_composer"] .ec-full-primary-actions .btn{
  transition:transform .14s cubic-bezier(.2,.8,.2,1),box-shadow .14s ease,border-color .14s ease,background-color .14s ease,color .14s ease;
}
[data-toantin-tool="equation_composer"] .ec-full-template-btn:hover,
[data-toantin-tool="equation_composer"] .ec-full-command-btn:hover,
[data-toantin-tool="equation_composer"] .ec-full-context-tab:hover{
  transform:translateY(-1px);
}
[data-toantin-tool="equation_composer"] .ec-full-template-btn:hover{
  background:linear-gradient(180deg,#fff,#f3f8ff);border-color:#94bff2;box-shadow:var(--ec-v14-glow);
}
[data-toantin-tool="equation_composer"] .ec-full-template-btn:active,
[data-toantin-tool="equation_composer"] .ec-full-command-btn:active,
[data-toantin-tool="equation_composer"] .ec-full-primary-actions .btn:active{
  transform:translateY(0) scale(.98);
}
[data-toantin-tool="equation_composer"] .ec-full-section,
[data-toantin-tool="equation_composer"] .ec-full-context{
  border-color:#d7e5f6;border-radius:var(--ec-v14-radius-lg);box-shadow:var(--ec-v14-shadow-soft);
}
[data-toantin-tool="equation_composer"] .ec-full-section-head{
  background:linear-gradient(180deg,#fff 0%,#f9fbff 100%);
}
[data-toantin-tool="equation_composer"] .ec-full-stage-canvas{
  min-height:340px;border-radius:16px;border-color:#c6daf2;
  background:
    radial-gradient(circle at 50% -18%,rgba(56,189,248,.12),transparent 38%),
    linear-gradient(145deg,#fff 0%,#fbfdff 62%,#f4f8ff 100%);
  box-shadow:inset 0 1px 0 #fff,0 14px 36px rgba(15,31,75,.055);
}
[data-toantin-tool="equation_composer"] .ec-full-stage-canvas::before{
  content:"";position:absolute;inset:10px;border-radius:12px;border:1px solid rgba(13,91,239,.045);pointer-events:none;
}
[data-toantin-tool="equation_composer"] .ec-full-stage-canvas:focus-within{
  border-color:#69a6ee;box-shadow:0 0 0 4px rgba(56,189,248,.12),0 14px 38px rgba(13,91,239,.09),inset 0 1px 0 #fff;
}
[data-toantin-tool="equation_composer"] .ec-full-stage-formula{
  text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;
}
[data-toantin-tool="equation_composer"] .ec-full-stage-hint{
  border:1px solid rgba(188,211,239,.72);background:rgba(248,251,255,.90);backdrop-filter:blur(8px);
}
[data-toantin-tool="equation_composer"] .ec-full-context-tabs{
  padding:8px;background:linear-gradient(180deg,#fbfdff,#f5f9ff);
}
[data-toantin-tool="equation_composer"] .ec-full-context-tab.active{
  border-color:#a9cdf7;background:linear-gradient(180deg,#fff,#f0f6ff);box-shadow:0 4px 12px rgba(13,91,239,.08),inset 0 -2px 0 var(--ec-primary);
}
[data-toantin-tool="equation_composer"] .ec-full-status-pill{
  border-color:#d8e6f6;background:rgba(248,251,255,.92);box-shadow:inset 0 1px 0 #fff;
}
[data-toantin-tool="equation_composer"] .ec-full-statusbar{
  background:rgba(255,255,255,.92);backdrop-filter:blur(8px);
}
[data-toantin-tool="equation_composer"] .ec-full-empty-mini,
[data-toantin-tool="equation_composer"] .ec-empty-state{
  background:linear-gradient(180deg,#fff,#f8fbff);border-color:#bfd5ee;
}
[data-toantin-tool="equation_composer"] .ec-vk-key:hover,
[data-toantin-tool="equation_composer"] .ec-full-context-actions .btn:hover{
  box-shadow:var(--ec-v14-glow);border-color:#9fc4f0;
}
[data-toantin-tool="equation_composer"] [aria-disabled="true"],
[data-toantin-tool="equation_composer"] button:disabled{
  cursor:not-allowed;filter:saturate(.7);opacity:.5;
}
[data-toantin-tool="equation_composer"] .ec-full-status-ok::before,
[data-toantin-tool="equation_composer"] .ec-full-status-warn::before{
  content:"";width:6px;height:6px;border-radius:999px;display:inline-block;flex:0 0 auto;
}
[data-toantin-tool="equation_composer"] .ec-full-status-ok::before{background:#22c55e;box-shadow:0 0 0 3px rgba(34,197,94,.10)}
[data-toantin-tool="equation_composer"] .ec-full-status-warn::before{background:#f59e0b;box-shadow:0 0 0 3px rgba(245,158,11,.11)}
@media (pointer:coarse){
  [data-toantin-tool="equation_composer"] .ec-full-template-btn:hover,
  [data-toantin-tool="equation_composer"] .ec-full-command-btn:hover,
  [data-toantin-tool="equation_composer"] .ec-full-context-tab:hover{transform:none}
}
@media (prefers-reduced-motion:reduce){
  [data-toantin-tool="equation_composer"] .ec-full-template-btn,
  [data-toantin-tool="equation_composer"] .ec-full-command-btn,
  [data-toantin-tool="equation_composer"] .ec-full-context-tab,
  [data-toantin-tool="equation_composer"] .ec-full-primary-actions .btn{transition:none!important;transform:none!important}
}


/* Owner Fix 06A: Equation Composer owns contextual menus; hide MathLive's competing hamburger. */

/* Roadmap Fix Equation V1 — Phase 05: UI information architecture */
[data-toantin-tool="equation_composer"] .ec-context-bar{
  justify-content:space-between;
  gap:10px;
  overflow:visible;
  min-height:46px;
}
[data-toantin-tool="equation_composer"] .ec-context-actions{
  display:flex;
  align-items:center;
  gap:5px;
  min-width:0;
  flex:1 1 auto;
  overflow-x:auto;
  scrollbar-width:thin;
}
[data-toantin-tool="equation_composer"] .ec-context-idle{
  color:var(--ec-muted);
  font-size:.78rem;
  padding:0 4px;
  white-space:nowrap;
}
[data-toantin-tool="equation_composer"] .ec-editor-utility-group{
  display:flex;
  align-items:center;
  gap:5px;
  flex:0 0 auto;
  margin-left:auto;
  padding-left:8px;
  border-left:1px solid var(--ec-border);
}
[data-toantin-tool="equation_composer"] .ec-editor-utility-btn{
  width:38px;
  height:36px;
  padding:0;
  border:1px solid #dfe8f5;
  border-radius:9px;
  background:#fff;
  color:#304a6d;
}
[data-toantin-tool="equation_composer"] .ec-editor-utility-btn:hover,
[data-toantin-tool="equation_composer"] .ec-editor-utility-btn.active,
[data-toantin-tool="equation_composer"] .ec-editor-utility-btn[aria-expanded="true"]{
  background:#eaf3ff;
  border-color:#a9c9f4;
  color:var(--ec-primary);
}
[data-toantin-tool="equation_composer"] .ec-topbar{gap:5px!important;}
[data-toantin-tool="equation_composer"] .ec-strip-wrap{padding-top:6px;padding-bottom:6px;}
[data-toantin-tool="equation_composer"] .ec-full-commandbar{align-items:center;}
[data-toantin-tool="equation_composer"] .ec-full-command-utility{flex:0 0 auto;}
[data-toantin-tool="equation_composer"] .ec-full-quick-strip{flex:1 1 auto;min-width:0;}
@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"] .ec-context-bar{gap:6px;padding:6px;}
  [data-toantin-tool="equation_composer"] .ec-context-idle{display:none;}
  [data-toantin-tool="equation_composer"] .ec-editor-utility-group{padding-left:6px;}
  [data-toantin-tool="equation_composer"] .ec-editor-utility-btn{width:42px;height:42px;}
}


/* Roadmap Fix Equation V1 — Phase 06: Toolbar / Palette Density & Floating UX
   Desktop preserves current clarity; tablet compacts visual density ~15–20%;
   mobile compacts visual/icon/padding ~30–35% while preserving usable hit areas. */
[data-toantin-tool="equation_composer"] .ec-category-tabs{
  gap:2px;
  padding:6px 7px;
}
[data-toantin-tool="equation_composer"] .ec-template-panel{padding:8px;}
[data-toantin-tool="equation_composer"] .ec-template-grid{
  grid-template-columns:repeat(auto-fill,minmax(52px,1fr));
  gap:5px;
}
[data-toantin-tool="equation_composer"] .ec-template-grid .ec-icon-btn{
  height:50px;
  padding:3px;
}
[data-toantin-tool="equation_composer"] .ec-template-grid .ec-math-preview-svg{
  width:56px;
  height:34px;
}
[data-toantin-tool="equation_composer"] .ec-favorites{
  overflow:hidden;
  scrollbar-width:none;
}
[data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn:nth-child(n+9){display:none;}
[data-toantin-tool="equation_composer"] .ec-strip-wrap{
  padding-inline:8px;
}
[data-toantin-tool="equation_composer"] .ec-full-quick-strip{
  gap:4px;
  overflow:hidden;
}
[data-toantin-tool="equation_composer"] .ec-full-quick-strip .ec-full-template-btn:nth-child(n+9){display:none;}

@media (min-width:768px) and (max-width:1199.98px){
  [data-toantin-tool="equation_composer"] .ec-category-tabs{padding:5px 6px;}
  [data-toantin-tool="equation_composer"] .ec-category-btn{
    width:34px;
    height:34px;
    border-radius:8px;
    font-size:.88rem;
  }
  [data-toantin-tool="equation_composer"] .ec-template-panel{padding:7px;}
  [data-toantin-tool="equation_composer"] .ec-template-grid{
    grid-template-columns:repeat(auto-fill,minmax(46px,1fr));
    gap:4px;
  }
  [data-toantin-tool="equation_composer"] .ec-template-grid .ec-icon-btn{
    height:46px;
    min-height:46px;
    padding:2px;
    border-radius:9px;
  }
  [data-toantin-tool="equation_composer"] .ec-template-grid .ec-math-preview-svg{
    width:48px;
    height:29px;
  }
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn:nth-child(n+7){display:none;}
  [data-toantin-tool="equation_composer"] .ec-full-quick-strip .ec-full-template-btn:nth-child(n+7){display:none;}
  [data-toantin-tool="equation_composer"] .ec-full-template-btn{
    width:42px;
    height:40px;
    flex-basis:42px;
  }
  [data-toantin-tool="equation_composer"] .ec-full-template-btn .ec-math-preview-svg{
    max-width:35px;
    max-height:26px;
  }
}

@media (max-width:767.98px){
  [data-toantin-tool="equation_composer"] .ec-strip-wrap{
    padding:5px 6px;
  }
  [data-toantin-tool="equation_composer"] .ec-category-tabs{
    gap:1px;
    padding:4px 5px;
  }
  [data-toantin-tool="equation_composer"] .ec-category-btn{
    width:44px;
    height:44px;
    border-radius:8px;
    font-size:.84rem;
  }
  [data-toantin-tool="equation_composer"] .ec-template-panel{padding:5px;}
  [data-toantin-tool="equation_composer"] .ec-template-grid{
    grid-template-columns:repeat(5,minmax(44px,1fr));
    gap:3px;
  }
  [data-toantin-tool="equation_composer"] .ec-template-grid .ec-icon-btn{
    min-height:44px;
    height:44px;
    padding:1px;
    border-radius:8px;
  }
  [data-toantin-tool="equation_composer"] .ec-template-grid .ec-math-preview-svg{
    width:40px;
    height:25px;
  }
  [data-toantin-tool="equation_composer"] .ec-template-grid .ec-math-icon{
    font-size:.98rem;
  }
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn:nth-child(n+5){display:none;}
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn{
    min-width:44px;
    width:44px;
    height:44px;
    padding:0 3px;
  }
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-math-preview-svg{
    width:36px;
    height:23px;
  }
  [data-toantin-tool="equation_composer"] .ec-full-quick-strip .ec-full-template-btn:nth-child(n+5){display:none;}
  [data-toantin-tool="equation_composer"] .ec-full-template-btn{
    width:44px;
    height:44px;
    flex-basis:44px;
    padding:1px;
  }
  [data-toantin-tool="equation_composer"] .ec-full-template-btn .ec-math-preview-svg{
    max-width:32px;
    max-height:23px;
  }
}
@media (max-width:390px){
  [data-toantin-tool="equation_composer"] .ec-template-grid{
    grid-template-columns:repeat(4,minmax(44px,1fr));
  }
}
@media (pointer:coarse){
  [data-toantin-tool="equation_composer"] .ec-template-grid .ec-icon-btn,
  [data-toantin-tool="equation_composer"] .ec-category-btn,
  [data-toantin-tool="equation_composer"] .ec-full-template-btn{
    min-width:44px;
    min-height:44px;
  }
}

/* Roadmap Fix Equation V1 — Phase 07: Full Tool Visual Excellence
   Production-facing polish only; no new Core/state/persistence. */
[data-toantin-tool="equation_composer"] .ec-full-tool-v11{
  --ec-p07-surface:#ffffff;
  --ec-p07-surface-soft:#f8fbff;
  --ec-p07-border:#e3ebf5;
  --ec-p07-border-strong:#cbdcf0;
  --ec-p07-text:#10213e;
  --ec-p07-muted:#667892;
  --ec-p07-shadow:0 8px 24px rgba(15,31,75,.055);
  --ec-p07-shadow-focus:0 0 0 3px rgba(13,91,239,.14);
  background:linear-gradient(180deg,#f8fbff 0,#f4f8fd 100%);
}
[data-toantin-tool="equation_composer"] .ec-full-appbar{
  grid-template-columns:minmax(230px,1fr) auto auto;
  gap:12px;
  padding:12px 14px;
  border-bottom:1px solid var(--ec-p07-border);
  background:rgba(255,255,255,.96);
  box-shadow:0 1px 0 rgba(255,255,255,.8);
}
[data-toantin-tool="equation_composer"] .ec-full-brand{gap:9px}
[data-toantin-tool="equation_composer"] .ec-full-brand-mark{
  width:38px;height:38px;border-radius:11px;
  box-shadow:0 6px 16px rgba(13,91,239,.15);
}
[data-toantin-tool="equation_composer"] .ec-full-brand h2{font-size:1rem;color:var(--ec-p07-text)}
[data-toantin-tool="equation_composer"] .ec-full-brand p{font-size:.74rem;color:var(--ec-p07-muted)}
[data-toantin-tool="equation_composer"] .ec-full-header-status{gap:5px}
[data-toantin-tool="equation_composer"] .ec-full-status-pill{
  min-height:26px;padding:2px 7px;border-color:var(--ec-p07-border);background:#fbfdff;
}
[data-toantin-tool="equation_composer"] .ec-full-primary-actions{gap:5px}
[data-toantin-tool="equation_composer"] .ec-full-primary-actions .btn{
  min-height:36px;border-radius:9px;font-weight:600;
}
[data-toantin-tool="equation_composer"] .ec-full-insert{box-shadow:0 5px 12px rgba(13,91,239,.14)}
[data-toantin-tool="equation_composer"] .ec-full-commandbar{
  gap:8px;padding:7px 10px;border-bottom:1px solid var(--ec-p07-border);background:#fbfdff;
}
[data-toantin-tool="equation_composer"] .ec-full-command-utility{gap:3px;padding-right:8px;border-right-color:var(--ec-p07-border)}
[data-toantin-tool="equation_composer"] .ec-full-command-btn{
  width:36px;height:36px;border:1px solid transparent;background:transparent;color:#405877;
}
[data-toantin-tool="equation_composer"] .ec-full-command-btn:hover{
  background:#edf5ff;border-color:#d2e3f8;color:#0d5bef;
}
[data-toantin-tool="equation_composer"] .ec-full-workspace-v11{
  grid-template-columns:minmax(0,1fr) minmax(270px,320px);
  gap:10px;padding:10px;min-height:450px;
}
[data-toantin-tool="equation_composer"] .ec-full-editor-stage{gap:8px}
[data-toantin-tool="equation_composer"] .ec-full-section,
[data-toantin-tool="equation_composer"] .ec-full-context{
  border-color:var(--ec-p07-border);
  border-radius:14px;
  box-shadow:var(--ec-p07-shadow);
}
[data-toantin-tool="equation_composer"] .ec-full-section-head{
  padding:10px 12px;border-bottom-color:var(--ec-p07-border);background:#fff;
}
[data-toantin-tool="equation_composer"] .ec-full-section-head h3{font-size:.88rem;color:var(--ec-p07-text)}
[data-toantin-tool="equation_composer"] .ec-full-section-head p{font-size:.73rem;color:var(--ec-p07-muted)}
[data-toantin-tool="equation_composer"] .ec-full-section-body{padding:12px}
[data-toantin-tool="equation_composer"] .ec-full-stage-canvas{
  min-height:286px;
  padding:24px 22px 42px;
  border-color:var(--ec-p07-border-strong);
  background:radial-gradient(circle at 50% 12%,#fff 0,#fbfdff 58%,#f7faff 100%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.95);
}
[data-toantin-tool="equation_composer"] .ec-full-stage-canvas:focus-within{
  border-color:#82b2ed;box-shadow:var(--ec-p07-shadow-focus),inset 0 1px 0 #fff;
}
[data-toantin-tool="equation_composer"] .ec-full-stage-formula{color:#111d34}
[data-toantin-tool="equation_composer"] .ec-full-stage-hint{
  bottom:12px;padding:5px 9px;background:transparent;color:#8391a5;font-size:.7rem;
}
[data-toantin-tool="equation_composer"] .ec-full-editor-footer{padding:0 1px;gap:8px}
[data-toantin-tool="equation_composer"] .ec-full-context-tabs{
  gap:1px;padding:6px;border-bottom-color:var(--ec-p07-border);background:#f8fbff;
}
[data-toantin-tool="equation_composer"] .ec-full-context-tab{
  min-height:34px;padding:.3rem .5rem;color:#60748f;border-radius:8px;
}
[data-toantin-tool="equation_composer"] .ec-full-context-tab:hover{background:#eef5ff;color:#214e88}
[data-toantin-tool="equation_composer"] .ec-full-context-tab.active{
  background:#fff;border-color:#c8daf0;color:#0d5bef;box-shadow:0 1px 3px rgba(15,31,75,.05);
}
[data-toantin-tool="equation_composer"] .ec-full-context-panel{padding:12px}
[data-toantin-tool="equation_composer"] .ec-full-context-hint,
[data-toantin-tool="equation_composer"] .ec-full-panel-lead span{color:var(--ec-p07-muted)}
[data-toantin-tool="equation_composer"] .ec-full-empty-mini{
  padding:18px 12px;border:1px dashed #d7e3f1;border-radius:10px;background:#fbfdff;color:#75869d;text-align:center;
}
[data-toantin-tool="equation_composer"] .ec-full-diagnostic-result:empty{display:none}
[data-toantin-tool="equation_composer"] .ec-full-statusbar{
  min-height:34px;padding:7px 12px;border-top:1px solid var(--ec-p07-border);background:#fbfdff;color:#708198;font-size:.7rem;
}
[data-toantin-tool="equation_composer"] .ec-full-template-btn{
  border-color:#e1eaf5;box-shadow:0 1px 2px rgba(15,31,75,.025);
}
[data-toantin-tool="equation_composer"] .ec-full-template-btn:hover{
  background:#f4f8ff;border-color:#9fc4f2;box-shadow:0 3px 10px rgba(13,91,239,.08);transform:translateY(-1px);
}
[data-toantin-tool="equation_composer"] .ec-full-template-btn:active{transform:translateY(0) scale(.98);box-shadow:none}
[data-toantin-tool="equation_composer"] .ec-full-tool-v11 button:disabled{opacity:.48;cursor:not-allowed;box-shadow:none!important;transform:none!important}
[data-toantin-tool="equation_composer"] .ec-full-tool-v11 .btn-light{background:#fff;border-color:#e1eaf5;color:#405877}
[data-toantin-tool="equation_composer"] .ec-full-tool-v11 .btn-light:hover{background:#f3f7fc;border-color:#cbdcf0;color:#244b7d}
[data-toantin-tool="equation_composer"] .ec-full-tool-v11 .btn:focus-visible{outline:0;box-shadow:var(--ec-p07-shadow-focus)}


@media (prefers-reduced-motion:reduce){
  [data-toantin-tool="equation_composer"] .ec-full-tool-v11 *,
  [data-toantin-tool="equation_composer"] .ec-full-tool-v11 *::before,
  [data-toantin-tool="equation_composer"] .ec-full-tool-v11 *::after{scroll-behavior:auto!important}
}


/* Roadmap Fix Equation V1 — Phase 08: Responsive / Touch / LCD Rebuild
   Device-quality pass: 360/390, tablet, desktop, 1920/fullscreen, coarse-pointer LCD.
   Visual density scales without shrinking usable touch hit areas. */
[data-toantin-tool="equation_composer"]{
  --ec-safe-bottom:env(safe-area-inset-bottom,0px);
  --ec-safe-left:env(safe-area-inset-left,0px);
  --ec-safe-right:env(safe-area-inset-right,0px);
}
[data-toantin-tool="equation_composer"] .ec-shell,
[data-toantin-tool="equation_composer"] .ec-workspace,
[data-toantin-tool="equation_composer"] .ec-edit-area,
[data-toantin-tool="equation_composer"] .ec-palette,
[data-toantin-tool="equation_composer"] .ec-full-tool-v11,
[data-toantin-tool="equation_composer"] .ec-full-workspace-v11{min-width:0;max-width:100%;}
[data-toantin-tool="equation_composer"] .ec-category-tabs,
[data-toantin-tool="equation_composer"] .ec-favorites,
[data-toantin-tool="equation_composer"] .ec-full-quick-strip,
[data-toantin-tool="equation_composer"] .ec-full-context-tabs{
  overscroll-behavior-inline:contain;
  -webkit-overflow-scrolling:touch;
}
[data-toantin-tool="equation_composer"] button,
[data-toantin-tool="equation_composer"] [role="button"]{touch-action:manipulation;}
[data-toantin-tool="equation_composer"] .ec-vk-v2{
  max-width:calc(100% - var(--ec-safe-left) - var(--ec-safe-right));
  overscroll-behavior:contain;
}
[data-toantin-tool="equation_composer"] .ec-vk-v2[data-placement="floating"]{
  bottom:calc(16px + var(--ec-safe-bottom));
}

/* Tablet portrait/landscape: target ~15–20% visual compaction while preserving hierarchy. */
@media (min-width:768px) and (max-width:1199.98px){
  [data-toantin-tool="equation_composer"] .ec-workspace{grid-template-columns:minmax(238px,31%) minmax(0,1fr);min-height:350px;}
  [data-toantin-tool="equation_composer"] .ec-edit-area{padding:14px;}
  [data-toantin-tool="equation_composer"] .ec-editor-canvas{min-height:215px;padding:13px;}
  [data-toantin-tool="equation_composer"] .ec-a2-editor-fallback,
  [data-toantin-tool="equation_composer"] .ec-mathfield{min-height:132px;padding:12px;font-size:clamp(1.25rem,2.25vw,1.75rem);}
  [data-toantin-tool="equation_composer"] .ec-context-bar{padding:6px 7px;gap:6px;}
  [data-toantin-tool="equation_composer"] .ec-editor-utility-btn{width:34px;height:34px;}
  [data-toantin-tool="equation_composer"] .ec-full-appbar{padding:10px 12px;gap:9px;}
  [data-toantin-tool="equation_composer"] .ec-full-commandbar{padding:6px 8px;gap:6px;}
  [data-toantin-tool="equation_composer"] .ec-full-workspace-v11{padding:8px;gap:8px;}
  [data-toantin-tool="equation_composer"] .ec-full-stage-canvas{min-height:250px;padding:18px 16px 34px;}
  [data-toantin-tool="equation_composer"] .ec-full-context-panel{max-height:300px;}
  [data-toantin-tool="equation_composer"] .ec-vk-grid{grid-template-columns:repeat(auto-fit,minmax(54px,1fr));gap:.35rem;padding:.45rem;}
  [data-toantin-tool="equation_composer"] .ec-vk-key{min-height:46px;}
}

/* Mobile: compact visual footprint ~30–35%, keep usable hit targets and avoid viewport breakage. */
@media (max-width:767.98px){
  [data-toantin-tool="equation_composer"]{border-left:0;border-right:0;border-radius:10px;}
  [data-toantin-tool="equation_composer"] .ec-topbar{min-height:46px;padding:5px 6px;flex-wrap:nowrap!important;overflow-x:auto;scrollbar-width:none;}
  [data-toantin-tool="equation_composer"] .ec-topbar::-webkit-scrollbar{display:none;}
  [data-toantin-tool="equation_composer"] .ec-action-btn{width:44px;height:44px;min-width:44px;}
  [data-toantin-tool="equation_composer"] .ec-strip-wrap{padding:4px 6px;}
  [data-toantin-tool="equation_composer"] .ec-section-label{font-size:.61rem;margin-bottom:3px;}
  [data-toantin-tool="equation_composer"] .ec-workspace{grid-template-columns:1fr;min-height:0;}
  [data-toantin-tool="equation_composer"] .ec-palette{max-height:42vh;overflow:auto;}
  [data-toantin-tool="equation_composer"] .ec-category-tabs{position:sticky;top:0;z-index:4;background:#fbfdff;}
  [data-toantin-tool="equation_composer"] .ec-template-panel{padding:5px 5px 7px;}
  [data-toantin-tool="equation_composer"] .ec-edit-area{padding:8px 7px calc(8px + var(--ec-safe-bottom));}
  [data-toantin-tool="equation_composer"] .ec-editor-heading{margin-bottom:6px;gap:6px!important;}
  [data-toantin-tool="equation_composer"] .ec-editor-heading small{display:none;}
  [data-toantin-tool="equation_composer"] .ec-editor-controls{gap:3px!important;}
  [data-toantin-tool="equation_composer"] .ec-profile-select{min-width:0;max-width:none;}
  [data-toantin-tool="equation_composer"] .ec-context-bar{min-height:48px;padding:3px 4px;gap:4px;}
  [data-toantin-tool="equation_composer"] .ec-context-actions{min-width:0;overflow-x:auto;scrollbar-width:none;}
  [data-toantin-tool="equation_composer"] .ec-editor-utility-group{padding-left:4px;gap:3px;}
  [data-toantin-tool="equation_composer"] .ec-editor-utility-btn{width:44px;height:44px;min-width:44px;}
  [data-toantin-tool="equation_composer"] .ec-editor-canvas{min-height:178px;padding:6px;border-radius:11px;scroll-margin-bottom:48vh;}
  [data-toantin-tool="equation_composer"] .ec-a2-editor-fallback,
  [data-toantin-tool="equation_composer"] .ec-mathfield{min-height:132px;padding:8px;font-size:clamp(1.18rem,5.4vw,1.55rem);line-height:1.5;}
  [data-toantin-tool="equation_composer"] .ec-full-appbar{padding:8px 8px 7px;gap:7px;}
  [data-toantin-tool="equation_composer"] .ec-full-brand-mark{width:34px;height:34px;}
  [data-toantin-tool="equation_composer"] .ec-full-brand h2{font-size:.92rem;}
  [data-toantin-tool="equation_composer"] .ec-full-commandbar{padding:5px 6px;gap:5px;}
  [data-toantin-tool="equation_composer"] .ec-full-command-btn{width:44px;height:44px;}
  [data-toantin-tool="equation_composer"] .ec-full-workspace-v11{padding:6px;gap:6px;}
  [data-toantin-tool="equation_composer"] .ec-full-section-head{padding:8px 9px;}
  [data-toantin-tool="equation_composer"] .ec-full-section-body{padding:7px;}
  [data-toantin-tool="equation_composer"] .ec-full-stage-canvas{min-height:190px;padding:12px 9px 32px;scroll-margin-bottom:48vh;}
  [data-toantin-tool="equation_composer"] .ec-full-stage-hint{bottom:7px;max-width:calc(100% - 14px);overflow:hidden;text-overflow:ellipsis;}
  [data-toantin-tool="equation_composer"] .ec-full-context{border-radius:11px;}
  [data-toantin-tool="equation_composer"] .ec-full-context-tabs{padding:4px;gap:1px;}
  [data-toantin-tool="equation_composer"] .ec-full-context-tab{min-height:44px;padding:.3rem .48rem;}
  [data-toantin-tool="equation_composer"] .ec-full-context-panel{padding:8px;max-height:42vh;}
  [data-toantin-tool="equation_composer"] .ec-full-statusbar{padding:6px 8px;font-size:.64rem;}
  [data-toantin-tool="equation_composer"] .ec-vk-v2{margin:0;border-radius:12px 12px 0 0;padding-bottom:var(--ec-safe-bottom);}
  [data-toantin-tool="equation_composer"] .ec-vk-v2[data-placement="floating"]{left:6px!important;right:6px!important;bottom:calc(6px + var(--ec-safe-bottom));width:auto;max-height:min(44dvh,330px);}
  [data-toantin-tool="equation_composer"] .ec-vk-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:.3rem;padding:.38rem;max-height:min(34dvh,255px);}
  [data-toantin-tool="equation_composer"] .ec-vk-key{min-width:44px;min-height:44px;padding:.2rem;}
}

@media (max-width:390px){
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn{width:44px;min-width:44px;height:44px;}
  [data-toantin-tool="equation_composer"] .ec-template-grid{grid-template-columns:repeat(4,minmax(44px,1fr));gap:3px;}
  [data-toantin-tool="equation_composer"] .ec-template-grid .ec-icon-btn{height:44px;min-height:44px;}
  [data-toantin-tool="equation_composer"] .ec-template-grid .ec-math-preview-svg{width:38px;height:23px;}
  [data-toantin-tool="equation_composer"] .ec-full-primary-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;width:100%;}
  [data-toantin-tool="equation_composer"] .ec-full-primary-actions .btn{min-width:0;width:100%;padding-inline:.35rem;}
  [data-toantin-tool="equation_composer"] .ec-full-stage-canvas{min-height:178px;}
}

@media (max-width:360px){
  [data-toantin-tool="equation_composer"] .ec-template-grid{grid-template-columns:repeat(4,minmax(42px,1fr));}
  [data-toantin-tool="equation_composer"] .ec-full-brand p{display:none;}
  [data-toantin-tool="equation_composer"] .ec-full-context-actions{grid-template-columns:1fr;}
  [data-toantin-tool="equation_composer"] .ec-full-statusbar span:first-child{display:none;}
}

/* Large desktop / fullscreen: use space without bloating controls. */
@media (min-width:1600px){
  [data-toantin-tool="equation_composer"] .ec-workspace{grid-template-columns:minmax(320px,32%) minmax(0,1fr);min-height:470px;}
  [data-toantin-tool="equation_composer"] .ec-editor-canvas{min-height:350px;}
  [data-toantin-tool="equation_composer"] .ec-full-workspace-v11{grid-template-columns:minmax(0,1fr) minmax(330px,360px);max-width:1920px;margin-inline:auto;}
  [data-toantin-tool="equation_composer"] .ec-full-stage-canvas{min-height:400px;}
}

/* Touch LCD / projector: no hover dependency, stronger active state, larger physical targets. */
@media (min-width:1200px) and (pointer:coarse){
  [data-toantin-tool="equation_composer"] .ec-action-btn,
  [data-toantin-tool="equation_composer"] .ec-category-btn,
  [data-toantin-tool="equation_composer"] .ec-icon-btn,
  [data-toantin-tool="equation_composer"] .ec-context-btn,
  [data-toantin-tool="equation_composer"] .ec-editor-utility-btn,
  [data-toantin-tool="equation_composer"] .ec-full-command-btn,
  [data-toantin-tool="equation_composer"] .ec-full-template-btn,
  [data-toantin-tool="equation_composer"] .ec-vk-key{min-width:52px;min-height:52px;}
  [data-toantin-tool="equation_composer"] .ec-template-grid{grid-template-columns:repeat(auto-fill,minmax(62px,1fr));gap:7px;}
  [data-toantin-tool="equation_composer"] .ec-full-context-tab{min-height:50px;font-size:.92rem;}
  [data-toantin-tool="equation_composer"] .ec-full-primary-actions .btn{min-height:50px;font-size:.95rem;}
  [data-toantin-tool="equation_composer"] .ec-icon-btn:active,
  [data-toantin-tool="equation_composer"] .ec-category-btn:active,
  [data-toantin-tool="equation_composer"] .ec-vk-key:active,
  [data-toantin-tool="equation_composer"] .ec-full-template-btn:active{background:#dcecff;border-color:#7cace8;color:#0b4fcf;box-shadow:inset 0 0 0 2px rgba(13,91,239,.13);}
  [data-toantin-tool="equation_composer"] .ec-full-stage-formula{font-size:clamp(2rem,3.2vw,3.15rem);}
}

@media (hover:none){
  [data-toantin-tool="equation_composer"] .ec-icon-btn:hover,
  [data-toantin-tool="equation_composer"] .ec-category-btn:hover,
  [data-toantin-tool="equation_composer"] .ec-full-template-btn:hover,
  [data-toantin-tool="equation_composer"] .ec-vk-key:hover{transform:none;box-shadow:none;}
}

/* V1.1 OP01 — editor ownership / Full Tool recovery */
[data-toantin-tool="equation_composer"] math-field::part(menu-toggle){display:none}
[data-toantin-tool="equation_composer"] .ec-editor-detached-placeholder{
  min-height:148px;display:flex;align-items:center;justify-content:center;text-align:center;
  border:1px dashed #c9d9ec;border-radius:12px;background:#f8fbff;color:#60738d;
  font-size:.86rem;padding:1rem;
}
[data-toantin-tool="equation_composer"] .ec-full-editor-mount{
  display:flex;align-items:stretch;min-height:190px;padding:0;overflow:visible;background:#fff;
}
[data-toantin-tool="equation_composer"] .ec-full-editor-mount .ec-mathfield{
  width:100%;min-height:190px;border:0;border-radius:14px;padding:22px 24px;font-size:clamp(1.55rem,2.4vw,2.35rem);
  background:#fff;
}
[data-toantin-tool="equation_composer"] .ec-full-editor-mount .ec-mathfield:focus-within{
  outline:2px solid rgba(37,99,235,.18);outline-offset:-2px;
}
@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"] .ec-full-editor-mount,[data-toantin-tool="equation_composer"] .ec-full-editor-mount .ec-mathfield{min-height:150px}
  [data-toantin-tool="equation_composer"] .ec-full-editor-mount .ec-mathfield{padding:16px 14px;font-size:1.35rem}
}

/* V1.1 OP02 — UI Architecture & Branding */
[data-toantin-tool="equation_composer"] .ec-topbar{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:nowrap;
  min-width:0;
}
[data-toantin-tool="equation_composer"] .ec-toolbar-brand{
  display:inline-flex;
  align-items:center;
  gap:7px;
  flex:0 0 auto;
  min-width:0;
  color:#163b73;
  text-decoration:none;
  font-weight:800;
  font-size:.8rem;
  letter-spacing:.015em;
  padding-right:8px;
  border-right:1px solid var(--ec-border);
}
[data-toantin-tool="equation_composer"] .ec-toolbar-brand:hover{color:var(--ec-primary)}
[data-toantin-tool="equation_composer"] .ec-toolbar-brand-logo{
  width:30px;
  height:30px;
  object-fit:contain;
  display:block;
  border-radius:8px;
  flex:0 0 auto;
}
[data-toantin-tool="equation_composer"] .ec-global-actions{
  display:flex;
  align-items:center;
  gap:4px;
  min-width:0;
  flex:1 1 auto;
  overflow-x:auto;
  scrollbar-width:none;
  overscroll-behavior-inline:contain;
}
[data-toantin-tool="equation_composer"] .ec-global-actions::-webkit-scrollbar{display:none}
[data-toantin-tool="equation_composer"] .ec-home-btn{color:#1d4f91;text-decoration:none}
[data-toantin-tool="equation_composer"] .ec-home-btn:hover{color:var(--ec-primary)}
[data-toantin-tool="equation_composer"] .ec-full-brand-logo{
  object-fit:contain;
  background:transparent!important;
  box-shadow:none!important;
  padding:0;
}
[data-toantin-tool="equation_composer"] .ec-full-home{
  min-width:34px;
  padding-inline:.55rem;
  font-size:1rem;
  text-decoration:none;
}
[data-toantin-tool="equation_composer"] .ec-full-primary-actions{
  gap:5px;
}
[data-toantin-tool="equation_composer"] .ec-strip-wrap{
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:center;
  gap:8px;
}
[data-toantin-tool="equation_composer"] .ec-strip-wrap .ec-section-label{
  margin:0;
  white-space:nowrap;
}
[data-toantin-tool="equation_composer"] .ec-favorites{min-width:0}
[data-toantin-tool="equation_composer"] .ec-context-bar{
  background:linear-gradient(180deg,#fbfdff,#f7faff);
}
[data-toantin-tool="equation_composer"] .ec-context-actions:empty::before{
  content:"Sẵn sàng soạn công thức";
  color:var(--ec-muted);
  font-size:.78rem;
  padding-inline:4px;
}

@media (max-width:767.98px){
  [data-toantin-tool="equation_composer"] .ec-topbar{gap:5px!important}
  [data-toantin-tool="equation_composer"] .ec-toolbar-brand{padding-right:5px;gap:0}
  [data-toantin-tool="equation_composer"] .ec-toolbar-brand span{display:none}
  [data-toantin-tool="equation_composer"] .ec-toolbar-brand-logo{width:32px;height:32px;border-radius:8px}
  [data-toantin-tool="equation_composer"] .ec-global-actions{gap:3px}
  [data-toantin-tool="equation_composer"] .ec-strip-wrap{grid-template-columns:1fr;gap:3px}
  [data-toantin-tool="equation_composer"] .ec-strip-wrap .ec-section-label{display:none}
}
@media (max-width:390px){
  [data-toantin-tool="equation_composer"] .ec-toolbar-brand{display:none}
  [data-toantin-tool="equation_composer"] .ec-global-actions{width:100%}
}

/* V1.1 OP03 — Tool-owned editor utilities: suppress MathLive in-canvas toggles. */
[data-toantin-tool="equation_composer"] math-field::part(virtual-keyboard-toggle),
[data-toantin-tool="equation_composer"] math-field::part(keyboard-toggle){display:none!important}

/* V1.1 OP04 — dual keyboard utilities + dense matrix context */
[data-toantin-tool="equation_composer"] .ec-editor-utility-fullkbd .ec-math-icon{font-family:Georgia,"Times New Roman",serif;font-style:italic;font-weight:800}
[data-toantin-tool="equation_composer"] .ec-context-actions[data-context="matrix"]{display:flex;align-items:center;gap:4px;flex-wrap:wrap;min-width:0}
[data-toantin-tool="equation_composer"] .ec-context-actions[data-context="matrix"] .ec-context-btn{min-width:40px;padding-inline:8px}
@media(max-width:767.98px){[data-toantin-tool="equation_composer"] .ec-context-actions[data-context="matrix"]{max-width:calc(100% - 132px);overflow:auto;flex-wrap:nowrap;scrollbar-width:thin}[data-toantin-tool="equation_composer"] .ec-editor-utility-group{flex:0 0 auto}}

[data-toantin-tool="equation_composer"] .ec-matrix-fence-select{width:auto;min-width:104px}


/* V1.1 OP05 — keyboard micro-interactions */
[data-toantin-tool="equation_composer"] .ec-virtual-keyboard{
  opacity:0;
  transform:translateY(9px) scale(.985);
  transform-origin:center bottom;
  transition:opacity 180ms cubic-bezier(.2,.8,.2,1),transform 200ms cubic-bezier(.2,.8,.2,1),box-shadow 200ms ease;
  will-change:opacity,transform;
}
[data-toantin-tool="equation_composer"] .ec-virtual-keyboard.is-open{
  opacity:1;
  transform:translateY(0) scale(1);
}
[data-toantin-tool="equation_composer"] .ec-virtual-keyboard.is-closing{
  pointer-events:none;
  opacity:0;
  transform:translateY(7px) scale(.99);
}
[data-toantin-tool="equation_composer"] .ec-editor-utility-btn[aria-pressed="true"]{
  transform:translateY(-1px);
  box-shadow:0 5px 14px rgba(37,99,235,.12);
}
@media (prefers-reduced-motion: reduce){
  [data-toantin-tool="equation_composer"] .ec-virtual-keyboard,
  [data-toantin-tool="equation_composer"] .ec-editor-utility-btn{
    transition:none!important;
    animation:none!important;
    transform:none!important;
  }
}


/* V1.1 OP07 — discovery/search polish for the expanded 400+ item catalog. */
[data-toantin-tool="equation_composer"] .ec-discovery-featured{
  display:flex;flex-wrap:wrap;gap:6px;margin:8px 0 10px;
}
[data-toantin-tool="equation_composer"] .ec-discovery-featured[hidden]{display:none!important}
[data-toantin-tool="equation_composer"] .ec-discovery-chip{
  border:1px solid rgba(37,99,235,.16);background:#f8fbff;color:#17335f;border-radius:999px;
  min-height:30px;padding:4px 10px;font:700 12px/1.15 system-ui,sans-serif;cursor:pointer;
  transition:background .14s ease,border-color .14s ease,transform .14s ease,box-shadow .14s ease;
}
[data-toantin-tool="equation_composer"] .ec-discovery-chip:hover{
  background:#eef6ff;border-color:rgba(37,99,235,.3);transform:translateY(-1px);box-shadow:0 4px 10px rgba(37,99,235,.08)
}
[data-toantin-tool="equation_composer"] .ec-discovery-chip:focus-visible{outline:3px solid rgba(37,99,235,.18);outline-offset:2px}
@media(prefers-reduced-motion:reduce){[data-toantin-tool="equation_composer"] .ec-discovery-chip{transition:none;transform:none!important}}

/* V1.1 OP08 — responsive/touch/LCD qualification retained; OP09 removed the obsolete red full-keyboard close overlay. */
@media (max-width:390px){
  [data-toantin-tool="equation_composer"] .ec-discovery-featured{gap:4px}
  [data-toantin-tool="equation_composer"] .ec-discovery-chip{min-height:28px;padding:3px 8px;font-size:11px}
}

/* ========================================================================== 
   V2.0.1 / B01 — Unified Toolbar Architecture + 3D-lite Visual Foundation
   Scope: TB-P01/P02/P04/P05/P10/P11. Math preview drawing itself is B02.
   ========================================================================== */
[data-toantin-tool="equation_composer"]{
  --ec-ui-icon-size:22px;
  --ec-ui-button-size:40px;
  --ec-ui-button-radius:11px;
  --ec-ui-button-gap:4px;
  --ec-ui-border:#cdddf1;
  --ec-ui-border-strong:#a9c7ee;
  --ec-ui-surface-top:#ffffff;
  --ec-ui-surface-bottom:#f1f6fd;
  --ec-ui-shadow:0 2px 5px rgba(25,62,112,.12),inset 0 1px 0 rgba(255,255,255,.96),inset 0 -1px 0 rgba(136,165,205,.10);
  --ec-ui-shadow-hover:0 5px 12px rgba(28,78,150,.16),inset 0 1px 0 #fff;
  --ec-ui-shadow-pressed:0 1px 2px rgba(25,62,112,.13),inset 0 2px 4px rgba(33,91,174,.11);
  --ec-ui-active-top:#2f83f7;
  --ec-ui-active-bottom:#0d5bef;
  --ec-ui-active-text:#fff;
  --ec-ui-transition:150ms ease;
}
[data-toantin-tool="equation_composer"] .ec-shell{position:relative;}
[data-toantin-tool="equation_composer"] .ec-ui-icon{display:block;width:var(--ec-ui-icon-size);height:var(--ec-ui-icon-size);overflow:visible;pointer-events:none;}
[data-toantin-tool="equation_composer"] .ec-ui-icon-text{font-family:var(--toantin-font,Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif);}

[data-toantin-tool="equation_composer"] .ec-action-btn,
[data-toantin-tool="equation_composer"] .ec-category-btn,
[data-toantin-tool="equation_composer"] .ec-zoom-btn,
[data-toantin-tool="equation_composer"] .ec-fit-btn,
[data-toantin-tool="equation_composer"] .ec-help-toggle,
[data-toantin-tool="equation_composer"] .ec-more-toggle,
[data-toantin-tool="equation_composer"] .ec-editor-utility-btn,
[data-toantin-tool="equation_composer"] .ec-context-btn,
[data-toantin-tool="equation_composer"] .ec-full-command-btn,
[data-toantin-tool="equation_composer"] .ec-full-fit-btn,
[data-toantin-tool="equation_composer"] .ec-icon-btn{
  border:1px solid var(--ec-ui-border);
  background:linear-gradient(180deg,var(--ec-ui-surface-top),var(--ec-ui-surface-bottom));
  box-shadow:var(--ec-ui-shadow);
  color:#183f75;
  transition:transform var(--ec-ui-transition),box-shadow var(--ec-ui-transition),border-color var(--ec-ui-transition),background var(--ec-ui-transition),color var(--ec-ui-transition);
}
[data-toantin-tool="equation_composer"] .ec-action-btn,
[data-toantin-tool="equation_composer"] .ec-category-btn,
[data-toantin-tool="equation_composer"] .ec-zoom-btn,
[data-toantin-tool="equation_composer"] .ec-fit-btn,
[data-toantin-tool="equation_composer"] .ec-help-toggle,
[data-toantin-tool="equation_composer"] .ec-more-toggle,
[data-toantin-tool="equation_composer"] .ec-full-command-btn{
  width:var(--ec-ui-button-size);height:var(--ec-ui-button-size);min-width:var(--ec-ui-button-size);padding:0;border-radius:var(--ec-ui-button-radius);
  display:inline-grid;place-items:center;
}
[data-toantin-tool="equation_composer"] .ec-action-btn:hover,
[data-toantin-tool="equation_composer"] .ec-category-btn:hover,
[data-toantin-tool="equation_composer"] .ec-zoom-btn:hover,
[data-toantin-tool="equation_composer"] .ec-fit-btn:hover,
[data-toantin-tool="equation_composer"] .ec-help-toggle:hover,
[data-toantin-tool="equation_composer"] .ec-more-toggle:hover,
[data-toantin-tool="equation_composer"] .ec-editor-utility-btn:hover,
[data-toantin-tool="equation_composer"] .ec-context-btn:hover,
[data-toantin-tool="equation_composer"] .ec-full-command-btn:hover,
[data-toantin-tool="equation_composer"] .ec-full-fit-btn:hover,
[data-toantin-tool="equation_composer"] .ec-icon-btn:hover{
  transform:translateY(-1px);border-color:var(--ec-ui-border-strong);box-shadow:var(--ec-ui-shadow-hover);background:linear-gradient(180deg,#fff,#eaf3ff);color:var(--ec-primary);
}
[data-toantin-tool="equation_composer"] .ec-action-btn:active,
[data-toantin-tool="equation_composer"] .ec-category-btn:active,
[data-toantin-tool="equation_composer"] .ec-zoom-btn:active,
[data-toantin-tool="equation_composer"] .ec-fit-btn:active,
[data-toantin-tool="equation_composer"] .ec-help-toggle:active,
[data-toantin-tool="equation_composer"] .ec-more-toggle:active,
[data-toantin-tool="equation_composer"] .ec-editor-utility-btn:active,
[data-toantin-tool="equation_composer"] .ec-context-btn:active,
[data-toantin-tool="equation_composer"] .ec-full-command-btn:active,
[data-toantin-tool="equation_composer"] .ec-full-fit-btn:active,
[data-toantin-tool="equation_composer"] .ec-icon-btn:active{
  transform:translateY(1px);box-shadow:var(--ec-ui-shadow-pressed);
}
[data-toantin-tool="equation_composer"] .ec-category-btn.active,
[data-toantin-tool="equation_composer"] .ec-mode-btn.active,
[data-toantin-tool="equation_composer"] .ec-editor-utility-btn.active,
[data-toantin-tool="equation_composer"] .ec-editor-utility-btn[aria-pressed="true"],
[data-toantin-tool="equation_composer"] .ec-full-command-btn[aria-pressed="true"]{
  color:var(--ec-ui-active-text);border-color:#0a51d9;background:linear-gradient(180deg,var(--ec-ui-active-top),var(--ec-ui-active-bottom));box-shadow:0 4px 10px rgba(13,91,239,.24),inset 0 1px 0 rgba(255,255,255,.35),inset 0 -2px 0 rgba(6,45,128,.22);
}
[data-toantin-tool="equation_composer"] .ec-category-btn.active{box-shadow:0 4px 10px rgba(13,91,239,.22),inset 0 1px 0 rgba(255,255,255,.32);}
[data-toantin-tool="equation_composer"] button:disabled{transform:none!important;box-shadow:none!important;opacity:.46;}

/* Keep mathematical content crisp and flat inside a raised control. */
[data-toantin-tool="equation_composer"] .ec-icon-btn.ec-has-math-preview .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-full-template-btn .ec-math-preview-svg{filter:none;transform:none;}
[data-toantin-tool="equation_composer"] .ec-template-grid .ec-icon-btn,
[data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn,
[data-toantin-tool="equation_composer"] .ec-full-template-btn{border-color:var(--ec-ui-border);box-shadow:var(--ec-ui-shadow);}

/* Unified primary toolbar: one entry point per action. */
[data-toantin-tool="equation_composer"] .ec-topbar{gap:8px;padding:7px 10px;overflow:visible;}
[data-toantin-tool="equation_composer"] .ec-global-actions{gap:var(--ec-ui-button-gap);overflow-x:auto;overflow-y:hidden;padding:2px 2px 4px;}
[data-toantin-tool="equation_composer"] .ec-zoom-controls{margin-left:auto;gap:var(--ec-ui-button-gap)!important;padding-left:8px;}
[data-toantin-tool="equation_composer"] .ec-zoom-label{height:var(--ec-ui-button-size);min-width:58px;border:1px solid var(--ec-ui-border);border-radius:var(--ec-ui-button-radius);background:#fff;box-shadow:inset 0 1px 2px rgba(19,52,94,.06);color:#0d5bef;font-weight:800;}
[data-toantin-tool="equation_composer"] .ec-help-toggle{border-radius:var(--ec-ui-button-radius);font-weight:700;background:linear-gradient(180deg,#fff,#eef5ff);}
[data-toantin-tool="equation_composer"] .ec-more-toggle[aria-expanded="true"]{color:var(--ec-ui-active-text);border-color:#0a51d9;background:linear-gradient(180deg,var(--ec-ui-active-top),var(--ec-ui-active-bottom));box-shadow:0 4px 10px rgba(13,91,239,.24),inset 0 1px 0 rgba(255,255,255,.35);}

[data-toantin-tool="equation_composer"] .ec-more-menu{position:absolute;z-index:45;top:58px;right:10px;width:min(280px,calc(100% - 20px));padding:6px;border:1px solid var(--ec-border);border-radius:13px;background:#fff;box-shadow:0 14px 30px rgba(15,31,75,.18);}
[data-toantin-tool="equation_composer"] .ec-more-menu[hidden]{display:none!important;}
[data-toantin-tool="equation_composer"] .ec-more-item{width:100%;min-height:42px;display:flex;align-items:center;gap:9px;justify-content:flex-start;border:0;background:transparent;color:#203e67;text-align:left;border-radius:9px;padding:7px 9px;box-shadow:none;}
[data-toantin-tool="equation_composer"] .ec-more-item:hover{background:#eef5ff;color:var(--ec-primary);}
[data-toantin-tool="equation_composer"] .ec-more-item-icon{width:24px;height:24px;display:grid;place-items:center;flex:0 0 24px;}
[data-toantin-tool="equation_composer"] .ec-more-item .ec-ui-icon{width:20px;height:20px;}

/* Category semantics: larger optical icon, identical button shell. */
[data-toantin-tool="equation_composer"] .ec-category-tabs{gap:5px;padding:7px 9px;background:linear-gradient(180deg,#fff,#f8fbff);}
[data-toantin-tool="equation_composer"] .ec-category-btn{width:42px;height:42px;min-width:42px;border-radius:11px;}
[data-toantin-tool="equation_composer"] .ec-category-btn .ec-ui-icon{width:21px;height:21px;}

/* Full Tool command strip receives the same optical language. */
[data-toantin-tool="equation_composer"] .ec-full-commandbar{align-items:center;}
[data-toantin-tool="equation_composer"] .ec-full-command-btn{width:38px;height:38px;min-width:38px;border-radius:10px;}
[data-toantin-tool="equation_composer"] .ec-full-home{display:inline-grid;place-items:center;}
[data-toantin-tool="equation_composer"] .ec-full-home .ec-ui-icon{width:20px;height:20px;}

@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"]{--ec-ui-button-size:44px;--ec-ui-icon-size:23px;}
  [data-toantin-tool="equation_composer"] .ec-topbar{flex-wrap:wrap;}
  [data-toantin-tool="equation_composer"] .ec-global-actions{order:2;width:100%;flex-basis:100%;}
  [data-toantin-tool="equation_composer"] .ec-zoom-controls{order:3;margin-left:0;width:auto;flex:1 1 auto;padding:.4rem 0 0;border-left:0;border-top:1px solid var(--ec-border);justify-content:flex-start;}
  [data-toantin-tool="equation_composer"] .ec-help-toggle,[data-toantin-tool="equation_composer"] .ec-more-toggle{order:3;margin-top:.4rem;}
  [data-toantin-tool="equation_composer"] .ec-more-menu{top:112px;right:8px;}
}
@media(max-width:390px){
  [data-toantin-tool="equation_composer"] .ec-global-actions{gap:3px;}
  [data-toantin-tool="equation_composer"] .ec-zoom-label{min-width:54px;}
  [data-toantin-tool="equation_composer"] .ec-more-menu{top:108px;}
}
@media(hover:none){
  [data-toantin-tool="equation_composer"] .ec-action-btn:hover,
  [data-toantin-tool="equation_composer"] .ec-category-btn:hover,
  [data-toantin-tool="equation_composer"] .ec-zoom-btn:hover,
  [data-toantin-tool="equation_composer"] .ec-fit-btn:hover,
  [data-toantin-tool="equation_composer"] .ec-help-toggle:hover,
  [data-toantin-tool="equation_composer"] .ec-more-toggle:hover,
  [data-toantin-tool="equation_composer"] .ec-icon-btn:hover{transform:none;}
}
@media(prefers-reduced-motion:reduce){
  [data-toantin-tool="equation_composer"] .ec-action-btn,
  [data-toantin-tool="equation_composer"] .ec-category-btn,
  [data-toantin-tool="equation_composer"] .ec-zoom-btn,
  [data-toantin-tool="equation_composer"] .ec-fit-btn,
  [data-toantin-tool="equation_composer"] .ec-help-toggle,
  [data-toantin-tool="equation_composer"] .ec-more-toggle,
  [data-toantin-tool="equation_composer"] .ec-icon-btn{transition:none;}
}

/* ========================================================================== 
   V2.0.2 / B01 PATCH_01 — Math icon optical normalization
   Owner runtime feedback: Summation overlap + root family too wide.
   Keep button shell 3D-lite; mathematical glyphs remain flat and crisp.
   ========================================================================== */
[data-toantin-tool="equation_composer"]{
  --ec-math-preview-standard-w:52px;
  --ec-math-preview-standard-h:32px;
  --ec-math-preview-compact-w:46px;
  --ec-math-preview-wide-w:54px;
}
[data-toantin-tool="equation_composer"] .ec-math-preview-svg{
  max-width:100%;
  overflow:visible;
}
/* Standard quick/favorite optical box: consistent visual footprint. */
[data-toantin-tool="equation_composer"] .ec-favorites .ec-math-preview-svg{
  width:var(--ec-math-preview-standard-w);
  height:var(--ec-math-preview-standard-h);
}
/* Roots are intentionally shorter than the generic 64-unit semantic canvas. */
[data-toantin-tool="equation_composer"] .ec-math-preview[data-preview-kind="root"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-math-preview[data-preview-kind="nth-root"] .ec-math-preview-svg{
  width:var(--ec-math-preview-compact-w);
}
/* Large operators need enough breathing room for the operator + placeholder. */
[data-toantin-tool="equation_composer"] .ec-math-preview[data-preview-kind="sum"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-math-preview[data-preview-kind="integral"] .ec-math-preview-svg{
  width:var(--ec-math-preview-wide-w);
}
/* Palette tiles keep equal hit targets; only the internal optical width varies. */
[data-toantin-tool="equation_composer"] .ec-template-grid .ec-math-preview[data-preview-kind="root"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid .ec-math-preview[data-preview-kind="nth-root"] .ec-math-preview-svg{
  width:48px;
}
[data-toantin-tool="equation_composer"] .ec-template-grid .ec-math-preview[data-preview-kind="sum"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid .ec-math-preview[data-preview-kind="integral"] .ec-math-preview-svg{
  width:52px;
}
/* Full Tool uses the same proportions without enlarging the button shell. */
[data-toantin-tool="equation_composer"] .ec-full-template-btn .ec-math-preview[data-preview-kind="root"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-full-template-btn .ec-math-preview[data-preview-kind="nth-root"] .ec-math-preview-svg{
  width:34px;
}
[data-toantin-tool="equation_composer"] .ec-full-template-btn .ec-math-preview[data-preview-kind="sum"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-full-template-btn .ec-math-preview[data-preview-kind="integral"] .ec-math-preview-svg{
  width:38px;
}
@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-math-preview-svg{width:36px;height:23px;}
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-math-preview[data-preview-kind="root"] .ec-math-preview-svg,
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-math-preview[data-preview-kind="nth-root"] .ec-math-preview-svg{width:32px;}
  [data-toantin-tool="equation_composer"] .ec-template-grid .ec-math-preview[data-preview-kind="root"] .ec-math-preview-svg,
  [data-toantin-tool="equation_composer"] .ec-template-grid .ec-math-preview[data-preview-kind="nth-root"] .ec-math-preview-svg{width:36px;}
  [data-toantin-tool="equation_composer"] .ec-template-grid .ec-math-preview[data-preview-kind="sum"] .ec-math-preview-svg,
  [data-toantin-tool="equation_composer"] .ec-template-grid .ec-math-preview[data-preview-kind="integral"] .ec-math-preview-svg{width:40px;}
}

/* ========================================================================== 
   V2.0.3 / B01 PATCH_02 — Grouped palette IA + optical-grid hardening
   Inspired by MathType's family palettes, adapted for TOÁN TIN: fewer always-
   visible formulas, strong Quick strip, grouped families, contextual controls.
   ========================================================================== */
[data-toantin-tool="equation_composer"]{
  --ec-palette-cell:50px;
  --ec-palette-cell-h:48px;
  --ec-palette-gap:7px;
  --ec-palette-preview-w:38px;
  --ec-palette-preview-h:27px;
}
[data-toantin-tool="equation_composer"] .ec-domain-groups{
  display:flex;align-items:center;gap:6px;overflow-x:auto;overflow-y:hidden;
  padding:7px 10px;border-bottom:1px solid var(--ec-border);
  background:linear-gradient(180deg,#fff,#f4f8ff);scrollbar-width:thin;
  overscroll-behavior-inline:contain;
}
[data-toantin-tool="equation_composer"] .ec-palette-group-btn{
  width:auto;min-width:76px;height:42px;padding:0 10px;gap:6px;
  border-radius:11px;white-space:nowrap;flex:0 0 auto;
}
[data-toantin-tool="equation_composer"] .ec-palette-group-btn .ec-ui-icon{
  width:20px;height:20px;flex:0 0 20px;
}
[data-toantin-tool="equation_composer"] .ec-palette-group-label{
  display:block;font-size:.72rem;font-weight:750;line-height:1;color:inherit;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped{
  min-width:0;overflow:hidden;background:#fbfdff;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-panel{
  padding:10px 11px 14px;overflow:auto;max-height:min(62vh,640px);
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-panel-title{
  margin:0;font-size:.9rem;color:#173c71;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-panel-lead{
  margin:3px 0 9px;color:var(--ec-muted);font-size:.7rem;line-height:1.35;
}
[data-toantin-tool="equation_composer"] .ec-palette-section{
  padding:8px 0 9px;border-top:1px solid #e6eef9;
}
[data-toantin-tool="equation_composer"] .ec-palette-section:first-of-type{border-top:0;padding-top:2px;}
[data-toantin-tool="equation_composer"] .ec-palette-section-title{
  margin:0 0 6px;font-size:.69rem;font-weight:800;letter-spacing:.02em;color:#506984;
}
/* Fixed optical cells: do not stretch a mathematical symbol just because the panel is wider. */
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-grid-compact{
  display:grid;grid-template-columns:repeat(auto-fill,var(--ec-palette-cell));
  grid-auto-rows:var(--ec-palette-cell-h);justify-content:start;align-items:start;
  gap:var(--ec-palette-gap);width:100%;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-grid-compact .ec-icon-btn{
  width:var(--ec-palette-cell);min-width:var(--ec-palette-cell);max-width:var(--ec-palette-cell);
  height:var(--ec-palette-cell-h);min-height:var(--ec-palette-cell-h);padding:3px;
  overflow:hidden;border-radius:10px;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-grid-compact .ec-math-preview{
  width:100%;height:100%;display:grid;place-items:center;overflow:hidden;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-grid-compact .ec-math-preview-svg{
  width:var(--ec-palette-preview-w);height:var(--ec-palette-preview-h);max-width:100%;max-height:100%;overflow:visible;
}
/* Compact structural families need less horizontal footprint than the semantic SVG canvas. */
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-math-preview[data-preview-kind="root"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-math-preview[data-preview-kind="nth-root"] .ec-math-preview-svg{width:34px;}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-math-preview[data-preview-kind="sum"] .ec-math-preview-svg{width:31px;height:27px;}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-math-preview[data-preview-kind="integral"] .ec-math-preview-svg{width:34px;height:28px;}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-math-preview[data-preview-kind="fence"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-math-preview[data-preview-kind="matrix"] .ec-math-preview-svg{width:36px;}
/* Quick strip is the direct-access lane: compact, consistent hit targets, no stretched tiles. */
[data-toantin-tool="equation_composer"] .ec-favorites{gap:6px!important;padding:2px 1px 4px;}
[data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn.ec-has-math-preview{
  width:50px;min-width:50px;height:44px;min-height:44px;padding:3px;overflow:hidden;
}
[data-toantin-tool="equation_composer"] .ec-favorites .ec-math-preview{width:100%;height:100%;display:grid;place-items:center;overflow:hidden;}
[data-toantin-tool="equation_composer"] .ec-favorites .ec-math-preview-svg{width:38px;height:27px;max-width:100%;max-height:100%;}
[data-toantin-tool="equation_composer"] .ec-favorites .ec-math-preview[data-preview-kind="root"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-favorites .ec-math-preview[data-preview-kind="nth-root"] .ec-math-preview-svg{width:33px;}
[data-toantin-tool="equation_composer"] .ec-favorites .ec-math-preview[data-preview-kind="sum"] .ec-math-preview-svg{width:30px;}
[data-toantin-tool="equation_composer"] .ec-favorites .ec-math-preview[data-preview-kind="integral"] .ec-math-preview-svg{width:33px;}
@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"]{--ec-palette-cell:48px;--ec-palette-cell-h:48px;--ec-palette-gap:6px;}
  [data-toantin-tool="equation_composer"] .ec-domain-groups{padding:6px 8px;gap:5px;}
  [data-toantin-tool="equation_composer"] .ec-palette-group-btn{min-width:48px;width:48px;height:44px;padding:0;}
  [data-toantin-tool="equation_composer"] .ec-palette-group-label{display:none;}
  [data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-panel{max-height:44vh;padding:8px;}
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn.ec-has-math-preview{width:48px;min-width:48px;height:44px;}
}
@media(min-width:1200px) and (pointer:coarse){
  [data-toantin-tool="equation_composer"]{--ec-palette-cell:56px;--ec-palette-cell-h:54px;--ec-palette-gap:8px;}
  [data-toantin-tool="equation_composer"] .ec-palette-group-btn{min-height:50px;}
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn.ec-has-math-preview{width:54px;min-width:54px;height:50px;}
}
/* Desktop Quick strip shows the full curated set; smaller viewports progressively overflow. */
[data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn:nth-child(n+9){display:inline-flex;}
@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn:nth-child(n+9){display:none;}
}
@media(max-width:390px){
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn:nth-child(n+7){display:none;}
}
/* B01 PATCH_02 responsive hardening: utility toolbar remains a compact row, never a vertical button stack. */
@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"] .ec-topbar{
    display:grid;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:6px!important;
  }
  [data-toantin-tool="equation_composer"] .ec-toolbar-brand{grid-column:1;grid-row:1;}
  [data-toantin-tool="equation_composer"] .ec-global-actions{grid-column:2 / -1;grid-row:1;width:100%;min-width:0;order:initial;}
  [data-toantin-tool="equation_composer"] .ec-zoom-controls{
    grid-column:1 / 3;grid-row:2;display:flex!important;flex-flow:row nowrap!important;
    width:max-content!important;max-width:100%;margin:0!important;padding:5px 0 0!important;
    border:0!important;justify-content:flex-start!important;overflow-x:auto;
  }
  [data-toantin-tool="equation_composer"] .ec-help-toggle{grid-column:3;grid-row:2;order:initial;margin:5px 0 0!important;}
  [data-toantin-tool="equation_composer"] .ec-more-toggle{grid-column:4;grid-row:2;order:initial;margin:5px 0 0!important;}
}
@media(max-width:390px){
  [data-toantin-tool="equation_composer"] .ec-topbar{grid-template-columns:minmax(0,1fr) auto auto;}
  [data-toantin-tool="equation_composer"] .ec-toolbar-brand{display:none;}
  [data-toantin-tool="equation_composer"] .ec-global-actions{grid-column:1 / -1;grid-row:1;}
  [data-toantin-tool="equation_composer"] .ec-zoom-controls{grid-column:1;grid-row:2;}
  [data-toantin-tool="equation_composer"] .ec-help-toggle{grid-column:2;grid-row:2;}
  [data-toantin-tool="equation_composer"] .ec-more-toggle{grid-column:3;grid-row:2;}
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn:nth-child(5),
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn:nth-child(6){display:inline-flex;}
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn:nth-child(n+7){display:none;}
}

/* ========================================================================== 
   V2.0.4 / B01 PATCH_03 — Palette viewport + category reflow hardening
   Fixes clipped final palette rows, keeps family triggers inside their lane,
   and preserves a fully scrollable last section on desktop/mobile/touch.
   ========================================================================== */
[data-toantin-tool="equation_composer"] .ec-workspace{
  align-items:stretch;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped{
  display:flex;
  flex-direction:column;
  align-self:stretch;
  min-height:0;
  overflow:hidden;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-panel{
  flex:1 1 auto;
  min-height:0;
  height:100%;
  max-height:none;
  overflow-x:hidden;
  overflow-y:auto;
  padding-bottom:26px;
  scroll-padding-bottom:26px;
  scrollbar-gutter:stable;
  overscroll-behavior:contain;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-palette-section:last-of-type{
  padding-bottom:18px;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-grid-compact{
  padding-bottom:2px;
}

/* Seven scientific families form one disciplined lane on roomy containers.
   Narrow containers scroll horizontally instead of overflowing or shrinking text. */
[data-toantin-tool="equation_composer"] .ec-domain-groups{
  display:grid;
  grid-template-columns:repeat(7,minmax(72px,1fr));
  gap:6px;
  width:100%;
  min-width:0;
  overflow-x:auto;
  overflow-y:hidden;
  scrollbar-gutter:stable;
}
[data-toantin-tool="equation_composer"] .ec-palette-group-btn{
  width:100%;
  min-width:72px;
  max-width:none;
  padding-inline:8px;
  overflow:hidden;
}
[data-toantin-tool="equation_composer"] .ec-palette-group-label{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
}

@media(max-width:991.98px){
  [data-toantin-tool="equation_composer"] .ec-domain-groups{
    grid-template-columns:repeat(7,72px);
    justify-content:start;
  }
}
@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-panel{
    height:auto;
    max-height:min(46vh,420px);
    padding:8px 8px 28px;
    scroll-padding-bottom:28px;
  }
  [data-toantin-tool="equation_composer"] .ec-domain-groups{
    grid-template-columns:repeat(7,48px);
    gap:5px;
  }
  [data-toantin-tool="equation_composer"] .ec-palette-group-btn{
    width:48px;
    min-width:48px;
    padding:0;
  }
}
@media(min-width:1200px) and (pointer:coarse){
  [data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-panel{
    padding-bottom:34px;
    scroll-padding-bottom:34px;
  }
}


/* ========================================================================== 
   V2.0.5 / B01 PATCH_04 — layout hardening + full-window UX refinement
   Owner-verified Full Tool safe-lane remains intact. This pass makes the
   palette a single-scroll-owner workspace, widens scientific family triggers,
   improves visual density, and keeps the Full Tool command bar reachable.
   ========================================================================== */
@media (min-width:768px){
  [data-toantin-tool="equation_composer"] .ec-workspace{
    grid-template-columns:minmax(330px,34%) minmax(0,1fr);
    height:clamp(520px,calc(100dvh - 230px),720px);
    min-height:520px;
    overflow:hidden;
  }
  [data-toantin-tool="equation_composer"] .ec-palette-grouped{
    height:100%;
    min-height:0;
    overflow:hidden;
  }
  [data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-panel{
    height:auto;
    min-height:0;
    max-height:none;
    overflow-y:auto;
    overscroll-behavior:contain;
    scrollbar-gutter:stable;
    padding:9px 10px 34px;
    scroll-padding-bottom:34px;
  }
}
[data-toantin-tool="equation_composer"] .ec-domain-groups{
  grid-template-columns:repeat(7,minmax(94px,1fr));
  gap:7px;
  padding:7px 10px 8px;
  scrollbar-width:thin;
}
[data-toantin-tool="equation_composer"] .ec-palette-group-btn{
  min-width:94px;
  height:48px;
  padding-inline:11px;
  gap:7px;
}
[data-toantin-tool="equation_composer"] .ec-palette-group-label{
  font-size:.75rem;
  line-height:1.1;
  overflow:visible;
  text-overflow:clip;
}
[data-toantin-tool="equation_composer"] .ec-palette-section{
  padding:6px 0 7px;
}
[data-toantin-tool="equation_composer"] .ec-palette-section-title{
  margin-bottom:5px;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-palette-section:last-of-type{
  padding-bottom:28px;
}
[data-toantin-tool="equation_composer"] .ec-favorites{
  gap:7px!important;
  padding:3px 1px 5px;
}
[data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn.ec-has-math-preview{
  width:54px;
  min-width:54px;
  height:46px;
  min-height:46px;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-panel{
  scrollbar-width:thin;
  scrollbar-color:#b8cbe2 transparent;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-panel::-webkit-scrollbar{width:8px}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-panel::-webkit-scrollbar-track{background:transparent}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-panel::-webkit-scrollbar-thumb{background:#c7d7ea;border:2px solid transparent;border-radius:999px;background-clip:padding-box}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-panel:hover::-webkit-scrollbar-thumb{background:#9fb9d8;background-clip:padding-box}

/* Full Tool command lane remains available while its host scrolls. */
[data-toantin-tool="equation_composer"] .ec-full-commandbar{
  position:sticky;
  top:0;
  z-index:18;
  background:rgba(251,253,255,.97);
  backdrop-filter:blur(10px);
  box-shadow:0 1px 0 rgba(203,220,240,.9),0 6px 14px rgba(15,31,75,.045);
}

@media(max-width:991.98px) and (min-width:768px){
  [data-toantin-tool="equation_composer"] .ec-domain-groups{
    grid-template-columns:repeat(7,94px);
    justify-content:start;
  }
}
@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"] .ec-workspace{
    height:auto;
    min-height:0;
    overflow:visible;
  }
  [data-toantin-tool="equation_composer"] .ec-palette-grouped{height:auto;overflow:hidden}
  [data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-panel{
    max-height:min(48dvh,440px);
    overflow-y:auto;
    padding:7px 7px 30px;
    scroll-padding-bottom:30px;
  }
  [data-toantin-tool="equation_composer"] .ec-domain-groups{
    grid-template-columns:repeat(7,52px);
    gap:5px;
    padding:6px 7px;
  }
  [data-toantin-tool="equation_composer"] .ec-palette-group-btn{
    width:52px;
    min-width:52px;
    height:46px;
    padding:0;
  }
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn.ec-has-math-preview{
    width:48px;min-width:48px;height:44px;min-height:44px;
  }
}
/* PATCH_04 sticky owner fix: host scrolls; the surface itself must not become
   the sticky containing block via the legacy overflow:hidden rule. */
[data-toantin-tool="equation_composer"].ec-full-tool-v11{overflow:visible;}

/* ========================================================================== 
   V2.0.6 / B01 PATCH_05 — Owner consolidated UI/UX contract F01–F40
   Keep TOÁN TIN visual identity, reduce competing layers, use one scroll owner
   per palette, preserve stable Quick access, and separate Mode from Profile.
   ========================================================================== */
[data-toantin-tool="equation_composer"]{
  --ec-palette-cell:52px;
  --ec-palette-cell-h:50px;
  --ec-palette-gap:7px;
}
/* Docked unified palette: header never scrolls; body owns vertical scrolling. */
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-panel{
  display:flex;
  flex-direction:column;
  min-height:0;
  height:100%;
  padding:0;
  overflow:hidden;
}
[data-toantin-tool="equation_composer"] .ec-palette-head{
  flex:0 0 auto;
  padding:10px 11px 8px;
  border-bottom:1px solid #e7eef8;
  background:linear-gradient(180deg,#fff,#fbfdff);
}
[data-toantin-tool="equation_composer"] .ec-palette-head .ec-panel-lead{margin:3px 0 0}
[data-toantin-tool="equation_composer"] .ec-template-scroll{
  flex:1 1 auto;
  min-height:0;
  overflow-x:hidden;
  overflow-y:auto;
  padding:4px 10px 36px;
  scroll-padding-bottom:36px;
  scrollbar-gutter:stable;
  overscroll-behavior:contain;
  scrollbar-width:thin;
  scrollbar-color:#b8cbe2 transparent;
}
[data-toantin-tool="equation_composer"] .ec-template-scroll::-webkit-scrollbar{width:7px}
[data-toantin-tool="equation_composer"] .ec-template-scroll::-webkit-scrollbar-track{background:transparent}
[data-toantin-tool="equation_composer"] .ec-template-scroll::-webkit-scrollbar-thumb{background:#c3d3e7;border:2px solid transparent;border-radius:999px;background-clip:padding-box}
[data-toantin-tool="equation_composer"] .ec-template-scroll:hover::-webkit-scrollbar-thumb{background:#97b2d3;background-clip:padding-box}
[data-toantin-tool="equation_composer"] .ec-template-scroll .ec-palette-section:last-child,
[data-toantin-tool="equation_composer"] .ec-template-scroll .ec-matrix-picker:last-child{margin-bottom:22px;padding-bottom:24px}
/* Scientific family lane: readable labels on desktop, controlled scroll on narrow widths. */
[data-toantin-tool="equation_composer"] .ec-domain-groups{
  display:grid;
  grid-template-columns:repeat(7,minmax(108px,1fr));
  gap:8px;
  overflow-x:auto;
  overflow-y:hidden;
  padding:8px 10px 9px;
  scroll-snap-type:x proximity;
}
[data-toantin-tool="equation_composer"] .ec-palette-group-btn{
  min-width:108px;
  height:52px;
  padding-inline:12px;
  gap:8px;
  scroll-snap-align:start;
}
[data-toantin-tool="equation_composer"] .ec-palette-group-btn .ec-ui-icon{width:20px;height:20px;overflow:visible}
[data-toantin-tool="equation_composer"] .ec-palette-group-btn .ec-ui-icon-text{font-size:14px;font-weight:800}
[data-toantin-tool="equation_composer"] .ec-palette-group-label{font-size:.78rem;line-height:1.15;white-space:nowrap}
/* Quick strip stays spatially stable; Recent remains a separate Full Tool panel. */
[data-toantin-tool="equation_composer"] .ec-strip-wrap{padding-block:5px 6px}
[data-toantin-tool="equation_composer"] .ec-favorites{gap:7px!important;padding:2px 2px 4px;scrollbar-width:thin}
[data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn.ec-has-math-preview{
  width:56px;min-width:56px;height:48px;min-height:48px;border-radius:11px;
}
/* Optical families: recognize the structure without filling every pixel. */
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="root"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="nth-root"] .ec-math-preview-svg{width:35px}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="sum"] .ec-math-preview-svg{width:30px;height:28px}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="integral"] .ec-math-preview-svg{width:33px;height:29px}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="fence"] .ec-math-preview-svg{width:36px}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="matrix"] .ec-math-preview-svg{width:38px}
/* Mode and subject profile are different semantics; make that visually explicit. */
[data-toantin-tool="equation_composer"] .ec-editor-controls{flex-wrap:wrap;justify-content:flex-end}
[data-toantin-tool="equation_composer"] .ec-mode-group,
[data-toantin-tool="equation_composer"] .ec-profile-group{display:flex;align-items:center;gap:4px;min-width:0}
[data-toantin-tool="equation_composer"] .ec-control-caption{font-size:.64rem;font-weight:800;letter-spacing:.035em;text-transform:uppercase;color:#6b7f98;white-space:nowrap}
[data-toantin-tool="equation_composer"] .ec-profile-group{padding-left:7px;border-left:1px solid #dce7f4}
[data-toantin-tool="equation_composer"] .ec-profile-select{min-width:116px;max-width:170px}
/* Workspace remains the visual focus; avoid hard-coding an oversized palette. */
@media(min-width:992px){
  [data-toantin-tool="equation_composer"] .ec-workspace{grid-template-columns:minmax(310px,30%) minmax(0,1fr)}
}
@media(max-width:1199.98px) and (min-width:768px){
  [data-toantin-tool="equation_composer"] .ec-domain-groups{grid-template-columns:repeat(7,108px);justify-content:start}
}
@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"]{--ec-palette-cell:54px;--ec-palette-cell-h:52px;--ec-palette-gap:7px}
  [data-toantin-tool="equation_composer"] .ec-domain-groups{grid-template-columns:repeat(7,54px);gap:6px;padding:6px 7px}
  [data-toantin-tool="equation_composer"] .ec-palette-group-btn{width:54px;min-width:54px;height:48px;padding:0}
  [data-toantin-tool="equation_composer"] .ec-palette-group-label{display:none}
  [data-toantin-tool="equation_composer"] .ec-palette-group-btn .ec-ui-icon{width:22px;height:22px}
  [data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-template-panel{height:auto;max-height:min(50dvh,460px)}
  [data-toantin-tool="equation_composer"] .ec-template-scroll{max-height:min(50dvh,460px);padding:4px 8px 34px;scroll-padding-bottom:34px}
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn.ec-has-math-preview{width:52px;min-width:52px;height:46px;min-height:46px}
  [data-toantin-tool="equation_composer"] .ec-editor-controls{justify-content:flex-start}
  [data-toantin-tool="equation_composer"] .ec-profile-group{padding-left:0;border-left:0}
}
@media(pointer:coarse){
  [data-toantin-tool="equation_composer"] .ec-palette-group-btn,
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn,
  [data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-icon-btn{min-height:44px}
}

/* V2.0.7 — Draft recovery + explicit persistence feedback */
[data-toantin-tool="equation_composer"] .ec-draft-badge{
  margin-left:auto;display:inline-flex;align-items:center;min-height:32px;padding:.3rem .58rem;border:1px solid #dbe7f5;border-radius:999px;background:#f8fbff;color:#526987;font-size:.75rem;font-weight:700;white-space:nowrap;
}
[data-toantin-tool="equation_composer"] .ec-draft-badge[data-status="saved"],
[data-toantin-tool="equation_composer"] .ec-draft-badge[data-status="restored"]{background:#effaf3;border-color:#ccebd7;color:#23663c}
[data-toantin-tool="equation_composer"] .ec-draft-badge[data-status="pending"],
[data-toantin-tool="equation_composer"] .ec-draft-badge[data-status="saving"]{background:#fff8e8;border-color:#f2ddaa;color:#7a5b12}
[data-toantin-tool="equation_composer"] .ec-draft-badge[data-status="error"]{background:#fff1f1;border-color:#f2c8c8;color:#9b2c2c}
[data-toantin-tool="equation_composer"] .ec-persist-feedback{
  position:fixed;right:18px;bottom:18px;z-index:1250;max-width:min(420px,calc(100vw - 36px));padding:.7rem .9rem;border:1px solid #cfe0f5;border-radius:12px;background:#fff;box-shadow:0 14px 34px rgba(15,53,99,.18);font-size:.86rem;font-weight:700;color:#173b6b;
}
[data-toantin-tool="equation_composer"] .ec-persist-feedback[data-tone="success"]{border-color:#bfe2cb;background:#f2fbf5;color:#23663c}
[data-toantin-tool="equation_composer"] .ec-persist-feedback[data-tone="danger"]{border-color:#efc7c7;background:#fff4f4;color:#9b2c2c}
[data-toantin-tool="equation_composer"] .ec-full-draft-pill[data-status="saved"],
[data-toantin-tool="equation_composer"] .ec-full-draft-pill[data-status="restored"]{border-color:#ccebd7;background:#effaf3;color:#23663c}
[data-toantin-tool="equation_composer"] .ec-full-clear-draft{white-space:nowrap}
[data-toantin-tool="equation_composer"] .ec-full-save-notice{min-width:0;max-width:220px;color:#23663c;font-size:.76rem;font-weight:700;line-height:1.25}
@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"] .ec-draft-badge{display:none}
  [data-toantin-tool="equation_composer"] .ec-full-clear-draft{font-size:0;width:40px;padding:0}
  [data-toantin-tool="equation_composer"] .ec-full-clear-draft::before{content:'⌫';font-size:18px}
  [data-toantin-tool="equation_composer"] .ec-full-save-notice{display:none}
}


/* ==========================================================================
   V2.0.8 / B01 PATCH_07 — global mathematical icon legibility audit
   Larger optical previews by family; button hit areas stay >=44px.
   ========================================================================== */
[data-toantin-tool="equation_composer"]{--ec-palette-cell:58px;--ec-palette-cell-h:54px;--ec-palette-gap:7px}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-icon-btn{min-width:58px;width:58px;min-height:54px;height:54px;padding:2px;overflow:visible}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview{width:100%;height:100%;display:grid;place-items:center;overflow:visible}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview-svg{width:46px;height:34px;overflow:visible}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="glyph"] .ec-math-preview-svg{width:44px;height:33px}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="fraction"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="slash-fraction"] .ec-math-preview-svg{width:44px;height:34px}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="root"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="nth-root"] .ec-math-preview-svg{width:44px;height:33px}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="sup"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="sub"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="subsup"] .ec-math-preview-svg{width:43px;height:34px}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="sum"] .ec-math-preview-svg{width:38px;height:35px}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="integral"] .ec-math-preview-svg{width:40px;height:36px}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="fence"] .ec-math-preview-svg{width:43px;height:35px}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="matrix"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="system"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="cases"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="aligned"] .ec-math-preview-svg{width:45px;height:36px}
[data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn.ec-has-math-preview{width:60px;min-width:60px;height:52px;min-height:52px}
[data-toantin-tool="equation_composer"] .ec-favorites .ec-math-preview-svg{width:46px;height:34px}
[data-toantin-tool="equation_composer"] .ec-palette-group-btn .ec-ui-icon{width:24px;height:24px;overflow:visible}
[data-toantin-tool="equation_composer"] .ec-palette-group-btn .ec-ui-icon-text{font-size:17px;font-weight:800}
@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"]{--ec-palette-cell:56px;--ec-palette-cell-h:52px}
  [data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-icon-btn{width:56px;min-width:56px;height:52px;min-height:52px}
  [data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview-svg{width:44px;height:33px}
  [data-toantin-tool="equation_composer"] .ec-favorites .ec-icon-btn.ec-has-math-preview{width:56px;min-width:56px;height:50px;min-height:50px}
}

/* ========================================================================== 
   V2.0.9 / B01 PATCH_08 — canonical long-arrow group icon + in-tool confirm UI
   ========================================================================== */
[data-toantin-tool="equation_composer"] .ec-palette-group-btn [data-icon="category-arrows-long"] .ec-ui-icon-text,
[data-toantin-tool="equation_composer"] [data-icon="category-arrows-long"] .ec-ui-icon-text{font-size:19px;font-weight:800;letter-spacing:-.04em}
[data-toantin-tool="equation_composer"] .ec-confirm-layer{position:absolute;inset:0;z-index:1200;display:grid;place-items:center;padding:20px;background:rgba(20,43,79,.28);backdrop-filter:blur(2px)}
[data-toantin-tool="equation_composer"] .ec-confirm-dialog{width:min(460px,calc(100% - 24px));border:1px solid #cfe0f4;border-radius:18px;background:#fff;box-shadow:0 24px 70px rgba(24,55,95,.24),0 4px 14px rgba(24,55,95,.12);overflow:hidden;color:var(--ec-text)}
[data-toantin-tool="equation_composer"] .ec-confirm-head{display:flex;align-items:center;gap:12px;padding:20px 22px 10px}
[data-toantin-tool="equation_composer"] .ec-confirm-head h3{margin:0;font-size:1.05rem;font-weight:800;color:var(--ec-navy)}
[data-toantin-tool="equation_composer"] .ec-confirm-icon{width:30px;height:30px;flex:0 0 30px;display:grid;place-items:center;border-radius:50%;font-weight:900;background:#fff1f1;color:#b42318;border:1px solid #ffd2cf}
[data-toantin-tool="equation_composer"] .ec-confirm-body{padding:4px 22px 20px;color:#526581;font-size:.92rem;line-height:1.55}
[data-toantin-tool="equation_composer"] .ec-confirm-actions{display:flex;justify-content:flex-end;gap:10px;padding:14px 22px 20px;background:linear-gradient(180deg,#fff,#f8fbff)}
[data-toantin-tool="equation_composer"] .ec-confirm-actions .btn{min-width:104px;min-height:40px;border-radius:11px;font-weight:750}
[data-toantin-tool="equation_composer"] .ec-confirm-danger{background:#d92d20;border-color:#d92d20;color:#fff;box-shadow:0 5px 12px rgba(217,45,32,.18)}
[data-toantin-tool="equation_composer"] .ec-confirm-danger:hover{background:#b42318;border-color:#b42318;color:#fff}
[data-toantin-tool="equation_composer"] .ec-confirm-cancel{border-color:#cfdced;background:#fff;color:#27456c}
@media(max-width:575.98px){[data-toantin-tool="equation_composer"] .ec-confirm-layer{padding:12px}[data-toantin-tool="equation_composer"] .ec-confirm-dialog{width:100%}[data-toantin-tool="equation_composer"] .ec-confirm-actions{display:grid;grid-template-columns:1fr 1fr}[data-toantin-tool="equation_composer"] .ec-confirm-actions .btn{width:100%;min-width:0}}

/* ========================================================================== 
   V2.0.10 / B01 PATCH_09 — recognition-first mathematical icon system
   Preserve clear semantic previews; complex/invisible structures receive
   legible recognition icons while the tile shell and touch target stay stable.
   ========================================================================== */
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview-svg{
  width:49px;height:37px;max-width:calc(100% - 2px);max-height:calc(100% - 2px);
}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="overbrace"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="underbrace"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind^="space-"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind^="stack-"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="binomial"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="boxed"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="cancel"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="underline"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="hat"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="tilde"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="dot"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="ddot"] .ec-math-preview-svg{width:51px;height:38px}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="glyph"] .ec-math-preview-svg{width:47px;height:36px}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="fence"] .ec-math-preview-svg{width:47px;height:38px}
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="matrix"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="system"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="cases"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="aligned"] .ec-math-preview-svg{width:48px;height:38px}
[data-toantin-tool="equation_composer"] .ec-favorites .ec-math-preview[data-preview-kind="overbrace"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-favorites .ec-math-preview[data-preview-kind="underbrace"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-favorites .ec-math-preview[data-preview-kind^="space-"] .ec-math-preview-svg{width:48px;height:35px}
[data-toantin-tool="equation_composer"] [data-icon="category-arrows-long"]{overflow:visible}
[data-toantin-tool="equation_composer"] [data-icon="category-arrows-long"] .ec-ui-icon-text{font-size:22px;font-weight:850;letter-spacing:-.055em}

@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview-svg{width:47px;height:35px}
  [data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="overbrace"] .ec-math-preview-svg,
  [data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind="underbrace"] .ec-math-preview-svg,
  [data-toantin-tool="equation_composer"] .ec-template-grid-compact .ec-math-preview[data-preview-kind^="space-"] .ec-math-preview-svg{width:49px;height:36px}
}

/* V2.0.11 B01 PATCH_10 — centered formula metadata dialog */
[data-toantin-tool="equation_composer"] .ec-meta-layer{position:fixed;inset:0;z-index:72;display:grid;place-items:center;padding:18px;background:rgba(15,31,75,.34);backdrop-filter:blur(2px)}
[data-toantin-tool="equation_composer"] .ec-meta-dialog{width:min(460px,calc(100vw - 32px));overflow:hidden;border:1px solid #cfddf1;border-radius:18px;background:#fff;box-shadow:0 24px 70px rgba(15,31,75,.28);color:#102b55}
[data-toantin-tool="equation_composer"] .ec-meta-head{display:flex;gap:12px;align-items:flex-start;padding:18px 20px 14px;border-bottom:1px solid #e2eaf5;background:linear-gradient(180deg,#f9fcff,#f3f8ff)}
[data-toantin-tool="equation_composer"] .ec-meta-icon{display:grid;place-items:center;flex:0 0 38px;width:38px;height:38px;border-radius:12px;background:#e9f3ff;color:#1263dc;font-weight:900;font-size:1.1rem}
[data-toantin-tool="equation_composer"] .ec-meta-head h3{margin:0;font-size:1.02rem;font-weight:900;color:#123b75}
[data-toantin-tool="equation_composer"] .ec-meta-head p{margin:4px 0 0;font-size:.82rem;color:#60748f}
[data-toantin-tool="equation_composer"] .ec-meta-body{padding:18px 20px 12px}
[data-toantin-tool="equation_composer"] .ec-meta-label{display:grid;gap:7px;font-size:.82rem;font-weight:800;color:#334e72}
[data-toantin-tool="equation_composer"] .ec-meta-input{min-height:44px;border-color:#b9cce6;border-radius:11px;font-weight:700;color:#173b6b;box-shadow:none}
[data-toantin-tool="equation_composer"] .ec-meta-input:focus{border-color:#4a91ee;box-shadow:0 0 0 3px rgba(37,124,238,.14)}
[data-toantin-tool="equation_composer"] .ec-meta-input[aria-invalid="true"]{border-color:#dc3545;box-shadow:0 0 0 3px rgba(220,53,69,.12)}
[data-toantin-tool="equation_composer"] .ec-meta-hint{margin-top:8px;font-size:.75rem;line-height:1.45;color:#6b7f99}
[data-toantin-tool="equation_composer"] .ec-meta-actions{display:flex;justify-content:flex-end;gap:9px;padding:13px 20px 18px}
[data-toantin-tool="equation_composer"] .ec-meta-actions .btn{min-height:40px;min-width:108px;border-radius:11px;font-weight:800}

/* V2.0.11 PATCH_10 — Word-like matrix size picker */
[data-toantin-tool="equation_composer"] .ec-matrix-picker{padding:12px 13px 13px;background:linear-gradient(180deg,#f9fcff,#f4f8fe)}
[data-toantin-tool="equation_composer"] .ec-matrix-picker-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:3px}
[data-toantin-tool="equation_composer"] .ec-matrix-picker-head .ec-section-label{margin:0}
[data-toantin-tool="equation_composer"] .ec-matrix-picker-help{margin:0 0 9px;font-size:.72rem;color:#70829a}
[data-toantin-tool="equation_composer"] .ec-matrix-picker-grid{grid-template-columns:repeat(5,27px);gap:5px;padding:8px;border-radius:10px;box-shadow:inset 0 0 0 1px rgba(187,205,229,.28)}
[data-toantin-tool="equation_composer"] .ec-matrix-cell{width:27px;height:27px;border:1.5px solid #aebfd6;border-radius:2px;background:#fff;box-shadow:0 1px 1px rgba(15,31,75,.04);transition:background .08s ease,border-color .08s ease,box-shadow .08s ease}
[data-toantin-tool="equation_composer"] .ec-matrix-cell.active{background:#d9eaff;border-color:#287bea;box-shadow:inset 0 0 0 1px rgba(40,123,234,.14)}
[data-toantin-tool="equation_composer"] .ec-matrix-cell:focus-visible{outline:2px solid #1263dc;outline-offset:2px}
[data-toantin-tool="equation_composer"] .ec-matrix-picker-status{font-size:.82rem;min-width:auto;color:#1263dc}
[data-toantin-tool="equation_composer"] .ec-matrix-custom-label{font-size:.75rem;font-weight:800;color:#526984}
@media(max-width:767.98px){[data-toantin-tool="equation_composer"] .ec-matrix-picker-grid{grid-template-columns:repeat(5,32px)}[data-toantin-tool="equation_composer"] .ec-matrix-cell{width:32px;height:32px}}

/* ========================================================================== 
   V2.1.0 / B02-01 — Symbol Grid & Density
   Dense mathematical symbol families use a flat, recognition-first grid:
   larger glyphs, smaller cells, no 3D/card shadow, precise hover/focus glow.
   Structural templates retain their larger recognition tiles.
   ========================================================================== */
[data-toantin-tool="equation_composer"]{
  --ec-symbol-cell:44px;
  --ec-symbol-gap:3px;
  --ec-symbol-glyph-w:39px;
  --ec-symbol-glyph-h:31px;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,var(--ec-symbol-cell));
  grid-auto-rows:var(--ec-symbol-cell);
  gap:var(--ec-symbol-gap);
  justify-content:start;
  align-items:start;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile{
  width:var(--ec-symbol-cell);
  min-width:var(--ec-symbol-cell);
  max-width:var(--ec-symbol-cell);
  height:var(--ec-symbol-cell);
  min-height:var(--ec-symbol-cell);
  padding:1px;
  border:1px solid transparent;
  border-radius:6px;
  background:transparent;
  box-shadow:none;
  transform:none;
  transition:background-color .10s ease,border-color .10s ease,color .10s ease,box-shadow .10s ease;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile .ec-math-preview{
  width:100%;height:100%;display:grid;place-items:center;overflow:visible;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile .ec-math-preview[data-preview-kind="glyph"] .ec-math-preview-svg{
  width:var(--ec-symbol-glyph-w);
  height:var(--ec-symbol-glyph-h);
  max-width:100%;max-height:100%;overflow:visible;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile .ec-preview-text{
  font-weight:600;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile:hover{
  background:#edf5ff;
  border-color:#9fc4f5;
  color:#075fd4;
  box-shadow:0 0 0 2px rgba(55,132,235,.08);
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile:active{
  background:#dfeeff;
  border-color:#75aef1;
  color:#064fab;
  box-shadow:inset 0 0 0 1px rgba(21,101,192,.08);
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile:focus-visible{
  outline:0;
  background:#edf5ff;
  border-color:#458de8;
  color:#075fd4;
  box-shadow:0 0 0 3px rgba(59,130,246,.22);
}
/* Mixed families can still contain single-symbol controls: keep them flat too,
   but do not force the whole structural grid into dense 44px cells. */
[data-toantin-tool="equation_composer"] .ec-template-grid-compact:not(.ec-symbol-grid) .ec-symbol-tile{
  box-shadow:none;
}
/* Compact section rhythm: density comes from cells, not from cramped glyphs. */
[data-toantin-tool="equation_composer"] .ec-palette-section{padding-top:7px;margin-top:5px}
[data-toantin-tool="equation_composer"] .ec-palette-section-title{margin-bottom:4px}
@media(min-width:1200px){
  [data-toantin-tool="equation_composer"]{--ec-symbol-cell:42px;--ec-symbol-gap:3px;--ec-symbol-glyph-w:38px;--ec-symbol-glyph-h:31px}
}
@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"]{--ec-symbol-cell:46px;--ec-symbol-gap:4px;--ec-symbol-glyph-w:40px;--ec-symbol-glyph-h:32px}
}
@media(pointer:coarse){
  [data-toantin-tool="equation_composer"]{--ec-symbol-cell:48px;--ec-symbol-gap:4px;--ec-symbol-glyph-w:41px;--ec-symbol-glyph-h:33px}
  [data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile{min-height:48px;height:48px}
}
@media(prefers-reduced-motion:reduce){
  [data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile{transition:none}
}

/* B02-03 — compact selection-aware formatting strip */
[data-toantin-tool="equation_composer"] .ec-full-commandbar{
  grid-template-columns:auto auto minmax(0,1fr);
}
[data-toantin-tool="equation_composer"] .ec-full-format-strip{
  display:flex;align-items:center;gap:3px;padding:0 8px 0 0;border-right:1px solid var(--ec-border);min-width:max-content;
}
[data-toantin-tool="equation_composer"] .ec-full-format-btn{
  width:34px;height:34px;min-width:34px;padding:0;border-radius:8px;border-color:#d7e4f3;background:#fff;color:#173b73;box-shadow:none;font-weight:800;
}
[data-toantin-tool="equation_composer"] .ec-full-format-btn:hover,
[data-toantin-tool="equation_composer"] .ec-full-format-btn:focus-visible{
  border-color:#74a9f5;background:#edf5ff;color:#0d5bef;box-shadow:0 0 0 2px rgba(13,91,239,.11);
}
[data-toantin-tool="equation_composer"] .ec-format-italic{font-family:Georgia,"Times New Roman",serif;font-style:italic}
[data-toantin-tool="equation_composer"] .ec-format-roman{font-family:Georgia,"Times New Roman",serif;font-weight:600}
[data-toantin-tool="equation_composer"] .ec-full-font-size{
  width:78px;min-height:34px;padding-top:.2rem;padding-bottom:.2rem;border-color:#d7e4f3;border-radius:8px;background-color:#fff;color:#173b73;font-weight:750;box-shadow:none;
}
[data-toantin-tool="equation_composer"] .ec-full-font-size:focus{border-color:#74a9f5;box-shadow:0 0 0 2px rgba(13,91,239,.11)}
@media(max-width:1100px){
  [data-toantin-tool="equation_composer"] .ec-full-commandbar{grid-template-columns:auto minmax(0,1fr)}
  [data-toantin-tool="equation_composer"] .ec-full-format-strip{grid-column:1 / -1;order:3;border-right:0;border-top:1px solid var(--ec-border);padding:6px 0 0;overflow-x:auto}
}
@media(max-width:640px){
  [data-toantin-tool="equation_composer"] .ec-full-format-strip{gap:4px}
  [data-toantin-tool="equation_composer"] .ec-full-format-btn{width:40px;height:40px;min-width:40px}
  [data-toantin-tool="equation_composer"] .ec-full-font-size{min-height:40px;width:86px}
}

/* ========================================================================== 
   V2.6.0 / B02-06 — Optical Symbol Enlargement & Density Polish
   Owner visual audit: architecture stays locked; glyphs must use more of the
   existing flat cell, family by family, without increasing palette height.
   ========================================================================== */
[data-toantin-tool="equation_composer"]{
  --ec-symbol-glyph-w:41px;
  --ec-symbol-glyph-h:34px;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile{
  padding:0;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile .ec-math-preview-svg{
  width:var(--ec-symbol-glyph-w);
  height:var(--ec-symbol-glyph-h);
}
/* Horizontal arrows benefit from the full optical width of the cell; vertical
   and diagonal arrows keep their natural proportions from the SVG renderer. */
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile .ec-math-preview[data-optical-family="arrow"] .ec-math-preview-svg{
  width:41px;
  height:35px;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile .ec-math-preview[data-optical-family="relation"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile .ec-math-preview[data-optical-family="set"] .ec-math-preview-svg,
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile .ec-math-preview[data-optical-family="logic"] .ec-math-preview-svg{
  width:40px;
  height:35px;
}
[data-toantin-tool="equation_composer"] .ec-palette-section{padding-top:5px;margin-top:4px}
[data-toantin-tool="equation_composer"] .ec-palette-section-title{margin-bottom:3px}
@media(min-width:1200px){
  [data-toantin-tool="equation_composer"]{--ec-symbol-glyph-w:40px;--ec-symbol-glyph-h:34px}
}
@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"]{--ec-symbol-glyph-w:42px;--ec-symbol-glyph-h:35px}
}
@media(pointer:coarse){
  [data-toantin-tool="equation_composer"]{--ec-symbol-glyph-w:43px;--ec-symbol-glyph-h:36px}
}

/* ========================================================================== 
   V2.7.0 / B02-07 — Family-specific Tile & Preview Normalization
   Long formula previews must never be forced into 42px symbol cells. Arrow
   families now receive their catalog metadata so optical scaling works as
   designed; log templates get a larger recognition preview without bloating
   the whole palette.
   ========================================================================== */
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-formula-chip-grid{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:5px;
  grid-template-columns:none;
  grid-auto-rows:auto;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-formula-chip-grid .ec-formula-chip{
  width:76px;
  min-width:76px;
  height:46px;
  min-height:46px;
  padding:1px 4px;
  border-radius:8px;
  overflow:hidden;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-formula-chip-grid .ec-formula-chip[data-catalog-id="stat-covariance"],
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-formula-chip-grid .ec-formula-chip[data-catalog-id="stat-correlation"]{
  width:94px;
  min-width:94px;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-formula-chip-grid .ec-formula-chip[data-catalog-id="stat-normal"],
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-formula-chip-grid .ec-formula-chip[data-catalog-id="stat-binomial-dist"]{
  width:88px;
  min-width:88px;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-formula-chip-grid .ec-formula-chip .ec-math-preview-svg{
  width:100%;
  height:36px;
  max-width:none;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-log-template-grid{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:6px;
  grid-template-columns:none;
  grid-auto-rows:auto;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-log-template-grid .ec-icon-btn{
  flex:0 0 auto;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-log-template-grid .ec-log-template-tile{
  width:72px;
  min-width:72px;
  height:54px;
  min-height:54px;
  padding:1px;
}
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-log-template-grid .ec-log-template-tile .ec-math-preview-svg{
  width:66px;
  height:40px;
}
/* B02-06 family rules now receive the real catalog category/section metadata.
   Give special arrow families the last few optical pixels available in the
   flat cell without changing cell geometry. */
[data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-symbol-grid .ec-symbol-tile .ec-math-preview[data-optical-family="arrow"] .ec-math-preview-svg{
  width:42px;
  height:37px;
}
@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"] .ec-palette-grouped .ec-formula-chip-grid .ec-formula-chip{min-height:48px;height:48px}
}

/* V2.7.1 B02-07 FIX01 — MathLive full-keyboard lease. The Host owns portal geometry/z-index;
   Equation Composer only guarantees its keyboard child remains interactive. */
[data-toantin-tool="equation_composer"] .ML__keyboard,
[data-ec-virtual-keyboard-portal="active"] > .ML__keyboard {
  pointer-events: auto;
  max-width: 100%;
  box-sizing: border-box;
}

/* V2.7.6 / B02-07 FIX05 — Tool-owned Full height and five-tab Word palette.
   This block intentionally follows legacy breakpoints so the workspace, rather
   than scattered min-height/max-height overrides, owns the sizing model. */
[data-toantin-tool="equation_composer"].ec-full-tool-v11{
  display:flex;
  flex-direction:column;
  block-size:100%;
  min-block-size:560px;
  max-inline-size:100%;
  min-inline-size:0;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-appbar,
[data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-commandbar,
[data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-statusbar{flex:0 0 auto;}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-workspace-v11{
  flex:1 1 auto;
  block-size:auto;
  min-block-size:420px;
  min-inline-size:0;
  grid-template-columns:minmax(0,1fr) minmax(286px,350px);
  align-items:stretch;
  grid-template-rows:minmax(0,1fr);
  width:100%;
  max-width:1920px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-editor-stage{
  min-block-size:0;
  block-size:100%;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-editor-stage > .ec-full-section{
  display:flex;
  flex-direction:column;
  flex:1 1 auto;
  min-block-size:0;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-section-body{
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
  min-block-size:0;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-stage-canvas{
  flex:1 1 auto;
  inline-size:100%;
  min-block-size:290px;
  block-size:100%;
  box-sizing:border-box;
  overflow:auto;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-editor-mount .ec-mathfield{
  max-inline-size:100%;
  min-block-size:clamp(175px,38vh,420px);
  box-sizing:border-box;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-context{
  align-self:stretch;
  block-size:100%;
  min-block-size:0;
  display:flex;
  flex-direction:column;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-context-tabs{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  flex:0 0 auto;
  gap:4px;
  overflow:visible;
  scrollbar-width:auto;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-context-tab{
  min-inline-size:0;
  min-block-size:38px;
  inline-size:100%;
  padding:5px 4px;
  white-space:normal;
  overflow-wrap:anywhere;
  line-height:1.2;
  font-size:.75rem;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-context-tab:focus-visible{
  outline:2px solid #1667e8;
  outline-offset:-2px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-context-panels{
  display:flex;
  flex-direction:column;
  min-block-size:0;
  flex:1 1 auto;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-context-panel{
  flex:1 1 auto;
  min-block-size:0;
  max-block-size:none;
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior-y:contain;
  scrollbar-width:thin;
  padding:10px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-catalog-heading{
  color:#163b73;
  margin:15px 0 8px;
  font-weight:700;
  font-size:.83rem;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-library-actions{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:5px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-library-actions .btn{
  white-space:normal;
  font-size:.75rem;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-catalog-filters{
  display:grid;
  grid-template-columns:1fr;
  gap:6px;
  position:relative;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-catalog-filters :is(select,input){
  min-width:0;
  max-width:100%;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-catalog-counter{
  display:block;
  padding:6px 0;
  font-size:.69rem;
  color:#657893;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-catalog-group{margin:11px 0 15px;}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-catalog-group-title{
  font-size:.76rem;
  font-weight:750;
  color:#315783;
  margin:0 0 6px;
  padding:0 0 5px;
  border-bottom:1px solid #e2ecfa;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-catalog-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(76px,1fr));
  gap:6px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-catalog-tile{
  width:100%;
  height:auto;
  min-height:70px;
  min-width:0;
  padding:6px 3px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:5px;
  line-height:1.2;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-catalog-preview{
  max-width:100%;
  min-height:26px;
  display:grid;
  place-items:center;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-catalog-caption{
  font-size:.68rem;
  color:#536b89;
  text-align:center;
  overflow-wrap:anywhere;
}
@media(max-width:991.98px){
  [data-toantin-tool="equation_composer"].ec-full-tool-v11{
    height:auto;
    min-height:0;
    max-height:none;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-workspace-v11{
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:auto auto;
    min-height:0;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-editor-stage,
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-context{height:auto;}
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-stage-canvas{
    height:auto;
    min-height:clamp(265px,40vh,490px);
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-context{
    min-height:320px;
    max-height:min(62vh,620px);
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-context-panel{
    max-height:none;
    min-height:0;
  }
}
@media(max-width:480px){
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-context{max-height:60vh;}
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-catalog-grid{
    grid-template-columns:repeat(auto-fill,minmax(69px,1fr));
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-context-tab{min-height:44px;font-size:.72rem;}
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-stage-canvas{min-height:250px;}
}

/* V2.7.7 / B02-07 FIX06 — approved compact Tool-only UI.
   E4 modal header/footer remain Host-owned. No global selectors. */
[data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-appbar{
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:10px;
  padding:6px 12px;
  min-height:52px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-brand{
  display:flex;align-items:center;min-width:38px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-brand-mark{
  width:38px;height:38px;flex:0 0 38px;border-radius:10px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-compact-tools{
  display:block;min-width:0;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-compact-tools > summary{
  display:none;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-compact-tool-group{
  display:flex;flex-wrap:nowrap;align-items:center;gap:7px;min-width:0;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-command-utility{
  display:flex;align-items:center;gap:3px;padding:0 7px 0 0;border-right:1px solid #d8e5f5;
  flex:0 0 auto;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-format-strip{
  display:flex;align-items:center;flex:0 0 auto;gap:3px;padding:0;border:0;
  min-width:0;max-width:100%;overflow:visible;grid-column:auto;order:initial;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-primary-actions{
  display:flex;align-items:center;justify-content:flex-end;gap:5px;flex-wrap:nowrap;
  width:auto;min-width:0;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-primary-actions .btn{
  width:auto;min-width:0;flex:0 0 auto;min-height:36px;padding-inline:10px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-commandbar{
  display:flex;align-items:flex-start;gap:9px;padding:5px 10px;min-width:0;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-quick-strip{
  display:flex;align-items:center;flex-wrap:wrap;gap:5px;
  min-width:0;flex:1 1 auto;padding:0;overflow:visible;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-quick-strip .ec-full-template-btn{
  display:grid;flex:0 0 48px;width:48px;height:44px;min-height:44px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-quick-strip .ec-full-template-btn:nth-child(n+9){display:grid;}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-command-secondary{
  display:flex;align-items:center;justify-content:flex-end;flex:0 0 auto;gap:4px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-command-secondary .ec-full-command-btn{
  width:42px;height:44px;min-height:44px;padding:0;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-statusbar .ec-full-draft-feedback{
  flex:0 1 auto;font-size:.73rem;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-draft-feedback[data-status="error"]{
  color:#b91c1c;font-weight:750;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-draft-feedback[data-status="saved"]{
  color:#166534;
}
@media(max-width:1199.98px){
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-appbar{
    grid-template-columns:auto minmax(0,1fr);gap:6px 10px;padding:7px 9px;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-primary-actions{
    grid-column:2;grid-row:1;justify-self:end;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-compact-tools{
    grid-column:1 / -1;grid-row:2;align-self:start;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-compact-tools > summary{
    display:list-item;list-style-position:inside;cursor:pointer;user-select:none;
    width:max-content;max-width:100%;padding:6px 10px;border:1px solid #d8e5f5;border-radius:8px;
    background:#f4f8ff;color:#163b73;font-size:.77rem;font-weight:700;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-compact-tools > summary:focus-visible{
    outline:2px solid #0d5bef;outline-offset:2px;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-compact-tools:not([open]) > .ec-full-compact-tool-group{display:none;}
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-compact-tool-group{
    flex-wrap:wrap;gap:8px;margin-top:7px;max-width:100%;
  }
}
@media(max-width:640px){
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-appbar{padding:6px 7px;gap:5px 7px;min-height:0;}
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-brand-mark{width:34px;height:34px;flex-basis:34px;}
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-primary-actions{display:flex;gap:3px;min-width:0;}
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-primary-actions .btn{min-height:40px;padding-inline:6px;font-size:.75rem;}
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-compact-tool-group{align-items:flex-start;}
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-format-strip{flex-wrap:wrap;}
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-commandbar{padding:5px 6px;gap:5px;}
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-quick-strip .ec-full-template-btn{
    width:44px;height:44px;flex-basis:44px;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-command-secondary{flex-direction:column;gap:4px;}
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-command-secondary .ec-full-command-btn{width:44px;height:44px;}
}
@media(prefers-reduced-motion:reduce){
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-template-btn{transition:none;}
}


/* V2.7.8 / B02-07 FIX07 — Tool-owned scroll containment and non-destructive
   20-symbol Quick toolbar. FIX07 deliberately never styles Host modal parents. */
[data-toantin-tool="equation_composer"].ec-full-tool-v11{
  min-block-size:0;
  block-size:100%;
  max-block-size:100%;
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior-block:contain;
  overflow-anchor:none;
  scroll-padding-block-start:12px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-appbar{
  position:sticky;top:0;z-index:21;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-commandbar{
  position:sticky;
  top:var(--ec-full-appbar-height, 52px);
  z-index:20;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-brand{
  display:flex;align-items:center;gap:8px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-brand > .ec-full-command-btn{
  width:40px;height:40px;min-width:40px;flex:0 0 40px;
  border:1px solid #dce7f5;border-radius:10px;
  background:#fff;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-quick-strip{
  flex-wrap:wrap;
  align-content:flex-start;
  overflow:visible;
  gap:5px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-quick-strip .ec-full-template-btn:nth-child(n){
  display:grid;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-workspace-v11{
  min-block-size:0;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-editor-mount{
  overscroll-behavior:contain;
  scroll-margin-block-start:12px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-editor-mount .ec-mathfield{
  scroll-margin-block-start:12px;
}
@media(max-width:991.98px){
  [data-toantin-tool="equation_composer"].ec-full-tool-v11{
    min-block-size:0;block-size:100%;max-block-size:100%;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-workspace-v11{
    min-block-size:0;
  }
}
@media(max-width:640px){
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-commandbar{
    align-items:flex-start;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-quick-strip .ec-full-template-btn:nth-child(n){display:grid;}
}

/* Small screens retain every shortcut without stacking four toolbar rows above
   the editable canvas. Horizontal swipe/keyboard arrows expose the entire strip. */
@media(max-width:767.98px){
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-quick-strip{
    flex-wrap:nowrap;
    overflow-x:auto;
    overflow-y:hidden;
    overscroll-behavior-inline:contain;
    scrollbar-width:thin;
    touch-action:pan-x;
    scroll-padding-inline:8px;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-quick-strip .ec-full-template-btn:nth-child(n){
    display:grid;
    flex:0 0 44px;
  }
}

/* In a short tablet/mobile Host window, sticky chrome would cover the caret.
   Permit Tool-only vertical scrolling instead of stacking sticky rows above it. */
@media(max-width:991.98px){
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-appbar,
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-commandbar{
    position:relative;
    top:auto;
  }
}

/* The FIX05 one-row minmax(0,1fr) desktop grid must not collapse two stacked
   panels into the same short row at tablet width. Restore normal flow there. */
@media(max-width:991.98px){
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-workspace-v11{
    display:flex;
    flex-direction:column;
    flex:0 0 auto;
    block-size:auto;
    min-block-size:0;
    gap:10px;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-editor-stage{
    display:flex;
    flex-direction:column;
    flex:0 0 auto;
    block-size:auto;
    min-block-size:0;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-editor-stage > .ec-full-section{
    flex:0 0 auto;
    block-size:auto;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-stage-canvas{
    flex:0 0 auto;
    block-size:auto;
    min-block-size:250px;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-context{
    flex:0 0 auto;
    block-size:auto;
    min-block-size:320px;
    max-block-size:520px;
  }
}

/* V2.7.9 / B02-07 FIX08 — Tool-only, responsive single-row math shortcut rail.
   At browser zoom/Host-constrained widths, flex-wrap caused the last two icons
   to drop underneath the first 18 and consume formula-authoring height.
   Keep all 20 controls accessible: compact 44px touch targets; scroll *inside*
   the rail only when even this safe width cannot fit. Host modal geometry is
   intentionally untouched. */
[data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-commandbar{
  align-items:center;
  min-inline-size:0;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-quick-strip{
  display:flex;
  flex:1 1 auto;
  min-inline-size:0;
  max-inline-size:100%;
  flex-wrap:nowrap;
  align-content:center;
  align-items:center;
  gap:4px;
  overflow-x:auto;
  overflow-y:hidden;
  overscroll-behavior-inline:contain;
  scroll-padding-inline:8px;
  scrollbar-width:thin;
  scrollbar-color:#a2bbdb transparent;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-quick-strip .ec-full-template-btn:nth-child(n){
  display:grid;
  flex:0 0 44px;
  inline-size:44px;
  block-size:44px;
  min-block-size:44px;
  box-sizing:border-box;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-command-secondary{
  align-self:center;
  flex:0 0 auto;
}
@media(max-width:640px){
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-commandbar{
    align-items:center;
  }
}

/* FIX08: overflow-only scroll arrows and tactile single-row shortcut rail. */
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-quick-rail{
  display:flex;align-items:center;gap:3px;flex:1 1 auto;min-inline-size:0;max-inline-size:100%;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-quick-rail .ec-full-quick-strip{
  flex:1 1 auto;min-inline-size:0;max-inline-size:100%;touch-action:pan-x;
  -webkit-overflow-scrolling:touch;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-rail-arrow{
  display:none;flex:0 0 30px;inline-size:30px;block-size:44px;
  border:1px solid #dbe5f4;border-radius:9px;background:#f2f7ff;
  color:#143d7a;font-size:25px;font-weight:650;line-height:1;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-rail-overflowing .ec-full-rail-arrow{display:inline-flex;align-items:center;justify-content:center;}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-rail-arrow:disabled{opacity:.35;cursor:default;}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-rail-arrow:focus-visible{
  outline:3px solid #3b82f6;outline-offset:1px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-rail-dragging .ec-full-quick-strip,
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-rail-dragging .ec-full-template-btn{
  cursor:grabbing;user-select:none;
}
/* A compact dialog needs real vertical scroll distance for wheel-over-editor.
   Keep vertical scrolling inside the Tool instead of stealing the Host modal. */
@media(min-width:992px){
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-workspace-v11{
    min-block-size:520px;
  }
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-editor-mount,
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-stage-canvas{
  overscroll-behavior-y:auto;
}
@media(max-width:991.98px){
  [data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-commandbar{
    position:sticky;top:0;z-index:20;
  }
}


/* V2.7.10 / B02-07 FIX09 — E4 wheel + sticky-scroll ownership correction.
   Root scrolling from FIX07/FIX08 was isolated from the Host's scrollport:
   scrolling the E4 body moved the entire editor (toolbar included) while a
   wheel gesture over the MathLive field could be exhausted by nested scroll.
   In embedded mode keep the FULL Tool in normal block flow, with no second
   root scrollport. Both Tool-owned appbar and canonical math rail can now
   stick to the nearest scrollport naturally, including the Host-provided one.
   No Host selector, z-index escape, global CSS, or Host scroll mutation.
   Standalone intentionally retains the existing internal scroll contract. */
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-scroll-strategy="host-flow"] {
  block-size:auto;
  min-block-size:100%;
  max-block-size:none;
  overflow:visible;
  overscroll-behavior:auto;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-scroll-strategy="host-flow"] > .ec-full-appbar {
  position:sticky;
  top:0;
  z-index:21;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-scroll-strategy="host-flow"] > .ec-full-commandbar {
  position:sticky;
  top:var(--ec-full-appbar-height, 52px);
  z-index:20;
}
/* FIX07's short-window rule intentionally disabled sticky below 992px;
   hosted scroll MUST still keep both rows accessible on tablet/mobile. */
@media(max-width:991.98px) {
  [data-toantin-tool="equation_composer"].ec-full-tool-v11[data-scroll-strategy="host-flow"] > .ec-full-appbar,
  [data-toantin-tool="equation_composer"].ec-full-tool-v11[data-scroll-strategy="host-flow"] > .ec-full-commandbar {
    position:sticky;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11[data-scroll-strategy="host-flow"] > .ec-full-appbar { top:0; }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11[data-scroll-strategy="host-flow"] > .ec-full-commandbar { top:var(--ec-full-appbar-height, 52px); }
}
/* Keep scroll-into-view targets clear of the two Tool-owned sticky rows.
   This margin is local to Equation Composer; it does not style Host scrollports. */
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-scroll-strategy="host-flow"] .ec-full-editor-mount,
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-scroll-strategy="host-flow"] .ec-full-editor-mount .ec-mathfield {
  scroll-margin-block-start:calc(var(--ec-full-appbar-height, 52px) + 64px);
}

/* V2.7.11 / B02-07 FIX10 — Owner-approved SINGLE sticky math toolbar.
   The appbar (logo, format, TeX, Save) intentionally scrolls away, while the
   already separate canonical 20-item rail + MathLive fx toolbar remains pinned
   to the TOP OF THE TOOL SCROLLPORT. Embedded mode uses the Host-provided
   scrollport, standalone uses its existing internal scrollport. Neither mode
   changes Host modal/header/footer geometry or touches Host CSS/DOM. */
[data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-appbar,
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-scroll-strategy="host-flow"] > .ec-full-appbar {
  position:relative;
  top:auto;
  z-index:1;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11 > .ec-full-commandbar,
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-scroll-strategy="host-flow"] > .ec-full-commandbar {
  position:sticky;
  top:0;
  z-index:20;
}
/* Once scrolled, keyboard caret focus must remain below the ONE pinned row. */
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-editor-mount,
[data-toantin-tool="equation_composer"].ec-full-tool-v11 .ec-full-editor-mount .ec-mathfield,
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-scroll-strategy="host-flow"] .ec-full-editor-mount,
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-scroll-strategy="host-flow"] .ec-full-editor-mount .ec-mathfield {
  scroll-margin-block-start:64px;
}

/* V2.7.14 / E4-FIX08-T: opt-in right-panel collapse via public mountSurface options.
   All rules are scoped to the Tool + an explicitly enabled surface; no Host
   modal/scroll container selectors and no changes to normal standalone UX. */
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-context-panel-toggle="on"] .ec-full-context {
  min-inline-size:0;
}
@media (min-width:992px){
  /* Bound the palette's scrollport when opt-in, even in a tall Host-flow
     modal. The five tab bodies continue to scroll vertically in place. */
  [data-toantin-tool="equation_composer"].ec-full-tool-v11[data-context-panel-toggle="on"][data-context-panel-collapsed="false"] .ec-full-context {
    max-block-size:min(80vh,760px);
  }
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-context-panel-toggle="on"] .ec-context-toggle-controls {
  display:flex;
  justify-content:flex-end;
  padding:5px 6px;
  border-bottom:1px solid #dce6f6;
  background:#f6f9ff;
  flex:0 0 auto;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-context-panel-toggle="on"] .ec-context-toggle {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  inline-size:40px;
  block-size:40px;
  min-inline-size:40px;
  min-block-size:40px;
  padding:0;
  color:#17447d;
  border:1px solid #abc8ed;
  background:#fff;
  border-radius:9px;
  font-size:1.35rem;
  line-height:1;
  cursor:pointer;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-context-panel-toggle="on"] .ec-context-toggle:focus-visible {
  outline:3px solid #1671ec;
  outline-offset:2px;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-context-panel-toggle="on"] .ec-context-panel-content {
  display:flex;
  flex-direction:column;
  flex:1 1 auto;
  min-block-size:0;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-context-panel-toggle="on"] .ec-context-panel-content[hidden] {display:none;}
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-context-panel-toggle="on"] .ec-context-collapsed-label {display:none;}
@media (min-width:992px){
  [data-toantin-tool="equation_composer"].ec-full-tool-v11[data-context-panel-toggle="on"][data-context-panel-collapsed="true"] .ec-full-workspace-v11 {
    grid-template-columns:minmax(0,1fr) 54px;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11[data-context-panel-toggle="on"][data-context-panel-collapsed="true"] .ec-full-context {
    inline-size:54px;
    min-inline-size:54px;
    max-inline-size:54px;
    block-size:100%;
    min-block-size:0;
    overflow:hidden;
  }
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-context-panel-toggle="on"][data-context-panel-collapsed="true"] .ec-context-toggle-controls {
  padding-inline:6px;
  justify-content:center;
}
[data-toantin-tool="equation_composer"].ec-full-tool-v11[data-context-panel-toggle="on"][data-context-panel-collapsed="true"] .ec-context-collapsed-label {
  display:block;
  padding:12px 0;
  margin-inline:auto;
  writing-mode:vertical-rl;
  font-size:.73rem;
  font-weight:700;
  color:#42658d;
  user-select:none;
}
@media (max-width:991.98px){
  /* On small screens, the collapsed sidebar becomes a compact full-width rail
     after the editor. It never creates a 54px strip beside a narrow mathfield. */
  [data-toantin-tool="equation_composer"].ec-full-tool-v11[data-context-panel-toggle="on"][data-context-panel-collapsed="true"] .ec-full-workspace-v11 {
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:auto 52px;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11[data-context-panel-toggle="on"][data-context-panel-collapsed="true"] .ec-full-context {
    block-size:52px;
    min-block-size:52px;
    max-block-size:52px;
    overflow:hidden;
  }
  [data-toantin-tool="equation_composer"].ec-full-tool-v11[data-context-panel-toggle="on"][data-context-panel-collapsed="true"] .ec-context-collapsed-label {display:none;}
  [data-toantin-tool="equation_composer"].ec-full-tool-v11[data-context-panel-toggle="on"][data-context-panel-collapsed="true"] .ec-context-toggle-controls {
    justify-content:flex-end;
    border-bottom:none;
  }
}
