:root {
    --primary: #25514C;
    --primary-dark: #1A3C38;
    --primary-light: #EBF5F3;
    --accent: #059669;
    --bg: #F4F7FA;
    --card: #FFFFFF;
    --text: #1E293B;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --radius: 12px;
    --danger: #DC2626;
    --warn: #D97706;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-y: scroll;
}

.hidden {
    display: none !important;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.82rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    /* better mobile legibility */
    margin-bottom: 0.8rem;
    transition: all .2s;
    background: #ffffff;
    color: var(--text);
}

/* Force Calendar Icon Visibility */
input[type="date"] {
    position: relative;
    padding-right: 2.5rem;
    /* reserve space for icon */
    background-image: url('data:image/svg+xml;utf8,<svg fill="%2364748B" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20a2 2 0 002 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zm0-12H5V6h14v2zm-7 5h5v5h-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    background-size: 1.1rem;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    display: block;
    opacity: 0;
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    width: 1.5rem;
    height: 1.5rem;
    z-index: 10;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 81, 76, .1);
}

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    padding: 0 5%;
    height: 72px;
    background: white;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
    gap: 2rem;
}

.brand-text {
    font-size: 1.4rem;
    margin-left: 10px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-item {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.88rem;
    padding: 0.3rem 0;
    border-bottom: 2px solid transparent;
    transition: all .2s;
}

.nav-item.active {
    color: var(--primary);
    border-color: var(--primary);
}

.nav-item:hover {
    color: var(--primary);
}

.nav-admin-link {
    color: var(--accent);
}

.nav-logout {
    color: var(--danger);
}

.nav-logout:hover {
    color: #991B1B;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 81, 76, .3);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    padding: 0.55rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}

.btn-outline:hover {
    background: var(--primary-light);
}

.btn-hero {
    padding: 0.9rem 2.2rem;
    font-size: 1rem;
    margin-top: 1.5rem;
}

.full-width {
    width: 100%;
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.btn-sm svg {
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #B91C1C;
}

.btn-pipeline {
    border: none;
    color: white;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
    width: 100%;
    margin-top: 0.5rem;
}

.btn-step1 {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.btn-step2 {
    background: linear-gradient(135deg, var(--accent), #047857);
}

.btn-step3 {
    background: linear-gradient(135deg, var(--primary-dark), var(--accent));
}

.btn-pipeline:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}

.btn-accent {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.35rem 0.8rem;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all .2s;
}

.btn-accent:hover {
    background: #047857;
}

.btn-approve {
    margin-top: 1rem;
    background: linear-gradient(135deg, #059669, #047857);
}

/* Hero */
.hero {
    padding: 3rem 5% 4rem;
    background: linear-gradient(135deg, #F0FAF8 0%, white 50%, #F5F3FF 100%);
    text-align: center;
}

.hero h1 {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -1px;
    line-height: 1.2;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-top: 0.8rem;
    max-width: 600px;
    margin-inline: auto;
}

.journey-diagram {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.step span {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}

.icon-circle {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
}

.icon-circle img {
    width: 28px;
    height: 28px;
    filter: invert(25%) sepia(20%) saturate(800%) hue-rotate(130deg);
}

.icon-circle.dsm {
    background: #EDE9FE;
}

.icon-circle.dsm img {
    filter: invert(25%) sepia(80%) saturate(600%) hue-rotate(250deg);
}

.icon-circle.report {
    background: #FEF3C7;
}

.icon-circle.report img {
    filter: invert(60%) sepia(50%) saturate(600%) hue-rotate(10deg);
}

.arrow {
    font-size: 1.5rem;
    color: var(--border);
    font-weight: 300;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    width: 90%;
    max-width: 480px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .15);
}

.modal-lg {
    max-width: 700px;
}

.close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.form-subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 1.2rem;
}

.form-toggle {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-link {
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
}

/* MFA Dev Code */
.mfa-dev-code-box {
    background: linear-gradient(135deg, #F0FDF4, #ECFDF5);
    border: 2px dashed #4ADE80;
    border-radius: 10px;
    padding: 0.6rem 1rem;
    text-align: center;
    margin-bottom: 0.8rem;
    animation: fadeIn .3s ease;
}

.mfa-code-display {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 4px;
    display: block;
    margin: 0.2rem 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Patient Picker */
.patient-picker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.patient-picker-list h4,
.patient-picker-create h4 {
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.patient-list {
    max-height: 250px;
    overflow-y: auto;
}

.patient-card {
    padding: 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all .15s;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.patient-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.patient-card strong {
    font-size: 0.9rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-draft {
    background: #FEF3C7;
    color: #92400E;
}

.badge-uploaded {
    background: #DBEAFE;
    color: #1E40AF;
}

.badge-transcribed {
    background: #E0E7FF;
    color: #3730A3;
}

.badge-approved {
    background: #D1FAE5;
    color: #065F46;
}

.badge-admin {
    background: #FDE68A;
    color: #92400E;
}

.badge-physician {
    background: #DBEAFE;
    color: #1E40AF;
}

/* Dashboard */
.dashboard {
    padding: 0 5%;
    display: none;
}

.dashboard:not(.hidden) {
    display: block;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: var(--radius);
    margin: 1rem 0;
    box-shadow: var(--shadow);
}

.header-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-right: 0.3rem;
}

.header-value {
    font-weight: 600;
    color: var(--primary-dark);
    margin-right: 0.5rem;
}

.header-sep {
    color: var(--border);
    margin: 0 0.3rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 280px minmax(300px, 1fr) 300px;
    gap: 1rem;
}

.card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.card h3 {
    font-size: 1rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* Co-Pilot Tracker Badges */
.tracker-badge {
    padding: 0.6rem;
    border-radius: 6px;
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.tracker-badge strong {
    display: block;
    margin-bottom: 0.2rem;
}

.status-grey {
    background: #F1F5F9;
    color: #64748B;
    border-color: #E2E8F0;
}

.status-yellow {
    background: #FEF3C7;
    color: #92400E;
    border-color: #FDE68A;
    animation: pulse-yellow 2s infinite;
}

@keyframes pulse-yellow {
    0% {
        box-shadow: 0 0 0 0 rgba(253, 230, 138, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(253, 230, 138, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(253, 230, 138, 0);
    }
}

.status-green {
    background: #ECFDF5;
    color: #065F46;
    border-color: #A7F3D0;
}

.tracker-badge .snippet {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: inherit;
    opacity: 0.85;
    font-style: italic;
    background: rgba(255, 255, 255, 0.4);
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
}

/* Upload Panel */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    margin-bottom: 0.8rem;
}

.drop-zone:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-icon {
    width: 36px;
    opacity: 0.5;
    margin-bottom: 0.5rem;
}

.drop-zone p {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.file-name {
    font-size: 0.82rem;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.step-status {
    font-size: 0.82rem;
    padding: 0.5rem 0;
}

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

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

/* History */
.history-section {
    margin-top: 1.2rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.history-section h4 {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

#history-list {
    list-style: none;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 0.3rem;
    transition: background .15s;
    font-size: 0.85rem;
}

.history-item:hover {
    background: var(--primary-light);
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
}

.spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#loading-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Report View */
.report-view.empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

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

.report-header h4 {
    font-size: 1.1rem;
}

.section-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.report-textarea {
    width: 100%;
    min-height: 400px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'Inter', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    resize: vertical;
}

.report-content {
    max-height: 500px;
    overflow-y: auto;
    line-height: 1.65;
    font-size: 0.88rem;
    padding: 0.5rem 0;
}

.report-section {
    margin-bottom: 1rem;
}

/* Markdown */
.md-h2 {
    font-size: 1.2rem;
    color: var(--primary-dark);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.3rem;
    margin: 1rem 0 0.5rem;
}

.md-h3 {
    font-size: 1rem;
    color: var(--primary);
    margin: 0.8rem 0 0.3rem;
}

.md-h4 {
    font-size: 0.92rem;
    color: #475569;
    margin: 0.6rem 0 0.2rem;
    font-weight: 600;
}

.md-h5 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.5rem 0 0.2rem;
    font-weight: 600;
}

.st-met {
    color: #059669;
    font-weight: 600;
}

.st-notmet {
    color: #DC2626;
    font-weight: 600;
}

.st-na {
    color: #D97706;
    font-weight: 600;
}

/* Alerts */
.alert {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.alert-warn {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.alert-ok {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

/* Transcript details */
.transcript-details {
    margin-top: 1rem;
}

.transcript-details summary {
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--accent);
    padding: 0.5rem 0;
    list-style: none;
    /* hide native triangle */
}

.transcript-details summary::-webkit-details-marker {
    display: none;
}

/* Chrome/Safari */
.transcript-details summary::marker {
    display: none;
    content: '';
}

/* Firefox */

.transcript-details summary::before {
    content: '▸ ';
    font-size: 0.9rem;
}

.transcript-details[open] summary::before {
    content: '▾ ';
}

.history-other {
    opacity: 0.6;
}

.transcript-box {
    background: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.82rem;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
    direction: rtl;
    text-align: right;
    margin-top: 0.5rem;
}

/* DSM-5 Chart */
#dsm-chart-container {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

#dsm-chart-container h4 {
    font-size: 0.9rem;
    color: var(--primary-dark);
    margin-bottom: 0.8rem;
}

.chart-summary {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.chip {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.chip-met {
    background: #059669;
    color: white;
}

.chip-notmet {
    background: #DC2626;
    color: white;
}

.chip-na {
    background: #D97706;
    color: white;
}

.chart-bars {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.chart-row {
    display: grid;
    grid-template-columns: 32px 1fr 28px 120px;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.82rem;
}

.chart-label {
    font-weight: 600;
    color: var(--text-muted);
}

.chart-bar-bg {
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar {
    height: 100%;
    border-radius: 4px;
    transition: width .5s ease;
}

.chart-icon {
    text-align: center;
}

.chart-desc {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Role Chooser */
.role-chooser-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.role-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}

.role-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 81, 76, .15);
}

.role-icon {
    font-size: 2rem;
}

.role-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
}

.role-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Admin Panel */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.admin-create-row {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
}

.admin-create-row input,
.admin-create-row select,
.admin-create-row button {
    flex: 1;
    min-width: 140px;
}

/* ──────────────────────────────────────────────────────────────────────────
   * ADMIN TABS
   ────────────────────────────────────────────────────────────────────────── */
.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.admin-tab-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: all 0.2s;
    opacity: 0.6;
}

.admin-tab-btn:hover {
    opacity: 0.8;
    background: var(--bg-color);
}

.admin-tab-btn.active {
    opacity: 1;
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    margin-bottom: -10px;
    /* pull down over the border wrapper */
}

/* ──────────────────────────────────────────────────────────────────────────
   * SETTINGS GRID
   ────────────────────────────────────────────────────────────────────────── */

.admin-create-row button {
    white-space: nowrap;
}

.admin-grid .card h3 {
    font-size: 1rem;
}

.admin-grid .card h4 {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0.8rem 0 0.5rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.admin-table th {
    text-align: left;
    padding: 0.5rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #F1F5F9;
}

.badge-pending {
    background: #FEF3C7;
    color: #92400E;
}

/* Admin section header with search */
.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.admin-section-header h3 {
    margin: 0;
}

.admin-search-wrapper input {
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.82rem;
    min-width: 220px;
    font-family: inherit;
    background: var(--card-bg);
    transition: border-color 0.2s;
}

.admin-search-wrapper input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

/* Checkmark toggle */
.toggle-check {
    cursor: pointer;
    font-size: 1.1rem;
    user-select: none;
    transition: transform 0.15s;
}

.toggle-check:hover {
    transform: scale(1.2);
}

.td-center {
    text-align: center;
}

/* Dynamic create form fields */
.create-patient-field,
.create-physician-field {
    transition: all 0.2s;
}

.settings-label {
    display: block;
    margin-bottom: 0.6rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
}

.settings-label input,
.settings-label textarea {
    margin-top: 0.3rem;
}

.settings-label textarea {
    min-height: 120px;
    resize: vertical;
}

/* Content Pages */
.content-page {
    padding: 2rem 5%;
    max-width: 900px;
    margin: 0 auto;
}

.content-page h1 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

.content-card {
    margin-bottom: 1rem;
    padding: 1.5rem 2rem;
}

.content-card h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}

.content-card p {
    color: var(--text);
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

.content-card p:last-child {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

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

    .patient-picker-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .journey-diagram {
        gap: 0.8rem;
    }

    .chart-row {
        grid-template-columns: 32px 1fr 28px;
    }

    .chart-desc {
        display: none;
    }

    .patient-bar {
        flex-wrap: wrap;
    }

    .patient-bar-search {
        width: 100%;
    }

    .content-page {
        padding: 1.5rem 3%;
    }

    .content-card {
        padding: 1rem 1.2rem;
    }

    /* Responsive Admin Table */
    .admin-table,
    .admin-table tbody,
    .admin-table tr,
    .admin-table td {
        display: block;
        width: 100%;
    }

    .admin-table thead {
        display: none;
    }

    .admin-table tr {
        margin-bottom: 1rem;
        background: white;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        padding: 0.5rem;
    }

    .admin-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        border-bottom: 1px solid #F1F5F9;
        padding: 0.6rem;
    }

    .admin-table td:last-child {
        border-bottom: none;
    }

    .admin-table td::before {
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
        color: var(--text-muted);
        text-transform: uppercase;
        font-size: 0.72rem;
        letter-spacing: 0.5px;
    }

    .break-email {
        word-break: break-all;
        text-align: right;
    }
}

/* ── Inline Patient Search Bar ────────────────────────────────────────────── */
.patient-bar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.2rem;
    flex-wrap: wrap;
    margin-bottom: 0;
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid var(--border);
}

.patient-bar h3 {
    margin: 0;
    font-size: 0.88rem;
    white-space: nowrap;
}

.patient-bar-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.patient-bar-search input {
    min-width: 240px;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.82rem;
    font-family: inherit;
}

.patient-bar-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.patient-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 50;
    max-height: 250px;
    overflow-y: auto;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: #F0FDF4;
}

.patient-bar-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pbar-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.create-patient-inline {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    margin-top: 0.4rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
}

.create-patient-inline input,
.create-patient-inline select {
    flex: 1;
    min-width: 120px;
    padding: 0.4rem 0.6rem;
    font-size: 0.82rem;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    box-sizing: border-box;
}

.create-patient-inline button {
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Other physician visit styling */
.record-other {
    opacity: 0.7;
    border-left: 3px solid #E2E8F0;
    padding-left: calc(0.7rem + 3px);
}

/* ── Patient Records Grid ─────────────────────────────────────────────────── */
.records-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    gap: 0.8rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
}

.records-toolbar h3 {
    margin: 0;
    white-space: nowrap;
}

.records-filters {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    width: 100%;
    margin-top: 0.8rem;
}

@media (max-width: 768px) {
    #select-all-wrapper {
        width: 100%;
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--border);
    }

    .records-filters input[type="date"],
    .records-filters input[type="text"] {
        flex: 1 1 calc(50% - 0.5rem);
    }
}

.records-filters input[type="date"] {
    width: 155px;
    /* Increased to fit date and icon */
    padding: 0.4rem 0.6rem;
    padding-right: 2rem;
    /* Keep icon padding */
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
}

.records-filters input[type="text"] {
    width: 160px;
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: inherit;
}

.records-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.record-card {
    border-bottom: 1px solid var(--border);
}

.record-card:last-child {
    border-bottom: none;
}

.record-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
    gap: 0.6rem;
    user-select: none;
}

.record-card-header:hover {
    background: #F0FDF4;
}

.record-card-header>div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.toggle-icon {
    font-size: 0.85rem;
    color: var(--text-muted);
    width: 14px;
    display: inline-block;
}

.record-patient-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text);
}

.record-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Collapsible visits container */
.record-visits {
    padding: 0 1rem 0 2.2rem;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    max-height: 2000px;
}

.record-visits.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Individual visit row */
.record-visit {
    padding: 0.6rem 0;
    border-bottom: 1px solid #F1F5F9;
    margin-left: 0.5rem;
    border-left: 2px solid var(--accent);
    padding-left: 0.8rem;
}

.record-visit:last-child {
    border-bottom: none;
}

/* Other physician visit - muted */
.record-other {
    opacity: 0.65;
    border-left-color: #CBD5E1;
}

.report-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    flex-wrap: wrap;
}

.report-audio {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.4rem 0;
    flex-wrap: wrap;
}

.report-audio audio {
    height: 32px;
    flex: 1;
    max-width: 360px;
}

.btn-download {
    background: var(--accent);
    color: white;
    padding: 0.25rem 0.6rem;
    font-size: 0.72rem;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
}

.btn-download:hover {
    background: #047857;
}

.report-preview {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0.2rem 0;
    line-height: 1.4;
}

.badge-uploaded {
    background: #DBEAFE;
    color: #1E40AF;
}

.badge-transcribed {
    background: #E0E7FF;
    color: #3730A3;
}

.badge-draft {
    background: #FEF3C7;
    color: #92400E;
}

.badge-approved {
    background: #DCFCE7;
    color: #166534;
}

/* ── Bulk Action Bar ──────────────────────────────────────────────────────── */
.bulk-action-bar {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(37, 81, 76, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    z-index: 100;
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.bulk-count {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}

.btn-danger {
    background: #DC2626;
    color: white;
    padding: 0.25rem 0.6rem;
    font-size: 0.72rem;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #B91C1C;
}

/* ── Visit Checkboxes ─────────────────────────────────────────────────────── */
.visit-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.select-all-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}

.select-all-label input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ── Expandable Full Report ───────────────────────────────────────────────── */
.expand-report-btn {
    margin-top: 0.4rem;
    font-size: 0.72rem;
    padding: 0.2rem 0.6rem;
}

.full-report-panel {
    margin-top: 0.5rem;
    animation: fadeIn 0.2s ease-out;
}

.full-report-content {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--text);
    max-height: 500px;
    overflow-y: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Mobile Responsiveness & Hamburger Menu ───────────────────────────────── */
@media (max-width: 768px) {
    .navbar {
        justify-content: space-between;
        padding: 0 1rem;
    }

    .nav-controls {
        display: flex;
        align-items: center;
    }

    .hamburger {
        display: block !important;
    }

    /* Transform nav-links into a full-height mobile drawer */
    .nav-links {
        position: fixed;
        top: 72px;
        right: -100%;
        width: 250px;
        height: calc(100vh - 72px);
        background: white;
        flex-direction: column;
        align-items: flex-start;
        padding: 2rem;
        gap: 1.5rem;
        box-shadow: -4px 0 15px rgba(0, 0, 0, 0.05);
        transition: right 0.3s ease;
        z-index: 999;
    }

    /* When shown via JS */
    .nav-links.show {
        right: 0;
    }

    /* RTL specific logic for the drawer */
    [dir="rtl"] .nav-links {
        right: auto;
        left: -100%;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.05);
        transition: left 0.3s ease;
    }

    [dir="rtl"] .nav-links.show {
        left: 0;
    }

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

    .hero-content {
        padding: 2rem 1rem;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .journey-diagram {
        flex-direction: column;
    }

    .arrow {
        transform: rotate(90deg);
        margin: 1rem 0;
    }

    .modal-content {
        width: 90%;
        max-width: 440px;
        margin: 2rem auto;
    }

    .patient-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .patient-picker-grid {
        grid-template-columns: 1fr;
    }

    .create-patient-inline {
        flex-direction: column;
        width: 100%;
    }

    #toggle-create-patient {
        margin-left: 0 !important;
        margin-inline-start: auto;
        /* Logical property for LTR/RTL */
    }
}

/* ── Arabic (RTL) Overrides ────────────────────────────────────────────────── */
[dir="rtl"] {
    font-family: 'Cairo', 'Inter', sans-serif;
}

[dir="rtl"] .brand-text {
    margin-left: 0;
    margin-right: 10px;
}

[dir="rtl"] .header-value,
[dir="rtl"] .header-label {
    display: inline-block;
}

[dir="rtl"] .lang-toggle {
    margin-right: 0 !important;
    margin-left: 1rem;
}

[dir="rtl"] .record-visit {
    border-left: none;
    border-right: 2px solid var(--accent);
    margin-left: 0;
    margin-right: 0.5rem;
    padding-left: 0;
    padding-right: 0.8rem;
}

[dir="rtl"] .record-visits {
    padding: 0 2.2rem 0 1rem;
}

[dir="rtl"] .record-other {
    border-left-color: transparent;
    border-right-color: #CBD5E1;
}

[dir="rtl"] .close {
    right: auto;
    left: 1rem;
}

[dir="rtl"] input[type="date"] {
    padding-right: 1rem;
    padding-left: 2.5rem;
    background-position: left 0.8rem center;
}

[dir="rtl"] input[type="date"]::-webkit-calendar-picker-indicator {
    right: auto;
    left: 0.8rem;
}

/* ── Global Inline Toast Notifications ─────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 9999;
}

.toast {
    background: white;
    color: var(--text);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 350px;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.error {
    background: #FEF2F2;
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

.toast.success {
    background: #F0FDF4;
    color: var(--success);
    border-left: 4px solid var(--success);
}