/* ==========================================
   OCTOPUS NEXUS - Recent Studies Cache Panel
   ========================================== */

/* Painel Principal */
.zf-recent-studies-panel {
    position: fixed;
    inset: 0;
    margin: auto;
    width: 1020px;
    height: 90vh;
    min-width: 640px;
    min-height: 560px;
    max-width: 95vw;
    max-height: 94vh;
    resize: both;
    overflow: hidden;
    background: rgba(15, 17, 23, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    z-index: 10020;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(24px);
    animation: zfRecentFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    image-rendering: -webkit-optimize-contrast;
    backface-visibility: hidden;
    transform: none;
}

@keyframes zfRecentFadeIn {
    from { opacity: 0; transform: scale(0.985); }
    to { opacity: 1; transform: scale(1); }
}

/* Header */
.zf-recent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: grab;
    user-select: none;
    background: rgba(255, 255, 255, 0.015);
}

.zf-recent-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #f8fafc;
}

.zf-recent-title i {
    font-size: 17px;
    color: var(--primary, #60a5fa);
}

.zf-recent-actions {
    display: flex;
    gap: 4px;
}

.zf-recent-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.15s;
    font-size: 15px;
}

.zf-recent-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* Controls Bar (Busca, Filtros, Ordenação) */
.zf-recent-controls {
    padding: 12px 16px 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.25);
}

.zf-recent-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.zf-recent-search-box i {
    position: absolute;
    left: 11px;
    color: #64748b;
    font-size: 14px;
    pointer-events: none;
}

.zf-recent-search-box input {
    width: 100%;
    padding: 7px 32px 7px 34px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #f8fafc;
    font-size: 12px;
    outline: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

.zf-recent-search-box input:focus {
    border-color: var(--primary, #60a5fa);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 1px var(--primary, #60a5fa), 0 0 12px rgba(96, 165, 250, 0.2);
}

.zf-recent-search-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #94a3b8;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.15s ease;
    padding: 0;
}

.zf-recent-search-clear-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #f8fafc;
}

.zf-recent-reset-filter-btn {
    margin-top: 10px;
    padding: 6px 14px;
    background: rgba(96, 165, 250, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 6px;
    color: #93c5fd;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.zf-recent-reset-filter-btn:hover {
    background: rgba(96, 165, 250, 0.22);
    border-color: rgba(96, 165, 250, 0.5);
    color: #ffffff;
    transform: translateY(-1px);
}

.zf-recent-filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.zf-recent-modality-tabs {
    display: flex;
    gap: 3px;
    background: rgba(0, 0, 0, 0.45);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.zf-recent-tab {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.zf-recent-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
}

.zf-recent-tab.active[data-mod="ALL"] { background: var(--primary, #3b82f6); color: #ffffff; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.zf-recent-tab.active[data-mod="MR"] { background: rgba(96, 165, 250, 0.25); color: #93c5fd; border: 1px solid rgba(96, 165, 250, 0.4); }
.zf-recent-tab.active[data-mod="CT"] { background: rgba(56, 189, 248, 0.25); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.4); }
.zf-recent-tab.active[data-mod="MG"] { background: rgba(244, 114, 182, 0.25); color: #f472b6; border: 1px solid rgba(244, 114, 182, 0.4); }
.zf-recent-tab.active[data-mod="DX"] { background: rgba(251, 146, 60, 0.25); color: #fdba74; border: 1px solid rgba(251, 146, 60, 0.4); }
.zf-recent-tab.active[data-mod="US"] { background: rgba(74, 222, 128, 0.25); color: #86efac; border: 1px solid rgba(74, 222, 128, 0.4); }
.zf-recent-tab.active[data-mod="PINNED"] { background: rgba(251, 191, 36, 0.22); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.45); box-shadow: 0 0 8px rgba(251, 191, 36, 0.2); }

.zf-recent-tab-badge {
    display: inline-block;
    padding: 0 4px;
    font-size: 8.5px;
    font-weight: 800;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
    margin-left: 2px;
}

.zf-recent-tab.zero-count {
    opacity: 0.42;
}

.zf-recent-card.zf-recent-card-selected {
    background: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.45);
    box-shadow: 0 0 12px rgba(96, 165, 250, 0.25);
    outline: none;
}

.zf-recent-highlight {
    background: rgba(96, 165, 250, 0.28);
    color: #93c5fd;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 700;
}

/* Barra de Uso de Espaço em Disco */
.zf-recent-usage-bar-container {
    padding: 7px 18px 9px 18px;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.zf-recent-usage-bar-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 500;
    color: #94a3b8;
}

.zf-recent-usage-bar-label span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #cbd5e1;
    font-weight: 600;
}

.zf-recent-usage-bar-label span:last-child {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #94a3b8;
}

.zf-recent-usage-bar-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.zf-recent-usage-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 999px;
    transition: width 0.35s ease, background 0.35s ease;
}

.zf-recent-usage-bar-fill.warning {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.zf-recent-usage-bar-fill.danger {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

/* Custom Dark Glass Dropdown */
.zf-recent-custom-dropdown {
    position: relative;
    user-select: none;
}

.zf-recent-dropdown-trigger {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    color: #cbd5e1;
    padding: 4px 10px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.zf-recent-dropdown-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary, rgba(96, 165, 250, 0.4));
    color: #f8fafc;
}

.zf-recent-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 145px;
    background: #141721;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.75);
    padding: 4px;
    z-index: 10025;
    display: none;
    flex-direction: column;
    gap: 2px;
    backdrop-filter: blur(16px);
}

.zf-recent-dropdown-menu.show {
    display: flex;
    animation: zfDropdownFadeIn 0.15s ease-out;
}

@keyframes zfDropdownFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.zf-recent-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    font-size: 11px;
    color: #94a3b8;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.zf-recent-dropdown-item i {
    font-size: 14px;
    color: #64748b;
    transition: color 0.15s;
}

.zf-recent-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f1f5f9;
}

