/* ==========================================================================================================
   PORTAL-RD-1675 (lane/1675-rdw2-portal; owner 2026-11-13): the new look of the CLIENT PORTAL (js/modules/portal-redesign.js).
   Applies ONLY under body.prx-on (a portal client of a practice with the new look on) or body.lgx-on (the sign-in screens of
   a device whose last answer was the new look). Classic portal markup, handlers and save path are unchanged: this sheet only
   restyles. It never hides a control, never changes a word (no ::before / ::after text), never re-orders content.
   Practice-branded: the accent is the practice's own --primary-color (the classic portal colour); ChiroApp stays minimal.
   Phones: 16px fields (iOS zoom), nothing wider than the screen, header / bottom nav clear of the notch and home bar.
   --prx-ready tells the module this generation is loaded (a missing / stale sheet keeps classic).
   ========================================================================================================== */
:root { --prx-ready: 1; }

body.prx-on, body.lgx-on {
    --prx-accent: var(--primary-color, #355e3b);
    --prx-accent-ink: color-mix(in srgb, var(--primary-color, #355e3b) 78%, #000);
    --prx-accent-soft: color-mix(in srgb, var(--primary-color, #355e3b) 10%, #fff);
    --prx-bg: #f4f6f5;
    --prx-surface: #ffffff;
    --prx-surface-2: #f8faf9;
    --prx-line: #dfe5e1;
    --prx-ink: #0f172a;
    --prx-ink-2: #475569;
    --prx-head: 'Poppins', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --prx-radius: 16px;
    --prx-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.06);
}
/* the sign-in screens are ChiroApp's own (shared by staff and clients; no practice known yet): the ChiroApp green */
body.lgx-on { --prx-accent: #355e3b; --prx-accent-ink: #1f3d26; --prx-accent-soft: #e7efe8; }
[data-theme="dark"] body.prx-on, [data-theme="dark"] body.lgx-on {
    --prx-accent-ink: color-mix(in srgb, var(--primary-color, #6fae79) 45%, #fff);
    --prx-accent-soft: color-mix(in srgb, var(--primary-color, #355e3b) 22%, #141a17);
    --prx-bg: #0b0f0d; --prx-surface: #141a17; --prx-surface-2: #1a221e; --prx-line: #2a3530; --prx-ink: #f1f5f9; --prx-ink-2: #cbd5e1;
}

/* ───────────── frame: page, top bar, navigation, footer ───────────── */
body.prx-on { background: var(--prx-bg) !important; }
body.prx-on .portal-layout { background: var(--prx-bg); color: var(--prx-ink); }
body.prx-on .portal-header {
    background: var(--prx-surface); backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: 1px solid var(--prx-line);
    padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-top: calc(10px + env(safe-area-inset-top, 0px)); padding-bottom: 10px;
}
body.prx-on .portal-header-content { gap: 12px; min-width: 0; }
body.prx-on .portal-header-left { min-width: 0; gap: 10px; }
body.prx-on .portal-brand { min-width: 0; gap: 10px; }
body.prx-on .portal-brand h1 { font-family: var(--prx-head); font-weight: 600; font-size: 1.05rem; color: var(--prx-ink); margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) {
    /* phones: the practice name, with "Patient Portal" as a small line under it (both whole words, never cut off) */
    body.prx-on .portal-brand { flex-wrap: wrap; row-gap: 0; column-gap: 8px; }
    body.prx-on .portal-brand .portal-practice-name { flex: 1 0 100%; max-width: 100%; white-space: normal; font-size: 1rem; line-height: 1.2; }
    body.prx-on .portal-brand h1 { font-family: 'Inter', system-ui, sans-serif; font-size: 0.78rem; font-weight: 600; color: var(--prx-ink-2); line-height: 1.3; }
    body.prx-on .portal-logo { width: 36px; height: 36px; }
}
body.prx-on .portal-logo { width: 40px; height: 40px; border-radius: 10px; }
body.prx-on .portal-practice-name { font-family: var(--prx-head); color: var(--prx-accent-ink) !important; overflow-wrap: anywhere; }
body.prx-on .portal-user { gap: 6px !important; flex-shrink: 0; }
body.prx-on #portalNotifBell { min-width: 44px; min-height: 44px; justify-content: center; border-radius: 12px !important; color: var(--prx-ink-2) !important; }
body.prx-on #portalNotifBell:hover { background: var(--prx-surface-2) !important; }
body.prx-on .portal-user .logout-btn { min-height: 40px; border-radius: 12px; border-color: var(--prx-line); color: var(--prx-ink); background: var(--prx-surface); font-weight: 600; }
body.prx-on #portalLangPicker { font-size: 16px !important; min-height: 40px; border-radius: 10px !important; border-color: var(--prx-line) !important; background: var(--prx-surface) !important; max-width: 34vw; }
body.prx-on .hamburger-menu-btn { border-radius: 12px; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }

body.prx-on .portal-content { padding: 16px max(16px, env(safe-area-inset-left, 0px)) 24px max(16px, env(safe-area-inset-right, 0px)); gap: 16px; max-width: 980px; }

/* phone bottom navigation: solid surface, accent for the current place, clear of the home bar */
body.prx-on .portal-bottom-nav { padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--prx-line); }
body.prx-on .portal-bottom-nav::before { background: var(--prx-surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
body.prx-on .portal-bottom-nav .portal-nav-item { color: var(--prx-ink-2); font-weight: 600; font-size: 0.72rem; min-height: 52px; min-width: 0; border-radius: 12px; }
body.prx-on .portal-bottom-nav .portal-nav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
body.prx-on .portal-bottom-nav .portal-nav-item.active { color: var(--prx-accent-ink); }
@media (max-width: 768px) {
    body.prx-on .portal-layout { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

/* desktop side navigation (shown with the menu button): quiet list, accent for the current place */
@media (min-width: 769px) {
    body.prx-on .portal-desktop-nav { border-right: 0; padding: 16px 12px 16px 0; gap: 4px; }
    body.prx-on .portal-nav-item.desktop-only { background: transparent; color: var(--prx-ink); border: 0; border-radius: 12px; font-weight: 600; font-size: 0.98rem; min-height: 46px; padding: 10px 14px; }
    body.prx-on .portal-nav-item.desktop-only i { color: var(--prx-ink-2); }
    body.prx-on .portal-nav-item.desktop-only:hover { filter: none; background: var(--prx-surface); }
    body.prx-on .portal-nav-item.desktop-only.active { filter: none; background: var(--prx-accent-soft); color: var(--prx-accent-ink); box-shadow: none; border: 0; }
    body.prx-on .portal-nav-item.desktop-only.active i { color: var(--prx-accent-ink); }
    body.prx-on .portal-content { padding: 24px 24px 40px; }
}

body.prx-on .portal-legal-footer { background: transparent !important; border-top: 1px solid var(--prx-line) !important; color: var(--prx-ink-2) !important; }
body.prx-on .portal-legal-footer a { color: var(--prx-ink-2) !important; display: inline-block; padding: 6px 2px; }

/* ───────────── content: titles, cards, rows, labels ───────────── */
body.prx-on #portal-view-container { color: var(--prx-ink); min-width: 0; }
body.prx-on #portal-view-container .card,
body.prx-on #portal-view-container .glass,
body.prx-on #portal-view-container .prx-card {
    background: var(--prx-surface) !important; border: 1px solid var(--prx-line) !important; border-radius: var(--prx-radius) !important;
    box-shadow: var(--prx-shadow) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
}
body.prx-on #portal-view-container .portal-welcome.card { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; }
body.prx-on #portal-view-container .prx-card { padding: 16px !important; }
@media (min-width: 769px) { body.prx-on #portal-view-container .prx-card { padding: 20px 24px !important; } }

/* the page title row (classic: a centred title, subtitle and one wide action) -> left-aligned title, action beside it */
body.prx-on .prx-hero { text-align: left !important; padding: 4px 0 0 !important; margin: 0 0 16px !important; }
body.prx-on .prx-hero > h2 { font-family: var(--prx-head) !important; font-size: 1.7rem !important; font-weight: 700 !important; letter-spacing: -0.02em;
    line-height: 1.15; color: var(--prx-ink) !important; margin: 0 0 4px !important; overflow-wrap: anywhere; }
body.prx-on .prx-hero > h2 > i { display: none; }  /* decorative icon of the title only (no text, no control) */
body.prx-on .prx-hero > p { text-align: left; color: var(--prx-ink-2) !important; margin: 0 0 14px !important; font-size: 0.95rem !important; }
body.prx-on .prx-hero > .btn { margin: 0 !important; width: auto !important; max-width: 100% !important; display: inline-flex !important; }
@media (max-width: 480px) { body.prx-on .prx-hero > .btn { width: 100% !important; justify-content: center; } }

body.prx-on #portal-view-container h2, body.prx-on #portal-view-container h3 { font-family: var(--prx-head); letter-spacing: -0.01em; }
body.prx-on #portal-view-container h3 { font-size: 1.15rem; color: var(--prx-ink); overflow-wrap: anywhere; }
body.prx-on .prx-label {
    font-family: 'Inter', system-ui, sans-serif !important; font-size: 0.74rem !important; font-weight: 700 !important; letter-spacing: 0.09em;
    text-transform: uppercase; color: var(--prx-ink-2) !important; margin: 0 0 8px !important;
}
body.prx-on .prx-label > i { font-size: 1rem !important; }
body.prx-on .appointments-subsection { margin-bottom: 20px !important; }
body.prx-on .appointments-subsection:last-child { margin-bottom: 0 !important; }

body.prx-on #portal-view-container .portal-list { gap: 10px; display: flex; flex-direction: column; }
body.prx-on #portal-view-container .prx-row {
    background: var(--prx-surface) !important; border: 1px solid var(--prx-line) !important; border-radius: 14px !important;
    padding: 14px 16px !important; box-shadow: none !important; opacity: 1 !important; gap: 12px; min-width: 0; flex-wrap: wrap;
}
body.prx-on #portal-view-container .prx-row[style*="border-left"] { border-left: 1px solid var(--prx-line) !important; }   /* no stripe: the group title says it */
body.prx-on #portal-view-container .prx-row > div { min-width: 0; }
body.prx-on #portal-view-container .prx-row strong, body.prx-on #portal-view-container .prx-row [style*="font-weight: 700"] { overflow-wrap: anywhere; }
body.prx-on #portal-view-container .empty-state { color: var(--prx-ink-2); background: var(--prx-surface-2); border-radius: 12px; padding: 14px 16px; margin: 0; }

/* status words: plain coloured text, no pill (wave-1 rule) -- the classic inline colour is kept */
body.prx-on #portal-view-container .badge,
body.prx-on #portal-view-container .prx-row span[style*="border-radius: 20px"],
body.prx-on #portal-view-container .prx-row span[style*="border-radius:12px"] {
    background: none !important; padding: 0 !important; border: 0 !important; font-weight: 700 !important; font-size: 0.85rem !important;
}

/* ───────────── buttons and fields ───────────── */
body.prx-on .portal-layout .btn, body.prx-on .invoice-detail-view .btn {
    border-radius: 12px; font-weight: 600; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
body.prx-on .portal-layout .btn-primary { background: var(--prx-accent); border-color: var(--prx-accent); color: #fff; box-shadow: none; }
body.prx-on .portal-layout .btn-outline, body.prx-on .portal-layout .btn-secondary { background: var(--prx-surface); border: 1px solid var(--prx-line); color: var(--prx-ink); }
@media (pointer: coarse), (max-width: 1024px) {
    body.prx-on .portal-layout .btn, body.prx-on .modal .btn { min-height: 44px; }
}
body.prx-on #portal-view-container input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]):not([type=range]):not([type=color]),
body.prx-on #portal-view-container select,
body.prx-on #portal-view-container textarea,
body.prx-on .modal input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]):not([type=range]):not([type=color]),
body.prx-on .modal select, body.prx-on .modal textarea {
    font-size: 16px !important; border-radius: 10px !important; border: 1px solid var(--prx-line) !important; background: var(--prx-surface) !important;
    color: var(--prx-ink) !important; min-height: 44px; max-width: 100%; box-sizing: border-box;
}
body.prx-on #portal-view-container textarea, body.prx-on .modal textarea { min-height: 88px; }
body.prx-on #portal-view-container input:focus, body.prx-on #portal-view-container select:focus, body.prx-on #portal-view-container textarea:focus {
    outline: 2px solid var(--prx-accent) !important; outline-offset: 1px; border-color: var(--prx-accent) !important;
}
body.prx-on #portal-view-container label { color: var(--prx-ink); font-weight: 600; }
body.prx-on .prx-form { min-width: 0; }
/* classic two-column field grids collapse to one column on phones (no field squeezed off the screen) */
@media (max-width: 560px) {
    body.prx-on #portal-view-container [style*="grid-template-columns: 1fr 1fr"],
    body.prx-on #portal-view-container [style*="grid-template-columns:1fr 1fr"],
    body.prx-on #portal-view-container [style*="grid-template-columns: repeat(2"],
    body.prx-on #portal-view-container [style*="grid-template-columns: 2fr 1fr"],
    body.prx-on #portal-view-container [style*="grid-template-columns: 1fr 1fr 1fr"] { grid-template-columns: minmax(0, 1fr) !important; }
}
body.prx-on #portal-view-container [style*="display: grid"] > *, body.prx-on #portal-view-container [style*="display:grid"] > * { min-width: 0; }

/* ───────────── invoice document (classic Components.portalInvoiceModal / .invoice-detail-view) ───────────── */
body.prx-on .invoice-detail-view { color: var(--prx-ink); min-width: 0; }
body.prx-on #portal-view-container .card .invoice-detail-view { background: transparent !important; border: 0 !important; box-shadow: none !important; }
body.prx-on .invoice-detail-view td, body.prx-on .invoice-detail-view th { border-color: var(--prx-line) !important; }
body.prx-on .invoice-detail-view th { color: var(--prx-ink-2); font-weight: 700; }

/* ───────────── notifications (bell) ───────────── */
body.prx-on #portalNotifDropdown { border-radius: 16px !important; border: 1px solid var(--prx-line) !important; background: var(--prx-surface) !important; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16) !important; }
@media (max-width: 560px) {
    body.prx-on #portalNotifDropdown { position: fixed !important; left: 8px !important; right: 8px !important; width: auto !important; max-width: none !important;
        top: calc(64px + env(safe-area-inset-top, 0px)) !important; max-height: calc(100dvh - 160px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); overflow-y: auto; }
}

/* ───────────── sign-in, two-step code, email verification (device hint) ───────────── */
body.lgx-on.login-page, body.lgx-on .login-container { background: var(--prx-bg) !important; }
body.lgx-on .login-container { padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); box-sizing: border-box; }
body.lgx-on .login-box { background: var(--prx-surface) !important; border: 1px solid var(--prx-line) !important; border-radius: 20px !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.10) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; color: var(--prx-ink); max-width: 100%; box-sizing: border-box; }
body.lgx-on .login-header h1, body.lgx-on .login-header h2, body.lgx-on .login-header h3 { font-family: var(--prx-head); letter-spacing: -0.02em; color: var(--prx-ink); }
body.lgx-on .login-box input:not([type=checkbox]):not([type=radio]):not([type=hidden]) { font-size: 16px !important; min-height: 46px; border-radius: 12px !important;
    border: 1px solid var(--prx-line) !important; background: var(--prx-surface) !important; color: var(--prx-ink) !important; box-sizing: border-box; max-width: 100%; }
body.lgx-on .login-box .btn { border-radius: 12px; min-height: 46px; font-weight: 600; }
body.lgx-on .login-box .btn-primary { background: var(--prx-accent) !important; border-color: var(--prx-accent) !important; color: #fff; }
body.lgx-on .login-box label { color: var(--prx-ink); font-weight: 600; }

/* the classic tinted Share / Insurance receipt buttons read as ordinary outline buttons (same buttons, same handlers);
   BRAND-1677: the Share button's tint is now rgba(var(--primary-rgb), ...) (was the hard-coded indigo) */
body.prx-on #portal-view-container .prx-row .btn[style*="background: rgba(var(--primary-rgb)"],
body.prx-on #portal-view-container .prx-row .btn[style*="background: rgba(16,185,129"] {
    background: var(--prx-surface) !important; color: var(--prx-ink) !important; border: 1px solid var(--prx-line) !important;
}
