/* ── Portal Wrapper ─────────────────────────────────────────────────────────── */
#h2bio-portal-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    max-width: 1100px;
    margin: 0 auto;
}

/* ── Portal Header ───────────────────────────────────────────────────────────── */
#h2bio-portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #004d73 0%, #0073aa 100%);
    color: #fff;
    padding: 14px 28px;
    border-radius: 14px 14px 0 0;
    gap: 16px;
    flex-wrap: wrap;
}

#h2bio-portal-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 17px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.01em;
}

#h2bio-portal-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.h2bio-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.35);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    flex-shrink: 0;
}

.h2bio-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.h2bio-user-info strong {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.h2bio-user-info span {
    color: rgba(255,255,255,0.65);
    font-size: 12px;
}

#h2bio-signout {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1.5px solid rgba(255,255,255,0.3);
    padding: 7px 18px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
    white-space: nowrap;
}

#h2bio-signout:hover {
    background: rgba(255,255,255,0.28);
}

/* ── Portal Content Area ─────────────────────────────────────────────────────── */
#h2bio-portal-content {
    background: #f0f4f8;
    padding: 24px;
    border-radius: 0 0 14px 14px;
    min-height: 300px;
}

/* ── Upload Card ─────────────────────────────────────────────────────────────── */
#h2bio-upload-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    padding: 28px 32px 32px;
    margin-bottom: 24px;
}

.h2bio-card-head {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eef0f3;
}

.h2bio-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: #e8f4fb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.h2bio-card-head h3 {
    margin: 0 0 5px;
    font-size: 18px;
    font-weight: 800;
    color: #1a202c;
}

.h2bio-card-head p {
    margin: 0;
    font-size: 13px;
    color: #718096;
    line-height: 1.5;
}

/* ── Section Labels ──────────────────────────────────────────────────────────── */
.h2bio-section-label {
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #a0aec0;
    margin-bottom: 14px;
    margin-top: 4px;
}

/* ── Form Grid ───────────────────────────────────────────────────────────────── */
.h2bio-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.h2bio-field {
    margin-bottom: 0;
}

.h2bio-field label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #4a5568;
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.h2bio-field input,
.h2bio-field select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    color: #2d3748;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.h2bio-field input:focus,
.h2bio-field select:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,115,170,0.1);
}

/* ── Upload Zone ─────────────────────────────────────────────────────────────── */
.h2bio-upload-zone {
    position: relative;
    border: 2px dashed #b2d4e8;
    border-radius: 12px;
    padding: 36px 24px;
    text-align: center;
    background: #f7faff;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 4px;
}

.h2bio-upload-zone:hover {
    border-color: #0073aa;
    background: #edf5fb;
}

.h2bio-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
}

.h2bio-drop-text {
    margin: 8px 0 5px;
    font-size: 15px;
    color: #4a5568;
    font-weight: 500;
}

.h2bio-browse-link {
    color: #0073aa;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

.h2bio-drop-hint {
    margin: 0;
    font-size: 12px;
    color: #a0aec0;
}

/* ── Submit Button ───────────────────────────────────────────────────────────── */
#h2bio-submit {
    width: 100%;
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    color: #fff;
    border: none;
    padding: 15px 28px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 9px;
    cursor: pointer;
    margin-top: 10px;
    transition: opacity 0.2s, transform 0.1s;
    letter-spacing: 0.01em;
}

#h2bio-submit:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

#h2bio-submit:active {
    transform: translateY(0);
}

/* ── Loading Card ────────────────────────────────────────────────────────────── */
.h2bio-loading-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    padding: 56px 32px;
    text-align: center;
    margin-bottom: 24px;
}

.h2bio-spinner {
    width: 46px;
    height: 46px;
    border: 4px solid #e2e8f0;
    border-top-color: #0073aa;
    border-radius: 50%;
    margin: 0 auto 22px;
    animation: h2bio-spin 0.75s linear infinite;
}

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

.h2bio-loading-title {
    font-size: 17px;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 8px;
}

.h2bio-loading-sub {
    font-size: 13px;
    color: #a0aec0;
    margin: 0;
}

/* ── Error ───────────────────────────────────────────────────────────────────── */
#h2bio-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 14px 18px;
    border-radius: 9px;
    color: #991b1b;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.6;
}

/* ── Results Panel ───────────────────────────────────────────────────────────── */
#h2bio-results {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    padding: 24px 28px;
}

.h2bio-patient-name {
    font-size: 15px;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 16px;
}

