:root {
    --bg-main: #0B0F19;
    --bg-panel: rgba(18, 25, 43, 0.65);
    --bg-header: rgba(11, 15, 25, 0.85);
    --border-color: rgba(255, 255, 255, 0.06);
    --text-main: #E2E8F0;
    --text-muted: #94A3B8;
    --accent-blue: #38BDF8;
    --accent-glow: rgba(56, 189, 248, 0.4);
    --accent-purple: #818cf8;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --font-ui: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

body {
    background: linear-gradient(135deg, #0B0F19 0%, #12192B 50%, #0d1321 100%);
    color: var(--text-main);
    font-family: var(--font-ui);
    height: 100vh;
    overflow: hidden;
    font-size: 13px;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    height: 60px;
    background-color: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(56, 189, 248, 0.08);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(56, 189, 248, 0.05);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.header-upload-form {
    margin: 0;
    padding: 0;
    display: flex;
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-family: var(--font-ui);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.header-upload-btn {
    background: linear-gradient(135deg, rgba(56,189,248,0.1) 0%, rgba(129,140,248,0.1) 100%);
    color: var(--accent-blue);
    border: 1px solid rgba(56, 189, 248, 0.3);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.header-upload-btn:hover {
    background: linear-gradient(135deg, rgba(56,189,248,0.2) 0%, rgba(129,140,248,0.2) 100%);
    color: #fff;
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.header-laudar-btn {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(52, 211, 153, 0.15) 100%) !important;
    color: #10b981 !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.1);
}

.header-laudar-btn:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(52, 211, 153, 0.25) 100%) !important;
    color: #fff !important;
    border-color: #34d399 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.header-trash:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.header-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 4px;
}

.icon {
    cursor: pointer;
    opacity: 0.7;
}

.icon:hover {
    opacity: 1;
}

/* Workspace Grid - Stage 1 (Full Screen) */
.workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    padding: 1.25rem;
    flex: 1;
    overflow: hidden;
}

.right-panels-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.right-panels-wrapper .panel {
    flex: 1;
}

.panel {
    background-color: var(--bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35), 
                0 0 1px rgba(56, 189, 248, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.06);
    min-height: 0;
    transition: transform 0.3s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}

.panel:hover {
    box-shadow: 0 14px 55px rgba(0, 0, 0, 0.45), 
                0 0 2px rgba(56, 189, 248, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border-color: rgba(56, 189, 248, 0.1);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 100%);
}

.panel-header h2 {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-main);
    text-transform: uppercase;
}

.dots {
    color: var(--text-muted);
    cursor: pointer;
}

/* Utilities */
.highlight-blue { color: var(--accent-blue); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.muted { color: var(--text-muted); }
.text-right { text-align: right; }

/* Left Column: Worklist */


.error-msg {
    margin-top: 0.5rem;
    color: var(--danger);
    font-size: 0.8rem;
}

.flash-msg {
    margin-top: 0.5rem;
    color: var(--accent-blue);
    font-size: 0.8rem;
    padding: 0.4rem;
    border-radius: 4px;
    background: rgba(56, 189, 248, 0.1);
}

/* Batch Progress Bar */
.batch-progress {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    margin-bottom: 0.5rem;
    color: var(--accent-blue);
}

.progress-bar-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), #818cf8, var(--accent-blue));
    background-size: 200% 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.5), 0 0 4px rgba(129, 140, 248, 0.3);
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Search Box */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.15);
}

.search-box svg {
    color: var(--text-muted);
    flex-shrink: 0;
    opacity: 0.6;
}

.search-box input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 0.75rem;
    outline: none;
    transition: all 0.2s;
}

.search-box input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.search-box input:focus {
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(56, 189, 248, 0.05);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.15);
}

.search-count {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--accent-blue);
    white-space: nowrap;
    opacity: 0.8;
}

