@font-face {
    font-family: 'Manrope';
    src: url('../fonts/manrope-var.woff2') format('woff2-variations');
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}
.patient-match-status {
    display: block;
    margin: -9px 0 12px;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
}
.patient-match-status.is-loading { color: #0369a1; }
.patient-match-status.is-found { color: #15803d; }
.patient-match-status.is-new { color: #a16207; }
.patient-match-status.is-error { color: #b91c1c; }

.background-uploads {
    position: fixed;
    z-index: 5200;
    right: 10px;
    bottom: 12px;
    display: grid;
    gap: 8px;
    width: min(180px, calc(100vw - 16px));
    max-height: calc(100vh - 24px);
    overflow: auto;
    pointer-events: none;
}
.background-upload {
    padding: 8px 10px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: var(--app-surface);
    color: var(--app-text);
    box-shadow: var(--app-shadow-lg);
    pointer-events: auto;
}
.background-upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}
.background-upload-header strong,
.background-upload p {
    overflow-wrap: anywhere;
}
.background-upload-header strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}
.background-upload-header span {
    flex: none;
    font-size: 12px;
}
.background-upload-bar {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--app-surface-soft);
}
.background-upload-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #2563eb;
    
}
.background-upload p {
    display: -webkit-box;
    margin: 5px 0 0;
    color: var(--app-muted);
    font-size: 12px;
    line-height: 1.35;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.background-upload[data-state="completed"] .background-upload-bar span { background: #16a34a; }
.background-upload[data-state="failed"] .background-upload-bar span { background: #dc2626; }
.background-upload[data-state="failed"] p { color: #b91c1c; }
.background-upload[data-state="network-wait"] .background-upload-bar span { background: #f59e0b; }
.background-upload[data-state="network-wait"] p { color: #a16207; }
.background-upload[data-state="retrying"] .background-upload-bar span { background: #f59e0b; }
.background-upload[data-state="retrying"] p { color: #a16207; }
.background-upload a {
    display: inline-block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--app-accent);
}

.dicom-patient-dialog {
    box-sizing: border-box;
    width: min(520px, calc(100vw - 28px));
    max-height: calc(100vh - 28px);
    padding: 0;
    overflow: auto;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: var(--app-surface);
    color: var(--app-text);
    box-shadow: var(--app-shadow-lg);
}

.dicom-patient-dialog::backdrop {
    background: rgba(5, 12, 20, .58);
}

.dicom-patient-dialog-shell {
    display: grid;
    gap: 0;
}

.dicom-patient-dialog header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px 11px;
    border-bottom: 1px solid var(--app-border);
}

.dicom-patient-dialog h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.35;
}

.dicom-patient-dialog-close {
    flex: none;
    min-width: 32px;
    min-height: 32px;
    padding: 4px 8px;
}

.dicom-patient-dialog-content {
    padding: 14px 16px;
}

.dicom-patient-dialog-content p {
    margin: 0;
    color: var(--app-muted);
    font-size: 12px;
    line-height: 1.55;
}

.dicom-patient-dialog-content dl {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 7px 14px;
    margin: 13px 0 0;
    padding: 11px 12px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: var(--app-surface-soft);
}

.dicom-patient-dialog-content dt {
    color: var(--app-muted);
    font-size: 12px;
}

.dicom-patient-dialog-content dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 12px;
    font-weight: 600;
}

.dicom-patient-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px 16px;
}

.dicom-patient-dialog-actions button {
    min-width: 104px;
}

.dicom-patient-dialog-actions .dicom-patient-dialog-primary {
    border-color: var(--app-accent);
    background: var(--app-accent);
    color: #fff;
}

.dicom-patient-dialog-actions .dicom-patient-dialog-secondary {
    background: transparent;
    color: var(--app-text);
}

@media (max-width: 520px) {
    .dicom-patient-dialog-content dl {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .dicom-patient-dialog-content dd {
        margin-bottom: 7px;
    }

    .dicom-patient-dialog-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .dicom-patient-dialog-actions button {
        width: 100%;
    }
}
