/* Patient Chart Tabs Styles */

/* Last updated timestamp */
.last-updated {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    font-style: italic;
}

/* Improved loading overlay visibility */
.loading-overlay {
    position: relative;
}

.loading-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.92);
    z-index: 100;
    border-radius: 8px;
    backdrop-filter: blur(2px);
}

.loading-overlay-content {
    position: relative;
    z-index: 101;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 200px;
}

.loading-overlay-content .loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #2160E8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.loading-overlay-content p {
    color: #374151;
    font-weight: 500;
    font-size: 14px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Loading skeleton placeholders */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    height: 120px;
    margin-bottom: 16px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.medium {
    width: 80%;
}

.skeleton-text.long {
    width: 100%;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid #e5e7eb;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.form-group label .required {
    color: #dc2626;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-text {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
}

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2563eb;
}

.btn-primary:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: white;
    color: #374151;
    border-color: #d1d5db;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #f9fafb;
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Medication Reconciliation Styles */
.med-reconciliation-container {
    padding: 20px;
}

.med-reconciliation-content {
    max-width: min(1200px, 95vw);
    margin: 0 auto;
    width: 100%;
}

.med-reconciliation-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.summary-card.summary-home {
    border-top: 4px solid #0ea5e9;
}

.summary-card.summary-hospital {
    border-top: 4px solid #10b981;
}

.summary-card.summary-discrepancies {
    border-top: 4px solid #ef4444;
}

.summary-value {
    font-size: 32px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.summary-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.med-reconciliation-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.med-reconciliation-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.med-reconciliation-section h4 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.discrepancies-list,
.medications-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.discrepancy-card {
    padding: 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
}

.discrepancy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.discrepancy-description {
    font-weight: 600;
    color: #111827;
    flex: 1;
}

.discrepancy-severity {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.discrepancy-severity.severity-critical {
    background-color: #fee2e2;
    color: #991b1b;
}

.discrepancy-severity.severity-major {
    background-color: #fef3c7;
    color: #92400e;
}

.discrepancy-severity.severity-minor {
    background-color: #dbeafe;
    color: #1e40af;
}

.discrepancy-details {
    margin-bottom: 12px;
}

.discrepancy-actions {
    display: flex;
    gap: 8px;
}

.medication-card {
    padding: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.medication-name {
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.medication-strength,
.medication-frequency {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 4px;
}

/* Workflow Stepper */
.workflow-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 24px 0;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.stepper-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 8px;
    transition: all 0.3s;
}

.stepper-step.completed .step-number {
    background: #10b981;
    color: white;
}

.stepper-step.active .step-number {
    background: #0ea5e9;
    color: white;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.2);
}

.step-label {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
    font-weight: 500;
}

.stepper-step.completed .step-label,
.stepper-step.active .step-label {
    color: #111827;
    font-weight: 600;
}

.stepper-connector {
    flex: 1;
    height: 2px;
    background: #e5e7eb;
    margin: 0 8px;
    margin-bottom: 28px;
    transition: all 0.3s;
}

.stepper-connector.completed {
    background: #10b981;
}

/* Reconciliation Status */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.reconciliation-status-badge {
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.reconciliation-status-badge.status-not-started {
    background: #f3f4f6;
    color: #6b7280;
}

.reconciliation-status-badge.status-in-progress {
    background: #dbeafe;
    color: #1e40af;
}

.reconciliation-status-badge.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.reconciliation-info {
    font-size: 13px;
    margin-top: 8px;
}

/* Interactive Medication Cards */
.medication-card.interactive {
    cursor: pointer;
    transition: all 0.2s;
}

.medication-card.interactive:hover {
    background: #f3f4f6;
    border-color: #0ea5e9;
}

.medication-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
}

.btn-icon:hover {
    background: #e5e7eb;
    color: #111827;
}

.medication-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.medication-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.medication-actions .btn-sm {
    font-size: 12px;
    padding: 6px 12px;
}

.medication-decision {
    padding: 8px;
    background: #f0f9ff;
    border-radius: 4px;
    margin-top: 8px;
}

.decision-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.decision-badge.decision-continue {
    background: #d1fae5;
    color: #065f46;
}

.decision-badge.decision-hold {
    background: #fef3c7;
    color: #92400e;
}

.decision-badge.decision-change {
    background: #dbeafe;
    color: #1e40af;
}

.decision-badge.decision-discontinue {
    background: #fee2e2;
    color: #991b1b;
}

.medication-info {
    font-size: 13px;
    color: #6b7280;
}

.medication-info div {
    margin-bottom: 4px;
}

/* Discrepancy Resolution Modal */
.discrepancy-modal-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.discrepancy-description-box {
    padding: 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
}

.discrepancy-description-box h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.discrepancy-description-box p {
    margin: 0 0 12px 0;
    color: #374151;
}

.discrepancy-meta {
    display: flex;
    gap: 12px;
    align-items: center;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Completion Summary */
.completion-summary {
    background: #f9fafb;
    padding: 16px;
    border-radius: 6px;
    margin: 16px 0;
}

.completion-summary div {
    margin-bottom: 8px;
    font-size: 14px;
}

/* Comparison View */
.med-reconciliation-comparison-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.comparison-column {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.comparison-column h4 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
}

.medication-match {
    border-left: 4px solid #10b981;
}

.medication-different {
    border-left: 4px solid #f59e0b;
}

.medication-discrepancy {
    border-left: 4px solid #ef4444;
}

.empty-state-small {
    padding: 20px;
    text-align: center;
    color: #6b7280;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #059669;
}

/* Intake/Output Tab Styles */
.io-summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.io-summary-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.io-summary-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.io-summary-value {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
}

.io-summary-value.intake {
    color: #2160E8;
}

.io-summary-value.output {
    color: #8B5CF6;
}

.io-summary-status {
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
}

.io-shift-summary {
    background: #EEF2FF;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.io-shift-summary h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.io-shift-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.io-shift-label {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 4px;
}

.io-shift-value {
    font-size: 16px;
    font-weight: 700;
}

.io-shift-value.intake {
    color: #2160E8;
}

.io-shift-value.output {
    color: #8B5CF6;
}

.io-quick-entry {
    margin-bottom: 24px;
}

.io-quick-entry label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.io-quick-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.io-entry-form {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.io-entry-form h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
}

.io-type-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.io-recent-entries {
    margin-top: 24px;
}

.io-recent-entries h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
}

.io-entries-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.io-entry-card {
    background: white;
    border-radius: 6px;
    padding: 16px;
    border: 1px solid #e5e7eb;
}

.io-entry-card.entry-intake {
    border-left: 4px solid #2160E8;
}

.io-entry-card.entry-output {
    border-left: 4px solid #8B5CF6;
}

.io-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.io-entry-type {
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
}

.io-entry-time {
    font-size: 12px;
    color: #6b7280;
}

.io-entry-amount {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.io-entry-details {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 14px;
    color: #6b7280;
}

.io-entry-notes {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
}

/* AI Summary Panel */
.ai-summary-panel {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
    border: 1px solid #667eea;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
}

.ai-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.ai-summary-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ai-summary-header h3 {
    margin: 0;
    font-size: 18px;
    color: #4a5568;
}

.ai-summary-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    color: #6b7280;
    font-size: 14px;
}

.ai-summary-content {
    background: white;
    padding: 15px;
    border-radius: 6px;
    line-height: 1.6;
    color: #2c3e50;
    font-size: 14px;
}

.ai-summary-target {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 10px;
}

/* Results Tab (wrapper holds tablist + count + view toggle for a11y) */
.results-tab-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    flex-wrap: wrap;
}

.results-tab-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.results-tab-bar .tab-button {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.results-tab-bar .tab-button:hover {
    background: #e9ecef;
}

.results-tab-bar .tab-button.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.results-count {
    margin-left: auto;
    font-size: 14px;
    color: #6c757d;
}

.results-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: white;
    border-bottom: 1px solid #dee2e6;
}

.quick-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: #e9ecef;
}

