/* ===========================================================
   UPLOAD DOCUMENTS WORKFLOW
   =========================================================== */

.session-time-wrap {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

    .session-time-wrap .session-time {
        margin-left: 0;
    }

.files-badge {
    background: var(--gray-bg);
    border: 1px solid var(--gray-line);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-mute);
    padding: 3px 8px;
    border-radius: 6px;
}

/* ---- topbar variants ---- */
.pages-left {
    justify-self: end;
    margin-left: auto;
}

.upload-topbar-simple {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

.review-topbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

    .review-topbar-row h2 {
        font-size: 26px;
        font-weight: 800;
    }

.review-topbar-actions {
    display: flex;
    align-items: center;
    gap: 22px;
}

.link-btn {
    color: var(--blue);
    font-weight: 700;
    font-size: 14.5px;
}

    .link-btn:hover {
        text-decoration: underline;
    }

.patient-ro-row {
    display: flex;
    gap: 40px;
    width: 100%;
    justify-content: space-between;
    align-items: flex-end;
}

.patient-ro-field {
    max-width: 340px;
    flex: 1;
}

    .patient-ro-field label {
        display: block;
        font-size: 11px;
        color: var(--text-mute);
        margin-bottom: 3px;
    }

    .patient-ro-field input {
        width: 100%;
        border: none;
        background: var(--gray-bg);
        border-radius: 8px;
        padding: 9px 14px;
        font-size: 14.5px;
        color: var(--text);
        outline: none;
    }

.confirm-btn {
    padding: 11px 22px;
    align-self: flex-end;
}

    .confirm-btn[disabled] {
        background: #cfd6e0;
        color: #8792a2;
        cursor: default;
    }

/* ---- start screen / dropzone ---- */
.upload-start {
    height: 100%;
    padding: 40px 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 26px;
    text-align: center;
}

    .upload-start h2 {
        font-size: 27px;
        font-weight: 800;
        color: var(--navy-dark);
    }

.dropzone {
    width: 100%;
    max-width: 640px;
    border: 2px dashed #a9c5f2;
    background: #eaf2ff;
    border-radius: 14px;
    padding: 44px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, transform .15s ease;
}

    .dropzone:hover {
        background: #ddebff;
        border-color: #7fa9ea;
        transform: translateY(-2px);
    }

    .dropzone svg {
        width: 34px;
        height: 34px;
        color: #5089e8;
    }

    .dropzone .dz-title {
        font-size: 15.5px;
        font-weight: 600;
        color: var(--text);
    }

        .dropzone .dz-title b {
            color: #2860c9;
        }

    .dropzone .dz-sub {
        font-size: 13px;
        color: #5089e8;
        font-weight: 500;
    }

.upload-note {
    color: var(--text-mute);
    font-size: 13px;
    max-width: 480px;
    line-height: 1.5;
}

.file-row {
    width: 100%;
    max-width: 640px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--gray-line);
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 14.5px;
    animation: fadeSlideIn .3s ease;
}

    .file-row .fname {
        flex: 1;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: 500;
    }

    .file-row .fsize {
        color: var(--text-mute);
        font-size: 13px;
    }

    .file-row .fcheck {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #e4f6ea;
        color: var(--green);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

        .file-row .fcheck svg {
            width: 13px;
            height: 13px;
            stroke-width: 3;
        }

    .file-row .fx {
        color: var(--text-mute);
        flex-shrink: 0;
    }

        .file-row .fx:hover {
            color: #d1452b;
        }

/* ---- doc thumbnail + choose action ---- */
.upload-action-screen {
    padding: 30px 34px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.doc-thumb-row {
    display: flex;
    gap: 20px;
    margin-bottom: 34px;
}

.doc-thumb, .add-file-thumb {
    width: 150px;
    border: 1px solid var(--gray-line);
    border-radius: 12px;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

    .doc-thumb .doc-icon {
        width: 42px;
        height: 52px;
        background: #dbe8ff;
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #2860c9;
        font-size: 10px;
        font-weight: 800;
        position: relative;
    }

.doc-thumb {
    transition: border-color .15s ease, box-shadow .15s ease;
}

    .doc-thumb:hover {
        border-color: #c7d7f2;
        box-shadow: var(--shadow);
    }

    .doc-thumb .fname-small {
        font-size: 12.5px;
        font-weight: 500;
        line-height: 1.3;
        word-break: break-word;
    }

    .doc-thumb .trash-mini {
        color: #d1452b;
        margin-top: 2px;
        cursor: pointer;
        transition: color .15s ease;
    }

        .doc-thumb .trash-mini:hover {
            color: #a8331f;
        }

.add-file-thumb {
    color: var(--text-mute);
    background: var(--gray-bg);
    cursor: pointer;
    justify-content: center;
    transition: background .15s ease;
}

    .add-file-thumb:hover {
        background: #e7ebf1;
    }

    .add-file-thumb svg {
        width: 26px;
        height: 26px;
    }

    .add-file-thumb span {
        font-size: 13px;
        font-weight: 600;
    }

.upload-action-screen h2 {
    font-size: 27px;
    font-weight: 800;
    margin-bottom: 18px;
    text-align: center;
}

.action-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 640px;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--gray-bg);
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 15px 18px;
    font-size: 15px;
    font-weight: 600;
    color: var(--blue);
    text-align: left;
    transition: background .15s ease, border-color .15s ease, transform .12s ease;
}

    .action-item svg {
        width: 19px;
        height: 19px;
        color: var(--blue);
        flex-shrink: 0;
    }

.action-item {
    cursor: pointer;
}

    .action-item:hover,
    .action-item:focus-visible {
        background: var(--blue-light);
        border-color: #c7d7f2;
        transform: translateX(2px);
    }

    .action-item:focus-visible {
        outline: 2px solid var(--navy);
        outline-offset: 2px;
    }

    /* ---- completed action row: check badge + View link, same hover treatment
   as a pending row so the whole list reads consistently ---- */
    .action-item.done {
        justify-content: flex-start;
    }

    .action-item .check-badge {
        width: 22px;
        height: 22px;
        border-radius: 50%;
        background: #e4f6ea;
        color: var(--green);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

        .action-item .check-badge svg {
            width: 13px;
            height: 13px;
            stroke-width: 3;
            color: var(--green);
        }

    .action-item .view-link {
        margin-left: auto;
        color: var(--blue);
        font-weight: 700;
        font-size: 13.5px;
    }

    .action-item.done:hover .view-link,
    .action-item.done:focus-visible .view-link {
        text-decoration: underline;
    }

/* small patient tag under the "Review Documents" heading, keeps the
   selected patient visible on this step too */
.review-patient-tag {
    font-size: 12.5px;
    color: var(--text-mute);
    margin-top: 3px;
    font-weight: 500;
}

/* ---- spinner overlay card (summarizing / extracting / generating) ---- */
.spinner-card {
    background: #fff;
    border-radius: 16px;
    padding: 46px 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-md);
    animation: popIn .3s ease;
}

.spinner-ring-sm {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    border: 7px solid var(--blue-light);
    border-top-color: var(--green);
    border-right-color: var(--navy);
    animation: spin 1.1s linear infinite;
}

.spinner-card .label {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
}

    .spinner-card .label .dots span {
        animation: recBlink 1.2s infinite;
    }

        .spinner-card .label .dots span:nth-child(2) {
            animation-delay: .15s;
        }

        .spinner-card .label .dots span:nth-child(3) {
            animation-delay: .3s;
        }

/* ---- "Save the original" / patient picker modal ---- */
.search-field {
    position: relative;
    margin-bottom: 4px;
}

    .search-field label {
        display: block;
        font-size: 12.5px;
        margin-bottom: 6px;
        font-weight: 600;
    }

        .search-field label .req {
            color: #d1452b;
        }

    .search-field input {
        width: 100%;
        border: 1.5px solid var(--gray-line);
        background: var(--gray-bg);
        border-radius: 8px;
        padding: 12px 14px;
        font-size: 14.5px;
        outline: none;
    }

        .search-field input:focus {
            border-color: var(--navy);
            background: #fff;
        }

.search-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    max-height: 220px;
    overflow-y: auto;
    z-index: 5;
    animation: fadeSlideIn .2s ease;
}

    .search-dropdown .opt {
        padding: 13px 16px;
        font-size: 14.5px;
        cursor: pointer;
        border-bottom: 1px solid var(--gray-line);
    }

        .search-dropdown .opt:last-child {
            border-bottom: none;
        }

        .search-dropdown .opt:hover {
            background: var(--gray-bg);
        }

