.text-format-popup{display:flex;align-items:center;gap:3px;padding:8px 24px;border-block:1px solid var(--line,#ded7e7);background:var(--surface,#faf9fd);color:var(--text,#302b3b);flex-wrap:wrap}
.text-format-dock{position:static;flex:none;max-height:120px;overflow:auto;min-width:0}
.text-format-dock.is-inactive{visibility:hidden;pointer-events:none}
.text-format-popup[hidden]{display:none}.text-format-popup button{height:30px;min-width:28px;border:0;border-radius:7px;background:transparent;color:inherit;cursor:pointer;font-size:13px}.text-format-popup button:hover{background:var(--accent-light,#e9e0f1)}.text-format-popup select{height:29px;max-width:65px;border:0;border-radius:6px;background:transparent;color:inherit;font:11px inherit}.text-format-popup input[type=color]{border:0;width:25px;height:25px;padding:2px;background:transparent}.text-format-popup button:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.note-link-confirm-dialog{width:min(440px,calc(100vw - 32px))}.note-link-address{display:grid;gap:9px;padding:15px;border:1px solid var(--line);border-radius:13px;background:var(--surface-alt);overflow:auto;max-height:160px}.note-link-address strong{font-size:15px}.note-link-address span{font-size:12px;line-height:1.7;color:var(--secondary);overflow-wrap:anywhere}
:root:is([data-theme=glass],[data-theme=custom]) :is(.text-format-popup,.note-link-confirm-dialog,.history-dialog){background:linear-gradient(125deg,#ffffffc7,#ffffff8c),var(--surface);border-color:#fff9;backdrop-filter:blur(35px) saturate(150%);box-shadow:inset 0 1px #fffd,0 16px 55px #42315624}
.history-row{display:flex;width:100%;gap:15px;align-items:center;justify-content:space-between;padding:12px 4px;border-bottom:1px solid var(--line)}.history-row strong{font-size:12px}.history-row small{color:var(--muted);font-size:11px}.history-preview{white-space:pre-wrap;max-height:230px;overflow:auto;background:var(--surface-alt);border-radius:12px;padding:16px;margin:15px 0;font-size:13px;line-height:1.8}.document-flow :is(span,a){text-decoration-skip-ink:auto}.tool-draw{font-size:18px}

.drawing-size-fields{display:flex;gap:12px;align-items:center;flex-wrap:wrap}.drawing-size-fields label{font-size:12px;color:var(--muted)}.drawing-size-fields input{width:90px;border:1px solid var(--line);border-radius:8px;background:var(--surface-alt);color:var(--text);padding:9px}.sync-status-host{width:100%;margin-top:12px}.workspace-footer{flex-wrap:wrap}.sync-detail{max-width:580px}
.workspace{display:flex;flex-direction:column;overflow:hidden}
.workspace-top{flex:none}
.workspace-content{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:0 1px;scrollbar-gutter:stable}
.workspace-footer{flex:none;margin-top:auto;padding-bottom:max(18px,env(safe-area-inset-bottom))}
@media(max-height:600px){.workspace-footer{padding-top:8px;padding-bottom:max(10px,env(safe-area-inset-bottom))}.sync-status-host{margin-top:8px}.sync-detail{padding:10px 14px;gap:4px}}
.editor-tools{overflow-x:auto;max-width:100%;min-width:0}.editor-bottom{gap:10px}

/* A steady workspace: each preview occupies one equal grid cell. */
.notes-grid{align-items:stretch}
.notes-grid:not(.list)>.note-card,.card-drag-ghost{display:flex;flex-direction:column;height:284px;min-height:284px;max-height:284px;padding:18px 18px 10px;gap:0}
.notes-grid:not(.list)>.note-card h3,.card-drag-ghost h3{-webkit-line-clamp:2;font-size:14px;line-height:1.5;margin:3px 38px 9px 0;flex:none;max-height:42px}
.notes-grid:not(.list)>.note-card .card-body,.card-drag-ghost .card-body{flex:1;min-height:0;max-height:none;-webkit-line-clamp:6;margin:0;line-height:1.75;overflow:hidden}
.notes-grid:not(.list)>.note-card:has(.card-image,.card-video) .card-body{-webkit-line-clamp:2;max-height:42px}
.notes-grid:not(.list)>.note-card :is(.card-image,.card-video),.card-drag-ghost :is(.card-image,.card-video){height:94px;min-height:94px;max-height:94px;width:calc(100% + 36px);margin:-18px -18px 10px;object-fit:cover;flex:none}
.notes-grid:not(.list)>.note-card .card-checklist{flex:1;min-height:0;overflow:hidden;max-height:128px}
.notes-grid:not(.list)>.note-card .card-labels{flex:none;flex-wrap:nowrap;max-height:22px;margin-top:7px;overflow:hidden}
.notes-grid:not(.list)>.note-card .reminder-chip{flex:none;max-height:24px;margin-top:7px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.notes-grid:not(.list)>.note-card .card-footer,.card-drag-ghost .card-footer{flex:none;margin-top:auto;padding-top:9px;width:100%;min-height:32px}
.notes-grid.list>.note-card{height:112px;min-height:112px;max-height:112px}
.note-card[data-reorderable]{user-select:none;touch-action:pan-y}
.card-drag-handle{position:absolute;right:43px;top:10px;z-index:3;width:28px;height:30px;display:grid;place-items:center;border-radius:9px;opacity:0;color:inherit;background:#ffffff68;font-size:21px;line-height:1;cursor:grab;touch-action:none}
.note-card:hover .card-drag-handle,.note-card:focus-within .card-drag-handle{opacity:.7}
.card-drag-handle:focus-visible{opacity:1;outline:2px solid currentColor;outline-offset:1px}
.card-moving{opacity:.28}.note-card.drop-before{box-shadow:inset 4px 0 var(--accent),0 0 0 2px var(--accent-light)}.note-card.drop-after{box-shadow:inset -4px 0 var(--accent),0 0 0 2px var(--accent-light)}
.notes-grid.list .drop-before{box-shadow:inset 0 4px var(--accent)}.notes-grid.list .drop-after{box-shadow:inset 0 -4px var(--accent)}
.card-drag-ghost{position:fixed;z-index:100000;pointer-events:none;box-shadow:0 22px 64px #21143140;opacity:.95;transform:rotate(1deg);margin:0}
.reordering-notes,.reordering-notes *{cursor:grabbing!important}.reordering-notes .note-card:hover{transform:none}
/* App-owned popovers share theme, glass, keyboard navigation and dismissal. */
.editor-select{display:inline-flex;min-width:0;position:relative}
.editor-select-trigger{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:32px;border:1px solid var(--line);border-radius:9px;background:var(--surface-alt);padding:5px 10px;color:var(--text);font-size:12px;white-space:nowrap}
.editor-select-trigger:hover{background:var(--accent-light);color:var(--accent-text)}
.editor-control-popover{position:fixed;inset:auto;margin:0;min-width:140px;max-width:calc(100vw - 16px);max-height:min(420px,calc(100dvh - 16px));overflow:auto;padding:6px;border:1px solid var(--line);border-radius:14px;background:var(--surface);color:var(--text);box-shadow:0 12px 36px #21143124;font:12px/1.5 Inter,'Segoe UI',sans-serif;z-index:100;overscroll-behavior:contain}
.editor-control-popover::backdrop{background:transparent}
.editor-control-popover [role=option]{display:flex;align-items:center;justify-content:space-between;width:100%;text-align:left;padding:9px 11px;border-radius:9px;min-height:36px;background:transparent;color:inherit;border:0;font:inherit;cursor:pointer}
.editor-control-popover [role=option][aria-selected=true]{background:var(--accent-light);color:var(--accent-text)}
.editor-control-popover [role=option][aria-selected=true]::after{content:'✓';margin-left:16px}
.editor-control-popover [role=option]:hover,.editor-control-popover [role=option]:focus-visible{outline:0;background:var(--field)}
:root:is([data-theme=glass],[data-theme=custom]) .editor-control-popover{background:linear-gradient(125deg,#ffffffcc,#ffffff99),var(--surface);backdrop-filter:blur(36px) saturate(145%);border-color:#fff9;box-shadow:inset 0 1px #fff,0 14px 44px #2e1b4b24}
.editor-color-swatch{display:block;width:18px;height:18px;border-radius:5px;box-shadow:inset 0 0 0 1px #0002}
.editor-control-popover.editor-color-popover{width:224px;padding:13px;overflow:visible}
.editor-color-presets{display:grid;grid-template-columns:repeat(8,1fr);gap:5px;margin-bottom:12px}
.editor-color-presets button{padding:0;min-width:0;width:20px;height:20px;border-radius:50%;border:1px solid #7773;cursor:pointer}
.editor-color-square{height:135px;position:relative;border-radius:8px;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,transparent);touch-action:none;cursor:crosshair;outline-offset:3px}
.editor-color-square i{position:absolute;width:10px;height:10px;transform:translate(-50%,-50%);border:2px solid #fff;border-radius:50%;box-shadow:0 0 0 1px #0005;pointer-events:none}
.editor-color-hue{appearance:none;width:100%;height:10px;border-radius:20px;background:linear-gradient(to right,red,#ff0,#0f0,cyan,#00f,#f0f,red);margin:15px 0 11px;cursor:pointer}
.editor-color-hue::-webkit-slider-thumb{appearance:none;width:15px;height:15px;border-radius:50%;border:3px solid #fff;box-shadow:0 0 0 1px #0003;background:transparent}
.editor-hex-field{display:flex;gap:10px;align-items:center;font-size:10px;color:var(--secondary)}
.editor-hex-field input{min-width:0;flex:1;border:1px solid var(--line);background:var(--field);color:var(--text);border-radius:8px;padding:7px 9px;font:12px ui-monospace,monospace}
/* Clear primary actions; less frequent note actions live in the named menu. */
.editor-dialog>.editor-bottom{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 15px;padding:10px 20px}
.editor-tools{gap:5px;min-width:0}
.editor-tools :is(.tool-color,.tool-label,.tool-kind,.tool-separator){display:none}
.editor-tools .icon-button{gap:5px;padding:5px 8px;height:36px;min-width:34px;font-size:14px}
.editor-tool-caption{font-size:11px;font-weight:500;white-space:nowrap}
.editor-tools .media-wrap-picker{flex:none}
.editor-tools .media-wrap-picker>.editor-select-trigger{border:0;background:transparent;border-radius:9px;color:inherit}
.editor-tools .media-wrap-picker>.editor-select-trigger[aria-expanded=true]{background:var(--accent-light);color:var(--accent-text)}
.editor-tools .media-wrap-picker svg{width:17px;height:17px}
.editor-bottom>.editor-done{grid-column:2;grid-row:1}
.editor-tools{grid-column:1;grid-row:1}
.text-format-popup{gap:5px;padding:9px 22px;background:color-mix(in srgb,var(--surface) 85%,transparent)}
.text-format-popup button.editor-select-trigger{height:30px;border:1px solid var(--line);background:var(--surface-alt);padding:3px 9px}
.text-format-popup .editor-control-popover button{height:auto;font-size:12px}
.text-format-dock.is-inactive{visibility:visible;opacity:.34;pointer-events:none}
.text-format-popup .editor-color-presets button{width:20px;height:20px;min-width:20px;padding:0}
.text-format-popup .editor-control-popover .editor-hex-field input{max-width:160px}
@media(max-width:760px){.notes-grid:not(.list)>.note-card{height:264px;min-height:264px;max-height:264px}.notes-grid:not(.list)>.note-card :is(.card-image,.card-video){height:84px;min-height:84px;max-height:84px}.card-drag-handle{opacity:.55}.editor-tools .icon-button{padding:4px 6px}.editor-tool-caption{font-size:10px}.editor-dialog>.editor-bottom{padding:11px 14px;gap:8px}.text-format-popup{padding:8px 14px;gap:4px}}
@media(max-width:480px){.editor-tools .icon-button{width:34px;padding:4px}.editor-tool-caption{display:none}.notes-grid:not(.list)>.note-card{height:250px;min-height:250px;max-height:250px}.editor-dialog>.editor-bottom{gap:8px}.editor-bottom>.editor-done{min-height:34px;padding:8px 12px}}
@media(prefers-reduced-motion:reduce){.note-card,.editor-select-trigger{transition:none}}

.text-format-group{display:inline-flex;align-items:center;gap:2px;flex:none}
.text-format-popup{column-gap:10px;row-gap:5px}
@media(max-width:480px){.text-format-popup{column-gap:5px;padding:8px 12px}.text-format-popup button.editor-select-trigger{padding:3px 5px;min-width:30px}.text-format-popup button:not(.editor-select-trigger){min-width:27px}}
