/* PlexCache-D Web UI Custom Styles */

/* Log viewer - single scroll context for both axes */
.log-viewer {
    height: 500px;
    overflow: auto;
    background-color: var(--plex-bg-input);
    padding: 1rem;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 0.85em;
    line-height: 1.4;
}

.log-viewer code,
.log-viewer pre {
    background: none;
    padding: 0;
    white-space: pre;
    width: max-content;
    min-width: 100%;
}

/* Alert styles */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--plex-radius-sm);
    position: relative;
}

.alert-success {
    background-color: rgba(46, 204, 113, 0.1);
    border-left: 4px solid var(--plex-success);
}

.alert-error {
    background-color: rgba(231, 76, 60, 0.1);
    border-left: 4px solid var(--plex-error);
}

.alert-warning {
    background-color: rgba(243, 156, 18, 0.1);
    border-left: 4px solid var(--plex-warning);
}

.alert-info {
    background-color: rgba(52, 152, 219, 0.1);
    border-left: 4px solid var(--plex-info);
}

.alert .close {
    position: absolute;
    right: 0.5rem;
    top: 0.5rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.5;
}

.alert .close:hover {
    opacity: 1;
}

/* HTMX loading indicator */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline;
}

.htmx-request .button-text {
    display: none;
}

/* Path mapping cards */
.path-mapping {
    margin-bottom: 1rem;
}

.path-mapping dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
}

.path-mapping dt {
    font-weight: bold;
}

.path-mapping dd {
    margin: 0;
}

/* Small buttons */
button.small, .button.small {
    padding: 0.25rem 0.5rem;
    font-size: 0.85em;
}

/* Navigation current page indicator */
nav a[aria-current="page"] {
    font-weight: bold;
    border-bottom: 2px solid var(--plex-orange);
}

/* Settings tabs navigation */
article nav ul {
    display: flex;
    gap: 1rem;
    list-style: none;
    padding: 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--plex-border);
}

article nav ul li {
    margin: 0;
}

article nav ul li a {
    display: block;
    padding: 0.5rem 1rem;
    text-decoration: none;
}

article nav ul li a[aria-current="page"] {
    border-bottom: 2px solid var(--plex-orange);
    margin-bottom: -1px;
}

/* Footer styling */
footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--plex-border);
    text-align: center;
    opacity: 0.7;
}

