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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

#login-screen {
    min-height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    z-index: 1000;
}

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

#login-screen.active {
    display: flex;
}

#main-screen {
    display: none;
}

#main-screen.active {
    display: block;
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 35px 40px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 100px rgba(255, 255, 255, 0.1);
    width: 100%;
    max-width: 450px;
    text-align: center;
    animation: slideUp 0.6s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

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

.logo-wrapper {
    margin-bottom: 20px;
    animation: fadeIn 0.6s ease-out 0.1s both;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.brand-logo {
    max-width: 140px;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.brand-logo:hover {
    transform: scale(1.05);
}

.welcome-title {
    font-size: 1.8rem;
    margin-bottom: 6px;
    color: #1e293b;
    font-weight: 700;
    letter-spacing: -0.5px;
    animation: fadeIn 0.6s ease-out 0.15s both;
}

.subtitle {
    color: #475569;
    margin-bottom: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    animation: fadeIn 0.6s ease-out 0.2s both;
}

.service-type {
    color: #667eea;
    margin-bottom: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    animation: fadeIn 0.6s ease-out 0.3s both;
}

.input-group {
    position: relative;
    margin-bottom: 16px;
    animation: fadeIn 0.6s ease-out 0.4s both;
}

.input-group input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    font-size: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    transition: all 0.3s ease;
    color: #1e293b;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.input-group .input-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.input-group input:focus + .input-icon {
    opacity: 1;
}

.toggle-password {
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    opacity: 0.6;
    transition: all 0.3s ease;
    z-index: 10;
}

.toggle-password:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.toggle-password:active {
    transform: translateY(-50%) scale(0.95);
}

.login-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
    animation: fadeIn 0.6s ease-out 0.6s both;
}

.login-footer p {
    color: #94a3b8;
    font-size: 0.85rem;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.app-header {
    background: var(--bg-white);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    height: 40px;
    width: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.header-logo:hover {
    transform: scale(1.05);
}

.app-header h1 {
    font-size: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.action-bar {
    padding: 20px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
}

.tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    padding: 20px;
    background: var(--bg-light);
}

.tab {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: white;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-height: 120px;
    position: relative;
    overflow: hidden;
}

.tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0);
    transition: all 0.3s ease;
}

.tab:hover::before {
    background: rgba(255, 255, 255, 0.1);
}

.tab:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.tab.active {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.tab.active::before {
    background: rgba(255, 255, 255, 0.15);
}

.tab[data-status="RECEIVED"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.tab[data-status="SCORING"] {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.tab[data-status="READY"] {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.tab[data-view="upload-pg"] {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.tab[data-view="upload-psg"] {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.tab-icon {
    font-size: 2.5rem;
    position: relative;
    z-index: 1;
}

.tab-label {
    display: block;
    font-size: 0.95rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.tab-count {
    background: rgba(255, 255, 255, 0.3);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.tab.active .tab-count {
    background: rgba(255, 255, 255, 0.5);
}

.patient-list {
    padding: 20px;
}

.patient-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.patient-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.patient-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 10px;
}

.patient-info h3 {
    font-size: 1.1rem;
    margin-bottom: 3px;
}

.patient-ref {
    color: var(--text-light);
    font-size: 0.85rem;
}

.study-type {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.study-type.PG {
    background: #dbeafe;
    color: #1e40af;
}

.study-type.PSG {
    background: #fef3c7;
    color: #92400e;
}

.patient-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.patient-date {
    color: var(--text-light);
    font-size: 0.85rem;
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 50%, #6d28d9 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.25), 0 1px 2px rgba(0,0,0,0.06);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 50%, #5b21b6 100%);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(139, 92, 246, 0.2);
}

#login-form .btn-primary {
    width: 100%;
    padding: 16px 20px;
    margin-top: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    animation: fadeIn 0.6s ease-out 0.5s both;
}

#login-form .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

#login-form .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-dark);
    border: 1.5px solid var(--border);
}

.btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

.claim-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
}

.claim-btn:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.5);
    transform: translateY(-3px);
}

.claim-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 20px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255,255,255,0.1);
    animation: modalSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px 28px 20px 28px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.01em;
}

.close {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.2s;
    background: transparent;
}

.close:hover {
    color: var(--text-dark);
    background: var(--bg-light);
}

form {
    padding: 28px;
}

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.92rem;
    letter-spacing: -0.01em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 0.97rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: #f8fafd;
    color: var(--text-dark);
    -webkit-appearance: none;
    appearance: none;
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="tel"]:hover,
select:hover,
textarea:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #8b5cf6;
    background: #ffffff;
    box-shadow: 0 0 0 3.5px rgba(139, 92, 246, 0.12), 0 1px 2px rgba(0,0,0,0.04);
}

