/* ==========================================================================================================
   SCHEDULE-1669 (lane/1669-schedule, owner 2026-11-09): the new-look Schedule page (js/modules/schedule-redesign.js).
   Namespaced .sx-*; uses the ChiroApp "cx" tokens from css/index.css. Nothing here applies unless the module draws
   #sxRoot (new look on). --sx-ready tells the module this stylesheet is loaded (a missing / stale one keeps classic).
   No pills / chips (counts and status are plain coloured words), no emoji. Same app on phone, tablet and desktop:
   the detail panel is a right column at 1200px and wider, the SAME content in a bottom sheet below.
   ========================================================================================================== */
:root {
    --sx-ready: 1;
    --sx-head: 'Poppins', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --sx-clinic: #16a34a;
    --sx-mobile: #7c3aed;
    --sx-requested: #f59e0b;
    --sx-followup: #ea580c;
    --sx-done: #94a3b8;
    --sx-block: #94a3b8;
    --sx-now: #dc2626;
    --sx-hero: #2f5a37;
    --sx-hero-2: #3a6b43;
    --sx-soft: #eaf2ec;
    --sx-row-bg: var(--cx-surface, #fff);
    --sx-line: var(--cx-border, #dfe5e1);
}
[data-theme="dark"] { --sx-soft: #1b2a1e; --sx-hero: #23402a; --sx-hero-2: #2b4f33; }

#page-appointments > .sx-classic-hidden { display: none !important; }

.sx { color: var(--cx-text); display: flex; flex-direction: column; gap: 14px; padding-bottom: 24px; min-width: 0; }
.sx *, .sx-sheet * { box-sizing: border-box; }
.sx-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sx-muted { color: var(--cx-text-2); }
.sx-show-narrow { display: none; }
.sx-nowrap { white-space: nowrap; }

.sx-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 6px 4px; margin: 0 0 -6px -4px;
    color: var(--cx-brand-ink); font: inherit; font-weight: 600; font-size: 0.95rem; cursor: pointer; min-height: 40px; }
.sx-back:hover { text-decoration: underline; }

/* header */
.sx-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sx-titles { min-width: 0; }
.sx-crumb { white-space: nowrap; margin: 0 0 4px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cx-brand-ink); display: flex; align-items: center; gap: 6px; }
.sx-head h1 { margin: 0; font-family: var(--sx-head); font-size: 2.1rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; color: var(--primary-text, var(--cx-text)); }   /* BRAND-1677 */
.sx-subtitle { margin: -6px 0 0; color: var(--cx-text-2); font-size: 0.95rem; }
body.sx-on #page-appointments .wt-first-tooltip { display: none !important; }
.sx-hour b { font-weight: inherit; }
.sx-hl-short { display: none; }
.sx-hero-title { display: block; min-width: 0; }
.sx-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* buttons */
.sx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px;
    border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 0.95rem; cursor: pointer; text-decoration: none; color: inherit;
    background: var(--cx-surface); transition: background 120ms ease, box-shadow 120ms ease, transform 120ms ease; white-space: nowrap; }
.sx-btn:active { transform: translateY(1px); }
.sx-btn i { font-size: 1.15em; }
.sx-btn--brand { background: var(--sx-hero); color: #fff; box-shadow: 0 4px 12px rgba(47, 90, 55, 0.28); }
.sx-btn--brand:hover { background: var(--sx-hero-2); }
.sx-btn--outline { border-color: var(--sx-line); background: var(--cx-surface); color: var(--cx-text); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05); }
.sx-btn--outline:hover { border-color: var(--cx-brand); }
.sx-btn--soft { background: var(--sx-soft); color: var(--cx-brand-ink); }
.sx-btn--sm { min-height: 36px; padding: 0 12px; font-size: 0.875rem; border-radius: 10px; }
.sx-btn--danger { color: #b91c1c; }
.sx-btn:focus-visible, .sx-icon-btn:focus-visible, .sx-row:focus-visible, .sx-tab:focus-visible, .sx-switch-btn:focus-visible, .sx-mo-cell:focus-visible,
.sx-tl-item:focus-visible, .sx-wk-item:focus-visible, .sx-wk-day:focus-visible { outline: 3px solid var(--cx-focus); outline-offset: 2px; }
.sx-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--sx-line);
    background: var(--cx-surface); color: var(--cx-text); cursor: pointer; font-size: 1.1rem; flex: 0 0 auto; }
