:root {
    --primary: #1E709B;
    --primary-hover: #155a75;
    --success: #10b981;
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --border: rgba(30, 112, 155, 0.15);
    --text-main: #1e293b;
    --text-dim: #64748b;
    --accent: #D7CC75;
    --glass: rgba(255, 255, 255, 0.9);
    --amber: #f59e0b;
    --blue-export: #1E709B;
    --green-csv: #D7CC75;
}

[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --bg-light: #0f172a;
    --card-bg: #1e293b;
    --border: rgba(255, 255, 255, 0.1);
    --text-main: #e2e8f0;
    --text-dim: #94a3b8;
    --accent: #06b6d4;
    --glass: rgba(30, 41, 59, 0.9);
    --bg: #0f172a;
    --card: #1e293b;
}

[data-theme="light"] {
    --bg: #f8fafc;
    --card: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Viga', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Background Decor */
.background-decor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(100px);
    opacity: 0.4;
    border-radius: 50%;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: var(--primary);
    top: -100px;
    right: -100px;
    opacity: 0.1;
    animation: float 20s infinite alternate;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: var(--accent);
    bottom: -100px;
    left: -100px;
    opacity: 0.1;
    animation: float 15s infinite alternate-reverse;
}

@keyframes float {
    from { transform: translate(0, 0); }
    to { transform: translate(50px, 50px); }
}

/* App Wrapper */
.app-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-box {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.brand-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
}

.brand-text h1 span {
    color: var(--primary);
}

.brand-text p {
    font-size: 0.8rem;
    color: var(--text-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Learning Badge */
.learning-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--brain-purple);
    animation: pulseGlow 3s infinite;
}

.learning-badge i {
    font-size: 0.9rem;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(168, 85, 247, 0.1); }
    50% { box-shadow: 0 0 15px rgba(168, 85, 247, 0.3); }
}

/* Progress Bar */
.progress-container {
    padding: 0 1rem;
}

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

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--brain-purple), var(--accent));
    background-size: 200% 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    animation: shimmer 2s infinite linear;
}

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

.progress-text {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.3rem;
}

/* Dashboard Grid */
.dashboard-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 320px 1fr 380px;
    gap: 1.5rem;
    min-height: 0;
}

.glass {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.section-header {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.section-header i {
    color: var(--primary);
    font-size: 1.2rem;
}

.section-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

/* Sidebar / Upload */
.upload-sidebar {
    padding-bottom: 0.5rem;
    overflow-y: auto;
}

.upload-zone {
    margin: 1rem 1.25rem;
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 1.5rem 1rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-content i {
    font-size: 2rem;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
}

.upload-content p {
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.upload-content span {
    color: var(--primary);
    font-weight: 600;
}

.upload-content small {
    display: block;
    color: var(--text-dim);
    font-size: 0.75rem;
}

.text-input-area {
    padding: 0 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.text-input-area label {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.text-input-area textarea {
    height: 60px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: white;
    padding: 0.75rem;
    resize: none;
    font-size: 0.85rem;
}

.text-input-area textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Patient Section */
.patient-section {
    padding: 0 1.25rem;
    margin-top: 0.5rem;
}

.section-header-small {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.section-header-small i {
    color: var(--brain-purple);
    font-size: 0.85rem;
}

.patient-fields {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.patient-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    transition: border-color 0.2s;
}

.patient-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.3);
}

.patient-input option {
    background: #1e293b;
    color: white;
}

input[type="text"], 
input[type="number"], 
select, 
textarea {
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: var(--text-main) !important;
    padding: 10px 14px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    transition: all 0.2s !important;
}

input:focus, textarea:focus, select:focus {
    background: rgba(0, 0, 0, 0.1) !important;
    border-color: var(--primary) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(30, 112, 155, 0.2) !important;
}

label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 6px;
    font-weight: 600;
}

.btn-primary {
    margin: 0.75rem 1.25rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    border: none;
    border-radius: 12px;
    padding: 0.85rem;
    color: white;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
}

/* Main Stage / Editor */
.main-stage {
    position: relative;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-dim);
    margin-bottom: 1.5rem;
    opacity: 0.3;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.editor-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.editor-toolbar {
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid var(--border);
}

.divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 0.5rem;
}

.tool-group {
    display: flex;
    gap: 0.5rem;
}

.tool-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn.active {
    background: var(--primary);
    border-color: var(--primary);
}

.editor-status {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    padding: 2rem;
}

#image-canvas {
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    cursor: crosshair;
    transition: transform 0.1s ease-out;
    image-rendering: high-quality;
}

#image-canvas.grabbing {
    cursor: grabbing !important;
}

#image-canvas.pan-mode {
    cursor: grab;
}