.filter-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.advanced-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* Results List */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
}

.result-card {
    padding: 16px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s;
}

.result-card:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.result-card.result-abnormal {
    border-left: 4px solid #ffc107;
}

.result-card.result-critical {
    border-left: 4px solid #dc3545;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.result-name {
    font-weight: 600;
    font-size: 16px;
}

.result-date {
    font-size: 14px;
    color: #6c757d;
}

.result-value-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.result-value {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
}

.result-flag {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.result-flag.abnormal {
    background: #fff3cd;
    color: #856404;
}

.result-flag.critical {
    background: #f8d7da;
    color: #721c24;
}

.result-reference {
    font-size: 14px;
    color: #6c757d;
}

/* Orders Tab */
.orders-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: white;
    border-bottom: 1px solid #dee2e6;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.selection-mode-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #e7f3ff;
    border-bottom: 1px solid #b3d9ff;
}

.selection-info {
    font-weight: 600;
    color: #004085;
}

.selection-actions {
    display: flex;
    gap: 8px;
}

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
}

.order-card {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.order-selection {
    display: flex;
    align-items: flex-start;
    padding-top: 4px;
}

.order-content {
    flex: 1;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.order-name {
    font-weight: 600;
    font-size: 16px;
}

.order-badges {
    display: flex;
    gap: 8px;
}

.order-status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.order-status-badge.status-pending {
    background: #fff3cd;
    color: #856404;
}

.order-status-badge.status-scheduled {
    background: #cce5ff;
    color: #004085;
}

.order-status-badge.status-active {
    background: #d1ecf1;
    color: #0c5460;
}

.order-status-badge.status-completed {
    background: #d4edda;
    color: #155724;
}

.order-status-badge.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.order-priority-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.order-priority-badge.priority-stat {
    background: #dc3545;
    color: white;
}

.order-priority-badge.priority-urgent {
    background: #fd7e14;
    color: white;
}

.order-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.detail-item {
    display: flex;
    gap: 8px;
    font-size: 14px;
}

.detail-label {
    font-weight: 600;
    color: #6c757d;
}

.detail-value {
    color: #212529;
}

.order-instructions {
    font-size: 14px;
    color: #6c757d;
    font-style: italic;
    margin-top: 8px;
}

.order-actions {
    display: flex;
    gap: 8px;
}

.completed-orders-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid #dee2e6;
}

.completed-orders-section h4 {
    margin-bottom: 16px;
    color: #6c757d;
}

.order-completed {
    opacity: 0.7;
}

/* Vitals Tab */
.vitals-entry-form {
    margin: 16px;
    padding: 20px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #dee2e6;
}

.form-header h4 {
    margin: 0;
    font-size: 18px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #6c757d;
    padding: 4px 8px;
}

.btn-close:hover {
    color: #212529;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    font-size: 14px;
    color: #212529;
}

.form-group-inline {
    display: flex;
    gap: 8px;
    align-items: center;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #dee2e6;
}

/* Notes Tab */
.notes-section {
    padding: 16px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 16px 20px 12px 20px;
    border-bottom: 1px solid #dee2e6;
}

.section-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.section-header .header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.notes-list-full {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.note-card-full {
    padding: 16px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s;
}

.note-card-full:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.note-title-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.note-type-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #e7f3ff;
    color: #004085;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    width: fit-content;
}

.note-title {
    font-weight: 600;
    font-size: 16px;
    color: #212529;
}

.note-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
    font-size: 14px;
    color: #6c757d;
}

