/* ==========================================================================
   Engage design system
   One stylesheet for every tenant + staff page. Tokens first, then the shell,
   then reusable components. No framework underneath — Bootstrap Icons only.
   ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */
:root {
    color-scheme: light;
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

    /* Surfaces */
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #f1f5f9;
    --surface-hover: #f8f9fc;
    --border: #e4e7ee;
    --border-strong: #cfd5e1;
    --ring: rgba(79, 70, 229, .22);

    /* Text */
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --faint: #94a3b8;
    --on-accent: #ffffff;

    /* Accent */
    --accent: #4f46e5;
    --accent-2: #7c3aed;
    --accent-hover: #4338ca;
    --accent-soft: #eef2ff;
    --accent-soft-2: #e0e7ff;
    --accent-text: #3730a3;
    --accent-grad: linear-gradient(135deg, #4f46e5 0%, #6d5ae6 60%, #7c3aed 100%);

    /* Status */
    --success: #16a34a;  --success-soft: #ecfdf5;  --success-text: #15803d; --success-border: #bbf7d0;
    --warn: #d97706;     --warn-soft: #fffbeb;     --warn-text: #92400e;    --warn-border: #fde68a;
    --danger: #dc2626;   --danger-soft: #fef2f2;   --danger-text: #b91c1c;  --danger-border: #fecaca;
    --info: #2563eb;     --info-soft: #eff6ff;     --info-text: #1d4ed8;    --info-border: #bfdbfe;
    --teal: #0d9488;     --teal-soft: #f0fdfa;     --teal-text: #0f766e;    --teal-border: #99f6e4;
    --cyan: #0891b2;     --cyan-soft: #ecfeff;     --cyan-text: #0e7490;
    --neutral-soft: #f1f5f9; --neutral-text: #475569;

    /* Channels (charts) */
    --ch-email: #4f46e5; --ch-sms: #14b8a6; --ch-call: #8b5cf6; --ch-linkedin: #0ea5e9; --ch-rvm: #f59e0b;

    /* Sidebar (always dark navy) */
    --sb-bg: #0b1222;
    --sb-bg-2: #0f172a;
    --sb-border: rgba(255,255,255,.07);
    --sb-text: #94a3b8;
    --sb-text-strong: #f8fafc;
    --sb-hover: rgba(255,255,255,.06);
    --sb-active: rgba(99,102,241,.22);
    --sb-section: rgba(148,163,184,.55);
    --sidebar-w: 236px;
    --sidebar-cw: 64px;
    --topbar-h: 56px;

    /* Shape & depth */
    --r-sm: 6px; --r: 8px; --r-lg: 12px; --r-xl: 16px; --r-pill: 999px;
    --shadow-xs: 0 1px 2px rgba(15,23,42,.05);
    --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
    --shadow-md: 0 6px 20px -6px rgba(15,23,42,.14), 0 2px 6px -2px rgba(15,23,42,.06);
    --shadow-lg: 0 24px 50px -16px rgba(15,23,42,.28), 0 8px 20px -8px rgba(15,23,42,.12);
    --shadow-focus: 0 0 0 3px var(--ring);

    /* Motion */
    --ease: cubic-bezier(.2,.7,.2,1);
    --ease-out: cubic-bezier(.16,1,.3,1);
    --dur-1: 150ms; --dur-2: 220ms; --dur-3: 320ms;

    /* Type scale */
    --fs-xs: 11px; --fs-sm: 12px; --fs-base: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 26px; --fs-3xl: 32px;
}

:root[data-theme="dark"] { color-scheme: dark; }

:root[data-theme="dark"] {
    --bg: #0b1020;
    --surface: #111729;
    --surface-2: #151c31;
    --surface-3: #1b2338;
    --surface-hover: #161d33;
    --border: #232c44;
    --border-strong: #334155;
    --ring: rgba(129,140,248,.35);
    --text: #f1f5f9;
    --text-2: #cbd5e1;
    --muted: #94a3b8;
    --faint: #64748b;
    --accent: #6366f1;
    --accent-2: #8b5cf6;
    --accent-hover: #818cf8;
    --accent-soft: rgba(99,102,241,.14);
    --accent-soft-2: rgba(99,102,241,.24);
    --accent-text: #c7d2fe;
    --success-soft: rgba(22,163,74,.14); --success-text: #86efac; --success-border: rgba(34,197,94,.35);
    --warn-soft: rgba(217,119,6,.14);    --warn-text: #fcd34d;    --warn-border: rgba(245,158,11,.35);
    --danger-soft: rgba(220,38,38,.14);  --danger-text: #fca5a5;  --danger-border: rgba(239,68,68,.35);
    --info-soft: rgba(37,99,235,.14);    --info-text: #93c5fd;    --info-border: rgba(59,130,246,.35);
    --teal-soft: rgba(13,148,136,.14);   --teal-text: #5eead4;    --teal-border: rgba(20,184,166,.35);
    --cyan-soft: rgba(8,145,178,.16);    --cyan-text: #67e8f9;
    --neutral-soft: #1e293b; --neutral-text: #cbd5e1;
    --ch-email: #6366f1; --ch-sms: #2dd4bf; --ch-call: #a78bfa; --ch-linkedin: #38bdf8; --ch-rvm: #fbbf24;
    --sb-bg: #070b16; --sb-bg-2: #0b1222;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
    --shadow-md: 0 8px 24px -8px rgba(0,0,0,.7);
    --shadow-lg: 0 24px 50px -16px rgba(0,0,0,.8);
}

/* ---------- 2. Base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--fs-base);
    line-height: 1.5;
    font-feature-settings: "cv11", "ss01", "ss03";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; color: var(--text); line-height: 1.3; }
h1 { font-size: var(--fs-xl); letter-spacing: -.02em; }
h2 { font-size: var(--fs-md); }
h3 { font-size: var(--fs-base); }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; transition: color var(--dur-1) var(--ease); }
a:hover { color: var(--accent-hover); }
strong, b { font-weight: 600; }
small { font-size: var(--fs-sm); }
code, kbd, .mono { font-family: var(--mono); font-size: 12px; }
code { color: var(--accent-text); background: var(--accent-soft); padding: .1rem .4rem; border-radius: 4px; }
kbd { display: inline-block; padding: .05rem .4rem; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--muted); font-size: 11px; line-height: 1.5; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
ul.plain, ol.plain { list-style: none; margin: 0; padding: 0; }
[hidden] { display: none !important; }
.num, .tabular { font-variant-numeric: tabular-nums; }
::selection { background: var(--accent-soft-2); color: var(--text); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.btn:focus-visible, .input:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 1000; background: var(--surface); color: var(--text); padding: .5rem .75rem; border-radius: var(--r); box-shadow: var(--shadow-md); }
.skip-link:focus { left: 8px; }

/* ---------- 3. Application shell ---------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--sb-bg-2) 0%, var(--sb-bg) 100%);
    color: var(--sb-text);
    display: flex; flex-direction: column;
    z-index: 200;
    overflow: hidden;
    transition: width var(--dur-3) var(--ease), transform var(--dur-3) var(--ease);
    border-right: 1px solid var(--sb-border);
}
.sidebar.collapsed { width: var(--sidebar-cw); }
.sidebar::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(600px 240px at -10% -10%, rgba(99,102,241,.22), transparent 60%); }

.sidebar-header { display: flex; align-items: center; gap: .6rem; height: var(--topbar-h); padding: 0 .75rem 0 .9rem; flex-shrink: 0; border-bottom: 1px solid var(--sb-border); position: relative; z-index: 1; }
.sidebar-brand { display: flex; align-items: center; gap: .65rem; min-width: 0; flex: 1; color: var(--sb-text-strong); }
.brand-icon {
    width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px;
    background: var(--accent-grad); color: #fff;
    display: grid; place-items: center;
    font-size: 11px; font-weight: 700; letter-spacing: .04em;
    box-shadow: 0 4px 12px -4px rgba(99,102,241,.7), inset 0 1px 0 rgba(255,255,255,.2);
}
.brand-icon i { font-size: 15px; }
.brand-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--sb-text-strong); transition: opacity var(--dur-2) var(--ease); }
.brand-sub { display: block; font-size: 10.5px; font-weight: 500; color: var(--sb-text); letter-spacing: .04em; text-transform: uppercase; }
.sidebar.collapsed .brand-name, .sidebar.collapsed .brand-sub { opacity: 0; width: 0; }
/* Collapsed rail is 64px: brand icon + toggle shrink to 24px each so the toggle stays reachable */
.sidebar.collapsed .sidebar-header { padding: 0 6px; gap: 0; justify-content: space-between; }
.sidebar.collapsed .sidebar-brand { gap: 0; flex: 0 0 auto; }
.sidebar.collapsed .brand-icon { width: 24px; height: 24px; border-radius: 6px; }
.sidebar.collapsed .brand-icon i { font-size: 12px; }
.sidebar.collapsed .sidebar-toggle { width: 24px; height: 24px; font-size: 11px; }

.sidebar-toggle {
    flex-shrink: 0; width: 28px; height: 28px; border: 0; border-radius: 7px;
    background: rgba(255,255,255,.06); color: var(--sb-text); cursor: pointer;
    display: grid; place-items: center; font-size: 13px;
    transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease), transform var(--dur-3) var(--ease);
}
.sidebar-toggle:hover { background: rgba(255,255,255,.14); color: #fff; }
.sidebar.collapsed .sidebar-toggle i { transform: rotate(180deg); }
.sidebar-toggle i { transition: transform var(--dur-3) var(--ease); }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: .6rem .6rem; position: relative; z-index: 1; scrollbar-width: none; }
.sidebar-nav::-webkit-scrollbar { width: 0; }
.sidebar-section { font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--sb-section); padding: 1rem .6rem .35rem; white-space: nowrap; transition: opacity var(--dur-2) var(--ease); }
.sidebar.collapsed .sidebar-section { opacity: 0; height: 14px; padding-top: .5rem; }
.sidebar.collapsed .sidebar-section::after { content: ""; display: block; height: 1px; background: var(--sb-border); margin: 0 .3rem; }

