:root {
    --ink: #0f2740;            /* primary text */
    --ink-soft: #51647a;      /* secondary text */
    --muted: #8595a6;         /* tertiary / captions */
    --line: #e7ecf3;          /* hairline borders */
    --surface: #ffffff;       /* cards */
    --bg: #eef2f8;            /* app background */
    --accent: #2a6fb0;
    --accent-2: #43a7e8;
    --accent-grad: linear-gradient(135deg, #43a7e8 0%, #2a6fb0 100%);
    --brand: #2a6fb0;         /* primary brand = accent (active tabs, badges, highlights) */
    --shadow: 0 6px 20px -6px rgba(15, 39, 64, .16), 0 2px 6px -2px rgba(15, 39, 64, .06);
    --teal: #34c8a0;
    --good: #16a36b;
    --warn: #e0a000;
    --bad: #e0483d;
    --surface-2: #f4f7fb;     /* tint fills (tenure cells, foot rows, hovers) */
    --hover: #eef3f9;         /* row hover / selected */
    --field: #ffffff;         /* input background */
    --topbar-bg: rgba(255, 255, 255, .85);
    --radius: 14px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(15, 39, 64, .06);
    --shadow-md: 0 6px 20px -6px rgba(15, 39, 64, .16), 0 2px 6px -2px rgba(15, 39, 64, .06);
    --shadow-lg: 0 18px 44px -10px rgba(15, 39, 64, .22);
    --font: 'Plus Jakarta Sans', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

html[data-theme="dark"] {
    --ink: #e8eef5;
    --ink-soft: #a3b4c6;
    --muted: #7a8da3;
    --line: #2a3a4c;
    --surface: #18232f;
    --surface-2: #1f2c3a;
    --hover: #243340;
    --field: #1b2733;
    --bg: #0d1825;
    --good: #35cf8e;
    --warn: #f0b22e;
    --bad: #f26b60;
    --topbar-bg: rgba(16, 26, 38, .8);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 8px 24px -6px rgba(0, 0, 0, .5);
    --shadow-lg: 0 20px 48px -10px rgba(0, 0, 0, .6);
    --shadow: 0 8px 24px -6px rgba(0, 0, 0, .5);
    --brand: #43a7e8;
    color-scheme: dark;
}

/* dark: bootstrap + form surfaces the tokens don't reach on their own */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select { background-color: var(--field); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .form-control::placeholder { color: var(--muted); }
html[data-theme="dark"] .table { color: var(--ink); --bs-table-bg: transparent; --bs-table-color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .table > :not(caption) > * > * { border-color: var(--line); }
html[data-theme="dark"] .btn-outline-primary { color: var(--accent-2); border-color: var(--accent); }
html[data-theme="dark"] .btn-outline-secondary { color: var(--ink-soft); border-color: var(--line); }

html, body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a, .btn-link {
    color: var(--accent);
}

.btn-primary {
    color: #fff;
    background-image: var(--accent-grad);
    background-color: #2a6fb0;
    border: none;
    box-shadow: 0 2px 8px -1px rgba(42, 111, 176, .4);
}
.btn-primary:hover { filter: brightness(1.05); color: #fff; }

/* premium surfaces + interactions */
article.content { background: var(--bg); }
.panel, .kpi-card, .fin-card, .card-box, .summary-wrap, .rev-item, .import-panel, .msg-list, .msg-thread {
    border-color: var(--line);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .18s ease, transform .18s ease;
}
.panel:hover, .kpi-card:hover, .fin-card:hover { box-shadow: var(--shadow-md); }
.btn { transition: filter .15s ease, box-shadow .15s ease, border-color .15s ease; }

/* crisp, tightly-tracked numerals read premium */
.hero-value, .kpi-value, .md-val, .mq-val, .fin-card-value, .tenure-val, .login-brand { letter-spacing: -.015em; }

/* accent buttons share the brand gradient */
.add-kpi-btn { background-image: var(--accent-grad); border: none; box-shadow: 0 2px 8px -1px rgba(42,111,176,.4); }
.add-kpi-btn:hover { filter: brightness(1.05); background-image: var(--accent-grad); }

/* office switcher: brand-tinted active state */
.office-item.active { background: linear-gradient(90deg, rgba(67,167,232,.28), rgba(67,167,232,.06)); box-shadow: inset 3px 0 0 #43a7e8; }
.office-dot { background: var(--teal); box-shadow: 0 0 0 3px rgba(52,200,160,.18); }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ---- Nodi dashboard ---- */
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
    border-bottom: 2px solid var(--line);
    padding-bottom: .75rem;
    margin-bottom: 1.25rem;
}
.dash-header h1 { margin: 0; font-size: 1.95rem; font-weight: 800; color: var(--ink); letter-spacing: -.022em; }
.dash-sub { color: var(--ink-soft); font-size: .9rem; }
.dash-controls { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.add-kpi-btn { display: inline-flex; align-items: center; gap: .3rem; background: #2a6fb0; color: #fff; border: none; border-radius: 6px; padding: .4rem .8rem; font-size: .9rem; font-weight: 600; cursor: pointer; }
.add-kpi-btn:hover { background: #225d96; }
.goals-btn { display: inline-flex; align-items: center; gap: .3rem; background: var(--surface); color: var(--ink-soft); border: 1px solid #ced4da; border-radius: 6px; padding: .4rem .8rem; font-size: .9rem; cursor: pointer; }
.goals-btn:hover { border-color: #2a6fb0; }

/* goal status coloring + editor */
.val-good { color: #2fa36b; }
.val-warn { color: #e6a700; }
.val-bad { color: #d6453d; }
.kpi-goal { font-size: .75rem; margin-top: .15rem; opacity: .85; }
.goal-row { display: flex; align-items: center; gap: .5rem; padding: .3rem .25rem; border-bottom: 1px solid var(--line); }
.goal-name { flex: 1; font-size: .88rem; color: var(--ink-soft); }
.goal-dir { color: #8595a6; font-weight: 700; }
.goal-input { width: 7rem; }
.goal-unit { width: 1rem; color: #8595a6; }

/* removable user cards */
.panel-title { display: flex; align-items: center; }
.card-remove { margin-left: auto; border: none; background: transparent; color: #c2ccd8; font-size: 1.15rem; line-height: 1; cursor: pointer; padding: 0 .1rem; }
.card-remove:hover { color: #d6453d; }

/* Add-KPI picker */
.picker-modal { background: var(--surface); border-radius: 10px; width: min(560px, 96vw); max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(20,48,74,.3); padding: 1.1rem 1.3rem 1rem; }
.picker-search { margin-bottom: .6rem; }
.picker-list { overflow-y: auto; }
.picker-cat { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: #8595a6; margin: .7rem 0 .2rem; }
.picker-item { display: flex; align-items: center; gap: .5rem; width: 100%; text-align: left; background: transparent; border: none; border-radius: 5px; padding: .4rem .5rem; font-size: .9rem; color: var(--ink-soft); cursor: pointer; }
.picker-item:hover { background: var(--hover); }
.picker-item.added { color: var(--ink); font-weight: 600; }
.picker-item .chk { width: 1rem; color: #2fa36b; font-weight: 700; text-align: center; }
.picker-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .5rem; }
.picker-count { font-size: .85rem; color: var(--ink-soft); }
.picker-actions { display: flex; gap: .5rem; }
.picker-btn { border: 1px solid #ced4da; background: var(--surface); border-radius: 6px; padding: .35rem .75rem; font-size: .85rem; cursor: pointer; color: var(--ink-soft); }
.picker-btn:hover:not(:disabled) { border-color: #2a6fb0; }
.picker-btn.primary { background: #2a6fb0; color: #fff; border-color: #2a6fb0; }
.picker-btn:disabled { opacity: .5; cursor: default; }

/* multi-metric cards */
.multi-row { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.multi-row:last-child { border-bottom: none; }
.multi-label { flex: 1; font-size: .85rem; color: var(--ink-soft); }
.multi-val { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* trend modal date range */
.trend-head-controls { display: flex; align-items: center; gap: .6rem; }
.trend-range { width: auto; }
.dash-period { display: flex; align-items: center; gap: .5rem; }

/* provider multi-select */
.prov-filter { position: relative; }
.prov-filter-btn { display: inline-flex; align-items: center; gap: .4rem; background: var(--surface); border: 1px solid #ced4da; border-radius: 6px; padding: .4rem .7rem; font-size: .9rem; color: var(--ink-soft); cursor: pointer; }
.prov-filter-btn:hover { border-color: #2a6fb0; }
.caret { color: #8595a6; font-size: .75rem; }
.prov-backdrop { position: fixed; inset: 0; z-index: 40; }
.prov-panel { position: absolute; right: 0; top: calc(100% + 4px); z-index: 50; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(20,48,74,.18); padding: .4rem; min-width: 240px; max-height: 380px; overflow-y: auto; }
.prov-grp { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: #8595a6; padding: .45rem .5rem .15rem; }
.prov-opt { display: flex; align-items: center; gap: .5rem; width: 100%; background: transparent; border: none; text-align: left; padding: .35rem .5rem; border-radius: 5px; font-size: .88rem; color: var(--ink-soft); cursor: pointer; }
.prov-opt:hover { background: var(--hover); }
.prov-opt.sel { color: var(--ink); font-weight: 600; }
.prov-opt .chk { width: 1rem; color: #2fa36b; font-weight: 700; }
.prov-all { border-bottom: 1px solid var(--line); border-radius: 0; margin-bottom: .2rem; }
.dash-period label { font-size: .8rem; color: var(--ink-soft); margin: 0; }
.dash-period .form-select { width: auto; min-width: 12rem; }
.dash-period .date-input { width: auto; }
.dash-period .date-sep { color: var(--ink-soft); }

.group-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 1.2rem 0 .55rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .9rem;
}
.kpi-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid #cfd8e3;
    border-radius: 8px;
    padding: .85rem 1rem;
    box-shadow: 0 1px 2px rgba(20, 48, 74, .04);
}
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; }
.kpi-expand {
    border: none;
    background: transparent;
    color: #b6c2d0;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0 0 .4rem;
}
.kpi-expand:hover { color: #2a6fb0; }
.kpi-label { font-size: .78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--ink); line-height: 1.2; margin-top: .15rem; }
.kpi-sub { font-size: .78rem; color: #8595a6; margin-top: .15rem; }
.kpi-good { border-left-color: #2fa36b; }
.kpi-warn { border-left-color: #e6a700; }
.kpi-bad  { border-left-color: #d6453d; }

/* office switcher (left nav, dark sidebar) */
.office-switcher { padding: .75rem 1rem .55rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.office-switcher-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: rgba(255,255,255,.5); margin-bottom: .35rem; }
.office-item { display: flex; align-items: center; gap: .5rem; width: 100%; background: transparent; border: none; color: #d7d7d7; padding: .35rem .45rem; border-radius: 6px; font-size: .88rem; text-align: left; cursor: pointer; }
.office-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.office-item.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }
.office-dot { width: 8px; height: 8px; border-radius: 50%; background: #6fe7c6; flex: none; }

/* panel grid */
.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: .7rem;
    align-items: start;
}
/* AR is its own bottom section — keep it from stretching full width */
.panel-grid-ar { grid-template-columns: minmax(320px, 560px); }

.panel-title { cursor: grab; user-select: none; }
.panel-title:active { cursor: grabbing; }
.panel-ghost { opacity: .4; }
.panel-title::before {
    content: "⠿";
    color: #c2ccd8;
    margin-right: .45rem;
    font-size: .95rem;
    vertical-align: 1px;
}
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.panel-title { font-size: 1.05rem; font-weight: 700; color: var(--ink); padding: .75rem 1.1rem .15rem; }
.panel-body { padding: .35rem 1.1rem .8rem; }
.panel-sub { font-size: .8rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; margin: 1rem 0 .5rem; }
.panel-note { font-size: .78rem; color: #93a1b2; margin: .6rem 0 0; }
.panel-foot { border-top: 1px solid var(--line); background: var(--surface-2); padding: .4rem 1.1rem; }

.hero { margin-top: .3rem; }
.hero-label { font-size: .85rem; color: var(--ink-soft); }
.hero-row { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.hero-value { font-size: 1.8rem; font-weight: 700; color: var(--ink); }
.goal-tag { flex-basis: 100%; font-size: .72rem; color: #8595a6; margin-top: .05rem; }
.goal-tag.val-good { color: #2fa36b; }
.goal-tag.val-warn { color: #e6a700; }
.goal-tag.val-bad { color: #d6453d; }

.tenure-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-top: .3rem; }
.tenure-cell { background: var(--surface-2); border-radius: 6px; padding: .5rem .25rem; text-align: center; }
.tenure-val { display: block; font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.tenure-lbl { display: block; font-size: .72rem; color: var(--ink-soft); }

.metric-duo { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: .8rem; }
.metric-quad { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem .8rem; margin-top: .4rem; }
.md-label, .mq-label { font-size: .8rem; color: var(--ink-soft); }
.md-row { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.md-val, .mq-val { font-size: 1.35rem; font-weight: 700; color: var(--ink); }

.foot-row { display: flex; align-items: center; gap: .5rem; padding: .22rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.foot-goal { flex-basis: 100%; font-size: .7rem; color: #8595a6; }
.foot-goal.val-good { color: #2fa36b; }
.foot-goal.val-warn { color: #e6a700; }
.foot-goal.val-bad { color: #d6453d; }
.foot-row:last-child { border-bottom: none; }
.foot-label { flex: 1; font-size: .85rem; color: var(--ink-soft); }
.foot-val { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.foot-spacer { width: 1.1rem; display: inline-block; }

.gauge { width: 64px; height: 36px; }
.gauge-bg { fill: none; stroke: var(--line); stroke-width: 9; stroke-linecap: round; }
.gauge-val { fill: none; stroke: #2fa36b; stroke-width: 9; stroke-linecap: round; }

.subgroup-title {
    font-size: .9rem;
    font-weight: 600;
    color: var(--ink-soft);
    margin: 1.1rem 0 .6rem;
}
.prod-split {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1.1rem 1.4rem;
    flex-wrap: wrap;
}
.prod-donut { width: 150px; height: 150px; flex: none; }
.prod-donut-total { font-size: 15px; font-weight: 700; fill: var(--ink); }
.prod-donut-cap { font-size: 8px; font-weight: 600; fill: #8595a6; letter-spacing: .08em; }
.prod-legend { display: flex; flex-direction: column; gap: .6rem; }
.legend-row { display: flex; align-items: center; gap: .6rem; font-size: .95rem; color: var(--ink-soft); }
.legend-row .sw { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.legend-row .sw-doc { background: linear-gradient(135deg, #43a7e8, #2a6fb0); }
.legend-row .sw-hyg { background: linear-gradient(135deg, #9fd4f5, #7fb3e3); }
.legend-name { width: 4.5rem; }
.legend-amt { font-weight: 700; color: var(--ink); min-width: 6rem; }
.legend-pct { color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.split-legend { display: flex; flex-direction: column; gap: .45rem; margin-top: .3rem; }

.ar-aging { margin-top: 1rem; max-width: 640px; }
.ar-row { display: flex; align-items: center; gap: .75rem; margin-bottom: .4rem; }
.ar-label { width: 4rem; font-size: .85rem; color: var(--ink-soft); text-align: right; }
.ar-bar-track { flex: 1; background: var(--line); border-radius: 4px; height: 16px; overflow: hidden; }
.ar-bar { background: linear-gradient(90deg, #43a7e8, #2a6fb0); height: 100%; border-radius: 4px; transition: width .5s cubic-bezier(.4, 0, .2, 1); }
.rev-bar { transition: height .5s cubic-bezier(.4, 0, .2, 1); }
.prod-donut circle { transition: stroke-dasharray .6s ease, stroke-dashoffset .6s ease; }
.ar-amt { width: 6.5rem; font-size: .85rem; font-weight: 600; color: var(--ink); }

.prov-table thead th { font-size: .78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .02em; }
.prov-table td, .prov-table th { vertical-align: middle; }
.prov-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* provider selector */
.prov-filter { margin: .25rem 0 1.25rem; }
.prov-filter-panel { margin-top: .6rem; padding: .8rem 1rem; background: var(--surface-2); border: 1px solid #e3e9f0; border-radius: 8px; max-width: 720px; }
.prov-filter-actions { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.prov-filter-group { margin-bottom: .5rem; }
.prov-filter-grouplbl { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-soft); margin-bottom: .3rem; }
.prov-check { display: inline-flex; align-items: center; gap: .35rem; margin: 0 1rem .35rem 0; font-size: .9rem; color: var(--ink-soft); cursor: pointer; }
.prov-check input { cursor: pointer; }

/* login — split brand panel + form */
.auth-split { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }
.auth-brand {
    position: relative; overflow: hidden; display: flex; align-items: center; padding: 3.5rem;
    background-image:
        radial-gradient(80% 60% at 85% 15%, rgba(67,167,232,.35) 0%, rgba(67,167,232,0) 55%),
        radial-gradient(70% 55% at 10% 90%, rgba(52,200,160,.28) 0%, rgba(52,200,160,0) 55%),
        linear-gradient(150deg, #0c2237 0%, #0a1a2c 100%);
    color: #fff;
}
.auth-brand::after {
    content: ""; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px);
    background-size: 22px 22px; opacity: .5; pointer-events: none;
}
.auth-brand-inner { position: relative; max-width: 460px; }
.auth-tagline { font-size: 2.1rem; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; margin: 1.8rem 0 .7rem; }
.auth-blurb { color: rgba(255,255,255,.72); font-size: 1.08rem; line-height: 1.5; margin: 0; }
.auth-points { list-style: none; padding: 0; margin: 2rem 0 0; display: flex; flex-direction: column; gap: .75rem; }
.auth-points li { position: relative; padding-left: 1.7rem; color: rgba(255,255,255,.88); font-size: .98rem; }
.auth-points li::before { content: "✓"; position: absolute; left: 0; top: -1px; color: #34c8a0; font-weight: 800; }
.auth-form-col { display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--bg); }

.login-card { width: 380px; max-width: 92vw; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 2.4rem 2.1rem; }
.login-heading { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; color: var(--ink); margin: 0; }
.login-sub { color: var(--ink-soft); margin: .2rem 0 1.4rem; }
.login-label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin: .7rem 0 .25rem; }
.login-error { background: #fdecee; color: #b3261e; border: 1px solid #f5c2c7; border-radius: 8px; padding: .55rem .75rem; font-size: .85rem; margin-bottom: .6rem; }
.login-card .form-control { padding: .6rem .8rem; border-radius: 9px; }
.login-card .btn-primary { padding: .65rem; font-weight: 700; border-radius: 9px; }

@media (max-width: 860px) {
    .auth-split { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
}

/* Empty desk landing — shown at "/" until the user opens something from the toolbar. Kept deliberately
   faint so it reads as a quiet backdrop, not a page. */
.desk-home { min-height: 78vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .9rem; text-align: center; opacity: .55; user-select: none; }
.desk-home .nodi-lockup { transform: scale(1.25); transform-origin: center; margin-bottom: 1rem; opacity: .5; filter: grayscale(.2); }
.desk-home-hint { color: var(--muted); font-size: .95rem; font-weight: 500; }
.desk-home-arrow { display: inline-block; color: var(--muted); font-weight: 800; animation: deskNudge 1.6s ease-in-out infinite; }
@keyframes deskNudge { 0%,100% { transform: translateX(0); } 50% { transform: translateX(5px); } }

/* global motion + polish */
@keyframes fadeUp { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
article.content { animation: fadeUp .3s ease both; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #c8d3e0; border-radius: 9px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #b1bfd0; }
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(67,167,232,.32) !important; border-color: #43a7e8 !important; outline: none;
}

/* nav user footer */
.nav-user { margin-top: auto; padding: .8rem 1rem; border-top: 1px solid rgba(255,255,255,.12); }
.theme-toggle { display: flex; align-items: center; gap: .5rem; width: 100%; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); color: #c7d2de; border-radius: 8px; padding: .45rem .7rem; font-size: .84rem; font-weight: 500; cursor: pointer; margin-bottom: .8rem; transition: background-color .15s ease, color .15s ease; }
.theme-toggle:hover { background: rgba(255,255,255,.13); color: #fff; }
.theme-toggle-icon { font-size: 1.05rem; line-height: 1; }

/* brand lockup (mark + wordmark) */
.nodi-lockup { display: inline-flex; align-items: center; gap: .6rem; }
.nodi-mark { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 4px 11px rgba(42,111,176,.45)); }
.nodi-word { font-family: 'Fredoka', system-ui, sans-serif; font-weight: 600; font-size: 1.5rem; letter-spacing: -.006em; color: #fff; line-height: 1; }
.nodi-lockup.lg { gap: .8rem; }
.nodi-lockup.lg .nodi-mark { width: 50px; height: 50px; }
.nodi-lockup.lg .nodi-word { font-size: 2.2rem; color: #111827; }
.nav-user-name { color: #e8f0f8; font-size: .9rem; font-weight: 600; margin-bottom: .3rem; }
.nav-user-actions { display: flex; gap: .8rem; align-items: center; }
.nav-user-link { color: #b9d3ea; font-size: .82rem; text-decoration: none; background: none; border: none; padding: 0; cursor: pointer; }
.nav-user-link:hover { color: #fff; text-decoration: underline; }
.nav-logout-form { display: inline; margin: 0; }

/* admin */
.card-box { background: var(--surface); border: 1px solid #e3e9f0; border-radius: 10px; padding: 1rem 1.2rem; }
.admin-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .8rem; }
.admin-form label { font-size: .78rem; color: var(--ink-soft); display: block; margin-bottom: .2rem; }
.admin-practices { margin-top: .8rem; }
.admin-practices > label { font-size: .78rem; color: var(--ink-soft); display: block; margin-bottom: .3rem; }
.admin-ok { background: #e8f6ed; color: #1e7a3d; border: 1px solid #b7e0c4; border-radius: 6px; padding: .5rem .7rem; font-size: .85rem; margin: .5rem 0; }
.admin-actions { display: flex; gap: .4rem; white-space: nowrap; }

/* reviews page */
.rev-tabs { display: flex; gap: .3rem; border-bottom: 2px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.rev-tab { border: none; background: transparent; padding: .5rem .9rem; font-size: .9rem; color: var(--ink-soft); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.rev-tab:hover { color: #2a6fb0; }
.rev-tab.active { color: var(--ink); font-weight: 700; border-bottom-color: #2a6fb0; }
.tmpl-form label { display: block; font-size: .78rem; color: var(--ink-soft); margin: .6rem 0 .15rem; }
.tmpl-row { display: flex; gap: 1rem; }
.tmpl-meta { font-size: .72rem; color: #93a1b2; margin-top: .25rem; }
.tmpl-preview { font-size: .82rem; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .5rem .7rem; margin-top: .3rem; white-space: pre-wrap; }
.tmpl-check { display: flex !important; align-items: center; gap: .45rem; font-size: .85rem !important; color: var(--ink) !important; margin-top: 1rem !important; cursor: pointer; }
.tmpl-check input { width: auto; }
.tmpl-section { font-weight: 600; color: var(--ink); font-size: .92rem; margin: 1.3rem 0 .2rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.tmpl-vars { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-top: .8rem; }
.var-chip { font-family: ui-monospace, Consolas, monospace; font-size: .76rem; color: #2a6fb0; background: var(--hover); border: 1px solid #d4e4f2; border-radius: 999px; padding: .12rem .55rem; cursor: pointer; }
.var-chip:hover { background: #dcebf8; }
.tmpl-logo { display: flex; align-items: center; gap: 1rem; margin: .2rem 0 .6rem; }
.tmpl-logo img { max-height: 64px; max-width: 220px; border: 1px solid var(--line); border-radius: 6px; padding: 4px; background: var(--surface); }
.link-btn { background: none; border: none; color: #2a6fb0; cursor: pointer; text-decoration: underline; font-size: .8rem; padding: 0; }
.rev-data-text { max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); }

.rev-chart-panel { padding: 1rem 1.2rem 1.4rem; }
.rev-bars { display: flex; align-items: flex-end; gap: .35rem; height: 180px; }
.rev-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.rev-bar-count { font-size: .7rem; color: var(--ink-soft); }
.rev-bar { width: 70%; min-height: 2px; background: linear-gradient(180deg, #3a8dde, #2a6fb0); border-radius: 3px 3px 0 0; }
.rev-bar-label { font-size: .62rem; color: #8595a6; margin-top: .3rem; transform: rotate(-45deg); white-space: nowrap; }

.theme-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.theme-chip { background: #eef5ee; border: 1px solid #d6e6d6; color: var(--ink-soft); border-radius: 999px; padding: .25rem .7rem; font-size: .82rem; }
.theme-chip strong { color: #2fa36b; margin-left: .25rem; }

.rev-list { display: flex; flex-direction: column; gap: .6rem; }
.rev-item { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; }
.rev-item-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.rev-stars { color: #f5b301; letter-spacing: 1px; }
.rev-name { font-weight: 700; color: var(--ink); }
.rev-channel { font-size: .72rem; color: #8595a6; border: 1px solid var(--line); border-radius: 4px; padding: 0 .35rem; }
.rev-date { font-size: .8rem; color: #8595a6; margin-left: auto; }
.rev-invite { font-size: .72rem; color: #2a6fb0; }
.rev-text { margin-top: .4rem; color: var(--ink-soft); font-size: .92rem; }
.rev-empty { color: #adb8c4; font-style: italic; }
.rev-themes { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.rev-theme { font-size: .72rem; color: var(--ink-soft); background: var(--hover); border-radius: 4px; padding: .1rem .45rem; }

.inv-badge { font-size: .72rem; font-weight: 600; border-radius: 999px; padding: .12rem .55rem; }
.inv-sent { background: var(--line); color: var(--ink-soft); }
.inv-opened { background: #e7f0fb; color: #2a6fb0; }
.inv-clicked { background: #fff3da; color: #b9821a; }
.inv-reviewed { background: #e6f5ee; color: #2fa36b; }

.contact-name { font-weight: 600; color: var(--ink); }

/* recall worklists */
.recall-count { display: inline-block; min-width: 1.3rem; text-align: center; font-size: .72rem; font-weight: 700; background: var(--accent); color: #fff; border-radius: 999px; padding: 0 .35rem; margin-left: .3rem; }
.rev-tab.active .recall-count { background: var(--accent); }
.recall-contact { display: flex; flex-direction: column; line-height: 1.25; font-size: .82rem; }
.recall-email { color: var(--ink-soft); }
.recall-pref { font-size: .7rem; color: var(--muted); font-style: italic; }
.recall-missing { font-size: .8rem; color: var(--bad); }
.recall-actions { display: flex; gap: .35rem; white-space: nowrap; }
.recall-insights { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; margin: .2rem 0 1rem; padding: .55rem .9rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.recall-insights-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.recall-insight { font-size: .9rem; color: var(--ink-soft); }
.recall-insight strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.recall-toolbar { display: flex; align-items: center; gap: .8rem; margin: .2rem 0 1rem; }
.recall-search { max-width: 320px; }
.recall-toolbar-count { font-size: .82rem; color: var(--muted); }
.recall-toolbar-hint { font-size: .8rem; color: var(--muted); }
.recall-filters { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0 0 1rem; padding: .5rem .85rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.recall-filters-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.recall-filter-chk { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--ink-soft); cursor: pointer; }
.recall-focus-btn { margin-left: auto; white-space: nowrap; }
.recall-sort-label { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.recall-sort { width: auto; min-width: 130px; }

/* "Today" tab — the prioritized command-center queue */
.rev-tab-today { font-weight: 600; }
.rev-tab-today.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.rev-tab-today.active .recall-count { background: rgba(255,255,255,.25); color: #fff; }

/* Work mode — focused, one-patient-at-a-time step-through */
.recall-work { width: min(620px, 94vw); max-height: 92vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 1.4rem 1.6rem; }
.recall-work-top { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.1rem; }
.recall-work-progress { flex: 1; display: flex; flex-direction: column; gap: .35rem; font-size: .78rem; color: var(--muted); }
.recall-work-bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.recall-work-fill { height: 100%; background: var(--brand); border-radius: 3px; transition: width .25s ease; }
.recall-work-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1.1rem 1.2rem; background: var(--surface-2); }
.recall-work-name { font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.recall-work-reason { font-size: 1rem; color: var(--brand); font-weight: 600; margin-top: .15rem; }
.recall-work-meta { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin-top: .7rem; font-size: .85rem; color: var(--ink-soft); }
.recall-work-days { font-weight: 600; color: var(--ink); }
.recall-work-prev { margin-top: .7rem; font-size: .82rem; color: var(--muted); }
.recall-work-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; justify-content: flex-end; }
.recall-work-actions .btn { flex: 1 1 auto; }
.recall-work-done { text-align: center; padding: 2rem 1rem; }
.recall-work-done-mark { font-size: 3rem; }

/* Patient detail — notes + follow-up/snooze in the contact modal */
.recall-detail { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .9rem; display: flex; flex-direction: column; gap: .7rem; }
.recall-detail-row { display: flex; flex-direction: column; gap: .3rem; }
.recall-detail-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.recall-notes { resize: vertical; min-height: 2.4rem; }
.recall-detail-followup { flex-direction: row; align-items: center; flex-wrap: wrap; gap: .5rem; }
.recall-detail-followup input[type=date] { max-width: 170px; }
.recall-detail-clear { padding: 0 .3rem; }
.recall-followup { font-size: .72rem; color: var(--brand); white-space: nowrap; font-variant-numeric: tabular-nums; }
.recall-noteflag { font-size: .8rem; cursor: help; }

/* Per-channel confirmation icons (📞/💬/✉): faded = not tried, yellow = reached out, green = confirmed */
.recall-chans { display: inline-flex; gap: .15rem; }
.recall-chan { position: relative; display: inline-flex; align-items: center; gap: .12rem; font-size: .85rem; line-height: 1; padding: .16rem .34rem;
    border-radius: 7px; border: 1px solid var(--line); background: var(--surface-2); }
/* Clock badge: an automated reminder for this patient sends on this channel within the next 3 hours. */
.recall-chan-soon { position: absolute; top: -6px; right: -7px; font-size: .58rem; line-height: 1;
    background: var(--surface); border-radius: 999px; padding: 1px; box-shadow: 0 0 0 1px var(--line); }
.recall-chan.chan-off { background: var(--surface-2); border-color: var(--line); }
.recall-chan.chan-try { background: color-mix(in srgb, var(--warn) 45%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 60%, var(--line)); }
.recall-chan.chan-on { background: color-mix(in srgb, var(--good) 45%, var(--surface)); border-color: color-mix(in srgb, var(--good) 60%, var(--line)); }
/* Unavailable method (no phone / no email / texts declined): dim + a diagonal strike across the icon,
   instead of a "no contact" label that would push the row out of line. */
.recall-chan.recall-chan-na { position: relative; opacity: .45; filter: grayscale(1); }
.recall-chan.recall-chan-na::after { content: ""; position: absolute; left: 12%; right: 12%; top: 50%;
    height: 2px; background: var(--bad); border-radius: 2px; transform: rotate(-18deg); pointer-events: none; }
.recall-chan-ct { display: inline-flex; align-items: center; justify-content: center; min-width: 14px; height: 14px;
    font-size: .62rem; font-weight: 800; color: #fff; background: var(--ink); border-radius: 999px; padding: 0 3px; }
.recall-chan-ct:empty { display: none; }
.recall-ostatus { font-size: .7rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; white-space: nowrap;
    min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.recall-ostatus.ostatus-on { color: var(--good); background: color-mix(in srgb, var(--good) 16%, transparent); }
.recall-ostatus.ostatus-try { color: #8a5a00; background: color-mix(in srgb, var(--warn) 24%, transparent); }
html[data-theme="dark"] .recall-ostatus.ostatus-try { color: var(--warn); }
.recall-logged { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin: .2rem 0 .4rem; }
.recall-logged-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.recall-logged-item { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; color: var(--ink-soft);
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: .12rem .4rem .12rem .55rem; }
.recall-undo { border: none; background: none; cursor: pointer; color: var(--muted); font-size: .8rem; line-height: 1; padding: 0 .1rem; border-radius: 50%; }
.recall-undo:hover { color: var(--bad); }
.recall-chanlog { margin: .2rem 0 .9rem; }
.recall-chanlog-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: .7rem 0 .3rem; }
.recall-chan-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.recall-confirmed-note { font-size: .82rem; color: var(--good); font-weight: 600; margin-left: .3rem; }
.recall-odsync { margin-top: .5rem; font-size: .82rem; font-weight: 600; color: var(--good); }

/* Detail-panel compose area — text or email a patient right here */
.recall-compose { margin: .5rem 0 1.1rem; }
.recall-compose-tabs { display: flex; gap: .4rem; align-items: center; margin-bottom: .5rem; }
.recall-compose-tab { font-size: .85rem; font-weight: 600; padding: .35rem .95rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-soft); cursor: pointer; }
.recall-compose-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.recall-compose-tab:disabled { opacity: .4; cursor: not-allowed; }
.recall-compose-call { margin-left: auto; }
.recall-compose-subject { margin-bottom: .4rem; }
.recall-compose-body { resize: vertical; min-height: 96px; }
.recall-compose-foot { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-top: .55rem; flex-wrap: wrap; }
.recall-sendrow { display: flex; align-items: center; gap: .6rem; margin: .4rem 0 .2rem; flex-wrap: wrap; }

/* Recall master–detail: worklist on the left, docked patient panel on the right */
.recall-split { display: flex; gap: 1rem; align-items: flex-start; }
.recall-listpane { flex: 0 0 460px; min-width: 0; }
@media (max-width: 1200px) { .recall-listpane { flex-basis: 400px; } }

/* Recall shell: left category nav rail · body (worklist + detail) */
.recall-shell { display: flex; gap: 1.1rem; align-items: flex-start; }
.recall-nav { flex: 0 0 184px; display: flex; flex-direction: column; gap: .25rem; position: sticky; top: 4rem; }
.recall-navtab { display: flex; align-items: center; justify-content: space-between; gap: .5rem; width: 100%; text-align: left;
    padding: .6rem .85rem; border-radius: var(--radius-sm); border: 1px solid transparent; background: none;
    color: var(--ink-soft); cursor: pointer; font-size: .95rem; font-weight: 500; }
.recall-navtab:hover { background: var(--surface-2); }
.recall-navtab.active { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand);
    border-color: color-mix(in srgb, var(--brand) 30%, transparent); font-weight: 600; }
.recall-navtab .recall-count { background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: .02rem .45rem; font-size: .76rem; font-variant-numeric: tabular-nums; }
.recall-navtab.active .recall-count { background: var(--brand); color: #fff; }
.recall-navtab-today { font-weight: 600; }
.recall-body { flex: 1 1 auto; min-width: 0; }
@media (max-width: 920px) {
    .recall-shell { flex-direction: column; }
    .recall-nav { flex-direction: row; flex-wrap: wrap; position: static; flex-basis: auto; width: 100%; }
    .recall-navtab { width: auto; }
}

/* Sub-filter chips inside a category (e.g. Confirmations → 3-Day / 1-Week / 2-Week) */
.recall-subtabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.recall-subtab { font-size: .82rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
    padding: .25rem .8rem; color: var(--ink-soft); cursor: pointer; }
.recall-subtab:hover { background: var(--surface); }
.recall-subtab.active { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
.recall-subcount { opacity: .7; margin-left: .25rem; font-variant-numeric: tabular-nums; }
.recall-subtab.active .recall-subcount { opacity: .85; }

/* Compact worklist (list of clickable patient items, not a dense table) */
.recall-worklist { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.recall-worklist-empty { padding: 1.5rem 1rem; color: var(--muted); text-align: center; }
.recall-daygroup { display: flex; align-items: baseline; gap: .4rem; padding: .55rem .9rem .35rem; font-size: .8rem; font-weight: 700;
    color: var(--ink); background: var(--surface-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; }
.recall-daygroup-count { color: var(--muted); font-weight: 500; }
/* Fixed grid tracks: time · provider · name (truncates) · side (pinned right). Deterministic columns —
   long names truncate instead of shoving the icons, and every row's columns line up exactly. */
.recall-item { display: grid; grid-template-columns: 70px 76px minmax(0, 1fr) auto; align-items: center; gap: .75rem;
    width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--line); padding: .55rem .9rem; cursor: pointer; }
.recall-item:last-child { border-bottom: none; }
.recall-item:hover { background: var(--surface-2); }
.recall-item.active { background: color-mix(in srgb, var(--brand) 12%, transparent); box-shadow: inset 3px 0 0 var(--brand); }
.recall-item-time { min-width: 0; overflow: hidden; font-size: .82rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.recall-item-where { display: flex; align-items: center; min-width: 0; }
.recall-item-prov { font-size: .82rem; color: var(--ink-soft); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recall-item-main { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.recall-item-name { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recall-item-reason { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Side cluster is pinned to the right of every row; its content (status pill, icons, badges) stays fixed-width. */
.recall-item-side { display: flex; align-items: center; gap: .5rem; min-width: 0; justify-self: end; }
.recall-item-side .recall-ostatus { flex-shrink: 1; }

/* RecallMax-style icon toolbar in the detail panel: one-click switch between Task / Contact / Messages / Notes. */
.recall-ptabs { display: flex; gap: .4rem; margin: .1rem 0 .9rem; }
.recall-ptab { position: relative; flex: 1 1 0; display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; line-height: 1; padding: .55rem 0; border: 1px solid var(--line); border-radius: 10px;
    background: var(--surface-2); cursor: pointer; transition: background .12s, border-color .12s; }
.recall-ptab:hover { background: var(--surface); }
.recall-ptab.active { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); box-shadow: inset 0 -2px 0 var(--brand); }
.recall-ptab-dot { position: absolute; top: 6px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.recall-tabname { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 .5rem; }
.recall-task { background: color-mix(in srgb, var(--brand) 6%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line));
    border-radius: var(--radius-sm); padding: .8rem .9rem; margin-bottom: 1rem; }
.recall-task-title { font-weight: 700; color: var(--brand); margin-bottom: .35rem; }
.recall-task-when { font-weight: 600; color: var(--ink); }
.recall-task-meta { display: flex; flex-wrap: wrap; gap: .15rem 1.1rem; margin-top: .35rem; font-size: .88rem; color: var(--ink-soft); }
.recall-task-k { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; margin-right: .15rem; }
.recall-task-desc { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line)); font-size: .88rem; color: var(--ink-soft); }
.recall-dob { font-size: .82rem; color: var(--muted); margin-top: .1rem; }

/* Contact Info block above the Task card */
.recall-cinfo { margin-bottom: 1rem; }
.recall-cinfo-guardian { font-size: .9rem; color: var(--ink-soft); margin-bottom: .4rem; }
.recall-cinfo-rel { color: var(--muted); }
.recall-cinfo-main { display: flex; align-items: center; gap: .6rem; }
.recall-cinfo-text { width: 34px; height: 34px; flex: none; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1rem; border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--line)); border-radius: 9px;
    background: color-mix(in srgb, var(--brand) 10%, var(--surface)); cursor: pointer; }
.recall-cinfo-text:hover { background: color-mix(in srgb, var(--brand) 18%, var(--surface)); }
.recall-cinfo-phone { font-weight: 600; color: var(--ink); text-decoration: none; }
.recall-cinfo-phone:hover { text-decoration: underline; }
.recall-cinfo-expand { margin-left: auto; border: 1px solid var(--line); background: var(--surface-2); border-radius: 50%;
    width: 26px; height: 26px; cursor: pointer; color: var(--ink-soft); line-height: 1; }
.recall-cinfo-expand:hover { background: var(--surface); }
.recall-cinfo-more { margin-top: .55rem; padding-top: .5rem; border-top: 1px solid var(--line); font-size: .88rem; color: var(--ink-soft); display: flex; flex-direction: column; gap: .3rem; }
.recall-cinfo-more a { color: var(--brand); text-decoration: none; }
.recall-cinfo-pref { color: var(--muted); }
.recall-cinfo-lbl { display: inline-block; min-width: 42px; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; }
.recall-detail-empty-sm { color: var(--muted); font-size: .9rem; padding: 1.2rem .4rem; text-align: center; }

/* Panel head action buttons: ⚙ preferences + ✓ outcome/confirm. */
.recall-head-actions { display: flex; align-items: center; gap: .35rem; }
.recall-head-gear, .recall-head-check { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: 50%; background: var(--surface-2); cursor: pointer; font-size: .95rem; line-height: 1; }
.recall-head-gear:hover { background: var(--surface); }
.recall-head-gear.active { background: color-mix(in srgb, var(--brand) 16%, transparent); border-color: var(--brand); color: var(--brand); }
.recall-head-check { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, var(--line)); font-weight: 800; }
.recall-head-check:hover { background: color-mix(in srgb, var(--good) 14%, transparent); }

/* Patient Preferences (gear) tab */
.recall-prefs-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.recall-prefs-k { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.recall-prefs-on { color: var(--good); font-weight: 600; }
.recall-prefs-off { color: var(--muted); }

/* ✓ Outcome modal (work-this-patient) */
.recall-outcome { width: min(440px, 94vw); max-height: 92vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: 0 18px 50px rgba(20,48,74,.32); padding: 1.1rem 1.3rem 1.2rem; }
.recall-outcome-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.recall-outcome-title { font-weight: 700; color: var(--ink); }
.recall-outcome-sec { font-weight: 700; color: var(--ink); margin: 1rem 0 .4rem; }
.recall-radio { display: flex; align-items: center; gap: .5rem; padding: .25rem 0; cursor: pointer; color: var(--ink-soft); }
.recall-outcome-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.recall-outcome-chan { width: 130px; flex: none; }
.recall-outcome-note { font-size: .8rem; color: var(--muted); margin: .6rem 0; }
.recall-outcome-fam { display: flex; align-items: center; gap: .5rem; margin: .6rem 0; color: var(--ink-soft); }
.recall-outcome-foot { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }

/* Inline text history in the recall panel — reuses the .msg-bubble styling from the Inbox, capped + scrollable. */
.recall-thread { display: flex; flex-direction: column; gap: .5rem; max-height: 280px; overflow-y: auto;
    padding: .65rem .7rem; margin: .3rem 0 .9rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }

/* Detail panel: contact chips, prominent actions, collapsible message preview */
.recall-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .7rem 0; }
.recall-chip { font-size: .8rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: .12rem .6rem; color: var(--ink-soft); white-space: nowrap; }
.recall-chip-warn { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.recall-chip-btn { font-family: inherit; cursor: pointer; }
.recall-chip-btn:hover { background: var(--surface); border-color: var(--brand); color: var(--brand); }
.recall-current { font-size: .85rem; color: var(--muted); margin-bottom: .6rem; }
.recall-actions-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.recall-actions-row .btn { flex: 1 1 auto; }
.recall-act-send { flex-basis: 100% !important; }
.recall-savenote { margin-left: auto; }
.recall-msg-preview { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.recall-msg-preview summary { cursor: pointer; font-size: .82rem; color: var(--muted); font-weight: 600; }
.recall-msg-preview .recall-msg { margin-top: .5rem; }
/* Stick below the sticky 3.25rem top bar (top: bar + gap), and size so the whole panel fits between the
   bar and the viewport bottom — otherwise it scrolls up under the bar and the patient name is hidden. */
.recall-detailpane { flex: 1 1 auto; min-width: 0; position: sticky; top: 4rem; max-height: calc(100vh - 5rem); overflow-y: auto;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem 1.5rem; }
.recall-detailpane-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .2rem; }
.recall-detailpane-head h3 { margin: 0; font-size: 1.3rem; font-weight: 700; color: var(--ink); }
.recall-detail-empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.recall-detail-empty-mark { font-size: 2.4rem; opacity: .6; margin-bottom: .5rem; }
@media (max-width: 1100px) {
    .recall-split { flex-direction: column; }
    .recall-detailpane { position: static; flex-basis: auto; width: 100%; max-height: none; }
}

/* Two-way texting (/inbox) */
.sms-live { color: var(--good); font-weight: 600; }
.sms-sim { color: var(--muted); }
.sms-unread { display: inline-block; margin-left: .4rem; background: var(--brand); color: #fff; font-size: .68rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px; }
.sms-status { color: var(--muted); text-transform: lowercase; }
.sms-search-results { display: flex; flex-direction: column; margin-top: .5rem; max-height: 240px; overflow-y: auto; }
.sms-search-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .5rem .6rem; background: none; border: none; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
.sms-search-row:hover { background: var(--surface-2); }
.sms-simrow { display: flex; align-items: center; gap: .5rem; padding: .5rem .2rem 0; flex-wrap: wrap; }
.sms-simrow .form-control { max-width: 320px; }

/* Settings → Auto Messages (per-channel toggle matrix) */
.msg-settings-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1.1rem; padding: .4rem 1.2rem 1rem; }
.msg-settings-title { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .9rem 0 .2rem; }
.msg-settings-table { width: 100%; border-collapse: collapse; }
.msg-settings-table th { text-align: left; font-size: .78rem; font-weight: 600; color: var(--muted); padding: .5rem .4rem; border-bottom: 1px solid var(--line); }
.msg-settings-table td { padding: .55rem .4rem; border-bottom: 1px solid var(--line); }
.msg-settings-table tr:last-child td { border-bottom: none; }
.msg-col { width: 96px; text-align: center; }
th.msg-col { text-align: center; }
.msg-sendtime { width: 180px; color: var(--muted); font-size: .82rem; white-space: nowrap; }
.msg-sendtime-input { width: 100%; max-width: 170px; font-size: .82rem; padding: .25rem .45rem; color: var(--ink-soft);
    background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.msg-sendtime-input:focus { outline: none; border-color: var(--brand); }
.msg-sendtime-fixed { color: var(--muted); font-size: .82rem; }
.settings-tabs { margin: .2rem 0 1.3rem; }

/* Keep page content clear of the fixed 56px right rail. */
.page { padding-right: 56px; }

/* RecallMax-style right-edge icon rail + Front Desk flyout (Stage 1 prototype) */
.rmx-rail { position: fixed; top: 0; right: 0; bottom: 0; width: 56px; z-index: 1200; display: flex; flex-direction: column;
    align-items: center; gap: .35rem; padding: .8rem 0; background: linear-gradient(180deg, #0c2237 0%, #0a1a2c 100%);
    border-left: 1px solid rgba(255,255,255,.06); box-shadow: -2px 0 14px rgba(15,39,64,.18); }
.rmx-rail .rmx-icon { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
    border: none; border-radius: 11px; background: transparent; color: rgba(255,255,255,.78); cursor: pointer; font-size: 1.15rem; line-height: 1; }
.rmx-rail .rmx-icon:hover { background: rgba(255,255,255,.1); color: #fff; }
.rmx-rail .rmx-icon.active { background: var(--brand); color: #fff; }
.rmx-rail .rmx-icon .bi { width: 20px; height: 20px; }
.rmx-spacer { flex: 1; }
.rmx-brand { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-bottom: .5rem;
    border: none; border-radius: 12px; background: var(--brand); text-decoration: none; cursor: pointer; }
.rmx-brand .nodi-mark { width: 30px; height: 30px; }
.rmx-flyout-sub { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: .9rem 0 .2rem; }
.rmx-signout-form { margin: 0; }
.rmx-signout-form button { width: 100%; }
.rmx-signout .rmx-flyout-label, .rmx-signout { color: var(--bad); }

.rmx-flyout { position: fixed; top: 0; right: 56px; bottom: 0; width: 320px; max-width: calc(100vw - 56px); z-index: 1201; overflow-y: auto;
    background: var(--surface); border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgba(20,48,74,.16);
    padding: 1.1rem 1.2rem; animation: rmxSlide .16s ease both; }
@keyframes rmxSlide { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.rmx-scrim { position: fixed; inset: 0 56px 0 0; z-index: 1199; background: transparent; }
.rmx-flyout-grp { font-size: 1.05rem; font-weight: 700; color: var(--ink); margin: 1rem 0 .3rem; }
.rmx-flyout-grp:first-child { margin-top: 0; }
.rmx-flyout-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%;
    background: none; border: none; padding: .5rem .2rem; cursor: pointer; border-bottom: 1px solid var(--line); }
.rmx-flyout-row:hover { background: var(--surface-2); }
.rmx-flyout-label { color: var(--ink-soft); }
.rmx-flyout-count { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Collapsed desk window: it shrinks to ~190px (Chromium's minimum window width), so let the rail fill the
   whole window — no dead space beside it — making it read as one clean RecallMax-style bar. */
@media (max-width: 240px) {
    .page { padding-right: 0; }
    .rmx-rail { left: 0; right: 0; width: auto; }
}

/* Floating worklist window (Stage 3a) — pops over the current screen, left of the rail */
.rmx-window { position: fixed; top: 1.5rem; bottom: 1.5rem; z-index: 1202; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line)); border-radius: 16px;
    box-shadow: 0 22px 60px rgba(20,48,74,.34); animation: rmxSlide .16s ease both; }
.rmx-window-list { right: 72px; width: 360px; max-width: calc(100vw - 84px); }
.rmx-window-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem .6rem; cursor: grab; touch-action: none; }
.rmx-window.rmx-dragging { animation: none; user-select: none; box-shadow: 0 28px 70px rgba(20,48,74,.42); }
.rmx-window.rmx-dragging .rmx-window-head { cursor: grabbing; }
.rmx-window-title { font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.rmx-window-count { color: var(--muted); font-weight: 600; }
.rmx-window-x { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 1rem; line-height: 1; padding: .2rem; }
.rmx-window-x:hover { color: var(--ink); }
.rmx-window-body { flex: 1; overflow-y: auto; padding: .2rem .6rem; }
.rmx-window-foot { padding: .7rem 1.2rem; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .88rem; }
.rmx-wl-day { font-weight: 700; color: var(--ink); font-size: .92rem; padding: .7rem .6rem .3rem; }
.rmx-wl-row { display: grid; grid-template-columns: 62px 70px 1fr; align-items: center; gap: .5rem; width: 100%; text-align: left;
    background: none; border: none; padding: .4rem .6rem; border-radius: 8px; cursor: pointer; }
.rmx-wl-row:hover { background: var(--surface-2); }
.rmx-wl-time { font-size: .82rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rmx-wl-prov { font-size: .82rem; color: var(--ink-soft); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rmx-wl-name { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rmx-wl-empty { color: var(--muted); padding: 1.5rem .6rem; text-align: center; }
.rmx-wl-row.active { background: color-mix(in srgb, var(--brand) 12%, transparent); box-shadow: inset 3px 0 0 var(--brand); }

/* Large app window — hosts a full page (Dashboard, Reviews, Settings…) in an iframe, RecallMax-style,
   over the empty desk. Draggable by its header (panels.js). */
.rmx-window-app { right: 72px; top: 1.2rem; bottom: 1.2rem; width: min(1180px, calc(100vw - 104px)); }
.rmx-window-app .rmx-window-head { border-bottom: 1px solid var(--line); padding: .7rem 1.1rem .65rem; }
.rmx-window-frame { flex: 1; width: 100%; border: none; border-radius: 0 0 16px 16px; background: var(--bg); }
/* While dragging, let the header keep the pointer — the iframe must not swallow move events. */
.rmx-window.rmx-dragging .rmx-window-frame { pointer-events: none; }

/* Chrome-less ("bare") page rendered inside an app window's iframe: drop the rail gutter + top padding. */
.page.bare { padding-right: 0; }
.content.win-bare { padding-top: .6rem; padding-bottom: 1.2rem; animation: none; }

/* Floating patient-detail window (Stage 3b) — sits to the left of the worklist window */
.rmx-window-patient { right: 448px; width: 400px; max-width: calc(100vw - 460px); }
.rmx-pw-dob { font-size: .82rem; color: var(--muted); margin-top: .1rem; }
.rmx-pw-sec { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1rem .6rem .35rem; }
.rmx-pw-sec:first-child { margin-top: .3rem; }
.rmx-pw-guardian { padding: 0 .6rem; color: var(--ink-soft); font-size: .9rem; }
.rmx-pw-rel { color: var(--muted); }
.rmx-pw-contact { display: flex; flex-wrap: wrap; gap: .3rem .9rem; padding: .2rem .6rem; }
.rmx-pw-contact a { color: var(--brand); text-decoration: none; font-weight: 600; }
.rmx-pw-appt { padding: .2rem .6rem; }
.rmx-pw-when { font-weight: 600; color: var(--ink); }
.rmx-pw-meta { font-size: .88rem; color: var(--ink-soft); margin-top: .15rem; }
.rmx-pw-desc { font-size: .86rem; color: var(--ink-soft); margin-top: .35rem; padding-top: .35rem; border-top: 1px solid var(--line); }
.rmx-pw-confirm { display: flex; gap: .4rem; padding: .2rem .6rem; }
.rmx-pw-confirm .btn { flex: 1; }
.rmx-window-patient .recall-odsync { padding: .3rem .6rem 0; }
.rmx-window-patient textarea { margin: 0 .6rem; width: calc(100% - 1.2rem); }
.rmx-pw-notesfoot { display: flex; gap: .4rem; padding: .5rem .6rem; }
.rmx-pw-save { margin-left: auto; }
.rmx-pw-link { border: none; background: none; color: var(--brand); cursor: pointer; font-weight: 600; font-size: .9rem; padding: 0; }
.rmx-pw-link:hover { text-decoration: underline; }
.rmx-pw-thread { display: flex; flex-direction: column; gap: .45rem; max-height: 190px; overflow-y: auto; margin: 0 .6rem;
    padding: .55rem .6rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.rmx-pw-compose { display: flex; gap: .4rem; padding: .5rem .6rem .2rem; }
.rmx-pw-sendnote { font-size: .76rem; color: var(--muted); padding: 0 .6rem; }
.rmx-pw-nomsg { color: var(--muted); font-size: .86rem; padding: .3rem .6rem; }
.msg-type-name { font-weight: 600; color: var(--brand); }
.msg-na { color: var(--muted); }
/* toggle switch */
.msg-switch { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; }
.msg-switch input { opacity: 0; width: 0; height: 0; }
.msg-switch-track { position: absolute; inset: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; transition: background .15s; }
.msg-switch-track::before { content: ""; position: absolute; height: 16px; width: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.msg-switch input:checked + .msg-switch-track { background: var(--good); border-color: var(--good); }
.msg-switch input:checked + .msg-switch-track::before { transform: translateX(18px); }
.msg-saved { color: var(--good); font-weight: 600; font-size: .9rem; }
.msg-type-link { background: none; border: none; padding: 0; font-weight: 600; color: var(--brand); cursor: pointer; text-align: left; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--brand) 35%, transparent); text-underline-offset: 2px; }
.msg-type-link:hover { text-decoration-color: var(--brand); }
.msg-row-active { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.practice-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .7rem 1rem; margin-bottom: 1rem; }
.practice-info-grid label { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
.msg-editor { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.4rem; margin-bottom: 1.5rem; scroll-margin-top: 1rem; }
.msg-editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.msg-editor-head h3 { margin: 0; font-size: 1.2rem; }
.msg-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
@media (max-width: 900px) { .msg-editor-grid { grid-template-columns: 1fr; } }
.msg-editor-edit textarea, .msg-editor-edit input { margin-bottom: .3rem; }
.msg-editor-edit textarea { resize: vertical; }
.msg-tokens { font-size: .78rem; color: var(--muted); margin: .5rem 0 .8rem; line-height: 1.9; }
.msg-tokens code, .dash-sub code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: .05rem .3rem; font-size: .92em; color: var(--ink-soft); }
.msg-editor-actions { display: flex; gap: .5rem; }
.msg-editor-preview { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem 1.1rem; }
.msg-preview-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin: .2rem 0 .35rem; }
.msg-editor-preview .recall-msg { margin-bottom: .6rem; }

/* Communication preferences grid */
.comms-consent, .comms-reach { font-size: .74rem; font-weight: 600; padding: .08rem .45rem; border-radius: 999px; white-space: nowrap; }
.consent-yes { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.consent-no { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.consent-unknown { color: var(--muted); background: var(--surface-2); }
.reach-both { color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent); }
.reach-sms { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.reach-email { color: var(--accent, var(--brand)); background: color-mix(in srgb, var(--brand) 10%, transparent); }
.reach-none { color: var(--muted); background: var(--surface-2); }
.recall-days { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-soft); }
.recall-days-hot { color: var(--bad); }
.recall-status { font-size: .74rem; font-weight: 600; white-space: nowrap; margin-right: .4rem; padding: .1rem .45rem; border-radius: 999px; }
.recall-status.status-contacted { background: rgba(22,163,107,.14); color: var(--good); }
.recall-status.status-scheduled { background: rgba(67,167,232,.16); color: var(--accent); }
.recall-status.status-noanswer { background: rgba(224,72,61,.13); color: var(--bad); }
.recall-status.status-snoozed { background: var(--surface-2); color: var(--muted); }
.recall-outcomes { display: flex; gap: .4rem; }
.audit-action { font-size: .72rem; font-weight: 600; padding: .08rem .45rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); white-space: nowrap; }
.audit-action.audit-login { background: rgba(22,163,107,.14); color: var(--good); }
.audit-action.audit-loginfailed { background: rgba(224,72,61,.13); color: var(--bad); }
.audit-action.audit-viewpatient { background: rgba(67,167,232,.16); color: var(--accent); }

/* MFA enrollment */
.mfa-steps { padding-left: 1.2rem; color: var(--ink); }
.mfa-steps li { margin-bottom: .5rem; }
.mfa-key { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; letter-spacing: .12em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .8rem; margin: .4rem 0; display: inline-block; }
.mfa-link { display: inline-block; margin: .2rem 0 .8rem; font-size: .85rem; }
.mfa-verify { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.mfa-verify .form-control { max-width: 160px; }
.mfa-qr { width: 180px; height: 180px; background: #fff; padding: 8px; border: 1px solid var(--line); border-radius: 10px; margin: .4rem 0 .8rem; }
.mfa-qr svg { width: 100%; height: 100%; display: block; }
.recovery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .8rem; margin: .6rem 0; max-width: 360px; }
.recovery-code { font-family: ui-monospace, Consolas, monospace; font-size: .95rem; letter-spacing: .06em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .5rem; color: var(--ink); text-align: center; }
.recall-modal { background: var(--surface); border-radius: var(--radius); width: min(560px, 96vw); max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg); padding: 1.1rem 1.3rem 1.2rem; }
.recall-modal-meta { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .85rem; color: var(--ink-soft); margin-bottom: .4rem; }
.recall-modal-reason { color: var(--accent); font-weight: 600; }
.recall-msg { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .8rem; font-size: .88rem; color: var(--ink); }
.recall-pre { white-space: pre-wrap; margin-top: .4rem; }
.recall-modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.recall-modal-note { font-size: .76rem; color: var(--muted); }

/* message inbox */
.msg-layout { display: grid; grid-template-columns: 150px 320px 1fr; gap: .75rem; height: calc(100vh - 200px); min-height: 460px; }
.msg-folders { display: flex; flex-direction: column; gap: .2rem; }
.msg-folder { display: flex; justify-content: space-between; align-items: center; background: transparent; border: none; text-align: left; padding: .45rem .6rem; border-radius: 6px; font-size: .9rem; color: var(--ink-soft); cursor: pointer; }
.msg-folder:hover { background: var(--hover); }
.msg-folder.active { background: #e7f0fb; color: var(--ink); font-weight: 600; }
.msg-folder-count { font-size: .72rem; color: #8595a6; }
.msg-list { border: 1px solid var(--line); border-radius: 8px; overflow-y: auto; background: var(--surface); }
.msg-convo { display: block; width: 100%; text-align: left; background: transparent; border: none; border-bottom: 1px solid var(--line); padding: .6rem .7rem; cursor: pointer; }
.msg-convo:hover { background: var(--hover); }
.msg-convo.active { background: var(--hover); }
.msg-convo-top { display: flex; justify-content: space-between; }
.msg-convo-name { font-weight: 600; color: var(--ink); font-size: .9rem; }
.msg-convo-date { font-size: .72rem; color: #8595a6; }
.msg-convo-preview { font-size: .8rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-convo-preview.optout { color: #d6453d; font-weight: 600; }
.msg-convo-loc { font-size: .7rem; color: #adb8c4; margin-top: .15rem; }
.msg-thread { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); display: flex; flex-direction: column; }
.msg-thread-head { padding: .7rem 1rem; border-bottom: 1px solid var(--line); font-weight: 700; color: var(--ink); }
.msg-bubbles { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.msg-bubble { max-width: 75%; }
.msg-bubble.out { align-self: flex-end; text-align: right; }
.msg-bubble.in { align-self: flex-start; }
.msg-bubble-body { display: inline-block; padding: .5rem .75rem; border-radius: 12px; font-size: .88rem; }
.msg-bubble.out .msg-bubble-body { background: #2a6fb0; color: #fff; border-bottom-right-radius: 3px; }
.msg-bubble.in .msg-bubble-body { background: var(--line); color: var(--ink); border-bottom-left-radius: 3px; }
.msg-bubble-meta { font-size: .68rem; color: #adb8c4; margin-top: .15rem; }
.msg-system { align-self: center; font-size: .78rem; color: #8595a6; background: var(--surface-2); border-radius: 6px; padding: .3rem .7rem; }
.summary-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; margin-top: 1rem; }
.summary-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.summary-table th, .summary-table td { padding: .55rem .9rem; text-align: left; white-space: nowrap; }
.summary-table thead th { background: var(--surface-2); color: var(--ink-soft); font-weight: 600; font-size: .8rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.summary-table th.num, .summary-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.summary-table td.kpi { color: var(--ink); font-weight: 600; }
.summary-table tbody tr.srow:nth-child(even) { background: var(--surface-2); }
.summary-table tbody tr.srow:hover { background: var(--hover); }
.summary-table .ent { color: var(--ink); font-weight: 700; border-left: 1px solid var(--line); background: var(--surface-2); }
.pl-table tr.pl-head td { background: var(--surface-2); color: #2a6fb0; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding-top: .55rem; }
.pl-table tr.pl-total td { font-weight: 600; border-top: 1px solid var(--line); }
.pl-table tr.pl-key td { font-weight: 700; color: var(--ink); background: #f3f8f3; border-top: 2px solid #cfe0cf; }
.pl-table tr.pl-pct td { color: var(--ink-soft); font-size: .82rem; font-style: italic; }
.fin-keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin: 1rem 0 .4rem; }
.fin-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; }
.fin-card-label { font-size: .74rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.fin-card-value { font-size: 1.5rem; font-weight: 700; color: var(--ink); margin: .15rem 0; }
.fin-card-sub { font-size: .78rem; color: #93a1b2; }
.fin-card-sub.up { color: #1f9d55; }
.fin-card-sub.down { color: #d64545; }
.import-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.import-title { font-weight: 700; color: var(--ink); }
.import-actions { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; }
.msg-sendwindow { padding: .4rem .7rem; font-size: .78rem; color: var(--ink-soft); background: var(--surface-2); border-top: 1px solid var(--line); display: flex; align-items: center; gap: .35rem; }
.msg-optout-btn { margin-left: auto; font-size: .74rem; padding: .2rem .6rem; border: 1px solid #d6dde5; border-radius: 5px; background: var(--surface); color: var(--ink-soft); cursor: pointer; }
.msg-optout-btn:hover { background: var(--line); color: var(--ink); }
.msg-compose { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--line); }
.msg-compose .form-control { flex: 1; }

/* trend modal + chart */
.trend-overlay {
    position: fixed; inset: 0; background: rgba(20, 48, 74, .45);
    display: flex; align-items: center; justify-content: center; z-index: 1050; padding: 1rem;
}
.trend-modal {
    background: var(--surface); border-radius: 10px; width: min(820px, 96vw);
    box-shadow: 0 12px 40px rgba(20, 48, 74, .3); padding: 1.1rem 1.3rem 1.3rem;
}
.trend-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.trend-head h3 { font-size: 1.1rem; font-weight: 700; color: var(--ink); margin: 0; }
.trend-close { border: none; background: transparent; font-size: 1.1rem; color: var(--ink-soft); cursor: pointer; }
.trend-close:hover { color: #d6453d; }
.trend-loading { padding: 3rem 0; text-align: center; color: var(--ink-soft); }
.trend-chart { width: 100%; height: 300px; }
.trend-grid { stroke: var(--line); stroke-width: 1; }
.trend-axis { font-size: 11px; fill: #8595a6; }
.trend-area { fill: url(#trendArea); stroke: none; }
.trend-line { fill: none; stroke: url(#trendStroke); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 6px 10px rgba(42,111,176,.28)); }
.trend-fit { stroke: #e6932a; stroke-width: 2; stroke-dasharray: 6 4; opacity: .85; }
.trend-dot { fill: #fff; stroke: #2a6fb0; stroke-width: 1.6; }
.trend-foot { margin-top: .5rem; font-size: .85rem; color: var(--ink-soft); }
.trend-foot strong { color: var(--ink); }
.trend-key { display: inline-block; padding-left: 1.1rem; margin-right: .8rem; position: relative; }
.trend-key::before { content: ""; position: absolute; left: 0; top: 50%; width: .9rem; height: 0; border-top-width: 3px; border-top-style: solid; }
.trend-key-line::before { border-top-color: #2a6fb0; }
.trend-key-fit::before { border-top-color: #e6932a; border-top-style: dashed; }