.popover-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    margin-left: var(--space-xs);
    border: 0;
    border-radius: var(--radius-pill);
    cursor: pointer;
    background: var(--color-primary-700);
    color: var(--color-surface);
    font-family: var(--font-family-ui);
    font-size: var(--type-caption-size);
    font-weight: var(--type-caption-weight);
    line-height: 1;
    vertical-align: middle;
    top: -2px;
}

.popover-trigger:hover {
    background: var(--color-primary-600);
}

.popover-trigger:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--color-primary-500) 30%, var(--color-surface));
    outline-offset: 2px;
}

/* Canonical heading/label info trigger shared by manager workspaces and Settings. */
.workspace-section-heading__title {
    align-items: center;
    display: flex;
    gap: var(--space-xs);
}

.workspace-section-heading__title h2 {
    margin: 0;
}

.workspace-section-help.popover-trigger {
    align-items: center;
    background: transparent;
    color: var(--color-primary-700);
    display: inline-flex;
    flex: 0 0 auto;
    height: 2.75rem;
    justify-content: center;
    margin: -0.75rem;
    top: auto;
    width: 2.75rem;
}

.workspace-section-help.popover-trigger:hover {
    background: transparent;
    color: var(--color-primary-600);
}

.workspace-section-help.popover-trigger:focus-visible {
    background: var(--color-primary-100);
    border-radius: var(--radius-pill);
    box-shadow: 0 0 0 0.1875rem color-mix(in srgb, var(--color-primary-500) 30%, var(--color-surface));
    outline: none;
}

.workspace-section-help .icon {
    height: 1.125rem;
    width: 1.125rem;
}

.popover {
    /* Local values keep each variant's arrow in sync with its surface. */
    --popover-background: var(--color-surface);
    --popover-border: var(--color-border);
    --popover-text: var(--color-text-primary);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10000;
    max-width: min(260px, calc(100vw - var(--space-md)));
    padding: var(--space-md);
    border: 1px solid var(--popover-border);
    border-radius: var(--radius-menu);
    background: var(--popover-background);
    color: var(--popover-text);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--color-text-primary) 20%, transparent);
    font-family: var(--font-family-ui);
    font-size: var(--type-body-small-size);
    font-weight: var(--type-body-small-weight);
    line-height: var(--type-body-small-line-height);
    overflow-wrap: anywhere;
}

/* Shared text-only help tooltips intentionally retain their dark surface. */
.popover--help {
    --popover-background: #111;
    --popover-border: #111;
    --popover-text: var(--color-surface);
}

.popover.is-hidden {
    display: none;
}

.popover__title {
    margin: 0 0 var(--space-xs);
    font-weight: var(--type-h3-weight);
    font-size: var(--type-body-small-size);
    line-height: var(--type-body-small-line-height);
}

.popover__caption {
    color: var(--color-text-secondary);
    font-size: var(--type-caption-size);
    line-height: var(--type-caption-line-height);
}

.popover--help .popover__caption {
    color: color-mix(in srgb, var(--color-surface) 78%, transparent);
}

.popover a:link,
.popover a:visited {
    color: var(--color-primary-700);
}

.popover a:hover {
    color: var(--color-primary-600);
}

.popover--help a:link,
.popover--help a:visited,
.popover--help a:hover {
    color: var(--color-primary-300);
}

.popover :is(a, button):focus-visible {
    outline: 3px solid var(--color-primary-300);
    outline-offset: 2px;
    border-radius: var(--radius-control);
}

.popover__arrow,
.popover__arrow::before {
    position: absolute;
    width: 10px;
    height: 10px;
}

.popover__arrow::before {
    content: '';
    display: block;
    transform: rotate(45deg);
    background: var(--popover-background);
    border: 1px solid var(--popover-border);
}

.popover[data-popper-placement^="top"] > .popover__arrow {
    bottom: -5px;
}

.popover[data-popper-placement^="bottom"] > .popover__arrow {
    top: -5px;
}

.popover[data-popper-placement^="left"] > .popover__arrow {
    right: -5px;
}

.popover[data-popper-placement^="right"] > .popover__arrow {
    left: -5px;
}

.popover[data-popper-placement^="top"] > .popover__arrow::before {
    border-top: 0;
    border-left: 0;
}

.popover[data-popper-placement^="bottom"] > .popover__arrow::before {
    border-bottom: 0;
    border-right: 0;
}

.popover[data-popper-placement^="left"] > .popover__arrow::before {
    border-bottom: 0;
    border-left: 0;
}

.popover[data-popper-placement^="right"] > .popover__arrow::before {
    border-top: 0;
    border-right: 0;
}