.sidebar-link {
    position: relative;
    display: flex; align-items: center; gap: .7rem;
    height: 36px; padding: 0 .6rem; margin-bottom: 2px;
    border-radius: 8px; color: var(--sb-text);
    font-size: 13px; font-weight: 500; white-space: nowrap;
    transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.sidebar-link i { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; transition: transform var(--dur-2) var(--ease), color var(--dur-1) var(--ease); }
.sidebar-link span { transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); }
.sidebar-link:hover { background: var(--sb-hover); color: var(--sb-text-strong); }
.sidebar-link:hover i { transform: translateX(1px); }
.sidebar-link.active { background: var(--sb-active); color: var(--sb-text-strong); }
.sidebar-link.active::before { content: ""; position: absolute; left: -.6rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-grad); box-shadow: 0 0 12px rgba(99,102,241,.8); }
.sidebar-link.active i { color: #a5b4fc; }
.sidebar-link .count { margin-left: auto; font-size: 10.5px; font-weight: 600; padding: .05rem .4rem; border-radius: 999px; background: rgba(255,255,255,.1); color: #e2e8f0; }
.sidebar-link .count.hot { background: #dc2626; color: #fff; }
.sidebar.collapsed .sidebar-link span:not(.count) { opacity: 0; width: 0; overflow: hidden; pointer-events: none; }
.sidebar.collapsed .sidebar-link { padding: 0; gap: 0; justify-content: center; }
.sidebar.collapsed .sidebar-link i { width: auto; }
.sidebar.collapsed .sidebar-link .count { position: absolute; top: 4px; right: 6px; margin: 0; padding: 0 .3rem; font-size: 9px; line-height: 14px; }

.sidebar-footer { border-top: 1px solid var(--sb-border); padding: .5rem .6rem; flex-shrink: 0; position: relative; z-index: 1; }

.sidebar-plan { display: flex; flex-direction: column; gap: .4rem; margin: 0 0 .45rem; padding: .7rem .75rem; border-radius: 10px; background: rgba(255,255,255,.05); border: 1px solid var(--sb-border); color: var(--sb-text); white-space: nowrap; overflow: hidden; transition: background var(--dur-1) var(--ease); }
.sidebar-plan:hover { background: rgba(255,255,255,.09); color: var(--sb-text); }
.sidebar-plan .plan-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.sidebar-plan .plan-head b { color: var(--sb-text-strong); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.sidebar-plan .plan-status { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: .1rem .4rem; border-radius: 999px; background: rgba(34,197,94,.18); color: #86efac; flex-shrink: 0; }
.sidebar-plan .plan-status.warn { background: rgba(245,158,11,.18); color: #fcd34d; }
.sidebar-plan .progress { background: rgba(255,255,255,.1); }
.sidebar-plan small { font-size: 11px; color: var(--sb-text); }
.sidebar-plan .plan-link { font-size: 11.5px; font-weight: 600; color: #a5b4fc; display: inline-flex; align-items: center; gap: .25rem; }
.sidebar-plan .plan-link i { font-size: 11px; transition: transform var(--dur-1) var(--ease); }
.sidebar-plan:hover .plan-link i { transform: translateX(2px); }
.sidebar.collapsed .sidebar-plan { display: none; }

/* Collapsed tooltips */
.sidebar.collapsed .sidebar-link[data-tip]::after {
    content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%) translateX(-4px);
    background: #0f172a; color: #fff; font-size: 12px; font-weight: 500; padding: .3rem .6rem; border-radius: 6px; white-space: nowrap;
    opacity: 0; pointer-events: none; box-shadow: var(--shadow-md); transition: opacity var(--dur-1) var(--ease), transform var(--dur-1) var(--ease); z-index: 300;
}
.sidebar.collapsed .sidebar-link[data-tip]:hover::after { opacity: 1; transform: translateY(-50%) translateX(0); }

.sidebar-overlay { position: fixed; inset: 0; background: rgba(2,6,23,.5); backdrop-filter: blur(2px); z-index: 190; opacity: 0; pointer-events: none; transition: opacity var(--dur-2) var(--ease); }
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }

.app-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; transition: margin-left var(--dur-3) var(--ease); }
.app-main.collapsed { margin-left: var(--sidebar-cw); }

/* Top bar */
.topbar {
    position: sticky; top: 0; z-index: 150;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: .75rem;
    padding: 0 1.5rem;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar-toggle { display: none; }
.crumbs { display: flex; align-items: center; gap: .4rem; min-width: 0; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--faint); font-size: 11px; }
.crumbs .current { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .4rem; }
.topbar-link { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; color: var(--muted); font-size: 16px; position: relative; transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.topbar-link:hover { background: var(--surface-3); color: var(--text); }
.topbar-link .ping { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 9.5px; font-weight: 700; line-height: 12px; text-align: center; border: 2px solid var(--surface); box-sizing: border-box; }

.btn-create { height: 34px; padding: 0 .85rem; border-radius: 9px; }
.btn-create i { font-size: 13px; }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-grad); color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; flex-shrink: 0; box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.xl { width: 56px; height: 56px; font-size: 19px; border-radius: 16px; }
.avatar.neutral { background: var(--surface-3); color: var(--text-2); box-shadow: none; }
.user-btn { display: inline-flex; align-items: center; gap: .55rem; padding: .25rem .5rem .25rem .25rem; border: 1px solid transparent; background: transparent; border-radius: 999px; cursor: pointer; color: var(--text); font: inherit; transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease); }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-3); border-color: var(--border); }
.user-btn .name { font-size: 12.5px; font-weight: 600; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-btn i { color: var(--muted); font-size: 12px; }

/* Banners */
.banner { display: flex; align-items: center; gap: .6rem; padding: .5rem 1.5rem; font-size: 12.5px; border-bottom: 1px solid; }
.banner-staff { background: var(--warn-soft); color: var(--warn-text); border-color: var(--warn-border); }
.banner-danger { background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger-border); }
.banner-trial { background: var(--info-soft); color: var(--info-text); border-color: var(--info-border); padding-block: .35rem; }
.banner a { margin-left: auto; font-weight: 600; color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.banner .pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; }

/* Page body */
.page { flex: 1; width: 100%; padding: 1.5rem 1.75rem 3rem; animation: page-in var(--dur-3) var(--ease-out) backwards; }
.page.wide { max-width: none; }
.page.flush { padding: 0; animation: none; }
.narrow { max-width: 720px; }
.narrow-md { max-width: 860px; }
.narrow-lg { max-width: 1080px; }
.narrow-sm { max-width: 560px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head .titles { min-width: 0; }
.page-head .titles h1 { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.page-head .sub { margin-top: .25rem; font-size: 13px; color: var(--muted); max-width: 70ch; }
.page-head .sub-wide { max-width: none; }
.page-head .actions, .page-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: .35rem; font-size: 12.5px; color: var(--muted); margin-bottom: .45rem; font-weight: 500; }
.back:hover { color: var(--text); }
.back i { font-size: 12px; transition: transform var(--dur-1) var(--ease); }
.back:hover i { transform: translateX(-2px); }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0 0 .85rem; }
.section-head h2 { display: flex; align-items: center; gap: .5rem; }
.section-head h2 i { color: var(--faint); font-size: 14px; }
.section-head .meta { font-size: 12px; color: var(--muted); }
.link-arrow { display: inline-flex; align-items: center; gap: .25rem; font-size: 12.5px; font-weight: 500; }
.link-arrow::after { content: "→"; transition: transform var(--dur-1) var(--ease); }
.link-arrow:hover::after { transform: translateX(3px); }

/* Layout utils */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-auto-sm { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid-auto-lg { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.stack-sm { display: flex; flex-direction: column; gap: .4rem; }
.stack-lg { display: flex; flex-direction: column; gap: 1.25rem; }
.cluster { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.cluster-sm { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
/* An icon box beside a title + hint (the hint lines up under the title, not the icon) */
.icon-row { display: flex; align-items: flex-start; gap: .65rem; }
.icon-row > .icon-box { margin-top: 1px; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.spacer { flex: 1; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; } .mt-4 { margin-top: 1rem; } .mt-5 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .25rem; } .mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: .75rem; } .mb-4 { margin-bottom: 1rem; } .mb-5 { margin-bottom: 1.5rem; }
.ml-auto { margin-left: auto; }
.text-muted { color: var(--muted); } .text-faint { color: var(--faint); } .text-2 { color: var(--text-2); }
.text-success { color: var(--success-text); } .text-warn { color: var(--warn-text); } .text-danger { color: var(--danger-text); } .text-info { color: var(--info-text); } .text-accent { color: var(--accent); }
.text-sm { font-size: 12px; } .text-xs { font-size: 11px; } .text-md { font-size: 14px; } .text-lg { font-size: 16px; }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.text-right { text-align: right; } .text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.w-100 { width: 100%; }
.hide-mobile { } .show-mobile { display: none; }
.inline { display: inline; }
.divider-v { width: 1px; height: 20px; background: var(--border); }

/* ---------- 4. Buttons -------------------------------------------------- */
.btn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    height: 34px; padding: 0 .9rem;
    border-radius: var(--r); border: 1px solid var(--border);
    background: var(--surface); color: var(--text-2);
    font: inherit; font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap;
    cursor: pointer; text-decoration: none; user-select: none;
    box-shadow: var(--shadow-xs);
    transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.btn i { font-size: 14px; line-height: 1; }
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text); }
.btn:active { transform: translateY(1px) scale(.99); box-shadow: none; }
.btn:focus-visible { box-shadow: var(--shadow-focus); border-color: var(--accent); }
.btn:disabled, .btn[aria-disabled="true"], .btn.disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; pointer-events: none; }
.btn-primary { background: var(--accent-grad); border-color: transparent; color: #fff; box-shadow: 0 1px 2px rgba(79,70,229,.3), inset 0 1px 0 rgba(255,255,255,.18); }
.btn-primary:hover { background: linear-gradient(135deg, #4338ca 0%, #5b4fe0 60%, #6d28d9 100%); border-color: transparent; color: #fff; box-shadow: 0 4px 14px -4px rgba(79,70,229,.6), inset 0 1px 0 rgba(255,255,255,.18); }
.btn-primary:focus-visible { box-shadow: var(--shadow-focus); }
.btn-dark { background: #0f172a; border-color: #0f172a; color: #fff; }
.btn-dark:hover { background: #1e293b; border-color: #1e293b; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--text); }
.btn-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); box-shadow: none; }
.btn-soft:hover { background: var(--accent-soft-2); border-color: transparent; color: var(--accent-text); }
.btn-outline-accent { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.btn-outline-accent:hover { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-danger-soft { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger-text); box-shadow: none; }
.btn-danger-soft:hover { background: #fee2e2; border-color: #fca5a5; color: var(--danger-text); }
.btn-warn-soft { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn-text); box-shadow: none; }
.btn-warn-soft:hover { background: #fef3c7; border-color: #fcd34d; color: var(--warn-text); }
.btn-success-soft { background: var(--success-soft); border-color: var(--success-border); color: var(--success-text); box-shadow: none; }
.btn-success-soft:hover { background: #dcfce7; color: var(--success-text); }
.btn-link { background: none; border: 0; box-shadow: none; padding: 0; height: auto; color: var(--accent); font-weight: 500; }
.btn-link:hover { background: none; color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }
.btn-link.danger { color: var(--danger-text); }
.btn-sm { height: 30px; padding: 0 .7rem; font-size: 12.5px; border-radius: 7px; }
.btn-sm i { font-size: 13px; }
.btn-xs { height: 26px; padding: 0 .55rem; font-size: 12px; border-radius: 6px; }
.btn-xs i { font-size: 12px; }
.btn-lg { height: 40px; padding: 0 1.25rem; font-size: 14px; border-radius: 10px; }
.btn-icon { width: 34px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-icon.btn-xs { width: 26px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn:not(.btn-primary):not(.btn-danger):not(.btn-dark).loading::after { border-color: var(--border-strong); border-top-color: var(--accent); }

/* ---------- 5. Badges & chips ------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .5rem; border-radius: 6px; font-size: 11px; font-weight: 600; line-height: 1.5; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral-text); letter-spacing: .01em; }
.badge i { font-size: 11px; }
.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-warn { background: var(--warn-soft); color: var(--warn-text); }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); }
.badge-info { background: var(--info-soft); color: var(--info-text); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-teal { background: var(--teal-soft); color: var(--teal-text); }
.badge-cyan { background: var(--cyan-soft); color: var(--cyan-text); }
.badge-muted { background: var(--neutral-soft); color: var(--faint); }
.badge-outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.badge-pill { border-radius: var(--r-pill); }
.badge-lg { font-size: 12px; padding: .25rem .65rem; }
.badge-xs { font-size: 10px; padding: .05rem .4rem; }
.badge-upper { text-transform: uppercase; letter-spacing: .06em; font-size: 10px; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-live .dot { animation: pulse 1.6s infinite; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.dot-success { background: var(--success); } .dot-warn { background: var(--warn); } .dot-danger { background: var(--danger); } .dot-muted { background: var(--faint); } .dot-info { background: var(--info); } .dot-cyan { background: var(--cyan); }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .4rem .2rem .6rem; border-radius: var(--r-pill); font-size: 12px; font-weight: 500; background: var(--accent-soft); color: var(--accent-text); transition: background var(--dur-1) var(--ease); }
.chip:hover { background: var(--accent-soft-2); color: var(--accent-text); }
.chip .x { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font-size: 10px; background: rgba(0,0,0,.08); }
.chip-teal { background: var(--teal-soft); color: var(--teal-text); }
.icon-box { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 14px; flex-shrink: 0; }
.icon-box.lg { width: 38px; height: 38px; border-radius: 10px; font-size: 17px; }
.icon-box.success { background: var(--success-soft); color: var(--success-text); }
.icon-box.warn { background: var(--warn-soft); color: var(--warn-text); }
.icon-box.danger { background: var(--danger-soft); color: var(--danger-text); }
.icon-box.info { background: var(--info-soft); color: var(--info-text); }
.icon-box.teal { background: var(--teal-soft); color: var(--teal-text); }
.icon-box.cyan { background: var(--cyan-soft); color: var(--cyan-text); }
.icon-box.neutral { background: var(--surface-3); color: var(--muted); }

/* ---------- 6. Cards & KPIs --------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); transition: box-shadow var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); }
.card-hover:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-1px); }
.card-body { padding: 1.1rem 1.25rem; }
.card-body.compact { padding: .85rem 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: .5rem; }
.card-head h2 i, .card-head h3 i { color: var(--faint); font-size: 14px; }
.card-head .meta { font-size: 12px; color: var(--muted); }
.card-foot { padding: .75rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.card-desc { font-size: 12.5px; color: var(--muted); margin-top: .2rem; line-height: 1.5; }
.card-section { padding: 1.1rem 1.25rem; border-top: 1px solid var(--border); }
.card-section:first-child { border-top: 0; }
.card.dashed { border-style: dashed; box-shadow: none; background: transparent; }
.card.muted { background: var(--surface-2); box-shadow: none; }
.card.accent { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm); }
.card-link { display: block; color: inherit; }
.card-link:hover { color: inherit; }
.inset { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: .85rem 1rem; }

.kpi { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1.15rem; min-width: 0; }
.kpi .kpi-label { display: flex; align-items: center; gap: .4rem; font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.kpi .kpi-label i { font-size: 13px; color: var(--accent); }
.kpi .kpi-value { font-size: var(--fs-2xl); font-weight: 650; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text); }
.kpi .kpi-value.sm { font-size: var(--fs-xl); }
.kpi .kpi-sub { font-size: 12px; color: var(--muted); }
.kpi .kpi-spark { position: absolute; right: .9rem; bottom: .6rem; width: 84px; height: 28px; opacity: .9; }
.kpi .kpi-trend { display: inline-flex; align-items: center; gap: .2rem; font-size: 11.5px; font-weight: 600; }
.kpi .kpi-foot { margin-top: .25rem; font-size: 12px; }
.kpi.kpi-link { color: inherit; }
.kpi.kpi-link::after { content: "\F285"; font-family: "bootstrap-icons"; position: absolute; top: .9rem; right: .9rem; color: var(--faint); font-size: 12px; opacity: 0; transform: translateX(-4px); transition: all var(--dur-2) var(--ease); }
.kpi.kpi-link:hover::after { opacity: 1; transform: translateX(0); }
.kpi.danger .kpi-value { color: var(--danger-text); }
.kpi.warn .kpi-value { color: var(--warn-text); }
.kpi.success .kpi-value { color: var(--success-text); }
.kpi.cyan .kpi-value { color: var(--cyan-text); }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .85rem; }
.stat { display: flex; flex-direction: column; gap: .1rem; min-width: 80px; }
.stat b { font-size: 20px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.danger b { color: var(--danger-text); } .stat.warn b { color: var(--warn-text); } .stat.success b { color: var(--success-text); } .stat.cyan b { color: var(--cyan-text); }
.stat-row { display: flex; gap: 1.75rem; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: 13px; align-items: baseline; }
.kv dt { color: var(--muted); font-weight: 500; margin: 0; }
.kv dd { margin: 0; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.kv.stacked { grid-template-columns: 1fr; gap: .5rem; }
.kv.stacked dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; }
.kv.stacked dd { margin-top: -.3rem; }
.fact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem 1.5rem; }
.fact .eyebrow { margin-bottom: .25rem; }
.fact .v { font-size: 13px; color: var(--text); }
.fact .s { font-size: 12px; color: var(--muted); }

/* ---------- 7. Tables --------------------------------------------------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; text-align: left; padding: .65rem 1rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th.right, .table td.right { text-align: right; }
.table th.center, .table td.center { text-align: center; }
.table td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-1) var(--ease); }
.table tbody tr:hover td { background: var(--surface-hover); }
.table tbody tr.selected td { background: var(--accent-soft); }
/* A row that needs attention (an organization on hold): tinted, with a bar on the left. */
.table tbody tr.flagged td { background: var(--warn-soft); }
.table tbody tr.flagged td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.table tbody tr.group-row td { background: var(--surface-2); font-size: 11.5px; font-weight: 600; color: var(--muted); padding: .45rem 1rem; text-transform: uppercase; letter-spacing: .05em; }
.table td.primary, .table .primary { color: var(--text); font-weight: 500; }
.table td a.primary:hover { color: var(--accent); }
.table .check-col { width: 40px; text-align: center; padding-left: .75rem; padding-right: .5rem; }
.table .actions-col { width: 1%; white-space: nowrap; text-align: right; }
.table .row-actions { display: inline-flex; gap: .25rem; opacity: .6; transition: opacity var(--dur-1) var(--ease); }
.table .actions-col .cluster, .table .actions-col .cluster-sm, .table .actions-col .row-actions { flex-wrap: nowrap; justify-content: flex-end; }
.table .actions-col form { margin: 0; display: inline; }
.table tr:hover .row-actions, .table tr:focus-within .row-actions { opacity: 1; }
@media (hover: none) { .table .row-actions { opacity: 1; } }
.table.compact td { padding: .5rem .75rem; }
.table.compact th { padding: .5rem .75rem; }
.table.plain { font-size: 13px; }
.table.plain th { position: static; background: transparent; padding: .35rem .5rem .45rem 0; border-bottom: 1px solid var(--border); }
.table.plain td { padding: .5rem .5rem .5rem 0; border-bottom: 1px solid var(--border); }
.table.plain tbody tr:hover td { background: transparent; }
.table .sub { display: block; font-size: 11.5px; color: var(--faint); margin-top: .1rem; }
.table th a { color: inherit; display: inline-flex; align-items: center; gap: .25rem; }
.table th a:hover { color: var(--text); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .65rem 1rem; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); background: var(--surface-2); }
.table-count { font-size: 12px; color: var(--faint); margin-bottom: .6rem; }

.pager { display: flex; align-items: center; justify-content: center; gap: .35rem; margin-top: 1rem; }
.pager .info { font-size: 12px; color: var(--muted); padding: 0 .5rem; font-variant-numeric: tabular-nums; }

/* Bulk action bar */
.action-bar { position: sticky; bottom: 1rem; z-index: 60; display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; margin-top: 1rem; padding: .65rem .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: rise var(--dur-3) var(--ease-out); }
.action-bar .count { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; display: inline-flex; align-items: center; gap: .45rem; }
.action-bar .count .n { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 .4rem; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11.5px; }
.action-bar form { display: flex; align-items: center; gap: .4rem; margin: 0; }

/* ---------- 8. Forms ---------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field + .field { margin-top: .9rem; }
/* A row of fields next to a single field (or another row) keeps the same rhythm. */
.field-row + .field, .field + .field-row, .field-row + .field-row { margin-top: .9rem; }
.field-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.field-row > .field { flex: 1; min-width: 160px; margin: 0; }
.field-row > .field.auto { flex: 0 0 auto; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .85rem 1rem; }
.field-grid > .field { margin: 0; }
.label, label.label, .field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: baseline; gap: .35rem; }
.label .opt, .label small { font-weight: 400; color: var(--muted); font-size: 12px; }
.label.upper { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.45; }
.error, .field-error { font-size: 12px; color: var(--danger-text); display: flex; align-items: center; gap: .3rem; }
.error::before, .field-error::before { content: "\F33A"; font-family: "bootstrap-icons"; font-size: 11px; }
.form-errors { margin-bottom: 1rem; }

.input, .select, .textarea, .form-control, .form-select,
.field input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=submit]):not([type=button]),
.field select, .field textarea,
.form input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=submit]):not([type=button]),
.form select, .form textarea,
.card input[type=text], .card input[type=email], .card input[type=number], .card input[type=url], .card input[type=tel], .card input[type=password], .card input[type=search], .card input[type=date], .card input[type=time], .card select, .card textarea,
.filter-bar input:not([type=checkbox]):not([type=radio]), .filter-bar select,
.action-bar input[type=text], .action-bar select {
    appearance: none; -webkit-appearance: none;
    width: 100%; max-width: 100%;
    height: 36px; padding: 0 .75rem;
    font: inherit; font-size: 13.5px; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
    box-shadow: var(--shadow-xs);
    transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.input::placeholder, .field input::placeholder, .form input::placeholder, textarea::placeholder, .filter-bar input::placeholder { color: var(--faint); }
.input:hover, .field input:hover, .field select:hover, .field textarea:hover, .form input:hover, .form select:hover, .form textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus,
.field input:focus, .field select:focus, .field textarea:focus,
.form input:focus, .form select:focus, .form textarea:focus,
.card input:focus, .card select:focus, .card textarea:focus,
.filter-bar input:focus, .filter-bar select:focus, .action-bar input:focus, .action-bar select:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }
.field input:disabled, .field select:disabled, .field textarea:disabled, .input:disabled, fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea { background: var(--surface-2); color: var(--muted); cursor: not-allowed; box-shadow: none; }
.field textarea, .form textarea, .textarea, .card textarea { height: auto; min-height: 96px; padding: .6rem .75rem; line-height: 1.5; resize: vertical; }
.field select, .form select, .select, .card select, .filter-bar select, .action-bar select {
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .7rem center;
}
.field select[multiple], .form select[multiple] { height: auto; min-height: 120px; padding: .4rem; background-image: none; }
.field select[multiple] option, .form select[multiple] option { padding: .3rem .5rem; border-radius: 5px; }
.input-sm, .field .sm input, .field .sm select { height: 30px; font-size: 12.5px; padding: 0 .6rem; }
.input-xs { height: 28px; font-size: 12px; padding: 0 .5rem; }
.input-w-xs { width: 72px; } .input-w-sm { width: 110px; } .input-w-md { width: 180px; } .input-w-lg { width: 280px; }
.input-group { display: flex; align-items: stretch; }
.input-group > * { border-radius: 0 !important; margin-left: -1px; }
.input-group > :first-child { border-radius: var(--r) 0 0 var(--r) !important; margin-left: 0; }
.input-group > :last-child { border-radius: 0 var(--r) var(--r) 0 !important; }
.input-group .btn { height: 36px; }
.input-group > .addon { display: flex; align-items: center; height: 36px; padding: 0 .75rem; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: 13px; white-space: nowrap; }
.input-group > input { min-width: 0; }
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix > i, .input-affix > .prefix { position: absolute; left: .7rem; color: var(--faint); font-size: 13px; pointer-events: none; }
.input-affix > input { padding-left: 2rem !important; }
.input-affix.suffix > i { left: auto; right: .7rem; }
.input-affix.suffix > input { padding-left: .75rem !important; padding-right: 2rem !important; }
input[type=file] { font-size: 13px; color: var(--muted); }
input[type=file]::file-selector-button { font: inherit; font-size: 12.5px; font-weight: 500; margin-right: .75rem; padding: .35rem .7rem; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text-2); cursor: pointer; transition: background var(--dur-1) var(--ease); }
input[type=file]::file-selector-button:hover { background: var(--surface-3); }
.field input[type=file] { height: auto; padding: .4rem; }
input[type=date], input[type=time] { font-variant-numeric: tabular-nums; }
input[type=date]::-webkit-calendar-picker-indicator, input[type=time]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
input[type=range] { accent-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

/* Checkbox / radio */
input[type=checkbox], input[type=radio] {
    appearance: none; -webkit-appearance: none;
    width: 16px; height: 16px; margin: 0; flex-shrink: 0;
    border: 1.5px solid var(--border-strong); border-radius: 4px; background: var(--surface);
    display: inline-grid; place-items: center; cursor: pointer; vertical-align: middle;
    transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--accent); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { box-shadow: var(--shadow-focus); outline: none; }
input[type=checkbox]:checked, input[type=radio]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) scale(0) translate(1px, -1px); transition: transform var(--dur-1) var(--ease); }
input[type=checkbox]:checked::after { transform: rotate(-45deg) scale(1) translate(1px, -1px); }
input[type=checkbox]:indeterminate { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:indeterminate::after { width: 8px; height: 0; border: 0; border-top: 2px solid #fff; transform: none; }
input[type=radio]::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform var(--dur-1) var(--ease); }
input[type=radio]:checked::after { transform: scale(1); }
input[type=checkbox]:disabled, input[type=radio]:disabled { opacity: .5; cursor: not-allowed; }
.check { display: flex; align-items: flex-start; gap: .6rem; font-size: 13.5px; color: var(--text); cursor: pointer; line-height: 1.4; }
.check input { margin-top: 2px; }
.check .hint { display: block; margin-top: .15rem; }
.check.inline { display: inline-flex; align-items: center; }
.check-list { display: flex; flex-direction: column; gap: .5rem; }
.check-list ul, .check-list li { list-style: none; margin: 0; padding: 0; }
.check-list label { display: flex; align-items: center; gap: .6rem; font-size: 13.5px; cursor: pointer; padding: .2rem 0; }
.radio-cards { display: flex; flex-direction: column; gap: .4rem; }
.radio-cards > div { display: flex; flex-direction: column; gap: .4rem; }
.radio-cards > div > div { display: contents; }
.radio-cards label { display: flex; align-items: flex-start; gap: .6rem; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: var(--r); font-size: 13px; cursor: pointer; background: var(--surface); transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease); }
.radio-cards label:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.radio-cards label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-cards ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.radio-cards li label { display: flex; }
/* Switch: wrap a checkbox in label.switch */
.switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-size: 13.5px; }
.switch input { width: 34px; height: 20px; border-radius: 999px; border: 0; background: var(--border-strong); position: relative; transition: background var(--dur-2) var(--ease); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); border: 0; transform: none; transition: transform var(--dur-2) var(--ease-out); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }
.switch.top { align-items: flex-start; }
.switch.top input { margin-top: 1px; }
/* Chip checkboxes (e.g. weekdays) */
.chip-checks { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip-checks label { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); font-size: 13px; font-weight: 500; cursor: pointer; transition: all var(--dur-1) var(--ease); }
.chip-checks label:hover { border-color: var(--border-strong); }
.chip-checks label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip-checks input { width: 14px; height: 14px; }
.form-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-top: 1.25rem; }
.form-actions.sticky { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); padding: .85rem 0; margin-top: 1rem; border-top: 1px solid var(--border); }