input::placeholder, textarea::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}

textarea {
    resize: vertical;
    min-height: 44px;
    line-height: 1.5;
}

.file-input-wrapper {
    position: relative;
}

input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-name {
    display: block;
    padding: 14px;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    text-align: center;
    color: var(--text-light);
    background: #f8fafd;
    cursor: pointer;
    font-size: 0.93rem;
    transition: all 0.2s;
}

.file-name:hover {
    border-color: #8b5cf6;
    background: #f5f3ff;
}

.file-name.selected {
    border-color: #8b5cf6;
    border-style: solid;
    color: #7c3aed;
    background: #f5f3ff;
}

.error {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 10px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

@media (min-width: 640px) {
    .tab-label {
        display: inline;
    }
    
    .tab-icon {
        display: none;
    }
}

@media (min-width: 768px) {
    .app-header h1 {
        font-size: 1.8rem;
    }
    
    .patient-card {
        padding: 20px;
    }
}

.time-tracking-panel {
    padding: 20px;
    background: var(--bg-light);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-width: 1200px;
}

.stat-card {
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    color: white;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.performance-card {
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
}

.alert-card {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
}

.stat-header {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1;
}

.stat-subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 8px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 12px;
}

.progress-fill {
    height: 100%;
    background: white;
    transition: width 0.5s ease;
    border-radius: 4px;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: 2rem;
    }
}

/* Upload Panel */
.upload-panel {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px;
}

.upload-header {
    text-align: center;
    margin-bottom: 32px;
}

.upload-header h2 {
    font-size: 24px;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.upload-subtitle {
    color: var(--text-light);
    font-size: 14px;
}

/* Dropzone */
.dropzone {
    border: 3px dashed var(--border);
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    background: var(--bg-white);
    transition: all 0.3s ease;
    cursor: pointer;
}

.dropzone:hover {
    border-color: var(--primary);
    background: #eff6ff;
}

.dropzone.dragover {
    border-color: var(--primary);
    background: #dbeafe;
    transform: scale(1.02);
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.dropzone-icon {
    font-size: 64px;
}

.dropzone-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

.dropzone-hint {
    font-size: 14px;
    color: var(--text-light);
}

/* Upload Queue */
.upload-queue {
    margin-top: 32px;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.queue-header h3 {
    font-size: 18px;
    color: var(--text-dark);
}

.queue-actions {
    display: flex;
    gap: 12px;
}

.queue-list {
    background: var(--bg-white);
    border-radius: 8px;
    overflow: hidden;
    max-height: 400px;
    overflow-y: auto;
}

.queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.queue-item:last-child {
    border-bottom: none;
}

.queue-item-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.queue-item-icon {
    font-size: 20px;
}

.queue-item-details {
    flex: 1;
}

.queue-item-name {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 14px;
    margin-bottom: 4px;
}

.queue-item-meta {
    font-size: 12px;
    color: var(--text-light);
}

.queue-item-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.status-pending {
    color: var(--text-light);
}

.status-uploading {
    color: var(--primary);
}

.status-uploading-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--primary);
    min-width: 220px;
}

.file-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 3px;
    overflow: hidden;
    min-width: 80px;
}

