﻿/* ── IntakeAdminReviewPage (/admin/intake-review) ─────────────────── */
.iar-page          { max-width: 900px; margin: 0 auto; padding: 24px 16px; font-family: var(--font-main, system-ui); }
.iar-header        { margin-bottom: 24px; }
.iar-title         { font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.iar-meta          { display: flex; gap: 16px; font-size: 12px; color: #666; }
.iar-meta code     { background: #f0f0f0; padding: 1px 5px; border-radius: 3px; font-size: 11px; }
.iar-loading       { color: #888; font-style: italic; }
.iar-error         { background: #fee; border: 1px solid #f99; color: #c00; padding: 10px 14px; border-radius: 4px; }
.iar-warn          { background: #fff8e1; border: 1px solid #ffd; color: #855; padding: 10px 14px; border-radius: 4px; }
.iar-empty         { color: #aaa; font-style: italic; margin: 4px 0; }

.iar-section       { margin-bottom: 28px; border-top: 2px solid #e8e8e8; padding-top: 16px; }
.iar-section-collapsed { border-top-color: #ddd; }
.iar-section-title { font-size: 15px; font-weight: 600; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.iar-collapsible   { cursor: pointer; user-select: none; }
.iar-chevron       { font-size: 11px; color: #888; }
.iar-badge         { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 10px; letter-spacing: .5px; }
.iar-badge.ai      { background: #e8f0fe; color: #1a56db; }

.iar-narrative     { white-space: pre-wrap; font-size: 13px; line-height: 1.6; background: #f8f9fa;
                     border: 1px solid #e8e8e8; border-radius: 4px; padding: 12px 14px; margin: 0; }

/* ROS grid */
.iar-ros-grid      { display: flex; flex-wrap: wrap; gap: 12px; }
.iar-ros-group     { background: #fff8e1; border: 1px solid #ffe082; border-radius: 4px; padding: 8px 12px; min-width: 180px; }
.iar-ros-system    { font-size: 12px; font-weight: 700; color: #b45; margin-bottom: 4px; }
.iar-ros-list      { margin: 0; padding-left: 16px; font-size: 12px; color: #444; }

/* PE tables */
.iar-pe-table      { width: 100%; border-collapse: collapse; font-size: 12px; }
.iar-pe-table th   { background: #f0f0f0; text-align: left; padding: 6px 10px; font-weight: 600; border-bottom: 2px solid #ddd; }
.iar-pe-table td   { padding: 5px 10px; border-bottom: 1px solid #eee; }
.iar-pe-abnormal td{ background: #fff5f5; }
.iar-exam-id       { color: #666; font-family: monospace; font-size: 11px; }
.iar-finding-text  { color: #c00; font-weight: 500; }

/* PE by DX */
.iar-dx-exam       { margin-bottom: 20px; border: 1px solid #e0e8f0; border-radius: 6px; overflow: hidden; }
.iar-dx-exam-header{ background: #e8f0fe; color: #1a3a7a; font-size: 13px; font-weight: 700; padding: 8px 14px; }
.iar-dx-section    { padding: 8px 14px; border-top: 1px solid #e8e8e8; }
.iar-dx-section-name { font-size: 11px; font-weight: 600; color: #555; text-transform: uppercase; letter-spacing: .5px; display: block; margin-bottom: 4px; }
.iar-dx-components { display: flex; flex-direction: column; gap: 3px; }
.iar-comp          { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; padding: 2px 0; }
.iar-comp-test     { color: #333; }
.iar-comp-result   { font-size: 11px; text-align: right; max-width: 55%; }
.iar-comp-result.abnormal { color: #c00; font-weight: 600; }
.iar-comp-result.normal   { color: #2a7a2a; }
.iar-comp-result.undoc    { color: #bbb; font-style: italic; }
.iar-comp-undoc    { opacity: .6; }

/* ── Medical records: sticky banner ────────────────────────────────── */
/* Medical records: sticky banner while QAI manifest POST is in flight */
.medrec-pipeline-submit-banner {
    position: sticky;
    top: 0;
    z-index: 1080;
}

/* ================================================================
   Base
   ================================================================ */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, sans-serif;
}

h3 {
    color: #1a3a5c;
}

/* ================================================================
   Medico brand palette
   ================================================================
   --medico-dark:    #0d2b55  (deep navy — brand)
   --medico-mid:     #1a4a8a  (medium blue — sidebar)
   --medico-accent:  #2e80d4  (action blue — buttons / active)
   --medico-light:   #e8f1fb  (hover / active bg on sidebar)
   --medico-sidebar-w: 240px
   ================================================================ */
:root {
    --medico-dark:       #0d2b55;
    --medico-mid:        #1a4a8a;
    --medico-accent:     #2e80d4;
    --medico-light:      #d6e8f7;
    --medico-sidebar-w:  240px;
    --medico-topbar-h:   44px;
}

/* ================================================================
   Shell — authenticated layout (sidebar + main)
   ================================================================ */
.medico-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.medico-shell-sidebar {
    width: var(--medico-sidebar-w);
    flex-shrink: 0;
    background: var(--medico-dark);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s ease, min-width 0.2s ease;
}

.medico-shell-sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden;
    border: none;
}

.medico-shell-sidebar-toggle {
    border: 1px solid #d0d7e2;
    background: #fff;
    color: #1a4a8a;
    border-radius: 0.25rem;
    padding: 0.2rem 0.55rem;
    line-height: 1.2;
    font-size: 0.85rem;
}

.medico-shell-sidebar-toggle:hover {
    background: #e8f1fb;
}

.form-diagnostics-panel {
    border-top: 2px solid #495057;
    border-radius: 0;
    flex-shrink: 0;
}

.appointment-calendar-root.calendar-expanded {
    max-width: 100%;
}

.medico-version-badge {
    margin-top: auto;
    padding: 6px 10px;
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    letter-spacing: .04em;
    user-select: none;
}

.medico-shell-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f5f7fa;
}

/* ── Top bar ────────────────────────────────────────────────── */
.medico-topbar {
    height: var(--medico-topbar-h);
    background: #fff;
    border-bottom: 1px solid #e0e6ef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    flex-shrink: 0;
}

.medico-topbar-left, .medico-topbar-right {
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* ── Page body (scrollable) ─────────────────────────────────── */
.medico-shell-body {
    flex: 1;
    overflow-x: auto;
    overflow-y: auto;
    min-width: 0;
    padding: 1.5rem;
}

/* ================================================================
   Sidebar component
   ================================================================ */
.medico-sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: #fff;
}

/* ── Brand ──────────────────────────────────────────────────── */
.medico-sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.1rem 1rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.12);
    flex-shrink: 0;
}

.medico-brand-icon {
    font-size: 1.8rem;
    color: #7ec8f5;
    flex-shrink: 0;
}

.medico-brand-name {
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .12em;
    color: #fff;
    line-height: 1.2;
}

.medico-brand-sub {
    font-size: .68rem;
    color: rgba(255,255,255,.55);
    letter-spacing: .04em;
    line-height: 1.2;
}

/* ── Primary nav ────────────────────────────────────────────── */
.medico-nav {
    flex: 1;
    padding: .75rem 0;
    overflow-y: auto;
}

.medico-nav-section {
    font-size: .63rem;
    font-weight: 700;
    letter-spacing: .1em;
    color: rgba(255,255,255,.4);
    padding: .6rem 1rem .3rem;
    text-transform: uppercase;
}

.medico-nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem 1rem;
    color: rgba(255,255,255,.78);
    text-decoration: none;
    font-size: .875rem;
    border-radius: 0;
    transition: background .15s, color .15s;
    cursor: pointer;
    position: relative;
}

    .medico-nav-link:hover {
        background: rgba(255,255,255,.10);
        color: #fff;
        text-decoration: none;
    }

    .medico-nav-link.active {
        background: rgba(46,128,212,.28);
        color: #fff;
        font-weight: 600;
    }

        .medico-nav-link.active::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 3px;
            background: var(--medico-accent);
            border-radius: 0 2px 2px 0;
        }

.nav-icon {
    font-size: 1rem;
    width: 1.1rem;
    flex-shrink: 0;
    opacity: .8;
}

.medico-nav-auth-prompt {
    padding: 1rem;
    color: rgba(255,255,255,.4);
    font-size: .8rem;
    display: flex;
    align-items: center;
}

/* ── Footer ─────────────────────────────────────────────────── */
.medico-sidebar-footer {
    border-top: 1px solid rgba(255,255,255,.12);
    padding: .75rem 0 .5rem;
    flex-shrink: 0;
}

.medico-user-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .4rem 1rem .5rem;
}

.medico-user-icon {
    font-size: 1.5rem;
    color: rgba(255,255,255,.55);
    flex-shrink: 0;
}

.medico-user-info {
    overflow: hidden;
}

.medico-user-name {
    font-size: .8rem;
    font-weight: 600;
    color: rgba(255,255,255,.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.medico-user-role {
    font-size: .68rem;
    color: rgba(255,255,255,.45);
}

/* Sign-out rendered as <button> — strip browser defaults so it looks like a nav link */
button.medico-nav-link {
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
    padding: .5rem 1rem;
    cursor: pointer;
}

.medico-signout {
    color: rgba(255,180,180,.75) !important;
}

    .medico-signout:hover {
        background: rgba(255,60,60,.15) !important;
        color: #ffaaaa !important;
    }

/* ================================================================
   Login page — image-left / form-right split layout
   ================================================================ */
.login-split {
    display: flex;
    min-height: 100vh;
}

/* ── Left: full marketing image panel (~68%) ─────────────────── */
.login-image-panel {
    flex: 0 0 68%;
    position: relative;
    overflow: hidden;
    /* fallback gradient if image is not yet uploaded */
    background: linear-gradient(145deg, #0a2244 0%, #0d3470 45%, #154a9c 100%);
}

.login-bg-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* ── Right: simple form panel (~32%) ─────────────────────────── */
.login-form-panel {
    flex: 0 0 32%;
    background: #add8e6;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
}

.login-form-inner {
    width: 100%;
    max-width: 300px;
}

/* Error banner */
.login-error-banner {
    background: rgba(200, 40, 40, .12);
    border: 1px solid rgba(200, 40, 40, .35);
    border-radius: 6px;
    color: #7a1010;
    font-size: .85rem;
    padding: .55rem .75rem;
    margin-bottom: 1.25rem;
    word-break: break-word;
}

/* Field group */
.login-field-group {
    margin-bottom: 1.25rem;
}

.login-field-label {
    display: block;
    font-size: .88rem;
    font-weight: 600;
    color: #1a3a5c;
    margin-bottom: .35rem;
    letter-spacing: .01em;
}

.login-field-input {
    display: block;
    width: 100%;
    padding: .55rem .75rem;
    font-size: .95rem;
    color: #1a2d45;
    background: #ffffff;
    border: 1px solid #b0c8de;
    border-radius: 6px;
    outline: none;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
}

    .login-field-input:focus {
        border-color: #2e80d4;
        box-shadow: 0 0 0 3px rgba(46,128,212,.18);
    }

    .login-field-input::placeholder {
        color: #94aec4;
    }

/* Submit row */
.login-submit-row {
    margin-top: 1.75rem;
    text-align: center;
}

.login-submit-btn {
    width: 100%;
    padding: .6rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: #2e80d4;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    letter-spacing: .03em;
    transition: background .15s;
}

    .login-submit-btn:hover:not([disabled]) {
        background: #1a6bbc;
    }

    .login-submit-btn:disabled {
        background: #90b8dd;
        cursor: default;
    }

/* Product name / logo row */
.login-logo-row {
    text-align: center;
    margin-bottom: 2rem;
}

.login-product-name {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a3a5c;
    letter-spacing: .04em;
}

/* Busy spinner inside the submit button */
.login-spinner {
    display: inline-block;
    width: .85rem;
    height: .85rem;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: login-spin .65s linear infinite;
    vertical-align: middle;
    margin-right: .4rem;
}

@keyframes login-spin {
    to { transform: rotate(360deg); }
}

/* ── Responsive: stack on small screens ─────────────────────── */
@media (max-width: 768px) {
    .login-split {
        flex-direction: column;
    }

    .login-image-panel {
        flex: 0 0 220px;
    }

    .login-form-panel {
        flex: 1;
        padding: 2rem 1.25rem;
    }

    .medico-shell-sidebar {
        width: 200px;
    }

    :root {
        --medico-sidebar-w: 200px;
    }
}

/* ------------------------------------------------------------------
   Existing "mf-" modal (unchanged)
-------------------------------------------------------------------*/
.mf-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 9998;
}

.mf-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(1100px, 92vw);
    height: min(80vh, 800px);
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    display: flex;
    flex-direction: column;
    z-index: 9999;
}

.mf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.mf-title {
    font-weight: 600;
}

.mf-x {
    border: 0;
    background: transparent;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.mf-frame {
    flex: 1;
    width: 100%;
    border: 0;
}

/* ------------------------------------------------------------------
   Chart Modal + Tree (new)
   Higher z-index than page content, below any OS overlays
-------------------------------------------------------------------*/
.chart-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    backdrop-filter: saturate(120%) blur(2px);
    z-index: 10040;
}

.chart-modal {
    position: fixed;
    inset: 5% 8%;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
    z-index: 10050;
    outline: 0;
}

    .chart-modal:focus-within {
        box-shadow: 0 0 0 2px #c7dfff inset;
    }

.chart-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .75rem 1rem;
    border-bottom: 1px solid #eee;
}

.chart-modal-body {
    flex: 1;
    display: flex;
    min-height: 400px;
    min-width: 0;
}

.chart-modal-left {
    width: 280px;
    max-width: 40vw;
    border-right: 1px solid #eee;
    overflow: auto;
    padding: .5rem;
}

.chart-modal-right {
    flex: 1;
    overflow: auto;
    padding: .75rem;
    min-width: 0;
}

.chart-modal-footer {
    padding: .5rem 1rem;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.tree {
    font-size: .95rem;
    line-height: 1.25rem;
}

    .tree .tree-item {
        padding: .35rem .5rem;
        border-radius: .375rem;
        cursor: pointer;
        margin-bottom: .15rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

        .tree .tree-item:hover {
            background: #f5f5f5;
        }

        .tree .tree-item.active {
            background: #e9f2ff;
            border: 1px solid #c7dfff;
        }

        .tree .tree-item.disabled {
            color: #aaa;
            cursor: default;
        }

.json {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: .92rem;
    line-height: 1.25rem;
    margin: 0;
}

.muted {
    color: #6c757d;
}

/* Nice scrollbars (WebKit) */
.chart-modal-left::-webkit-scrollbar,
.chart-modal-right::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.chart-modal-left::-webkit-scrollbar-thumb,
.chart-modal-right::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 8px;
    border: 2px solid #f8fafc;
}

    .chart-modal-left::-webkit-scrollbar-thumb:hover,
    .chart-modal-right::-webkit-scrollbar-thumb:hover {
        background: #b9c2cf;
    }

/* Responsive tweaks */
@media (max-width: 992px) {
    .chart-modal {
        inset: 6% 4%;
    }

    .chart-modal-left {
        width: 240px;
    }
}

@media (max-width: 640px) {
    .chart-modal {
        inset: 4% 3%;
    }

    .chart-modal-body {
        flex-direction: column;
    }

    .chart-modal-left {
        width: auto;
        max-width: none;
        border-right: 0;
        border-bottom: 1px solid #eee;
        max-height: 35vh;
    }

    .chart-modal-right {
        max-height: 50vh;
    }
}

/* Utility (optional) */
.badge {
    display: inline-block;
    padding: .35em .5em;
    border-radius: .5rem;
    font-weight: 600;
}

    .badge.bg-success {
        background: #16a34a;
        color: #fff;
    }

    .badge.bg-danger {
        background: #dc2626;
        color: #fff;
    }

/* ================================================================
   mc-dialog  —  Bootstrap-modal lookalike that Bootstrap JS ignores.
   Use .mc-overlay / .mc-dialog / .mc-dialog-header / .mc-dialog-body /
   .mc-dialog-footer on all standalone form pages instead of .modal* classes.
   ================================================================ */
.mc-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.mc-dialog {
    background: #fff;
    border-radius: .5rem;
    width: 720px;
    max-width: 96vw;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,.22);
    overflow: hidden;
}
.mc-dialog-lg  { width: 900px; }
.mc-dialog-sm  { width: 480px; }
.mc-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1.25rem;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}
.mc-dialog-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}
.mc-dialog-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}
.mc-dialog-footer {
    padding: .85rem 1.25rem;
    border-top: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.mc-btn-close {
    background: transparent;
    border: none;
    padding: .25rem .5rem;
    font-size: 1.3rem;
    line-height: 1;
    color: #6c757d;
    cursor: pointer;
    opacity: .65;
    transition: opacity .15s;
}
.mc-btn-close:hover { opacity: 1; }

/* ── AppointmentInfoBar ──────────────────────────────────────────────────── */
.appt-info-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem 1.25rem;
    padding: .35rem .85rem;
    background: #f0f4f8;
    border-bottom: 1px solid #dee2e6;
    font-size: .8rem;
    color: #495057;
}
.appt-info-item {
    display: flex;
    align-items: center;
    gap: .3rem;
}
.appt-info-label {
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    font-size: .7rem;
    letter-spacing: .03em;
}
.appt-info-value { color: #212529; }

/* ── Pipeline progress roadmap — no scroll arrows; wrap on narrow widths ───── */
.pipeline-progress-roadmap {
    overflow-x: hidden;
    overflow-y: hidden;
    row-gap: .35rem;
    scrollbar-width: none;
}
.pipeline-progress-roadmap::-webkit-scrollbar {
    display: none;
}