.worklist-table {
    flex: 1;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.table-header, .table-row {
    display: grid;
    grid-template-columns: 24px 1.2fr 45px 1.2fr 60px 80px;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    align-items: center;
    gap: 0.5rem;
}

.table-header span:nth-child(1), .table-row > span:nth-child(1) { text-align: left; }
.table-header span:nth-child(2), .table-row > span:nth-child(2) { text-align: left; }
.table-header span:nth-child(3), .table-row > span:nth-child(3) { text-align: center; }
.table-header span:nth-child(4), .table-row > span:nth-child(4) { text-align: left; }

.table-header span:nth-child(5) { text-align: center; }
.table-row > span:nth-child(5) { 
    display: flex;
    justify-content: center;
}

.table-header span:nth-child(6) { text-align: right; }
.table-row > span:nth-child(6) { 
    display: flex;
    justify-content: flex-end;
}

.patient-name {
    font-size: 0.95rem;
    font-family: var(--font-ui);
    font-weight: 600;
    color: #f1f5f9;
    text-transform: capitalize;
    line-height: 1.3;
    word-break: break-word;
    letter-spacing: -0.01em;
}

.premium-number {
    font-size: 0.85rem;
    font-weight: 800;
    font-family: var(--font-mono);
    width: 22px;
    text-align: right;
    user-select: none;
    background: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(56, 189, 248, 0.2));
    letter-spacing: -0.5px;
}

.row-number {
    font-size: 1.7rem;
    font-weight: 200;
    color: rgba(255, 255, 255, 0.05);
    font-family: var(--font-mono);
    width: 38px;
    text-align: left;
    flex-shrink: 0;
    line-height: 1;
    letter-spacing: -1.5px;
    margin-right: 4px;
    user-select: none;
    transition: color 0.3s ease;
}

.table-row:hover .row-number {
    color: rgba(56, 189, 248, 0.2);
}

.views-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.55rem;
    font-weight: 700;
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    border: 1px solid rgba(56, 189, 248, 0.15);
    letter-spacing: 0.04em;
}

.viewer-images {
    display: flex;
    gap: 4px;
    height: 100%;
    width: 100%;
    justify-content: center;
    align-items: center;
}

.viewer-images img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    flex: 1;
    min-width: 0;
}

.table-header {
    color: #475569;
    font-weight: 700;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, var(--bg-panel) 80%, transparent);
    z-index: 2;
    padding: 0.7rem 1rem;
}

.table-row {
    cursor: pointer;
    transition: all 0.25s ease;
    animation: fadeIn 0.4s ease-out forwards;
    position: relative;
    border-radius: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.table-row:hover {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.04) 0%, rgba(129,140,248,0.02) 50%, transparent 100%);
    padding-left: 1.15rem;
}
.table-row:hover .patient-name {
    color: #ffffff;
}

.table-row.active {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.08) 0%, rgba(56, 189, 248, 0) 100%);
    border-left: 3px solid #38bdf8;
    padding-left: calc(1rem - 3px);
    box-shadow: inset 0 0 20px rgba(56, 189, 248, 0.03);
}
.table-row.active .patient-name {
    color: #38bdf8;
}

[class^="status-"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 8px;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}
.table-row:hover [class^="status-"] { transform: scale(1.08); }

.status-pronto { 
    color: #10b981; 
    background: rgba(16, 185, 129, 0.1); 
    border: 1px solid rgba(16, 185, 129, 0.25); 
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.12); 
}
.status-processando { 
    color: #a855f7; 
    background: rgba(168, 85, 247, 0.1); 
    border: 1px solid rgba(168, 85, 247, 0.25);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.15);
    animation: statusPulse 2s ease-in-out infinite;
}
.status-pendente { 
    color: #64748b; 
    background: rgba(100, 116, 139, 0.08); 
    border: 1px solid rgba(100, 116, 139, 0.2); 
}
.status-erro { 
    color: #ef4444; 
    background: rgba(239, 68, 68, 0.1); 
    border: 1px solid rgba(239, 68, 68, 0.25); 
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.12); 
}

@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(168, 85, 247, 0.15); transform: scale(1); }
    50% { box-shadow: 0 0 20px rgba(168, 85, 247, 0.4); transform: scale(1.1); }
}

