/* ════════════════════════════════════════════════════════════════════════════════════════════
   Previous Patient Records — the TYPE tabs and the Advanced Speciality Tools' records
   (assets/js/speciality-records.js). The record detail wears the SAME tile look as a clinical
   session's AI outputs (v37-ui.css #session-detail-view .clinical-output-card), scoped to this
   panel because those rules are scoped to the session-detail view.
   ════════════════════════════════════════════════════════════════════════════════════════════ */

/* The six tabs WRAP rather than scroll. They are ~970 px wide and the records column is ~720 px on a
   desktop (~310 px on a phone): a sideways-scrolling row looked cut off at "Deep Radiology Anal…" and
   could only be scrolled with a trackpad gesture or a thin, often hidden, scrollbar — a mouse wheel
   never moves it. Wrapped, every tab is on screen at every width, and the page still never scrolls
   sideways (§30). */
.records-types {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 6px;
    margin: 0 0 14px;
    padding-bottom: 2px;
    border-bottom: 1px solid #dbe7f7;
}
.records-types[hidden] { display: none !important; }
.records-type {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: var(--text-secondary, #5f738f);
    border: none;
    border-bottom: 3px solid transparent;
    padding: 9px 12px 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    min-height: 40px;
}
.records-type:hover { color: #0b3b7a; }
.records-type.active { color: var(--primary-color, #1c5fd4); border-bottom-color: var(--primary-color, #1c5fd4); }
.records-type-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
    background: rgba(28, 95, 212, .1); color: #1c5fd4; font-size: 11px; font-weight: 800;
}
.records-type.active .records-type-count { background: var(--primary-color, #1c5fd4); color: #fff; }

.sessions-list[hidden], .speciality-records-panel[hidden] { display: none !important; }
.speciality-records-panel { min-width: 0; }

.sr-list-head { font-size: 12.5px; font-weight: 700; color: #5f738f; margin: 0 0 8px; }
.sr-avatar { background: var(--sr-color, #1b55e2) !important; color: #fff; }
.sr-avatar i { font-size: 18px; }
.sr-row .record-info h4 { overflow-wrap: anywhere; }
.empty-records.sr-loading i { animation: srSpin 1s linear infinite; }
@keyframes srSpin { to { transform: rotate(360deg); } }
.empty-records.sr-failed { border: 1px solid #fecaca; background: #fff7f7; border-radius: 14px; }

.sr-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 40px; padding: 8px 16px; border-radius: 10px;
    border: 1px solid #1c5fd4; background: #1c5fd4; color: #fff;
    font-family: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.sr-btn.sr-ghost { background: #fff; color: #1c5fd4; }
.sr-btn:disabled { opacity: .6; cursor: default; }

.sr-back {
    display: inline-flex; align-items: center; gap: 6px; margin: 0 0 12px;
    background: transparent; border: none; color: #1c5fd4; font: inherit; font-size: 13.5px; font-weight: 700;
    cursor: pointer; min-height: 40px; padding: 0;
}
.sr-detail .sr-header { position: relative; }
.sr-detail .sr-header h2 { overflow-wrap: anywhere; }
.sr-avatar-lg { background: var(--sr-color, #1b55e2) !important; color: #fff; }
.sr-avatar-lg i { font-size: 26px; }
.sr-delete {
    margin-left: auto; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px;
    border: 1px solid #fecaca; background: #fff; color: #dc2626; cursor: pointer; font-size: 18px;
    display: inline-flex; align-items: center; justify-content: center;
}
.sr-note { display: flex; gap: 8px; align-items: center; color: #475569; font-size: 13px; margin: 6px 0 10px; }

.sr-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 12px;
}
#speciality-records-panel .clinical-output-card {
    background: rgba(255, 255, 255, .72);
    border: 1px solid #d6e5f9;
    border-radius: 14px;
    padding: 16px 15px;
    cursor: pointer;
    transition: .2s;
    text-align: left;
    font-family: inherit;
    position: relative;
    overflow: hidden;
    min-height: 128px;
}
#speciality-records-panel .clinical-output-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 48px rgba(10, 60, 90, .22);
    border-color: #7fd0e0;
}
#speciality-records-panel .clinical-output-card .co-icon {
    width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
    color: #fff; font-size: 20px; background: var(--co-color, #1b55e2);
    box-shadow: 0 8px 18px rgba(2, 10, 30, .4);
}
#speciality-records-panel .clinical-output-card h4 { display: block; font-size: 14px; color: #08374f; margin: 11px 0 0; line-height: 1.25; }
#speciality-records-panel .clinical-output-card p { display: block; font-size: 11.5px; color: #4a7e96; margin-top: 4px; line-height: 1.45; }
#speciality-records-panel .clinical-output-pill {
    position: absolute; top: 11px; right: 11px; font-size: 9.5px; font-weight: 800;
    padding: 2px 7px; border-radius: 99px; letter-spacing: .04em; text-transform: none;
}
#speciality-records-panel .clinical-output-pill.ready { background: #059669; color: #fff; }

/* A tool result that could not be filed: Retry, and View it here — it is never thrown away. */
.sr-file-failed {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start;
    padding: 14px 16px; border-radius: 14px; border: 1px solid #fecaca; background: #fff7f7; color: #7f1d1d;
}
.sr-file-failed > i { font-size: 22px; color: #dc2626; }
.sr-file-failed-text { flex: 1 1 220px; min-width: 0; }
.sr-file-failed-text p { margin: 4px 0 0; font-size: 13px; color: #7f1d1d; }
.sr-file-failed-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.sr-records-link { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sr-records-link small { color: #5f738f; }

@media (max-width: 640px) {
    .sr-tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
    .sr-detail .sr-header { flex-wrap: wrap; }
}
@media (max-width: 380px) {
    .sr-tiles { grid-template-columns: 1fr; }
}
