/* ==========================================================================================================
   SHELL-RD-1675 (lane/1675-rdw2-portal; redesign wave 2): the new look for
     1. the SHARED MODAL SHELL (.modal-overlay > .modal: #modalOverlay / App.openModal and every pop-up built on it -- the
        classic pop-ups the new pages still open, the sync screens, the note share / email pop-ups, the portal's pop-ups);
     2. Help: the Help & Support page (#page-help, the Help Center list) and the "?" buttons + article viewer (css/help.css);
     3. Database Cleanup (#page-cleanup), Practice Data Quality Center (#page-pdqc) and "Sync needs attention"
        (#syncRepairPanel, #decisionScreen / #syncDecidePanel, #departedChangesBanner / #departedChangesOverlay);
     4. the Record Resolution Wizard (#page-resolution-wizard) and Offline Diagnostics (#page-debug-offline): LIGHT only
        (support tools: correctness first -- spacing, cards, 16px fields; nothing moves, nothing is hidden).
   Applies only under body.cx-new-look (staff, new look on: js/modules/home-redesign.js) or body.prx-on (portal, new look on).
   STYLE ONLY: no markup, handler, word, order or visibility changes (no display:none on any control, no ::before/::after
   text). The menus (sidebar, phone menu, header, bottom nav) are NOT touched -- owner 2026-11-04 ("I like how the current
   menu is"); tests/journeys/newlookfix1663_menus_browser.cjs keeps proving it.
   --shx-ready: this generation is loaded.
   ========================================================================================================== */
:root { --shx-ready: 1; }