.zf-recent-dropdown-item:hover i {
    color: var(--primary, #60a5fa);
}

.zf-recent-dropdown-item.active {
    background: rgba(96, 165, 250, 0.16);
    color: var(--primary, #60a5fa);
    font-weight: 600;
}

.zf-recent-dropdown-item.active i {
    color: var(--primary, #60a5fa);
}

.zf-recent-group-title {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: #94a3b8;
    text-transform: uppercase;
    padding: 10px 8px 6px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.zf-recent-group-title i {
    color: var(--primary, #60a5fa);
    font-size: 13px;
}

.zf-recent-group-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin-left: 6px;
}

/* Body - Área de Rolagem dos Exames */
.zf-recent-body {
    padding: 8px 12px 14px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.22) rgba(255, 255, 255, 0.02);
}

/* Barra Lateral de Rolagem (Scrollbar) Estilizada e Visível */
.zf-recent-body::-webkit-scrollbar {
    width: 7px;
}

.zf-recent-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin: 4px 2px;
}

.zf-recent-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
    transition: all 0.2s ease;
}

.zf-recent-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary, #60a5fa);
    border: 1px solid transparent;
    background-clip: content-box;
    box-shadow: 0 0 8px rgba(96, 165, 250, 0.4);
}

.zf-recent-body::-webkit-scrollbar-thumb:active {
    background: #38bdf8;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
}

/* Stats Bar */
.zf-recent-stats {
    font-size: 11px;
    color: #64748b;
    padding: 4px 12px 8px;
    text-align: right;
}

/* Empty State */
.zf-recent-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 45px 20px;
    color: #64748b;
    font-size: 13px;
}

.zf-recent-empty i {
    font-size: 32px;
    opacity: 0.6;
    color: var(--primary, #60a5fa);
}

/* Loading */
.zf-recent-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px;
    color: #94a3b8;
    font-size: 13px;
}

@keyframes ph-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.ph-spin { animation: ph-spin 1s linear infinite; }

/* Card */
.zf-recent-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.04);
    margin-bottom: 4px;
}