/* Recent Activity scrollable container */
.recent-activity-scroll {
    max-height: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Thin subtle scrollbar for Chrome/Safari/Edge */
.recent-activity-scroll::-webkit-scrollbar {
    width: 6px;
}

.recent-activity-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.recent-activity-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.recent-activity-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Thin scrollbar for Firefox */
.recent-activity-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* Light theme scrollbar overrides */
[data-theme="light"] .recent-activity-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}
[data-theme="light"] .recent-activity-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.35);
}
[data-theme="light"] .recent-activity-scroll {
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* Keep table header sticky while scrolling */
.recent-activity-scroll table thead {
    position: sticky;
    top: 0;
    background: var(--plex-bg-card);
    z-index: 1;
}

/* Activity table column tweaks */
.activity-file-col {
    word-break: break-word;
    white-space: normal;
    min-width: 0;
}
.recent-activity-scroll table td:first-child {
    white-space: nowrap;
}

/* Associated files badge + expandable sub-rows */
.af-parent {
    cursor: pointer;
}
.associated-files-badge {
    margin-left: 0.375rem;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.15s ease;
}
.af-expanded .associated-files-badge {
    opacity: 0.5;
}
.associated-sub-row {
    display: none;
}
.associated-sub-row.af-visible {
    display: table-row;
}
.associated-sub-row td {
    padding-top: 0.1rem !important;
    padding-bottom: 0.1rem !important;
    border-bottom: none !important;
}
.associated-sub-row:hover td {
    background: transparent !important;
}
.associated-sub-file {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
    color: var(--plex-text-muted, #8e8e93);
    padding-left: 1.5rem !important;
}
.associated-sub-arrow {
    color: var(--plex-text-muted, #8e8e93);
    opacity: 0.5;
    margin-right: 0.25rem;
}
.associated-sub-size {
    font-size: 0.8rem;
    color: var(--plex-text-muted, #8e8e93);
}

/* Associated files hover popup (compact tables) */
.associated-files-hover {
    position: relative;
    display: inline-block;
    cursor: default;
}
.associated-files-popup {
    display: none;
    position: fixed;
    background: var(--plex-surface-elevated, #1f1f1f);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--plex-radius-sm, 8px);
    padding: 0.5rem 0.75rem;
    min-width: 280px;
    width: max-content;
    z-index: 1000;
    box-shadow: var(--plex-shadow-elevated, 0 4px 12px rgba(0, 0, 0, 0.4));
    white-space: nowrap;
    pointer-events: none;
}
.associated-files-popup .af-popup-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.125rem 0;
    font-size: 0.78rem;
    color: var(--plex-text-muted, #8e8e93);
}
.associated-files-popup .af-popup-name {
    flex: 1;
    min-width: 0;
}
.associated-files-popup .af-popup-name .associated-sub-arrow {
    opacity: 0.4;
}
.associated-files-popup .af-popup-size {
    flex-shrink: 0;
    text-align: right;
}

/* Date group headers in activity feed */
.date-group-header td {
    padding: 0.55rem 0.75rem 0.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

.date-group-header:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.date-group-inner {
    display: flex;
    align-items: center;
    width: 100%;
}

.date-group-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--plex-text-light, #aeaeb2);
    letter-spacing: 0.02em;
}

.date-group-label svg {
    width: 13px;
    height: 13px;
    stroke: var(--plex-text-muted, #8e8e93);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.date-group-count {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--plex-text-muted, #8e8e93);
    margin-left: 0.3rem;
}

.date-group-line {
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin-left: 0.75rem;
}

/* Light theme */
[data-theme="light"] .date-group-header td {
    background: rgba(0, 0, 0, 0.02);
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .date-group-line {
    background: rgba(0, 0, 0, 0.06);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .path-mapping dl {
        grid-template-columns: 1fr;
    }
}

/* Global Operation Indicator - visible in header across all pages */
.global-op-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background-color: rgba(230, 126, 34, 0.15);
    border: 1px solid rgba(230, 126, 34, 0.5);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--plex-orange, #e5a00d);
    margin-right: 0.75rem;
    animation: indicator-pulse 1.5s ease-in-out infinite;
    transition: background-color 0.2s, border-color 0.2s;
}

.global-op-indicator:hover {
    background-color: rgba(230, 126, 34, 0.25);
    border-color: rgba(230, 126, 34, 0.7);
    text-decoration: none;
}

.global-op-dot {
    width: 10px;
    height: 10px;
    background-color: var(--plex-orange, #e5a00d);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--plex-orange, #e5a00d);
    animation: dot-glow 1s ease-in-out infinite;
}

.global-op-text {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@keyframes indicator-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes dot-glow {
    0%, 100% {
        box-shadow: 0 0 8px var(--plex-orange, #e5a00d), 0 0 16px var(--plex-orange, #e5a00d);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 4px var(--plex-orange, #e5a00d);
        transform: scale(0.85);
    }
}

/* Hidden placeholder when no operation running */
#global-op-check {
    display: none;
}

/* Global Operation Banner - centered within content-wrapper */
#global-operation-banner {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
    display: flex;
    justify-content: center;
}

#global-operation-banner:empty {
    display: none;
}

#global-operation-banner > * {
    pointer-events: auto;
}

/* ── Banner Pill System ───────────────────────────────── */

/* Color accent variables per operation type */
.di-pill--caching  { --accent: #4CD964; --accent-dim: rgba(76,217,100,0.2);  --accent-glow: rgba(76,217,100,0.15); }
.di-pill--evicting { --accent: #FF9500; --accent-dim: rgba(255,149,0,0.2);   --accent-glow: rgba(255,149,0,0.15); }
.di-pill--maintenance { --accent: #5AC8FA; --accent-dim: rgba(90,200,250,0.2); --accent-glow: rgba(90,200,250,0.15); }
.di-pill--error    { --accent: #FF3B30; --accent-dim: rgba(255,59,48,0.2);   --accent-glow: rgba(255,59,48,0.15); }
.di-pill--dry-run  { --accent: #FFCC00; --accent-dim: rgba(255,204,0,0.2);   --accent-glow: rgba(255,204,0,0.15); }
.di-pill--completed { --accent: #4CD964; --accent-dim: rgba(76,217,100,0.2); --accent-glow: rgba(76,217,100,0.15); }
.di-pill--completed-errors { --accent: #FF9500; --accent-dim: rgba(255,149,0,0.2); --accent-glow: rgba(255,149,0,0.15); }
.di-pill--idle     { --accent: #e5a00d; --accent-dim: rgba(229,160,13,0.15); --accent-glow: rgba(229,160,13,0.1); }
.di-pill--disconnected { --accent: #FF3B30; --accent-dim: rgba(255,59,48,0.2); --accent-glow: rgba(255,59,48,0.15); }

/* Slide-down entrance */
@keyframes diSlideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Completion flash */
@keyframes diCompleteFlash {
    0%   { box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 0 0 0 var(--accent-glow); }
    50%  { box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 0 12px 4px var(--accent-glow); }
    100% { box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 0 0 0 var(--accent-glow); }
}

/* Content emerge animation — scale up from within (expand) */
@keyframes diFadeIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}
.di-content-enter { animation: diFadeIn 0.22s cubic-bezier(0.34, 1.3, 0.64, 1) both; }

/* Content recede animation — scale back down into pill (collapse) */
@keyframes diFadeOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.92); }
}
.di-content-exit { animation: diFadeOut 0.15s ease-in both; }

/* Quick settle fade — compact content appears during collapse morph */
@keyframes diSettle {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.di-content-settle { animation: diSettle 0.12s ease-out both; }

/* Base compact pill */
.di-pill {
    background: #000;
    border-radius: 28px;
    padding: 0 1.25rem;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-width: 240px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    /* No entrance animation — HTMX replaces innerHTML every 2s and would
       replay it each time, causing a visible bounce.  Entrance animation
       is applied once via .di-pill--entrance in JS on state changes. */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
/* One-shot entrance animation — added by JS only on real state changes */
.di-pill--entrance { animation: diSlideDown 0.3s ease-out; }

.di-pill:hover { transform: scale(1.02); }

/* Idle variant — smaller */
.di-pill--idle {
    height: 38px;
    border-radius: 20px;
    padding: 0 1rem;
    min-width: 200px;
}

/* ── Idle pill expanded actions ───────────────────────── */
.di-idle-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}
.di-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    border: none;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, transform 0.1s;
}
.di-btn:active { transform: scale(0.96); }
.di-btn--primary {
    background: var(--plex-orange, #e5a00d);
    color: #000;
}
.di-btn--primary:hover { background: #f0b020; }
.di-btn--secondary {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.12);
}
.di-btn--secondary:hover { background: rgba(255,255,255,0.14); color: #fff; }
.di-verbose-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    margin-right: auto;
}
.di-verbose-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--plex-orange, #e5a00d);
    cursor: pointer;
    margin: 0;
}

/* Dry run — dashed border */
.di-pill--dry-run { border: 1.5px dashed rgba(255,204,0,0.3); }

/* Completed — subtle glow border */
.di-pill--completed {
    border: 1.5px solid rgba(76,217,100,0.3);
    animation: diCompleteFlash 0.6s ease-out;
}
.di-pill--completed-errors {
    border: 1.5px solid rgba(255,149,0,0.3);
    animation: diCompleteFlash 0.6s ease-out;
}

/* Error — red glow border */
.di-pill--error { border: 1.5px solid rgba(255,59,48,0.3); }
.di-pill--disconnected { border: 1.5px solid rgba(255,59,48,0.3); }

/* Running pills use a fixed width in compact mode to prevent jumpiness
   as content changes (phase labels, counts, durations) every 2s poll */
.di-glow { width: 360px; min-width: 360px; border: 1.5px solid var(--accent-dim, rgba(255,255,255,0.12)); }

/* Subtle animated glow behind running pills — compact state only */
.di-glow::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 28px;
    background: var(--accent-glow, transparent);
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.3s ease;
}
/* Hide glow when expanded */
#global-operation-banner[data-di-expanded="tier2"] .di-glow::after,
#global-operation-banner[data-di-expanded="tier3"] .di-glow::after,
.di-pill.di-expanded.di-glow::after { opacity: 0; }
/* Hide border glow + flash animation when expanded */
#global-operation-banner[data-di-expanded="tier2"] .di-pill,
#global-operation-banner[data-di-expanded="tier3"] .di-pill,
.di-pill.di-expanded { border-color: rgba(255,255,255,0.06) !important; animation: none !important; }

/* Compact view layout */
.di-pill__compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
}

/* Subtle expand-hint chevron on compact pill */
.di-pill__compact::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 1.5px solid rgba(255,255,255,0.2);
    border-bottom: 1.5px solid rgba(255,255,255,0.2);
    transform: rotate(45deg);
    flex-shrink: 0;
    margin-top: -2px;
    transition: opacity 0.2s ease;
}
.di-pill:hover .di-pill__compact::after {
    border-color: rgba(255,255,255,0.45);
}

/* Pill layout sections */
.di-pill__left, .di-pill__right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    position: relative;
    z-index: 1;
}

/* Icon circle */
.di-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--accent-dim);
    color: var(--accent);
}

/* Label text */
.di-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

/* Metric (count, duration, etc.) */
.di-metric {
    font-size: 0.85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--accent);
}

/* Muted metric variant for idle/secondary info */
.di-metric--muted {
    color: rgba(255,255,255,0.5);
    font-weight: 400;
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

/* Accent-colored spinner */
.di-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: var(--accent);
    border-right-color: var(--accent-dim);
    border-radius: 50%;
    animation: diSpin 0.8s linear infinite;
    flex-shrink: 0;
}
@keyframes diSpin { to { transform: rotate(360deg); } }

/* 3px progress bar at pill bottom */
.di-pill__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 28px 28px;
    background: var(--accent);
    transition: width 0.5s ease;
    z-index: 1;
}

/* Error badge */
.di-error-badge {
    background: #e74c3c;
    color: #fff;
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    font-weight: 600;
    white-space: nowrap;
}
.di-cli-badge {
    background: rgba(155, 89, 182, 0.3);
    color: #bb8fce;
    font-size: 0.6rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* ── Expanded state ──────────────────────────────────── */
/* Driven by data-di-expanded on the OUTER #global-operation-banner div
   (which is NOT replaced by HTMX swaps). This avoids flicker — no JS
   class reapplication needed after each 2s poll. */

/* Default: expanded content hidden */
.di-pill .di-pill__expanded { display: none; }

/* Tier 2+: hide compact, show expanded */
#global-operation-banner[data-di-expanded="tier2"] .di-pill__compact,
#global-operation-banner[data-di-expanded="tier3"] .di-pill__compact { display: none !important; }
#global-operation-banner[data-di-expanded="tier2"] .di-pill__expanded,
#global-operation-banner[data-di-expanded="tier3"] .di-pill__expanded {
    display: flex !important;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

/* Hide the compact 3px progress bar when expanded (expanded has its own 4px bar) */
#global-operation-banner[data-di-expanded="tier2"] .di-pill__progress,
#global-operation-banner[data-di-expanded="tier3"] .di-pill__progress { display: none; }

/* Pill shape when expanded */
#global-operation-banner[data-di-expanded="tier2"] .di-pill,
#global-operation-banner[data-di-expanded="tier3"] .di-pill {
    border-radius: 22px;
    height: auto;
    padding: 0.85rem 1.25rem;
    max-width: 620px;
    min-width: 420px;
    cursor: default;
    overflow: visible;
    flex-direction: column;
}
#global-operation-banner[data-di-expanded="tier2"] .di-pill:hover,
#global-operation-banner[data-di-expanded="tier3"] .di-pill:hover { transform: none; }

/* Legacy class support (for JS-generated pills like completion banners) */
.di-pill.di-expanded .di-pill__compact { display: none !important; }
.di-pill.di-expanded .di-pill__expanded {
    display: flex !important;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}
.di-pill.di-expanded .di-pill__progress { display: none; }
.di-pill.di-expanded {
    border-radius: 22px;
    height: auto;
    padding: 0.85rem 1.25rem;
    max-width: 620px;
    min-width: 420px;
    cursor: default;
    overflow: visible;
    flex-direction: column;
}
.di-pill.di-expanded:hover { transform: none; }

/* Expanded header row */
.di-expanded__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
}
.di-expanded__header-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.di-expanded__header-right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Expanded progress bar */
.di-progress-track {
    height: 4px;
    background: #1a1a1a;
    border-radius: 2px;
    overflow: hidden;
    width: 100%;
}
.di-progress-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--accent);
    transition: width 0.5s ease;
}