#selection-overlay {
    position: absolute;
    pointer-events: none;
    border: 2px solid var(--primary);
    background: rgba(99, 102, 241, 0.2);
    display: none;
}

/* Results Panel */
.results-panel {
    padding-bottom: 0;
}

.exams-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.exams-table {
    width: 100%;
    border-collapse: collapse;
}

.exams-table th {
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-dim);
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.exams-table td {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.exam-row-input {
    background: transparent;
    border: 1px solid transparent;
    color: white;
    width: 100%;
    padding: 0.4rem;
    border-radius: 4px;
}

.exam-row-input:focus {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.2);
    outline: none;
}

.qty-input {
    text-align: center;
    min-width: 40px;
    font-weight: 600;
}

.price-cell {
    color: var(--success);
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}

.price-cell .no-price {
    color: var(--text-dim);
    font-weight: 400;
}

.btn-remove {
    color: var(--accent);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.6;
    transition: 0.2s;
}

.btn-remove:hover {
    opacity: 1;
}

/* Panel Footer */
.panel-footer {
    padding: 1rem 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Financial Summary */
.financial-summary {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fin-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.fin-row span:last-child {
    color: var(--text-main);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.fin-negative {
    color: var(--accent) !important;
}

.fin-total {
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
    margin-top: 0.2rem;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
}

.fin-total span:last-child {
    color: var(--success) !important;
    font-size: 1rem;
}

.fin-pct-input {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--amber);
    font-weight: 600;
    font-size: 0.8rem;
    width: 52px;
    padding: 0.2rem 0.4rem;
    text-align: center;
    margin: 0 0.3rem;
}

.fin-pct-input:focus {
    outline: none;
    border-color: var(--amber);
    background: rgba(245, 158, 11, 0.1);
}

/* Export Buttons */
.export-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-export {
    flex: 1;
    background: var(--blue-export);
    border: none;
    border-radius: 10px;
    padding: 0.6rem 0.5rem;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-export:hover:not(:disabled) {
    filter: brightness(1.2);
    transform: translateY(-1px);
}

.btn-export:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-export-csv {
    background: var(--green-csv);
}

.btn-export-csv:hover:not(:disabled) {
    background: var(--success);
}

.total-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

/* Action Buttons - Split */
.action-buttons-split {
    display: flex;
    gap: 0.5rem;
}

.btn-learn {
    flex: 1;
    background: linear-gradient(135deg, var(--brain-purple), #7c3aed);
    border: none;
    border-radius: 12px;
    padding: 0.85rem 0.5rem;
    color: white;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.btn-learn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-learn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(168, 85, 247, 0.4);
}

.btn-register-pixeon {
    flex: 1;
    background: linear-gradient(135deg, var(--register-blue), #0284c7);
    border: none;
    border-radius: 12px;
    padding: 0.85rem 0.5rem;
    color: white;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.btn-register-pixeon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-register-pixeon:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(14, 165, 233, 0.4);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Toasts */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 9999;
}

.toast {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: white;
    font-size: 0.9rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid var(--primary);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--accent); }
.toast.info { border-left-color: var(--register-blue); }
.toast.learn { border-left-color: var(--brain-purple); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== Modal de Operadores ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.25s ease-out;
}

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

@keyframes modalSlideUp {
    from { transform: translateY(30px) scale(0.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-container {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 520px;
    max-width: 90vw;
    max-height: 80vh;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(30, 112, 155, 0.1);
    animation: modalSlideUp 0.3s ease-out;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(30, 112, 155, 0.04), rgba(215, 204, 117, 0.04));
}

.modal-close-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.08);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 16px;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.add-operator-form {
    background: rgba(30, 112, 155, 0.04);
    border: 1px dashed rgba(30, 112, 155, 0.2);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 20px;
}

.btn-add-operator {
    width: 100%;
    margin-top: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    border: none;
    border-radius: 10px;
    padding: 11px;
    color: white;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s ease;
}

.btn-add-operator:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(30, 112, 155, 0.35);
}

.operators-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.operators-empty {
    text-align: center;
    padding: 30px 20px;
}

.operator-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    transition: all 0.2s ease;
    animation: operatorSlideIn 0.3s ease-out;
}

@keyframes operatorSlideIn {
    from { transform: translateX(-15px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.operator-card:hover {
    background: rgba(30, 112, 155, 0.04);
    border-color: rgba(30, 112, 155, 0.15);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.operator-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.operator-info {
    flex: 1;
    min-width: 0;
}

.operator-info .op-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.operator-info .op-role {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.operator-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.operator-actions button {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 13px;
    transition: all 0.2s;
}

.operator-actions .btn-edit-op:hover {
    background: rgba(30, 112, 155, 0.1);
    border-color: rgba(30, 112, 155, 0.2);
    color: var(--primary);
}

.operator-actions .btn-delete-op:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Operator Select Customization */
#operator-select option {
    background: white;
    color: var(--text-main);
    padding: 8px;
}

/* Responsive Modal */
@media (max-width: 600px) {
    .modal-container {
        width: 95vw;
        max-height: 90vh;
        border-radius: 16px;
    }
    
    .add-operator-form div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* Btn Success Override */
.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    color: white;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s ease;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
}

.btn-success:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.header-btn {
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: .2s;
}
.header-btn:hover { background: var(--primary); color: #fff; }

.fin-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    opacity: .8;
}
.fin-input {
    width: 40px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 2px;
    border-radius: 4px;
}

.search-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    font-size: 14px;
    transition: .15s;
}
.search-item:hover { background: var(--primary); color: #fff; }

.conf-badge, .dup-badge {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 4px;
    display: inline-block;
}

.chat-bubble {
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.4;
}
.chat-bubble.agent {
    align-self: flex-start;
    background: var(--card-bg);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: 0 15px 15px 15px;
    max-width: 85%;
    font-size: 14px;
    border: 1px solid var(--border);
}
.chat-bubble:not(.agent) {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    border-radius: 15px 15px 0 15px;
    max-width: 85%;
    font-size: 14px;
}

.app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
}
.main-header {
    padding: 10px 40px;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}
.brand {
    display: flex;
    align-items: center;
    gap: 20px;
}
.brand-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--primary);
}
.brand-text p {
    font-size: 10px;
    margin: 0;
    opacity: .7;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.operator-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}
.operator-selector select {
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}
.learning-badge {
    background: rgba(16, 185, 129, .1);
    color: #10b981;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(16, 185, 129, .2);
    display: flex;
    align-items: center;
    gap: 8px;
}
.main-layout {
    display: grid;
    grid-template-columns: 480px 1fr;
    gap: 25px;
    flex: 1;
    padding: 25px 40px;
    min-height: 0;
    overflow: hidden;
}
.config-panel, .results-panel {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 25px;
    gap: 20px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 16px;
}
.results-panel {
    overflow: hidden;
    padding: 0;
    gap: 0;
    height: 100%;
    min-height: 0;
}
.agent-chat-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
#chat-messages {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}
.section-header i {
    color: var(--primary);
    font-size: 16px;
}
.patient-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.input-group label {
    font-size: 12px;
    color: var(--text-dim);
    display: block;
    margin-bottom: 4px;
}
.input-group input, .input-group select, .input-group textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
}
.upload-zone {
    padding: 20px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    background: rgba(0,0,0,.02);
    transition: .2s;
}
.btn-primary {
    background: var(--primary);
    border: none;
    color: #fff;
    border-radius: 10px;
    padding: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: .2s;
}
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary {
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: .2s;
}
.btn-secondary:disabled { opacity: .5; }
.exams-table {
    width: 100%;
    font-size: 13px;
}
.exams-table th {
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 11px;
    text-transform: uppercase;
}
.exams-table td {
    padding: 6px 4px;
    border-bottom: 1px solid var(--border);
}
.exam-row-input {
    background: none;
    border: 1px solid transparent;
    color: var(--text-main);
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 13px;
    width: 100%;
}
.exam-row-input:focus {
    border-color: var(--primary);
    background: var(--card-bg);
}
.price-cell { font-size: 13px; color: var(--text-main); }
.no-price { color: var(--text-dim); opacity: .4; }
.financial-summary {
    padding: 18px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
}
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 500;
    align-items: center;
    justify-content: center;
}
.modal-container {
    background: var(--card-bg);
    border-radius: 16px;
    width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}
.modal-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-dim);
}
.modal-body { padding: 20px; }
.toast {
    padding: 12px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    margin-bottom: 8px;
    animation: slideIn .3s ease;
}
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }
.toast.info { background: #3b82f6; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}
.progress-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    z-index: 999;
}
.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width .3s;
    border-radius: 3px;
}
.progress-text {
    text-align: center;
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 6px;
}
