.app-context-menu { position:fixed; z-index:1000; width:224px; max-width:calc(100vw - 16px); max-height:calc(100dvh - 16px); overflow-y:auto; padding:6px; border:1px solid #e2e8f0; border-radius:10px; background:#fff; color:#334155; box-shadow:0 12px 40px #0f172a26; font:13px/1.6 "Segoe UI","Microsoft YaHei",sans-serif; }
.context-menu-title { padding:7px 10px 9px; margin-bottom:4px; border-bottom:1px solid #f1f5f9; font-size:11px; color:#94a3b8; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.app-context-menu button { display:block; width:100%; padding:8px 10px; border:0; border-radius:6px; background:transparent; text-align:left; font:inherit; color:inherit; cursor:pointer; }
.app-context-menu button:hover,.app-context-menu button:focus-visible { background:#eff6ff; color:#2563eb; outline:none; }
.app-context-menu button:disabled { color:#cbd5e1; cursor:default; background:transparent; }
.app-context-menu button.context-danger { color:#dc2626; }
.context-menu-divider { height:0; border:0; border-top:1px solid #e2e8f0; margin:5px 4px; pointer-events:none; }
.app-context-menu button.context-danger:hover,.app-context-menu button.context-danger:focus-visible { background:#fef2f2; color:#b91c1c; }
.context-menu-group[data-tone] { padding:2px 3px; border-left:3px solid var(--context-accent); border-radius:6px; background:var(--context-tint); }
.context-menu-group[data-tone="navigation"] { --context-accent:#60a5fa; --context-tint:#eff6ff; --context-hover:#dbeafe; --context-ink:#1e40af; }
.context-menu-group[data-tone="strategy"] { --context-accent:#c084fc; --context-tint:#faf5ff; --context-hover:#f3e8ff; --context-ink:#6b21a8; }
.context-menu-group[data-tone="edit"] { --context-accent:#2dd4bf; --context-tint:#f0fdfa; --context-hover:#ccfbf1; --context-ink:#115e59; }
.context-menu-group[data-tone="create"] { --context-accent:#4ade80; --context-tint:#f0fdf4; --context-hover:#dcfce7; --context-ink:#166534; }
.context-menu-group[data-tone="transfer"] { --context-accent:#fbbf24; --context-tint:#fffbeb; --context-hover:#fef3c7; --context-ink:#92400e; }
.context-menu-group[data-tone="hierarchy"] { --context-accent:#22d3ee; --context-tint:#ecfeff; --context-hover:#cffafe; --context-ink:#155e75; }
.context-menu-group[data-tone="status"] { --context-accent:#a5b4fc; --context-tint:#eef2ff; --context-hover:#e0e7ff; --context-ink:#3730a3; }
.context-menu-group[data-tone="danger"] { --context-accent:#f87171; --context-tint:#fef2f2; --context-hover:#fee2e2; --context-ink:#991b1b; }
.app-context-menu .context-menu-group[data-tone] button:not(:disabled):hover,.app-context-menu .context-menu-group[data-tone] button:not(:disabled):focus-visible { background:var(--context-hover); color:var(--context-ink); }
.app-context-menu .context-menu-group[data-tone] button:focus-visible { outline:2px solid var(--context-ink); outline-offset:-2px; }
.app-context-menu .context-menu-group[data-tone] button:disabled { color:#94a3b8; }
.workspace-shell .context-target { outline:2px solid #93c5fd; outline-offset:-2px; }
.workspace-shell .context-more { display:inline-flex; align-items:center; justify-content:center; border:0; background:transparent; color:#94a3b8; width:28px; height:28px; border-radius:6px; font-size:20px; line-height:1; flex-shrink:0; cursor:pointer; }
.workspace-shell .context-more:hover,.workspace-shell .context-more:focus-visible { color:#2563eb; background:#eff6ff; }
.task-card .task-quick-actions { display:flex; justify-content:space-between; align-items:center; margin-top:12px; }
.mind-node .mind-node-actions .context-more { font-size:16px; width:22px; height:22px; }
@media(pointer:fine) {
  .task-card .context-more,.mind-node-actions .context-more,.gantt-label-row .context-more,.task-tree-table .context-more { opacity:0; }
  .task-card:hover .context-more,.mind-node:hover .context-more,.gantt-label-row:hover .context-more,.task-tree-table tr:hover .context-more,
  .task-card:focus-within .context-more,.mind-node:focus-within .context-more,.gantt-label-row:focus-within .context-more,.task-tree-table tr:focus-within .context-more { opacity:1; }
}

/* Editors open at the context menu's position, within the viewport. */
.app-context-form{position:fixed;z-index:1001;width:320px;max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);overflow:auto;box-sizing:border-box;padding:18px;border:1px solid #dee5ef;border-radius:16px;background:#fff;color:#334155;box-shadow:0 14px 45px #182b4329;font:13px/1.6 "Segoe UI","Microsoft YaHei",sans-serif}.app-context-form h3{margin:0 0 6px;font-size:15px;font-weight:600}.context-form-description{margin:0 0 14px;color:#8491a3;font-size:11px;overflow-wrap:anywhere}.app-context-form>label{display:flex;flex-direction:column;gap:6px;margin:12px 0;color:#65748a;font-size:12px}.app-context-form input:not([type=checkbox]),.app-context-form select,.app-context-form textarea{box-sizing:border-box;width:100%;padding:9px 10px;border:1px solid #dce3ed;border-radius:9px;font:inherit;color:#24364d;background:#fbfcfe;min-width:0}.app-context-form textarea{min-height:90px;resize:vertical}.app-context-form input:focus,.app-context-form select:focus,.app-context-form textarea:focus{outline:2px solid #b7ccff;outline-offset:1px;background:#fff}.app-context-form .context-form-checks{margin:12px 0;border:0;padding:0;min-width:0}
.app-context-form .context-form-checks legend{font-size:12px;color:#65748a;margin-bottom:7px;max-width:100%;overflow-wrap:anywhere}
.app-context-form .context-form-check-options{max-height:230px;overflow-y:auto;overflow-x:hidden;min-width:0}
.app-context-form .context-form-checks label{display:flex;flex-direction:row;align-items:flex-start;gap:8px;min-width:0;margin:0;padding:6px 8px;border-radius:6px;cursor:pointer;line-height:1.5}
.app-context-form .context-form-checks label:hover{background:#f3f6fc}
.app-context-form .context-form-checks label:has(input:checked){background:#eef4ff}
.app-context-form .context-form-checks label>span{flex:1;min-width:0;white-space:normal;overflow-wrap:anywhere}
.app-context-form .context-form-checks input[type=checkbox]{appearance:auto;box-sizing:border-box;width:14px;height:14px;min-width:14px;max-width:14px;flex:0 0 14px;padding:0;margin:2px 0 0;accent-color:#3867df}
.context-form-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px;padding-top:12px;border-top:1px solid #edf1f6}.context-form-actions button{font:inherit;padding:7px 16px;border:1px solid #e0e6ef;border-radius:8px;background:#fff;color:#67758b;cursor:pointer}.context-form-actions .context-form-primary{background:#3564df;border-color:#3564df;color:white}.context-form-actions button:disabled{opacity:.6;cursor:wait}.context-form-error{font-size:12px;color:#ba4242;margin:10px 0;overflow-wrap:anywhere}

.app-context-form.context-form-smart-rules{width:680px}
.context-form-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:14px;align-items:start}
.context-form-row>label{display:flex;flex-direction:column;gap:5px;margin:7px 0;color:#65748a;font-size:12px;min-width:0}
.context-form-smart-rules>label{margin:7px 0}
.context-form-smart-rules .context-form-description{margin-bottom:8px}
.context-form-smart-rules .context-form-actions{margin-top:10px}
@media(max-width:480px){.context-form-row{gap:8px}.app-context-form.context-form-smart-rules{padding:14px}.context-form-smart-rules select,.context-form-smart-rules input{padding:8px 6px;font-size:12px}}

/* Only contextual actions position dialogs beside the mouse. */
dialog[data-interaction-position]{position:fixed!important;inset:auto!important;margin:0!important;right:auto!important;bottom:auto!important;transform:none!important;max-height:var(--interaction-max-height,calc(100dvh - 16px))!important;max-width:calc(100vw - 16px)!important;overflow:auto;box-sizing:border-box}
dialog.interaction-dialog{width:340px;border:1px solid #dbe3ef;padding:18px;border-radius:10px;color:#334155;box-shadow:0 12px 40px #0f172a30}
dialog.interaction-dialog::backdrop{background:#0f172a12;backdrop-filter:none}
.interaction-dialog h2{font-size:15px;line-height:1.6;margin:0 0 12px;overflow-wrap:anywhere}
.interaction-dialog label{display:flex;flex-direction:column;gap:6px;font-size:12px;color:#64748b}
.interaction-dialog input{width:100%;box-sizing:border-box;margin:0;padding:8px 10px;font:inherit;border:1px solid #cbd5e1;border-radius:6px}
.interaction-dialog p{font-size:13px;line-height:1.7;margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
.interaction-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}
.interaction-actions button{padding:7px 14px;font-size:12px}

/* Toolbar and single-click forms use a stable, centered modal position. */
dialog.interaction-dialog:not([data-interaction-position]){position:fixed;inset:0;margin:auto;max-height:calc(100dvh - 24px);max-width:calc(100vw - 24px)}
