/* Shared help tooltip trigger and viewport-safe tooltip portal. */
.metric-help {
    position: relative;
    display: inline-flex;
    width: 17px;
    height: 17px;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    color: var(--text-muted);
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
    background: var(--surface-primary);
    border: 1px solid var(--border-default);
    border-radius: 50%;
    cursor: help;
    outline: none;
    transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}
.metric-help:hover,
.metric-help:focus-visible,
.metric-help[aria-expanded="true"] {
    color: var(--text-primary);
    background: var(--surface-secondary);
    border-color: var(--border-strong);
}
.metric-help:focus-visible {
    box-shadow: 0 0 0 3px rgba(56, 103, 232, .12);
}

.ui-tooltip {
    position: fixed;
    z-index: 3200;
    width: max-content;
    max-width: min(320px, calc(100vw - 24px));
    padding: 9px 11px;
    color: var(--text-primary);
    background: var(--surface-primary);
    border: 1px solid var(--border-default);
    border-radius: 9px;
    box-shadow: var(--shadow-md);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.45;
    text-align: left;
    white-space: normal;
    pointer-events: none;
}
.ui-tooltip[hidden] { display: none; }