.sx-link { background: none; border: 0; padding: 6px 2px; color: var(--cx-brand-ink); font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.sx-link:hover { text-decoration: underline; }
.sx-badge-n { font-weight: 700; color: #b91c1c; }

/* toolbar */
.sx-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sx-switch { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: color-mix(in srgb, var(--cx-text-2) 10%, transparent); }
.sx-switch-btn { min-height: 40px; padding: 0 16px; border: 0; border-radius: 10px; background: transparent; color: var(--cx-text-2); font: inherit; font-weight: 600;
    font-size: 0.95rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.sx-switch-btn.is-active { background: var(--cx-surface); color: var(--cx-brand-ink); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }
.sx-nav { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.sx-nav-label { margin: 0 0 0 6px; font-family: var(--sx-head); font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.sx-today-word { font-family: inherit; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; color: var(--cx-brand-ink); text-transform: uppercase; margin-left: 6px; }
.sx-filters { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; min-width: 0; }
.sx-search, .sx-select { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--sx-line);
    background: var(--cx-surface); color: var(--cx-text-2); min-width: 0; }
.sx-search input, .sx-select select { border: 0; background: transparent; font: inherit; font-size: 0.95rem; color: var(--cx-text); outline: none; min-width: 0; padding: 0; height: 42px; }
.sx-search input { width: 220px; }
.sx-select select { max-width: 180px; cursor: pointer; }
.sx-search:focus-within, .sx-select:focus-within { border-color: var(--cx-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cx-focus) 25%, transparent); }

/* list tabs (underlined words) */
.sx-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--sx-line); overflow-x: auto; scrollbar-width: none; align-items: center; }
.sx-tabs::-webkit-scrollbar { display: none; }
.sx-tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 0 9px; margin-bottom: -1px; font: inherit; font-weight: 600; font-size: 0.95rem;
    color: var(--cx-text-2); cursor: pointer; white-space: nowrap; }
.sx-tab.is-active { color: var(--cx-brand-ink); border-bottom-color: var(--cx-brand); }
.sx-tab-n { color: #dc2626; font-weight: 700; }

/* layout */
.sx-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.sx-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; container-type: inline-size; }
@media (min-width: 1200px) {
    .sx-body.has-panel { grid-template-columns: minmax(0, 1fr) minmax(340px, 380px); }
    .sx-panel { position: sticky; top: 12px; }
}
.sx-card { background: var(--cx-surface); border: 1px solid var(--sx-line); border-radius: 18px; padding: 16px 18px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 18px rgba(15, 23, 42, 0.05); min-width: 0; }
.sx-card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.sx-card-head h2 { margin: 0; font-family: var(--sx-head); font-size: 1.35rem; font-weight: 700; }
.sx-card-head .sx-btn { margin-left: auto; }
.sx-card-head > .sx-muted { order: 3; flex-basis: 100%; font-size: 0.9rem; }
.sx-hint { margin: 10px 0 0; font-size: 0.82rem; color: var(--cx-text-2); text-align: right; }
.sx-empty { margin: 0; padding: 22px 12px; text-align: center; color: var(--cx-text-2); }
.sx-eyebrow { margin: 14px 0 8px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cx-text-2); display: flex; align-items: center; gap: 6px; }

/* summary strip */
.sx-summary { background: var(--cx-surface); border: 1px solid var(--sx-line); border-radius: 16px; padding: 14px 18px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
.sx-summary--inline { border: 0; box-shadow: none; padding: 0 0 12px; border-radius: 0; background: none; }
.sx-summary-line { display: flex; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; font-size: 0.95rem; }
.sx-summary-line > strong { font-family: var(--sx-head); font-weight: 600; font-size: 1.02rem; }
.sx-summary-next { margin-left: auto; color: var(--cx-text-2); font-size: 0.9rem; }
.sx-summary-next strong { color: var(--cx-brand-ink); }
.sx-progress { display: flex; gap: 4px; margin-top: 10px; height: 8px; }
.sx-seg-bar { flex: 1 1 0; border-radius: 4px; background: #d6e7da; }
.sx-seg-bar--done { background: #9aa8b6; }
.sx-seg-bar--in { background: var(--sx-hero); }
.sx-seg-bar--todo { background: #b9dcc2; }
.sx-seg-bar--req { background: #fde3a7; }

/* day groups + rows */
.sx-day-group { display: flex; flex-direction: column; gap: 8px; }
.sx-day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 6px 2px 0; }
.sx-day-head h3 { margin: 0; font-family: var(--sx-head); font-size: 1.15rem; font-weight: 700; color: var(--cx-text); }
.sx-day-head .sx-muted { font-size: 0.85rem; }
.sx-rows { display: flex; flex-direction: column; gap: 8px; }
.sx-list { display: flex; flex-direction: column; gap: 14px; }
.sx-row { --sx-acc: var(--sx-clinic); position: relative; display: grid; grid-template-columns: 92px 44px minmax(0, 1fr) minmax(0, 170px) 120px 18px; align-items: center; gap: 14px;
    width: 100%; text-align: left; padding: 12px 14px 12px 18px; border-radius: 14px; border: 1px solid var(--sx-line); background: var(--sx-row-bg); color: var(--cx-text);
    font: inherit; cursor: pointer; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); transition: box-shadow 120ms ease, border-color 120ms ease; min-height: 68px; }
.sx-row::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--sx-acc); }
.sx-row:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08); border-color: color-mix(in srgb, var(--sx-acc) 40%, var(--sx-line)); }
.sx-row.is-selected { border-color: var(--cx-brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--cx-brand) 35%, transparent); background: color-mix(in srgb, var(--sx-soft) 55%, var(--sx-row-bg)); }
.sx .sx-acc--clinic, .sx-sheet .sx-acc--clinic { --sx-acc: var(--sx-clinic); }
.sx .sx-acc--mobile, .sx-sheet .sx-acc--mobile { --sx-acc: var(--sx-mobile); }
.sx .sx-acc--requested, .sx-sheet .sx-acc--requested { --sx-acc: var(--sx-requested); }
.sx .sx-acc--followup, .sx-sheet .sx-acc--followup { --sx-acc: var(--sx-followup); }
.sx .sx-acc--done, .sx-sheet .sx-acc--done { --sx-acc: var(--sx-done); }
.sx .sx-acc--block, .sx-sheet .sx-acc--block { --sx-acc: var(--sx-block); }
.sx-acc-bg--clinic { background: var(--sx-clinic); } .sx-acc-bg--mobile { background: var(--sx-mobile); } .sx-acc-bg--requested { background: var(--sx-requested); }
.sx-acc-bg--followup { background: var(--sx-followup); } .sx-acc-bg--done { background: var(--sx-done); } .sx-acc-bg--block { background: var(--sx-block); }
.sx-st--requested { border-style: dashed; }
.sx-st--completed .sx-name, .sx-st--cancelled .sx-name { color: var(--cx-text-2); }
.sx-time { display: flex; flex-direction: column; line-height: 1.2; }
.sx-time strong { font-family: var(--sx-head); font-size: 1.12rem; font-weight: 600; white-space: nowrap; letter-spacing: -0.01em; }
.sx-time small { color: var(--cx-text-2); font-size: 0.8rem; }
.sx-avatar { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.45rem;
    border: 1px solid var(--sx-line); background: var(--cx-surface); color: var(--cx-text); flex: 0 0 auto; }