/* Progress meta row */
.di-progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
}
.di-progress-meta .di-progress-meta__right {
    color: rgba(255,255,255,0.7);
    font-variant-numeric: tabular-nums;
}

/* ── Expand hint (visible in tier2 only, hidden in tier3) ── */
.di-expand-hint {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.25);
    cursor: pointer;
    padding-top: 0.15rem;
}
#global-operation-banner[data-di-expanded="tier2"] .di-expand-hint,
.di-pill.di-expanded:not(.di-detail) .di-expand-hint { display: flex; }
#global-operation-banner[data-di-expanded="tier3"] .di-expand-hint,
.di-pill.di-detail .di-expand-hint { display: none; }

/* ── Detail panel (Tier 3) ───────────────────────────── */

.di-pill .di-pill__detail { display: none; }
#global-operation-banner[data-di-expanded="tier3"] .di-pill__detail,
.di-pill.di-detail .di-pill__detail {
    display: block;
    width: 100%;
    max-height: 260px;
    overflow-y: auto;
}

/* File row in detail panel */
.di-file-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.45);
    padding: 2px 0;
}
.di-file-row .di-action-tag {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    flex-shrink: 0;
}
.di-action-tag--active {
    background: rgba(90,200,250,0.15);
    color: #5AC8FA;
    animation: diPulseTag 1.5s ease-in-out infinite;
}
@keyframes diPulseTag { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.di-file-row--active .di-file-row__name { color: rgba(255,255,255,0.7); }
.di-action-tag--cached {
    background: rgba(76,217,100,0.12);
    color: #4CD964;
}
.di-action-tag--restored {
    background: rgba(255,149,0,0.12);
    color: #FF9500;
}
.di-action-tag--error {
    background: rgba(255,59,48,0.12);
    color: #FF3B30;
}
.di-file-row__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.di-file-row__size {
    color: rgba(255,255,255,0.25);
    flex-shrink: 0;
    margin-left: auto;
}
.di-file-row__assoc-badge {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.3);
    flex-shrink: 0;
}
.di-file-row--sub {
    padding-left: 1.25rem;
    font-size: 0.65rem;
    opacity: 0.55;
}
.di-sub-arrow {
    color: rgba(255,255,255,0.25);
    flex-shrink: 0;
    font-size: 0.7rem;
}