/* ---------- 9. Filters, pills, tabs, segmented --------------------------- */
.filter-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.filter-bar .search { flex: 1; min-width: 220px; }
.filter-bar input, .filter-bar select, .card .filter-bar input:not([type=checkbox]):not([type=radio]), .card .filter-bar select { width: auto; }
.filter-bar form { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 0; }
.filter-bar .sep { color: var(--faint); font-size: 12px; }
.filter-bar .search input { width: 100%; }
/* A form pushed to the right end of the line (the staff organizations search). */
.filter-bar > form.end { margin-left: auto; flex: 0 1 320px; }
.filter-bar > form.end .search { min-width: 0; }
.search-match { margin-top: .15rem; font-weight: 400; }
.search-match i { font-size: 10px; }
.filter-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1rem; margin-top: .75rem; box-shadow: var(--shadow-sm); }
.active-filters { display: flex; flex-wrap: wrap; gap: .35rem; margin: .75rem 0; }

.pills { display: inline-flex; gap: .3rem; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: .35rem; height: 30px; padding: 0 .8rem; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 500; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); white-space: nowrap; transition: all var(--dur-1) var(--ease); }
.pill:hover { border-color: var(--border-strong); background: var(--surface-hover); color: var(--text); }
.pill.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px -2px rgba(79,70,229,.5); }
.pill.active:hover { color: #fff; }
.pill.danger.active { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger-text); box-shadow: none; }
.pill .n { font-size: 11px; font-weight: 600; padding: 0 .4rem; min-width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.pill.active .n { background: rgba(255,255,255,.22); color: #fff; }
.pill.danger.active .n { background: var(--danger-border); color: var(--danger-text); }
.pill-sm { height: 26px; padding: 0 .65rem; font-size: 12px; }

.seg { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 9px; gap: 2px; }
.seg a, .seg button { display: inline-flex; align-items: center; gap: .3rem; height: 28px; padding: 0 .75rem; border-radius: 7px; font: inherit; font-size: 12.5px; font-weight: 500; color: var(--muted); background: transparent; border: 0; cursor: pointer; white-space: nowrap; transition: all var(--dur-2) var(--ease); }
.seg a:hover, .seg button:hover { color: var(--text); }
.seg .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.tabs { position: relative; display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: .4rem; padding: .6rem .8rem; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; border: 0; background: none; cursor: pointer; font-family: inherit; border-radius: 6px 6px 0 0; transition: color var(--dur-1) var(--ease), background var(--dur-1) var(--ease); }
.tab i { font-size: 14px; }
.tab:hover { color: var(--text); background: var(--surface-3); }
.tab.active { color: var(--accent); }
.tab .n { font-size: 11px; font-weight: 600; padding: 0 .35rem; min-width: 17px; height: 17px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.tab.active .n { background: var(--accent-soft); color: var(--accent-text); }
.tabs .indicator { position: absolute; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); transition: left var(--dur-3) var(--ease-out), width var(--dur-3) var(--ease-out); }
.tabs.no-js .tab.active::after, .tabs:not(.has-indicator) .tab.active::after { content: ""; position: absolute; left: .4rem; right: .4rem; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.tab-panel { animation: fade-in var(--dur-2) var(--ease); }
.tab-panel[hidden] { display: none; }
.subnav { display: flex; gap: .25rem; flex-wrap: wrap; }
.subnav a { display: inline-flex; align-items: center; gap: .4rem; height: 32px; padding: 0 .7rem; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--muted); transition: all var(--dur-1) var(--ease); }
.subnav a i { font-size: 14px; }
.subnav a:hover { background: var(--surface-3); color: var(--text); }
.subnav a.active { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- 10. Alerts, notes, toasts ----------------------------------- */
.alert { display: flex; align-items: flex-start; gap: .6rem; padding: .7rem .9rem; border-radius: var(--r); border: 1px solid; font-size: 13px; line-height: 1.45; }
.alert > i { font-size: 15px; margin-top: 1px; flex-shrink: 0; }
.alert a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.alert-info { background: var(--info-soft); color: var(--info-text); border-color: var(--info-border); }
.alert-success { background: var(--success-soft); color: var(--success-text); border-color: var(--success-border); }
.alert-warn, .alert-warning { background: var(--warn-soft); color: var(--warn-text); border-color: var(--warn-border); }
.alert-danger, .alert-error { background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger-border); }
.alert-neutral { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.alert .body { flex: 1; min-width: 0; }
.alert .title { font-weight: 600; display: block; margin-bottom: .1rem; }
.alert ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.note { display: flex; align-items: flex-start; gap: .4rem; font-size: 12px; color: var(--muted); line-height: 1.5; }
.note i { color: var(--faint); margin-top: 2px; }
.callout { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: .7rem .9rem; border-radius: 0 var(--r) var(--r) 0; font-size: 13px; color: var(--accent-text); }

.toasts { position: fixed; top: 1rem; right: 1rem; z-index: 500; display: flex; flex-direction: column; gap: .5rem; width: min(380px, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; position: relative; display: flex; align-items: flex-start; gap: .65rem; padding: .75rem .9rem .75rem .85rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); font-size: 13px; color: var(--text); overflow: hidden; animation: toast-in var(--dur-3) var(--ease-out); }
.toast.leaving { animation: toast-out var(--dur-2) var(--ease) forwards; }
.toast > i { font-size: 16px; margin-top: 1px; flex-shrink: 0; }
.toast-success > i { color: var(--success); } .toast-error > i, .toast-danger > i { color: var(--danger); } .toast-warning > i { color: var(--warn); } .toast-info > i { color: var(--info); }
.toast .msg { flex: 1; line-height: 1.45; }
.toast .close { background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 14px; padding: 0; line-height: 1; margin-top: 1px; }
.toast .close:hover { color: var(--text); }
.toast .bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--accent); transform-origin: left; animation: toast-bar 6s linear forwards; }
.toast-success .bar { background: var(--success); } .toast-error .bar, .toast-danger .bar { background: var(--danger); } .toast-warning .bar { background: var(--warn); }
.toast:hover .bar { animation-play-state: paused; }

/* ---------- 11. Menus, drawers, dialogs, tooltips ----------------------- */
.menu-wrap { position: relative; display: inline-block; }
.menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 200px; z-index: 300; padding: .35rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top right; pointer-events: none; transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease-out); }
.menu.left { right: auto; left: 0; transform-origin: top left; }
.menu.open { opacity: 1; transform: none; pointer-events: auto; }
/* Inside a scrolling table: fixed, placed by engage.js under (or, .up, above) its toggle. */
.table-wrap .menu { position: fixed; top: 0; left: 0; right: auto; }
.table-wrap .menu:not(.open) { visibility: hidden; }
.menu.up { transform-origin: bottom right; }
.menu.up:not(.open) { transform: translateY(6px) scale(.98); }
.menu-item { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .5rem .65rem; border-radius: 7px; font: inherit; font-size: 13px; color: var(--text-2); background: none; border: 0; text-align: left; cursor: pointer; white-space: nowrap; transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.menu-item i { font-size: 14px; color: var(--faint); width: 16px; text-align: center; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); color: var(--text); outline: none; }
.menu-item:hover i { color: var(--text-2); }
.menu-item.danger { color: var(--danger-text); }
.menu-item.danger:hover { background: var(--danger-soft); }
.menu-item.active { background: var(--accent-soft); color: var(--accent-text); }
.menu-item.active i { color: var(--accent); }
.menu-item kbd, .menu-item .badge { margin-left: auto; }
.menu-sep { height: 1px; background: var(--border); margin: .35rem .25rem; }
.menu-label { padding: .4rem .65rem .2rem; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.menu-head { padding: .5rem .65rem .6rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.menu-head b { display: block; font-size: 13px; }
.menu-head small { color: var(--muted); font-size: 12px; }
.menu form { margin: 0; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 400; background: rgba(2,6,23,.45); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity var(--dur-3) var(--ease); }
.drawer-backdrop.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 410; width: min(480px, 100vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(100%); transition: transform var(--dur-3) var(--ease-out); visibility: hidden; }
.drawer.open { transform: none; visibility: visible; }
.drawer.lg { width: min(640px, 100vw); }
.drawer-head { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.drawer-head h2 { flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 1.25rem; }
.drawer-foot { padding: .9rem 1.25rem; border-top: 1px solid var(--border); display: flex; gap: .5rem; justify-content: flex-end; background: var(--surface-2); }

dialog.dialog { border: 0; padding: 0; background: transparent; max-width: min(440px, calc(100vw - 2rem)); width: 100%; }
dialog.dialog::backdrop { background: rgba(2,6,23,.5); backdrop-filter: blur(3px); animation: fade-in var(--dur-2) var(--ease); }
dialog.dialog[open] .dialog-box { animation: dialog-in var(--dur-3) var(--ease-out); }
.dialog-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 1.35rem 1.4rem 1.2rem; }
.dialog-box .icon-box { margin-bottom: .85rem; }
.dialog-box h3 { font-size: 15px; margin-bottom: .35rem; }
.dialog-box p { font-size: 13px; color: var(--muted); line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }

[data-tooltip] { position: relative; }
[data-tooltip]::after { content: attr(data-tooltip); position: absolute; left: 50%; bottom: calc(100% + 7px); transform: translateX(-50%) translateY(4px); background: #0f172a; color: #fff; font-size: 11.5px; font-weight: 500; line-height: 1.35; padding: .35rem .55rem; border-radius: 6px; white-space: nowrap; max-width: 280px; opacity: 0; pointer-events: none; transition: opacity var(--dur-1) var(--ease), transform var(--dur-1) var(--ease); z-index: 320; box-shadow: var(--shadow-md); }
[data-tooltip]:hover::after, [data-tooltip]:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }
[data-tooltip].tip-wrap::after { white-space: normal; width: max-content; }
/* Opens below the element — for anything at the top edge of the page (the trial bar). */
[data-tooltip].tip-below::after { bottom: auto; top: calc(100% + 7px); transform: translateX(-50%) translateY(-4px); }
[data-tooltip].tip-below:hover::after, [data-tooltip].tip-below:focus-visible::after { transform: translateX(-50%) translateY(0); }
/* .tip-start: anchored to the element's left edge and opening rightwards — for an element at the
   left of a clipping container (the first column of a scrolling table). */
[data-tooltip].tip-start::after { left: 0; transform: translateY(4px); }
[data-tooltip].tip-start:hover::after, [data-tooltip].tip-start:focus-visible::after { transform: translateY(0); }
/* .tip-end: the mirror — anchored to the right edge, opening leftwards — for an element at the
   right of a clipping container (the actions column of a scrolling table). Even hidden, a centred
   tooltip there pokes out and gives the table a horizontal scrollbar. */
[data-tooltip].tip-end::after { left: auto; right: 0; transform: translateY(4px); }
[data-tooltip].tip-end:hover::after, [data-tooltip].tip-end:focus-visible::after { transform: translateY(0); }
/* A full-width banner: the tooltip sits under the banner's text (its left edge), not under the middle of the page. */
.banner[data-tooltip].tip-below::after { left: 1.5rem; transform: translateY(-4px); }
.banner[data-tooltip].tip-below:hover::after, .banner[data-tooltip].tip-below:focus-visible::after { transform: translateY(0); }

/* ---------- 12. Feedback: progress, skeleton, empty, spinner ------------ */
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span, .progress > div { display: block; height: 100%; border-radius: 999px; background: var(--accent-grad); transition: width var(--dur-3) var(--ease-out); animation: grow-x var(--dur-3) var(--ease-out); transform-origin: left; }
.progress.sm { height: 5px; }
.progress.lg { height: 12px; }
.progress .success { background: var(--success); } .progress .warn { background: var(--warn); } .progress .danger { background: var(--danger); } .progress .teal { background: var(--teal); }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: .3rem; font-variant-numeric: tabular-nums; }
.bar-row { display: grid; grid-template-columns: 120px 1fr auto; gap: .9rem; align-items: center; font-size: 13px; }
.bar-row .name { font-weight: 600; display: flex; align-items: center; gap: .35rem; }
.bar-row .progress { height: 20px; border-radius: 6px; }
.bar-row .progress > span { border-radius: 6px; }
.bar-row .vals { font-size: 12px; color: var(--muted); white-space: nowrap; }
.bar-row .vals b { color: var(--text); }

.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 6px; color: transparent !important; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent); animation: shimmer 1.4s infinite; }
.skeleton-line { height: 12px; margin: .35rem 0; }
.skeleton-line.w-60 { width: 60%; } .skeleton-line.w-40 { width: 40%; } .skeleton-line.w-80 { width: 80%; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
.spinner.lg { width: 28px; height: 28px; border-width: 3px; }

.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 3rem 1.5rem; color: var(--muted); }
.empty .icon-box { width: 48px; height: 48px; border-radius: 14px; font-size: 22px; margin-bottom: .9rem; background: var(--surface-3); color: var(--faint); }
/* A tinted icon keeps its tint inside an empty state (the grey above is only the default). */
.empty .icon-box.warn { background: var(--warn-soft); color: var(--warn-text); }
.empty .icon-box.success { background: var(--success-soft); color: var(--success-text); }
.empty .icon-box.danger { background: var(--danger-soft); color: var(--danger-text); }
.empty .icon-box.info { background: var(--info-soft); color: var(--info-text); }
.empty .icon-box.accent { background: var(--accent-soft); color: var(--accent-text); }
.empty h3 { font-size: 14px; color: var(--text); margin-bottom: .25rem; }
.empty p { font-size: 13px; max-width: 42ch; }
.empty .actions { margin-top: 1rem; display: flex; gap: .5rem; }
.empty.sm { padding: 1.75rem 1rem; }
.empty.sm .icon-box { width: 38px; height: 38px; font-size: 17px; border-radius: 10px; margin-bottom: .6rem; }
.empty.card, .empty.dashed { border: 1px dashed var(--border); border-radius: var(--r-lg); background: transparent; box-shadow: none; }