.zf-recent-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(96, 165, 250, 0.3);
    transform: translateX(2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

/* Card Ativo (Em Uso) */
.zf-recent-card.active-study {
    border-color: var(--primary, #3b82f6) !important;
    background: rgba(59, 130, 246, 0.1) !important;
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.18), inset 0 0 0 1px rgba(96, 165, 250, 0.2);
}

.zf-recent-active-badge {
    background: linear-gradient(135deg, var(--primary, #3b82f6), var(--primary-dark, #1d4ed8));
    color: #ffffff;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

/* Storage usage bar */
.zf-recent-usage-bar-container {
    padding: 7px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.zf-recent-usage-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 10.5px;
    color: #94a3b8;
    margin-bottom: 4px;
    font-weight: 500;
}

.zf-recent-usage-bar-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 2px;
    overflow: hidden;
}

.zf-recent-usage-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-dark, #2563eb) 0%, var(--primary, #60a5fa) 100%);
    border-radius: 2px;
    transition: width 0.3s;
}

.zf-recent-card:active {
    transform: scale(0.99);
}

/* Thumbnail */
.zf-recent-thumb {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #09090b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.zf-recent-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.zf-recent-thumb-placeholder {
    color: #475569;
    font-size: 20px;
}

/* Info */
.zf-recent-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.zf-recent-patient {
    font-size: 12.5px;
    font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
    letter-spacing: 0.2px;
}

.zf-recent-meta {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: #94a3b8;
    flex-wrap: wrap;
    align-items: center;
}

.zf-recent-modality {
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 9.5px;
    letter-spacing: 0.4px;
}

.zf-recent-desc {
    font-size: 11px;
    font-weight: 500;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.zf-recent-access {
    font-size: 10px;
    color: #64748b;
    margin-top: 1px;
}

/* Delete Button */
.zf-recent-delete-btn {
    background: rgba(239, 68, 68, 0.15) !important;
    border: 1px solid rgba(239, 68, 68, 0.35) !important;
    color: #f87171 !important;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1 !important;
    visibility: visible !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    flex-shrink: 0;
}

.zf-recent-card:hover .zf-recent-delete-btn,
.zf-recent-table-row .zf-recent-delete-btn {
    opacity: 1 !important;
    visibility: visible !important;
}

.zf-recent-delete-btn:hover {
    color: #ffffff !important;
    background: rgba(239, 68, 68, 0.4) !important;
    border-color: #ef4444 !important;
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* Wrapper e Linhas da Tabela de Exames Recentes */
.zf-recent-studies-panel .rm-table-wrapper {
    height: auto;
    min-height: 320px;
    max-height: calc(90vh - 210px);
    flex: 1 1 auto;
    overflow-y: auto !important;
    overflow-x: auto !important;
    border: 1px solid var(--border-viewer, rgba(255, 255, 255, 0.08));
    border-radius: 10px;
    background: var(--bg-side, #0a0d14);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
    scrollbar-width: thin;
    scrollbar-color: var(--primary, #60a5fa) rgba(0, 0, 0, 0.3);
}

.zf-recent-table-row {
    transition: all 0.15s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.zf-recent-table-row:hover {
    background: rgba(96, 165, 250, 0.07) !important;
    border-left: 3px solid var(--primary, #60a5fa) !important;
}

.zf-recent-table-row.rm-table-row-selected {
    background: rgba(96, 165, 250, 0.14) !important;
    border-left: 3px solid var(--primary, #60a5fa) !important;
}

.zf-recent-table-row.active-study-row {
    background: rgba(74, 222, 128, 0.08) !important;
    border-left: 3px solid #4ade80 !important;
}

.zf-recent-table-row.rm-table-row-selected-batch {
    background: rgba(59, 130, 246, 0.12) !important;
    border-left: 3px solid #3b82f6 !important;
}

.zf-recent-table-row.pinned-study-row {
    background: rgba(251, 191, 36, 0.04);
}

.zf-recent-pin-btn {
    background: transparent;
    border: none;
    padding: 2px 4px;
    font-size: 13px;
    color: #64748b;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.zf-recent-pin-btn:hover {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
    transform: scale(1.15);
}

.zf-recent-pin-btn.is-pinned {
    color: #fbbf24 !important;
    background: rgba(251, 191, 36, 0.15) !important;
}

.zf-recent-pin-btn.is-pinned:hover {
    color: #f59e0b !important;
    background: rgba(251, 191, 36, 0.25) !important;
}

/* ==========================================
   Cache Settings Modal
   ========================================== */

@keyframes zfModalOverlayFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zfModalCardPopIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.zf-cache-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10030;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: zfModalOverlayFade 0.15s ease-out;
}

.zf-cache-settings-content {
    width: 420px;
    min-width: 350px;
    max-width: 95vw;
    height: auto;
    min-height: 240px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: rgba(22, 22, 28, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    resize: both;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    animation: zfModalCardPopIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Indicador visual de redimensionamento no canto inferior direito */
.zf-cache-settings-content::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(255, 255, 255, 0.35);
    border-bottom: 2px solid rgba(255, 255, 255, 0.35);
    border-bottom-right-radius: 2px;
    pointer-events: none;
    z-index: 10;
}

.zf-cache-settings-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 14px;
    font-weight: 600;
    color: #e0e0e0;
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
}

.zf-cache-settings-header:active {
    cursor: grabbing;
}

.zf-cache-settings-header button {
    margin-left: auto;
}

.zf-cache-settings-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) rgba(255, 255, 255, 0.03);
}

.zf-cache-settings-body::-webkit-scrollbar {
    width: 6px;
}

.zf-cache-settings-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.zf-cache-settings-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    border: 1px solid transparent;
    background-clip: content-box;
    transition: all 0.2s ease;
}

.zf-cache-settings-body::-webkit-scrollbar-thumb:hover {
    background: rgba(96, 165, 250, 0.7);
}

.zf-cache-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #ccc;
    cursor: pointer;
}

.zf-cache-toggle input[type="checkbox"] {
    accent-color: var(--primary, #60a5fa);
    width: 16px;
    height: 16px;
}

.zf-cache-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.zf-cache-option label {
    font-size: 13px;
    color: #aaa;
}

.zf-cache-option select {
    background: #1e2430;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #f1f5f9;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color-scheme: dark;
}

.zf-cache-option select option {
    background-color: #11151e;
    color: #f1f5f9;
    padding: 8px 12px;
}

.zf-cache-option select:focus {
    outline: none;
    border-color: var(--primary, #60a5fa);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25);
}

/* Stats Bar */
.zf-cache-stats-display {
    margin-top: 4px;
}

.zf-cache-stats-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.zf-cache-stats-fill {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #a78bfa);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.zf-cache-stats-text {
    font-size: 11px;
    color: #666;
    text-align: center;
}

/* Clear Button */
.zf-cache-clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.2);
    color: #f43f5e;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    margin-top: 4px;
}

.zf-cache-clear-btn:hover {
    background: rgba(244, 63, 94, 0.2);
    border-color: rgba(244, 63, 94, 0.4);
}

/* Fix Native Dropdown Contrast in Dark Mode */
.zf-cache-settings-modal select,
.zf-recent-studies-panel select {
    color-scheme: dark;
}

.zf-cache-settings-modal select option,
.zf-recent-studies-panel select option {
    background-color: #161b26;
    color: #f8fafc;
    padding: 8px;
}

/* ==========================================
   FOLDER WATCHER — Toast de Notificação (Compacto com Stacking)
   ========================================== */

.zf-folder-watcher-toast-container {
    position: fixed;
    top: 14px;
    right: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 99999;
    pointer-events: none;
    max-width: 320px;
}

.zf-folder-watcher-toast {
    position: relative;
    top: auto;
    right: auto;
    display: flex;
    flex-direction: column;
    width: 290px;
    max-width: calc(100vw - 28px);
    padding: 8px 12px 10px 12px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    pointer-events: auto;
    box-sizing: border-box;
}

.zf-folder-watcher-toast.zf-fwt-visible {
    transform: translateX(0);
    opacity: 1;
}

.zf-folder-watcher-toast.zf-fwt-exit {
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.55, 0, 1, 0.45), opacity 0.2s ease;
}

.zf-fwt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.zf-fwt-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4ade80;
    font-size: 14px;
    flex-shrink: 0;
}

.zf-fwt-content {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.zf-fwt-title {
    font-size: 11.5px;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 5px;
}

.zf-fwt-detail {
    font-size: 11px;
    color: #e2e8f0;
    font-weight: 500;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zf-fwt-status {
    font-size: 9.5px;
    color: #4ade80;
    margin-top: 1px;
    font-weight: 500;
    opacity: 0.9;
}

.zf-fwt-load-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--primary, #38bdf8);
    border: none;
    border-radius: 4px;
    color: #000;
    font-size: 10.5px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.zf-fwt-load-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.zf-fwt-sidebar-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 4px;
    color: #93c5fd;
    font-size: 10.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.zf-fwt-sidebar-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    color: #fff;
    border-color: rgba(96, 165, 250, 0.8);
    transform: translateY(-1px);
}

.zf-fwt-recents-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-viewer, rgba(255, 255, 255, 0.15));
    border-radius: 4px;
    color: var(--text-viewer, #cbd5e1);
    font-size: 10.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.zf-fwt-recents-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.zf-fwt-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.zf-fwt-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

/* ==========================================
   PACS SYNC — Modal Dedicado
   ========================================== */

/* ==========================================
   PACS SYNC — Modal Dedicado & Dashboard
   ========================================== */

/* ==========================================
   PACS SYNC — Modal Integrado ao Design System & Temas
   ========================================== */

.zf-pacs-sync-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    animation: zfModalOverlayFade 0.15s ease-out;
}

.rm-pacs-sync-content {
    width: 1020px;
    min-width: 640px;
    max-width: 95vw;
    height: 92vh;
    min-height: 580px;
    max-height: 96vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-viewer);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    color: var(--text-viewer);
    font-family: 'Inter', -apple-system, sans-serif;
    animation: zfModalCardPopIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.rm-modal-resizer {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 24px;
    height: 24px;
    cursor: nwse-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary, #60a5fa);
    opacity: 0.65;
    z-index: 50;
    transition: opacity 0.15s, transform 0.15s, color 0.15s;
    user-select: none;
}

.rm-modal-resizer:hover,
.rm-modal-resizer.active {
    opacity: 1;
    color: var(--primary);
    transform: scale(1.18);
}

.rm-pacs-sync-body {
    padding: 10px 18px;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    overflow-y: auto !important;
    overflow-x: hidden;
    min-height: 0;
    background-color: var(--bg-viewer);
    color: var(--text-viewer);
    scrollbar-width: thin;
    scrollbar-color: var(--primary) rgba(0, 0, 0, 0.25);
}

.zf-folder-watcher-config.standalone-panel {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.rm-pacs-sync-body::-webkit-scrollbar,
.rm-table-wrapper::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}
.rm-pacs-sync-body::-webkit-scrollbar-track,
.rm-table-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    margin: 4px 0;
}
.rm-pacs-sync-body::-webkit-scrollbar-thumb,
.rm-table-wrapper::-webkit-scrollbar-thumb {
    background: var(--primary, #60a5fa);
    border-radius: 6px;
    border: 2px solid var(--bg-viewer);
}
.rm-pacs-sync-body::-webkit-scrollbar-thumb:hover,
.rm-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover, #93c5fd);
}

.zf-pacs-sync-modal .rm-table-wrapper {
    height: auto;
    min-height: 320px;
    max-height: calc(92vh - 340px);
    flex: 1 1 auto;
    overflow-y: auto !important;
    overflow-x: auto !important;
    border: 1px solid var(--border-viewer);
    border-radius: 10px;
    background: var(--bg-side);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
    scrollbar-width: thin;
    scrollbar-color: var(--primary, #60a5fa) rgba(0, 0, 0, 0.3);
}

.rm-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-side, #0f172a) !important;
    border-bottom: 1px solid var(--border-viewer) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.rm-pacs-sync-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-side);
    border-top: 1px solid var(--border-viewer);
    flex-shrink: 0;
}