/* ── Buttons ─────────────────────────────────────────── */

/* Circular stop button */
.di-stop {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,59,48,0.15);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
.di-stop:hover { background: rgba(255,59,48,0.3); }
.di-stop__inner {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: #FF3B30;
}

/* Circular dismiss/minimize button */
.di-dismiss {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.4);
    font-size: 1rem;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
    line-height: 1;
}
.di-dismiss:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* ── Warning row (reused from old banner) ────────────── */
.di-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    max-height: 0;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    padding-top: 0;
    margin-top: 0;
    border-top: 1px solid transparent;
    transition: max-height 0.35s ease-out, max-width 0.4s ease-out,
                opacity 0.3s ease-out, padding-top 0.35s ease-out,
                margin-top 0.35s ease-out, border-color 0.3s ease-out;
}

/* ── Summary stats row (completion expanded) ─────────── */
.di-summary-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.8rem;
    margin: 0.15rem 0;
}
.di-summary-stats__cached { color: #4CD964; }
.di-summary-stats__restored { color: #FF9500; }
.di-summary-stats__muted { color: rgba(255,255,255,0.25); }

/* Divider line */
.di-divider {
    height: 1px;
    background: #1a1a1a;
    margin: 0.15rem 0;
    width: 100%;
}

/* More files link */
.di-more-files {
    text-align: center;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.25);
    margin-top: 0.15rem;
}

/* ── Queue badge (compact pill) ──────────────────────── */
.di-queue-badge {
    background: rgba(90,200,250,0.2);
    color: #5AC8FA;
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Queue section (tier3 detail) ────────────────────── */
.di-queue-section {
    padding: 0.1rem 0;
}

.di-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.1rem 0 0.2rem;
}

.di-queue-header__label {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.25);
}

