/* --- DASHBOARD STYLES --- */
:root {
    /* Dashboard specific overrides if any */
}

/* Layout Foundation */
.dashboard-body {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: white;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
    z-index: 100;
    overflow: hidden;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-footer .user-profile {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.sidebar-footer .logout-btn {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
}

.build-tag {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-top: 0.25rem;
}

.dashboard-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2.5rem 3rem;
    min-height: 100vh;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3.5rem;
    padding-left: 0.5rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: white !important;
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--secondary), var(--accent));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.side-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #94A3B8;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s;
    font-weight: 500;
}

.side-nav a:hover, .side-nav a.active {
    background: var(--sidebar-active);
    color: white;
    transform: translateX(4px);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-profile .info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.user-profile .info strong {
    color: white;
    font-size: 0.9rem;
}

.user-profile .info span {
    color: #94A3B8;
    font-size: 0.8rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.logout-btn {
    margin-top: 0.5rem;
    padding: 0.5rem 0;
    color: #F87171;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 8px;
    transition: var(--transition);
}

.logout-btn:hover {
    color: #FCA5A5;
}

.sidebar-footer .logout-btn:hover {
    background: rgba(239, 68, 68, 0.12);
}

/* Global Component Classes */
.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

/* --- WORLD-CLASS ZEN 3.0 & ADMIN ADD-ONS --- */
.patient-info-slab {
    background: white;
    padding: 2.5rem;
    border-radius: 32px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.03);
    border: 1px solid rgba(226, 232, 240, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.patient-identity-row h1 {
    font-size: clamp(1.75rem, 4vw, 2.8rem);
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    line-height: 1.2;
    margin: 0;
}

.patient-identity-row h1 small {
    font-size: 0.45em;
    font-weight: 500;
    color: var(--text-muted);
}

.ai-nudge-box p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.action-center {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    padding: 0;
    border-radius: 0;
    width: 100%;
}

.btn-zen {
    height: 36px;
    padding: 0 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: none;
    cursor: pointer;
}

.btn-zen.scribe { background: var(--secondary); color: white; }
.btn-zen.history { background: white; color: var(--text-muted); border: 1px solid var(--border); }
.btn-zen.start { background: var(--primary); color: white; }

.note-canvas-container {
    background: white;
    border-radius: 40px;
    padding: 3rem;
    box-shadow: 0 10px 50px rgba(0,0,0,0.02);
}

.zen-textarea {
    width: 100%;
    height: 550px;
    border: none;
    font-size: 1.3rem;
    line-height: 1.8;
}

/* Admin Specific */
.health-indicator {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #ECFDF5;
    padding: 0.75rem 1.5rem;
    border-radius: 100px;
    color: #059669;
    font-weight: 700;
}

.pulse {
    width: 10px;
    height: 10px;
    background: #10B981;
    border-radius: 50%;
    animation: pulse-ring 1.5s infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(.8); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(.8); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Zen Grid & Sidebar */
.zen-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
}

.insight-card, .ai-nudge-box {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.vitals-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.vital-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 12px;
}

.allergy-tag {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: #fff1f2;
    color: #e11d48;
    border-radius: 10px;
    text-align: center;
}

/* Doctor role: hide reception/admin chrome */
.dashboard-body.role-doctor .dash-header {
    display: none;
}

.dashboard-body.role-doctor .dashboard-main {
    padding-top: 2rem;
}

.section-page-header {
    margin-bottom: 1.5rem;
}

.section-page-header h1 {
    font-size: 1.75rem;
    color: var(--text-main);
    margin-bottom: 0.35rem;
}

.section-page-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.dashboard-body.role-doctor .section-page-header:not(.hidden) + #doctor-zen-section {
    margin-top: 0;
}

/* --- Dashboard page layout & components --- */
.dash-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.dash-header .header-title h1,
.dash-header .welcome h1 {
    font-size: 2rem;
    color: var(--text-main);
    margin-bottom: 0.35rem;
}

.dash-header .header-title p,
.dash-header .welcome p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 42rem;
}

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

.search-bar {
    flex: 1;
    min-width: 220px;
    max-width: 520px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
    line-height: 1;
}

.search-bar input {
    width: 100%;
    padding: 0.875rem 1.25rem 0.875rem 2.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.95rem;
    color: var(--text-main);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.date-picker-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    background: var(--surface);
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.calendar-icon {
    font-size: 1rem;
    line-height: 1;
}

.date-input {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-main);
    font-family: inherit;
}

.counter-badge {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.stat-card h3 {
    font-size: 1.75rem;
    color: var(--text-main);
    margin-bottom: 0.35rem;
}

.stat-card small {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.section-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.card-header h2 {
    font-size: 1.25rem;
    color: var(--text-main);
}

.card-header h3 {
    font-size: 1.1rem;
    color: var(--text-main);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.queue-section {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
}

.table-scroll .queue-table {
    min-width: 720px;
}

.queue-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.queue-table thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--border);
    background: var(--bg);
}

.queue-table tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    vertical-align: middle;
}

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

.queue-table tbody tr.active-row {
    background: rgba(37, 99, 235, 0.04);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-pill.in-room {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent);
}

.status-pill.waiting {
    background: rgba(245, 158, 11, 0.12);
    color: #B45309;
}

.status-pill.pending-pay {
    background: rgba(239, 68, 68, 0.1);
    color: var(--urgent);
}

.status-pill.paid {
    background: #DCFCE7;
    color: #166534;
}

.triage-pill {
    display: inline-flex;
    padding: 0.25rem 0.65rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-muted);
}

