/* =====================================================================
   CRM theme — navy / blue / red palette, Inter type, soft cards.
   Built on Bootstrap 5.3 CSS variables, so components inherit it.
   ===================================================================== */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin.woff2") format("woff2");
}

:root {
    /* Brand palette */
    --crm-navy: #0a1628;
    --crm-navy-2: #122040;
    --crm-navy-3: #1a2a45;
    --crm-blue: #1b74ba;
    --crm-blue-dark: #165f99;
    --crm-blue-soft: #eef4fa;
    --crm-red: #d21034;
    --crm-red-dark: #b80d2d;
    --crm-gold: #c9a227;
    --crm-bg: #f5f8fc;
    --crm-surface: #ffffff;
    --crm-border: #dde3eb;
    --crm-text: #12203a;
    --crm-muted: #5b6b84;

    --crm-radius: .75rem;
    --crm-radius-lg: 1rem;
    --crm-shadow-xs: 0 1px 3px rgba(10, 22, 40, .06);
    --crm-shadow: 0 4px 10px rgba(10, 22, 40, .06), 0 2px 4px -1px rgba(10, 22, 40, .04);
    --crm-shadow-lg: 0 8px 24px rgba(10, 22, 40, .10), 0 4px 6px -1px rgba(10, 22, 40, .05);
    --crm-sidebar-w: 248px;
    --crm-topbar-h: 64px;

    /* Bootstrap overrides */
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-body-font-size: .9375rem;
    --bs-body-color: var(--crm-text);
    --bs-body-bg: var(--crm-bg);
    --bs-secondary-color: var(--crm-muted);
    --bs-tertiary-bg: #eef2f7;
    --bs-border-color: var(--crm-border);
    --bs-border-color-translucent: rgba(10, 22, 40, .08);
    --bs-border-radius: .5rem;
    --bs-border-radius-sm: .375rem;
    --bs-border-radius-lg: var(--crm-radius);
    --bs-primary: var(--crm-blue);
    --bs-primary-rgb: 27, 116, 186;
    --bs-danger: var(--crm-red);
    --bs-danger-rgb: 210, 16, 52;
    --bs-dark-rgb: 10, 22, 40;
    --bs-link-color: var(--crm-blue);
    --bs-link-color-rgb: 27, 116, 186;
    --bs-link-hover-color: var(--crm-blue-dark);
    --bs-link-hover-color-rgb: 22, 95, 153;
    --bs-focus-ring-color: rgba(27, 116, 186, .25);
    --bs-primary-bg-subtle: var(--crm-blue-soft);
    --bs-primary-text-emphasis: var(--crm-blue-dark);
}

body {
    background: var(--crm-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv11", "ss01";
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--crm-text); font-weight: 650; letter-spacing: -.015em; }
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
.text-muted { color: var(--crm-muted) !important; }
::selection { background: rgba(27, 116, 186, .18); }

/* ---------- Flag stripe ---------- */
.flag-stripe { height: 4px; background: linear-gradient(90deg, var(--crm-blue) 0 50%, var(--crm-red) 50% 100%); }