/* ---- Review Documents screen ---- */
.review-body {
    display: flex;
    height: 100%;
    min-height: 0;
}

.review-left, .review-right {
    flex: 1;
    min-width: 0;
    padding: 22px 26px;
    overflow-y: auto;
}

.review-right {
    border-left: 1px solid var(--gray-line);
}

.doc-chip-tab {
    display: inline-block;
    background: var(--blue-light);
    color: var(--navy);
    font-weight: 700;
    font-size: 13.5px;
    padding: 9px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.review-left h3 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 14px;
}

.extracted-summary-text {
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--text);
}

    .extracted-summary-text b {
        font-weight: 700;
    }

    .extracted-summary-text p {
        margin-bottom: 10px;
    }

.review-right-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

    .review-right-head .filename {
        font-weight: 700;
        font-size: 15px;
        word-break: break-word;
    }

.confidence-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-mute);
    white-space: nowrap;
}

/* ---- info icon + tooltip explaining the confidence-score colors ----
   The tooltip itself (.confidence-tooltip-float) is appended to <body>
   and positioned with `position: fixed` by JS, so it can never get
   clipped by the scrolling review-right panel's overflow. ---- */
.confidence-info {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: var(--text-mute);
    cursor: pointer;
    outline: none;
}

    .confidence-info:hover,
    .confidence-info:focus-visible {
        color: var(--navy);
    }