.file-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #ec4899);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.file-progress-pct {
    font-weight: 600;
    min-width: 35px;
    text-align: right;
}

.status-success {
    color: var(--success);
}

.status-error {
    color: var(--danger);
}

.queue-item-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
}

/* Upload Progress */
.upload-progress {
    margin-top: 24px;
    background: var(--bg-white);
    padding: 20px;
    border-radius: 8px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-text {
    font-weight: 500;
    color: var(--text-dark);
}

.progress-stats {
    font-size: 14px;
    color: var(--text-light);
}

.progress-bar-container {
    background: var(--bg-light);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* Upload Report */
.upload-report {
    margin-top: 24px;
    background: var(--bg-white);
    padding: 20px;
    border-radius: 8px;
}

.upload-report h3 {
    margin-bottom: 16px;
    color: var(--text-dark);
}

.report-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-section {
    padding: 12px;
    border-radius: 6px;
    background: var(--bg-light);
}

.report-section-title {
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-section-list {
    list-style: none;
    font-size: 14px;
    color: var(--text-light);
}

.report-section-list li {
    padding: 4px 0;
}

.report-success {
    border-left: 4px solid var(--success);
}

.report-error {
    border-left: 4px solid var(--danger);
}

/* Admin View */
.admin-header {
    padding: 32px 24px 16px;
    border-bottom: 2px solid var(--border);
    background: var(--bg-white);
}

.admin-header h2 {
    font-size: 28px;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.admin-header p {
    color: var(--text-light);
    font-size: 14px;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px 20px;
    background: rgba(255,255,255,0.95);
    border-bottom: 2px solid rgba(99, 102, 241, 0.1);
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
}
.admin-nav-btn {
    padding: 8px 16px;
    border: 1px solid rgba(99, 102, 241, 0.15);
    background: rgba(99, 102, 241, 0.05);
    color: #64748b;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}
.admin-nav-btn:hover {
    background: rgba(99, 102, 241, 0.12);
    color: #6366f1;
    border-color: rgba(99, 102, 241, 0.3);
}
.admin-nav-btn.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.admin-section {
    display: none;
}
.admin-section.active {
    display: block;
}

.filter-input, .filter-select {
    padding: 8px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    background: white;
    color: #334155;
    transition: border-color 0.3s;
}
.filter-input:focus, .filter-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.audit-filters, .message-tabs, .ia-training-tabs, .automation-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    flex-wrap: wrap;
    align-items: center;
}
.message-tab, .ia-train-tab, .auto-tab {
    padding: 6px 14px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #64748b;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}
.message-tab.active, .ia-train-tab.active, .auto-tab.active {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}
.message-tab:hover, .ia-train-tab:hover, .auto-tab:hover {
    border-color: #6366f1;
    color: #6366f1;
}
.message-tab.active:hover, .ia-train-tab.active:hover, .auto-tab.active:hover {
    color: white;
}

@media (max-width: 768px) {
    .admin-nav {
        padding: 8px 10px;
        gap: 4px;
    }
    .admin-nav-btn {
        padding: 6px 10px;
        font-size: 0.7rem;
    }
}

.users-table-container {
    padding: 24px;
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.users-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.users-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.users-table tbody tr:hover {
    background: var(--bg-light);
}

.users-table td {
    padding: 16px;
    color: var(--text-dark);
}

.user-email {
    font-weight: 500;
    color: var(--primary);
}

.user-role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.user-role-badge.admin {
    background: #fef3c7;
    color: #92400e;
}

.user-role-badge.physician {
    background: #dbeafe;
    color: #1e40af;
}

.user-role-badge.technician {
    background: #dcfce7;
    color: #166534;
}

.user-role-badge.viewer {
    background: #f3f4f6;
    color: #374151;
}

.user-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.user-status.active {
    background: #dcfce7;
    color: #166534;
}

.user-status.suspended {
    background: #fee2e2;
    color: #991b1b;
}

.user-stats {
    font-size: 13px;
    color: var(--text-light);
}

.user-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn-suspend {
    background: #fef3c7;
    color: #92400e;
}

.action-btn-suspend:hover {
    background: #fde68a;
}

.action-btn-activate {
    background: #dcfce7;
    color: #166534;
}

.action-btn-activate:hover {
    background: #bbf7d0;
}

.action-btn-delete {
    background: #fee2e2;
    color: #991b1b;
}

.action-btn-delete:hover {
    background: #fecaca;
}

.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.legal-notice {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 6px 20px;
    text-align: center;
    font-size: 11px;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border-bottom: 1px solid #475569;
}

.legal-notice p {
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.3px;
}

body {
    padding-top: 30px;
}

#login-screen {
    padding-top: 50px;
}

.otp-email {
    text-align: center;
    font-size: 1.1rem;
    color: #764ba2;
    font-weight: 600;
    margin: 0.5rem 0 2rem 0;
}

.checkbox-group {
    margin: 1.5rem 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #1e293b;
    cursor: pointer;
    font-size: 0.95rem;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #764ba2;
}

.checkbox-label span {
    flex: 1;
}

#otp-cancel-btn {
    margin-top: 1rem;
    width: 100%;
}

#otp-screen {
    min-height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    z-index: 1000;
}

#otp-screen.active {
    display: flex;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

#create-user-form,
#create-org-form {
    padding: 28px;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.83rem;
    color: #94a3b8;
    line-height: 1.4;
}

.role-description {
    color: #8b5cf6;
    font-weight: 500;
}

.permissions-section {
    margin: 24px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 14px;
    border: 1.5px solid var(--border);
}

.permissions-section h3 {
    font-size: 1.05rem;
    color: var(--text-dark);
    margin-bottom: 16px;
    font-weight: 700;
}

.permissions-grid {
    display: grid;
    gap: 10px;
}

.permission-item {
    padding: 11px 16px;
    background: white;
    border-radius: 10px;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.permission-item:hover {
    border-color: #cbd5e1;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}

.modal-actions button {
    flex: 1;
}

.admin-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.admin-header-content > div {
    flex: 1;
}

#add-user-btn {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .modal-content {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px;
    }
    
    .modal-header {
        padding: 20px 20px 14px 20px;
    }
    
    #create-user-form,
    #create-org-form,
    form {
        padding: 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .admin-header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    #add-user-btn {
        width: 100%;
    }
}

/* Invoice Modal */
.modal-large .modal-content {
    max-width: 800px;
}

.alert-message {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 15px;
    color: #92400e;
}

/* Invoice Cards */
.invoice-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.invoice-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.invoice-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.invoice-period {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

.invoice-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.status-unpaid {
    background: #fef3c7;
    color: #92400e;
}

.status-overdue {
    background: #fee2e2;
    color: #991b1b;
}

.status-paid {
    background: #d1fae5;
    color: #065f46;
}

.invoice-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.invoice-detail {
    text-align: center;
}

.invoice-detail-label {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.invoice-detail-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
}

.invoice-total {
    text-align: right;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 16px;
}

.invoice-total-label {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.invoice-total-amount {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.invoice-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-pay {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-pay:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-view {
    background: white;
    color: var(--primary);
    padding: 12px 24px;
    border-radius: 8px;
    border: 2px solid var(--primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-view:hover {
    background: var(--primary);
    color: white;
}

.invoices-panel {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.invoices-header {
    margin-bottom: 24px;
}

.invoices-header h2 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.invoices-header p {
    color: var(--text-light);
    font-size: 1rem;
}

.invoices-list {
    display: grid;
    gap: 16px;
}

.invoice-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.invoice-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.invoice-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.invoice-card-title {
    flex: 1;
}

.invoice-card-title h3 {
    font-size: 1.2rem;
    margin-bottom: 4px;
    color: var(--text-dark);
}

.invoice-card-title p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.invoice-card-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.PAID {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.UNPAID {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.OVERDUE {
    background: #fef3c7;
    color: #92400e;
}

.invoice-card-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.invoice-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.invoice-stat-label {
    color: var(--text-light);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.invoice-stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.invoice-card-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.btn-download-pdf {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-download-pdf:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-download-pdf:disabled {
    background: var(--secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

@media (max-width: 768px) {
    .invoice-details {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .invoice-actions {
        flex-direction: column;
    }
    
    .btn-pay, .btn-view {
        width: 100%;
    }
    
    .invoice-card-body {
        grid-template-columns: 1fr;
    }
    
    .invoice-card-footer {
        flex-direction: column;
    }
    
    .btn-download-pdf {
        width: 100%;
        justify-content: center;
    }
}

.user-row-clickable {
    cursor: pointer;
    transition: background 0.2s;
}

.user-row-clickable:hover {
    background: rgba(139, 92, 246, 0.08) !important;
}

.user-dashboard-panel {
    animation: dashSlideIn 0.35s ease;
}

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

.dash-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dash-topbar-actions {
    display: flex;
    gap: 8px;
}

.btn-back {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-back:hover {
    background: var(--bg-light);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-export-csv {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-export-csv:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.dash-profile-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(59, 130, 246, 0.04));
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 20px;
}

.dash-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.4rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

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

.dash-profile-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.dash-profile-main h2 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--text);
    word-break: break-all;
}

.dash-role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dash-role-badge.admin { background: #8b5cf6; color: #fff; }
.dash-role-badge.physician { background: #3b82f6; color: #fff; }
.dash-role-badge.technician { background: #10b981; color: #fff; }
.dash-role-badge.viewer { background: #6b7280; color: #fff; }

.dash-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dash-status-dot.online { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.dash-status-dot.away { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,0.4); }
.dash-status-dot.offline { background: #9ca3af; }

.dash-profile-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.dash-meta-item {
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
}

.dash-quick-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.dash-action-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.dash-action-suspend {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
}

.dash-action-suspend:hover { background: #fee2e2; }

.dash-action-activate {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.dash-action-activate:hover { background: #dcfce7; }

.dash-inactivity-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    color: #92400e;
    font-size: 14px;
    margin-bottom: 20px;
}

.dash-alert-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.dashboard-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.sc-icon {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.summary-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

.summary-value small {
    font-size: 0.6em;
    font-weight: 500;
}

.sc-patients .summary-value { color: #3b82f6; }
.sc-studies .summary-value { color: #8b5cf6; }
.sc-assignments .summary-value { color: #f59e0b; }
.sc-rate .summary-value { color: #22c55e; }
.sc-avg .summary-value { color: #14b8a6; }
.sc-invoices .summary-value { color: #ef4444; }
.sc-hours .summary-value { color: #6366f1; }

.summary-label {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.dash-activity-chart {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 20px;
}

.dash-chart-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

.dash-chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 120px;
}

.dash-chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.dash-chart-value {
    font-size: 10px;
    color: var(--text-light);
    margin-bottom: 4px;
    font-weight: 600;
}

.dash-chart-bar {
    width: 100%;
    max-width: 32px;
    background: linear-gradient(180deg, #8b5cf6, #6366f1);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.5s ease;
}

.dash-chart-label {
    font-size: 9px;
    color: var(--text-light);
    margin-top: 6px;
    white-space: nowrap;
}

.dashboard-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dashboard-tab {
    background: none;
    border: none;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dashboard-tab:hover {
    color: var(--primary);
    background: rgba(139, 92, 246, 0.04);
}

.dashboard-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-count {
    background: var(--bg-light);
    color: var(--text-light);
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.dashboard-tab.active .tab-count {
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary);
}

.dashboard-tab-content {
    min-height: 200px;
}

.dash-table-filter {
    margin-bottom: 12px;
}

.dash-filter-input {
    width: 100%;
    max-width: 360px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    background: var(--bg-card);
    color: var(--text);
    transition: border-color 0.2s;
}

.dash-filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.dashboard-table thead th {
    background: var(--bg-light);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-light);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
}

.dashboard-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.dashboard-table tbody tr.row-odd {
    background: rgba(139, 92, 246, 0.02);
}

.dashboard-table tbody tr:hover {
    background: rgba(139, 92, 246, 0.06) !important;
}

.dash-status-badge {
    display: inline-block;
    color: #fff;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.dash-notes-section {
    max-width: 640px;
}

.dash-note-form {
    margin-bottom: 20px;
}

.dash-note-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    background: var(--bg-card);
    color: var(--text);
    margin-bottom: 10px;
    transition: border-color 0.2s;
}

.dash-note-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.dash-note {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
}

.dash-note-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.dash-note-author {
    font-weight: 600;
    font-size: 13px;
    color: var(--primary);
}

.dash-note-date {
    font-size: 12px;
    color: var(--text-light);
}

.dash-note-delete {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.dash-note-delete:hover {
    color: #ef4444;
}

.dash-note-content {
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
    white-space: pre-wrap;
}

@media (max-width: 768px) {
    .dash-profile-card {
        flex-direction: column;
        text-align: center;
    }
    .dash-profile-meta {
        justify-content: center;
    }
    .dash-quick-actions {
        justify-content: center;
    }
    .dashboard-summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-tabs {
        flex-wrap: nowrap;
    }
    .dashboard-table {
        font-size: 12px;
    }
    .dash-chart-bars {
        height: 80px;
    }
    .dash-topbar {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}

.ia-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    padding: 3px 8px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
    transition: all 0.3s ease;
}
.ia-toggle-label:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.3);
}
.ia-toggle-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6366f1;
    white-space: nowrap;
}
.ia-toggle-checkbox {
    display: none;
}
.ia-toggle-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background: #ccc;
    border-radius: 20px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}
.ia-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.ia-toggle-checkbox:checked + .ia-toggle-slider {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}
.ia-toggle-checkbox:checked + .ia-toggle-slider::after {
    left: 18px;
}

.ia-actions-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-top: 8px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.15);
}
.ia-actions-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #6366f1;
    white-space: nowrap;
}
.ia-buttons-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.ia-btn {
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}
.ia-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.ia-btn-extract {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}
.ia-btn-qc {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}
.ia-btn-scoring {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}
.ia-btn-report {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}
.ia-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.ia-modal-content {
    background: white;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255,255,255,0.1);
    animation: modalSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.ia-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 28px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
    color: white;
    border-radius: 20px 20px 0 0;
}
.ia-modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.ia-modal-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    line-height: 1;
    transition: background 0.2s;
}
.ia-modal-close:hover {
    background: rgba(255,255,255,0.25);
}
.ia-modal-status {
    padding: 12px 24px;
    border-bottom: 1px solid #e5e7eb;
}
.ia-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.ia-status-success {
    background: #d1fae5;
    color: #065f46;
}
.ia-modal-body {
    padding: 20px 24px;
}
.ia-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}
.ia-result-item {
    background: #f9fafb;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ia-result-item.ia-highlight {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
    border-color: rgba(99, 102, 241, 0.2);
}
.ia-label {
    font-size: 0.72rem;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ia-value {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
}
.ia-issues-list, .ia-recommendations-list {
    list-style: none;
    padding: 0;
    margin: 8px 0;
}
.ia-issues-list li {
    padding: 6px 10px;
    margin: 4px 0;
    background: #fef3c7;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #92400e;
}
.ia-recommendations-list li {
    padding: 6px 10px;
    margin: 4px 0;
    background: #dbeafe;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #1e40af;
}
.ia-events-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}
.ia-events-section h4 {
    margin-bottom: 8px;
    color: #374151;
    font-size: 0.9rem;
}
.ia-note {
    margin-top: 12px;
    padding: 10px;
    background: #f0fdf4;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #166534;
    font-style: italic;
}
.ia-summary-section, .ia-sections-list {
    margin-top: 12px;
}
.ia-summary-section h4, .ia-sections-list h4 {
    color: #374151;
    font-size: 0.9rem;
    margin-bottom: 6px;
}
.ia-summary-section p {
    color: #4b5563;
    line-height: 1.6;
    font-size: 0.9rem;
}
.ia-sections-list ul {
    list-style: none;
    padding: 0;
}
.ia-sections-list li {
    padding: 6px 10px;
    margin: 3px 0;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #374151;
}
.ia-modal-footer {
    padding: 16px 24px;
    text-align: right;
    border-top: 1px solid #e5e7eb;
}
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content::-webkit-scrollbar,
.ia-modal-content::-webkit-scrollbar {
    width: 6px;
}
.modal-content::-webkit-scrollbar-track,
.ia-modal-content::-webkit-scrollbar-track {
    background: transparent;
}
.modal-content::-webkit-scrollbar-thumb,
.ia-modal-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
.modal-content::-webkit-scrollbar-thumb:hover,
.ia-modal-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.messages-list { padding: 10px 20px; }
.message-item { padding: 12px 16px; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: all 0.2s; position: relative; }
.message-item:hover { background: rgba(99, 102, 241, 0.05); border-color: #6366f1; }
.message-item.unread { border-left: 3px solid #6366f1; background: rgba(99, 102, 241, 0.03); }
.message-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.message-subject { font-weight: 600; color: #1e293b; margin-bottom: 4px; }
.message-preview { color: #64748b; font-size: 0.85rem; }
.message-date { color: #94a3b8; font-size: 0.75rem; }
.unread-badge { position: absolute; top: 12px; right: 12px; background: #6366f1; color: white; font-size: 0.65rem; padding: 2px 8px; border-radius: 10px; }
.thread-container { max-height: 400px; overflow-y: auto; padding: 10px; }
.thread-message { padding: 12px; border-radius: 8px; margin-bottom: 8px; max-width: 80%; }
.thread-message.sent { background: rgba(99, 102, 241, 0.1); margin-left: auto; }
.thread-message.received { background: #f1f5f9; }
.thread-msg-header { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 0.8rem; }
.thread-msg-body { font-size: 0.9rem; line-height: 1.5; }
.compose-label { display: block; font-weight: 600; margin-bottom: 4px; color: #374151; font-size: 0.85rem; }
.audit-details { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8rem; color: #64748b; }
.audit-filters { display: flex; gap: 10px; padding: 10px 20px; align-items: center; flex-wrap: wrap; }
.message-tabs, .ia-training-tabs, .automation-tabs { display: flex; gap: 4px; padding: 10px 20px; border-bottom: 1px solid #e2e8f0; flex-wrap: wrap; }
.message-tab, .ia-train-tab, .auto-tab { padding: 8px 16px; border: 1px solid #e2e8f0; border-radius: 6px; background: white; cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
.message-tab:hover, .ia-train-tab:hover, .auto-tab:hover { background: #f1f5f9; }
.message-tab.active, .ia-train-tab.active, .auto-tab.active { background: #6366f1; color: white; border-color: #6366f1; }
.empty-state { padding: 40px 20px; text-align: center; color: #64748b; }
.empty-state-icon { font-size: 3rem; margin-bottom: 10px; }
.loading { padding: 40px 20px; text-align: center; color: #94a3b8; }
.error { padding: 20px; text-align: center; color: #ef4444; }
.patient-actions { display: flex; gap: 4px; margin-top: 6px; }
.patient-btn-edit, .patient-btn-delete { padding: 4px 10px; border: none; border-radius: 4px; font-size: 0.75rem; cursor: pointer; transition: all 0.2s; }
.patient-btn-edit { background: #dbeafe; color: #1e40af; }
.patient-btn-edit:hover { background: #bfdbfe; }
.patient-btn-delete { background: #fee2e2; color: #991b1b; }
.patient-btn-delete:hover { background: #fecaca; }