.note-content-preview {
    font-size: 14px;
    color: #495057;
    line-height: 1.6;
}

/* MAR Tab Styles */
.mar-container {
    padding: 20px;
}

.mar-tab .stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.mar-tab .stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.mar-tab .stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.mar-tab .stat-card.stat-scheduled {
    border-top: 4px solid #3b82f6;
}

.mar-tab .stat-card.stat-administered {
    border-top: 4px solid #10b981;
}

.mar-tab .stat-card.stat-missed {
    border-top: 4px solid #ef4444;
}

.mar-tab .stat-value {
    font-size: 36px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
    line-height: 1;
}

.mar-tab .stat-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mar-tab .mar-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.mar-tab .empty-state {
    padding: 40px 20px;
}

.mar-tab .empty-state-actions {
    margin-top: 24px;
}

/* MAR Table - Sticky Header and Row Spacing (Iteration 3 Phase A) */
.mar-table-container {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

.mar-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.mar-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.mar-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.mar-table tbody tr {
    min-height: 48px;
}

.mar-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    vertical-align: middle;
}

.mar-table tbody tr:hover {
    background-color: #f8f9fa;
}

.mar-table tbody tr.overdue {
    background-color: #fef2f2;
}

.mar-table tbody tr.overdue:hover {
    background-color: #fee2e2;
}

/* Flowsheet Table - Cell Alignment and Header Contrast (Iteration 3 Phase A) */
.flowsheet-container {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
}

.flowsheet-table {
    display: grid;
    grid-template-columns: 200px repeat(auto-fit, minmax(120px, 1fr));
    min-width: 100%;
    background: white;
}

.flowsheet-header {
    display: contents;
}

.flowsheet-header .test-name-header {
    grid-column: 1;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 11;
}

.flowsheet-header .date-headers {
    display: contents;
}

.flowsheet-header .date-header {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.flowsheet-header .date-header .date-time {
    font-size: 12px;
    color: #6b7280;
    font-weight: 400;
    margin-top: 2px;
    display: block;
}

.flowsheet-rows {
    display: contents;
}

.flowsheet-row {
    display: contents;
}

.flowsheet-row .test-name-cell {
    grid-column: 1;
    padding: 12px 16px;
    font-size: 14px;
    color: #111827;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
}

.flowsheet-row:hover .test-name-cell {
    background: #f8f9fa;
}

.flowsheet-row .value-cells {
    display: contents;
}

.flowsheet-row .value-cell {
    padding: 12px 16px;
    font-size: 14px;
    text-align: right;
    border-bottom: 1px solid #e5e7eb;
    color: #111827;
}

.flowsheet-row:hover .value-cell {
    background: #f8f9fa;
}

.flowsheet-row .value-cell.abnormal {
    background-color: #fff3cd;
    color: #856404;
}

.flowsheet-row .value-cell.critical {
    background-color: #f8d7da;
    color: #721c24;
}

.flowsheet-row:hover .value-cell.abnormal {
    background-color: #ffe69c;
}

.flowsheet-row:hover .value-cell.critical {
    background-color: #f5c6cb;
}