.rm-pacs-footer-status {
    display: flex;
    align-items: center;
    font-size: 11.5px;
    color: var(--text-viewer);
}

.rm-status-dot-green {
    color: #34d399;
    font-size: 13px;
    margin-right: 6px;
}

/* ==========================================
   PACS SYNC — Seções & Elementos do Formulário
   ========================================== */

.zf-folder-watcher-config {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.rm-pacs-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
}

.rm-form-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rm-pacs-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid var(--border-viewer);
    background: var(--bg-side);
    color: var(--text-muted);
    letter-spacing: 0.4px;
}

.rm-pacs-status-badge.active {
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.4);
    background: rgba(52, 211, 153, 0.1);
}

.rm-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748b;
    flex-shrink: 0;
}

.rm-status-dot.active {
    background: #34d399;
    box-shadow: 0 0 6px #34d399;
}

.rm-pacs-meta-count {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Lista de Pastas */
.rm-pacs-folder-box {
    background: var(--bg-side);
    border: 1px solid var(--border-viewer);
    border-radius: 8px;
    max-height: 125px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    box-sizing: border-box;
}

.rm-pacs-folder-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.rm-pacs-folder-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-viewer);
}

.rm-pacs-folder-tag {
    font-size: 9.5px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--primary);
    border: 1px solid var(--border-viewer);
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.rm-pacs-folder-path {
    font-size: 12px;
    font-family: 'Consolas', 'Menlo', monospace;
    color: var(--text-viewer);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rm-pacs-folder-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 13px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
    flex-shrink: 0;
}