.h2bio-file-label {
    margin: 24px 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: #4a5568;
    padding-bottom: 8px;
    border-bottom: 1px solid #eef0f3;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Drop Zone ───────────────────────────────────────────────────────────────── */
.h2bio-dropzone {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 20px 16px 16px;
    text-align: center;
    color: #718096;
    transition: border-color 0.15s, background 0.15s;
    margin-bottom: 12px;
}
.h2bio-dropzone.dragover {
    border-color: #0073aa;
    background: #ebf5fb;
    color: #0073aa;
}
.h2bio-dropzone-label { font-size: 14px; margin: 0 0 10px; }
.h2bio-dropzone-filelist {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    text-align: left;
}
.h2bio-dropzone-filelist li {
    font-size: 12px;
    color: #4a5568;
    padding: 2px 0;
}
.h2bio-dropzone-filelist li::before { content: "📄 "; }

/* ── Customer Accordion ──────────────────────────────────────────────────────── */
.h2bio-cust-accordion {
    margin-top: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    font-size: 14px;
}
.h2bio-cust-row {
    border-bottom: 1px solid #e2e8f0;
}
.h2bio-cust-row:last-child { border-bottom: none; }
.h2bio-cust-header {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    background: #fff;
    gap: 10px;
    user-select: none;
    transition: background 0.15s;
}
.h2bio-cust-header:hover { background: #f7fafc; }
.h2bio-cust-num {
    min-width: 26px;
    color: #a0aec0;
    font-size: 12px;
    font-weight: 600;
}
.h2bio-cust-name {
    flex: 1 1 180px;
    font-weight: 600;
    color: #2d3748;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.h2bio-cust-email {
    flex: 2 1 220px;
    color: #718096;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.h2bio-cust-uploads {
    min-width: 64px;
    text-align: center;
    font-size: 12px;
    color: #718096;
}
.h2bio-cust-created {
    min-width: 110px;
    font-size: 12px;
    color: #a0aec0;
    white-space: nowrap;
}
.h2bio-cust-chevron {
    min-width: 20px;
    text-align: center;
    color: #a0aec0;
    font-size: 13px;
    transition: transform 0.2s;
}
.h2bio-cust-row.open .h2bio-cust-chevron { transform: rotate(90deg); }
.h2bio-cust-body {
    display: none;
    padding: 10px 14px 12px 50px;
    background: #f7fafc;
    border-top: 1px solid #e2e8f0;
    gap: 8px;
    flex-wrap: wrap;
}
.h2bio-cust-row.open .h2bio-cust-body { display: flex; }

/* ── Results Table ───────────────────────────────────────────────────────────── */
.h2bio-results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 14px;
}

.h2bio-results-table th,
.h2bio-results-table td {
    padding: 10px 13px;
    border: 1px solid #e2e8f0;
    text-align: left;
}

.h2bio-results-table th {
    background: #f7fafc;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #718096;
}

.h2bio-test-name-orig {
    display: block;
    font-size: 11px;
    color: #888;
    font-weight: normal;
    margin-top: 2px;
}

.h2bio-status-normal   { background: #f0fff4; }
.h2bio-status-low      { background: #fffbeb; }
.h2bio-status-high     { background: #fff7ed; }
.h2bio-status-critical { background: #fef2f2; }

.h2bio-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.h2bio-status-normal   .h2bio-badge { background: #bbf7d0; color: #14532d; }
.h2bio-status-low      .h2bio-badge { background: #fef08a; color: #713f12; }
.h2bio-status-high     .h2bio-badge { background: #fed7aa; color: #7c2d12; }
.h2bio-status-critical .h2bio-badge { background: #fecaca; color: #7f1d1d; }

.h2bio-date-col {
    white-space: nowrap;
    min-width: 130px;
}

.h2bio-file-duplicate {
    background: #fffbeb;
    border: 1px solid #fde68a;
    padding: 10px 14px;
    border-radius: 7px;
    color: #78350f;
    font-size: 14px;
    margin-top: 8px;
}

.h2bio-file-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 10px 14px;
    border-radius: 7px;
    color: #991b1b;
    font-size: 13px;
    margin-top: 8px;
}

#h2bio-new-report {
    display: inline-block;
    margin-top: 20px;
    color: #0073aa;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
}

#h2bio-new-report:hover {
    text-decoration: underline;
}

/* ── Quick Search ────────────────────────────────────────────────────────────── */
#h2bio-search-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    padding: 16px 18px;
}

#h2bio-test-search-row {
    display: flex;
    gap: 8px;
}

#h2bio-test-search {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    color: #2d3748;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 0;
}

#h2bio-test-search:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,115,170,0.1);
}

#h2bio-test-search-btn {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
}

#h2bio-test-search-btn:hover {
    opacity: 0.88;
}

#h2bio-test-search-clear {
    background: #f1f5f9;
    color: #64748b;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, color 0.2s;
}

#h2bio-test-search-clear:hover {
    background: #fee2e2;
    color: #e53e3e;
}

#h2bio-test-search-results {
    margin-top: 12px;
}

.h2bio-search-status {
    font-size: 13px;
    color: #718096;
    margin: 0;
}

mark.h2bio-search-highlight {
    background: #fde68a;
    color: #92400e;
    border-radius: 3px;
    padding: 0 2px;
    font-weight: 700;
}


/* ── History Panel ───────────────────────────────────────────────────────────── */
#h2bio-history {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    padding: 20px 22px;
}

.h2bio-history-hd {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.h2bio-history-hd h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    color: #2d3748;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

#h2bio-clear-history {
    background: #fff;
    color: #c0392b;
    border: 1.5px solid #fecaca;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: background 0.2s;
}

#h2bio-clear-history:hover {
    background: #fef2f2;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    #h2bio-portal-header {
        border-radius: 0;
        padding: 14px 16px;
    }

    #h2bio-portal-content {
        padding: 16px;
        border-radius: 0;
    }

    #h2bio-upload-card {
        padding: 20px 18px;
    }

    .h2bio-form-row {
        grid-template-columns: 1fr;
    }

    #h2bio-output-wrap {
        flex-direction: column !important;
    }

    #h2bio-history {
        width: 100% !important;
    }

    .h2bio-user-info {
        display: none;
    }
}

/* Sort arrow floating tooltip */
#h2bio-sort-tip {
    display: none;
    position: absolute;
    background: #333;
    color: #fff;
    font-size: 12px;
    padding: 5px 9px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 99999;
    pointer-events: none;
}