/* ---------- 13. Timeline, thread, calls --------------------------------- */
.timeline { position: relative; padding-left: 1.6rem; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--border); border-radius: 2px; }
.tl-item { position: relative; margin-bottom: 1rem; animation: fade-up var(--dur-3) var(--ease-out) backwards; }
.tl-item::before { content: ""; position: absolute; left: calc(-1.6rem + 1px); top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.tl-item.success::before { background: var(--success); } .tl-item.danger::before { background: var(--danger); } .tl-item.muted::before { background: var(--faint); } .tl-item.cyan::before { background: var(--cyan); } .tl-item.warn::before { background: var(--warn); }
.tl-item .tl-text { font-size: 13px; color: var(--text-2); }
.tl-item .tl-time { font-size: 12px; color: var(--faint); margin-top: .1rem; }
.tl-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: .75rem .95rem; box-shadow: var(--shadow-xs); }
.tl-card .tl-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.tl-card .tl-title { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.tl-card .tl-title i { color: var(--muted); }
.tl-card .tl-title .light { font-weight: 400; color: var(--muted); }
.tl-card .tl-meta { font-size: 12px; color: var(--faint); margin-top: .3rem; }
.tl-card .tl-foot { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }

.thread { display: flex; flex-direction: column; gap: .85rem; }
.msg { display: flex; max-width: 100%; animation: fade-up var(--dur-3) var(--ease-out) backwards; }
.msg.in { justify-content: flex-start; }
.msg.out { justify-content: flex-end; }
.bubble { max-width: min(78%, 640px); border-radius: 14px; padding: .7rem .95rem; font-size: 13.5px; line-height: 1.5; color: var(--text); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); }
.msg.in .bubble { border-bottom-left-radius: 4px; }
.msg.out .bubble { background: var(--accent-soft); border-color: var(--accent-soft-2); border-bottom-right-radius: 4px; }
.msg.out .bubble.human { background: var(--accent-grad); border-color: transparent; color: #fff; }
.msg.out .bubble.human .meta, .msg.out .bubble.human .meta b { color: rgba(255,255,255,.85); }
.bubble .meta { display: flex; align-items: center; gap: .4rem; font-size: 11px; color: var(--muted); margin-bottom: .3rem; flex-wrap: wrap; }
.bubble .meta b { color: var(--text-2); display: inline-flex; align-items: center; gap: .3rem; }
.bubble .subject { font-size: 12.5px; font-weight: 600; margin-bottom: .2rem; }
.bubble .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.draft { max-width: 100%; width: 100%; border-style: dashed; border-color: var(--accent-soft-2); background: var(--accent-soft); }
.bubble.draft .meta { color: var(--accent-text); font-weight: 600; }
.sys-line { display: flex; align-items: center; gap: .6rem; font-size: 11.5px; color: var(--faint); margin: .25rem 0; }
.sys-line::before, .sys-line::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.day-sep { text-align: center; font-size: 11px; color: var(--faint); font-weight: 500; margin: .25rem 0; }

.call-card { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; box-shadow: var(--shadow-xs); }
.call-card .call-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .6rem .9rem; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.call-card .call-head .title { font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: .4rem; }
.call-card .call-head .time { margin-left: auto; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.call-card .call-route { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .45rem .9rem; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.call-card .call-route .arrow { color: var(--faint); }
.call-card .call-reason { display: flex; align-items: center; gap: .45rem; padding: .55rem .9rem; font-size: 12.5px; color: var(--warn-text); background: var(--warn-soft); }
.call-card .call-events { display: flex; flex-direction: column; gap: .4rem; padding: .7rem .9rem; border-bottom: 1px solid var(--border); }
.call-ev { display: flex; align-items: center; gap: .55rem; font-size: 12.5px; color: var(--text-2); }
.call-ev .icon-box { width: 24px; height: 24px; font-size: 12px; border-radius: 7px; }
.call-ev .t { margin-left: auto; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.call-card .transcript { display: flex; flex-direction: column; gap: .5rem; padding: .7rem .9rem; }
.call-card .turn { display: flex; }
.call-card .turn.agent { justify-content: flex-start; }
.call-card .turn.prospect { justify-content: flex-end; }
.call-card .turn > div { max-width: 82%; }
.call-card .turn .who { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .15rem; color: var(--accent); }
.call-card .turn.prospect .who { text-align: right; color: var(--muted); }
.call-card .turn .text { font-size: 13px; line-height: 1.45; padding: .45rem .7rem; border-radius: 10px; white-space: pre-wrap; background: var(--accent-soft); color: var(--text); }
.call-card .turn.prospect .text { background: var(--surface-3); }
.call-card .call-foot { display: flex; align-items: center; gap: .75rem; padding: .55rem .9rem; border-top: 1px solid var(--border); font-size: 12.5px; }
.audio-player { display: flex; align-items: center; gap: .6rem; width: 100%; }
.audio-player audio { flex: 1; height: 34px; min-width: 0; }
audio { accent-color: var(--accent); }
audio::-webkit-media-controls-panel { background: var(--surface-2); }

/* ---------- 14. Inbox workspace ----------------------------------------- */
.inbox { display: grid; grid-template-columns: 340px minmax(0,1fr); height: calc(100vh - var(--topbar-h)); min-height: 520px; background: var(--surface); }
.inbox.has-side { grid-template-columns: 340px minmax(0,1fr) 300px; }
.inbox.side-closed { grid-template-columns: 340px minmax(0,1fr); }
.inbox.side-closed .inbox-side { display: none; }
.inbox-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: var(--surface); }
.inbox-list-head { padding: .85rem 1rem .6rem; border-bottom: 1px solid var(--border); }
.inbox-list-head h1 { font-size: 16px; display: flex; align-items: center; gap: .5rem; }
.inbox-list-head .sub { font-size: 12px; color: var(--muted); margin-top: .1rem; }
.inbox-list-head .pills { margin-top: .6rem; gap: .25rem; }
.inbox-list-head .pill { height: 26px; padding: 0 .6rem; font-size: 12px; }
.inbox-rows { flex: 1; overflow-y: auto; min-height: 0; }
.conv-row { display: grid; grid-template-columns: 36px minmax(0,1fr) auto; gap: .65rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); color: inherit; position: relative; transition: background var(--dur-1) var(--ease); cursor: pointer; }
.conv-row:hover { background: var(--surface-hover); color: inherit; }
.conv-row.active { background: var(--accent-soft); }
.conv-row.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.conv-row .avatar { width: 36px; height: 36px; font-size: 12px; }
.conv-row.unread .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.conv-row .name { display: flex; align-items: center; gap: .35rem; font-size: 13px; font-weight: 500; color: var(--text); min-width: 0; }
.conv-row.unread .name { font-weight: 650; }
.conv-row .name .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-row .camp { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: .3rem; }
.conv-row .preview { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: .15rem; display: flex; align-items: center; gap: .3rem; }
.conv-row.unread .preview { color: var(--text-2); }
.conv-row .preview i { color: var(--success); font-size: 11px; flex-shrink: 0; }
.conv-row .side { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; font-size: 11px; color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.conv-row .side .flags { display: flex; gap: .25rem; }
.conv-row .side .badge { font-size: 9.5px; padding: .05rem .35rem; }
.inbox-list-foot { padding: .5rem .75rem; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }

.inbox-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.conv-head { display: flex; align-items: center; gap: .8rem; padding: .75rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.conv-head .who { min-width: 0; flex: 1; }
.conv-head .who h1 { font-size: 15px; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.conv-head .who .sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.conv-head .actions { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.conv-body { flex: 1; overflow-y: auto; padding: 1.25rem 1.5rem; min-height: 0; }
.conv-compose { background: var(--surface); border-top: 1px solid var(--border); padding: .85rem 1.25rem; }
.conv-compose textarea { min-height: 76px; border: 0; box-shadow: none; padding: .25rem 0; background: transparent; width: 100%; resize: none; font: inherit; font-size: 13.5px; color: var(--text); }
.conv-compose textarea:focus { outline: none; box-shadow: none; }
.conv-compose .subject { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; padding: .2rem 0 .4rem; margin-bottom: .4rem; height: auto; background: transparent; width: 100%; font: inherit; font-size: 13px; font-weight: 600; color: var(--text); }
.conv-compose .subject:focus { outline: none; box-shadow: none; border-color: var(--accent); }
.conv-compose .compose-box { border: 1px solid var(--border); border-radius: var(--r-lg); padding: .6rem .85rem .5rem; background: var(--surface); transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease); }
.conv-compose .compose-box:focus-within { border-color: var(--accent); box-shadow: var(--shadow-focus); }
.conv-compose .compose-foot { display: flex; align-items: center; gap: .75rem; margin-top: .3rem; }
.conv-compose .compose-foot .hint { flex: 1; }
.inbox-side { border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; min-height: 0; }
.side-section { padding: 1rem 1.1rem; border-bottom: 1px solid var(--border); }
.side-section h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin-bottom: .6rem; display: flex; align-items: center; justify-content: space-between; }
.side-section h3 a { font-size: 11px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.side-contact { display: flex; align-items: center; gap: .75rem; }
.side-contact .n { font-size: 14px; font-weight: 600; }
.side-contact .s { font-size: 12px; color: var(--muted); }
.side-list { display: flex; flex-direction: column; gap: .45rem; font-size: 12.5px; }
.side-list .row { display: flex; align-items: flex-start; gap: .5rem; color: var(--text-2); min-width: 0; }
.side-list .row i { color: var(--faint); width: 16px; text-align: center; margin-top: 2px; flex-shrink: 0; }
.side-list .row span { overflow-wrap: anywhere; min-width: 0; }
.inbox-empty { flex: 1; display: flex; align-items: center; justify-content: center; }
.inbox-mobile-back { display: none; }

/* ---------- 15. Charts -------------------------------------------------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .bar { transition: opacity var(--dur-1) var(--ease); transform-origin: bottom; }
.chart.animate .bar { animation: grow-y .6s var(--ease-out) both; }
.chart .bar-group:hover .bar { opacity: .75; }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 2 4; }
.chart .axis-label { fill: var(--faint); font-size: 10.5px; font-family: var(--font); }
.chart-tip { position: absolute; z-index: 20; pointer-events: none; background: #0f172a; color: #fff; font-size: 11.5px; line-height: 1.4; padding: .4rem .6rem; border-radius: 7px; box-shadow: var(--shadow-md); white-space: nowrap; opacity: 0; transform: translate(-50%, -100%) translateY(-8px) scale(.97); transition: opacity var(--dur-1) var(--ease), transform var(--dur-1) var(--ease); }
.chart-tip.show { opacity: 1; transform: translate(-50%, -100%) translateY(-10px) scale(1); }
.chart-tip b { display: block; font-weight: 600; color: #cbd5e1; margin-bottom: .1rem; font-size: 11px; }
.chart-tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: .35rem; vertical-align: middle; }
.legend { display: flex; gap: 1rem; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.spark { width: 100%; height: 100%; }
.spark path.line { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.spark path.area { fill: url(#sparkfill); opacity: .35; }
.chart.animate .spark path.line { stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 1.1s var(--ease-out) forwards; }
.chart.animate > svg > path.line { stroke-dasharray: 2400; stroke-dashoffset: 2400; animation: draw 1.6s var(--ease-out) forwards; }
.spark-bars .bar { fill: var(--accent); opacity: .85; }
.ring { position: relative; width: 56px; height: 56px; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring .track { stroke: var(--surface-3); }
.ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .8s var(--ease-out); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 600; }

/* ---------- 16. Misc domain components ---------------------------------- */
.lane { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-xl); padding: .9rem; min-width: 0; }
.lane-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.lane-head h2 { font-size: 14px; }
.step-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: .8rem .9rem; margin-bottom: .55rem; box-shadow: var(--shadow-xs); transition: box-shadow var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease); position: relative; }
.step-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.step-card .step-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .45rem; }
.step-card .step-title { display: flex; align-items: center; gap: .5rem; min-width: 0; font-size: 13px; font-weight: 600; }
.step-card .step-summary { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: .5rem; }
.step-card .step-foot { display: flex; align-items: center; gap: .5rem; font-size: 12px; color: var(--muted); }
.step-card .step-foot input { height: 28px; width: 68px; padding: 0 .45rem; font-size: 12px; text-align: right; }
.step-tools { display: flex; gap: .1rem; opacity: .35; transition: opacity var(--dur-1) var(--ease); }
.step-card:hover .step-tools, .step-card:focus-within .step-tools { opacity: 1; }
.step-tools form { display: inline; margin: 0; }
.connector { display: flex; justify-content: center; color: var(--faint); font-size: 12px; margin: -.3rem 0 .25rem; }
.funnel-card { flex: 1; min-width: 180px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: .85rem 1rem; }
.list-item { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease); }
.list-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.list-item .main { flex: 1; min-width: 0; }
.list-item .t { font-size: 13.5px; font-weight: 600; }
.list-item .s { font-size: 12px; color: var(--muted); }
.list-rows { display: flex; flex-direction: column; gap: .5rem; }
.rows { display: flex; flex-direction: column; }
.rows > * { padding: .65rem 0; border-bottom: 1px solid var(--border); }
.rows > :last-child { border-bottom: 0; }
.rows > :first-child { padding-top: 0; }
.plan-card { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.1rem; background: var(--surface); position: relative; transition: all var(--dur-2) var(--ease); }
.plan-card:hover { box-shadow: var(--shadow-md); }
.plan-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-card .price { font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin: .3rem 0; }
.plan-card .price small { font-size: 12px; font-weight: 400; color: var(--muted); }
.plan-card ul { margin: .5rem 0 1rem; padding-left: 1rem; font-size: 12.5px; color: var(--text-2); }
.plan-card li { margin: .2rem 0; }
.dns-row { display: grid; grid-template-columns: 90px 1fr; gap: .25rem .75rem; font-size: 12.5px; }
.dns-row code { overflow-wrap: anywhere; }
.copy-field { display: flex; align-items: center; gap: .4rem; }
.copy-field code { flex: 1; padding: .4rem .6rem; font-size: 12px; overflow-wrap: anywhere; }
.steps-nav { display: flex; gap: .5rem; counter-reset: step; }
.steps-nav .s { display: flex; align-items: center; gap: .5rem; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.steps-nav .s::before { counter-increment: step; content: counter(step); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); font-size: 11px; }
.steps-nav .s.done::before { background: var(--success); border-color: var(--success); color: #fff; content: "✓"; }
.steps-nav .s.active { color: var(--text); }
.steps-nav .s.active::before { background: var(--accent); border-color: var(--accent); color: #fff; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(900px 500px at 10% -10%, rgba(99,102,241,.16), transparent 60%), radial-gradient(700px 500px at 100% 110%, rgba(124,58,237,.12), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 2rem; animation: dialog-in var(--dur-3) var(--ease-out); }
.login-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.5rem; }
.login-brand .brand-icon { width: 40px; height: 40px; border-radius: 11px; font-size: 14px; }
.login-brand b { display: block; font-size: 16px; letter-spacing: -.01em; }
.login-brand small { color: var(--muted); font-size: 12.5px; }
.login-card .field + .field { margin-top: 1rem; }
.login-foot { text-align: center; font-size: 12px; color: var(--faint); margin-top: 1.25rem; }
.staff-nav { position: sticky; top: 0; z-index: 150; height: var(--topbar-h); display: flex; align-items: center; gap: 1.25rem; padding: 0 1.5rem; background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.staff-nav .brand { display: flex; align-items: center; gap: .6rem; font-weight: 650; color: var(--text); letter-spacing: -.01em; white-space: nowrap; flex-shrink: 0; }
/* Links never wrap (long translations broke the bar into three-line items); when the window is
   too narrow for all of them the nav scrolls sideways instead. */
.staff-nav .nav { display: flex; align-items: stretch; height: 100%; gap: .1rem; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.staff-nav .nav::-webkit-scrollbar { display: none; }
.staff-nav .nav a { position: relative; display: flex; align-items: center; gap: .4rem; padding: 0 .75rem; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; flex-shrink: 0; transition: color var(--dur-1) var(--ease); }
@media (max-width: 1440px) { .staff-nav { gap: .9rem; } .staff-nav .nav a { padding: 0 .55rem; } }
.staff-nav .nav a i { font-size: 14px; }
.staff-nav .nav a:hover { color: var(--text); }
.staff-nav .nav a.active { color: var(--text); }
.staff-nav .nav a.active::after { content: ""; position: absolute; left: .5rem; right: .5rem; bottom: 0; height: 2px; background: var(--accent); border-radius: 2px; }
.staff-nav .right { margin-left: auto; display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.staff-page { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; animation: page-in var(--dur-3) var(--ease-out) backwards; }
.capacity { display: flex; align-items: center; gap: .6rem; font-size: 12px; color: var(--muted); }
.capacity .progress { flex: 1; }
/* Sign-up host shell (signup/base.html): top bar, centred page, footer; .prose = long legal text */
.signup-shell { min-height: 100vh; display: flex; flex-direction: column; }
.signup-nav { position: sticky; top: 0; z-index: 150; height: var(--topbar-h); display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem; background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.signup-nav .brand { display: flex; align-items: center; gap: .6rem; font-weight: 650; color: var(--text); letter-spacing: -.01em; white-space: nowrap; }
.signup-nav .right { margin-left: auto; display: flex; align-items: center; gap: .4rem; }
.signup-page { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 2rem 1.5rem 3rem; animation: page-in var(--dur-3) var(--ease-out) backwards; }
.signup-page > .narrow, .signup-page > .narrow-md, .signup-page > .narrow-sm { margin-left: auto; margin-right: auto; }
/* Registration form: progress indicator above the step card; fine print under it */
.signup-steps { flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: 1.25rem; }
.signup-fine { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-top: 1rem; font-size: 12.5px; color: var(--muted); }
.signup-fine form { display: inline; }
/* What the sign-up is for (trial / plan + "Change"), under the progress indicator */
.signup-order { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem; margin: -.4rem 0 1rem; padding: .55rem .85rem; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2, var(--surface)); font-size: 13px; }
.signup-order .what { display: inline-flex; align-items: center; gap: .5rem; color: var(--text); }
.signup-order .what i { color: var(--accent); }
.signup-order a { font-weight: 500; white-space: nowrap; }
/* Trial card step: start free, or buy a plan now (signup/payment.html) */
.signup-choice { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1rem; }
.signup-choice > * { display: flex; flex-direction: column; gap: .2rem; padding: .7rem .85rem; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--text); font-size: 13px; text-decoration: none; }
.signup-choice > a:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.signup-choice > .on { border-color: var(--accent); background: var(--accent-soft); }
.signup-choice .t { display: flex; align-items: center; gap: .45rem; font-weight: 600; }
.signup-choice .d { color: var(--muted); font-size: 12.5px; }
@media (max-width: 480px) { .signup-choice { grid-template-columns: 1fr; } }
/* "Sign-ups are paused" (signup/paused.html): the ways forward, one row each, in the card foot. */
.paused-head { padding: 2rem 1.5rem 1.6rem; }
.paused-head h3 { font-size: 15px; }
.paused-head p { max-width: 46ch; text-wrap: balance; }
.paused-options { padding: .25rem 1.25rem; }
.paused-option { display: flex; align-items: center; gap: .75rem; padding: .8rem 0; font-size: 13px; }
.paused-option + .paused-option { border-top: 1px solid var(--border); }
.paused-option .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.paused-option .btn { flex-shrink: 0; }
@media (max-width: 480px) { .paused-option { flex-wrap: wrap; } .paused-option .btn { width: 100%; } }
.hp-field { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.site-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1.5rem; flex-wrap: wrap; padding: 1rem 1.5rem; border-top: 1px solid var(--border); font-size: 12px; color: var(--faint); }
.site-foot nav { display: flex; gap: .35rem 1.1rem; flex-wrap: wrap; }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--text); }
.prose { font-size: 14px; line-height: 1.7; color: var(--text-2); overflow-wrap: anywhere; }
.prose h2 { margin: 1.75rem 0 .5rem; }
.prose p { margin: 0 0 .85rem; }
.prose ul { margin: 0 0 .85rem; padding-left: 1.25rem; }
.prose li { margin-bottom: .35rem; }
.prose .legal-date { margin: 0; font-size: 12.5px; color: var(--muted); }
.prose .legal-date + :not(.legal-date) { margin-top: 1rem; }
.doc-list { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.doc-list .card-link .card-body { display: flex; align-items: flex-start; gap: .75rem; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--r-lg); padding: 1.75rem 1rem; text-align: center; color: var(--muted); background: var(--surface-2); transition: all var(--dur-2) var(--ease); cursor: pointer; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.dropzone i { font-size: 24px; display: block; margin-bottom: .4rem; }
.dropzone input { display: none; }
.dropzone .file { font-weight: 600; color: var(--text); }
pre.log { background: #0f172a; color: #e2e8f0; border-radius: var(--r); padding: .85rem 1rem; font-size: 12px; line-height: 1.5; overflow: auto; max-height: 320px; margin: 0; }
.narration { display: flex; flex-direction: column; gap: .4rem; }
.narration .ev { display: flex; align-items: flex-start; gap: .55rem; font-size: 13px; padding: .5rem .7rem; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); animation: fade-up var(--dur-3) var(--ease-out) backwards; }
.narration .ev .t { margin-left: auto; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- 16b. Dashboard ---------------------------------------------- */
.page.dash { max-width: none; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.dash-greet { font-size: 13.5px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: .35rem; }
.dash-greet .wave { display: inline-block; animation: wave 1.6s var(--ease) 1; transform-origin: 70% 70%; }
.dash-head h1 { font-size: var(--fs-2xl); letter-spacing: -.025em; margin-top: .15rem; }
.dash-links { margin-top: .8rem; }
.dash-head .actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.menu-form { padding: .35rem .5rem .45rem; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.menu-form input { height: 30px; font-size: 12px; padding: 0 .5rem; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); font-family: inherit; }
.menu-form .btn { grid-column: 1 / -1; }
.menu-item .check { margin-left: auto; color: var(--accent); font-size: 12px; opacity: 0; }
.menu-item.active .check { opacity: 1; }

.dash-kpis { display: grid; gap: .85rem; margin-bottom: .85rem; }
.dash-kpis.lead { grid-template-columns: repeat(4, minmax(0,1fr)); }
.dash-kpis.engage { grid-template-columns: repeat(6, minmax(0,1fr)); }
.kpi.rich { display: grid; grid-template-columns: auto minmax(0,1fr) auto; grid-template-areas: "icon label spark" "icon value spark" "icon foot spark"; column-gap: .8rem; row-gap: .1rem; align-items: center; padding: 1rem 1.1rem; overflow: visible; }
.kpi.rich .icon-box { grid-area: icon; align-self: start; width: 38px; height: 38px; border-radius: 11px; font-size: 17px; }
.kpi.rich .kpi-label { grid-area: label; text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.kpi.rich .kpi-value { grid-area: value; font-size: 24px; }
.kpi.rich .kpi-foot { grid-area: foot; margin: .15rem 0 0; font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; min-width: 0; }
.kpi.rich .kpi-spark { grid-area: spark; position: static; width: 76px; height: 34px; align-self: center; }
.kpi.rich.compact { grid-template-columns: auto minmax(0,1fr); grid-template-areas: "icon label" "icon value" "foot foot"; position: relative; padding: .9rem 1rem; }
.kpi.rich.compact .icon-box { width: 34px; height: 34px; font-size: 15px; border-radius: 10px; }
.kpi.rich.compact .kpi-value { font-size: 22px; }
.kpi.rich.compact .kpi-foot { margin-top: .45rem; padding-right: 64px; }
.kpi.rich.compact .kpi-spark { position: absolute; right: .9rem; bottom: .85rem; width: 56px; height: 26px; }
.kpi.rich.compact.no-spark .kpi-foot { padding-right: 0; }
.kpi-trend { display: inline-flex; align-items: center; gap: .15rem; font-size: 11.5px; font-weight: 600; padding: .05rem .4rem; border-radius: 999px; line-height: 1.4; }
.kpi-trend.up { color: var(--success-text); background: var(--success-soft); }
.kpi-trend.down { color: var(--danger-text); background: var(--danger-soft); }
.kpi-trend.flat { color: var(--muted); background: var(--surface-3); }
.kpi-trend i { font-size: 11px; }
.icon-box.accent { background: var(--accent-soft); color: var(--accent-text); }
.icon-box.muted { background: var(--surface-3); color: var(--muted); }

.dash-main, .dash-bottom { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; }
.dash-main > .wide, .dash-bottom > .wide { grid-column: span 2; }
.dash-main { margin-bottom: .85rem; }
.dash-main > .card, .dash-bottom > .card { display: flex; flex-direction: column; min-width: 0; }
.dash-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; padding: 1rem 1.15rem .55rem; }
.dash-card-head h2 { font-size: 14.5px; }
.dash-card-head .sub { font-size: 12px; color: var(--muted); margin-top: .1rem; }
.dash-card-head .link-arrow { white-space: nowrap; margin-top: .15rem; }
.dash-card-body { padding: .3rem 1.15rem 1rem; flex: 1; min-width: 0; }
.dash-card-body.flush { padding: 0 .6rem .5rem; }
.dash-card-foot { padding: .6rem 1.15rem; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: .5rem; }

.donut-wrap { display: flex; align-items: center; gap: 1.1rem; }
.donut { position: relative; width: 132px; height: 132px; flex-shrink: 0; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.donut .track { stroke: var(--surface-3); }
.donut .seg { transition: stroke-dasharray .9s var(--ease-out), opacity var(--dur-1) var(--ease), stroke-width var(--dur-1) var(--ease); cursor: default; }
.donut:not(.animate) .seg { stroke-dasharray: 0 999 !important; }
.donut.has-hover .seg:not(.hover) { opacity: .4; }
.donut .seg.hover { stroke-width: 17; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.donut-center b { font-size: 21px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.donut-center small { font-size: 11px; color: var(--muted); }
.donut-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .45rem; }
.donut-legend .row { display: grid; grid-template-columns: 10px minmax(0,1fr) auto auto; align-items: center; gap: .45rem; font-size: 12px; }
.donut-legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend .lbl { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend .pct { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }
.donut-legend .n { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; font-size: 11.5px; }
.donut-legend .row.zero { opacity: .5; }

.attn { display: flex; flex-direction: column; gap: .3rem; }
.attn a { display: flex; align-items: center; gap: .7rem; padding: .5rem .55rem; border-radius: 10px; color: var(--text); transition: background var(--dur-1) var(--ease); }
.attn a:hover { background: var(--surface-2); color: var(--text); }
.attn .icon-box { width: 32px; height: 32px; font-size: 14px; border-radius: 9px; flex-shrink: 0; }
.attn .t { font-size: 12.5px; line-height: 1.35; min-width: 0; }
.attn .t b { font-size: 14px; font-variant-numeric: tabular-nums; margin-right: .2rem; }
.attn .chev { margin-left: auto; color: var(--faint); font-size: 12px; transition: transform var(--dur-1) var(--ease); }
.attn a:hover .chev { transform: translateX(2px); }
.attn-clear { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 1.4rem .5rem; color: var(--muted); font-size: 12.5px; gap: .5rem; }
.attn-clear .icon-box { width: 42px; height: 42px; border-radius: 12px; font-size: 18px; }
.attn-clear b { color: var(--text); font-size: 13px; }

.dash-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dash-table th { text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: .4rem .55rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.dash-table td { padding: .6rem .55rem; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.dash-table tr:last-child td { border-bottom: 0; }
.dash-table tbody tr { transition: background var(--dur-1) var(--ease); }
.dash-table tbody tr:hover { background: var(--surface-2); }
.dash-table .right { text-align: right; font-variant-numeric: tabular-nums; }
.dash-table td.name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.dash-table td.name a { font-weight: 600; color: var(--text); }
.dash-table td.name a:hover { color: var(--accent); }
.dash-table .na { color: var(--faint); }
.chan-icons { display: inline-flex; gap: .25rem; }
.chan-icons i { width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 11.5px; background: var(--accent-soft); color: var(--accent-text); }
.prog-cell { display: flex; align-items: center; gap: .5rem; min-width: 120px; }
.prog-cell .progress { flex: 1; height: 6px; }
.prog-cell .v { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-2); min-width: 34px; text-align: right; }
.status-counts { display: flex; gap: .85rem; font-size: 12px; color: var(--muted); flex-wrap: wrap; margin-top: .3rem; }
.status-counts b { color: var(--text); font-variant-numeric: tabular-nums; }
.status-counts .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: .3rem; vertical-align: 1px; }

.feed { display: flex; flex-direction: column; }
.feed a, .feed .feed-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: .7rem; align-items: start; padding: .6rem .5rem; border-bottom: 1px solid var(--border); color: inherit; border-radius: 8px; transition: background var(--dur-1) var(--ease); }
.feed > :last-child { border-bottom: 0; }
.feed a:hover { background: var(--surface-2); color: inherit; }
.feed .icon-box { width: 32px; height: 32px; border-radius: 9px; font-size: 14px; }
.feed .t { display: block; font-size: 12.5px; font-weight: 500; color: var(--text); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .s { display: block; font-size: 11.5px; color: var(--muted); margin-top: .1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed time { font-size: 11px; color: var(--faint); white-space: nowrap; padding-top: .15rem; }

.inbox-mini { display: flex; flex-direction: column; }
.inbox-mini a { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: .65rem; align-items: center; padding: .55rem .5rem; border-bottom: 1px solid var(--border); color: inherit; border-radius: 8px; transition: background var(--dur-1) var(--ease); }
.inbox-mini a:last-child { border-bottom: 0; }
.inbox-mini a:hover { background: var(--surface-2); color: inherit; }
.inbox-mini .avatar { width: 32px; height: 32px; font-size: 12px; }
.inbox-mini .n { font-size: 12.5px; font-weight: 500; color: var(--text-2); display: flex; align-items: center; gap: .35rem; min-width: 0; }
.inbox-mini .n .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-mini a.unread .n { font-weight: 600; color: var(--text); }
.inbox-mini .n .unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.inbox-mini .p { font-size: 11.5px; color: var(--muted); display: flex; gap: .3rem; align-items: center; min-width: 0; }
.inbox-mini .p i { color: var(--faint); font-size: 11px; flex-shrink: 0; }
.inbox-mini .p .truncate { flex: 1; }
.inbox-mini time { font-size: 11px; color: var(--faint); white-space: nowrap; }
.inbox-mini .flag { margin-left: .3rem; }
.pills.tight { gap: .25rem; }
.pills.tight .pill { height: 26px; padding: 0 .6rem; font-size: 11.5px; }

/* Movable dashboard blocks: a grip at the top edge of each card, drag or arrow keys to reorder */
[data-dash-item] { position: relative; }
.drag-handle { position: absolute; top: 3px; left: 50%; transform: translateX(-50%); width: 36px; height: 14px; border-radius: 999px; display: grid; place-items: center; color: var(--faint); font-size: 14px; line-height: 1; cursor: grab; opacity: 0; z-index: 3; transition: opacity var(--dur-1) var(--ease), background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.drag-handle:hover, .drag-handle:focus-visible { background: var(--surface-3); color: var(--text-2); opacity: 1; outline: none; }
.drag-handle:focus-visible { box-shadow: var(--shadow-focus); }
.drag-handle:active { cursor: grabbing; }
[data-dash-item]:hover > .drag-handle, [data-dash-item]:focus-within > .drag-handle { opacity: 1; }
[data-dash-item].dragging { opacity: .35; }
[data-dash-item].moved { animation: fade-up var(--dur-2) var(--ease-out); }
.dash-dragging .drag-handle { opacity: 0; }
.dash-dragging [data-dash-zone] { outline: 1px dashed var(--border-strong); outline-offset: 6px; border-radius: 14px; }
.dash-dragging [data-dash-zone].drop-target { outline-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 6px var(--accent-soft); }
.dash-dragging [data-dash-zone].no-drop { opacity: .6; }
@media (pointer: coarse) { .drag-handle { opacity: .55; } }

/* ---------- 17. Motion -------------------------------------------------- */
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }
@keyframes toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes wave { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 40% { transform: rotate(-8deg); } 60% { transform: rotate(14deg); } 80% { transform: rotate(-4deg); } }
.stagger > * { animation: fade-up var(--dur-3) var(--ease-out) backwards; }
.stagger > :nth-child(1) { animation-delay: 0ms; } .stagger > :nth-child(2) { animation-delay: 40ms; } .stagger > :nth-child(3) { animation-delay: 80ms; } .stagger > :nth-child(4) { animation-delay: 120ms; } .stagger > :nth-child(5) { animation-delay: 160ms; } .stagger > :nth-child(6) { animation-delay: 200ms; } .stagger > :nth-child(7) { animation-delay: 240ms; } .stagger > :nth-child(8) { animation-delay: 280ms; }
.collapse-panel { overflow: hidden; transition: height var(--dur-3) var(--ease); }
.collapse-panel[hidden] { display: none; }
.rotate-open i, .rotate-open .chev { transition: transform var(--dur-2) var(--ease); }
.rotate-open[aria-expanded="true"] i.chev, .rotate-open[aria-expanded="true"] .chev { transform: rotate(180deg); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    .chart.animate .bar, .chart.animate .spark path.line { animation: none; stroke-dashoffset: 0; }
}

/* ---------- 18. Responsive ---------------------------------------------- */
@media (max-width: 1200px) {
    .inbox.has-side { grid-template-columns: 300px minmax(0,1fr); }
    .inbox.has-side .inbox-side { display: none; }
    .inbox.has-side.side-open { grid-template-columns: 300px minmax(0,1fr) 280px; }
    .inbox.has-side.side-open .inbox-side { display: block; }
}
@media (max-width: 1280px) {
    .dash-kpis.engage { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .dash-main, .dash-bottom { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
}
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .grid-side { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .dash-kpis.lead { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .dash-main, .dash-bottom { grid-template-columns: 1fr; }
    .dash-main > .wide, .dash-bottom > .wide { grid-column: auto; }
    .dash-head { align-items: flex-start; flex-direction: column; }
    .inbox, .inbox.has-side, .inbox.has-side.side-open { grid-template-columns: 1fr; height: auto; min-height: calc(100vh - var(--topbar-h)); }
    .inbox-list { border-right: 0; }
    .inbox.showing-conv .inbox-list { display: none; }
    .inbox:not(.showing-conv) .inbox-main, .inbox:not(.showing-conv) .inbox-side { display: none; }
    .inbox.has-side.side-open .inbox-side { display: block; border-left: 0; border-top: 1px solid var(--border); }
    .inbox-mobile-back { display: inline-flex; }
    .conv-body { padding: 1rem; }
}
@media (max-width: 768px) {
    .app-main, .app-main.collapsed { margin-left: 0; }
    .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; box-shadow: none; }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .sidebar .sidebar-toggle { display: none; }
    .sidebar.collapsed .brand-name, .sidebar.collapsed .brand-sub, .sidebar.collapsed .sidebar-section, .sidebar.collapsed .sidebar-link span:not(.count) { opacity: 1; width: auto; overflow: visible; transform: none; pointer-events: auto; }
    .sidebar.collapsed .sidebar-header { padding: 0 .75rem 0 .9rem; gap: .6rem; }
    .sidebar.collapsed .sidebar-brand { gap: .65rem; flex: 1; }
    .sidebar.collapsed .brand-icon { width: 30px; height: 30px; border-radius: 8px; }
    .sidebar.collapsed .brand-icon i { font-size: 15px; }
    .sidebar.collapsed .sidebar-link { padding: 0 .6rem; gap: .7rem; justify-content: flex-start; }
    .sidebar.collapsed .sidebar-link i { width: 20px; }
    .sidebar.collapsed .sidebar-section { height: auto; padding-top: 1rem; }
    .sidebar.collapsed .sidebar-section::after { display: none; }
    .sidebar.collapsed .sidebar-link[data-tip]::after { display: none; }
    .sidebar.collapsed .sidebar-plan { display: flex; }
    .topbar { padding: 0 1rem; }
    .topbar-toggle { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 18px; cursor: pointer; }
    .user-btn .name { display: none; }
    .page { padding: 1rem 1rem 3rem; }
    .page-head { flex-direction: column; }
    .page-head .actions { width: 100%; }
    .grid-2, .grid-3, .grid-4, .grid-side { grid-template-columns: 1fr; }
    .kpi-row { grid-template-columns: repeat(2, 1fr); }
    .hide-mobile { display: none !important; }
    .show-mobile { display: initial; }
    .bar-row { grid-template-columns: 90px 1fr; }
    .bar-row .vals { grid-column: 2; }
    .action-bar { bottom: .5rem; }
    .table-wrap .table { min-width: 640px; }
    .drawer { width: 100vw; }
    .toasts { top: auto; bottom: 1rem; right: 1rem; left: 1rem; width: auto; }
    .banner { padding: .5rem 1rem; }
    .staff-nav { gap: .75rem; overflow-x: auto; }
    .staff-page { padding: 1rem 1rem 3rem; }
    .signup-nav { padding: 0 1rem; }
    .signup-page { padding: 1.25rem 1rem 2.5rem; }
    .signup-steps .s:not(.active) span { display: none; }
    .site-foot { padding: 1rem; }
}
@media (max-width: 560px) {
    .dash-kpis.engage { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .dash-kpis.lead { grid-template-columns: 1fr; }
    .dash-head h1 { font-size: 20px; }
    .donut-wrap { flex-direction: column; align-items: stretch; }
    .donut { margin: 0 auto; }
    .dash-table-wrap { overflow-x: auto; }
    .dash-table { min-width: 560px; }
}
@media (max-width: 480px) {
    .kpi-row { grid-template-columns: 1fr 1fr; }
    .kpi .kpi-value { font-size: 22px; }
    .stat-row { gap: 1rem; }
}
@media print {
    .sidebar, .topbar, .banner, .toasts, .action-bar, .page-actions, .conv-compose { display: none !important; }
    .app-main { margin-left: 0 !important; }
    body { background: #fff; }
    .card, .table-wrap { box-shadow: none; }
}
