.notes-formula-launcher { white-space: nowrap; }
.notes-formula-editor { position: fixed; z-index: 45; top: 82px; right: 16px; display: flex; flex-direction: column; width: min(860px, calc(100vw - 16px)); height: min(620px, calc(100dvh - 16px)); padding: 0 0 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); overflow: hidden; box-shadow: 0 12px 48px #0003; }
.notes-formula-bar { display: flex; flex: none; align-items: center; justify-content: space-between; height: 36px; border-bottom: 1px solid var(--line); font: 12px/1.5 var(--sans); }
.notes-formula-bar button { border: 0; background: transparent; color: inherit; height: 100%; padding: 0 12px; }
.notes-formula-bar .notes-formula-drag { flex: 1; text-align: left; cursor: move; touch-action: none; user-select: none; }
.notes-formula-frame { flex: 1; min-height: 0; overflow: auto; }
.notes-formula-status { margin: 0; padding: 12px 16px; font: 14px/1.6 var(--sans); }
.notes-formula-resize { position: absolute; right: 0; bottom: 0; width: 24px; height: 20px; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: nwse-resize; touch-action: none; }
.notes-formula-editor[data-manipulating] iframe { pointer-events: none; }
@media (max-width: 700px) {
  .site-header { height: auto; min-height: 66px; flex-wrap: wrap; padding-block: 8px; gap: 6px; }
  .header-actions { flex-wrap: wrap; gap: 5px; }
}
@media print { .notes-formula-launcher, .notes-formula-editor { display: none !important; } }
.notes-formula-launcher { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; }
.notes-formula-bar button:not(.notes-formula-drag) { display: inline-grid; place-items: center; flex: none; width: 36px; padding: 0; border-radius: 4px; }
.notes-formula-bar button:hover { background: var(--wash); }
.notes-formula-actions { position: fixed; z-index: 44; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; max-width: min(380px, calc(100vw - 16px)); padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--muted); box-shadow: 0 4px 20px #0002; font: 12px/1.5 var(--sans); }
.notes-formula-actions > button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: inherit; }
.notes-formula-actions > button:hover { background: var(--wash); color: var(--accent); }
.notes-formula-copy-status:not(:empty) { padding: 0 6px; }
.notes-formula-copy-source { flex: 1 0 100%; width: 100%; height: 100px; padding: 8px; border: 1px solid var(--line); border-radius: 4px; resize: vertical; font: 12px/1.5 monospace; color: var(--ink); background: var(--paper); }
[data-formula-actions]:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.notes-formula-selected { background-color: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 2px; }
.notes-formula-pending { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--line); font: 12px/1.5 var(--sans); color: var(--muted); }
.notes-formula-pending > span { flex: 1; }
.notes-formula-pending button { padding: 4px 8px; font-size: 12px; }
.notes-formula-pending button:last-child { border: 0; display: grid; place-items: center; padding: 4px; }
.notes-formula-saved { position: absolute; z-index: 2; top: 38px; right: 12px; width: min(320px, calc(100% - 24px)); max-height: min(300px, 70%); overflow: auto; padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); box-shadow: 0 5px 24px #0002; }
.notes-formula-saved > button { display: block; width: 100%; text-align: left; border: 0; padding: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-formula-editor[hidden], .notes-formula-actions[hidden], .notes-formula-pending[hidden], .notes-formula-saved[hidden], .notes-formula-copy-source[hidden] { display: none; }
@media print { .notes-formula-actions { display: none !important; } .notes-formula-selected { background: transparent; } }
