/* Riffhelm managed-setup customer screens. Everything is scoped under #rhMsRoot / .rhms-* so the legacy UI is untouched.
   Targets: 375px phones (no horizontal scroll), >=44px touch targets, 4.5:1 text contrast, visible focus, no information in colour alone. */

/* When the managed UI owns the screen every legacy surface stays closed, whatever legacy code paints. */
html.rh-ms-active .shell,
html.rh-ms-active #pmAuthOverlay,
html.rh-ms-active #rhOnboardingOverlay,
html.rh-ms-active #rhCreatePasswordOverlay,
html.rh-ms-active #pmAuthUserbar,
html.rh-ms-active #rhAuthResolving,
html.rh-ms-active #rhRecoveryModal { display: none !important; visibility: hidden !important; pointer-events: none !important; }

.rhms-root { position: fixed; inset: 0; z-index: 10050; overflow-y: auto; -webkit-overflow-scrolling: touch; background: #f3f6fb; color: #10213d;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.rhms-root[hidden] { display: none; }
.rhms-root *, .rhms-root *::before, .rhms-root *::after { box-sizing: border-box; }
.rhms-root a { color: #0b4f9e; }
.rhms-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.rhms-skip { position: absolute; left: 8px; top: -60px; background: #fff; padding: 10px 14px; border-radius: 8px; z-index: 5; }
.rhms-skip:focus { top: 8px; }
.rhms-root [tabindex="-1"]:focus { outline: none; }
.rhms-root :focus-visible, .rhms-dialog :focus-visible { outline: 3px solid #1473e6; outline-offset: 2px; border-radius: 4px; }

/* layout */
.rhms-top { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 10px 16px; background: #fff; border-bottom: 1px solid #dfe7f1; position: sticky; top: 0; z-index: 3; }
.rhms-top-left, .rhms-top-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; }
.rhms-org { font-weight: 700; color: #0a2c59; overflow-wrap: anywhere; }
.rhms-who { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #40516d; font-size: 14px; }
.rhms-logo { height: 34px; width: auto; max-width: 180px; display: block; }
.rhms-logo-text { font-weight: 900; letter-spacing: .08em; color: #0a2c59; }
.rhms-nav { display: flex; gap: 6px; }
.rhms-navbtn { min-height: 44px; padding: 8px 14px; border: 0; border-bottom: 3px solid #d7193f; background: transparent; font: inherit; font-weight: 800; color: #0a2c59; cursor: pointer; }
.rhms-main { width: min(760px, 100%); margin: 0 auto; padding: 20px 16px 48px; }
.rhms-main-auth { padding-top: 32px; }
.rhms-main-wide { width: min(1100px, 100%); }
.rhms-card { background: #fff; border: 1px solid #dfe7f1; border-radius: 20px; padding: 22px 20px; box-shadow: 0 14px 38px rgba(13,39,77,.10); }
.rhms-center { text-align: center; }
.rhms-brand { margin-bottom: 14px; }
.rhms-h1 { margin: 0 0 8px; font-size: 26px; line-height: 1.2; color: #0a2c59; outline: none; overflow-wrap: anywhere; }
.rhms-h2 { margin: 18px 0 8px; font-size: 18px; color: #0a2c59; }
.rhms-h3 { margin: 12px 0 6px; font-size: 16px; color: #0a2c59; }
.rhms-lede { margin: 0 0 14px; color: #243652; }
.rhms-help { margin: 4px 0; font-size: 14px; color: #4a5a72; }
.rhms-note { margin: 8px 0; padding: 10px 12px; background: #eef4fb; border-left: 4px solid #1473e6; border-radius: 6px; font-size: 15px; color: #1b2f4d; }
.rhms-legal-links { text-align: center; font-size: 13px; color: #4a5a72; margin-top: 14px; }
.rhms-switch { margin: 16px 0 0; text-align: center; color: #243652; }
.rhms-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .rhms-grid2 { grid-template-columns: 1fr; } .rhms-h1 { font-size: 22px; } .rhms-card { padding: 18px 14px; border-radius: 16px; } .rhms-who { display: none; } }

/* forms */
.rhms-form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.rhms-subform { margin-top: 18px; padding-top: 14px; border-top: 1px solid #dfe7f1; display: flex; flex-direction: column; gap: 10px; }
.rhms-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rhms-label { font-weight: 700; color: #10213d; font-size: 15px; }
.rhms-req { color: #b00020; }
.rhms-field input:not([type=checkbox]):not([type=file]), .rhms-field select, .rhms-field textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; font-size: 16px; color: #10213d; background: #fff; border: 1.5px solid #8393ab; border-radius: 10px; }
.rhms-field textarea { min-height: 96px; resize: vertical; }
.rhms-field [aria-invalid="true"] { border-color: #b00020; border-width: 2px; }
.rhms-field-error { color: #9a001b; font-size: 14px; font-weight: 600; }
.rhms-field-error::before { content: "✕ "; }
.rhms-pw-row { display: flex; gap: 8px; align-items: stretch; }
.rhms-pw-row input { flex: 1; min-width: 0; }
.rhms-toggle { min-width: 64px; min-height: 48px; padding: 0 12px; border: 1.5px solid #8393ab; border-radius: 10px; background: #f6f8fb; font: inherit; font-weight: 700; color: #0a2c59; cursor: pointer; }
.rhms-rules { list-style: none; margin: 0; padding: 10px 12px; background: #f6f8fb; border-radius: 10px; display: grid; gap: 4px; font-size: 14px; }
.rhms-rule { color: #4a5a72; }
.rhms-rule-mark { display: inline-block; width: 1.4em; font-weight: 800; }
.rhms-rule-ok { color: #0b6b43; font-weight: 700; }
.rhms-match { min-height: 1.2em; }
.rhms-match.rhms-ok { color: #0b6b43; font-weight: 700; }
.rhms-check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.rhms-check input { width: 24px; height: 24px; margin-top: 2px; flex: none; }
.rhms-check label { min-height: 28px; }
.rhms-fieldset { border: 1.5px solid #c6d1e0; border-radius: 12px; padding: 10px 12px; margin: 0; }
.rhms-days { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.rhms-day { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 12px; border: 1.5px solid #8393ab; border-radius: 22px; background: #fff; cursor: pointer; }
.rhms-day input { width: 20px; height: 20px; }
.rhms-details { border: 1px solid #dfe7f1; border-radius: 12px; padding: 8px 12px; }
.rhms-details summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 700; overflow-wrap: anywhere; }

/* buttons */
.rhms-btn { min-height: 48px; min-width: 48px; padding: 10px 18px; border-radius: 12px; border: 2px solid transparent; font: inherit; font-weight: 800; cursor: pointer; }
.rhms-btn-block { width: 100%; }
.rhms-btn-primary { background: #c4122f; color: #fff; }
.rhms-btn-primary:hover:not(:disabled) { background: #a50f27; }
.rhms-btn-secondary { background: #fff; color: #0a2c59; border-color: #0a2c59; }
.rhms-btn-link, .rhms-linkbtn { background: transparent; color: #0b4f9e; text-decoration: underline; border: 0; padding: 8px 6px; min-height: 44px; font: inherit; font-weight: 700; cursor: pointer; }
.rhms-btn:disabled { opacity: .55; cursor: not-allowed; }
.rhms-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

/* messages */
.rhms-alert { margin: 8px 0; padding: 10px 12px; border-radius: 10px; font-size: 15px; border: 1.5px solid; }
.rhms-alert-label { font-weight: 800; }
.rhms-alert-error { background: #fdecef; border-color: #b00020; color: #6e0014; }
.rhms-alert-success { background: #e8f6ee; border-color: #0b6b43; color: #07422a; }
.rhms-alert-info { background: #eaf2fc; border-color: #1473e6; color: #0a2c59; }
.rhms-status:empty { display: none; }

/* steps */
.rhms-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 4px; padding: 0; margin: 0 0 16px; }
.rhms-step { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 20px; background: #eef2f8; color: #4a5a72; font-size: 14px; }
.rhms-step-mark { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 50%; background: #c6d1e0; color: #10213d; font-weight: 800; font-size: 13px; }
.rhms-step-done { background: #e8f6ee; color: #07422a; } .rhms-step-done .rhms-step-mark { background: #0b6b43; color: #fff; }
.rhms-step-current { background: #0a2c59; color: #fff; font-weight: 800; } .rhms-step-current .rhms-step-mark { background: #fff; color: #0a2c59; }

/* hub */
.rhms-hub { display: flex; flex-direction: column; gap: 14px; }
.rhms-hub-head .rhms-h1 { margin-bottom: 2px; }
.rhms-org-line { margin: 0; color: #4a5a72; overflow-wrap: anywhere; }
.rhms-statuscard, .rhms-block { background: #fff; border: 1px solid #dfe7f1; border-radius: 16px; padding: 16px; box-shadow: 0 6px 18px rgba(13,39,77,.06); }
.rhms-statuscard-action { border-left: 6px solid #c4122f; } .rhms-statuscard-wait { border-left: 6px solid #0a2c59; }
.rhms-statuscard .rhms-h2 { margin-top: 8px; font-size: 22px; }
.rhms-badge { display: inline-block; padding: 4px 10px; border-radius: 14px; font-size: 13px; font-weight: 800; border: 1.5px solid; }
.rhms-badge-action { background: #fdecef; color: #7a0016; border-color: #c4122f; } .rhms-badge-wait { background: #eaf2fc; color: #0a2c59; border-color: #0a2c59; } .rhms-badge-done { background: #e8f6ee; color: #07422a; border-color: #0b6b43; }
.rhms-kvs { margin: 10px 0; display: grid; gap: 8px; }
.rhms-kv dt { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #4a5a72; }
.rhms-kv dd { margin: 2px 0 0; font-size: 16px; }
.rhms-confirmation { margin: 12px 0; padding: 12px 14px; background: #e8f6ee; border: 1.5px solid #0b6b43; border-radius: 10px; color: #07422a; font-weight: 600; }
.rhms-updated { margin: 8px 0 0; font-size: 14px; color: #4a5a72; }
.rhms-trial { padding: 10px 14px; background: #fff7e6; border: 1.5px solid #b26a00; border-radius: 10px; color: #5a3500; font-weight: 700; }
.rhms-list { margin: 8px 0; padding-left: 22px; } .rhms-list li { margin: 4px 0; }
.rhms-info { margin: 14px 0; padding: 12px 14px; background: #f6f8fb; border-radius: 12px; }
.rhms-info .rhms-h2 { margin-top: 0; }

/* upload */
.rhms-drop { border: 2px dashed #8393ab; border-radius: 14px; padding: 18px 14px; text-align: center; background: #fbfcfe; }
.rhms-drop-over { border-color: #1473e6; background: #eaf2fc; }
.rhms-drop-title { margin: 0 0 4px; font-weight: 800; }
.rhms-upload-summary { margin: 10px 0 4px; font-weight: 700; }
.rhms-files { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.rhms-file { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid #dfe7f1; border-radius: 12px; background: #fff; }
.rhms-file-main { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; }
.rhms-file-name { font-weight: 700; overflow-wrap: anywhere; min-width: 0; }
.rhms-file-size { color: #4a5a72; font-size: 14px; }
.rhms-file-status { font-size: 14px; font-weight: 700; }
.rhms-file-received .rhms-file-status { color: #0b6b43; } .rhms-file-failed .rhms-file-status, .rhms-file-pending_remote .rhms-file-status { color: #9a001b; }
.rhms-file-error { color: #9a001b; font-size: 14px; font-weight: 600; }
.rhms-file-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rhms-bar { height: 10px; border-radius: 6px; background: #dfe7f1; overflow: hidden; margin-top: 4px; }
.rhms-bar-fill { height: 100%; background: #0a2c59; transition: width .2s; width: 0; }
.rhms-overall { margin: 10px 0; } .rhms-overall-label { font-size: 14px; font-weight: 700; }
.rhms-rejected ul { margin: 6px 0 0; padding-left: 20px; }
.rhms-confirm { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }

/* review */
.rhms-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0; }
.rhms-stat { padding: 12px 8px; background: #f6f8fb; border-radius: 12px; text-align: center; display: flex; flex-direction: column; font-size: 14px; }
.rhms-stat-n { font-size: 28px; color: #0a2c59; line-height: 1.1; }
.rhms-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 15px; }
.rhms-table th, .rhms-table td { padding: 8px 6px; border-bottom: 1px solid #dfe7f1; text-align: left; overflow-wrap: anywhere; }
.rhms-teamnote { margin: 10px 0; padding: 10px 12px; background: #eef4fb; border-radius: 10px; }
.rhms-cr { padding: 10px 0; border-top: 1px solid #dfe7f1; }
.rhms-cr-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.rhms-comments { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.rhms-comment { padding: 8px 10px; background: #f6f8fb; border-radius: 10px; overflow-wrap: anywhere; }
.rhms-comment-head { font-size: 13px; color: #4a5a72; }

/* dialog */
.rhms-shade { position: fixed; inset: 0; z-index: 10100; background: rgba(7,23,44,.55); display: flex; align-items: flex-start; justify-content: center; padding: 16px; overflow-y: auto; }
.rhms-dialog { background: #fff; width: min(560px, 100%); border-radius: 18px; padding: 20px 18px; margin-top: 4vh; box-shadow: 0 20px 60px rgba(0,0,0,.35); color: #10213d; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.rhms-dialog-title { margin: 0 0 10px; font-size: 20px; color: #0a2c59; }
.rhms-dialog *, .rhms-dialog *::before { box-sizing: border-box; }

/* spinner */
.rhms-spin { width: 34px; height: 34px; border: 3px solid #edf0f3; border-top-color: #c4122f; border-radius: 50%; margin: 0 auto 14px; animation: rhmsSpin .8s linear infinite; }
@keyframes rhmsSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rhms-spin { animation: none; } .rhms-bar-fill { transition: none; } }

/* staff two-factor screens (scripts/rh-staff-mfa.js) */
.rhms-mfa-steps { margin: 8px 0 12px; padding-left: 22px; display: grid; gap: 6px; }
.rhms-mfa-qrwrap { display: flex; justify-content: center; margin: 8px 0 14px; }
.rhms-qr { display: block; width: 200px; max-width: 100%; height: auto; background: #fff; padding: 8px; border: 1px solid #dfe7f1; border-radius: 12px; }
.rhms-secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .06em; overflow-wrap: anywhere; }
.rhms-mfa-code { font-size: 24px; letter-spacing: .3em; text-align: center; min-height: 52px; }
.rhms-mfa-status { min-height: 1.5em; margin-top: 8px; color: #4a5a72; }

/* review round C: file-handling notice, add information, details, closed setup */
.rhms-handling { border: 1px solid #dfe7f1; }
.rhms-handling .rhms-check { margin-top: 10px; }
.rhms-drop-disabled { opacity: .55; border-color: #b9c4d4; background: #f3f5f8; }
.rhms-drop-disabled .rhms-btn { cursor: not-allowed; }
.rhms-cr-list { margin-top: 14px; }
.rhms-contact a { overflow-wrap: anywhere; }