.di-queue-header__clear {
    background: rgba(255,255,255,0.06);
    border: none;
    color: rgba(255,255,255,0.35);
    font-size: 0.6rem;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.di-queue-header__clear:hover {
    background: rgba(255,59,48,0.15);
    color: #FF3B30;
}

/* Queue items use the same .di-file-row layout */
.di-queue-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.45);
    padding: 2px 0;
}

.di-queue-item__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.di-queue-item__count {
    color: rgba(255,255,255,0.2);
    font-size: 0.65rem;
    flex-shrink: 0;
    margin-left: auto;
}

/* Queued action tag — muted cyan, matches maintenance accent */
.di-action-tag--queued {
    background: rgba(90,200,250,0.1);
    color: rgba(90,200,250,0.6);
}

.di-queue-item__remove {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.15);
    font-size: 0.8rem;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.di-queue-item__remove:hover {
    background: rgba(255,59,48,0.15);
    color: #FF3B30;
}

/* ── Queue countdown ─────────────────────────────────── */
.di-countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.di-countdown__text {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
}

.di-countdown__timer {
    font-family: monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: #5AC8FA;
    font-variant-numeric: tabular-nums;
}

.di-countdown__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* ── Light theme pill overrides ──────────────────────── */
/* Pill stays dark in light mode — just soften the shadow for lighter backgrounds */
[data-theme="light"] .di-pill {
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

/* ── Mobile responsive ───────────────────────────────── */
@media (max-width: 768px) {
    #global-operation-banner {
        left: 0;
        right: 0;
        transform: none;
    }

    .di-pill {
        min-width: auto;
        max-width: none;
        width: 100%;
    }

    .di-pill.di-expanded {
        max-width: none;
        min-width: auto;
    }

    .di-pill__detail {
        max-height: 150px;
    }
}

/* ── Activity Filter Pills ────────────────────────────── */
.activity-filter-bar {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.activity-filter-pill {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.5);
    padding: 0.2rem 0.65rem;
    border-radius: 14px;
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.activity-filter-pill:hover {
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.75);
}

.activity-filter-pill.active {
    background: var(--plex-orange, #e5a00d);
    border-color: var(--plex-orange, #e5a00d);
    color: #000;
    font-weight: 600;
}

/* Light theme overrides */
[data-theme="light"] .activity-filter-pill {
    border-color: rgba(0, 0, 0, 0.15);
    color: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .activity-filter-pill:hover {
    border-color: rgba(0, 0, 0, 0.3);
    color: rgba(0, 0, 0, 0.75);
}

[data-theme="light"] .activity-filter-pill.active {
    color: #000;
}
