/* Screen-ready marker: no layout impact. No display:none or visibility:hidden.
   position: absolute; overflow: hidden. 1px size so Playwright state:'visible' passes (0x0 is not visible). */
.screen-ready-marker {
    position: absolute;
    left: -9999px;
    top: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Logo sizing fixes */
.sidebar-logo {
    width: 32px !important;
    height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
    visibility: visible;
}

.login-logo {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    object-fit: contain;
}

a, .btn-link {
    color: #006bb7;
}

/* Override for navigation links - no underlines */
.sidebar-content a,
.sidebar-content a:visited,
.sidebar-content a:hover,
.sidebar-content a:active,
.sidebar-content a:focus,
.nav-item-wrapper a,
.nav-item-wrapper a:visited,
.nav-item-wrapper a:hover,
.nav-item-wrapper a:active,
.nav-item-wrapper a:focus,
nav a,
nav a:visited,
nav a:hover,
nav a:active,
nav a:focus {
    text-decoration: none !important;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.page-container {
    padding: 20px;
    max-width: min(1400px, 95vw);
    margin: 0 auto;
    min-height: calc(100vh - 40px);
    width: 100%;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px 0;
}

.page-header p {
    color: #6b7280;
    margin: 0;
}

.content-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

/* Patient Workspace Styles */
.patient-workspace-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #f9fafb;
}

.patient-workspace-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.patient-tab-content {
    padding: 20px;
}

/* Patient Context Bar */
.patient-context-bar {
    background-color: white;
    border-bottom: 1px solid #e5e7eb;
}

.patient-banner {
    background-color: #2160e8;
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.patient-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.patient-name {
    font-size: 16px;
    font-weight: bold;
}

.patient-details {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: #e5e7eb;
}

.patient-details span {
    display: flex;
    align-items: center;
}

.patient-actions {
    display: flex;
    gap: 8px;
}

.patient-ai-snapshot {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    padding: 16px 20px;
    background-color: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

.patient-ai-snapshot .ai-summary-panel {
    margin-bottom: 0;
}

.ai-summary-panel-compact {
    padding: 16px;
}

.ai-summary-panel-compact .ai-summary-content {
    padding: 12px;
}

.ai-summary-badge {
    background: #e0e7ff;
    color: #4338ca;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.ai-summary-badge.badge-attention {
    background: #fef3c7;
    color: #92400e;
}

.ai-summary-list {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #374151;
}

.ai-risk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.ai-risk-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px 12px;
}

.ai-risk-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ai-risk-value {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

.ai-risk-value.risk-moderate {
    color: #b45309;
}

.ai-risk-value.risk-high {
    color: #dc2626;
}

.ai-risk-value.risk-low {
    color: #059669;
}

.ai-risk-value.risk-watch {
    color: #2563eb;
}

.ai-care-gap-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #374151;
    font-size: 13px;
}

.ai-care-gap {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.ai-care-gap::before {
    content: "•";
    color: #f59e0b;
    font-weight: 700;
}

.ai-disclaimer {
    font-size: 12px;
    color: #6b7280;
}

.btn-outline-white {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.95);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.btn-outline-white:hover {
    background-color: rgba(255, 255, 255, 0.28);
    border-color: #fff;
}

.patient-tabs {
    display: flex;
    background-color: #f9fafb;
    padding: 10px 16px;
    gap: 0;
    overflow-x: auto;
}

.tab-button {
    padding: 10px 16px;
    background: white;
    border: 1.5px solid #d1d5db;
    border-radius: 16px;
    color: #111827;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 8px;
    white-space: nowrap;
}

.tab-button:hover {
    background-color: #f3f4f6;
}

.tab-button.active {
    background-color: #2160e8;
    border-color: #2160e8;
    color: white;
}

.tab-button:focus {
    outline: 2px solid #2160e8;
    outline-offset: 2px;
}

:root {
    --empty-state-padding: 60px 20px;
    --empty-state-gap: 16px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--empty-state-padding);
    text-align: center;
    gap: var(--empty-state-gap);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.empty-state p {
    color: #6b7280;
    margin-bottom: 24px;
    max-width: 500px;
}

.empty-state-error .empty-icon {
    filter: none;
}

.empty-state-error h3 {
    color: #b45309;
}

.empty-state-hint {
    font-size: 13px;
    color: #6b7280;
    margin-top: 8px;
}

.empty-state-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* A11y: visible focus for keyboard users */
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #2160e8;
    outline-offset: 2px;
}

.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    margin: 20px;
}

.error-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.error-state h3 {
    font-size: 20px;
    font-weight: 600;
    color: #991b1b;
    margin-bottom: 8px;
}

.error-state p {
    color: #dc2626;
    margin-bottom: 24px;
}

.error-state .btn-secondary {
    margin-top: 12px;
    background-color: #6b7280;
    color: white;
    border: none;
}

.error-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Encounter card focus styles */
.encounter-card:focus {
    outline: 2px solid #2160E8;
    outline-offset: 2px;
}

.encounter-card:hover {
    background-color: #F3F4F6;
    cursor: pointer;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* Patient List Styles */
.patient-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.patient-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
}

.patient-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.patient-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.patient-card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.patient-mrn {
    font-size: 12px;
    color: #6b7280;
}

.patient-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.patient-info-row {
    display: flex;
    gap: 8px;
    font-size: 13px;
}

.info-label {
    font-weight: 600;
    color: #6b7280;
    min-width: 60px;
}

/* Note Editor Styles */
.note-editor-container {
    padding: 20px;
    max-width: min(1200px, 95vw);
    margin: 0 auto;
    width: 100%;
}

.signed-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: #fef3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    font-size: 14px;
}