/* Item Progress Bar */
.item-progress-container {
    grid-column: 1 / -1;
    padding: 0 1rem 0.5rem 1rem;
    margin-top: -0.5rem;
}

.item-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: #d946ef;
    margin-bottom: 2px;
}

.item-progress-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
}

.item-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #d946ef, #818cf8, #d946ef);
    background-size: 200% 100%;
    transition: width 0.4s ease;
    animation: shimmer 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(217, 70, 239, 0.4);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.action-link { 
    background: rgba(56, 189, 248, 0.08);
    color: #38bdf8;
    padding: 6px;
    border: 1px solid rgba(56, 189, 248, 0.15);
    border-radius: 7px;
    text-decoration: none;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.action-link:hover { 
    background: rgba(56, 189, 248, 0.18); 
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
    transform: translateY(-1px);
    text-decoration: none; 
}

.action-delete { 
    color: #ef4444; 
    text-decoration: none; 
    opacity: 0.5;
    padding: 6px;
    border-radius: 7px;
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.action-delete:hover { 
    opacity: 1; 
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.15);
    transform: translateY(-1px);
}

.action-redo {
    color: #f59e0b;
    text-decoration: none;
    opacity: 0.7;
    padding: 6px;
    border-radius: 7px;
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.12);
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.action-redo:hover { 
    opacity: 1; 
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
    transform: translateY(-1px);
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.empty-row {
    opacity: 0.5;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(11, 17, 32, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    gap: 1rem;
    font-family: var(--font-mono);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spin-anim {
    animation: spin 2s linear infinite;
}

.visualizer-panel {
    position: relative;
}

/* Center Column: Visualizer */
.dicom-viewer {
    flex: 1;
    background-color: #000;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.viewer-overlays {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-blue);
    text-shadow: 0 0 3px rgba(56, 189, 248, 0.4), 0 1px 3px rgba(0, 0, 0, 0.8);
    padding: 1rem;
    line-height: 1.5;
    letter-spacing: 0.5px;
}

.overlay { position: absolute; }
.top-left { top: 1rem; left: 1rem; }
.top-right { top: 1rem; right: 1rem; }
.bottom-right { bottom: 1rem; right: 1rem; }

.dicom-viewer img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.empty-viewer {
    text-align: center;
    font-family: var(--font-mono);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-viewer .empty-icon {
    color: var(--accent-blue);
    opacity: 0.4;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.3));
}

.empty-viewer p {
    margin: 0.25rem 0;
}

/* Multimodal Analysis */
.multimodal-analysis {
    display: flex;
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    gap: 1rem;
    background-color: rgba(0, 0, 0, 0.2);
}

.analysis-left {
    flex: 2;
}

.analysis-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-left: 1px solid var(--border-color);
    padding-left: 1rem;
}

.multimodal-analysis h3 {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.bar-row span:first-child {
    width: 120px;
}

.bar-track {
    flex: 1;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
    margin: 0 8px;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.bar-low {
    background: linear-gradient(90deg, #10b981, #34d399);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.bar-medium {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.bar-high {
    background: linear-gradient(90deg, #ef4444, #f87171);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.gauge {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: conic-gradient(var(--accent-blue) var(--gauge-percent, 0%), rgba(255,255,255,0.05) var(--gauge-percent, 0%));
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.5rem;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.3), inset 0 0 10px rgba(56, 189, 248, 0.1);
    transition: all 0.5s ease;
}

.gauge::before {
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--bg-panel);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}

.gauge:hover {
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.6), inset 0 0 15px rgba(56, 189, 248, 0.2);
}

.gauge-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 12px rgba(56, 189, 248, 0.8);
    position: relative;
    z-index: 10;
}

.gauge-labels {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-align: center;
    margin-top: 0.5rem;
}

/* Right Column: Editor */
.editor-subtitle {
    padding: 0.2rem 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--accent-blue);
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 4px;
    margin: 0 1rem 0.5rem 1rem;
    display: inline-block;
    letter-spacing: 0.5px;
}

.editor-content {
    flex: 1;
    padding: 0 1rem 1rem 1rem;
    overflow-y: auto;
}

.patient-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

/* ===== Patient Card Premium ===== */
.pc-card {
    background: linear-gradient(160deg, rgba(15,23,42,0.9), rgba(11,17,32,0.7));
    border: 1px solid rgba(56,189,248,0.1);
    border-radius: 14px;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 1px rgba(56,189,248,0.15), inset 0 1px 0 rgba(255,255,255,0.04);
    animation: pcSlideIn 0.4s ease-out;
}
@keyframes pcSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.pc-header {
    background: linear-gradient(135deg, rgba(56,189,248,0.1), rgba(129,140,248,0.06), rgba(192,132,252,0.04));
    padding: 14px 18px;
    border-bottom: 1px solid rgba(56,189,248,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.pc-avatar {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #38bdf8, #818cf8, #c084fc);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(56,189,248,0.3), 0 0 0 2px rgba(56,189,248,0.08);
}
.pc-avatar span {
    color: #fff; font-size: 1.1rem; font-weight: 800; text-transform: uppercase;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.pc-name-block { min-width: 0; flex: 1; }
.pc-name {
    font-size: 1rem; font-weight: 700; color: #f8fafc; line-height: 1.3;
    text-transform: capitalize; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pc-sub {
    font-size: 0.58rem; color: #475569; font-family: var(--font-mono);
    letter-spacing: 0.12em; font-weight: 600; margin-top: 1px;
}

.pc-grid {
    padding: 14px 18px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.pc-info-item {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 10px;
    padding: 10px 12px;
    transition: all 0.3s ease;
}
.pc-info-item:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(56,189,248,0.12);
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.pc-icon {
    width: 34px; height: 34px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}
.pc-info-item:hover .pc-icon { transform: scale(1.08); }

.pc-icon-blue { background: rgba(56,189,248,0.1); border: 1px solid rgba(56,189,248,0.15); color: #38bdf8; }
.pc-icon-blue:hover, .pc-info-item:hover .pc-icon-blue { box-shadow: 0 0 12px rgba(56,189,248,0.2); }

.pc-icon-purple { background: rgba(129,140,248,0.1); border: 1px solid rgba(129,140,248,0.15); color: #818cf8; }
.pc-icon-purple:hover, .pc-info-item:hover .pc-icon-purple { box-shadow: 0 0 12px rgba(129,140,248,0.2); }

.pc-icon-green { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.15); color: #10b981; }
.pc-icon-green:hover, .pc-info-item:hover .pc-icon-green { box-shadow: 0 0 12px rgba(16,185,129,0.2); }

.pc-icon-amber { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.15); color: #f59e0b; }
.pc-icon-amber:hover, .pc-info-item:hover .pc-icon-amber { box-shadow: 0 0 12px rgba(245,158,11,0.2); }

.pc-label {
    font-size: 0.58rem; color: #475569; text-transform: uppercase;
    letter-spacing: 0.12em; font-weight: 700; font-family: var(--font-ui);
    margin-bottom: 2px;
}
.pc-value {
    font-size: 0.95rem; color: #f1f5f9; font-weight: 600;
    font-family: var(--font-ui);
}

.pc-exam-bar {
    margin: 0 18px 16px 18px;
    background: linear-gradient(135deg, rgba(56,189,248,0.06), rgba(129,140,248,0.03));
    border: 1px solid rgba(56,189,248,0.1);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex; align-items: center; gap: 12px;
    transition: all 0.3s ease;
}
.pc-exam-bar:hover {
    border-color: rgba(56,189,248,0.2);
    box-shadow: 0 2px 16px rgba(56,189,248,0.08);
}
.pc-exam-name {
    font-size: 0.9rem; color: #38bdf8; font-weight: 700;
    font-family: var(--font-ui);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.patient-card-header {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-blue);
    padding: 0.6rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-ui);
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(56, 189, 248, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.patient-card-body {
    padding: 1.2rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.patient-card-body .info-group:nth-child(1) {
    grid-column: span 3;
}
.patient-card-body .info-group:nth-child(2) {
    grid-column: span 1;
}
.patient-card-body .info-group:nth-child(3) {
    grid-column: span 1;
}
.patient-card-body .info-group:nth-child(4) {
    grid-column: span 1;
}
.patient-card-body .info-group:nth-child(5) {
    grid-column: span 3;
}

.info-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.info-group label {
    font-size: 0.6rem;
    color: var(--accent-blue);
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
    font-family: var(--font-ui);
    font-weight: 600;
}

.info-group span {
    font-size: 0.95rem;
    color: #f8fafc;
    font-family: var(--font-ui);
    font-weight: 500;
}

.editor-content pre {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.7;
    color: #F8FAFC;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
    background: rgba(11, 15, 25, 0.6);
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    min-height: 100%;
    box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.editor-actions {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.85rem;
    border-radius: 6px;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    background: transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-success {
    border: 1px solid #10b981;
    color: #fff;
    background: rgba(16, 185, 129, 0.8);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.2);
}

.btn-success:hover { 
    background: rgba(16, 185, 129, 1);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.btn-primary {
    border: 1px solid #3b82f6;
    color: #fff;
    background: rgba(59, 130, 246, 0.8);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover { 
    background: rgba(59, 130, 246, 1);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.btn-danger {
    border: 1px solid #ef4444;
    color: #fff;
    background: rgba(239, 68, 68, 0.8);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover { 
    background: rgba(239, 68, 68, 1);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

/* Footer */
.app-footer {
    height: 40px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-header);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

.footer-stats {
    display: flex;
    align-items: center;
    gap: 2rem;
    text-align: right;
}

.security-badge {
    color: var(--success);
    border: 1px solid var(--success);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.1);
}

/* Double-Check Review Box */
.review-box {
    margin-top: 12px;
    padding: 14px 18px;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
}

.review-approved {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.review-attention {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.review-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
    opacity: 0.9;
}

.review-body {
    font-size: 0.85rem;
    color: #e2e8f0;
    line-height: 1.6;
}

/* Responsividade - Estágio 2: Meia Tela Larga (900px - 1400px) */
@media (max-width: 1400px) {
    body { overflow-y: auto; height: auto; }
    .app-container { height: auto; min-height: 100vh; }
    
    .workspace {
        display: flex;
        flex-wrap: wrap;
        overflow: visible;
    }
    
    .worklist-panel {
        width: 100%;
        height: 550px;
    }
    
    .right-panels-wrapper {
        width: 100%;
        flex-direction: row;
        height: 600px;
    }
    
    .visualizer-panel, .editor-panel {
        width: calc(50% - 0.5rem);
        height: 100%;
    }
}

/* Responsividade - Estágio 3: Meia Tela Estreita (< 900px) */
@media (max-width: 900px) {
    .workspace {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
    }
    
    .worklist-panel, .right-panels-wrapper {
        width: 100%;
    }
    
    .right-panels-wrapper {
        flex-direction: column;
        height: auto;
    }

    .visualizer-panel, .editor-panel {
        width: 100%;
        height: 500px;
    }
}

/* VIEWER TOOLBAR & LAYOUT */
.viewer-toolbar {
    display: flex;
    justify-content: center;
    gap: 8px;
    background: #0f172a;
    padding: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.tool-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-size: 0.8em;
}

.tool-btn:hover {
    color: var(--text-light);
    background: rgba(255,255,255,0.05);
}

.tool-btn.active {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.3);
}

.viewer-layout {
    display: flex;
    flex-direction: row;
    flex: 1;
    width: 100%;
    overflow: hidden;
}

.viewer-sidebar {
    width: 120px;
    background: rgba(0, 0, 0, 0.4);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 8px;
    overflow-y: auto;
}

.thumbnail {
    position: relative;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
}

.thumbnail.active {
    border-color: #38bdf8;
}

.thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

.thumb-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
}

.viewer-main-container {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: #000;
}

.viewer-main-container img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    transform-origin: center center;
    /* transition: transform 0.1s ease-out; Removido para drag mais suave */
}