.rm-pacs-folder-remove:hover {
    color: #f43f5e;
}

.rm-pacs-folder-item.inaccessible {
    border-color: rgba(245, 158, 11, 0.4) !important;
    background: rgba(245, 158, 11, 0.05) !important;
}

.rm-pacs-folder-warn-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
    flex-shrink: 0;
}

.rm-pacs-folder-tag.tag-warn {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
}

.rm-pacs-empty-text {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 14px;
    font-style: italic;
}

/* Radio & Checkbox Labels */
.rm-radio-label, .rm-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-viewer);
    cursor: pointer;
    user-select: none;
}

.rm-radio-label input[type="radio"],
.rm-checkbox-label input[type="checkbox"] {
    accent-color: var(--primary);
    width: 14px;
    height: 14px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Modalidade Badge & Status Table Badges */
.rm-pacs-mod-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-viewer);
    color: var(--primary);
}

.rm-pacs-table-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.rm-pacs-table-badge.rm-status-ready {
    background: rgba(52, 211, 153, 0.12);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.35);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.15);
}

.rm-pacs-table-badge.rm-status-ready .rm-ready-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 6px #34d399;
    display: inline-block;
}

.rm-pacs-table-badge.rm-status-dl {
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.35);
}

.rm-pacs-table-badge.rm-status-err {
    background: rgba(244, 63, 94, 0.12);
    color: #f43f5e;
    border: 1px solid rgba(244, 63, 94, 0.35);
}

/* Modality Badges Clínicos */
.rm-pacs-mod-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-viewer);
}

