/* ---- SMR brand typography (Montserrat) -------------------------------- */
:root {
    --mud-typography-default-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mud-typography-h1-family: 'Montserrat', sans-serif;
    --mud-typography-h2-family: 'Montserrat', sans-serif;
    --mud-typography-h3-family: 'Montserrat', sans-serif;
    --mud-typography-h4-family: 'Montserrat', sans-serif;
    --mud-typography-h5-family: 'Montserrat', sans-serif;
    --mud-typography-h6-family: 'Montserrat', sans-serif;
    --mud-typography-subtitle1-family: 'Montserrat', sans-serif;
    --mud-typography-subtitle2-family: 'Montserrat', sans-serif;
    --mud-typography-body1-family: 'Montserrat', sans-serif;
    --mud-typography-body2-family: 'Montserrat', sans-serif;
    --mud-typography-button-family: 'Montserrat', sans-serif;
    --mud-typography-caption-family: 'Montserrat', sans-serif;
    --mud-typography-overline-family: 'Montserrat', sans-serif;

    --smr-cyan: #04C0F0;
    --smr-teal: #00688F;
    --smr-navy: #00415D;
    --smr-gray-light: #D1D3D4;
    --smr-gray: #6D6E71;
}

html, body {
    font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* MudBlazor reads font-family from CSS vars above; headings stay bold per brand. */
.mud-typography-h4,
.mud-typography-h5,
.mud-typography-h6 {
    font-weight: 700;
    letter-spacing: .2px;
}

/* ---- App bar / logo --------------------------------------------------- */
.smr-appbar-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.smr-appbar-tag {
    color: rgba(255, 255, 255, .85);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.smr-appbar-phone {
    display: inline-flex;
    align-items: center;
    color: #ffffff !important;
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
}

.smr-appbar-phone:hover {
    text-decoration: underline;
}

/* THE page width. This class is the single source of truth (the MudContainer is
   MaxWidth.False) — it was 720px, which crushed Step 3's panels to ~400px and left
   most of a desktop monitor empty. 1500px = ~960px card + ~480px contents sidebar.
   Still capped on purpose: unbounded line lengths hurt form readability. */
.smr-main {
    max-width: 1500px;
    margin-inline: auto;
}

/* ---- Cards / steps ---------------------------------------------------- */
.smr-card {
    border: 1px solid #E5E9ED;   /* hairline on the near-white canvas (C pass) */
}

/* ---- Questionnaire (Step 3) ------------------------------------------ */
/* Section intro carries the ONE question for its checklist rows (2026-07-26)
   — it IS the ask, so it reads like one: larger + bold. */
.smr-intro {
    color: var(--smr-navy);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.5;
}

.smr-question {
    border-left: 2px solid transparent;
}

/* nested (revealed) questions get a subtle guide line */
.smr-question[style*="padding-left"] {
    border-left: 2px solid var(--smr-gray-light);
}

/* ---- Explicit Yes/No condition rows (sections with explicitYesNo in Umbraco)
   Clinical-minimal pass (Charlie 2026-07-26, "C sized for patients"): hairline
   row dividers, ≥44px touch targets, 15px labels (16px on phones). */
.smr-explicit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 0;
    min-height: 44px;
    border-bottom: 1px solid #ECEFF2;
}
.smr-explicit-label { flex: 1 1 220px; font-size: .95rem; }
.smr-explicit-toggle .mud-toggle-item { padding: 7px 18px; min-height: 40px; }

/* Inside the amber "you are here" panel the divider is noise. */
.smr-condition-open .smr-explicit-row { border-bottom: none; }

/* Tighter vertical rhythm between checklist rows (C is deliberately dense). */
.smr-question.mb-4 { margin-bottom: .55rem; }

/* Patients on phones: bigger text, full 44px targets. */
@media (max-width: 600px) {
    .smr-explicit-label { font-size: 1rem; }
    .smr-explicit-toggle .mud-toggle-item { min-height: 44px; }
}

/* ---- Identity bar (whose session is this — every page once the name is known) */
.smr-identity-bar {
    text-align: center;
    font-size: .82rem;
    color: var(--smr-gray);
    background: rgba(0, 104, 143, .06);
    border: 1px solid var(--smr-gray-light);
    border-radius: 8px;
    padding: 6px 14px;
    margin: 4px auto 10px;
    width: fit-content;
    max-width: 100%;
}
.smr-identity-bar b { color: var(--smr-navy); }

/* ---- Locked-after-signing row (ConsentStep) */
.smr-lock-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: .82rem;
    color: var(--smr-gray);
    background: rgba(0, 65, 93, .05);
    border-radius: 8px;
    padding: 6px 12px;
}