/* ---------- App shell ---------- */
.app-sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--crm-sidebar-w); z-index: 1040;
    background: linear-gradient(180deg, var(--crm-navy) 0%, var(--crm-navy-2) 100%);
    color: #c9d4e3; display: flex; flex-direction: column;
}
.app-sidebar .brand {
    display: flex; align-items: center; gap: .7rem; padding: 1.15rem 1.25rem; color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.app-sidebar .brand:hover { text-decoration: none; }
.brand-mark {
    width: 34px; height: 34px; border-radius: .6rem; display: grid; place-items: center; flex: none;
    background: linear-gradient(135deg, var(--crm-blue) 0%, var(--crm-blue) 50%, var(--crm-red) 50%, var(--crm-red) 100%);
    color: #fff; font-weight: 700; font-size: .95rem; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
}
.brand-name { font-weight: 650; letter-spacing: -.01em; line-height: 1.1; }
.brand-sub { font-size: .7rem; color: #8ea0b9; text-transform: uppercase; letter-spacing: .08em; }
.app-sidebar .nav-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: .75rem .75rem 1rem; }
.app-sidebar .nav-section {
    text-transform: uppercase; font-size: .675rem; font-weight: 600; letter-spacing: .1em;
    color: #6f82a0; padding: 1rem .75rem .4rem;
}
.app-sidebar .nav-link {
    display: flex; align-items: center; gap: .65rem; color: #c9d4e3; border-radius: .5rem;
    padding: .5rem .75rem; font-size: .875rem; font-weight: 500; margin-bottom: 1px; position: relative;
    transition: background-color .15s, color .15s;
}
.app-sidebar .nav-link svg { width: 18px; height: 18px; flex: none; opacity: .75; }
.app-sidebar .nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.app-sidebar .nav-link.active { background: rgba(27, 116, 186, .22); color: #fff; }
.app-sidebar .nav-link.active::before {
    content: ""; position: absolute; left: -.75rem; top: .4rem; bottom: .4rem; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--crm-red);
}
.app-sidebar .nav-link.active svg { opacity: 1; color: #7fb8e6; }
.app-sidebar .nav-link .badge { margin-left: auto; }
.app-sidebar .sidebar-foot { padding: .9rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, .07); font-size: .75rem; color: #6f82a0; }

.app-main { margin-left: var(--crm-sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.app-topbar {
    position: sticky; top: 0; z-index: 1030; height: var(--crm-topbar-h);
    display: flex; align-items: center; gap: 1rem; padding: 0 1.75rem;
    background: rgba(255, 255, 255, .85); backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--crm-border);
}
.app-content { padding: 1.75rem; flex: 1; width: 100%; max-width: 1480px; }

.topbar-search { position: relative; flex: 1; max-width: 460px; }
.topbar-search svg { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--crm-muted); }
.topbar-search input {
    padding-left: 2.3rem; background: var(--crm-bg); border-color: transparent; border-radius: 999px; height: 38px;
}
.topbar-search input:focus { background: #fff; border-color: var(--crm-blue); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
    background: var(--crm-navy); color: #fff; font-size: .8rem; font-weight: 600; letter-spacing: .02em;
}
.user-chip { display: flex; align-items: center; gap: .6rem; border: 0; background: none; padding: .25rem .4rem; border-radius: 999px; color: var(--crm-text); }
.user-chip:hover { background: var(--crm-bg); }
.user-chip .who { text-align: left; line-height: 1.15; }
.user-chip .who small { display: block; color: var(--crm-muted); font-size: .72rem; }
.role-pill { font-size: .66rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: .2rem .5rem; border-radius: 999px; }
.role-SuperAdmin { background: rgba(210, 16, 52, .1); color: var(--crm-red-dark); }
.role-SuperUser { background: var(--crm-blue-soft); color: var(--crm-blue-dark); }
.role-User { background: #eef2f7; color: var(--crm-muted); }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); transition: transform .25s ease; }
    .app-sidebar.show { transform: none; box-shadow: var(--crm-shadow-lg); }
    .app-main { margin-left: 0; }
    .app-topbar { padding: 0 1rem; }
    .app-content { padding: 1.25rem 1rem; }
    .sidebar-backdrop { position: fixed; inset: 0; background: rgba(10, 22, 40, .45); z-index: 1035; display: none; }
    .sidebar-backdrop.show { display: block; }
}

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.6rem; margin: 0; font-weight: 700; letter-spacing: -.025em; }
.page-header .eyebrow, .eyebrow {
    display: inline-flex; align-items: center; gap: .4rem; font-size: .72rem; font-weight: 600;
    letter-spacing: .1em; text-transform: uppercase; color: var(--crm-blue); margin-bottom: .35rem;
}
.eyebrow::before { content: ""; width: 18px; height: 2px; background: var(--crm-red); border-radius: 2px; }
.page-header .back { font-size: .8rem; color: var(--crm-muted); display: inline-block; margin-bottom: .35rem; }

/* ---------- Hero banner (dashboard, login) ---------- */
.hero {
    position: relative; overflow: hidden; border-radius: var(--crm-radius-lg); color: #fff;
    background: radial-gradient(120% 140% at 100% 0%, rgba(27, 116, 186, .55) 0%, rgba(27, 116, 186, 0) 55%),
                linear-gradient(135deg, var(--crm-navy) 0%, var(--crm-navy-2) 100%);
    padding: 1.75rem 2rem; margin-bottom: 1.5rem; box-shadow: var(--crm-shadow-lg);
}
.hero::after {
    content: ""; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%;
    border: 36px solid rgba(255, 255, 255, .04);
}
.hero h1, .hero h2 { color: #fff; }
.hero .lead { color: #b9c7da; font-size: 1rem; margin: 0; }
.hero .eyebrow { color: #7fb8e6; }

/* ---------- Cards ---------- */
.card {
    --bs-card-border-color: var(--crm-border);
    --bs-card-border-radius: var(--crm-radius);
    --bs-card-inner-border-radius: calc(var(--crm-radius) - 1px);
    --bs-card-cap-bg: transparent;
    --bs-card-cap-padding-y: .9rem;
    --bs-card-cap-padding-x: 1.25rem;
    --bs-card-spacer-x: 1.25rem;
    box-shadow: var(--crm-shadow-xs);
}
.card-header { font-weight: 600; font-size: .9rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.card-footer { background: #fafbfd; }

.stat-card { border: 1px solid var(--crm-border); transition: box-shadow .2s, transform .2s; overflow: hidden; }
.stat-card:hover { box-shadow: var(--crm-shadow); transform: translateY(-1px); }
.stat-card .card-body { display: flex; align-items: center; gap: 1rem; padding: 1.15rem 1.25rem; }
.stat-card .icon { width: 44px; height: 44px; border-radius: .75rem; display: grid; place-items: center; flex: none; }
.stat-card .icon svg { width: 22px; height: 22px; }
.stat-card .label { font-size: .78rem; color: var(--crm-muted); font-weight: 500; }
.stat-card .value { font-size: 1.65rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; color: var(--crm-text); }
.tone-blue { background: var(--crm-blue-soft); color: var(--crm-blue); }
.tone-red { background: rgba(210, 16, 52, .08); color: var(--crm-red); }
.tone-gold { background: rgba(201, 162, 39, .12); color: #9a7a12; }
.tone-navy { background: #e6ecf3; color: var(--crm-navy); }

/* ---------- Buttons & forms ---------- */
.btn { --bs-btn-font-weight: 500; --bs-btn-border-radius: .5rem; --bs-btn-padding-x: 1rem; letter-spacing: -.005em; }
.btn-sm { --bs-btn-border-radius: .4rem; --bs-btn-padding-x: .7rem; }
.btn-primary {
    --bs-btn-bg: var(--crm-blue); --bs-btn-border-color: var(--crm-blue);
    --bs-btn-hover-bg: var(--crm-blue-dark); --bs-btn-hover-border-color: var(--crm-blue-dark);
    --bs-btn-active-bg: #124f80; --bs-btn-active-border-color: #124f80;
    --bs-btn-disabled-bg: var(--crm-blue); --bs-btn-disabled-border-color: var(--crm-blue);
    box-shadow: 0 1px 2px rgba(27, 116, 186, .3);
}
.btn-danger { --bs-btn-bg: var(--crm-red); --bs-btn-border-color: var(--crm-red); --bs-btn-hover-bg: var(--crm-red-dark); --bs-btn-hover-border-color: var(--crm-red-dark); }
.btn-outline-primary { --bs-btn-color: var(--crm-blue); --bs-btn-border-color: var(--crm-blue); --bs-btn-hover-bg: var(--crm-blue); --bs-btn-hover-border-color: var(--crm-blue); }
.btn-outline-secondary {
    --bs-btn-color: var(--crm-text); --bs-btn-border-color: var(--crm-border); --bs-btn-bg: #fff;
    --bs-btn-hover-bg: var(--crm-bg); --bs-btn-hover-color: var(--crm-text); --bs-btn-hover-border-color: #c9d2de;
    --bs-btn-active-bg: #e6ecf3; --bs-btn-active-color: var(--crm-text); --bs-btn-active-border-color: #c9d2de;
}
.btn-secondary { --bs-btn-bg: var(--crm-navy); --bs-btn-border-color: var(--crm-navy); --bs-btn-hover-bg: var(--crm-navy-3); --bs-btn-hover-border-color: var(--crm-navy-3); }
.btn-outline-danger { --bs-btn-color: var(--crm-red); --bs-btn-border-color: rgba(210, 16, 52, .4); --bs-btn-hover-bg: var(--crm-red); --bs-btn-hover-border-color: var(--crm-red); }
.btn-link { --bs-btn-color: var(--crm-blue); }

.form-control, .form-select { border-color: var(--crm-border); border-radius: .5rem; }
.form-control:focus, .form-select:focus { border-color: var(--crm-blue); box-shadow: 0 0 0 .2rem rgba(27, 116, 186, .15); }
.form-label { font-size: .82rem; font-weight: 550; color: #34445e; margin-bottom: .35rem; }
.form-text { color: var(--crm-muted); font-size: .78rem; }
.form-check-input:checked { background-color: var(--crm-blue); border-color: var(--crm-blue); }
.input-group > .btn { border-radius: 0 .5rem .5rem 0; }

/* ---------- Tables ---------- */
.table { --bs-table-hover-bg: #f5f8fc; --bs-table-border-color: #e9eef4; margin-bottom: 0; }
.table > thead th {
    font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--crm-muted);
    background: #fafbfd; border-bottom-color: var(--crm-border); padding-top: .7rem; padding-bottom: .7rem; white-space: nowrap;
}
.table > :not(caption) > * > * { padding: .7rem 1rem; }
.table-sm > :not(caption) > * > * { padding: .55rem .9rem; }
.table td, .table th { vertical-align: middle; }
.card > .table-responsive:first-child .table > thead th:first-child { border-top-left-radius: var(--crm-radius); }
.card > .table-responsive:first-child .table > thead th:last-child { border-top-right-radius: var(--crm-radius); }
.table tbody tr:last-child td { border-bottom: 0; }

/* ---------- Badges & stage pills ---------- */
.badge { font-weight: 600; letter-spacing: .01em; border-radius: 999px; padding: .35em .7em; }
.text-bg-secondary { background-color: #e8edf3 !important; color: #3d4c63 !important; }
.text-bg-primary { background-color: var(--crm-blue-soft) !important; color: var(--crm-blue-dark) !important; }
.text-bg-info { background-color: #e3f2fb !important; color: #0e6189 !important; }
.text-bg-warning { background-color: #fff4d6 !important; color: #8a5d00 !important; }
.text-bg-success { background-color: #e3f5ea !important; color: #17663a !important; }
.text-bg-danger { background-color: #fde8ec !important; color: var(--crm-red-dark) !important; }
.text-bg-dark { background-color: var(--crm-navy) !important; color: #fff !important; }

.pipeline { display: flex; flex-wrap: wrap; gap: .35rem; }
.pipeline .step {
    position: relative; padding: .45rem .9rem .45rem 1.1rem; font-size: .78rem; font-weight: 500;
    background: #eef2f7; color: var(--crm-muted); clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%, 8px 50%);
}
.pipeline .step:first-child { clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%); border-radius: .4rem 0 0 .4rem; padding-left: .9rem; }
.pipeline .step.done { background: #dcebf7; color: var(--crm-blue-dark); }
.pipeline .step.current { background: var(--crm-blue); color: #fff; font-weight: 600; }

/* ---------- Lists, alerts, misc ---------- */
.list-group { --bs-list-group-border-color: #e9eef4; }
.list-group-item-action:hover { background: #f5f8fc; }
.alert { border-radius: var(--crm-radius); border-width: 0 0 0 4px; box-shadow: var(--crm-shadow-xs); }
.alert-success { --bs-alert-bg: #eef9f2; --bs-alert-color: #17663a; --bs-alert-border-color: #2e9e5b; }
.alert-danger { --bs-alert-bg: #fdf0f2; --bs-alert-color: #8f0a23; --bs-alert-border-color: var(--crm-red); }
.alert-warning { --bs-alert-bg: #fff8e6; --bs-alert-color: #6e4b00; --bs-alert-border-color: var(--crm-gold); }
.nav-tabs { --bs-nav-tabs-border-color: var(--crm-border); --bs-nav-tabs-link-active-border-color: transparent transparent var(--crm-blue); gap: .25rem; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--crm-muted); font-weight: 500; font-size: .875rem; }
.nav-tabs .nav-link:hover { color: var(--crm-text); text-decoration: none; }
.nav-tabs .nav-link.active { background: none; color: var(--crm-blue); border-bottom-color: var(--crm-blue); }
.pagination { --bs-pagination-active-bg: var(--crm-blue); --bs-pagination-active-border-color: var(--crm-blue); --bs-pagination-color: var(--crm-blue); --bs-pagination-border-radius: .5rem; }
.dropdown-menu { --bs-dropdown-border-color: var(--crm-border); --bs-dropdown-border-radius: .65rem; --bs-dropdown-link-active-bg: var(--crm-blue); box-shadow: var(--crm-shadow-lg); padding: .4rem; font-size: .875rem; }
.dropdown-item { border-radius: .4rem; padding: .45rem .75rem; }
.dropdown-header { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }

dl.fields dt { font-weight: 500; color: var(--crm-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .15rem; }
dl.fields dd { margin-bottom: 1rem; white-space: pre-wrap; word-break: break-word; font-weight: 500; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
.timeline li { padding: .65rem 0; border-bottom: 1px solid #edf1f6; }
.timeline li:last-child { border-bottom: 0; }
.empty { text-align: center; color: var(--crm-muted); padding: 2rem 1rem; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.filter-bar { background: #fff; border: 1px solid var(--crm-border); border-radius: var(--crm-radius); padding: .75rem; margin-bottom: 1rem; box-shadow: var(--crm-shadow-xs); }

/* ---------- Public pages (sign-in, webforms) ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-panel {
    position: relative; overflow: hidden; color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
    background: radial-gradient(90% 80% at 100% 0%, rgba(27, 116, 186, .55) 0%, rgba(27, 116, 186, 0) 60%),
                radial-gradient(70% 60% at 0% 100%, rgba(210, 16, 52, .25) 0%, rgba(210, 16, 52, 0) 60%),
                linear-gradient(160deg, var(--crm-navy) 0%, var(--crm-navy-2) 100%);
}
.auth-panel::after { content: ""; position: absolute; right: -120px; top: 30%; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(255, 255, 255, .035); }
.auth-panel h1 { color: #fff; font-size: 2.4rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; max-width: 18ch; }
.auth-panel p { color: #b9c7da; max-width: 42ch; font-size: 1.05rem; }
.auth-panel .points { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .75rem; color: #d7e1ee; font-size: .92rem; }
.auth-panel .points li { display: flex; gap: .6rem; align-items: center; }
.auth-panel .points li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--crm-red); box-shadow: 0 0 0 4px rgba(210, 16, 52, .2); flex: none; }
.auth-form { display: grid; place-items: center; padding: 2.5rem 1.5rem; background: #fff; }
.auth-form .inner { width: 100%; max-width: 380px; }
.auth-form h2 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.auth-form .form-control { height: 44px; }
.auth-form .btn-primary { height: 46px; font-weight: 600; }
@media (max-width: 991.98px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-panel { padding: 2rem 1.5rem; }
    .auth-panel h1 { font-size: 1.75rem; }
    .auth-panel .points { display: none; }
}

.public-header { background: linear-gradient(135deg, var(--crm-navy) 0%, var(--crm-navy-2) 100%); color: #fff; }
.public-header .container { display: flex; align-items: center; gap: .75rem; padding-top: 1rem; padding-bottom: 1rem; }
.public-hero { background: linear-gradient(180deg, var(--crm-navy-2) 0%, #18305a 100%); color: #fff; padding: 2.5rem 0 5rem; }
.public-hero h1 { color: #fff; font-size: 2rem; font-weight: 700; letter-spacing: -.025em; }
.public-hero p { color: #b9c7da; max-width: 60ch; white-space: pre-wrap; }
.public-body { margin-top: -3.5rem; padding-bottom: 3rem; }
.public-footer { color: var(--crm-muted); font-size: .8rem; padding: 1.5rem 0 2.5rem; text-align: center; }

.validation-summary-valid { display: none !important; }
.icon-badge { width: 56px; height: 56px; border-radius: 1rem; display: grid; place-items: center; }
.icon-badge svg { width: 26px; height: 26px; }
/* Icons sit on the text's centre line in every button, link and menu item, at any button size. */
.icon-inline { display: inline-flex; align-items: center; justify-content: center; width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.icon-inline svg { width: 100%; height: 100%; display: block; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.btn .badge { margin-left: 0 !important; }
.btn.dropdown-toggle::after { margin-left: .1rem; }
.dropdown-item { display: flex; align-items: center; gap: .55rem; }
.dropdown-item .icon-inline { color: var(--crm-muted); }
a:has(> .icon-inline), button:has(> .icon-inline) { text-decoration-skip-ink: auto; }
.module-card { transition: box-shadow .2s, transform .2s, border-color .2s; }
.module-card:hover { box-shadow: var(--crm-shadow); transform: translateY(-2px); border-color: #c8d6e6; }
.module-card .icon-badge svg { width: 22px; height: 22px; }
.stage-bar { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: #eef2f7; gap: 2px; }
.stage-bar .seg { display: block; height: 100%; }
.seg-secondary { background: #9aa8bb; } .seg-primary { background: var(--crm-blue); } .seg-info { background: #3aa3d8; }
.seg-warning { background: #e3a008; } .seg-success { background: #2e9e5b; } .seg-danger { background: var(--crm-red); } .seg-dark { background: var(--crm-navy); }
.min-w-0 { min-width: 0; }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: #fff; --bs-btn-color: var(--crm-navy); --bs-btn-hover-bg: #eef4fa; --bs-btn-hover-border-color: #eef4fa; font-weight: 600; }
.migration-log { background: var(--crm-navy); color: #cfe0f3; font-size: .78rem; padding: 1rem 1.25rem; max-height: 560px; overflow: auto;
    border-radius: 0 0 var(--crm-radius) var(--crm-radius); white-space: pre-wrap; }
.rule-card .branch { border-left: 3px solid var(--crm-blue); padding: .5rem .75rem; margin-bottom: .5rem; background: #fafbfd; border-radius: 0 .5rem .5rem 0; }
.rule-card .branch .if { font-size: .72rem; font-weight: 700; color: var(--crm-blue); text-transform: uppercase; letter-spacing: .06em; }
.review-notes { white-space: pre-wrap; font-size: .82rem; }
.tag-pill { display: inline-block; font-size: .72rem; padding: .15rem .55rem; border-radius: 999px; background: #eef2f7; color: #3d4c63; margin: 0 .2rem .2rem 0; }

/* ---------- Record detail page ---------- */
.record-hero { border: 0; box-shadow: var(--crm-shadow); background:
    linear-gradient(180deg, #fff 0%, #fff 60%, #f7f9fc 100%); position: relative; overflow: hidden; }
.record-hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--crm-blue) 0 50%, var(--crm-red) 50%); }
.record-hero h1 { font-weight: 700; letter-spacing: -.025em; }
.hero-avatar { width: 56px; height: 56px; border-radius: 1rem; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 1.1rem;
    color: #fff; background: linear-gradient(135deg, var(--crm-navy) 0%, var(--crm-blue) 100%); box-shadow: var(--crm-shadow); }
.hero-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; align-items: center; font-size: .82rem; color: var(--crm-muted); }
.hero-meta > span { display: inline-flex; align-items: center; gap: .35rem; }
.hero-meta svg { width: 15px; height: 15px; }

.stepper { display: flex; overflow-x: auto; padding: .25rem 0 .25rem; }
.stepper .step { flex: 1 1 0; min-width: 118px; position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .45rem;
    font-size: .76rem; color: var(--crm-muted); padding-right: .5rem; }
.stepper .step::before { content: ""; position: absolute; top: 11px; left: 24px; right: 0; height: 3px; border-radius: 3px; background: #e6ecf3; }
.stepper .step:last-child::before { display: none; }
.stepper .step .dot { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
    font-size: .7rem; font-weight: 700; background: #fff; color: var(--crm-muted); border: 2px solid #d5dde8; }
.stepper .step .name { line-height: 1.25; }
.stepper .step.done .dot { background: #dcebf7; border-color: #9ccbee; color: var(--crm-blue-dark); }
.stepper .step.done::before { background: #9ccbee; }
.stepper .step.current .dot { background: var(--crm-blue); border-color: var(--crm-blue); color: #fff; box-shadow: 0 0 0 4px rgba(27,116,186,.15); }
.stepper .step.current .name { color: var(--crm-text); font-weight: 600; }
.stepper .step.closed-danger .dot { background: var(--crm-red); border-color: var(--crm-red); box-shadow: 0 0 0 4px rgba(210,16,52,.15); }
.stepper .step.closed-success .dot, .stepper .step.closed-dark .dot { background: #2e9e5b; border-color: #2e9e5b; box-shadow: 0 0 0 4px rgba(46,158,91,.15); }
.stage-move { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .6rem .75rem; background: var(--crm-bg); border-radius: .6rem; }
.stage-move select { width: auto; max-width: 340px; } .stage-move input { width: auto; flex: 1; min-width: 160px; }

.details-toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; position: sticky; top: calc(var(--crm-topbar-h) + 4px); z-index: 20;
    background: rgba(245, 248, 252, .92); backdrop-filter: blur(8px); padding: .5rem 0; }
.section-nav { display: flex; gap: .35rem; flex-wrap: wrap; }
.section-nav a { font-size: .78rem; font-weight: 500; padding: .3rem .7rem; border-radius: 999px; background: #fff; border: 1px solid var(--crm-border); color: var(--crm-text); }
.section-nav a span { color: var(--crm-muted); margin-left: .2rem; font-weight: 600; }
.section-nav a:hover { border-color: var(--crm-blue); text-decoration: none; }
.section-nav a.is-empty { opacity: .55; }
.field-section { scroll-margin-top: 130px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .25rem 1.5rem; }
.fv { position: relative; padding: .55rem .6rem; margin: 0 -.6rem; border-radius: .5rem; transition: background-color .15s; }
.fv.wide { grid-column: 1 / -1; }
/* Record detail view: strong field titles, regular values */
.field-section .fv-label { font-size: .8rem; font-weight: 800; color: var(--crm-text); }
/* Section banners: a soft tint and accent per section */
.field-section { --tone: 27, 116, 186; }
.field-section.tone-1 { --tone: 210, 16, 52; }
.field-section.tone-2 { --tone: 201, 162, 39; }
.field-section.tone-3 { --tone: 23, 140, 84; }
.field-section.tone-4 { --tone: 111, 66, 193; }
.field-section > .card-header { background: rgba(var(--tone), .10); border-bottom: 1px solid rgba(var(--tone), .18);
    border-left: 4px solid rgba(var(--tone), .85); font-weight: 700; font-size: .95rem; color: var(--crm-text); }
.field-section .fv-value { font-weight: 400; }
.fv:hover { background: #f5f8fc; }
.fv-label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--crm-muted); margin-bottom: .2rem; }
.fv-value { display: flex; align-items: flex-start; gap: .4rem; min-height: 1.5rem; font-weight: 500; word-break: break-word; }
.fv-display { flex: 0 1 auto; min-width: 0; }   /* value only as wide as its text, so ✎ sits right after it */
.fv-empty { color: #b3bfcf; font-weight: 400; }
.fv-long { white-space: pre-wrap; font-weight: 400; }
.fv-chip { display: inline-block; padding: .15rem .6rem; border-radius: 999px; background: var(--crm-blue-soft); color: var(--crm-blue-dark); font-size: .8rem; margin: 0 .25rem .25rem 0; }
.fv-bool { font-size: .85rem; color: var(--crm-muted); } .fv-bool.yes { color: #17663a; font-weight: 600; }
.fv-edit { border: 0; background: none; color: var(--crm-blue); opacity: 0; padding: 0 .3rem; border-radius: .3rem; font-size: .95rem; line-height: 1.4; cursor: pointer; }
.fv:hover .fv-edit, .fv-edit:focus { opacity: 1; }
.fv-edit:hover { background: var(--crm-blue-soft); }
.fv.editing { background: #fff; box-shadow: 0 0 0 2px var(--crm-blue), var(--crm-shadow); z-index: 2; }
.fv.editing .fv-value, .fv.editing > .fv-display, .fv.editing > h1, .fv.editing > .fv-edit { display: none !important; }
.fv-form .form-label { display: none; }
.fv-form .form-check-label { display: inline; }
.fv-error { color: var(--crm-red); font-size: .8rem; margin-top: .3rem; }
.fv.saved { animation: saved 1.4s ease; }
@keyframes saved { 0% { background: #e3f5ea; } 100% { background: transparent; } }
.fv-title { display: flex; align-items: center; gap: .3rem; margin: 0; padding: 0 .4rem 0 0; }
.fv-title.editing { padding: .5rem; margin: 0 0 .5rem; flex-direction: column; align-items: stretch; }
.fv-inline { padding: .1rem .3rem; margin: 0; display: inline-flex !important; }
.fv-inline.editing { padding: .4rem; flex-direction: column; align-items: stretch; }
.hide-empty .fv[data-empty="1"]:not(.editing) { display: none; }
.section-empty { display: none; }
.field-section.all-hidden .section-empty { display: block; }
.side-sticky { position: sticky; top: calc(var(--crm-topbar-h) + 16px); }
@media (max-width: 1199.98px) { .side-sticky { position: static; } .details-toolbar { position: static; } }

/* ---------- Toasts ---------- */
#toastHost { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 2000; display: grid; gap: .5rem; }
.crm-toast { background: var(--crm-navy); color: #fff; padding: .65rem 1rem; border-radius: .6rem; box-shadow: var(--crm-shadow-lg); font-size: .875rem;
    border-left: 4px solid #2e9e5b; transition: opacity .3s, transform .3s; }
.crm-toast.error { border-left-color: var(--crm-red); }
.crm-toast.hide { opacity: 0; transform: translateY(6px); }

/* ---------- Records list & board ---------- */
.stage-tabs { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .25rem; }
.stage-tab { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; padding: .45rem .85rem; border-radius: 999px; font-size: .82rem; font-weight: 500;
    background: #fff; border: 1px solid var(--crm-border); color: var(--crm-text); }
.stage-tab span { font-size: .72rem; font-weight: 700; color: var(--crm-muted); background: #eef2f7; border-radius: 999px; padding: .05rem .45rem; }
.stage-tab:hover { border-color: var(--crm-blue); text-decoration: none; }
.stage-tab.active { background: var(--crm-navy); border-color: var(--crm-navy); color: #fff; }
.stage-tab.active span { background: rgba(255,255,255,.15); color: #fff; }
.stage-tab .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.records-table tbody tr[data-href] { cursor: pointer; }
.records-table tbody tr:hover .avatar { transform: scale(1.05); }
.avatar { transition: transform .15s; }
.avatar-xs { width: 24px; height: 24px; font-size: .62rem; }
.view-toggle .btn { min-width: 64px; }

.board { display: flex; gap: .9rem; overflow-x: auto; padding-bottom: .75rem; align-items: flex-start; }
.board-col { flex: 0 0 290px; background: #eaeff5; border-radius: var(--crm-radius); padding: .5rem; max-height: 75vh; display: flex; flex-direction: column; transition: background-color .15s, box-shadow .15s; }
.board-col.drop-target { background: var(--crm-blue-soft); box-shadow: inset 0 0 0 2px var(--crm-blue); }
.board-col-head { display: flex; justify-content: space-between; align-items: center; padding: .45rem .55rem .6rem; font-size: .85rem; border-top: 3px solid; border-radius: .3rem; }
.board-col-head .count { font-size: .72rem; font-weight: 700; background: #fff; border-radius: 999px; padding: .1rem .5rem; color: var(--crm-muted); }
.border-secondary { border-top-color: #9aa8bb !important; } .border-primary { border-top-color: var(--crm-blue) !important; } .border-info { border-top-color: #3aa3d8 !important; }
.border-warning { border-top-color: #e3a008 !important; } .border-success { border-top-color: #2e9e5b !important; } .border-danger { border-top-color: var(--crm-red) !important; } .border-dark { border-top-color: var(--crm-navy) !important; }
.board-cards { display: flex; flex-direction: column; gap: .5rem; overflow-y: auto; min-height: 60px; padding: .1rem; }
.board-card { display: block; background: #fff; border-radius: .6rem; padding: .7rem .8rem; box-shadow: var(--crm-shadow-xs); border: 1px solid transparent;
    color: var(--crm-text); font-size: .86rem; cursor: grab; transition: box-shadow .15s, border-color .15s, transform .15s; }
.board-card:hover { border-color: #c8d6e6; box-shadow: var(--crm-shadow); text-decoration: none; transform: translateY(-1px); }
.board-card.dragging { opacity: .5; }
.board-more { text-align: center; font-size: .8rem; padding: .4rem; }
.board-empty { text-align: center; color: var(--crm-muted); font-size: .8rem; padding: 1rem; border: 1px dashed #c6d1de; border-radius: .6rem; }

/* ---------- Intake forms (e.g. passport application) ---------- */
.intake-section .card-header { font-size: 1rem; }
.intake-section .step-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; margin-right: .6rem;
    background: var(--crm-navy); color: #fff; font-size: .75rem; font-weight: 700; }
.intake .form-label { font-weight: 600; color: var(--crm-text); font-size: .86rem; }
.req { color: var(--crm-red); }
.choice-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.choice { padding: .5rem 1rem; border: 1px solid var(--crm-border); border-radius: .6rem; background: #fff; cursor: pointer; font-size: .9rem; font-weight: 500;
    transition: border-color .15s, background-color .15s, color .15s; user-select: none; }
.choice:hover { border-color: var(--crm-blue); }
.btn-check:checked + .choice { background: var(--crm-blue); border-color: var(--crm-blue); color: #fff; box-shadow: 0 1px 2px rgba(27,116,186,.3); }
.btn-check:focus-visible + .choice { box-shadow: 0 0 0 .2rem rgba(27,116,186,.25); }
.choice-group.is-invalid .choice { border-color: var(--crm-red); }
.sig-pad { border: 1.5px dashed #b9c6d6; border-radius: .75rem; background: #fbfcfe; overflow: hidden; }
.sig-pad canvas { display: block; width: 100%; height: 160px; touch-action: none; cursor: crosshair; }
.sig-pad.signed { border-style: solid; border-color: var(--crm-blue); background: #fff; }
.sig-pad.is-invalid { border-color: var(--crm-red); }
.sig-actions { display: flex; justify-content: space-between; align-items: center; padding: .25rem .75rem; border-top: 1px solid var(--crm-border); background: #fff; }
.intake-nav-link { display: block; padding: .35rem .6rem; border-radius: .4rem; font-size: .86rem; color: var(--crm-text); }
.intake-nav-link:hover { background: var(--crm-bg); text-decoration: none; }
.intake [hidden] { display: none !important; }
.intake-section { scroll-margin-top: 90px; }

/* ---------- WhatsApp inbox ---------- */
.inbox { display: grid; grid-template-columns: 320px 1fr 260px; height: calc(100vh - var(--crm-topbar-h) - 150px); min-height: 520px; overflow: hidden; }
.inbox-list { border-right: 1px solid var(--crm-border); display: flex; flex-direction: column; min-height: 0; }
.inbox-filters { display: flex; gap: .25rem; padding: .4rem .5rem; border-bottom: 1px solid var(--crm-border); }
.inbox-filters a { font-size: .78rem; padding: .25rem .6rem; border-radius: 999px; color: var(--crm-muted); }
.inbox-filters a.active { background: var(--crm-navy); color: #fff; }
.inbox-items { overflow-y: auto; flex: 1; }
.inbox-item { display: flex; gap: .7rem; padding: .7rem .8rem; border-bottom: 1px solid #f0f3f7; color: var(--crm-text); }
.inbox-item:hover { background: #f7f9fc; text-decoration: none; }
.inbox-item.active { background: var(--crm-blue-soft); }
.inbox-item .name { font-weight: 600; font-size: .88rem; }
.inbox-item.unread .name { font-weight: 700; }
.inbox-item .time, .inbox-item .assignee { font-size: .72rem; color: var(--crm-muted); white-space: nowrap; }
.inbox-item .preview { font-size: .8rem; color: var(--crm-muted); }
.inbox-item.unread .preview { color: var(--crm-text); }
.inbox-thread { display: flex; flex-direction: column; min-height: 0; background: #efeae2; }
.empty-thread { align-items: center; justify-content: center; background: #f7f9fc; }
.thread-head { display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem; background: #fff; border-bottom: 1px solid var(--crm-border); }
.thread-head .form-select { width: auto; }
.thread-body { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: .35rem; }
.bubble { max-width: 70%; padding: .45rem .7rem .3rem; border-radius: .75rem; box-shadow: 0 1px 1px rgba(0,0,0,.08); font-size: .9rem; word-wrap: break-word; }
.bubble.in { align-self: flex-start; background: #fff; border-top-left-radius: .2rem; }
.bubble.out { align-self: flex-end; background: #d9fdd3; border-top-right-radius: .2rem; }
.bubble.failed { background: #fde8ec; }
.bubble .text { white-space: pre-wrap; }
.bubble img { max-width: 260px; max-height: 260px; border-radius: .5rem; display: block; margin-bottom: .25rem; }
.bubble audio, .bubble video { max-width: 260px; }
.bubble .doc { display: block; padding: .4rem .5rem; background: rgba(0,0,0,.04); border-radius: .4rem; margin-bottom: .25rem; }
.bubble .meta { font-size: .68rem; color: #667781; text-align: right; margin-top: .1rem; }
.bubble .tick.read { color: #53bdeb; } .bubble .tick.failed { color: var(--crm-red); font-weight: 700; }
.bubble .err { font-size: .72rem; color: var(--crm-red); }
.thread-compose { background: #f0f2f5; border-top: 1px solid var(--crm-border); }
.compose { display: flex; gap: .5rem; align-items: flex-end; padding: .6rem .75rem; }
.compose textarea { resize: none; border-radius: 1.2rem; padding: .5rem .9rem; }
.compose .btn-primary { border-radius: 1.2rem; }
.window-note { font-size: .72rem; color: var(--crm-muted); padding: 0 1rem .5rem; }
.window-closed { padding: .9rem 1rem; }
.template-pick { background: #fff; border: 1px solid var(--crm-border); border-radius: .5rem; padding: .5rem .75rem; margin-bottom: .4rem; }
.template-pick summary { cursor: pointer; font-weight: 600; font-size: .86rem; }
.template-preview { white-space: pre-wrap; background: #f7f9fc; padding: .5rem; border-radius: .4rem; }
.inbox-side { border-left: 1px solid var(--crm-border); overflow-y: auto; }
@media (max-width: 1199.98px) { .inbox { grid-template-columns: 280px 1fr; } .inbox-side { display: none; } }
@media (max-width: 767.98px) { .inbox { grid-template-columns: 1fr; height: auto; } .inbox[data-conversation] .inbox-list { display: none; } .inbox:not([data-conversation]) .inbox-thread { display: none; } }

/* ---------- Team chat ---------- */
.chat { display: grid; grid-template-columns: 260px 1fr; height: calc(100vh - var(--crm-topbar-h) - 150px); min-height: 480px; overflow: hidden; }
.chat-list { border-right: 1px solid var(--crm-border); overflow-y: auto; background: #fafbfd; padding-bottom: .5rem; }
.chat-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; color: var(--crm-muted); padding: .9rem .9rem .3rem; }
.chat-item { display: flex; justify-content: space-between; align-items: center; padding: .4rem .9rem; margin: 0 .4rem; border-radius: .4rem; color: var(--crm-text); font-size: .88rem; }
.chat-item:hover { background: #eef2f7; text-decoration: none; }
.chat-item.active { background: var(--crm-navy); color: #fff; }
.chat-thread { display: flex; flex-direction: column; min-height: 0; }
.chat-body { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: .8rem; }
.chat-msg { display: flex; gap: .65rem; align-items: flex-start; }
.chat-msg .who { font-weight: 600; font-size: .85rem; }
.chat-msg .when { font-weight: 400; font-size: .72rem; color: var(--crm-muted); margin-left: .3rem; }
.chat-msg .text { white-space: pre-wrap; word-wrap: break-word; font-size: .9rem; }
.chat-msg.mine .avatar { background: var(--crm-blue); }
.avatar-sm { width: 32px; height: 32px; font-size: .72rem; }
.chat .compose { border-top: 1px solid var(--crm-border); background: #fff; }
@media (max-width: 767.98px) { .chat { grid-template-columns: 1fr; height: auto; } .chat-list { max-height: 220px; } }

/* ---------- Floating team chat ---------- */
.cw { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 1900; display: flex; flex-direction: column; align-items: flex-end; gap: .75rem; }
.cw-fab { width: 56px; height: 56px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--crm-navy) 0%, var(--crm-blue) 100%);
    color: #fff; box-shadow: var(--crm-shadow-lg); display: grid; place-items: center; position: relative; transition: transform .15s; order: 2; }
.cw-fab:hover { transform: scale(1.06); }
.cw-fab svg { width: 24px; height: 24px; }
.cw-badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--crm-red);
    color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.cw.ping .cw-fab { animation: cwping .6s ease; }
@keyframes cwping { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.15); } }
.cw-panel { width: 360px; height: 520px; max-height: calc(100vh - 120px); background: #fff; border-radius: 1rem; box-shadow: 0 18px 50px rgba(10,22,40,.25);
    display: flex; flex-direction: column; overflow: hidden; order: 1; border: 1px solid var(--crm-border); }
.cw-head { display: flex; align-items: center; gap: .4rem; padding: .7rem .8rem; color: #fff; background: linear-gradient(135deg, var(--crm-navy) 0%, var(--crm-navy-2) 100%); }
.cw-title { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-icon, .cw-back { border: 0; background: transparent; color: #cfe0f3; width: 30px; height: 30px; border-radius: .4rem; display: grid; place-items: center; font-size: .95rem; }
.cw-icon:hover, .cw-back:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.cw-list { flex: 1; overflow-y: auto; padding: .4rem 0; }
.cw-loading, .cw-empty { color: var(--crm-muted); font-size: .85rem; text-align: center; padding: 2rem 1rem; }
.cw-group { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; color: var(--crm-muted); padding: .7rem 1rem .3rem; }
.cw-item { display: flex; align-items: center; gap: .6rem; width: 100%; border: 0; background: none; padding: .5rem 1rem; text-align: left; font-size: .9rem; color: var(--crm-text); }
.cw-item:hover { background: var(--crm-bg); }
.cw-item.unread .cw-name { font-weight: 700; }
.cw-item .avatar { background: var(--crm-blue-soft); color: var(--crm-blue); }
.cw-people { margin: .6rem 1rem; width: calc(100% - 2rem); }
.cw-thread { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.cw-messages { flex: 1; overflow-y: auto; padding: .8rem; display: flex; flex-direction: column; gap: .5rem; background: #f7f9fc; }
.cw-msg { max-width: 85%; align-self: flex-start; }
.cw-msg.mine { align-self: flex-end; text-align: right; }
.cw-who { font-size: .68rem; color: var(--crm-muted); margin: 0 .3rem .1rem; }
.cw-text { display: inline-block; text-align: left; white-space: pre-wrap; word-wrap: break-word; font-size: .88rem; padding: .45rem .7rem; border-radius: .8rem;
    background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.cw-msg.mine .cw-text { background: var(--crm-blue); color: #fff; }
.cw-compose { display: flex; gap: .4rem; padding: .5rem; border-top: 1px solid var(--crm-border); align-items: flex-end; margin: 0; }
.cw-compose textarea { flex: 1; resize: none; border: 1px solid var(--crm-border); border-radius: 1rem; padding: .4rem .75rem; font-size: .88rem; }
.cw-compose textarea:focus { outline: none; border-color: var(--crm-blue); }
.cw-compose .btn { border-radius: 50%; width: 34px; height: 34px; padding: 0; }
body:has(#chatWidget) #toastHost { bottom: 5.5rem; }
@media (max-width: 575.98px) { .cw { right: .75rem; bottom: .75rem; } .cw-panel { width: calc(100vw - 1.5rem); height: calc(100vh - 110px); } }
@media print { .cw { display: none !important; } }
.lang-picker .dropdown-item.active { background: var(--crm-blue-soft); color: var(--crm-blue-dark); }
.lang-dark .btn-outline-secondary { --bs-btn-color: #fff; --bs-btn-border-color: rgba(255,255,255,.35); --bs-btn-bg: transparent; --bs-btn-hover-bg: rgba(255,255,255,.1); --bs-btn-hover-color: #fff; }
.public-header .container { justify-content: flex-start; }

/* ---------- Records list (rows) ---------- */
.rec-list { display: flex; flex-direction: column; gap: .5rem; }
.rec-row { display: flex; align-items: center; gap: 1rem; padding: .85rem 1.1rem .85rem 1rem; background: #fff; border: 1px solid var(--crm-border);
    border-left: 4px solid #9aa8bb; border-radius: var(--crm-radius); color: var(--crm-text); box-shadow: var(--crm-shadow-xs);
    transition: box-shadow .15s, transform .15s, border-color .15s; }
.rec-row:hover { text-decoration: none; box-shadow: var(--crm-shadow); transform: translateY(-1px); border-color: #c8d6e6; }
.rec-row .avatar { width: 40px; height: 40px; background: var(--crm-blue-soft); color: var(--crm-blue); font-size: .8rem; }
.rec-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.rec-name { font-weight: 650; font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-sub { font-size: .8rem; color: var(--crm-muted); display: flex; gap: .35rem; flex-wrap: wrap; }
.rec-num { font-variant-numeric: tabular-nums; font-weight: 500; }
.rec-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .15rem; }
.rec-chip { font-size: .75rem; background: #f3f6fa; border-radius: 999px; padding: .15rem .6rem; color: var(--crm-text); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.rec-chip span { color: var(--crm-muted); margin-right: .2rem; }
.rec-side { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; flex: none; }
.rec-time { font-size: .75rem; color: var(--crm-muted); white-space: nowrap; }
.rec-chevron { font-size: 1.4rem; color: #b3bfcf; flex: none; transition: transform .15s, color .15s; }
.rec-row:hover .rec-chevron { color: var(--crm-blue); transform: translateX(2px); }
.stripe-primary { border-left-color: var(--crm-blue); } .stripe-info { border-left-color: #3aa3d8; } .stripe-warning { border-left-color: #e3a008; }
.stripe-success { border-left-color: #2e9e5b; } .stripe-danger { border-left-color: var(--crm-red); } .stripe-dark { border-left-color: var(--crm-navy); }
@media (max-width: 575.98px) { .rec-row { flex-wrap: wrap; } .rec-side { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; } .rec-chevron { display: none; } }

/* ---------------------------------------------------------------- records "Filter by" panel (Zoho style) */
.rec-layout { display: block; }
.rec-layout .flt-panel { display: none; }
.rec-layout.filters-open { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 1rem; align-items: start; }
.rec-layout.filters-open .flt-panel { display: flex; }
.rec-content { min-width: 0; }
.flt-panel { flex-direction: column; background: var(--crm-surface); border: 1px solid var(--crm-border); border-radius: var(--crm-radius);
    box-shadow: var(--crm-shadow-xs); padding: .75rem; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); }
.flt-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.flt-scroll { overflow-y: auto; flex: 1 1 auto; margin: 0 -.25rem; padding: 0 .25rem; }
.flt-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--crm-muted); font-weight: 600; margin: .75rem 0 .25rem; }
.flt-group:first-child { margin-top: 0; }
.flt-field { border-radius: .5rem; }
.flt-field > summary { list-style: none; cursor: pointer; padding: .35rem .5rem; border-radius: .5rem; font-size: .875rem; display: flex; align-items: center; gap: .5rem; }
.flt-field > summary::-webkit-details-marker { display: none; }
.flt-field > summary::before { content: ""; width: 14px; height: 14px; flex: none; border: 1.5px solid #a8b3c4; border-radius: 4px; }
.flt-field > summary:hover { background: var(--crm-blue-soft); }
.flt-field.is-active > summary { font-weight: 600; color: var(--crm-blue); }
.flt-field.is-active > summary::before { background: var(--crm-blue); border-color: var(--crm-blue);
    box-shadow: inset 0 0 0 2px var(--crm-surface); }
.flt-body { display: flex; flex-direction: column; gap: .4rem; padding: .25rem .5rem .6rem 1.85rem; }
.flt-options { max-height: 180px; overflow-y: auto; font-size: .85rem; }
.flt-v2 { display: flex; flex-direction: column; gap: .25rem; margin-top: .25rem; }
.flt-actions { display: flex; gap: .5rem; padding-top: .6rem; margin-top: .4rem; border-top: 1px solid var(--crm-border); }
.flt-chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.flt-chip { display: inline-flex; gap: .3rem; align-items: center; font-size: .8rem; padding: .2rem .6rem; border-radius: 999px; text-decoration: none;
    background: var(--crm-blue-soft); color: var(--crm-blue); border: 1px solid transparent; }
.flt-chip:hover { border-color: currentColor; }
@media (max-width: 991.98px) {
    .rec-layout.filters-open { display: block; }
    .rec-layout.filters-open .flt-panel { position: static; max-height: none; margin-bottom: 1rem; }
    .flt-scroll { max-height: 55vh; }
}
.flt-dd { position: relative; }
.flt-dd > summary { list-style: none; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flt-dd > summary::-webkit-details-marker { display: none; }
.flt-dd-menu { position: absolute; z-index: 30; left: 0; right: 0; margin-top: .25rem; padding: .5rem; background: var(--crm-surface);
    border: 1px solid var(--crm-border); border-radius: .5rem; box-shadow: var(--crm-shadow-lg); }
.flt-dd-menu .flt-options { max-height: 220px; }
.flt-dd-actions { margin-bottom: .25rem; color: var(--crm-muted); }

/* ---------------------------------------------------------------- records list: selection + mass actions */
.rec-item { display: flex; align-items: stretch; gap: .6rem; }
.rec-item > .rec-row { flex: 1; min-width: 0; }
.rec-check { display: flex; align-items: center; padding: 0 .15rem; cursor: pointer; }
.rec-check .form-check-input { width: 1.15rem; height: 1.15rem; margin: 0; cursor: pointer; }
.rec-item.selected > .rec-row { border-color: var(--crm-blue); background: var(--crm-blue-soft); }
.bulk-select-all { margin: 0 0 .5rem .15rem; color: var(--crm-muted); }
.bulk-bar { position: sticky; top: .5rem; z-index: 6; margin-bottom: .75rem; padding: .6rem .8rem; background: var(--crm-navy); color: #fff;
    border-radius: var(--crm-radius); box-shadow: var(--crm-shadow-lg); }
.bulk-bar[hidden] { display: none; }
.bulk-bar-main { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.bulk-bar .btn-link { color: #9fc4e8; }
.bulk-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: .5rem; }
.bulk-bar .btn-outline-secondary { color: #fff; border-color: rgba(255,255,255,.45); }
.bulk-bar .btn-outline-secondary:hover { background: rgba(255,255,255,.15); }
.bulk-panel { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .6rem; padding-top: .6rem; border-top: 1px solid rgba(255,255,255,.2); }
.bulk-panel[hidden] { display: none; }
.bulk-panel .form-select { width: auto; min-width: 180px; max-width: 260px; }
.bulk-panel .text-muted { color: #b9c7da !important; }
.bulk-value { min-width: 200px; }
.bulk-value .form-check { color: #fff; }
.doc-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; position: sticky; top: .5rem; z-index: 6; margin-bottom: .75rem; padding: .6rem .8rem;
    background: var(--crm-navy); color: #fff; border-radius: var(--crm-radius); box-shadow: var(--crm-shadow-lg); }
.doc-bar[hidden] { display: none; }
.doc-bar .btn-link { color: #9fc4e8; }
.doc-bar .btn-outline-secondary { color: #fff; border-color: rgba(255,255,255,.45); }
.doc-bar .btn-outline-secondary:hover { background: rgba(255,255,255,.15); }

/* ---------------------------------------------------------------- file preview window */
.file-preview-body { padding: 0; height: 72vh; display: flex; align-items: center; justify-content: center; background: #eef2f7; overflow: auto; }
.fp-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.fp-image { max-width: 100%; max-height: 100%; object-fit: contain; }
.fp-text { align-self: stretch; width: 100%; margin: 0; padding: 1rem; background: #fff; font-size: .8rem; white-space: pre-wrap; overflow: auto; }
.fp-message { text-align: center; padding: 2rem; color: var(--crm-muted); }
.fp-message p { margin-bottom: 1rem; }

/* ---------------------------------------------------------------- analytics */
.an-designer { display: flex; flex-direction: column; gap: .75rem; }
.an-topbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.an-name { max-width: 340px; font-weight: 600; }
.an-banner { padding: .5rem .8rem; border-radius: .5rem; background: var(--crm-blue-soft); font-size: .85rem; }
.an-banner[hidden] { display: none; }
.an-banner-error { background: #fdecef; color: #a1122b; }
.an-banner-ok { background: #e6f6ec; color: #17663a; }
.an-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 260px; gap: .9rem; align-items: start; }
.an-left, .an-right { position: sticky; top: .75rem; max-height: calc(100vh - 1.5rem); overflow-y: auto; }
.an-fields { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.an-field { display: flex; align-items: center; gap: .5rem; padding: .3rem .5rem; border-radius: .4rem; cursor: grab; font-size: .84rem; }
.an-field:hover, .an-field:focus { background: var(--crm-blue-soft); outline: none; }
.an-field-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-field-add { border: 0; background: none; color: var(--crm-blue); font-weight: 700; opacity: 0; cursor: pointer; }
.an-field:hover .an-field-add, .an-field:focus .an-field-add { opacity: 1; }
.an-glyph-type { width: 1.6rem; flex: none; text-align: center; font-size: .7rem; font-weight: 700; color: var(--crm-muted); }
.an-tree summary { cursor: pointer; font-size: .85rem; padding: .2rem 0; }
.an-ins { cursor: pointer; color: var(--crm-blue); font-size: .72rem; }
.an-tree-cols { list-style: none; margin: 0 0 .5rem; padding-left: .4rem; }
.an-tree-col { border: 0; background: none; width: 100%; text-align: left; padding: .15rem .3rem; border-radius: .3rem; font-size: .78rem; display: flex; align-items: center; }
.an-tree-col:hover { background: var(--crm-blue-soft); }

.an-wells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-bottom: .8rem; }
.an-well { background: var(--crm-surface); border: 1.5px dashed #c3cfdf; border-radius: .6rem; padding: .5rem .6rem; min-height: 84px; }
.an-well.over { border-color: var(--crm-blue); background: var(--crm-blue-soft); }
.an-well-wide { grid-column: 1 / -1; }
.an-well[hidden] { display: none; }
.an-well-title { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--crm-muted); margin-bottom: .35rem; }
.an-well-body { display: flex; flex-wrap: wrap; gap: .4rem; }
.an-hint { font-size: .78rem; color: #9aa8bb; }
.an-chip { display: inline-flex; align-items: center; gap: .35rem; background: var(--crm-blue-soft); border: 1px solid #cfe0f3; border-radius: .5rem; padding: .15rem .3rem .15rem .6rem; max-width: 100%; }
.an-chip-label { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.an-chip-sel { width: auto; min-width: 84px; padding-top: .1rem; padding-bottom: .1rem; font-size: .75rem; }
.an-chip-input { width: 130px; font-size: .78rem; }
.an-chip-x { border: 0; background: none; color: var(--crm-muted); font-size: 1.1rem; line-height: 1; padding: 0 .35rem; cursor: pointer; }
.an-chip-x:hover { color: var(--crm-red); }
.an-filter { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; width: 100%; background: #f6f9fc; border: 1px solid var(--crm-border); border-radius: .5rem; padding: .25rem .4rem .25rem .6rem; }
.an-between { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; }
.an-dd { position: relative; min-width: 160px; }
.an-dd > summary { list-style: none; cursor: pointer; font-size: .78rem; padding-top: .15rem; padding-bottom: .15rem; }
.an-dd > summary::-webkit-details-marker { display: none; }
.an-dd-menu { position: absolute; z-index: 20; margin-top: .2rem; padding: .4rem .6rem; background: var(--crm-surface); border: 1px solid var(--crm-border); border-radius: .5rem;
    box-shadow: var(--crm-shadow-lg); max-height: 240px; min-width: 200px; overflow-y: auto; }
.an-dd-menu .form-check-label { font-size: .8rem; }
.an-sql { font-size: .82rem; tab-size: 2; }

.an-preview { overflow: hidden; }
.an-preview-head { display: flex; justify-content: space-between; align-items: center; padding: .5rem .8rem; border-bottom: 1px solid var(--crm-border); }
.an-canvas { min-height: 340px; height: 420px; padding: .6rem; position: relative; }
.an-chart { position: relative; width: 100%; height: 100%; }
.an-note { display: grid; place-items: center; height: 100%; color: var(--crm-muted); text-align: center; padding: 1rem; }
.an-note.an-error { color: #a1122b; white-space: pre-wrap; }
.an-note-small { height: auto; padding: .3rem; font-size: .75rem; }
.an-table-wrap { height: 100%; overflow: auto; }
.an-tview { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.an-tview .an-table-wrap { flex: 1 1 auto; min-height: 0; height: auto; }
.an-tbar { display: flex; align-items: center; gap: .6rem; padding: .35rem .5rem; flex: 0 0 auto; }
.an-tsearch { max-width: 280px; }
.an-sortable { cursor: pointer; user-select: none; }
.an-sortable::after { content: ' ↕'; opacity: .25; font-size: .75em; }
.an-sortable.sorted[data-dir="asc"]::after { content: ' ▲'; opacity: .8; }
.an-sortable.sorted[data-dir="desc"]::after { content: ' ▼'; opacity: .8; }
.an-table thead tr.an-filter-row th { padding: .2rem .3rem; font-weight: normal; }
.an-colfilter { min-width: 4.5rem; font-size: .75rem; }
.an-table { font-size: .82rem; margin: 0; }
.an-table thead th { position: sticky; top: 0; background: #f3f6fa; z-index: 1; white-space: nowrap; }
.an-table tfoot td { background: #f3f6fa; position: sticky; bottom: 0; }
.an-kpi { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.an-kpi { padding: 0 .5rem; overflow: hidden; }
.an-kpi-value, .an-kpi-label { max-width: 100%; white-space: nowrap; }
.an-kpi-value { font-size: 2.4rem; font-weight: 700; line-height: 1.1; color: #000; }
.an-kpi-label { color: #404040; font-size: .9rem; font-weight: 700; margin-bottom: .35rem; }
@media (max-width: 575.98px) { .an-kpi-value { font-size: 2rem; } }
.an-tile-body:has(> .an-map-wrap) { padding: 0; overflow: hidden; border-radius: 0 0 var(--crm-radius) var(--crm-radius); }
.an-map-wrap { position: absolute; inset: 0; }
.an-map { display: block; width: 100%; height: 100%; }
.an-map-bg { fill: #e4ecf3; }
.an-map-state { stroke: #fff; stroke-linejoin: round; }
.an-map-link { cursor: pointer; }
.an-map-link:hover .an-map-state, .an-map-link:focus .an-map-state { filter: brightness(.92); stroke: #12203a; }
.an-map-link:focus { outline: none; }
.an-map-state:not(.has-data) { stroke: #c9d3df; }
.an-map-dark .an-map-bg { fill: #181818; }
.an-heat-state { fill: #454545; stroke: #7a7a7a; stroke-dasharray: 2 2; stroke-linejoin: round; }
.an-heat-name { fill: #a7a7a7; text-anchor: middle; dominant-baseline: middle; pointer-events: none; opacity: .75; }
.an-heat-glow { mix-blend-mode: screen; }
.an-map-label { pointer-events: none; text-anchor: middle; fill: #000; }
.an-map-callout { pointer-events: none; }
.an-map-leader { stroke: #12203a; }
.an-map-leaderdot { fill: #12203a; }
.an-map-calltext { fill: #000; font-weight: 600; paint-order: stroke; stroke: #fff; stroke-linejoin: round; }
.an-map-name { font-weight: 400; fill: #4a5566; opacity: .8; }
.an-map-count { font-weight: 600; }

.an-gensql { background: #0a1628; color: #d8e4f2; border-radius: .5rem; padding: .75rem; font-size: .78rem; white-space: pre-wrap; margin: .5rem 0; }

.an-visuals { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; }
.an-visual { display: flex; flex-direction: column; align-items: center; gap: .1rem; border: 1px solid var(--crm-border); background: #fff; border-radius: .5rem; padding: .35rem .2rem; font-size: .68rem; cursor: pointer; }
.an-visual:hover { border-color: var(--crm-blue); }
.an-visual.active { border-color: var(--crm-blue); background: var(--crm-blue-soft); color: var(--crm-blue-dark); font-weight: 600; }
.an-glyph::before { font-size: 1.25rem; line-height: 1.2; }
.an-glyph-bar::before { content: "▥"; } .an-glyph-hbar::before { content: "☰"; } .an-glyph-stacked::before { content: "▤"; }
.an-glyph-line::before { content: "⌇"; } .an-glyph-area::before { content: "◭"; } .an-glyph-pie::before { content: "◔"; }
.an-glyph-doughnut::before { content: "◎"; } .an-glyph-kpi::before { content: "№"; } .an-glyph-table::before { content: "▦"; }
.an-glyph-pivot::before { content: "▩"; } .an-glyph-heatmap::before { content: "◍"; } .an-glyph-halfdonut::before { content: "◒"; } .an-glyph-usmap::before { content: "▚"; } .an-glyph-list::before { content: "≣"; }
.an-checks { max-height: 150px; overflow-y: auto; font-size: .8rem; }

.an-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; }
.an-tile { display: flex; flex-direction: column; background: var(--crm-surface); border: 1px solid var(--crm-border); border-radius: var(--crm-radius); box-shadow: var(--crm-shadow-xs); min-width: 0; }
.an-tile.dragging { opacity: .45; }
.an-tile.drop-target { outline: 2px dashed var(--crm-blue); outline-offset: 2px; }
.an-tile-head { display: flex; align-items: center; gap: .4rem; padding: .55rem .8rem; border-bottom: 1px solid var(--crm-border); min-height: 46px; }
.an-tile-title { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }
.an-tile-head select { width: auto; }
.an-grip { cursor: grab; color: var(--crm-muted); font-size: 1.1rem; }
.an-tile-body { flex: 1; min-height: 0; padding: .5rem; position: relative; }
@media (max-width: 1199.98px) {
    .an-layout { grid-template-columns: 220px minmax(0, 1fr); }
    .an-right { grid-column: 1 / -1; position: static; max-height: none; }
}
@media (max-width: 767.98px) {
    .an-layout { grid-template-columns: 1fr; }
    .an-left { position: static; max-height: none; }
    .an-wells { grid-template-columns: 1fr; }
    /* Small tiles (numbers) sit two to a row; everything else takes the full width */
    .an-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .an-tile { grid-column: 1 / -1 !important; }
    .an-tile[data-span="1"], .an-tile[data-span="2"], .an-tile[data-span="3"] { grid-column: span 1 !important; }
    .an-newdash { flex: 1 1 100%; } .an-newdash input { flex: 1; width: auto; }
}
.an-tile-bare .an-tile-body { padding: .75rem; }
.an-viewmode { margin: .75rem 0; display: flex; flex-direction: column; height: calc(100vh - 11rem); min-height: 360px; }
.an-viewbody { flex: 1 1 auto; min-height: 0; }

.an-glyph-combo::before { content: "▥"; } .an-glyph-radar::before { content: "✶"; } .an-glyph-polar::before { content: "✺"; } .an-glyph-scatter::before { content: "∴"; }
.an-glyph-funnel::before { content: "▽"; } .an-glyph-treemap::before { content: "▦"; } .an-glyph-gauge::before { content: "◠"; } .an-glyph-bubblemap::before { content: "◉"; }
.an-funnel { display: flex; flex-direction: column; justify-content: center; gap: 4px; height: 100%; padding: .5rem 1rem; }
.an-funnel-row { display: flex; justify-content: center; flex: 1 1 0; min-height: 0; max-height: 44px; }
.an-funnel-bar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 0 .75rem; color: #fff; font-size: .8rem; border-radius: 4px; overflow: hidden; white-space: nowrap; }
.an-funnel-bar span { overflow: hidden; text-overflow: ellipsis; }
.an-treemap { position: relative; width: 100%; height: 100%; }
.an-treemap-box { position: absolute; box-sizing: border-box; border: 2px solid #fff; border-radius: 3px; color: #fff; padding: .3rem .4rem; overflow: hidden; display: flex; flex-direction: column; font-size: .78rem; line-height: 1.2; }
.an-treemap-box strong { font-size: .95rem; }
.an-gauge { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; }
.an-gauge svg { width: 100%; max-height: 85%; }
.an-gauge-track, .an-gauge-fill { fill: none; stroke-width: 18; stroke-linecap: round; }
.an-gauge-track { stroke: #e3e8ef; } .an-gauge-fill { stroke: #1b74ba; }
.an-gauge-value { font-size: 22px; font-weight: 700; fill: currentColor; } .an-gauge-end { font-size: 9px; fill: #868e96; }
.an-gauge-label { font-size: .85rem; color: var(--crm-muted); }
.an-bubble { fill: rgba(255, 79, 139, .55); stroke: #ffd36b; stroke-width: .6; }
.an-bubble-label { fill: #fff; text-anchor: middle; font-weight: 700; pointer-events: none; }

.stepper button.step { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.stepper .step-click:hover .dot, .stepper .step-click:focus-visible .dot { border-color: var(--crm-blue); box-shadow: 0 0 0 4px rgba(27,116,186,.18); }
.stepper .step-click:hover .name { color: var(--crm-blue-dark); text-decoration: underline; }
.lookup-picker { position: relative; }
.lookup-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; max-height: 260px; overflow: auto; box-shadow: 0 10px 30px rgba(10,22,40,.18); margin: 0; }
.lookup-results .list-group-item { cursor: pointer; font-size: .88rem; }
.fv-link { font-weight: 600; }
.related-link { display: flex; justify-content: space-between; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--crm-border); font-size: .88rem; }
.related-link:last-child { border-bottom: 0; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.1rem; }
/* Contact record, laid out like Zoho */
.zc-header .zc-avatar { width: 72px; height: 72px; font-size: 1.5rem; flex: none; }
.zc-name { font-size: 1.5rem; margin: .1rem 0 .3rem; }
.zc-card-line { display: flex; flex-wrap: wrap; gap: .3rem 1.6rem; font-size: .86rem; }
.zc-k { color: var(--crm-muted); margin-right: .3rem; }
.zc-rail { position: sticky; top: 80px; }
.zc-rail a { display: flex; justify-content: space-between; align-items: center; padding: .4rem .6rem; border-radius: .4rem; color: var(--crm-text); font-size: .86rem; }
.zc-rail a:hover { background: var(--crm-bg); text-decoration: none; }
.zc-rail-title { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--crm-muted); padding: .3rem .6rem; }
.zc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2.5rem; }
.zc-cell { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--crm-border); align-items: baseline; }
.zc-cell dt { text-align: right; font-weight: 400; color: var(--crm-muted); font-size: .84rem; }
.zc-cell dd { margin: 0; font-weight: 500; word-break: break-word; white-space: pre-wrap; }
@media (max-width: 767px) { .zc-fields { grid-template-columns: 1fr; } }

/* ---------- Left menu: fold sections, hide the whole menu ---------- */
.app-sidebar .nav-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; background: none; border: 0; text-align: left; cursor: pointer; }
.app-sidebar .nav-toggle:hover { color: #9fb1c9; }
.app-sidebar .nav-caret { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; margin-right: .2rem; }
/* A folded section (class on <html>, set before first paint); the section with the current page stays open */
html.fold-services .nav-group[data-nav-group="services"]:not(:has(.nav-link.active)) .nav-items,
html.fold-messages .nav-group[data-nav-group="messages"]:not(:has(.nav-link.active)) .nav-items,
html.fold-manage .nav-group[data-nav-group="manage"]:not(:has(.nav-link.active)) .nav-items,
html.fold-admin .nav-group[data-nav-group="admin"]:not(:has(.nav-link.active)) .nav-items { display: none; }
html.fold-services .nav-group[data-nav-group="services"]:not(:has(.nav-link.active)) .nav-caret,
html.fold-messages .nav-group[data-nav-group="messages"]:not(:has(.nav-link.active)) .nav-caret,
html.fold-manage .nav-group[data-nav-group="manage"]:not(:has(.nav-link.active)) .nav-caret,
html.fold-admin .nav-group[data-nav-group="admin"]:not(:has(.nav-link.active)) .nav-caret { transform: rotate(-45deg); }
@media (min-width: 992px) {
    .app-sidebar { transition: width .2s ease; overflow: visible; }
    .app-main { transition: margin-left .2s ease; }
    /* Collapsed: a slim icon-only rail, and the page takes the rest of the screen (both follow --crm-sidebar-w) */
    html.sidebar-collapsed { --crm-sidebar-w: 68px; }
    html.sidebar-collapsed .app-sidebar .brand { justify-content: center; padding: 1rem .5rem; }
    html.sidebar-collapsed .app-sidebar .brand > span:not(.brand-mark) { display: none; }
    html.sidebar-collapsed .app-sidebar .nav-scroll { padding: .5rem .5rem 1rem; overflow-x: hidden; }
    html.sidebar-collapsed .app-sidebar .nav-section { display: none; }
    html.sidebar-collapsed .app-sidebar .nav-group .nav-items { display: block !important; }
    html.sidebar-collapsed .app-sidebar .nav-link { font-size: 0; gap: 0; justify-content: center; padding: .6rem 0; }
    html.sidebar-collapsed .app-sidebar .nav-link > :not(svg):not(.badge) { display: none; }
    html.sidebar-collapsed .app-sidebar .nav-scroll { scrollbar-gutter: auto; }
    html.sidebar-collapsed .app-sidebar .nav-link svg { width: 20px; height: 20px; }
    html.sidebar-collapsed .app-sidebar .nav-link .badge { position: absolute; top: 2px; right: 4px; font-size: .6rem; padding: .15rem .35rem; margin: 0; }
    html.sidebar-collapsed .app-sidebar .nav-link.active::before { left: -.5rem; }
    html.sidebar-collapsed .app-sidebar .sidebar-foot { display: none; }
}
}
.related-link-block { flex-direction: column; gap: .1rem; min-width: 0; overflow: hidden; }
.related-link-block > * { min-width: 0; max-width: 100%; }
.related-snippet { color: var(--crm-text); font-size: .82rem; opacity: .85; line-height: 1.3; display: block; white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.related-date { color: var(--crm-muted); font-size: .72rem; }

/* =====================================================================
   Colour layer — more colour on every page, same navy / blue / red brand.
   Soft tints for surfaces, brand colour for emphasis; nothing here moves anything.
   ===================================================================== */
:root {
    --crm-green: #178c54;  --crm-green-soft: #e8f6ef;
    --crm-purple: #6f42c1; --crm-purple-soft: #f0eafa;
    --crm-teal: #0f9aa8;   --crm-teal-soft: #e5f6f8;
    --crm-gold-soft: #fbf5e1;
    --crm-red-soft: #fdecef;
    --crm-tint: #e9f1fa;
}

/* The page itself: a pale blue wash at the top that fades into the usual background */
body { background: linear-gradient(180deg, #e6f0fa 0, var(--crm-bg) 340px) no-repeat, var(--crm-bg); }
.app-content { position: relative; }

/* Page headers become a soft coloured banner with the brand accent on its left edge */
.page-header {
    padding: 1rem 1.25rem; border-radius: var(--crm-radius); border: 1px solid #d5e3f2; border-left: 5px solid var(--crm-blue);
    background: linear-gradient(110deg, #ffffff 0%, #f1f7fd 55%, #e4eefa 100%); box-shadow: var(--crm-shadow-xs);
}
.page-header .eyebrow { color: var(--crm-blue); font-weight: 700; }
.page-header h1 { color: var(--crm-navy); }
.page-header .back { color: var(--crm-blue-dark); font-weight: 600; }
.an-designer .page-header, .zc-header .page-header { background: none; border: 0; box-shadow: none; padding: 0; border-radius: 0; }

/* Cards: tinted headers with a blue marker */
.card { border-color: #d9e4f0; }
.card > .card-header {
    background: linear-gradient(180deg, #f8fbfe 0%, #edf4fb 100%); border-bottom: 1px solid #d9e4f0; color: var(--crm-navy);
    border-top-left-radius: var(--crm-radius); border-top-right-radius: var(--crm-radius);
}
.card > .card-header:not(:has(.avatar))::before { content: ""; width: 4px; align-self: stretch; margin: -.1rem .6rem -.1rem 0; border-radius: 4px; background: var(--crm-blue); flex: none; }
.card > .card-header { justify-content: flex-start; }
.card > .card-header > :last-child:not(:first-child) { margin-left: auto; }
.card:nth-of-type(5n+2) > .card-header:not(:has(.avatar))::before { background: var(--crm-red); }
.card:nth-of-type(5n+3) > .card-header:not(:has(.avatar))::before { background: var(--crm-gold); }
.card:nth-of-type(5n+4) > .card-header:not(:has(.avatar))::before { background: var(--crm-green); }
.card:nth-of-type(5n+5) > .card-header:not(:has(.avatar))::before { background: var(--crm-purple); }
.field-section > .card-header::before, .an-preview .card-header::before { display: none; }

/* Tables */
.table > thead th { background: #eaf2fb; color: var(--crm-navy); border-bottom: 2px solid #cfe0f1; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f0f6fd; }
.table > tbody > tr:nth-child(even) > td { background-color: #fbfdff; }
.table a:not(.btn) { font-weight: 600; }

/* Buttons */
.btn-primary { background: linear-gradient(180deg, #2384cd 0%, var(--crm-blue) 100%); border-color: var(--crm-blue-dark); box-shadow: 0 1px 2px rgba(22, 95, 153, .35); }
.btn-primary:hover, .btn-primary:focus-visible { background: linear-gradient(180deg, var(--crm-blue) 0%, var(--crm-blue-dark) 100%); border-color: var(--crm-blue-dark); }
.btn-outline-primary { color: var(--crm-blue-dark); border-color: #9ec4e6; background: #f5f9fd; }
.btn-outline-primary:hover { background: var(--crm-blue); border-color: var(--crm-blue); color: #fff; }
.btn-outline-secondary { color: var(--crm-navy-3); border-color: #c9d6e6; background: #fff; }
.btn-outline-secondary:hover { background: var(--crm-tint); border-color: #9ec4e6; color: var(--crm-blue-dark); }
.btn-outline-danger { background: #fff8f9; }
.btn-outline-danger:hover { background: var(--crm-red); border-color: var(--crm-red); color: #fff; }
.btn-outline-success { color: var(--crm-green); border-color: #9fd6b9; background: #f4fbf7; }
.btn-outline-success:hover { background: var(--crm-green); border-color: var(--crm-green); color: #fff; }
.btn-secondary { background: var(--crm-navy-3); border-color: var(--crm-navy-3); }

/* Badges, tags and chips */
.badge.text-bg-light { background: var(--crm-tint) !important; color: var(--crm-blue-dark) !important; }
.badge.text-bg-secondary { background: #6c7a91 !important; }
.badge.text-bg-info { background: var(--crm-teal) !important; color: #fff !important; }
.badge.text-bg-success { background: var(--crm-green) !important; }
.badge.text-bg-warning { background: #f0b429 !important; color: #3d2d00 !important; }
.tag-pill { background: var(--crm-purple-soft); color: var(--crm-purple); border: 1px solid #ddd0f3; }
.fv-chip { background: var(--crm-blue-soft); color: var(--crm-blue-dark); border: 1px solid #cfe0f1; }

/* Forms */
.form-control:focus, .form-select:focus { border-color: var(--crm-blue); box-shadow: 0 0 0 .2rem rgba(27, 116, 186, .18); }
.form-check-input:checked { background-color: var(--crm-blue); border-color: var(--crm-blue); }
.form-label { color: var(--crm-navy-3); }
.filter-bar { background: linear-gradient(180deg, #ffffff, #f3f8fd); border-color: #d9e4f0; }

/* Alerts */
.alert-success { background: var(--crm-green-soft); border-color: #bfe5d0; color: #0f5c37; }
.alert-danger { background: var(--crm-red-soft); border-color: #f3c0c9; color: #8a1226; }

/* Empty states and hints get a little warmth */
.empty { background: radial-gradient(circle at 50% 0, var(--crm-blue-soft), transparent 70%); }
.form-text, .small.text-muted { color: #61728c !important; }

/* Headings inside pages: a short brand underline */
h2.h5, .app-content h2.h5 { display: inline-block; padding-bottom: .25rem; border-bottom: 3px solid var(--crm-blue); margin-bottom: .75rem !important; }

/* Left menu: each section has its own colour (the bar, caret, header and icons) */
.app-sidebar .nav-group[data-nav-group="services"] { --grp: #5eb0ee; }
.app-sidebar .nav-group[data-nav-group="messages"] { --grp: #3fd18f; }
.app-sidebar .nav-group[data-nav-group="manage"] { --grp: #f2c14e; }
.app-sidebar .nav-group[data-nav-group="admin"] { --grp: #ff7a90; }
.app-sidebar .nav-group .nav-section { color: var(--grp); opacity: .9; }
.app-sidebar .nav-group .nav-toggle:hover { color: #fff; }
.app-sidebar .nav-group .nav-link svg { color: var(--grp); opacity: .9; }
.app-sidebar .nav-group .nav-link.active { background: color-mix(in srgb, var(--grp) 22%, transparent); }
.app-sidebar .nav-group .nav-link.active::before { background: var(--grp); }
.app-sidebar .nav-group[data-nav-group="services"] .nav-link:nth-child(6n+2) svg { color: #ff7a90; }
.app-sidebar .nav-group[data-nav-group="services"] .nav-link:nth-child(6n+3) svg { color: #f2c14e; }
.app-sidebar .nav-group[data-nav-group="services"] .nav-link:nth-child(6n+4) svg { color: #3fd18f; }
.app-sidebar .nav-group[data-nav-group="services"] .nav-link:nth-child(6n+5) svg { color: #b79cf2; }
.app-sidebar .nav-group[data-nav-group="services"] .nav-link:nth-child(6n+6) svg { color: #4fd1de; }
.app-sidebar > .nav-scroll > .nav-link:nth-of-type(1) svg { color: #5eb0ee; }
.app-sidebar > .nav-scroll > .nav-link:nth-of-type(2) svg { color: #ff7a90; }
.app-sidebar > .nav-scroll > .nav-link:nth-of-type(3) svg { color: #f2c14e; }

/* Top bar and records list */
.app-topbar { border-bottom: 2px solid #d5e3f2; background: rgba(255, 255, 255, .9); }
.module-card:hover { border-color: #9ec4e6; box-shadow: 0 6px 18px rgba(27, 116, 186, .14); }
.rec-row:hover { background: #f0f6fd; }
.stage-tab.active { background: var(--crm-blue); border-color: var(--crm-blue); }
.pagination .page-link { color: var(--crm-blue-dark); }
.pagination .page-item:not(.disabled) .page-link:hover { background: var(--crm-tint); }

/* The menu's own collapse button: a round tab on the menu's edge, always in view */
.sidebar-edge { display: none; }
@media (min-width: 992px) {
    .sidebar-edge {
        display: grid; place-items: center; position: fixed; z-index: 1041; top: 76px; left: calc(var(--crm-sidebar-w) - 14px); width: 28px; height: 28px; border-radius: 50%;
        border: 2px solid #fff; background: var(--crm-blue); color: #fff; box-shadow: 0 2px 8px rgba(10, 22, 40, .3); cursor: pointer; padding: 0; transition: left .2s ease, background .15s;
    }
    .sidebar-edge:hover { background: var(--crm-red); }
    .sidebar-edge::before { content: ""; width: 7px; height: 7px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-left: 3px; }
    html.sidebar-collapsed .sidebar-edge::before { transform: rotate(-135deg); margin-left: -3px; }
}

/* Scrollbars are hidden until the person scrolls (scrollbars.js adds .is-scrolling to the element being scrolled). */
* { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.is-scrolling { scrollbar-color: rgba(120, 130, 150, .55) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; background: transparent; }
*::-webkit-scrollbar-thumb { background: transparent; border-radius: 8px; }
.is-scrolling::-webkit-scrollbar-thumb { background: rgba(120, 130, 150, .55); }
.app-sidebar { overscroll-behavior: contain; }
.word-preview { background: #e9edf2; border-radius: .5rem; padding: 1rem 0; overflow-x: auto; }

/* ---------- Small screens: room under the content for the floating chat button; roomier tap targets ---------- */
@media (max-width: 991.98px) {
    .app-content { padding-bottom: 5.5rem; }
    .page-header { margin-bottom: 1rem; }
    .page-header h1 { font-size: 1.35rem; }
    .btn, .form-select, .form-control { min-height: 40px; }
    .btn-sm, .form-select-sm, .form-control-sm { min-height: 34px; }
    .dropdown-menu { max-width: calc(100vw - 1.5rem); }
    .modal-dialog { margin: .5rem; }
}
@media (max-width: 575.98px) {
    .topbar-search input::placeholder { color: transparent; }
    .bulk-bar-main, .bulk-actions { flex-wrap: wrap; }
    .bulk-panel .form-select { max-width: 100%; }
    .card-body { padding: 1rem; }
    .table > :not(caption) > * > * { padding: .5rem .55rem; }
}
/* Very wide screens: keep the page centred rather than hugging the left */
@media (min-width: 1700px) { .app-content { margin-inline: auto; } }
@media (max-width: 575.98px) {
    .page-header > *, .hero > * { min-width: 0; max-width: 100%; }
    .page-header .d-flex, .hero .d-flex { flex-wrap: wrap; }
    .form-check-label { white-space: normal; }
    .btn { white-space: normal; }
    .an-newdash { flex: 1 1 100%; flex-wrap: wrap; }
    .an-newdash input { min-width: 140px; }
}

/* ---------- Report export dialog ---------- */
.an-modal { position: fixed; inset: 0; z-index: 2000; background: rgba(10, 22, 40, .5); display: grid; place-items: center; padding: 1rem; }
.an-modal-box { background: var(--crm-surface, #fff); border-radius: var(--crm-radius, .75rem); box-shadow: var(--crm-shadow-lg); width: 100%; max-width: 520px; max-height: calc(100vh - 2rem); overflow-y: auto; padding: 1.25rem; }
.an-ex-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .15rem .75rem; max-height: 220px; overflow-y: auto; border: 1px solid var(--crm-border); border-radius: .5rem; padding: .5rem .75rem; }
.an-ex-cols .form-check { margin: 0; overflow-wrap: anywhere; }

/* ---------- Collapsible sections on a record's page ---------- */
.sec-toggle { cursor: pointer; user-select: none; display: flex; align-items: center; gap: .5rem; }
.sec-toggle:focus-visible { outline: 2px solid var(--crm-blue); outline-offset: -2px; }
.sec-caret { width: 8px; height: 8px; flex: none; border-right: 2px solid var(--crm-muted); border-bottom: 2px solid var(--crm-muted); transform: rotate(45deg); transition: transform .15s; margin-right: .25rem; }
.card.is-collapsed > .sec-toggle .sec-caret { transform: rotate(-45deg); }
.card.is-collapsed > :not(.card-header) { display: none !important; }
.card.is-collapsed > .card-header { border-bottom: 0; }

/* ---------- Correspondence ---------- */
.corr-item { border-bottom: 1px solid var(--crm-border); }
.corr-item:last-child { border-bottom: 0; }
.corr-item > summary { display: flex; align-items: center; gap: .75rem; padding: .65rem 1rem; cursor: pointer; list-style: none; }
.corr-item > summary::-webkit-details-marker { display: none; }
.corr-item > summary:hover { background: var(--crm-bg); }
.corr-dir { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; background: var(--crm-blue-soft); color: var(--crm-blue-dark); }
.corr-out .corr-dir { background: #e8f6ee; color: #1b7a4b; }
.corr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.corr-subject { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.corr-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.corr-body { margin: 0; padding: .25rem 1rem 1rem 3.35rem; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: .9rem; max-height: 420px; overflow-y: auto; }
@media (max-width: 575.98px) { .corr-item > summary { flex-wrap: wrap; } .corr-date { width: 100%; padding-left: 2.35rem; } .corr-body { padding-left: 1rem; } }

/* ---------- Tags on the records list and board ---------- */
.rec-tags { display: flex; flex-wrap: wrap; gap: .2rem; margin-top: .3rem; }
.rec-tags .tag-pill { margin: 0; white-space: nowrap; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; }
.tag-more { background: #eef2f7 !important; color: var(--crm-muted) !important; border-color: var(--crm-border) !important; }

/* ---------- Dashboard tiles: the same colours as the rest of the app (blue, red, gold, green, purple, teal) ---------- */
.an-grid > .an-tile { --tc: var(--crm-blue); --tc-soft: var(--crm-blue-soft); --tc-dark: var(--crm-blue-dark); }
.an-grid > .an-tile:nth-child(6n+2) { --tc: var(--crm-red); --tc-soft: var(--crm-red-soft); --tc-dark: var(--crm-red-dark, #a50d28); }
.an-grid > .an-tile:nth-child(6n+3) { --tc: var(--crm-gold); --tc-soft: var(--crm-gold-soft); --tc-dark: #8a6d0b; }
.an-grid > .an-tile:nth-child(6n+4) { --tc: var(--crm-green); --tc-soft: var(--crm-green-soft); --tc-dark: #0f5c37; }
.an-grid > .an-tile:nth-child(6n+5) { --tc: var(--crm-purple); --tc-soft: var(--crm-purple-soft); --tc-dark: #4f2d8f; }
.an-grid > .an-tile:nth-child(6n+6) { --tc: var(--crm-teal); --tc-soft: var(--crm-teal-soft); --tc-dark: #0a6f7a; }
.an-grid > .an-tile {
    border-color: #d9e4f0; border-top: 3px solid var(--tc);
    background: linear-gradient(180deg, var(--tc-soft) 0, var(--crm-surface, #fff) 70%);
}
.an-grid > .an-tile .an-tile-head { background: transparent; border-bottom: 1px solid color-mix(in srgb, var(--tc) 20%, #d9e4f0); }
.an-grid > .an-tile .an-tile-head > a, .an-grid > .an-tile .an-tile-head > span.fw-semibold { color: var(--tc-dark); }
.an-grid > .an-tile .an-kpi-value { color: var(--tc-dark); }
.an-grid > .an-tile .an-kpi-label { color: color-mix(in srgb, var(--tc-dark) 80%, #404040); }
.an-grid > .an-tile.an-tile-bare { box-shadow: 0 1px 2px rgba(10, 22, 40, .06), 0 4px 14px color-mix(in srgb, var(--tc) 10%, transparent); }
.an-grid > .an-tile:hover { box-shadow: 0 2px 6px rgba(10, 22, 40, .08), 0 8px 22px color-mix(in srgb, var(--tc) 18%, transparent); }
.an-grid > .an-tile .an-kpi-label { white-space: normal; overflow-wrap: anywhere; line-height: 1.15; }

/* ---------- AI assistant in the chat bubble ---------- */
.cw-tabs { display: flex; border-bottom: 1px solid var(--crm-border); background: #f3f8fd; }
.cw-tab { flex: 1; border: 0; background: transparent; padding: .5rem .25rem; font-size: .82rem; font-weight: 600; color: var(--crm-muted); border-bottom: 2px solid transparent; }
.cw-tab.active { color: var(--crm-blue-dark); border-bottom-color: var(--crm-blue); background: #fff; }
.cw-ai { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.cw-ai[hidden] { display: none; }
.cw-ai-err .cw-text { background: var(--crm-red-soft); color: #8a1226; }
.cw-ai-extra { margin-top: .35rem; font-size: .78rem; max-width: 100%; }
.cw-ai-extra summary { cursor: pointer; color: var(--crm-blue-dark); }
.cw-ai-tablewrap { overflow: auto; max-height: 180px; margin-top: .3rem; border: 1px solid var(--crm-border); border-radius: .4rem; background: #fff; }
.cw-ai-table { border-collapse: collapse; font-size: .72rem; width: max-content; min-width: 100%; }
.cw-ai-table th, .cw-ai-table td { padding: .2rem .45rem; border-bottom: 1px solid var(--crm-border); white-space: nowrap; text-align: left; }
.cw-ai-table th { position: sticky; top: 0; background: #eef4fa; }
.cw-ai-sql { white-space: pre-wrap; overflow-wrap: anywhere; background: #0a1628; color: #cfe3f7; padding: .5rem; border-radius: .4rem; margin: .3rem 0 0; font-size: .72rem; }

/* ---------- Public application status page ---------- */
.status-now .badge { padding: .55rem .9rem; }
.status-steps { list-style: none; padding: 0; margin: 1.25rem 0 0; display: flex; gap: .5rem; }
.status-steps li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center; font-size: .8rem; color: var(--crm-muted); position: relative; }
.status-steps li + li::before { content: ""; position: absolute; top: 14px; right: 50%; width: 100%; height: 3px; background: #dbe6f2; z-index: 0; }
.status-steps .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #fff; border: 2px solid #c9d6e6; position: relative; z-index: 1; }
.status-steps .done .dot { background: var(--crm-green); border-color: var(--crm-green); color: #fff; }
.status-steps .done, .status-steps .current { color: var(--crm-navy); font-weight: 600; }
.status-steps .done + li::before, .status-steps li.done::before { background: var(--crm-green); }
.status-steps .current .dot { border-color: var(--crm-blue); color: var(--crm-blue); box-shadow: 0 0 0 4px rgba(27, 116, 186, .15); }
.status-now .badge.text-bg-success, .status-now .badge.text-bg-secondary, .status-now .badge.text-bg-danger { color: #fff !important; }
.status-now .badge.text-bg-warning { color: #3d2d00 !important; }

/* ---------- Site-wide copyright footer ---------- */
.site-footer { padding: 1.25rem 1rem 1.5rem; text-align: center; font-size: .78rem; color: var(--crm-muted); }
.site-footer a { color: var(--crm-blue-dark); font-weight: 600; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
@media print { .site-footer { display: none; } }
/* On the sign-in page the two-column screen fills the window: leave room under it so the footer is visible without scrolling */
body:has(.auth-shell) .auth-shell { min-height: calc(100vh - 3.2rem); }
body:has(.auth-shell) .site-footer { background: #fff; padding: .9rem 1rem; border-top: 1px solid var(--crm-border); }