.signed-banner .signed-icon {
    font-size: 20px;
}

.signed-banner .signed-info strong {
    font-weight: 700;
}

.note-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.note-editor-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.note-metadata {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.note-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.note-section {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.required-badge {
    background-color: #fee2e2;
    color: #dc2626;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.section-content {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.note-editor-main {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.note-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

/* Enhanced Note Editor Styles */
.note-editor-header {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.header-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.header-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 20px;
    border: none;
    background-color: #e5e7eb;
    color: #111827;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: #d1d5db;
}

.btn-icon.btn-danger {
    background-color: #fee2e2;
    color: #dc2626;
}

.btn-icon.btn-danger:hover {
    background-color: #fecaca;
}

.restore-indicator {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background-color: #fef3c7;
    border-radius: 4px;
    font-size: 12px;
}

.warning-text {
    color: #92400e;
}

.btn-ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.btn-ai:hover:not(:disabled) {
    background: linear-gradient(135deg, #5568d3 0%, #653a8f 100%);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.btn-ai:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-sm.btn-ai {
    padding: 4px 12px;
    font-size: 12px;
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f0f4ff;
    border-left: 3px solid #667eea;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 14px;
    color: #4a5568;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.section-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-bold {
    font-weight: bold;
}

.template-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.template-selector {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex: 1;
}

.template-selector label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.expand-controls {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.template-status {
    padding: 8px 0;
    font-size: 11px;
    color: #6b7280;
}

.status-message {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-message.success {
    background-color: #d1fae5;
    color: #065f46;
}

.status-message.info {
    background-color: #dbeafe;
    color: #1e40af;
}

.btn-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    padding: 0;
    margin-left: 12px;
}

.patient-banner {
    background: #f3f4f6;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #374151;
}

.note-sections-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.note-section-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.note-section-card .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
}

.note-section-card .section-header:hover {
    background-color: #f3f4f6;
}

.section-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.expand-icon {
    font-size: 12px;
    color: #6b7280;
    width: 20px;
    text-align: center;
}

.section-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    flex: 1;
}

.word-count {
    font-size: 11px;
    color: #6b7280;
    font-weight: normal;
}

.section-content {
    padding: 16px;
}

.section-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
}

.section-textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.form-control {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
}

.form-control-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6b7280;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Order Entry Styles */
.order-entry-container {
    padding: 20px;
    max-width: min(1200px, 95vw);
    margin: 0 auto;
    width: 100%;
}

.order-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.order-entry-header h1 {
    margin: 0 0 12px 0;
    font-size: 24px;
    font-weight: 600;
    color: #111827;
}

.quick-templates {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    margin-right: 4px;
}

.quick-template-btn {
    padding: 4px 12px;
    font-size: 11px;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.quick-template-btn:hover {
    background-color: #1d4ed8;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.order-queue-panel {
    background: #f9fafb;
    border: 1px solid #2563eb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.queue-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.queue-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.queue-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.queue-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.queue-item-info strong {
    font-size: 13px;
    color: #111827;
}

.queue-item-details {
    font-size: 11px;
    color: #6b7280;
}

.queue-item-actions {
    display: flex;
    gap: 4px;
}

.queue-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.empty-queue {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 13px;
}

.order-form {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.schedule-inputs {
    display: flex;
    gap: 8px;
}

.smart-entry-section {
    margin-bottom: 24px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.smart-entry-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.smart-entry-header label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    min-width: 100px;
}

.smart-entry-input-group {
    display: flex;
    gap: 8px;
    flex: 1;
}

.smart-entry-input-group input {
    flex: 1;
}

.detected-type {
    padding: 8px 12px;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 4px;
    font-size: 12px;
    margin-top: 8px;
}

.order-details-section {
    margin-bottom: 24px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.order-details-section h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.btn-text {
    background: none;
    border: none;
    color: #2563eb;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
}

.btn-text:hover {
    text-decoration: underline;
}

.btn-text:disabled {
    color: #9ca3af;
    cursor: not-allowed;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 16px;
    border: none;
    background-color: #e5e7eb;
    color: #111827;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: #d1d5db;
}

.btn-icon-small {
    width: 24px;
    height: 24px;
    border-radius: 12px;
    border: none;
    background-color: #fee2e2;
    color: #dc2626;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-small:hover {
    background-color: #fecaca;
}

.form-section {
    margin-bottom: 32px;
}

.form-section h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

/* Patient Chart Tab Styles */
.patient-chart-container {
    padding: 20px;
    max-width: min(1400px, 95vw);
    margin: 0 auto;
    background-color: #F9FAFB;
    width: 100%;
}

.patient-chart-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 2px solid #E5E7EB;
    margin-bottom: 24px;
    overflow-x: auto;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 16px;
    background: white;
    border: 1.5px solid #D1D5DB;
    border-radius: 8px;
    color: #111827;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    background-color: #F3F4F6;
    border-color: #9CA3AF;
}

.tab-btn.active {
    background-color: #2160E8;
    border-color: #2160E8;
    color: white;
}

.tab-btn:focus {
    outline: 2px solid #2160E8;
    outline-offset: 2px;
}

.patient-chart-content {
    min-height: 400px;
}

.patient-chart-tab {
    padding: 20px;
    max-width: 100%;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

.chart-quick-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.chart-quick-actions button {
    min-width: fit-content;
    white-space: nowrap;
    word-break: keep-all;
}

.chart-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;
    max-width: 100%;
    overflow-x: hidden; /* Prevent horizontal overflow */
    word-wrap: break-word; /* Break long words */
}

.chart-section .section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    width: 100%;
}

.chart-section .section-header h3 {
    word-break: break-word; /* Break long headings */
    overflow-wrap: break-word;
}

.chart-section .section-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    flex: 1;
}

.badge {
    background-color: #e5e7eb;
    color: #374151;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.btn-primary { background-color: #2160E8; color: white; }
.btn-secondary { background-color: #6b7280; color: white; }
.btn-success { background-color: #059669; color: white; }
.btn-warning { background-color: #f59e0b; color: white; }
.btn-info { background-color: #0369a1; color: white; }

.btn-sm:hover {
    opacity: 0.9;
}

/* Appointments */
.appointments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.appointments-list h4 {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 8px 0;
}

.appointment-card {
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    width: 100%;
    overflow-x: hidden;
    word-wrap: break-word;
}

.appointment-card .appointment-reason {
    word-break: break-word;
    overflow-wrap: break-word;
}

.appointment-upcoming {
    background-color: #f0f9ff;
    border-color: #0369a1;
}

.appointment-past {
    background-color: #f9fafb;
    display: flex;
    gap: 12px;
    align-items: center;
}

.appointment-main {
    flex: 1;
}

.appointment-time {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.appointment-type {
    font-size: 13px;
    color: #0369a1;
    margin-top: 4px;
}

.appointment-reason {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.appointment-date {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    width: 100px;
}

.appointment-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* Outpatient Visit */
.outpatient-visit {
    background-color: #e0f2fe;
    border-color: #0369a1;
    border-width: 2px;
}

.visit-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    width: 100%;
    overflow-x: hidden;
}

@media (max-width: 768px) {
    .visit-info-grid {
        grid-template-columns: 1fr; /* Stack on mobile */
    }
}

.visit-info-item label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.visit-value {
    font-size: 16px;
    font-weight: 600;
    color: #0c4a6e;
}

/* Problems Summary */
.problems-summary {
    background-color: #fef3c7;
    border-color: #f59e0b;
}

.problems-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.problem-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    word-break: break-word;
    overflow-wrap: break-word;
}

.problem-description {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink */
}

.problem-icon {
    font-size: 16px;
    color: #f59e0b;
}

.problem-description {
    font-size: 14px;
    color: #1f2937;
}

.problem-icd {
    font-size: 12px;
    color: #6b7280;
}

/* Vitals */
.vitals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    width: 100%;
    overflow-x: hidden;
}

@media (max-width: 768px) {
    .vitals-grid {
        grid-template-columns: 1fr; /* Stack on mobile */
    }
}

.vital-card {
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.vital-date {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.vital-values {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.vital-item {
    display: flex;
    gap: 4px;
}

.vital-label {
    font-size: 12px;
    color: #6b7280;
}

.vital-value {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

/* Lab Results */
.lab-results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lab-result-card {
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.lab-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.lab-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.lab-date {
    font-size: 12px;
    color: #6b7280;
}

.lab-result-value {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.lab-flag {
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.lab-flag.abnormal {
    background-color: #fee2e2;
    color: #991b1b;
}

.lab-reference {
    font-size: 12px;
    color: #6b7280;
}

/* Medications */
.medications-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.medication-card {
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.medication-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.medication-details {
    font-size: 13px;
    color: #374151;
}

.medication-instructions {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    font-style: italic;
}

/* Allergies */
.allergies-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.allergy-card {
    padding: 10px 12px;
    background-color: #fef2f2;
    border-radius: 6px;
    border: 1px solid #fecaca;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    word-break: break-word;
    overflow-wrap: break-word;
    width: 100%;
}

.allergy-card.allergy-severe {
    background-color: #fee2e2;
    border-color: #dc2626;
    border-width: 2px;
}

.allergy-substance {
    font-size: 14px;
    font-weight: 600;
    color: #991b1b;
}

.allergy-reaction {
    font-size: 13px;
    color: #374151;
}

.allergy-severity {
    font-size: 12px;
    color: #991b1b;
    font-weight: 600;
}

/* Notes */
.notes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.note-card {
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.note-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.note-type {
    font-size: 12px;
    font-weight: 600;
    color: #2160E8;
    padding: 2px 8px;
    background-color: #eef2ff;
    border-radius: 4px;
}

.note-date {
    font-size: 12px;
    color: #6b7280;
}

.note-author {
    font-size: 12px;
    color: #374151;
    margin-left: auto;
}

.note-subject {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.note-preview {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
}

.message-preview {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Responsive improvements for patient chart */
@media (max-width: 768px) {
    .patient-chart-tab {
        padding: 12px;
    }
    
    .chart-section {
        padding: 16px;
    }
    
    .chart-quick-actions {
        flex-direction: column;
    }
    
    .chart-quick-actions button {
        width: 100%;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .section-header h3 {
        width: 100%;
    }
}

/* Messages */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-card {
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.message-from {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.message-date {
    font-size: 12px;
    color: #6b7280;
}

.message-subject {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.message-preview {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

/* Medications Tab Styles */
.medications-tab {
    padding: 20px;
}

.medications-subtabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.subtab-btn {
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    background-color: #e5e7eb;
    color: #111827;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.subtab-btn:hover {
    background-color: #d1d5db;
}

.subtab-btn.active {
    background-color: #2c3e50;
    color: white;
}

.medications-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.medications-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.medications-filters .search-bar {
    flex: 1;
}

.medications-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.medication-card-full {
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s;
}

.medication-card-full:hover {
    border-color: #2160E8;
    box-shadow: 0 2px 4px rgba(33, 96, 232, 0.1);
}

.medication-card-full.selected {
    border-color: #2160E8;
    border-width: 2px;
    background-color: #f0f7ff;
}

.medication-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.medication-name-section {
    flex: 1;
}

.medication-name {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.medication-generic {
    font-size: 14px;
    color: #6b7280;
}

.medication-dosing {
    background-color: #f9fafb;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.dosing-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.dosing-label {
    font-size: 16px;
}

.dosing-text {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.interaction-warning {
    background-color: #fef2f2;
    border: 2px solid #fca5a5;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    gap: 8px;
}

.warning-icon {
    font-size: 16px;
}

.warning-content {
    flex: 1;
}

.warning-title {
    font-size: 12px;
    font-weight: 600;
    color: #dc2626;
    margin-bottom: 2px;
}

.warning-text {
    font-size: 11px;
    color: #7f1d1d;
}

.medication-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 13px;
    color: #111827;
    font-weight: 500;
}

.badge-success {
    background-color: #10b981;
    color: white;
}

.badge-danger {
    background-color: #ef4444;
    color: white;
}

.badge-secondary {
    background-color: #6b7280;
    color: white;
}

/* Vitals Tab Additional Styles */
.vitals-tab .vitals-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.vital-card-full {
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    margin-bottom: 12px;
}

.vital-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.vital-date {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.vital-recorded-by {
    font-size: 12px;
    color: #6b7280;
}

.vital-values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.vital-value-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Allergies Tab Additional Styles */
.allergies-tab .allergies-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.allergies-list-full {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.allergy-card-full {
    padding: 15px;
    background: #fef2f2;
    border-radius: 8px;
    border: 1px solid #fecaca;
}

.allergy-card-full.allergy-severe {
    background: #fee2e2;
    border-color: #dc2626;
    border-width: 2px;
}

.allergy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.allergy-substance {
    font-size: 16px;
    font-weight: 600;
    color: #991b1b;
}

.allergy-severity-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.severity-severe {
    background-color: #dc2626;
    color: white;
}

.severity-moderate {
    background-color: #f59e0b;
    color: white;
}

.severity-mild {
    background-color: #fbbf24;
    color: #78350f;
}

.allergy-reactions {
    margin: 8px 0;
    font-size: 13px;
    color: #374151;
}

.reaction-label {
    font-weight: 600;
    margin-right: 4px;
}

.allergy-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #fecaca;
}

/* Problems Tab Additional Styles */
.problems-tab .problems-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.problems-list-full {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.problem-card-full {
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.problem-card-full.problem-active {
    border-left: 4px solid #2160E8;
}

.problem-card-full.problem-resolved {
    background: #f9fafb;
    opacity: 0.8;
}

.problem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.problem-description {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    flex: 1;
}

.problem-status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.status-active {
    background-color: #2160E8;
    color: white;
}

.status-resolved {
    background-color: #10b981;
    color: white;
}

.problem-notes {
    margin-top: 8px;
    padding: 8px;
    background: #f9fafb;
    border-radius: 4px;
    font-size: 13px;
    color: #6b7280;
}

/* Orders Tab Styles */
.orders-tab .orders-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-card {
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.order-name {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.order-status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.status-completed {
    background-color: #10b981;
    color: white;
}

.status-cancelled {
    background-color: #ef4444;
    color: white;
}

.status-unknown {
    background-color: #6b7280;
    color: white;
}

.order-instructions {
    margin-top: 8px;
    padding: 8px;
    background: #f9fafb;
    border-radius: 4px;
    font-size: 13px;
    color: #6b7280;
}

/* Results Tab Additional Styles */
.results-tab .results-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-card {
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.result-card.result-abnormal {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.result-name {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.result-date {
    font-size: 12px;
    color: #6b7280;
}

.result-value-section {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.result-value {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.result-flag {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.result-flag.abnormal {
    background-color: #fef3c7;
    color: #92400e;
}

.result-flag.critical {
    background-color: #fee2e2;
    color: #991b1b;
}

/* AI Lab Result Interpretation */
.result-actions {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    background: #f3f4f6;
    color: #111827;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm:hover:not(:disabled) {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.btn-sm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-interpret-all {
    margin: 16px 0;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
}

.batch-interpretation-section {
    margin: 20px 0;
    padding: 16px;
    background: #f0f9ff;
    border-radius: 8px;
    border: 1px solid #0ea5e9;
    text-align: center;
}

.ai-interpretation-panel {
    margin-top: 12px;
    padding: 16px;
    background: #fefce8;
    border-radius: 8px;
    border: 1px solid #fbbf24;
    box-shadow: 0 2px 4px rgba(251, 191, 36, 0.1);
}

.ai-interpretation-panel.batch-interpretation {
    background: #f0f9ff;
    border-color: #0ea5e9;
    margin-top: 20px;
}

.interpretation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.interpretation-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #78350f;
}

.batch-interpretation .interpretation-header h4 {
    color: #0c4a6e;
}

.btn-close-sm {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-close-sm:hover {
    background: #f3f4f6;
    color: #111827;
}

.interpretation-content {
    font-size: 13px;
    line-height: 1.6;
    color: #374151;
}

.interpretation-section {
    margin-bottom: 16px;
}

.interpretation-section:last-child {
    margin-bottom: 0;
}

.interpretation-section strong {
    display: block;
    margin-bottom: 6px;
    color: #1f2937;
    font-size: 13px;
}

.interpretation-section p {
    margin: 0;
    color: #4b5563;
}

.interpretation-section ul {
    margin: 4px 0 0 0;
    padding-left: 20px;
    color: #4b5563;
}

.interpretation-section li {
    margin: 4px 0;
}

.result-reference {
    font-size: 12px;
    color: #6b7280;
}

/* Notes Tab Additional Styles */
.notes-tab .notes-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.notes-list-full {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.note-card-full {
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.note-title-section {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-type-badge {
    padding: 2px 8px;
    background-color: #eef2ff;
    color: #2160E8;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.note-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.note-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.note-content-preview {
    margin-top: 8px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 4px;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.6;
}

/* Demographics Grid */
.demographics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.demographic-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.demographic-item label {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.demographic-item div {
    font-size: 14px;
    color: #111827;
    font-weight: 500;
}

/* Physical Characteristics Grid */
.physical-char-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.physical-char-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.physical-char-item label {
    font-size: 12px;
    color: #6b7280;
}

.physical-char-item div {
    font-size: 14px;
    color: #111827;
    font-weight: 500;
}

/* Care Team Grid */
.care-team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.care-team-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.care-team-item label {
    font-size: 12px;
    color: #6b7280;
}

.care-team-item div {
    font-size: 14px;
    color: #111827;
    font-weight: 500;
}

/* Medical Information */
.medical-info-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.medical-info-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.medical-info-item label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
}

.code-status {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.allergies-string-list,
.directives-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.allergy-badge {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

.directive-badge {
    background-color: #d1fae5;
    color: #065f46;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

.no-allergies {
    font-size: 14px;
    color: #6b7280;
    font-style: italic;
}

/* Record Information */
.record-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.record-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.record-info-item label {
    font-size: 12px;
    color: #6b7280;
}

.record-info-item div {
    font-size: 14px;
    color: #111827;
}

/* Latest Vitals Display */
.latest-vitals-display {
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 6px;
    font-size: 14px;
    color: #111827;
    font-family: 'Courier New', monospace;
}

/* Encounters */
.encounters-list {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 0;
}

.encounter-card {
    padding: 12px;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    min-width: 150px;
    cursor: pointer;
    transition: all 0.2s;
}

.encounter-card:hover {
    background-color: #f3f4f6;
    border-color: #2160E8;
}

.encounter-card.encounter-selected {
    background-color: #eef2ff;
    border-color: #2160E8;
    border-width: 2px;
}

.encounter-type {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.encounter-date {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.encounter-status {
    font-size: 11px;
    color: #059669;
    font-weight: 500;
}

.encounter-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.encounter-detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.encounter-detail-item label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
}

.encounter-detail-item div {
    font-size: 14px;
    color: #111827;
}

/* Visit Info Full Width */
.visit-info-item.visit-info-full {
    grid-column: 1 / -1;
}

/* Lab Results Full List */
.lab-results-list-full {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lab-result-card-full {
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.lab-result-card-full.lab-abnormal {
    border-left: 4px solid #f59e0b;
    background-color: #fffbeb;
}

/* Imaging Results */
.imaging-results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.imaging-result-card {
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.imaging-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.imaging-type {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.imaging-date {
    font-size: 12px;
    color: #6b7280;
}

.imaging-body-part {
    font-size: 13px;
    color: #374151;
    margin-bottom: 4px;
}

.imaging-impression {
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
}

/* Problems List Full */
.problems-list-full {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.problem-card-full {
    padding: 12px;
    background-color: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.problem-icd {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

/* Medications List Full */
.medications-list-full {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.medication-card-full {
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

/* Allergies List Full */
.allergies-list-full {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.allergy-card-full {
    padding: 12px;
    background-color: #fef2f2;
    border-radius: 6px;
    border: 1px solid #fecaca;
}

.allergy-card-full.allergy-severe {
    background-color: #fee2e2;
    border-color: #dc2626;
    border-width: 2px;
}

.allergy-severity-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.severity-severe {
    background-color: #dc2626;
    color: white;
}

.severity-moderate {
    background-color: #f59e0b;
    color: white;
}

.severity-mild {
    background-color: #fbbf24;
    color: #78350f;
}

/* Notes List Full */
.notes-list-full {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.note-card-full {
    padding: 12px;
    background-color: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

/* Last Visit Summary */
.last-visit-summary {
    background-color: #f0fdf4;
    border-color: #10b981;
}

.last-visit-grid {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 12px 8px;
}

.last-visit-item {
    display: contents;
}

.last-visit-item label {
    font-size: 13px;
    color: #6b7280;
    grid-column: 1;
}

.last-visit-item div {
    font-size: 14px;
    color: #1f2937;
    font-weight: 500;
    grid-column: 2;
    word-break: break-word;
}

/* Preventive Care */
.preventive-care {
    background-color: #fef3c7;
    border-color: #f59e0b;
}

.preventive-care-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preventive-care-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background-color: white;
    border-radius: 6px;
}

.preventive-care-icon {
    font-size: 18px;
}

.preventive-care-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.preventive-care-name {
    font-size: 14px;
    color: #1f2937;
    font-weight: 500;
}

.preventive-care-due {
    font-size: 12px;
    color: #6b7280;
}

.preventive-care-up-to-date {
    font-size: 13px;
    color: #065f46;
    font-weight: 600;
    text-align: center;
    padding: 8px;
}

/* Pending Refills */
.pending-refills {
    background-color: #f5f3ff;
    border-color: #8b5cf6;
}

.pending-refills-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pending-refill-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background-color: white;
    border-radius: 6px;
    gap: 12px;
}

.refill-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.refill-medication {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.refill-dosage {
    font-size: 12px;
    color: #6b7280;
}

.refill-date {
    font-size: 11px;
    color: #9ca3af;
}

/* Active Referrals */
.active-referrals {
    background-color: #fef2f2;
    border-color: #dc2626;
}

.referrals-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.referral-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: white;
    border-radius: 6px;
}

.referral-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.referral-specialty {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.referral-reason {
    font-size: 12px;
    color: #6b7280;
}

.referral-date {
    font-size: 11px;
    color: #9ca3af;
}

.problems-hint {
    font-size: 11px;
    color: #78350f;
    margin-top: 8px;
    font-style: italic;
}

/* Advanced AI Options for Note Editor */
.advanced-ai-options {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.advanced-ai-options.expanded {
    border-color: #3498db;
    background: #f0f8ff;
}

.ai-options-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #374151;
}

.ai-options-icon {
    font-size: 16px;
}

.ai-options-badge {
    margin-left: auto;
    padding: 2px 8px;
    background: #e5e7eb;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
}

.ai-options-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.ai-options-row .form-group {
    margin-bottom: 0;
}

.ai-options-row .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}

.field-hint {
    font-weight: 400;
    color: #6b7280;
    font-size: 11px;
    font-style: italic;
}

.ai-options-hint {
    margin-top: 12px;
    padding: 10px;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    border-radius: 4px;
    font-size: 12px;
    color: #856404;
}

.ai-options-hint strong {
    font-weight: 600;
}

.options-badge {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
}

.btn-sm.active {
    background: #3498db;
    color: white;
    border-color: #2980b9;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    transition: all 0.2s;
}

/* ============================================
   UI/UX POLISH - Responsive Design & Accessibility
   ============================================ */

/* Responsive Breakpoints */
@media (max-width: 768px) {
    .page-container {
        padding: 12px;
        max-width: 100%;
    }
    
    .content-card {
        padding: 16px;
    }
    
    .page-header h1 {
        font-size: 24px;
    }
    
    .header-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons button {
        width: 100%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .patient-list {
        grid-template-columns: 1fr;
    }
    
    .patient-chart-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    
    .tab-btn {
        min-width: fit-content;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .order-entry-header {
        flex-direction: column;
        gap: 16px;
    }
    
    .quick-templates {
        flex-wrap: wrap;
    }
    
    .note-editor-header {
        flex-direction: column;
    }
    
    .template-row {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .page-container {
        padding: 8px;
    }
    
    .content-card {
        padding: 12px;
    }
    
    .page-header h1 {
        font-size: 20px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Enhanced Keyboard Navigation */
*:focus-visible {
    outline: 2px solid #2160E8;
    outline-offset: 2px;
    border-radius: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #2160E8;
    outline-offset: 2px;
}

/* Skip to main content link for screen readers */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: #2160E8;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-main:focus {
    top: 0;
}

/* Improved Button States */
.btn {
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Improved Form Controls */
.form-control {
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:hover:not(:disabled) {
    border-color: #9ca3af;
}

.form-control:focus {
    border-color: #2160E8;
    box-shadow: 0 0 0 3px rgba(33, 96, 232, 0.1);
}

.form-control.error {
    border-color: #dc2626;
}

.form-control.error:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Loading States */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 200px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #2160E8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

/* Loading overlay for tabs with existing data */
.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.85);
    z-index: 10;
    border-radius: 8px;
}

.loading-overlay-content {
    position: relative;
    z-index: 11;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 200px;
}

/* Last updated timestamp */
.last-updated {
    font-size: 12px;
    color: #6b7280;
    margin-top: 8px;
    font-style: italic;
}

/* Status Messages */
.status-message {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Improved Empty States */
.empty-state {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .header-actions,
    .action-buttons,
    .btn,
    .tab-btn,
    .quick-templates,
    .ai-suggestions-panel,
    .order-queue-panel {
        display: none !important;
    }
    
    .page-container {
        max-width: 100%;
        padding: 0;
    }
    
    .content-card {
        box-shadow: none;
        border: 1px solid #000;
        page-break-inside: avoid;
    }
    
    .patient-chart-tabs {
        border-bottom: 2px solid #000;
    }
    
    .tab-btn.active {
        background: white;
        color: #000;
        border: 2px solid #000;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
    
    .page-header h1 {
        color: #000;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .btn-primary {
        border: 2px solid #000;
    }
    
    .content-card {
        border: 2px solid #000;
    }
    
    .form-control {
        border: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: #2160E8;
    }
}

/* Touch Target Sizes (Mobile) */
@media (max-width: 768px) {
    .btn,
    .tab-btn,
    .patient-card,
    .encounter-card {
        min-height: 44px; /* iOS recommended touch target */
        min-width: 44px;
    }
    
    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Improved Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Consistent Spacing Scale */
:root {
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
}

/* Consistent Color Palette */
:root {
    --color-primary: #2160E8;
    --color-primary-hover: #1d4ed8;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #dc2626;
    --color-info: #0369a1;
    --color-text: #111827;
    --color-text-secondary: #6b7280;
    --color-border: #e5e7eb;
    --color-background: #f9fafb;
}

/* Improved Card Hover States */
.patient-card,
.content-card,
.note-section-card,
.medication-card,
.lab-result-card {
    transition: all 0.2s ease;
}

.patient-card:hover,
.content-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Better Error Display */
.error-state,
.alert-danger {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Improved Table Responsiveness */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    thead,
    tbody,
    tr {
        display: block;
    }
    
    th,
    td {
        display: block;
        text-align: left;
        padding: 8px;
        border-bottom: 1px solid #e5e7eb;
    }
    
    th {
        background: #f9fafb;
        font-weight: 600;
    }
}

/* Dashboard Tables - Row Height, Numeric Alignment, Hover State (Iteration 3 Phase A) */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.table thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.table tbody tr {
    min-height: 48px;
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table tbody td {
    padding: 12px 16px;
    font-size: 14px;
    vertical-align: middle;
    border-bottom: 1px solid #e5e7eb;
}

/* Specific column alignment for known numeric columns in dashboard tables */
.table.audit-log tbody td:first-child {
    text-align: right;
}

/* Billing Dashboard: Amount (col 3) and Date (col 5) are right-aligned via inline styles */
/* Records Dashboard: Due Date (col 4) is right-aligned via inline styles */
/* Users: Last Login (col 5) is right-aligned via inline styles */

/* Focus Trap for Modals/Dialogs */
.modal:focus-within {
    outline: none;
}

/* Improved Select Dropdowns */
select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Improved Checkbox and Radio Styling */
input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #2160E8;
}

/* Better Link Styling */
a {
    text-decoration: none;
    color: #2160E8;
    transition: color 0.2s;
}

a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

a:focus-visible {
    outline: 2px solid #2160E8;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Outpatient AI widget stubs (feature-flagged, no PHI) */
.ai-widget-stub {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
}
.ai-widget-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.ai-widget-icon { font-size: 1.1rem; }
.ai-widget-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
}
.ai-widget-badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    background: #e5e7eb;
    color: #6b7280;
    border-radius: 4px;
}
.ai-widget-description {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    color: #6b7280;
}
.ai-widget-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.ai-widget-stub .btn-sm { font-size: 0.8rem; }