:root {
    --rcsd-navy: #12324a;
    --rcsd-blue: #0b6fa4;
    --rcsd-blue-dark: #07577f;
    --rcsd-surface: #f4f7f9;
    --rcsd-border: #c8d4dc;
    --rcsd-danger: #a32626;
    --rcsd-success: #176b43;
}

.rcsd-staff-page { max-width: 1180px; margin: 0 auto; padding: 1.5rem; color: var(--rcsd-navy); }
.rcsd-staff-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.5rem; }
.rcsd-staff-header h1 { font-size: clamp(2rem, 4vw, 3rem); margin: .15rem 0 .35rem; }
.rcsd-eyebrow { color: var(--rcsd-blue); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; margin: 0; font-size: .82rem; }
.rcsd-staff-filters { display: grid; grid-template-columns: minmax(260px, 2fr) minmax(220px, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.rcsd-staff-filters label { font-weight: 700; }
.rcsd-staff-filters input, .rcsd-staff-filters select { width: 100%; min-height: 50px; border: 1px solid var(--rcsd-border); border-radius: 10px; padding: .75rem; font-size: 1rem; background: white; }
.rcsd-appointment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.rcsd-appointment-card { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; min-height: 128px; text-align: left; padding: 1rem; border: 2px solid var(--rcsd-border); border-radius: 14px; background: #fff; color: var(--rcsd-navy); cursor: pointer; }
.rcsd-appointment-card:hover, .rcsd-appointment-card:focus-visible, .rcsd-appointment-card.is-selected { border-color: var(--rcsd-blue); box-shadow: 0 0 0 3px rgba(11,111,164,.15); }
.rcsd-appointment-time { grid-row: 1 / 4; font-size: 1.45rem; font-weight: 800; color: var(--rcsd-blue); }
.rcsd-confirm-card, .rcsd-recent { margin-top: 1.5rem; padding: 1.25rem; border-radius: 16px; background: var(--rcsd-surface); border: 1px solid var(--rcsd-border); }
.rcsd-confirm-card dl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.rcsd-confirm-card dl div { display: grid; gap: .2rem; }
.rcsd-confirm-card dt { color: #526875; font-size: .86rem; }
.rcsd-confirm-card dd { margin: 0; font-weight: 800; }
.rcsd-button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .72rem 1.2rem; border-radius: 10px; border: 2px solid transparent; font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; }
.rcsd-button:disabled { opacity: .55; cursor: not-allowed; }
.rcsd-button--primary { color: #fff; background: var(--rcsd-blue); }
.rcsd-button--primary:hover:not(:disabled), .rcsd-button--primary:focus-visible { background: var(--rcsd-blue-dark); }
.rcsd-button--secondary { color: var(--rcsd-navy); background: #fff; border-color: var(--rcsd-border); }
.rcsd-button--large { min-height: 58px; font-size: 1.08rem; }
.rcsd-state { min-height: 160px; display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 2rem; border-radius: 14px; background: var(--rcsd-surface); }
.rcsd-state--error, .rcsd-inline-error, .rcsd-patient-alert { color: var(--rcsd-danger); }
.rcsd-recent-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; background: white; border-radius: 10px; color: inherit; text-decoration: none; margin-top: .65rem; }
.rcsd-recent-row a { color: inherit; text-decoration: none; min-width: 0; }
.rcsd-recent-row a span { display: grid; }
.rcsd-recent-row small { color: #526875; }
.rcsd-recent-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.rcsd-status { padding: .4rem .7rem; background: #e1eef5; border-radius: 999px; font-weight: 800; white-space: nowrap; }
.rcsd-status--large { font-size: 1rem; }
.rcsd-back-link { color: var(--rcsd-blue); font-weight: 700; }
.rcsd-artifact-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1rem; margin: 1.5rem 0; }
.rcsd-artifact-card { border: 1px solid var(--rcsd-border); border-radius: 14px; padding: 1.2rem; background: #fff; }
.rcsd-artifact-card h2 { font-size: 1.15rem; }
.rcsd-artifact-card .rcsd-card-actions { justify-content: flex-start; margin-top: .75rem; }
.rcsd-card-dialog { position: fixed; inset: 0; z-index: 12000; display: grid; place-items: center; padding: 1.5rem; }
.rcsd-card-dialog__backdrop { position: absolute; inset: 0; background: rgba(15, 23, 32, .55); }
.rcsd-card-dialog__panel { position: relative; z-index: 1; width: min(920px, 100%); max-height: calc(100dvh - 3rem); overflow: auto; background: #fff; border-radius: 16px; padding: 1.2rem 1.3rem 1.4rem; box-shadow: 0 16px 48px rgba(15, 23, 32, .28); }
.rcsd-card-dialog__header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.rcsd-card-dialog__header h2 { margin: 0; font-size: 1.25rem; }
.rcsd-card-dialog__image { display: block; width: 100%; height: auto; max-height: min(70dvh, 720px); object-fit: contain; background: #111; border-radius: 12px; margin-bottom: .8rem; }

.rcsd-patient-layout { position: fixed; inset: 0; z-index: 10000; height: 100dvh; overflow: hidden; background: var(--rcsd-surface); color: var(--rcsd-navy); }
.rcsd-patient-shell { height: 100dvh; overflow: hidden; display: grid; grid-template-rows: auto minmax(0,1fr) auto; font-size: clamp(17px, 2.1vw, 22px); }
.rcsd-patient-header { padding: max(.8rem, env(safe-area-inset-top)) clamp(1rem, 4vw, 3rem) .7rem; background: #fff; border-bottom: 1px solid var(--rcsd-border); }
.rcsd-progress-copy { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; font-size: .84em; }
.rcsd-progress { height: 8px; background: #dce6ec; border-radius: 8px; overflow: hidden; margin-top: .6rem; }
.rcsd-progress span { display: block; height: 100%; background: var(--rcsd-blue); transition: width .25s ease; }
.rcsd-patient-content { min-height: 0; overflow: hidden; display: grid; place-items: center; padding: clamp(.8rem, 2vw, 1.5rem) clamp(1rem, 4vw, 3rem); }
.rcsd-patient-content > * { width: min(100%, 1080px); max-height: 100%; }
.rcsd-patient-footer { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem clamp(1rem, 4vw, 3rem) max(.8rem, env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--rcsd-border); }
.rcsd-patient-footer .rcsd-button { min-width: min(240px, 42vw); }
.rcsd-kiosk-hint { margin: 0 0 1.25rem; padding: .85rem 1rem; border-radius: 12px; background: #e8f4fa; color: var(--rcsd-navy); }
.rcsd-kiosk-hint a { font-weight: 800; color: var(--rcsd-blue-dark); }
.rcsd-kiosk-wait { text-align: center; max-width: 720px; margin: auto; }
.rcsd-kiosk-wait h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin: .35rem 0 .8rem; }
.rcsd-welcome { text-align: center; max-width: 850px !important; }
.rcsd-welcome h1, .rcsd-sign-step h1, .rcsd-card-capture h1, .rcsd-review h1, .rcsd-submit-step h1 { font-size: clamp(1.65rem, 4vw, 2.8rem); margin: .25rem 0 .7rem; }
.rcsd-callout { padding: 1rem; border-left: 5px solid var(--rcsd-blue); background: #fff; border-radius: 8px; }
.rcsd-document-reader { height: 100%; min-height: 0; width: 100%; display: grid; grid-template-rows: minmax(0,1fr) auto; gap: .45rem; }
.rcsd-document-stage { min-height: 0; height: 100%; width: 100%; display: grid; place-items: center; container-type: size; }
.rcsd-document-frame {
    position: relative; container-type: size; aspect-ratio: 612 / 792;
    width: min(100cqw, calc(100cqh * 612 / 792)); height: auto;
    line-height: 0; background: #fff; box-shadow: 0 2px 15px rgba(18,50,74,.15);
}
.rcsd-document-frame img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.rcsd-form-overlay { position: absolute; z-index: 1; box-sizing: border-box; font-family: Helvetica, Arial, sans-serif; color: #111; }
.rcsd-form-overlay--name, .rcsd-form-overlay--date {
    display: flex; align-items: center; padding: 0 .4em; background: #fff; overflow: hidden;
    font-size: clamp(.62rem, 1.45cqw, .95rem); font-weight: 700; pointer-events: none; white-space: nowrap;
}
.rcsd-form-overlay--dentist {
    display: flex; flex-direction: column; justify-content: center; padding: 0 .12em; background: #fff;
    overflow: hidden; font-size: clamp(.5rem, 1.55cqw, .78rem); font-weight: 700;
    pointer-events: none; line-height: 1.08;
}
.rcsd-form-overlay--dentist span { display: block; white-space: nowrap; }
.rcsd-form-overlay--check {
    z-index: 3; border: 0; padding: 0; margin: 0; border-radius: 50%;
    appearance: none; -webkit-appearance: none; min-width: 16px; min-height: 16px;
    width: 3.2cqw; height: 3.2cqw; transform: translate(-50%, -50%);
    display: grid; place-items: center; background: transparent; cursor: pointer;
    overflow: visible; line-height: 0; color: #111;
}
.rcsd-form-overlay--check::before {
    content: ""; position: absolute; inset: 6%; border-radius: 50%;
    border: 2px solid var(--rcsd-blue); background: transparent; box-shadow: none; pointer-events: none;
}
.rcsd-form-overlay--check::after {
    content: ""; position: absolute; inset: -14px;
}
.rcsd-form-overlay--check.is-checked { background: #fff; }
.rcsd-form-overlay--check.is-checked::before { display: none; }
.rcsd-form-check-mark { display: none; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.rcsd-form-overlay--check.is-checked .rcsd-form-check-mark { display: block; }
.rcsd-form-check-mark line { stroke: #111; stroke-width: 3.1; stroke-linecap: square; }
.rcsd-form-overlay--signature { z-index: 2; pointer-events: auto; }
.rcsd-form-hint { margin: 0; text-align: center; font-weight: 700; color: var(--rcsd-blue-dark); }
.rcsd-document-frame--tele .rcsd-form-overlay--authorize { left: 10.83%; top: 50.37%; }
.rcsd-document-frame--tele .rcsd-form-overlay--revoke { left: 10.66%; top: 75.79%; }
.rcsd-document-frame--tele .rcsd-form-overlay--name { left: 13.04%; top: 57.09%; width: 45.92%; height: 3.64%; }
.rcsd-document-frame--tele .rcsd-form-overlay--date { left: 68.18%; top: 64.95%; width: 16.59%; height: 3.64%; }
.rcsd-document-frame--tele .rcsd-form-overlay--signature { left: 13.18%; top: 61.5%; width: 45.3%; height: 7.6%; }
.rcsd-document-frame--delegation .rcsd-form-overlay--authorize { left: 11.09%; top: 52.19%; }
.rcsd-document-frame--delegation .rcsd-form-overlay--revoke { left: 11.09%; top: 77.67%; }
.rcsd-document-frame--delegation .rcsd-form-overlay--dentist { left: 40.73%; top: 49.63%; width: 27.59%; height: 3.35%; }
.rcsd-document-frame--delegation .rcsd-form-overlay--name { left: 13.04%; top: 58.91%; width: 45.92%; height: 3.64%; }
.rcsd-document-frame--delegation .rcsd-form-overlay--date { left: 68.18%; top: 66.77%; width: 16.59%; height: 3.64%; }
.rcsd-document-frame--delegation .rcsd-form-overlay--signature { left: 13.18%; top: 63.2%; width: 45.3%; height: 7.6%; }
.rcsd-document-frame.is-revoke .rcsd-form-overlay--name { left: 13.04%; top: 79.62%; width: 45.92%; height: 3.64%; }
.rcsd-document-frame.is-revoke .rcsd-form-overlay--date { left: 68.49%; top: 87.20%; width: 16.59%; height: 3.64%; }
.rcsd-document-frame.is-revoke .rcsd-form-overlay--signature { left: 12.90%; top: 83.5%; width: 45.3%; height: 7.6%; }
.rcsd-sign-step { text-align: center; height: 100%; display: grid; grid-template-rows: auto auto minmax(0,1fr); }
.rcsd-signature { min-height: 0; display: grid; grid-template-rows: minmax(150px,1fr) auto auto; gap: .55rem; }
.rcsd-signature__canvas { display: block; width: 100%; height: 100%; min-height: 150px; border: 3px solid var(--rcsd-navy); border-radius: 14px; background: #fff; touch-action: none; }
.rcsd-signature.rcsd-signature--on-form { width: 100%; min-height: 0; display: flex; flex-wrap: wrap; justify-content: center; grid-template-rows: none; gap: .55rem; }
.rcsd-signature__canvas.rcsd-signature__canvas--on-form { min-height: 0; border: 2px dashed var(--rcsd-blue); border-radius: 6px; background: rgba(255,255,255,.94); }
.rcsd-signature__actions, .rcsd-card-actions { display: flex; justify-content: center; gap: .8rem; flex-wrap: wrap; }
.rcsd-card-capture { text-align: center; height: 100%; display: flex; min-height: 0; flex-direction: column; align-items: center; }
.rcsd-card-capture h1 { margin-bottom: .2rem; }
.rcsd-card-capture > p { margin: .2rem 0 .55rem; }
.rcsd-camera-stage { position: relative; flex: 1; min-height: 180px; width: min(100%, 900px); overflow: hidden; border-radius: 14px; background: #10212c; margin-bottom: .6rem; }
.rcsd-camera-stage video, .rcsd-camera-stage canvas, .rcsd-camera-stage .rcsd-card-shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.rcsd-card-guide { position: absolute; left: 12%; right: 12%; top: 16%; bottom: 16%; border: 4px solid rgba(255,255,255,.9); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.22); pointer-events: none; }
.rcsd-card-manual { touch-action: none; cursor: crosshair; }
.rcsd-quality-ok { color: var(--rcsd-success); font-weight: 800; }
.rcsd-review { max-width: 900px !important; }
.rcsd-review article { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; padding: 1rem; border: 1px solid var(--rcsd-border); border-radius: 12px; background: #fff; margin: .7rem 0; }
.rcsd-review article p { margin: .15rem 0 0; }
.rcsd-review article button { min-width: 84px; min-height: 44px; border: 0; color: var(--rcsd-blue); background: transparent; font: inherit; font-weight: 800; }
.rcsd-review-check, .rcsd-finished__check, .rcsd-submit-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: #dff3e9; color: var(--rcsd-success); font-weight: 900; }
.rcsd-submit-step, .rcsd-finished { text-align: center; max-width: 780px !important; margin: auto; }
.rcsd-submit-icon, .rcsd-finished__check { width: 76px; height: 76px; margin: 0 auto 1rem; font-size: 2.2rem; }
.rcsd-finished { align-self: center; grid-row: 1 / -1; padding: 2rem; }
.rcsd-finished h1 { font-size: clamp(1.8rem, 4vw, 3rem); }
.rcsd-staff-return { margin-top: 4rem; min-height: 44px; padding: .7rem 1rem; border: 0; background: transparent; color: #657984; font: inherit; font-size: .7em; }
.rcsd-patient-state { grid-row: 1 / -1; align-self: center; justify-self: center; text-align: center; padding: 2rem; }
.rcsd-patient-state--error { color: var(--rcsd-navy); }
.rcsd-patient-alert { position: absolute; top: 5.2rem; left: 50%; transform: translateX(-50%); z-index: 5; width: min(90%, 800px); padding: .7rem 1rem; border: 1px solid #e6b6b6; border-radius: 8px; background: #fff5f5; text-align: center; }

@media (orientation: portrait) {
    .rcsd-camera-stage { width: 100%; }
    .rcsd-confirm-card dl { grid-template-columns: repeat(2, 1fr); }
    .rcsd-artifact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .rcsd-staff-filters { grid-template-columns: 1fr; }
    .rcsd-staff-header { flex-direction: column; }
    .rcsd-progress-copy { align-items: flex-start; flex-direction: column; gap: .15rem; }
    .rcsd-review article { grid-template-columns: auto 1fr; }
    .rcsd-review article button { grid-column: 2; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) { .rcsd-progress span { transition: none; } }