.rm-pacs-mod-badge.mod-mr {
    background: rgba(129, 140, 248, 0.18);
    color: #818cf8;
    border: 1px solid rgba(129, 140, 248, 0.4);
}

.rm-pacs-mod-badge.mod-ct {
    background: rgba(249, 115, 22, 0.18);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.4);
}

.rm-pacs-mod-badge.mod-xr {
    background: rgba(56, 189, 248, 0.18);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
}

.rm-pacs-mod-badge.mod-us {
    background: rgba(52, 211, 153, 0.18);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.4);
}

.rm-pacs-mod-badge.mod-mg {
    background: rgba(244, 114, 182, 0.18);
    color: #f472b6;
    border: 1px solid rgba(244, 114, 182, 0.4);
}

.rm-pacs-mod-badge.mod-sr {
    background: rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.rm-pacs-chip.zero-count {
    opacity: 0.45;
}

.rm-pacs-chip.zero-count:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-viewer);
    color: var(--text-muted);
}

/* Toggle Switch Integrado ao Tema */
.zf-toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.zf-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.zf-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-viewer);
    border-radius: 22px;
    transition: background 0.25s ease;
}

.zf-toggle-slider:before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--text-viewer);
    border-radius: 50%;
    transition: transform 0.25s ease;
}

.zf-toggle-switch input:checked + .zf-toggle-slider {
    background: var(--primary);
}

.zf-toggle-switch input:checked + .zf-toggle-slider:before {
    transform: translateX(18px);
}

/* Colunas Ordenáveis da Tabela PACS Sync */
.rm-sortable-th {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.rm-sortable-th:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-viewer) !important;
}

.rm-sortable-th.active-sort {
    color: var(--primary) !important;
}

.rm-th-content {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
}

.rm-sort-icon {
    font-size: 13px;
    transition: transform 0.15s ease, color 0.15s ease, opacity 0.15s ease;
    flex-shrink: 0;
}

.rm-sort-icon.active {
    color: var(--primary);
    opacity: 1 !important;
}

/* Linha selecionada / ativa da Tabela PACS Sync */
.rm-table-row {
    transition: all 0.15s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.rm-table-row:hover {
    background: rgba(96, 165, 250, 0.07) !important;
    border-left: 3px solid var(--primary, #60a5fa) !important;
}

.rm-table-row.rm-table-row-selected {
    background: rgba(96, 165, 250, 0.14) !important;
    border-left: 3px solid var(--primary, #60a5fa) !important;
}

.rm-table-row.active-study-row {
    background: rgba(74, 222, 128, 0.08) !important;
    border-left: 3px solid #4ade80 !important;
}

.rm-pacs-search-wrapper input:focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25);
}

/* Quick Filter Chips */
.rm-pacs-chips-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.rm-pacs-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding: 0 9px;
    font-size: 10.5px;
    font-weight: 600;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-viewer);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.rm-pacs-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-viewer);
    border-color: rgba(255, 255, 255, 0.2);
}

.rm-pacs-chip.active {
    background: rgba(96, 165, 250, 0.15);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 700;
}

.rm-chip-badge {
    font-size: 9.5px;
    padding: 1px 5px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: inherit;
    font-weight: 700;
}

.rm-pacs-chip.active .rm-chip-badge {
    background: var(--primary);
    color: #0b1120;
}

/* Modality Badges Clínicos */
.rm-pacs-mod-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-viewer);
}

.rm-pacs-mod-badge.mod-mr {
    background: rgba(129, 140, 248, 0.15);
    color: #818cf8;
    border: 1px solid rgba(129, 140, 248, 0.35);
}

.rm-pacs-mod-badge.mod-ct {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
}

.rm-pacs-mod-badge.mod-xr {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.35);
}

.rm-pacs-mod-badge.mod-us {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.35);
}

/* Menu de Contexto (Right-click) */
.rm-pacs-context-menu {
    position: fixed;
    z-index: 100000;
    min-width: 190px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 1px rgba(255, 255, 255, 0.2);
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: zfModalCardPopIn 0.12s ease-out;
}

.rm-pacs-context-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 11px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-viewer);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background 0.12s, color 0.12s;
}

.rm-pacs-context-item:hover {
    background: rgba(96, 165, 250, 0.18);
    color: #fff;
}

.rm-pacs-context-item i {
    font-size: 14px;
    color: var(--primary);
}

.rm-pacs-context-item.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.rm-pacs-context-item.danger i {
    color: #f87171;
}

.rm-pacs-context-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 3px 0;
}

/* Destaque sutil e fixo em Exames Recém-Detectados (Zero-Flicker) */
.rm-table-row.rm-table-row-new-arrival {
    background: rgba(52, 211, 153, 0.08);
    border-left: 3px solid #34d399 !important;
}