.confidence-tooltip-float {
    position: fixed;
    width: 270px;
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    padding: 14px 16px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text);
    white-space: normal;
    text-align: left;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .15s ease, transform .15s ease;
    pointer-events: none;
    z-index: 999;
}

    .confidence-tooltip-float.show {
        opacity: 1;
        transform: translateY(0);
    }

.ct-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

    .ct-row:last-child {
        margin-bottom: 0;
    }

.ct-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
}

    .ct-dot.ct-green {
        background: #1b8a5a;
    }

    .ct-dot.ct-yellow {
        background: #d19a15;
    }

    .ct-dot.ct-red {
        background: #c0392b;
    }

.confidence-pill {
    background: #fbe3e0;
    color: #c0392b;
    font-weight: 800;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    text-align: center;
    transition: background .3s ease, color .3s ease;
}

    .confidence-pill.good {
        background: #e0f5e8;
        color: #1b8a5a;
    }

    .confidence-pill.medium {
        background: #fff4d6;
        color: #9a6b00;
    }

.pdf-preview {
    border: 1px solid var(--gray-line);
    border-radius: 10px;
    padding: 20px 22px;
    font-size: 13.5px;
    line-height: 1.7;
    color: #333;
}

    .pdf-preview h4 {
        font-size: 17px;
        font-weight: 800;
        text-align: center;
        margin-bottom: 14px;
    }

    .pdf-preview p {
        margin-bottom: 12px;
    }

/* ---- chat / final summary screen ---- */
.chat-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.chat-tabs {
    display: flex;
    gap: 10px;
    padding: 18px 24px 0;
}

.chat-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 18px 26px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-bubble-user {
    align-self: flex-start;
    background: var(--blue-light);
    border-radius: 12px;
    padding: 14px 18px;
    max-width: 640px;
}

.chat-doc-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #d7e4fb;
    color: var(--navy);
    font-weight: 700;
    font-size: 13.5px;
    padding: 8px 14px;
    border-radius: 8px;
    margin-bottom: 8px;
}

    .chat-doc-chip svg {
        width: 15px;
        height: 15px;
    }

.chat-bubble-user .prompt-text {
    font-size: 14.5px;
    color: var(--text);
}

.summary-card {
    background: var(--gray-bg);
    border-radius: 12px;
    padding: 22px 24px;
    max-width: 760px;
    animation: fadeSlideIn .35s ease;
}

    .summary-card h4 {
        color: var(--blue);
        font-size: 16.5px;
        font-weight: 800;
        margin: 18px 0 10px;
    }

        .summary-card h4:first-child {
            margin-top: 0;
        }

    .summary-card ul {
        padding-left: 18px;
    }

    .summary-card li {
        font-size: 14.5px;
        line-height: 1.65;
        margin-bottom: 8px;
    }

    .summary-card .merge-note {
        margin-bottom: 14px;
    }

.chat-input-bar {
    border-top: 1px solid var(--gray-line);
    padding: 16px 26px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--gray-line);
    border-radius: 10px;
    padding: 10px 14px;
}

    .chat-input-row input {
        flex: 1;
        border: none;
        outline: none;
        font-size: 14.5px;
        background: transparent;
    }