/* ---- Consent signature block (ConsentStep; capture happens in SignatureDialog) */
.smr-signblock {
    border: 1.5px dashed var(--smr-gray-light);
    border-radius: 12px;
    background: #fff;
    padding: 18px 20px;
}

.smr-signblock-empty { text-align: center; padding: 26px 20px; }

.smr-signblock-img {
    display: block;
    max-width: min(420px, 100%);
    max-height: 120px;
    margin: 0 auto;
}

.smr-signblock-line {
    border-bottom: 1.5px solid #334155;
    max-width: min(420px, 100%);
    margin: 0 auto;
}

.smr-signblock-name {
    margin-top: 7px;
    text-align: center;
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .08em;
    color: var(--smr-navy);
}

.smr-signblock-sub {
    text-align: center;
    font-size: .8rem;   /* was .68rem — too small for the audience (2026-07-02) */
    color: var(--smr-gray);
    margin-top: 2px;
}

.smr-signblock-signed { text-align: center; }

/* ---- Collapsible subsection headers (Step 3) --------------------------
   STICKY (2026-07-26): on the single long Health History page the current
   group's header pins to the top while you scroll inside it — the "where am
   I" anchor. Solid background so questions don't scroll through it. */
.smr-subsection-header {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    border-radius: 0;
    padding: 8px 6px 8px 10px;
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fff;
    box-shadow: 0 1px 0 #E5E9ED;
    border-left: 3px solid var(--smr-teal);
}
.smr-subsection-header:hover { background: rgba(4, 192, 240, .07); }

/* Clinical small-caps group titles (C pass 2026-07-26). */
.smr-subsection-header .mud-typography {
    text-transform: uppercase;
    letter-spacing: .05em;
    font-size: .85rem;
}

.smr-subsection-summary {
    margin: 0 0 8px 28px;     /* aligns under the title, past the chevron */
    font-size: .8rem;
    color: var(--smr-gray);
}

/* ---- Section subheadings (step forms) -------------------------------- */
.smr-section {
    font-weight: 700;
    color: var(--smr-navy);
    margin: 22px 0 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--smr-cyan);
}

.smr-req {
    color: var(--smr-teal);
    font-weight: 700;
}

/* Field label row with an inline red "incomplete" flag */
.smr-flabel {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--smr-navy);
    margin-bottom: 5px;
}

.smr-flabel .mud-icon-root {
    font-size: 1.1rem;
}

.smr-optional {
    color: var(--smr-gray);
    font-weight: 400;
    font-size: .8rem;
}

/* ---- Consent document scroller --------------------------------------- */
.smr-consent-scroll {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--smr-gray-light);
    border-radius: 12px;
    padding: 18px 20px;
    background: #fff;
    line-height: 1.55;
}

.smr-consent-scroll h1,
.smr-consent-scroll h2,
.smr-consent-scroll h3 {
    color: var(--smr-navy);
}

/* Space between consent paragraphs — MudBlazor's reset zeroes <p> margins,
   which ran the Purpose/HIPAA items together as a wall of text. */
.smr-consent-scroll p {
    margin: 0 0 0.9em 0;
}
.smr-consent-scroll p:last-child {
    margin-bottom: 0;
}

/* ---- Step 3 medication summary table ---- */
.smr-medsummary thead th {
    background: var(--smr-navy);
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
}
.smr-medsummary td { vertical-align: top; }
.smr-medsummary tbody tr:hover { background: rgba(4, 192, 240, .06); }

/* ---- Active condition block: visual offset while its details are open ----
   The amber wash is the "you are here" highlighter (Charlie 2026-06-12,
   re-affirmed 2026-07-26 after a brief removal) — combined with the tidier
   2026-07-26 inner layout (year-first date row, compact toggles). */
.smr-condition-open {
    border-left: 3px solid var(--smr-cyan);
    background: #FFFBEC;   /* softened for the near-white canvas (C pass) */
    border-radius: 0 10px 10px 0;
    padding: 10px 14px 14px 16px;
    margin: 12px 0 20px;
}

/* ---- Completed-condition summary table (collapsed state) ---- */
.smr-condsummary {
    border-left: 3px solid var(--smr-gray-light);
    padding: 4px 12px 6px;
    margin: 4px 0 8px;
}

.smr-condsummary-table {
    border-collapse: collapse;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-top: 2px;
}
.smr-condsummary-table td {
    vertical-align: top;           /* label aligns with the FIRST medication, not the middle */
    padding: 1px 0;
}
.smr-condsummary-table td:first-child {
    color: var(--smr-gray);
    font-weight: 600;
    white-space: nowrap;
    padding-right: 18px;           /* gap between label column and values */
}
.smr-condsummary-table td:last-child > div {
    padding-left: 8px;             /* indent each medication name under the label */
}