/* Barra de Progresso Suave */
.rm-pacs-progress-wrap {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.rm-pacs-progress-fill {
    height: 100%;
    background: #fbbf24;
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ==========================================
   PACS SYNC — Header Pill & Quick Popover
   ========================================== */

/* Pílula Discreta no Topo / Barra Superior */
.zf-fw-header-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 11px;
    margin: 0 6px;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(147, 51, 234, 0.3);
    border-radius: 20px;
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Inter', -apple-system, sans-serif;
    cursor: pointer;
    user-select: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.zf-fw-header-pill:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(168, 85, 247, 0.6);
    color: #f1f5f9;
    box-shadow: 0 4px 14px rgba(147, 51, 234, 0.25);
    transform: translateY(-1px);
}

.zf-fw-header-pill.has-ready {
    border-color: rgba(74, 222, 128, 0.5);
    background: rgba(22, 101, 52, 0.2);
}

.zf-fw-pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748b;
    flex-shrink: 0;
}

.zf-fw-pill-dot.active {
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
    animation: zfFwcPulse 2s infinite;
}

.zf-fw-pill-text {
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.zf-fw-pill-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    margin-left: 2px;
}

/* Popover Flutuante Rápido */
.zf-fw-popover {
    position: fixed;
    top: 50px;
    right: 20px;
    width: 380px;
    max-width: 90vw;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(147, 51, 234, 0.3);
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 20px rgba(147, 51, 234, 0.15);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.zf-fw-popover.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.zf-fw-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(30, 41, 59, 0.4);
}

.zf-fw-popover-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 700;
    color: #f1f5f9;
}

.zf-fw-popover-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.zf-fw-popover-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 6px;
    transition: all 0.15s;
}

.zf-fw-popover-btn:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.1);
}

.zf-fw-popover-search-wrap {
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.zf-fw-popover-search {
    width: 100%;
    padding: 6px 10px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #f1f5f9;
    font-size: 11px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}

.zf-fw-popover-search:focus {
    border-color: #a855f7;
    background: rgba(30, 41, 59, 0.9);
}

.zf-fw-popover-body {
    padding: 10px;
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.zf-fw-popover-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(15, 23, 42, 0.4);
    font-size: 11px;
    color: #94a3b8;
}

.zf-fw-popover-footer a {
    color: #a855f7;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.zf-fw-popover-footer a:hover {
    text-decoration: underline;
}

/* Mini-thumbnail preview em linhas da tabela de Recentes */
.zf-recent-thumb-wrapper {
    position: relative;
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 5px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    flex-shrink: 0;
    cursor: pointer;
}

.zf-recent-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.zf-recent-thumb-tooltip {
    position: absolute;
    top: 0;
    left: calc(100% + 10px);
    width: 140px;
    height: 140px;
    border-radius: 8px;
    background: #090d16;
    border: 1px solid rgba(96, 165, 250, 0.4);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.8), 0 0 15px rgba(59, 130, 246, 0.25);
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.92);
    transform-origin: top left;
    transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.zf-recent-thumb-tooltip img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.zf-recent-thumb-wrapper:hover .zf-recent-thumb-tooltip {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* ==========================================
   CANAIS DE SINCRONIZAÇÃO / PRESETS ON-OFF
   ========================================== */

.zf-fw-channels-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.zf-fw-channel-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.4px;
    border-radius: 20px;
    cursor: pointer;
    user-select: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.7);
    color: #94a3b8;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.zf-fw-channel-btn:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.25);
    color: #f1f5f9;
    transform: translateY(-1px);
}

.zf-fw-channel-btn:active {
    transform: translateY(0);
}

/* LED Indicator */
.zf-channel-led {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #475569;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.zf-channel-status-pill {
    font-size: 9px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 10px;
    letter-spacing: 0.3px;
    line-height: 1.2;
    transition: all 0.22s ease;
}

/* Estado Inativo / Apagado (OFF) */
.zf-fw-channel-btn.channel-inactive {
    opacity: 0.55;
    background: rgba(15, 23, 42, 0.4);
    border-color: rgba(255, 255, 255, 0.06);
    color: #64748b;
}

.zf-fw-channel-btn.channel-inactive:hover {
    opacity: 0.85;
    border-color: rgba(255, 255, 255, 0.18);
    color: #cbd5e1;
}

.zf-fw-channel-btn.channel-inactive .zf-channel-led {
    background: #475569;
    box-shadow: none;
}

