/* One document-menu contract retains the established sales appearance for every consumer. */
.document-topbar-actions{position:relative;display:flex;align-items:center;gap:8px;overflow:visible}
.document-topbar-menu{position:relative;flex:none}
.document-topbar-menu>summary{list-style:none}
.document-topbar-menu>summary::-webkit-details-marker{display:none}
.document-topbar-icon-action{display:grid!important;width:40px;min-width:40px;height:40px;min-height:40px;padding:0!important;color:var(--text-strong);place-items:center}
.document-topbar-icon-action .document-action-icon{fill:currentColor;stroke:none}
.document-topbar-popover{position:absolute;top:calc(100% + 8px);right:0;z-index:220;width:max-content;min-width:230px;max-width:min(320px,calc(100vw - 24px));padding:6px;border:1px solid var(--border);border-radius:9px;background:var(--surface);box-shadow:0 14px 34px color-mix(in srgb, var(--shadow-ink) 20%, transparent)}
.document-topbar-popover form{display:block}
.document-menu-action{display:flex;width:100%;min-height:38px;align-items:center;justify-content:flex-start;gap:9px;padding:8px 10px;border:0;border-radius:6px;background:var(--surface);color:var(--text-strong);box-shadow:none;font:inherit;font-size:11px;font-weight:700;text-align:left;text-decoration:none;white-space:normal;overflow-wrap:anywhere;cursor:pointer}
.document-menu-action:hover,.document-menu-action:focus-visible{background:var(--hover-surface);color:var(--link);box-shadow:none;transform:none}
.document-menu-action svg{display:block;flex:0 0 18px;width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

/* The shared disclosure glyph also renders on pages without commercial editor styles. */
.document-topbar-menu > summary > svg { display: block; width: 20px; height: 20px; }

/* Disabled actions keep their full row and accessible explanation without an active target. */
.document-topbar-popover .permission-action-disabled { display: block; width: 100%; }
.document-menu-action:disabled { color: var(--muted); cursor: not-allowed; }
.document-menu-action:disabled:hover { background: var(--surface); color: var(--muted); }

/* Anchor compact menus to the header so preceding actions cannot push labels off-screen. */
@media (max-width: 760px) {
    .topbar .document-topbar-actions,
    .topbar .document-topbar-menu { position: static; }
    .topbar .document-topbar-popover {
        top: calc(100% + 2px);
        right: 12px;
        max-height: calc(100dvh - 90px);
        overflow-y: auto;
    }
}

/* The menu reserves the same icon space for a status dot and a line icon. */
.document-status-dot {
    display: inline-grid;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    vertical-align: middle;
    place-items: center;
}
.document-status-dot::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--menu-status-colour, var(--muted));
}
.document-status-dot[data-status-tone="blue"] { --menu-status-colour: var(--document-status-blue-accent); }
.document-status-dot[data-status-tone="green"] { --menu-status-colour: var(--success-fill); }
.document-status-dot[data-status-tone="amber"] { --menu-status-colour: var(--warning-fill); }
.document-status-dot[data-status-tone="red"] { --menu-status-colour: var(--danger-fill); }

/* Frame the saved status colour only on the shared edit action, inside its existing icon slot. */
.document-menu-action[data-document-status-edit] .document-status-dot::before {
    grid-area: 1 / 1;
    width: 5px;
    height: 5px;
}

.document-menu-action[data-document-status-edit] .document-status-dot::after {
    content: "";
    grid-area: 1 / 1;
    box-sizing: border-box;
    width: 15px;
    height: 15px;
    border: 1px solid var(--text-strong);
    border-radius: 50%;
}
