/* --- 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;
}

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

.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    gap: 2rem;
}

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

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

.search-bar input {
    width: 100%;
    padding: 1rem 1.5rem 1rem 3rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--secondary);
    background: white;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.1);
    transform: translateY(-2px);
}

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

.date-picker-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    padding: 0.65rem 1.25rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    transition: all 0.2s;
}

.date-picker-group:hover {
    border-color: var(--secondary);
    transform: translateY(-1px);
}

.calendar-icon {
    font-size: 1.1rem;
}

.date-input {
    border: none;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--text-main);
    outline: none;
    background: transparent;
    cursor: pointer;
}
.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;
}

.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 {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    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 > .logout-btn {
    margin-top: auto;
    padding: 0.75rem 1rem;
}

.sidebar > .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 h1 {
    font-size: clamp(1.75rem, 4vw, 2.8rem);
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    line-height: 1.2;
}

.patient-identity 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;
    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: flex-start;
    gap: 1.5rem;
    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: 480px;
}

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

.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);
}

.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;
}

.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 {
    border-color: var(--secondary);
    background: rgba(37, 99, 235, 0.05);
}

.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: 0.75rem 1.25rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.patient-identity-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    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;
    /* 1fr handles the queue; minmax blocks ensure typing canvas and context remain readable */
    grid-template-columns: 1fr minmax(450px, 2.5fr) minmax(300px, 1.2fr);
    gap: 1.5rem;
    align-items: start;
    padding: 1rem;
    height: calc(100vh - 120px); /* Fill screen height perfectly without overflow strings */
}

.zen-layout-3col.collapsed-queue {
    grid-template-columns: 5% minmax(450px, 3fr) minmax(300px, 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: 1.5rem;
}

.soap-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto; /* Allow independent scrolling for documentation */
    max-height: 100%;
    background: white;
    border-radius: 30px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.02);
    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 #cbd5e1;
    border-radius: 6px;
    transition: border-color 0.2s ease;
    background: #F8FAFC;
    color: var(--text-main);
}

.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%;
    }
}

/* 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);
}

@media (max-width: 1024px) {
    .queue-section,
    .zen-layout,
    .zen-layout-3col,
    .zen-grid {
        grid-template-columns: 1fr;
    }
    
    .zen-layout-3col {
        height: auto;
    }
    
    .zen-pipeline.full-height {
        height: auto;
        position: static;
    }

    .revenue-grid {
        grid-template-columns: 1fr;
    }
}

@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);
    }

    .dashboard-main {
        margin-left: 0;
        padding: 1.25rem;
        padding-top: 4rem;
    }

    .dash-header {
        flex-direction: column;
    }

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

/* 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;
}
.sidebar.compact-rail .logo-text,
.sidebar.compact-rail nav a span:not(:first-child),
.sidebar.compact-rail .user-profile .info {
    display: none;
}
.sidebar.compact-rail + .dashboard-main {
    margin-left: 70px;
}

.sidebar.compact-rail + .dashboard-main { margin-left: 70px; }