body.cx-new-look, body.prx-on {
    --shx-surface: var(--cx-surface, #ffffff);
    --shx-surface-2: var(--cx-surface-2, #f8faf9);
    --shx-line: var(--cx-border, #dfe5e1);
    --shx-ink: var(--cx-text, #0f172a);
    --shx-ink-2: var(--cx-text-2, #475569);
    --shx-accent: var(--cx-brand, var(--primary-color, #355e3b));
    --shx-accent-ink: var(--cx-brand-ink, #1f3d26);
    --shx-accent-soft: var(--cx-brand-soft, #e7efe8);
    --shx-head: 'Poppins', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --shx-warn-bg: #fff7e6; --shx-warn-line: #f5d38a; --shx-warn-ink: #8a3c0c;
    --shx-bad: #b91c1c; --shx-amber: #b45309; --shx-muted: #64748b;
}
body.prx-on { --shx-accent: var(--primary-color, #355e3b); --shx-accent-ink: color-mix(in srgb, var(--primary-color, #355e3b) 78%, #000); --shx-accent-soft: color-mix(in srgb, var(--primary-color, #355e3b) 10%, #fff); }
[data-theme="dark"] body.cx-new-look, [data-theme="dark"] body.prx-on {
    --shx-surface: var(--cx-surface, #141a17); --shx-surface-2: var(--cx-surface-2, #1a221e); --shx-line: var(--cx-border, #2a3530);
    --shx-ink: var(--cx-text, #f1f5f9); --shx-ink-2: var(--cx-text-2, #cbd5e1);
    --shx-warn-bg: #2a2110; --shx-warn-line: #6b4f12; --shx-warn-ink: #fcd34d; --shx-bad: #fca5a5; --shx-amber: #fcd34d; --shx-muted: #94a3b8;
}

/* ══════════════ 1. the shared modal shell ══════════════ */
body.cx-new-look .modal-overlay, body.prx-on .modal-overlay { background: rgba(15, 23, 42, 0.45); backdrop-filter: none; -webkit-backdrop-filter: none; }
body.cx-new-look .modal-overlay > .modal, body.prx-on .modal-overlay > .modal {
    background: var(--shx-surface) !important; color: var(--shx-ink); border: 1px solid var(--shx-line); border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22); backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
    max-width: min(var(--shx-modal-max, 600px), 100%); box-sizing: border-box; overflow-x: hidden;
}
body.cx-new-look .modal-overlay > .modal *, body.prx-on .modal-overlay > .modal * { box-sizing: border-box; }
body.cx-new-look .modal-header, body.prx-on .modal-header {
    padding: 18px 20px 12px; border-bottom: 1px solid var(--shx-line); gap: 12px; align-items: center;
    position: sticky; top: 0; z-index: 2; background: var(--shx-surface);
}
body.cx-new-look .modal-header h2, body.cx-new-look .modal-header h3, body.prx-on .modal-header h2, body.prx-on .modal-header h3 {
    font-family: var(--shx-head); font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; color: var(--shx-ink); margin: 0; min-width: 0; overflow-wrap: anywhere;
}
body.cx-new-look .modal-header .modal-close, body.cx-new-look .modal-header .btn-icon,
body.prx-on .modal-header .modal-close, body.prx-on .modal-header .btn-icon {
    min-width: 44px; min-height: 44px; border-radius: 12px; flex-shrink: 0; color: var(--shx-ink-2);
}
body.cx-new-look .modal-body, body.prx-on .modal-body { padding: 16px 20px 20px; min-width: 0; overflow-wrap: anywhere; }
body.cx-new-look .modal-footer, body.prx-on .modal-footer {
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--shx-line); display: flex; gap: 10px;
    flex-wrap: wrap; justify-content: flex-end; position: sticky; bottom: 0; background: var(--shx-surface); z-index: 2;
}
body.cx-new-look .modal-overlay > .modal .btn, body.prx-on .modal-overlay > .modal .btn { border-radius: 12px; font-weight: 600; }
body.cx-new-look .modal-overlay > .modal .form-group label, body.prx-on .modal-overlay > .modal .form-group label { font-weight: 600; color: var(--shx-ink); }
body.cx-new-look .modal-overlay > .modal input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]):not([type=range]):not([type=color]),
body.cx-new-look .modal-overlay > .modal select, body.cx-new-look .modal-overlay > .modal textarea {
    border-radius: 10px; border-color: var(--shx-line); max-width: 100%;
}
/* iOS: every field of a pop-up is 16px on phones, tablets and touch screens (no zoom on focus) */
@media (max-width: 1024px), (pointer: coarse) {
    body.cx-new-look .modal-overlay input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]):not([type=range]):not([type=color]),
    body.cx-new-look .modal-overlay select, body.cx-new-look .modal-overlay textarea,
    body.prx-on .modal-overlay input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]):not([type=range]):not([type=color]),
    body.prx-on .modal-overlay select, body.prx-on .modal-overlay textarea { font-size: 16px !important; }
    body.cx-new-look .modal-overlay > .modal .btn, body.prx-on .modal-overlay > .modal .btn { min-height: 44px; }
}
/* phones: a bottom sheet, clear of the notch and the home bar; nothing wider than the screen */
@media (max-width: 640px) {
    body.cx-new-look .modal-overlay:not(.slide-over), body.prx-on .modal-overlay:not(.slide-over) {
        align-items: flex-end; padding: calc(12px + env(safe-area-inset-top, 0px)) 0 0;
    }
    body.cx-new-look .modal-overlay:not(.slide-over) > .modal, body.prx-on .modal-overlay:not(.slide-over) > .modal {
        width: 100% !important; max-width: 100% !important; max-height: calc(100dvh - 12px - env(safe-area-inset-top, 0px)) !important;
        border-radius: 20px 20px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    body.cx-new-look .modal-header, body.prx-on .modal-header { padding: 14px 16px 10px; }
    body.cx-new-look .modal-body, body.prx-on .modal-body { padding: 14px 16px 18px; max-height: none !important; }
    body.cx-new-look .modal-footer, body.prx-on .modal-footer { padding-left: 16px; padding-right: 16px; }
    body.cx-new-look .modal-overlay > .modal [style*="grid-template-columns: 1fr 1fr"],
    body.prx-on .modal-overlay > .modal [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: minmax(0, 1fr) !important; }
}

/* ══════════════ 2. Help ══════════════ */
body.cx-new-look #page-help .page-header h1 { font-family: var(--shx-head); font-weight: 700; letter-spacing: -0.02em; }
body.cx-new-look #page-help .card { background: var(--shx-surface) !important; border: 1px solid var(--shx-line) !important; border-radius: 16px !important;
    box-shadow: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
body.cx-new-look #page-help .card h3 { font-family: var(--shx-head); font-size: 1.1rem; }
body.cx-new-look #page-help .card h3 > i { color: var(--shx-accent) !important; }
body.cx-new-look #page-help .hc-list button { background: var(--shx-surface); border: 1px solid var(--shx-line); border-radius: 14px; padding: 12px 14px; min-height: 64px; }
body.cx-new-look #page-help .hc-list button:hover, body.cx-new-look #page-help .hc-list button:focus-visible { border-color: var(--shx-accent); background: var(--shx-accent-soft); }
body.cx-new-look #page-help .hc-list button strong { color: var(--shx-ink); font-size: 0.98rem; }
body.cx-new-look #page-help .hc-list button span { color: var(--shx-ink-2); }
body.cx-new-look #page-help .btn { border-radius: 12px; font-weight: 600; min-height: 44px; }
@media (max-width: 1024px), (pointer: coarse) {
    body.cx-new-look #page-help input:not([type=checkbox]):not([type=radio]):not([type=hidden]), body.cx-new-look #page-help select, body.cx-new-look #page-help textarea { font-size: 16px !important; }
}
/* the "?" next to a page title: a 32px target (44px touch area via padding-free outline box), the accent colour */
body.cx-new-look .hc-q { width: 2rem; height: 2rem; border-width: 1.5px; border-color: var(--shx-accent); color: var(--shx-accent); background: var(--shx-surface); position: relative; }
body.cx-new-look .hc-q::after { content: ''; position: absolute; inset: -6px; }   /* larger touch area; no text */
body.cx-new-look .hc-q:hover, body.cx-new-look .hc-q:focus-visible { background: var(--shx-accent); color: #fff; }
/* the article viewer */
body.cx-new-look .hc-viewer, body.prx-on .hc-viewer { background: rgba(15, 23, 42, 0.45); }
body.cx-new-look .hc-viewer-box, body.prx-on .hc-viewer-box { border-radius: 20px; border: 1px solid var(--shx-line); background: var(--shx-surface); }
body.cx-new-look .hc-viewer-bar, body.prx-on .hc-viewer-bar { padding: 10px 12px; gap: 8px; border-bottom-color: var(--shx-line); }
body.cx-new-look .hc-viewer-bar strong, body.prx-on .hc-viewer-bar strong { font-family: var(--shx-head); font-size: 1rem; }
body.cx-new-look .hc-viewer-close, body.prx-on .hc-viewer-close { min-width: 44px; min-height: 44px; border-radius: 12px; }
body.cx-new-look .hc-viewer-more button, body.prx-on .hc-viewer-more button { min-height: 36px; border-radius: 10px; background: var(--shx-surface); }
body.cx-new-look .hc-viewer-more button[aria-pressed="true"] { background: var(--shx-accent-soft); border-color: var(--shx-accent); color: var(--shx-accent-ink); }
@media (max-width: 640px) { body.cx-new-look .hc-viewer-box, body.prx-on .hc-viewer-box { border-radius: 0; border: 0; } }

/* ══════════════ 3. Cleanup, Data quality, Sync needs attention ══════════════ */
/* common page header of the support pages: a real title, the classic back button kept as is */
body.cx-new-look :is(#page-cleanup, #page-pdqc, #page-debug-offline, #page-resolution-wizard) .page-header h1 {
    font-family: var(--shx-head); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere;
}
body.cx-new-look :is(#page-cleanup, #page-pdqc, #page-debug-offline, #page-resolution-wizard) .page-header .btn-icon { min-width: 44px; min-height: 44px; border-radius: 12px; flex-shrink: 0; }
body.cx-new-look :is(#page-cleanup, #page-pdqc, #page-debug-offline, #page-resolution-wizard) .page-header > div { min-width: 0; }
body.cx-new-look :is(#page-cleanup, #page-pdqc, #page-debug-offline, #page-resolution-wizard) .page-header > div > div { min-width: 0; }
body.cx-new-look :is(#page-cleanup, #page-pdqc, #page-debug-offline, #page-resolution-wizard) .card {
    background: var(--shx-surface) !important; border: 1px solid var(--shx-line) !important; border-radius: 16px !important; box-shadow: none !important;
    backdrop-filter: none !important; -webkit-backdrop-filter: none !important; min-width: 0; overflow-wrap: anywhere;
}
body.cx-new-look :is(#page-cleanup, #page-pdqc, #page-debug-offline, #page-resolution-wizard) .btn { border-radius: 12px; font-weight: 600; }
@media (max-width: 1024px), (pointer: coarse) {
    body.cx-new-look :is(#page-cleanup, #page-pdqc, #page-debug-offline, #page-resolution-wizard) :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]), select, textarea) { font-size: 16px !important; }
    body.cx-new-look :is(#page-cleanup, #page-pdqc, #page-debug-offline, #page-resolution-wizard) .btn { min-height: 44px; }
}

/* Database Cleanup: account cards with the classic checkbox, chips as quiet grey labels, the sticky action bar clear of the home bar */
body.cx-new-look #page-cleanup .cleanup-list > .card { border-left-width: 1px !important; padding: 16px !important; }
body.cx-new-look #page-cleanup .cleanup-list .badge { background: var(--shx-surface-2) !important; color: var(--shx-ink-2) !important; border: 1px solid var(--shx-line);
    border-radius: 8px; font-weight: 700; font-size: 0.8rem; padding: 3px 8px; white-space: normal; }
body.cx-new-look #page-cleanup .cleanup-checkbox { accent-color: var(--shx-accent); width: 1.3rem !important; height: 1.3rem !important; }
body.cx-new-look #page-cleanup #databaseCleanupFooter {
    background: var(--shx-surface); border-top: 1px solid var(--shx-line); box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.06);
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)) !important;
}
body.cx-new-look #page-cleanup #databaseCleanupContent > div > div:first-child { flex-wrap: wrap; gap: 10px; }

/* Data quality center */
body.cx-new-look #page-pdqc .subtitle { color: var(--shx-ink-2); }
body.cx-new-look #pdqcDashboardContent [style*="display: grid"], body.cx-new-look #pdqcDashboardContent [style*="display:grid"] { min-width: 0; }
body.cx-new-look #pdqcDashboardContent [style*="display: grid"] > *, body.cx-new-look #pdqcDashboardContent [style*="display:grid"] > * { min-width: 0; }
body.cx-new-look #pdqcDashboardContent h3, body.cx-new-look #pdqcDashboardContent h4 { font-family: var(--shx-head); overflow-wrap: anywhere; }
@media (max-width: 640px) {
    body.cx-new-look #pdqcDashboardContent [style*="grid-template-columns: repeat(3"], body.cx-new-look #pdqcDashboardContent [style*="grid-template-columns:repeat(3"] {
        grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)) !important; }
    body.cx-new-look #pdqcDashboardContent [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: minmax(0, 1fr) !important; }
}

/* Sync needs attention: the repair panel, Changes to decide, unsent changes from other people */
body.cx-new-look #syncRepairPanel > .modal, body.prx-on #syncRepairPanel > .modal { --shx-modal-max: 600px; }
body.cx-new-look :is(#decisionScreen, #syncDecidePanel) > .modal, body.prx-on :is(#decisionScreen, #syncDecidePanel) > .modal { --shx-modal-max: 760px; }
body.cx-new-look .sync-repair-item, body.prx-on .sync-repair-item,
body.cx-new-look .decide-card, body.prx-on .decide-card {
    background: var(--shx-surface) !important; border: 1px solid var(--shx-line) !important; border-radius: 14px !important; padding: 14px !important;
}
body.cx-new-look .sync-repair-item [style*="text-transform:uppercase"], body.prx-on .sync-repair-item [style*="text-transform:uppercase"] {
    background: none !important; border: 0 !important; padding: 0 !important; font-size: 0.78rem !important;   /* the state word, classic colour kept */
}
body.cx-new-look .sync-repair-item [id^="details-"], body.prx-on .sync-repair-item [id^="details-"] { background: var(--shx-surface-2) !important; border-color: var(--shx-line) !important; color: var(--shx-ink); }
body.cx-new-look .sync-repair-item > div:last-child, body.prx-on .sync-repair-item > div:last-child { flex-wrap: wrap; border-top-color: var(--shx-line) !important; }
body.cx-new-look .decide-group, body.prx-on .decide-group { font-size: 0.74rem !important; letter-spacing: 0.09em; text-transform: uppercase; color: var(--shx-ink-2); font-weight: 700; }
body.cx-new-look .decide-card-actions, body.prx-on .decide-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
body.cx-new-look #departedChangesBanner { background: var(--shx-warn-bg) !important; border: 1px solid var(--shx-warn-line) !important; color: var(--shx-warn-ink) !important;
    border-radius: 14px !important; max-width: calc(100vw - 16px); box-sizing: border-box; overflow-wrap: anywhere; }
body.cx-new-look #departedChangesOverlay > div { border-radius: 20px !important; background: var(--shx-surface) !important; color: var(--shx-ink); max-width: min(640px, 100%) !important; box-sizing: border-box; }
body.cx-new-look #departedChangesOverlay .departed-author { border: 1px solid var(--shx-line) !important; border-radius: 14px !important; padding: 14px !important; }
@media (max-width: 1024px), (pointer: coarse) {
    body.cx-new-look :is(#syncRepairPanel, #decisionScreen, #syncDecidePanel, #departedChangesOverlay) .btn,
    body.prx-on :is(#syncRepairPanel, #decisionScreen, #syncDecidePanel) .btn { min-height: 44px; }
}

/* ══════════════ 4. Resolution wizard + Offline diagnostics (light) ══════════════ */
body.cx-new-look #page-resolution-wizard .page-header { gap: 12px; }
body.cx-new-look #rrfWizardStepper { flex-wrap: wrap; row-gap: 8px; column-gap: 12px !important; min-width: 0; max-width: 100%; }
body.cx-new-look #rrfWizardStepper .step-indicator.active { color: var(--shx-accent-ink) !important; }
body.cx-new-look #rrfWizardStepper .step-indicator.active > span { background: var(--shx-accent-soft) !important; color: var(--shx-accent-ink); }
body.cx-new-look #rrfWizardPanelContainer { min-width: 0; overflow-wrap: anywhere; }
body.cx-new-look #rrfWizardPanelContainer table { max-width: 100%; }
body.cx-new-look #page-debug-offline > div[style*="display: grid"] { max-width: min(800px, 100%) !important; min-width: 0; }
body.cx-new-look #offline-diagnostics-container { min-width: 0; overflow-wrap: anywhere; }
body.cx-new-look #offline-diagnostics-container pre { white-space: pre-wrap; word-break: break-word; max-width: 100%; }