.chat-send-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .chat-send-btn svg {
        width: 16px;
        height: 16px;
    }

.chat-footnote {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

    .chat-footnote .hipaa {
        font-size: 12px;
        color: var(--text-mute);
    }

.credits-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff4d6;
    color: #9a6b00;
    font-weight: 700;
    font-size: 12.5px;
    padding: 8px 14px;
    border-radius: 20px;
}

.select-version-badge {
    align-self: flex-end;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--green);
    font-weight: 700;
    font-size: 13.5px;
    margin: 14px 26px 0 0;
}

    .select-version-badge svg {
        width: 15px;
        height: 15px;
    }


/* ---- "Summary" review-and-save screen (post-confirm, and read-only "View") ---- */
.summary-save-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.summary-save-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 26px 0;
}

.summary-save-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 28px 32px;
}

    .summary-save-body h4 {
        color: var(--blue);
        font-size: 16.5px;
        font-weight: 800;
        margin: 22px 0 10px;
    }

        .summary-save-body h4:first-child {
            margin-top: 0;
        }

    .summary-save-body ul {
        padding-left: 18px;
    }

    .summary-save-body li {
        font-size: 14.5px;
        line-height: 1.7;
        margin-bottom: 8px;
        color: var(--text);
    }

    .summary-save-body .body-note {
        font-size: 14px;
        line-height: 1.6;
        color: var(--text-mute);
        margin-bottom: 16px;
    }

    .summary-save-body .pdf-preview {
        margin-top: 6px;
    }

.merge-note {
    background: var(--blue-light);
    color: var(--navy);
    font-size: 13px;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
}

/* ---- "Session Date" custom select used in the Merge with Summary modal ---- */
.session-date-select {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1.5px solid var(--gray-line);
    background: var(--gray-bg);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 14.5px;
    color: var(--text-mute);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

    .session-date-select:hover {
        border-color: #b7c3d6;
    }

    .session-date-select svg {
        color: var(--text-mute);
        flex-shrink: 0;
    }

    .session-date-select.picked {
        color: var(--text);
        background: #fff;
    }

/* ---- Traceability view (Summarize with AI -> View) ---- */
.trace-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.trace-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 26px 0;
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
}

.trace-body {
    display: flex;
    flex: 1;
    min-height: 0;
    margin: 14px auto 0;
    max-width: 1320px;
    width: 100%;
}

.trace-left, .trace-right {
    flex: 1;
    min-width: 0;
    padding: 4px 26px 26px;
    overflow-y: auto;
}

    .trace-left h4 {
        color: var(--blue);
        font-size: 16px;
        font-weight: 800;
        margin: 20px 0 8px;
    }

        .trace-left h4:first-child {
            margin-top: 0;
        }

    .trace-left ul {
        padding-left: 18px;
    }

    .trace-left li.content-line {
        font-size: 14.5px;
        line-height: 1.65;
        margin: 2px -8px 4px;
        padding: 5px 8px;
    }

.trace-right {
    border-left: 1px solid var(--gray-line);
    background: var(--gray-bg);
}

.trace-right-head {
    padding-top: 4px;
    margin-bottom: 14px;
}

.trace-ref-tabs {
    display: flex;
    gap: 8px;
}

.trace-right-body {
    font-size: 13.5px;
    line-height: 1.75;
    color: #333;
    background: #fff;
    border: 1px solid var(--gray-line);
    border-radius: 10px;
    padding: 18px 20px;
}

    .trace-right-body p {
        margin-bottom: 12px;
    }

mark.trace-mark {
    background: transparent;
    color: inherit;
    border-radius: 3px;
    padding: 0 1px;
    transition: background .2s ease, box-shadow .2s ease;
}

    mark.trace-mark.trace-hit {
        background: #ffd86b;
        box-shadow: 0 0 0 2px #ffd86b;
    }

/* ---- screen-entry zoom, scoped to the upload flow only ----
   Each new screen starts at 80% scale and zooms up to full size as it
   fades/slides in, instead of the plain fade+slide the rest of the app
   uses. Higher-specificity selector overrides the shared .screen rule
   in layout.css without touching that shared file. */
#uploadStage .screen {
    transform: translateY(8px) scale(0.8);
}

    #uploadStage .screen.active {
        transform: translateY(0) scale(1);
    }
