.popover {
    position: relative;
}

.popover-inline {
    display: inline-block;
}

.popover-summary {
    list-style: none;
}

.popover-summary::-webkit-details-marker {
    display: none;
}

.popover-panel,
.actions-menu-panel {
    position: absolute;
    padding: 0.75rem;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.popover-panel {
    top: calc(100% + 0.35rem);
    border-radius: 10px;
    z-index: 20;
}

.popover-panel-left {
    left: 0;
    right: auto;
}

.popover-panel-above {
    top: auto;
    bottom: calc(100% + 0.35rem);
}

.popover-panel-center {
    left: 50%;
    transform: translateX(-50%);
}

.popover-panel-fill-width {
    min-width: 100%;
}

.popover-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.popover-actions-compact {
    margin-top: 0;
}

.actions-start {
    justify-content: flex-start;
}

.actions-end {
    justify-content: flex-end;
}

.actions-between {
    justify-content: space-between;
    align-items: center;
}

.actions-menu {
    position: relative;
    display: inline-block;
}

.actions-menu summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.actions-menu summary::-webkit-details-marker {
    display: none;
}

.actions-menu summary::after {
    content: "▾";
    margin-left: 0.4rem;
    font-size: 0.85em;
}

.actions-menu[open] summary::after {
    content: "▴";
}

.actions-menu-panel {
    right: 0;
    top: calc(100% + 0.5rem);
    min-width: 180px;
    padding: 0.5rem 0;
    border-radius: 8px;
    background: var(--bg);
    box-shadow: var(--shadow);
    z-index: 30;
}

.actions-menu-panel form,
.actions-menu-panel details {
    width: 100%;
    margin: 0;
}

.actions-menu-item {
    display: block;
    width: 100%;
    padding: 0.5rem 0.9rem;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    font: inherit;
    cursor: pointer;
}

.actions-menu-item:hover {
    background: var(--bg-secondary);
}

.actions-menu-item[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
}

.actions-menu-fill {
    width: 100%;
}

.date-range-dropdown-panel,
.runtime-filter-dropdown-panel {
    padding: 0.75rem;
}

.date-range-dropdown-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.date-range-dropdown-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.date-range-dropdown-field .field-label {
    margin-bottom: 0;
}

.runtime-filter-dropdown-panel .date-range-dropdown-fields {
    grid-template-columns: 1fr;
}

.duration-input {
    display: grid;
    grid-template-columns: minmax(1rem, 1fr) auto minmax(1rem, 1fr) auto minmax(1rem, 1fr);
    align-items: end;
    gap: 0.35rem;
}

.duration-input-segment {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.25rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.duration-input-segment .inline-input {
    color: var(--text);
    font-size: 1rem;
}

.duration-input-separator {
    padding-bottom: 0.5rem;
    font-weight: 600;
}

.date-range-dropdown-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.date-range-dropdown-preset {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--link, #2563eb);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.date-range-dropdown-preset:hover {
    text-decoration: none;
}

@media (max-width: 768px) {
    .actions-menu-panel,
    .popover-panel {
        position: static;
        margin-top: 0.5rem;
        min-width: 0;
        max-width: none;
        transform: none;
    }

    .date-range-dropdown-fields {
        grid-template-columns: 1fr;
    }

    .runtime-filter-dropdown-panel {
        min-width: 0;
    }
}