.triage-pill.urgent {
    background: rgba(239, 68, 68, 0.1);
    color: var(--urgent);
}

.triage-pill.moderate {
    background: rgba(245, 158, 11, 0.1);
    color: #B45309;
}

.triage-pill.routine {
    background: rgba(37, 99, 235, 0.08);
    color: var(--secondary);
}

.source-tag {
    display: inline-flex;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.source-tag.online {
    background: rgba(37, 99, 235, 0.1);
    color: var(--secondary);
}

.source-tag.walkin {
    background: var(--bg);
    color: var(--text-muted);
}

.lang-tag {
    display: inline-flex;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-small {
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--secondary);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-small:hover {
    background: var(--secondary-hover);
}

.btn-small.secondary {
    background: var(--surface);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-small.secondary:hover {
    background: var(--bg);
}

.quota-bars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.quota-item small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.bar {
    height: 8px;
    background: var(--bg);
    border-radius: 99px;
    overflow: hidden;
}

.bar .fill {
    height: 100%;
    background: var(--secondary);
    border-radius: 99px;
}

.ai-insights h3 {
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

.ai-insights p,
.insight-item p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.insight-item {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.insight-item small {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
}

/* Zen clinical workspace */
.zen-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.zen-pipeline {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.pipeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.pipeline-header h3 {
    font-size: 1rem;
    color: var(--text-main);
}

.pipeline-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pipeline-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    background: var(--surface);
}

.pipeline-item:hover {
    border-color: var(--secondary);
    background: var(--bg);
}

.pipeline-item.next,
.pipeline-item.active {
    border-color: var(--secondary);
    background: rgba(37, 99, 235, 0.06);
    box-shadow: inset 3px 0 0 var(--secondary);
}

.p-token {
    font-weight: 700;
    color: var(--secondary);
    font-size: 0.85rem;
}

.p-info strong {
    display: block;
    color: var(--text-main);
    font-size: 0.9rem;
}

.p-info span {
    font-size: 0.75rem;
}

.meta-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.pill {
    display: inline-flex;
    padding: 0.25rem 0.65rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-muted);
}

.pill.active {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent);
}

.pill.triage {
    background: rgba(37, 99, 235, 0.08);
    color: var(--secondary);
}

.lang-select {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: white;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.875rem;
}

.scribe-status-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(16, 185, 129, 0.08);
    color: var(--accent);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.zen-textarea {
    color: var(--text-main);
    background: transparent;
    resize: vertical;
    font-family: inherit;
}

.zen-textarea::placeholder {
    color: var(--text-muted);
}

.zen-textarea:focus {
    outline: none;
}

.summary-card {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.summary-card .card-header {
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
}

.summary-content {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.summary-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.vital-item .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.vital-item .value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 0.25rem;
}

.vital-item.warning .value {
    color: var(--urgent);
}

.suggested-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.suggested-tags span {
    padding: 0.35rem 0.75rem;
    background: var(--bg);
    border-radius: 99px;
    font-size: 0.8rem;
    color: var(--secondary);
    font-weight: 600;
}

.zen-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.insight-card .card-header,
.ai-nudge-box .card-header {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal.open {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-xl);
}

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

.modal-header h2 {
    color: var(--text-main);
    font-size: 1.25rem;
}

.close-modal {
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}

.close-modal:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 1.5rem;
    color: var(--text-main);
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
}

/* Prescription modal */
.rx-modal .rx-modal-content {
    max-width: 920px;
    width: 100%;
}

.rx-modal .modal-header {
    align-items: flex-start;
    gap: 1rem;
}

.rx-modal .modal-header-text h2 {
    font-size: 1.35rem;
    margin-bottom: 0.25rem;
}

.rx-modal .modal-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 400;
}

.rx-modal .close-modal {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg);
    font-size: 1.35rem;
    flex-shrink: 0;
    transition: var(--transition);
}

.rx-modal .close-modal:hover {
    background: var(--surface);
    border-color: var(--text-muted);
}

.rx-voice-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.rx-record-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.rx-recording-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--urgent);
}

