/* Hand-off pop-ups, the school admin's rules and the teacher's handed-over reports.
   Self-contained so the Experience log page and the staff dashboard look the same. */
.rh-dialog{width:min(520px,calc(100% - 32px));max-height:calc(100dvh - 32px);padding:26px;border:1px solid rgba(23,63,53,.13);border-radius:22px;background:#fffefa;color:#153d32;box-shadow:0 16px 45px rgba(23,63,53,.14);overflow:auto}
.rh-dialog.rh-wide{width:min(680px,calc(100% - 32px))}
.rh-dialog::backdrop{background:rgba(23,63,53,.4)}
.rh-dialog h2,.rh-panel-head h2{margin:0 0 6px;color:#173f35;font-size:1.35rem;letter-spacing:-.03em}
.rh-dialog h3{margin:16px 0 6px;color:#173f35;font-size:.95rem}
.rh-dialog form{display:grid;gap:14px}
.rh-hint,.rh-panel-head p{margin:0;color:#5f6b64;font-size:.84rem;line-height:1.55}
.rh-field{display:grid;gap:6px;font-size:.8rem;font-weight:700;color:#173f35}
.rh-field select,.rh-note-form input,.rh-rule-teacher select{width:100%;min-height:44px;padding:9px 12px;border:1px solid rgba(23,63,53,.22);border-radius:12px;background:#fff;color:inherit;font:inherit;font-size:max(16px,.92rem)}
.rh-field select:focus-visible,.rh-note-form input:focus-visible,.rh-rule-teacher select:focus-visible{outline:2px solid var(--forest-deep);outline-offset:1px;border-color:#245a4a;box-shadow:0 0 0 3px rgba(57,167,123,.22)}
.rh-fieldset{margin:0;padding:0;border:0;display:grid;gap:8px}
.rh-fieldset legend{margin-bottom:6px;font-size:.8rem;font-weight:700;color:#173f35}
.rh-choice{display:flex;align-items:center;gap:10px;padding:11px 13px;border:1px solid rgba(23,63,53,.18);border-radius:12px;font-size:.9rem;cursor:pointer}
.rh-choice:has(input:checked){border-color:#245a4a;background:#dff2e9}
.rh-status{min-height:1.2em;margin:0;color:#a52c41;font-size:.82rem;line-height:1.5}
.rh-actions{display:flex;justify-content:flex-end;gap:8px}
.rh-actions.rh-wrap{flex-wrap:wrap;justify-content:flex-start;margin-top:12px}
.rh-button{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:9px 16px;border:1px solid transparent;border-radius:10px;font-size:.8rem;font-weight:800;cursor:pointer}
.rh-button:focus-visible{outline:3px solid var(--forest-deep);outline-offset:2px}
.rh-button:disabled{opacity:.45;cursor:not-allowed}
.rh-primary{border-color:#245a4a;color:#fff;background:#245a4a}
.rh-primary:hover:not(:disabled){background:#173f35}
.rh-secondary{border-color:rgba(23,63,53,.28);color:#173f35;background:#fffefa}
.rh-secondary:hover:not(:disabled){background:#dff2e9}
.rh-danger{border-color:#d9a3ab;color:#9a3040;background:#fffefa}
.rh-danger:hover:not(:disabled){background:#f7e2e5}
.rh-badge{display:inline-flex;align-items:center;padding:4px 10px;border-radius:999px;font-size:.68rem;font-weight:700;color:#52655d;background:#edf2ee;white-space:nowrap}
.rh-badge.is-blue{color:#4a5a90;background:#eaedfa}
.rh-badge.is-green{color:#216b4f;background:#e0f2e9}
.rh-badge.is-amber{color:#8a5a12;background:#faf0dd}
.rh-badge.is-grey{color:#52655d;background:#edf2ee}
.rh-empty{margin:0;padding:14px 0;color:#5f6b64;font-size:.86rem}
.rh-panel-head{margin-bottom:16px}
.rh-rule-form{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px;align-items:end;margin-bottom:10px}
.rh-rules{display:grid;gap:10px;margin-top:8px}
.rh-rule{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(160px,1fr) auto;gap:12px;align-items:center;padding:14px 16px;border:1px solid rgba(23,63,53,.16);border-radius:14px;background:#fffefa}
.rh-rule.is-off{background:#f4f4ef}
.rh-rule-main{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
.rh-rule-teacher{display:grid;gap:4px;font-size:.7rem;font-weight:700;color:#5f6b64}
.rh-rule-actions{display:flex;gap:8px}
.rh-report-list{display:grid;gap:10px}
.rh-report{border:1px solid rgba(23,63,53,.16);border-radius:14px;background:#fffefa}
.rh-report-open{display:grid;gap:6px;width:100%;padding:14px 16px;border:0;border-radius:14px;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer}
.rh-report-open:hover{background:#f1f7f3}
.rh-report-open:focus-visible{outline:3px solid var(--forest-deep);outline-offset:-3px}
.rh-report-top{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px}
.rh-report-reason{color:#3c4f47;font-size:.86rem;line-height:1.5;overflow-wrap:anywhere}
.rh-report-meta{color:#5f6b64;font-size:.74rem}
.rh-detail header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.rh-close{flex:none;width:44px;height:44px;border:0;border-radius:50%;background:#edf2ee;color:#173f35;font-size:1.3rem;line-height:1;cursor:pointer}
.rh-reason{margin:14px 0 4px;padding:12px 14px;border-radius:12px;background:#f4f7f3;font-size:.9rem;line-height:1.55;overflow-wrap:anywhere}
.rh-notes{display:grid;gap:8px}
.rh-note{padding:10px 12px;border:1px solid rgba(23,63,53,.14);border-radius:10px}
.rh-note p{margin:0;font-size:.86rem;line-height:1.5;overflow-wrap:anywhere}
.rh-note small{color:#5f6b64;font-size:.72rem}
.rh-note-form{display:flex!important;gap:8px}
.rh-handoff-line{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:8px 0 0}
/* Report actions: a 2x2 grid of decisions, Hand off full-width under it, then a short safeguarding block.
   Colours come from the page's own variables so a school's colours carry through. */
.rh-outcome,.flag-outcome{margin:0 0 12px;padding:12px 14px;border:1px solid var(--line-strong,#b7cdbd);border-radius:12px;background:var(--mint,#e4f1e9);color:var(--forest,#173f35);font-size:.84rem;font-weight:700;line-height:1.5}
.rh-outcome:focus-visible,.flag-outcome:focus-visible{outline:3px solid var(--forest,#173f35);outline-offset:2px}
.flag-status-line{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:6px 0 8px;font-size:.78rem;line-height:1.5}
.badge.rh-tone.is-blue{color:#4a5a90;background:#eaedfa}
.badge.rh-tone.is-green{color:var(--forest,#216b4f);background:var(--mint,#e0f2e9)}
.badge.rh-tone.is-amber{color:#8a5a12;background:#faf0dd}
.badge.rh-tone.is-grey{color:#52655d;background:#edf2ee}
.next-steps,.rh-next{margin-top:12px}
.next-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.next-pass{display:grid;margin-top:8px}
.next-grid>button,.next-pass>button{width:100%;min-height:44px;padding:8px 10px;justify-content:center;text-align:center;line-height:1.25;overflow-wrap:anywhere}
.next-grid>button.danger,.next-grid>button.rh-danger{border-color:#d9a3ab;color:#9a3040}
.next-steps button:focus-visible,.rh-next button:focus-visible{outline:3px solid var(--forest,#173f35);outline-offset:2px}
.next-safeguarding{padding-top:10px;border-top:1px solid var(--line,rgba(23,63,53,.14))}
.next-safeguarding h4{display:flex;align-items:center;gap:6px;margin:0 0 6px;color:var(--forest,#173f35);font-size:.84rem}
.next-safeguarding h4 svg{width:16px;height:16px;flex:none}
.next-note{margin:0 0 6px;color:#5f6b64;font-size:.78rem;line-height:1.5}
.next-note b{color:var(--forest,#173f35)}
.next-support{display:grid;gap:3px;margin:0 0 6px;padding:0;list-style:none;font-size:.78rem}
.next-support li{display:flex;flex-wrap:wrap;gap:6px}
.next-support span{min-width:56px;color:#5f6b64}
.next-support a{color:var(--forest,#173f35);font-weight:700;overflow-wrap:anywhere}
@media (max-width:640px){.rh-rule{grid-template-columns:1fr}.rh-dialog{padding:20px}.rh-actions{flex-wrap:wrap}.rh-actions .rh-button{flex:1}}

.rh-rule-save{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:8px;padding:8px 10px;border:1px solid var(--line-strong,rgba(36,90,74,.29));border-radius:10px;background:var(--mint,#dff2e9);font-size:.78rem;font-weight:700;color:var(--forest-deep,#173f35)}
.rh-rule-save span{flex:1 1 180px}

.next-urgent{color:var(--forest-deep,#173f35)}
.next-urgent a{color:var(--forest-deep,#173f35);font-weight:800}

/* Staff report rows: a plain card, with a red edge only for high severity. */
.teacher-dashboard .flag-row{padding:14px 16px;border:1px solid var(--line,rgba(23,63,53,.14));background:var(--paper,#fffefa)}
.teacher-dashboard .flag-row:has(.flag-high){border-left:4px solid var(--danger,#c64b5c)}
.teacher-dashboard .flag-row.is-resolved{background:rgba(255,255,255,.72)}
.teacher-dashboard .flag-row-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.teacher-dashboard .flag-row-head .flag-when{margin-left:auto;color:var(--muted,#5f6b64);font-size:.75rem}
.teacher-dashboard .flag-row .flag-reason{margin:8px 0 4px;font-size:.95rem;font-weight:600;line-height:1.45}
.flag-quote{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:0 0 8px;color:var(--muted,#5f6b64);font-size:.9rem;font-style:italic;line-height:1.45}
.voice-flag-controls.is-compact{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin:0 0 8px}
.voice-flag-controls.is-compact .flag-actions{margin:0}
.flag-hold{margin:0;color:var(--muted,#5f6b64);font-size:.78rem}