/* ---- Custom Blazor reconnection modal (see App.razor + js/reconnect.js) ---- */
#components-reconnect-modal { display: none; }
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex; position: fixed; inset: 0; z-index: 12000;
    align-items: center; justify-content: center;
    background: rgba(0, 65, 93, 0.45);
}
.smr-reconnect-card {
    background: #fff; border-radius: 8px; padding: 24px 28px; max-width: 360px;
    text-align: center; box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
    font-family: Montserrat, Arial, sans-serif; color: #00415D;
}
/* While retrying, show the spinner; once failed/rejected, show the Reload card. */
#components-reconnect-modal .smr-reconnect-lost { display: none; }
#components-reconnect-modal.components-reconnect-failed .smr-reconnect-trying,
#components-reconnect-modal.components-reconnect-rejected .smr-reconnect-trying { display: none; }
#components-reconnect-modal.components-reconnect-failed .smr-reconnect-lost,
#components-reconnect-modal.components-reconnect-rejected .smr-reconnect-lost { display: block; }
.smr-reconnect-spinner {
    width: 34px; height: 34px; border: 3px solid #D1D3D4; border-top-color: #04C0F0;
    border-radius: 50%; margin: 0 auto 12px; animation: smrspin 1s linear infinite;
}
@keyframes smrspin { to { transform: rotate(360deg); } }
.smr-reconnect-btn {
    margin-top: 12px; background: #00688F; color: #fff; border: none; border-radius: 6px;
    padding: 10px 18px; font-size: 14px; cursor: pointer;
}
.smr-reconnect-btn:hover { background: #00415D; }

/* Hide the spinner once reconnection has given up (Reload button stays visible). */
#components-reconnect-modal.components-reconnect-failed .smr-reconnect-spinner,
#components-reconnect-modal.components-reconnect-rejected .smr-reconnect-spinner { display: none; }

/* ============================================================================
   Signature dialog (Syncfusion SfDialog, CssClass="smr-sigdlg") — DocuSign-style.
   SfDialog portals its DOM to <body>, so these MUST be global (not scoped css).
   Reconstructed from Documentation/signature-mockup.html + SignatureDialog.razor.
   ============================================================================ */

/* ---- Dialog chrome (override Syncfusion EJ2 parts) ---- */
.smr-sigdlg.e-dialog {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 40, 60, .25);
}
.smr-sigdlg .e-dlg-header-content {
    background: #004360 !important;
    padding: 14px 20px !important;
    border-radius: 0 !important;
    border-bottom: none !important;
}
.smr-sigdlg .e-dlg-header,
.smr-sigdlg .e-dlg-header * {
    color: #fff !important;
    font-weight: 600;
    font-size: 1rem;
}
.smr-sigdlg .e-dlg-header-content .e-btn.e-dlg-closeicon-btn { background: transparent !important; box-shadow: none !important; }
.smr-sigdlg .e-dlg-header-content .e-icon-dlg-close { color: #fff !important; opacity: .8; }
.smr-sigdlg .e-dlg-content { padding: 20px !important; font-family: Montserrat, Arial, sans-serif; }
.smr-sigdlg .e-footer-content {
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    padding: 14px 20px !important;
    display: flex; justify-content: flex-end; gap: 10px;
}

/* ---- Body content ---- */
.smr-sigdlg-prompt { font-size: .85rem; color: #475569; line-height: 1.45; margin: 0 0 16px; }
.smr-sigdlg-label {
    display: block; font-size: .78rem; font-weight: 600; color: #004360;
    text-transform: uppercase; letter-spacing: .04em; margin: 0 0 6px;
}
.smr-sigdlg .e-input-group { margin-bottom: 4px; }
.smr-sigdlg-mismatch,
.smr-sigdlg-error { color: #C0392B; font-size: .78rem; margin-top: 6px; }

/* ---- Draw / Type segmented toggle (SfButton + ToggleCss "smr-sigdlg-mode active") ---- */
.smr-sigdlg-toggle {
    display: inline-flex; margin: 16px 0 12px;
    border: 1.5px solid #cbd5e1; border-radius: 8px; overflow: hidden;
}
.smr-sigdlg-toggle .e-btn.smr-sigdlg-mode {
    border: none !important; border-radius: 0 !important; box-shadow: none !important;
    background: #fff !important; color: #64748b !important;
    padding: 7px 22px; font-weight: 500; text-transform: none;
}
.smr-sigdlg-toggle .e-btn.smr-sigdlg-mode.active {
    background: #004360 !important; color: #fff !important;
}

/* ---- Signature canvas (SfSignature) + hint ---- */
.smr-sigdlg-canvas-wrap {
    position: relative; margin-top: 4px;
    touch-action: none; -webkit-user-select: none; user-select: none;
}
.smr-sigdlg-canvas-wrap .e-signature,
.smr-sigdlg-canvas-wrap canvas {
    display: block; width: 100% !important; height: 170px !important;
    background: #fafbfc !important; border-radius: 8px 8px 0 0; cursor: crosshair;
}
.smr-sigdlg-hint {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: #b9c4cf; font-size: .85rem; pointer-events: none;
}

/* ---- Signature line + name echo ---- */
.smr-sigdlg-line { border-bottom: 1.5px solid #334155; position: relative; height: 1px; }
.smr-sigdlg-x { position: absolute; left: 4px; bottom: 2px; font-size: .9rem; color: #94a3b8; }
.smr-sigdlg-echo {
    margin-top: 7px; font-size: .82rem; font-weight: 600; letter-spacing: .08em;
    color: #004360; min-height: 1.1em; text-transform: uppercase;
}
.smr-sigdlg-subtext { font-size: .8rem; color: #64748b; margin-top: 2px; }  /* was .68rem/#94a3b8 — too small + too faint (2026-07-02) */

/* ---- Clear / Undo ---- */
.smr-sigdlg-actions { display: flex; gap: 8px; margin-top: 14px; }
.smr-sigdlg-actions .e-btn {
    border: 1.5px solid #cbd5e1 !important; background: #fff !important; color: #475569 !important;
    border-radius: 7px !important; box-shadow: none !important;
    padding: 6px 16px; font-size: .8rem; text-transform: none;
}

/* ---- Footer Cancel / Accept ---- */
.smr-sigdlg .e-btn.smr-sigdlg-cancel {
    background: #fff !important; border: 1.5px solid #cbd5e1 !important; color: #475569 !important;
    border-radius: 8px !important; box-shadow: none !important; padding: 9px 22px; font-weight: 600; text-transform: none;
}
.smr-sigdlg .e-btn.smr-sigdlg-accept {
    background: #20C0F2 !important; color: #00293c !important; border: none !important;
    border-radius: 8px !important; box-shadow: none !important; padding: 9px 22px; font-weight: 600; text-transform: none;
}
.smr-sigdlg .e-btn.smr-sigdlg-accept:disabled,
.smr-sigdlg .e-btn.smr-sigdlg-accept.e-disabled {
    background: #cbd5e1 !important; color: #fff !important; cursor: not-allowed;
}

/* ---- Component wrapper spacing (reconstructed — minor layout hooks) ---- */
.smr-medpicker,
.smr-doctorpicker { margin-top: 8px; }
.smr-partialdate { margin-top: 4px; }
.smr-qsection { margin-bottom: 10px; }

/* ---- Review step summary tables (reconstructed) ---- */
.smr-reviewtable td { padding: 4px 8px; vertical-align: top; font-size: .9rem; }
.smr-reviewtable td:first-child { color: var(--smr-gray); width: 38%; white-space: nowrap; }

/* ---- Instructions step (2026-07-02) ------------------------------------
   Larger, bolder, scannable copy for a predominantly older audience: bump the
   base size ~7%, loosen line height, heavier default weight, and space the
   key-point bullets so each bold lead-in reads as its own idea. Applies to the
   MudAlert body too, which MudBlazor otherwise renders at .875rem. */
.smr-instructions .mud-typography-body1,
.smr-instructions ul,
.smr-instructions .mud-alert-message { font-size: 1.07rem; line-height: 1.6; font-weight: 500; }
.smr-instructions b, .smr-instructions strong { font-weight: 700; }
.smr-instructions ul { padding-left: 1.35rem; }
.smr-instructions li { margin-bottom: 10px; }
.smr-keypoints li { margin-bottom: 14px; }

/* ---- Missing-items dialog (2026-07-02) ---- */
.smr-missing-list { padding-left: 1.35rem; margin: 0; font-size: 1rem; line-height: 1.55; }
.smr-missing-list li { margin-bottom: 8px; }

/* ---- Instructions "come back later" callout (2026-07-02) ----
   Warm, inviting box — deliberately not an alert color. Soft teal tint + teal left
   accent; sits directly above the button row. */
.smr-comeback-callout {
    display: flex; gap: 12px; align-items: flex-start;
    background: rgba(0, 104, 143, 0.06);
    border-left: 4px solid var(--smr-teal);
    border-radius: 8px;
    padding: 14px 16px;
    margin-top: 4px;
}
