/* Resident Details page. All rules are namespaced under .rd-page. */

/* ---------- Header ---------- */
.rd-page .rd-head-grid { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 24px; }
.rd-page .rd-head-left { flex: 1 1 320px; min-width: 0; }
.rd-page .rd-head-right { flex: 0 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.rd-page .rd-head-right > .mud-stack { align-items: flex-end; }
.rd-page .rd-chip-row { justify-content: flex-end; }
.rd-page .rd-chip-row .mud-chip { margin: 0; }
@media (max-width: 959px) {
    .rd-page .rd-chip-row { justify-content: flex-start; }
    .rd-page .rd-head-right, .rd-page .rd-head-right > .mud-stack { align-items: flex-start; }
}
.rd-page .rd-name { font-weight: 600; line-height: 1.25; }
.rd-page .rd-name,
.rd-page .rd-wrap { overflow-wrap: anywhere; min-width: 0; }
.rd-page .rd-header-right { align-items: flex-end; }
.rd-page .rd-stats { text-align: right; line-height: 1.4; display: block; }

/* ---------- Case heading ---------- */
.rd-page .rd-case-head { display: flex; flex-direction: column; gap: 4px; width: 100%; min-width: 0; }
.rd-page .rd-case-main { display: flex; flex-direction: row; align-items: center; gap: 10px; min-width: 0; }
.rd-page .rd-case-main > .mud-chip { flex: 0 0 auto; margin: 0; }
.rd-page .rd-case-title { flex: 1 1 auto; min-width: 0; margin: 0; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.rd-page .rd-case-main > span { flex: 0 0 auto; display: inline-flex; align-items: center; }
.rd-page .rd-case-meta { font-size: .75rem; opacity: .7; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }

/* ---------- Action row ---------- */
.rd-page .rd-actions { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--mud-palette-divider); }
.rd-page .rd-actions-group { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
.rd-page .rd-actions > .rd-actions-group:nth-of-type(2) { margin-left: auto; }
.rd-page .rd-actions .mud-button-root { min-height: 34px; height: 34px; text-transform: none; line-height: 1; padding-top: 0; padding-bottom: 0; }
.rd-page .rd-actions .mud-icon-button { width: 34px; height: 34px; padding: 0; }
.rd-page .rd-actions .mud-tooltip-root { display: inline-flex; }
.rd-page .rd-actions .mud-badge-root { display: inline-flex; }
.rd-page .rd-actions .mud-badge-root .mud-badge {
    font-size: .65rem; font-weight: 600; line-height: 1;
    min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box;
    border-radius: 8px; white-space: nowrap;
    top: 2px; right: 2px; inset-inline-end: 2px;
    transform: translate(50%, -50%);
}
@media (max-width: 959px) {
    .rd-page .rd-actions .mud-icon-button { width: 40px; height: 40px; }
    .rd-page .rd-actions .mud-button-root { min-height: 40px; height: 40px; }
    .rd-page .rd-actions > .rd-actions-group:nth-of-type(2) { margin-left: 0; }
}

/* ---------- Original issue ---------- */
.rd-page .issue-original { background-color: #f5f8fc; border-left: 4px solid #1e88e5; border-radius: 4px; }
.rd-page .rd-original-header { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; min-height: 32px; user-select: none; }
.rd-page .rd-original-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; margin: 4px 0 2px; }

/* ---------- Updates ---------- */
.rd-page .rd-section-title { text-transform: uppercase; letter-spacing: .04em; font-size: .75rem; opacity: .7; margin-top: 4px; }
.rd-page .rd-update { border-radius: 4px; padding: 10px 12px; margin-bottom: 10px; }
.rd-page .rd-update-head { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid rgba(0,0,0,.08); }
.rd-page .rd-update-meta { display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.rd-page .rd-update-actions { display: flex; flex-direction: row; flex: 0 0 auto; gap: 2px; }
.rd-page .rd-update-actions .mud-icon-button { width: 32px; height: 32px; padding: 0; }
.rd-page .rd-update-text { overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.5; }
.rd-page .issue-latest-update { background-color: #f1f8f4; border: 1px solid #cfe5d4; border-left: 4px solid #2e7d32; }
.rd-page .issue-update { background-color: #fff; border: 1px solid #dcdcdc; border-left: 4px solid #b0bec5; }

@media (max-width: 959px) {
    .rd-page .rd-header-right { align-items: flex-start; }
    .rd-page .rd-stats { text-align: left; }
}