.sx-avatar svg { width: 1em; height: 1em; }
.sx-avatar--human { background: var(--sx-soft); color: var(--cx-brand-ink); border-color: transparent; }
.sx-avatar--sm { width: 30px; height: 30px; font-size: 1.05rem; border-radius: 8px; }
.sx-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sx-row { line-height: 1.35; }
.sx-who { gap: 1px; }
.sx-who > span { display: block; line-height: 1.35 !important; padding-bottom: 1px; }
.sx-name { font-weight: 700; font-size: 1.02rem; }
.sx-species { font-weight: 500; color: var(--cx-brand-ink); }
.sx-sub { color: var(--cx-text-2); font-size: 0.88rem; }
.sx-loc { color: var(--cx-text-2); font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px; }
.sx-status { font-size: 0.88rem; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; color: var(--cx-text-2); }
.sx-status--scheduled { color: var(--cx-text-2); }
.sx-status--confirmed { color: #1d4ed8; }
.sx-status--checked_in { color: #15803d; font-weight: 700; }
.sx-status--requested { color: #b45309; }
.sx-status--followup { color: #c2410c; }
.sx-status--no_show, .sx-status--cancelled { color: #b91c1c; }
.sx-status--completed, .sx-status--seen, .sx-status--blocked { color: var(--cx-text-2); }
[data-theme="dark"] .sx-status--confirmed { color: #93c5fd; }
[data-theme="dark"] .sx-status--checked_in { color: #86efac; }
[data-theme="dark"] .sx-status--requested, [data-theme="dark"] .sx-status--followup { color: #fdba74; }
[data-theme="dark"] .sx-status--no_show, [data-theme="dark"] .sx-status--cancelled, [data-theme="dark"] .sx-btn--danger { color: #fca5a5; }
.sx-row .sx-status--scheduled ~ .sx-chev { opacity: 0.5; }
.sx-chev { color: var(--cx-text-2); opacity: 0.6; }
.sx-row--block { grid-template-columns: 92px minmax(0, 1fr); min-height: 46px; padding-top: 8px; padding-bottom: 8px; color: var(--cx-text-2); box-shadow: none;
    background: repeating-linear-gradient(-45deg, var(--cx-surface-2), var(--cx-surface-2) 8px, color-mix(in srgb, var(--cx-text-2) 7%, var(--cx-surface-2)) 8px, color-mix(in srgb, var(--cx-text-2) 7%, var(--cx-surface-2)) 16px); }
.sx-row--block::before { background: var(--sx-block); }
.sx-row--block .sx-time strong { font-size: 0.98rem; color: var(--cx-text-2); }
.sx-block-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }

@container (max-width: 640px) {
    .sx-row { grid-template-columns: 78px 40px minmax(0, 1fr) auto; grid-template-areas: 'time av who status' 'time av loc loc'; row-gap: 2px; column-gap: 10px; }
    .sx-row > .sx-time { grid-area: time; } .sx-row > .sx-avatar { grid-area: av; } .sx-row > .sx-who { grid-area: who; }
    .sx-row > .sx-status { grid-area: status; align-self: start; padding-top: 2px; } .sx-row > .sx-loc { grid-area: loc; font-size: 0.84rem; }
    .sx-row > .sx-chev { display: none; }
    .sx-row--block { grid-template-columns: 78px minmax(0, 1fr); grid-template-areas: none; }
    .sx-row--block > .sx-time { grid-area: auto; }
    .sx-avatar { width: 40px; height: 40px; font-size: 1.3rem; }
    .sx-time strong { font-size: 1.02rem; }
}
@container (max-width: 420px) {
    .sx-row { grid-template-columns: 70px 36px minmax(0, 1fr); grid-template-areas: 'time av who' 'time av status' 'time av loc'; padding: 10px 12px 10px 14px; }
    .sx-row > .sx-status { padding-top: 0; font-size: 0.82rem; }
    .sx-avatar { width: 36px; height: 36px; font-size: 1.15rem; border-radius: 10px; }
    .sx-row--block { grid-template-columns: 70px minmax(0, 1fr); }
}

/* up next (phone / tablet; the desktop panel already shows it) */
.sx-upnext { background: linear-gradient(135deg, var(--sx-hero), var(--sx-hero-2)); color: #fff; border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 12px;
    box-shadow: 0 8px 22px rgba(47, 90, 55, 0.28); }
.sx-upnext-head { background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 0; }
.sx-upnext-eyebrow { font-weight: 700; display: inline-flex; gap: 6px; align-items: center; font-size: 0.92rem; }
.sx-upnext-when { font-weight: 700; font-size: 0.92rem; opacity: 0.95; }
.sx-upnext-who { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; min-width: 0; }
.sx-upnext-who > span:last-child { display: flex; flex-direction: column; min-width: 0; font-size: 1rem; }
.sx-upnext-who strong { font-family: var(--sx-head); font-size: 1.25rem; font-weight: 600; }
.sx-upnext-who small { opacity: 0.9; font-size: 0.86rem; }
.sx-avatar--onbrand { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.35); color: #fff; }
.sx-upnext-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.sx-upnext-actions .sx-btn { padding: 0 8px; font-size: 0.9rem; min-width: 0; }
.sx-btn--light { background: #fff; color: var(--sx-hero); }
.sx-btn--ghost-light { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.4); color: #fff; }
@media (min-width: 1200px) { .sx-body.has-panel .sx-upnext { display: none; } }

/* detail panel / sheet */
.sx-panel { min-width: 0; }
.sx-detail { background: var(--cx-surface); border: 1px solid var(--sx-line); border-radius: 20px; overflow: hidden; box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08); }
.sx-detail--empty { padding: 28px 18px; }
.sx-hero { background: linear-gradient(160deg, var(--sx-hero), var(--sx-hero-2)); color: #fff; padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.sx-hero--block { background: linear-gradient(160deg, #475569, #64748b); }
.sx-hero--requested { background: linear-gradient(160deg, #8a4b0c, #a65f14); }
.sx-hero-top { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; font-weight: 600; }
.sx-hero-top > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.sx-hero-top > span:nth-child(2) { margin-left: auto; opacity: 0.9; font-weight: 500; }
.sx-hero-close { width: 36px; height: 36px; border-color: rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.1); color: #fff; }
.sx[data-view="list"] .sx-panel .sx-hero-close, .sx[data-view="day"] .sx-panel .sx-hero-close { display: none; }
.sx-hero-time { font-family: var(--sx-head); font-size: 2.2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.sx-hero-time small { font-family: 'Inter', system-ui, sans-serif; font-size: 1rem; font-weight: 500; letter-spacing: 0; opacity: 0.92; }
.sx-hero-who { display: flex; gap: 14px; align-items: center; min-width: 0; }
.sx-avatar--hero { width: 60px; height: 60px; font-size: 2rem; border-radius: 16px; background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.35); color: #fff; }
.sx-hero-names { display: flex; flex-direction: column; min-width: 0; font-size: 1rem; }
.sx-hero-names strong { font-family: var(--sx-head); font-size: 1.35rem; font-weight: 600; }
.sx-hero-names a { color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, 0.45); }
.sx-hero-names a:hover { border-bottom-color: #fff; }
.sx-hero-names .sx-species { color: rgba(255, 255, 255, 0.85); }
.sx-hero-names small { opacity: 0.92; font-size: 0.92rem; margin-top: 2px; overflow-wrap: anywhere; }
.sx-hero-meta { display: flex; gap: 6px 18px; flex-wrap: wrap; font-size: 0.92rem; }
.sx-hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.sx-detail-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.sx-primary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sx-primary:has(> :only-child) { grid-template-columns: 1fr; }
.sx-primary:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sx-btn--tile { flex-direction: column; gap: 6px; min-height: 76px; padding: 10px 6px; background: var(--sx-soft); color: var(--cx-brand-ink); border-radius: 14px; white-space: normal; text-align: center; line-height: 1.15; font-size: 0.9rem; }
.sx-btn--tile i { font-size: 1.5rem; }
.sx-btn--tile.sx-btn--brand { background: var(--sx-hero); color: #fff; }
.sx-secondary { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
/* ECHOCAL-1678 OQ1677-30 (owner review 2026-11-20 V12): Record Note -- full width under Create Note / Create Invoice, tile style */
.sx-record { display: grid; grid-template-columns: 1fr; }
.sx-secondary .sx-btn { padding: 0 8px; min-width: 0; }
.sx-info { display: flex; flex-direction: column; }
.sx-info-row { display: flex; gap: 12px; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--sx-line); font-size: 0.93rem; }
.sx-info-row:last-child { border-bottom: 0; }
.sx-info-k { color: var(--cx-text-2); flex: 0 0 auto; }
.sx-info-v { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.sx-info-row--notes { flex-direction: column; gap: 4px; }
.sx-info-row--notes .sx-info-v { text-align: left; white-space: pre-wrap; }
.sx-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
/* Owner review 2026-11-20 (V12): one or two stats use the whole width, so "First visit" is never cut to "First vi..." */
.sx-stats:has(> :only-child) { grid-template-columns: 1fr; }
.sx-stats:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sx-stat { background: var(--cx-surface-2); border: 1px solid var(--sx-line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; min-width: 0; }
.sx-stat strong { font-family: var(--sx-head); font-size: 1.05rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sx-stat span { font-size: 0.78rem; color: var(--cx-text-2); }
.sx-menu { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--sx-line); border-radius: 14px; background: var(--cx-surface); display: flex; flex-direction: column; }
.sx-menu .sx-detail-body .sx-eyebrow { margin: 4px 0 0; }
.sx-menu-item { width: 100%; justify-content: flex-start; background: none; border: 0; border-radius: 10px; min-height: 46px; font-weight: 500; padding: 0 12px; }
.sx-menu-item:hover { background: var(--cx-surface-2); }
.sx-detail-body > .sx-eyebrow { margin: 6px 0 -4px; }
#placeholderIntakeStatus.is-problem { color: #b91c1c; }

.sx-sheet-overlay { position: fixed; inset: 0; z-index: 10050; background: rgba(15, 23, 42, 0.45); display: none; align-items: flex-end; justify-content: center; }
.sx-sheet-overlay.is-open { display: flex; }
.sx-sheet { width: 100%; max-width: 640px; max-height: 90vh; max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--cx-surface);
    border-radius: 22px 22px 0 0; position: relative; animation: sx-up 200ms ease-out; padding-bottom: env(safe-area-inset-bottom, 0); }
.sx-sheet .sx-detail { border: 0; border-radius: 0; box-shadow: none; }
.sx-grip { position: absolute; top: 6px; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: rgba(255, 255, 255, 0.6); z-index: 1; }
.sx-sheet .sx-hero { padding-top: 20px; }
@keyframes sx-up { from { transform: translateY(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sx-sheet { animation: none; } }
body.sx-sheet-open { overflow: hidden; }

/* day timeline */
.sx-day .sx-summary--inline { border-bottom: 1px solid var(--sx-line); margin-bottom: 4px; }
.sx-tl-scroll { max-height: max(440px, calc(100vh - 330px)); max-height: max(440px, calc(100dvh - 330px)); overflow-y: auto; margin: 0 -6px; padding: 0 6px; overscroll-behavior: contain; }
.sx-tl { position: relative; margin-top: 8px; cursor: copy; }
.sx-hour { position: absolute; left: 0; right: 0; border-top: 1px solid var(--sx-line); height: 0; }
.sx-hour span { position: absolute; left: 0; top: -9px; font-size: 0.75rem; font-weight: 600; color: var(--cx-text-2); background: var(--cx-surface); padding-right: 6px; }
.sx-tl-lane { position: absolute; left: 58px; right: 0; top: 0; bottom: 0; }
.sx-off { position: absolute; left: 0; right: 0; pointer-events: none;
    background: repeating-linear-gradient(-45deg, transparent, transparent 7px, color-mix(in srgb, var(--cx-text-2) 7%, transparent) 7px, color-mix(in srgb, var(--cx-text-2) 7%, transparent) 14px); }
.sx-tl-item { --sx-acc: var(--sx-clinic); position: absolute; display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 14px; border-radius: 12px; border: 1px solid var(--sx-line);
    background: var(--sx-row-bg); color: var(--cx-text); font: inherit; text-align: left; cursor: pointer; overflow: hidden; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06); z-index: 1; }
.sx-tl-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--sx-acc); }
.sx-tl-item:hover { box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1); z-index: 2; }
.sx-tl-item.is-selected { border-color: var(--cx-brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--cx-brand) 35%, transparent); background: color-mix(in srgb, var(--sx-soft) 55%, var(--sx-row-bg)); }
.sx-tl-item.is-compact { padding-top: 2px; padding-bottom: 2px; }
.sx-tl-item--block { color: var(--cx-text-2); box-shadow: none;
    background: repeating-linear-gradient(-45deg, var(--cx-surface-2), var(--cx-surface-2) 8px, color-mix(in srgb, var(--cx-text-2) 8%, var(--cx-surface-2)) 8px, color-mix(in srgb, var(--cx-text-2) 8%, var(--cx-surface-2)) 16px); }
.sx-tl-time { display: flex; flex-direction: column; font-weight: 700; font-size: 0.9rem; white-space: nowrap; flex: 0 0 auto; min-width: 66px; }
.sx-tl-time small { font-weight: 500; color: var(--cx-text-2); font-size: 0.76rem; }
.sx-tl-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.25; }
.sx-tl-main small { color: var(--cx-text-2); font-size: 0.82rem; }
.sx-tl-item .sx-status { margin-left: auto; flex: 0 0 auto; }
.sx-st--completed .sx-tl-main strong { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--cx-text-2) 60%, transparent); color: var(--cx-text-2); }
.sx-now { position: absolute; left: -6px; right: 0; height: 0; border-top: 2px solid var(--sx-now); z-index: 3; pointer-events: none; }
.sx-now::before { content: ''; position: absolute; left: -6px; top: -7px; width: 12px; height: 12px; border-radius: 50%; background: var(--sx-now); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2); }
.sx-now span { position: absolute; left: -64px; top: -11px; background: var(--sx-now); color: #fff; font-size: 0.72rem; font-weight: 700; border-radius: 6px; padding: 2px 6px; }
.sx-now--wk { left: 0; }
.sx-now--wk::before { left: -4px; top: -5px; width: 8px; height: 8px; box-shadow: none; }
.sx-closed { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: var(--cx-surface-2); color: var(--cx-text-2); font-weight: 600; margin-bottom: 8px; }
.sx-closed .sx-btn { margin-left: auto; }
.sx-notime { margin-top: 12px; border-top: 1px solid var(--sx-line); }
@container (max-width: 560px) {
    .sx-tl-lane { left: 44px; }
    .sx-hour span { font-size: 0.7rem; }
    .sx-tl-item { gap: 8px; padding-left: 10px; }
    .sx-tl-time { min-width: 0; font-size: 0.82rem; }
    .sx-tl-item .sx-avatar { display: none; }
    .sx-tl-item .sx-status .sx-hide-narrow { display: none; }
    .sx-tl-item.sx-st--cancelled .sx-status .sx-hide-narrow, .sx-tl-item.sx-st--no_show .sx-status .sx-hide-narrow,
    .sx-tl-item.sx-st--in_room .sx-status .sx-hide-narrow { display: inline; }   /* past / special states keep their word */
    .sx-now span { display: none; }
}

/* week */
.sx-week { padding: 14px 12px; }
.sx-wk-head { display: grid; grid-template-columns: 48px repeat(7, minmax(0, 1fr)); gap: 0; margin-bottom: 6px; }
.sx-wk-day { background: none; border: 0; font: inherit; color: var(--cx-text); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; border-radius: 12px; min-width: 0; }
.sx-wk-day:hover { background: var(--cx-surface-2); }
.sx-wk-dow { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cx-text-2); }
.sx-wk-num { font-family: var(--sx-head); font-size: 1.45rem; font-weight: 700; width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.sx-wk-day.is-today .sx-wk-num { background: var(--sx-hero); color: #fff; }
.sx-wk-day.is-today .sx-wk-dow { color: var(--cx-brand-ink); }
.sx-wk-day.is-selected:not(.is-today) .sx-wk-num { box-shadow: inset 0 0 0 2px var(--cx-brand); }
.sx-wk-day.is-closed { opacity: 0.55; }
.sx-wk-n { font-size: 0.8rem; color: var(--cx-text-2); }
.sx-wk-grid { position: relative; }
.sx-wk-hours { position: absolute; inset: 0; }
.sx-wk-hours .sx-hour span { width: 44px; }
.sx-wk-cols { position: absolute; left: 48px; right: 0; top: 0; bottom: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.sx-wk-col { position: relative; border-left: 1px solid var(--sx-line); cursor: copy; min-width: 0; }
.sx-wk-col.is-today { background: color-mix(in srgb, var(--sx-soft) 55%, transparent); }
.sx-wk-item { --sx-acc: var(--sx-clinic); position: absolute; border-radius: 8px; border: 1px solid var(--sx-line); background: var(--sx-row-bg); font: inherit; font-size: 0.8rem;
    text-align: left; padding: 3px 6px 3px 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; color: var(--cx-text); z-index: 1; line-height: 1.25; }
.sx-wk-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--sx-acc); }
.sx-wk-item.is-selected { border-color: var(--cx-brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--cx-brand) 35%, transparent); }
.sx-wk-time { color: var(--cx-text-2); font-weight: 600; }
.sx-st--completed.sx-wk-item strong { text-decoration: line-through; color: var(--cx-text-2); }
.sx-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--sx-line); font-size: 0.86rem; color: var(--cx-text-2); align-items: center; }
.sx-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.sx-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
@container (max-width: 560px) {
    .sx-week { padding: 10px 6px; }
    .sx-wk-head { grid-template-columns: 30px repeat(7, minmax(0, 1fr)); }
    .sx-wk-cols { left: 30px; }
    .sx-wk-hours .sx-hour span { font-size: 0.68rem; width: 28px; }
    .sx-wk-hours .sx-hl-full { display: none; }
    .sx-wk-hours .sx-hl-short { display: inline; }
    .sx-wk-num { width: 32px; height: 32px; font-size: 1.05rem; }
    .sx-wk-dow { font-size: 0.66rem; letter-spacing: 0.02em; }
    .sx-wk-item { font-size: 0.7rem; padding: 2px 3px 2px 5px; white-space: nowrap; text-overflow: clip; line-height: 1.2; }
    .sx-wk-item .sx-wk-room { display: none; }
    .sx-wk-item .sx-wk-time { display: none; }
    .sx-hide-narrow { display: none; }
    .sx-show-narrow { display: inline; }
}

/* month (classic numbered colour circles) */
.sx-month { padding: 14px; }
.sx-mo-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.sx-mo-dow { text-align: center; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cx-text-2); padding: 4px 0 6px; }
.sx-mo-cell { min-height: 96px; border-radius: 14px; border: 1px solid var(--sx-line); background: var(--cx-surface); display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 10px 4px; font: inherit; color: var(--cx-text); cursor: pointer; min-width: 0; }
.sx-mo-cell:hover { border-color: var(--cx-brand); }
.sx-mo-cell.is-outside { background: none; border-color: transparent; color: var(--cx-text-2); opacity: 0.5; cursor: default; }
.sx-mo-num { font-family: var(--sx-head); font-weight: 600; font-size: 1.1rem; }
.sx-mo-cell.is-today { background: var(--sx-soft); border: 2px solid var(--sx-hero); }
.sx-mo-cell.is-selected:not(.is-today) { box-shadow: 0 0 0 2px var(--cx-brand); }
.sx-mo-cell.is-selected.is-today { box-shadow: 0 0 0 3px color-mix(in srgb, var(--cx-brand) 30%, transparent); }
.sx-circles { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }
.sx-circle { width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 0.72rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
    font-variant-numeric: tabular-nums; line-height: 1; flex: 0 0 auto; }
.sx-legend--month .sx-circle { width: 20px; height: 20px; }
.sx-legend-note { margin-left: auto; }
@container (max-width: 560px) {
    .sx-month { padding: 10px 6px; }
    .sx-mo-grid { gap: 4px; }
    .sx-mo-cell { min-height: 64px; padding: 6px 1px; gap: 5px; border-radius: 10px; }
    .sx-mo-num { font-size: 0.95rem; }
    .sx-circle { width: 18px; height: 18px; font-size: 0.66rem; }
    .sx-circles { gap: 2px; }
    .sx-legend-note { margin-left: 0; }
}

/* phone + tablet */
@media (max-width: 1024px) {
    .sx-head { align-items: center; }
    .sx-head h1 { font-size: 1.85rem; }
    .sx-filters { margin-left: 0; width: 100%; }
    .sx-search { flex: 1 1 200px; }
    .sx-search input { width: 100%; }
}
@media (max-width: 640px) {
    .sx { gap: 12px; }
    .sx-head { flex-wrap: nowrap; align-items: flex-end; }
    .sx-head-actions { flex-wrap: nowrap; }
    .sx-head h1 { font-size: 1.7rem; }
    .sx-subtitle { font-size: 0.85rem; }
    .sx-head-actions .sx-btn--outline span { display: none; }
    .sx-head-actions .sx-btn--outline { width: 44px; padding: 0; }
    .sx-hide-narrow { display: none; }
    .sx-show-narrow { display: inline; }
    .sx-toolbar { gap: 10px; }
    .sx-switch { width: 100%; }
    .sx-switch-btn { flex: 1 1 0; justify-content: center; padding: 0 6px; }
    .sx-nav { width: 100%; }
    .sx-nav-label { font-size: 1.08rem; overflow: hidden; text-overflow: ellipsis; }
    .sx-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .sx-search { grid-column: 1 / -1; }
    .sx-select select { max-width: none; width: 100%; }
    .sx-tabs { gap: 8px; justify-content: space-between; }
    .sx-tab { font-size: 0.86rem; }
    .sx-summary { padding: 12px 14px; }
    .sx-summary-next { margin-left: 0; }
    .sx-card { padding: 12px; border-radius: 16px; }
    .sx-hero-time { font-size: 1.9rem; }
    .sx-hint { text-align: left; }
}

/* ---- owner 2026-11-09: Go to date, past visits clearly marked, rooms + room call, reminder / intake status ---- */
.sx-goto { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border-radius: 12px;
    border: 1px solid var(--sx-line); background: var(--cx-surface); color: var(--cx-text); font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.sx-goto input { border: 0; background: transparent; font: inherit; font-weight: 500; color: var(--cx-text); max-width: 150px; min-width: 0; cursor: pointer; }
.sx-goto:focus-within { border-color: var(--cx-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cx-focus) 25%, transparent); }
.sx-goto-text { white-space: nowrap; }
.sx-st--cancelled .sx-name, .sx-st--no_show .sx-name, .sx-st--cancelled .sx-tl-main strong, .sx-st--no_show .sx-tl-main strong,
.sx-st--cancelled.sx-wk-item strong, .sx-st--no_show.sx-wk-item strong { text-decoration: line-through; text-decoration-color: color-mix(in srgb, #b91c1c 55%, transparent); }
.sx-st--cancelled, .sx-st--no_show { opacity: 0.9; }
.sx-status--in_room { color: #15803d; font-weight: 700; }
[data-theme="dark"] .sx-status--in_room { color: #86efac; }
.sx-wk-room { color: var(--cx-text-2); font-weight: 500; }
.sx-ok { color: #15803d; font-weight: 600; }
.sx-warn { color: #b45309; font-weight: 600; }
[data-theme="dark"] .sx-ok { color: #86efac; } [data-theme="dark"] .sx-warn { color: #fdba74; }
.sx-info-row--room { flex-wrap: wrap; align-items: center; }
.sx-info-row--room .sx-info-v { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.sx-room-select { min-height: 40px; border-radius: 10px; border: 1px solid var(--sx-line); background: var(--cx-surface); color: var(--cx-text); font: inherit; font-weight: 600; padding: 0 10px; }
.sx-roomcall { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88rem; font-weight: 600; text-align: right; }
.sx-roomcall--ok { color: #15803d; }
.sx-roomcall--warn { color: #b45309; }
.sx-roomcall--info { color: var(--cx-text-2); }
[data-theme="dark"] .sx-roomcall--ok { color: #86efac; } [data-theme="dark"] .sx-roomcall--warn { color: #fdba74; }
.sx-roomcall--info i { animation: sx-spin 900ms linear infinite; }
@keyframes sx-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sx-roomcall--info i { animation: none; } }
/* Setup > Rooms */
#sxRoomsCard h3 { display: flex; align-items: center; gap: 8px; }
.sx-rooms-card .sx-room-list { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: room; }
.sx-room-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sx-room-item.is-archived .sx-room-name { opacity: 0.6; }
.sx-room-name, #sxRoomNew { flex: 1 1 180px; min-height: 40px; border: 1px solid var(--sx-line, #dfe5e1); border-radius: 10px; padding: 0 10px; font: inherit; background: var(--cx-surface, #fff); color: var(--cx-text); min-width: 0; }
.sx-rooms-card .sx-icon-btn { width: 40px; height: 40px; }
.sx-room-add { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }
.sx-room-sms { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; line-height: 1.4; cursor: pointer; }
.sx-room-sms input { margin-top: 4px; width: 18px; height: 18px; }
@media (max-width: 640px) { .sx-goto-text { display: none; } .sx-goto input { max-width: 130px; } }
.sx-roomwarn { display: inline-flex; align-items: center; gap: 6px; color: #b45309; font-weight: 600; font-size: 0.88rem; text-align: right; }
#appointmentRoomWarning.sx-roomwarn { display: block; text-align: left; margin-top: 6px; }
[data-theme="dark"] .sx-roomwarn { color: #fdba74; }

/* IOS-16PX (lane/1674-rd-int; owner rule for the redesign: iOS inputs are at least 16px). iOS Safari zooms the whole page when
   a field under 16px gets focus; on phones / tablets / touch screens every field of this page and its sheet is 16px.
   Measured by tests/journeys/redesign1674_fit_browser.cjs F2 at 360 / 390. */
@media (max-width: 1024px), (pointer: coarse) {
    #sxRoot input, #sxRoot select, #sxRoot textarea, #sxSheet input, #sxSheet select, #sxSheet textarea { font-size: 16px; }
}

/* PERM-ROOMCALL-1674: why the room picker is not offered (no permission to call patients to a room) */
.sx-perm-hint { display: block; margin-top: 4px; font-size: 0.85rem; color: var(--cx-text-2); }