.rx-ai-draft {
    flex: 1 1 100%;
    padding: 0.75rem 1rem;
    background: rgba(37, 99, 235, 0.06);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(37, 99, 235, 0.15);
}

.rx-ai-draft h4 {
    font-size: 0.8rem;
    color: var(--secondary);
    margin-bottom: 0.35rem;
}

.rx-ai-draft p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.rx-panels {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.rx-form-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.rx-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rx-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rx-input,
.rx-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.rx-input:focus,
.rx-textarea:focus {
    outline: none;
    border-color: var(--secondary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.rx-input::placeholder,
.rx-textarea::placeholder {
    color: #94A3B8;
}

.rx-table-head {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0 0.15rem;
}

.med-row,
.lab-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.lab-row {
    grid-template-columns: 1fr;
}

.medicine-list .med-row:last-child,
#labTestList .lab-row:last-child {
    margin-bottom: 0;
}

.rx-add-btn {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--secondary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.rx-add-btn:hover {
    background: rgba(37, 99, 235, 0.06);
    border-color: var(--secondary);
}

.rx-sidebar {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.rx-sidebar-block + .rx-sidebar-block {
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.rx-sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.rx-history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.rx-history-list li {
    font-size: 0.875rem;
    color: var(--text-main);
    line-height: 1.45;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border);
}

.rx-history-list li:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.rx-history-list strong {
    color: var(--text-main);
}

.rx-tips-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.rx-tip-btn {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
}

.rx-tip-btn:hover {
    border-color: var(--secondary);
    background: rgba(37, 99, 235, 0.04);
    color: var(--secondary);
}

.rx-modal .modal-footer {
    justify-content: space-between;
}

.rx-modal .modal-footer .btn {
    min-width: 120px;
}

.rx-send-btn {
    min-width: 180px !important;
}

/* --- WORLD-CLASS ZEN 4.0 ADD-ONS --- */
.patient-banner-inner {
    background: white;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.patient-identity-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.patient-identity-row h1 {
    font-size: 1.5rem;
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
    margin: 0;
}

.patient-identity-row .allergy-tag {
    margin: 0;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
}

.zen-layout-3col {
    display: grid;
    grid-template-columns: minmax(160px, 200px) minmax(0, 2.5fr) minmax(240px, 320px);
    gap: 1.25rem;
    align-items: stretch;
    padding: 0;
    min-height: calc(100vh - 8rem);
}

.zen-sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.zen-sidebar-right .insight-card,
.zen-sidebar-right .ai-nudge-box {
    flex-shrink: 0;
}

.zen-layout-3col.collapsed-queue {
    grid-template-columns: 60px minmax(400px, 3fr) minmax(280px, 1.2fr);
}

.zen-pipeline {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    overflow-x: hidden;
}

.zen-pipeline.full-height {
    height: calc(100vh - 5rem);
    overflow-y: auto;
    position: sticky;
    top: 1rem;
}

.zen-pipeline.collapsed {
    padding: 1.5rem 0.5rem;
    text-align: center;
}

.zen-pipeline.collapsed .pipeline-header h3,
.zen-pipeline.collapsed .pipeline-header .badge,
.zen-pipeline.collapsed .p-info {
    display: none;
}

.zen-pipeline.collapsed .p-token {
    font-size: 0.75rem;
    padding: 0.25rem;
    margin-bottom: 0.5rem;
}

.zen-workspace-soap {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    min-height: 0;
}

.soap-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.soap-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.soap-field label {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--primary);
    font-size: 1.1rem;
}

.zen-textarea-small {
    width: 100%;
    min-height: 110px;
    resize: vertical;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: var(--bg);
    color: var(--text-main);
}

.zen-textarea-small::placeholder {
    color: var(--text-muted);
}

.zen-textarea-small:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: white;
}

.lang-select {
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 0 0.5rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
}

.btn-sync {
    background: #EEF2FF;
    color: #4F46E5;
    border: 1px solid #C7D2FE;
    font-weight: 600;
}

.btn-sync:hover {
    background: #E0E7FF;
}

@media (max-width: 768px) {
    .rx-panels {
        grid-template-columns: 1fr;
    }

    .rx-table-head {
        display: none;
    }

    .med-row {
        grid-template-columns: 1fr;
    }

    .rx-modal .modal-footer {
        flex-direction: column-reverse;
    }

    .rx-modal .modal-footer .btn {
        width: 100%;
    }
}

/* Lab watcher & shared form utilities */
.insights-box {
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

.insights-box p {
    margin-bottom: 0.75rem;
}

.lab-watcher-card {
    margin-top: 1.25rem;
}

.lab-watcher-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1rem;
}

.form-input {
    flex: 1 1 200px;
    min-width: 0;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--secondary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.lab-result-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.lab-result-input {
    flex: 1 1 280px;
}

.lab-alerts-container {
    margin-top: 1.25rem;
}

.lab-alert-card {
    background: #fee2e2;
    border-left: 4px solid var(--urgent);
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    border-radius: var(--radius-sm);
}

.lab-alert-card strong {
    color: #991b1b;
}

.lab-alert-card p {
    margin: 0.35rem 0 0;
    color: #7f1d1d;
    font-size: 0.9rem;
}

#labWatcherStatusBadge.badge-active {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent);
}

.section-container {
    animation: fadeIn 0.35s ease-out forwards;
}

/* Mobile sidebar */
.sidebar-mobile-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1100;
    padding: 0.6rem 1rem;
    background: var(--sidebar-bg);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1040;
}

.sidebar-backdrop.visible {
    display: block;
}

@media (max-width: 1200px) {
    .queue-section {
        grid-template-columns: 1fr;
    }

    .zen-layout-3col {
        grid-template-columns: minmax(140px, 180px) minmax(0, 1fr);
    }

    .zen-sidebar-right {
        grid-column: 1 / -1;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .zen-sidebar-right .insight-card,
    .zen-sidebar-right .ai-nudge-box {
        flex: 1 1 280px;
    }
}

@media (max-width: 1024px) {
    .dashboard-main {
        padding: 2rem 1.5rem;
    }

    .zen-layout,
    .zen-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) {
    .sidebar-mobile-toggle {
        display: none !important;
    }

    .sidebar {
        transform: translateX(0) !important;
    }

    .sidebar-backdrop {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .sidebar-mobile-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1050;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.compact-rail {
        width: var(--sidebar-width);
        padding: 2.5rem 1.5rem;
        align-items: stretch;
    }

    .sidebar.compact-rail .logo-text,
    .sidebar.compact-rail .user-profile .info,
    .sidebar.compact-rail .nav-text {
        display: block !important;
    }

    .sidebar.compact-rail .side-nav a {
        width: auto;
        height: auto;
        padding: 0.75rem 1rem;
        justify-content: flex-start;
    }

    .sidebar.compact-rail + .dashboard-main,
    .dashboard-main {
        margin-left: 0;
        padding: 1.25rem;
        padding-top: 4.5rem;
    }

    .dash-header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .btn-primary {
        width: 100%;
    }

    .search-bar {
        max-width: none;
        width: 100%;
    }

    .zen-layout-3col {
        grid-template-columns: 1fr !important;
        min-height: auto;
        gap: 1rem;
    }

    .zen-sidebar-right {
        flex-direction: column;
    }

    .zen-pipeline.full-height {
        height: auto;
        max-height: none;
        position: static;
    }

    .patient-identity-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .patient-identity-row .allergy-tag {
        align-self: stretch;
        text-align: center;
    }

    .soap-container {
        padding: 1rem;
    }
}

/* Utility Hidden */
.hidden { display: none !important; }

/* Maximize vertical canvas during live examinations */
body.zen-mode-active .dash-header {
    display: none;
}

/* Compact Sidebar Rail */
.sidebar.compact-rail {
    width: 70px;
    padding: 2.5rem 0.5rem;
    align-items: center;
    overflow-x: hidden;
}
.sidebar.compact-rail .logo {
    padding-left: 0;
    margin-bottom: 3.5rem;
    justify-content: center;
    width: 100%;
}
.sidebar.compact-rail .logo-text,
.sidebar.compact-rail .user-profile .info,
.sidebar.compact-rail .nav-text {
    display: none !important;
}
.sidebar.compact-rail .side-nav {
    width: 100%;
    align-items: center;
}
.sidebar.compact-rail .side-nav a {
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 12px;
    transition: var(--transition);
}
.sidebar.compact-rail .side-nav a span {
    font-size: 1.25rem;
    margin: 0;
}
.sidebar.compact-rail .user-profile {
    padding-left: 0;
    padding-right: 0;
    justify-content: center;
    width: 100%;
}
.sidebar.compact-rail .logout-btn {
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    margin-top: 1.5rem;
    border-radius: 12px;
}
.sidebar.compact-rail .logout-btn span {
    font-size: 1.25rem;
    margin: 0;
}
.sidebar.compact-rail + .dashboard-main {
    margin-left: 70px;
}

@media (min-width: 769px) {
    body.zen-mode-active {
        height: 100vh;
        overflow: hidden;
    }

    body.zen-mode-active .dashboard-main {
        height: 100vh;
        padding: 1.5rem 2rem;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    body.zen-mode-active #doctor-zen-section {
        flex: 1;
        height: 100%;
        overflow: hidden;
    }

    body.zen-mode-active .zen-layout-3col {
        height: 100%;
        padding: 0;
        gap: 1.5rem;
        grid-template-rows: 1fr;
    }

    body.zen-mode-active .zen-pipeline.full-height {
        height: 100%;
        position: static;
    }

    body.zen-mode-active .zen-workspace-soap {
        height: 100%;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    body.zen-mode-active .soap-container {
        flex: 1;
        overflow-y: auto;
    }

    body.zen-mode-active .zen-sidebar-right {
        height: 100%;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }
}

/* --- Prescription Builder & Print Styles --- */
.medicines-list { display: flex; flex-direction: column; gap: 0.5rem; }
.medicine-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 0.5rem; align-items: center; background: #f8fafc; padding: 0.75rem; border-radius: 6px; border: 1px solid var(--border-color); }
.medicine-row input { padding: 0.5rem; border: 1px solid #ccc; border-radius: 4px; font-size: 0.9rem; }
.print-only { display: none; }

@media print {
    body * { visibility: hidden; }
    .sidebar, .dash-header, .header-actions, .actions-row, .sidebar-backdrop, .sidebar-mobile-toggle, .zen-sidebar-right, #aiSummaryCard { display: none !important; }
    #prescription-print-area, #prescription-print-area * { visibility: visible; }
    #prescription-print-area { position: absolute; left: 0; top: 0; width: 100%; padding: 2rem; border: none !important; background: transparent !important; }
    .print-only { display: block; text-align: center; margin-bottom: 2rem; }
    .medicine-row { border: none; background: none; border-bottom: 1px dashed #ccc; grid-template-columns: 2fr 1fr 1fr 1fr; padding: 0.5rem 0; }
    .medicine-row button { display: none; }
    .medicine-row input { border: none; padding: 0; background: transparent; font-weight: 500; color: #000; }
    textarea { border: none; resize: none; overflow: hidden; background: transparent; color: #000; height: auto; min-height: unset; }
    .soap-field { border: none !important; padding: 0 !important; background: transparent !important; margin-bottom: 1rem; }
    .soap-field label { font-size: 1.1rem; color: #000; font-weight: bold; border-bottom: 1px solid #000; display: inline-block; padding-bottom: 2px; margin-bottom: 0.5rem; }
    .btn-sync { display: none; }
}