.zf-fw-channel-btn.channel-inactive .zf-channel-status-pill {
    background: rgba(100, 116, 139, 0.2);
    color: #64748b;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

/* Estado Ativo / Aceso (ON) */
.zf-fw-channel-btn.channel-active {
    opacity: 1;
    color: #f8fafc;
}

/* Temas Individuais para Cada Canal */

/* 1. CLINUX RIS (Azul/Ciano) */
.zf-fw-channel-btn.channel-clinux.channel-active {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.55);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.22);
}
.zf-fw-channel-btn.channel-clinux.channel-active .zf-channel-led {
    background: #38bdf8;
    box-shadow: 0 0 8px #38bdf8;
    animation: zfLedPulse 2s infinite ease-in-out;
}
.zf-fw-channel-btn.channel-clinux.channel-active .zf-channel-status-pill {
    background: rgba(56, 189, 248, 0.2);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.4);
}
.zf-fw-channel-btn.channel-clinux.channel-active i {
    color: #38bdf8;
}

/* 2. ANIMATI / WEASIS (Roxo/Lavanda) */
.zf-fw-channel-btn.channel-weasis.channel-active {
    background: rgba(192, 132, 252, 0.12);
    border-color: rgba(192, 132, 252, 0.55);
    box-shadow: 0 0 12px rgba(192, 132, 252, 0.22);
}
.zf-fw-channel-btn.channel-weasis.channel-active .zf-channel-led {
    background: #c084fc;
    box-shadow: 0 0 8px #c084fc;
    animation: zfLedPulse 2s infinite ease-in-out;
}
.zf-fw-channel-btn.channel-weasis.channel-active .zf-channel-status-pill {
    background: rgba(192, 132, 252, 0.2);
    color: #d8b4fe;
    border: 1px solid rgba(192, 132, 252, 0.4);
}
.zf-fw-channel-btn.channel-weasis.channel-active i {
    color: #c084fc;
}

/* 3. MOBILEMED PORTABLE (Rosa/Pink) */
.zf-fw-channel-btn.channel-mobilemed.channel-active {
    background: rgba(244, 114, 182, 0.12);
    border-color: rgba(244, 114, 182, 0.55);
    box-shadow: 0 0 12px rgba(244, 114, 182, 0.22);
}
.zf-fw-channel-btn.channel-mobilemed.channel-active .zf-channel-led {
    background: #f472b6;
    box-shadow: 0 0 8px #f472b6;
    animation: zfLedPulse 2s infinite ease-in-out;
}
.zf-fw-channel-btn.channel-mobilemed.channel-active .zf-channel-status-pill {
    background: rgba(244, 114, 182, 0.2);
    color: #fbcfe8;
    border: 1px solid rgba(244, 114, 182, 0.4);
}
.zf-fw-channel-btn.channel-mobilemed.channel-active i {
    color: #f472b6;
}

/* 4. RADIANT (Verde Esmeralda) */
.zf-fw-channel-btn.channel-radiant.channel-active {
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.55);
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.22);
}
.zf-fw-channel-btn.channel-radiant.channel-active .zf-channel-led {
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
    animation: zfLedPulse 2s infinite ease-in-out;
}
.zf-fw-channel-btn.channel-radiant.channel-active .zf-channel-status-pill {
    background: rgba(74, 222, 128, 0.2);
    color: #86efac;
    border: 1px solid rgba(74, 222, 128, 0.4);
}
.zf-fw-channel-btn.channel-radiant.channel-active i {
    color: #4ade80;
}

/* 5. PASTAS LOCAIS / REDE (Âmbar/Dourado) */
.zf-fw-channel-btn.channel-custom.channel-active {
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.55);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.22);
}
.zf-fw-channel-btn.channel-custom.channel-active .zf-channel-led {
    background: #fbbf24;
    box-shadow: 0 0 8px #fbbf24;
    animation: zfLedPulse 2s infinite ease-in-out;
}
.zf-fw-channel-btn.channel-custom.channel-active .zf-channel-status-pill {
    background: rgba(251, 191, 36, 0.2);
    color: #fde68a;
    border: 1px solid rgba(251, 191, 36, 0.4);
}
.zf-fw-channel-btn.channel-custom.channel-active i {
    color: #fbbf24;
}

/* Botão Ação Adicionar Pasta */
.zf-fw-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    border-radius: 20px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.25);
    color: #cbd5e1;
    transition: all 0.2s ease;
}

.zf-fw-add-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary, #60a5fa);
    color: #ffffff;
    transform: translateY(-1px);
}

@keyframes zfLedPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.65; transform: scale(0.85); }
}

/* Pastas vinculadas a canais pausados */
.rm-pacs-folder-item.channel-paused {
    opacity: 0.5 !important;
    filter: grayscale(0.5);
    background: rgba(15, 23, 42, 0.3) !important;
}

.rm-pacs-folder-paused-badge {
    font-size: 9.5px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
    flex-shrink: 0;
}
