/* ==========================================================================
   Sales CRM – calm, professional design system on top of Bootstrap 5.3
   Principles: regular-weight text, soft colours, few borders, lots of air.
   Colour is used only to signal something (a dot, a small tint), never as a big block.
   - Light + dark themes (html[data-bs-theme])
   - Three text sizes (html[data-text="md|lg|xl"]); everything is sized in rem
   - Desktop: side menu (can shrink to icons). Phone: bottom tab bar + sheets
   ========================================================================== */

:root {
    --font-sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Noto Sans", "Helvetica Neue", Arial, "Noto Sans Arabic", Tahoma, sans-serif;
    --font-display: var(--font-sans);
    --app-radius: 12px;
    --app-radius-sm: 8px;
    --nav-w: 248px;
    --nav-w-mini: 72px;
    --bottom-h: 60px;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-l: env(safe-area-inset-left, 0px);
    --safe-r: env(safe-area-inset-right, 0px);

    /* Signal colours: used for small dots and thin bars only */
    --c-red: #c8372f;
    --c-green: #1d7a3e;
    --c-blue: #1f57a3;
    --c-indigo: #2a63b0;
    --c-teal: #0b7f86;
    --c-amber: #c98a12;
    --c-gray: #a0a7b4;
    --c-purple: #8e5cd9;
}

:root, [data-bs-theme="light"] {
    --app-bg: #eef2f7;
    --app-surface: #ffffff;
    --app-surface-2: #f4f7fb;
    --app-head: #e4ecf8;
    --app-field: #ffffff;
    --app-border: #dbe3ee;
    --app-border-strong: #c3cfdf;
    --app-text: #14304f;
    --app-text-2: #2f4a6b;
    --app-muted: #5f7089;
    --app-subtle: #8192aa;
    --app-primary: #1d4f91;
    --app-primary-600: #173f78;
    --app-primary-50: #e7eefa;
    --app-primary-ring: rgba(29, 79, 145, .2);
    --app-value: #2a63b0;
    --app-hover: #f1f5fb;
    --app-shadow: 0 1px 3px rgba(16, 40, 80, .07);
    --app-shadow-lg: 0 10px 28px rgba(16, 40, 80, .16);
    --app-danger: #b42d27;
    --nav-bg: radial-gradient(120% 60% at 0% 0%, rgba(74, 134, 214, .35) 0%, transparent 60%), linear-gradient(180deg, #0f2d5c 0%, #123669 45%, #0d2850 100%);

    --t-indigo-bg: #e7eefa; --t-indigo-fg: #1d4f91;
    --t-blue-bg: #e9f1fc;   --t-blue-fg: #1f57a3;
    --t-amber-bg: #fff5db;  --t-amber-fg: #8a6312;
    --t-green-bg: #e8f6ed;  --t-green-fg: #1d7a3e;
    --t-gray-bg: #eef1f4;   --t-gray-fg: #56616d;
    --t-teal-bg: #e2f4f4;   --t-teal-fg: #0b7178;
    --t-rose-bg: #fdecea;   --t-rose-fg: #b42d27;
    --t-purple-bg: #f1ebfb; --t-purple-fg: #6a3fb0;

    --bs-primary: var(--app-primary);
    --bs-primary-rgb: 29, 79, 145;
    --bs-link-color: var(--app-value);
    --bs-link-color-rgb: 42, 99, 176;
    --bs-link-hover-color: var(--app-primary-600);
    --bs-link-hover-color-rgb: 23, 63, 120;
    --bs-body-color: var(--app-text);
    --bs-body-bg: var(--app-bg);
    --bs-border-color: var(--app-border);
    --bs-secondary-color: var(--app-muted);
    --bs-font-sans-serif: var(--font-sans);
}

[data-bs-theme="dark"] {
    --app-bg: #0f1723;
    --app-surface: #16202f;
    --app-surface-2: #1a2637;
    --app-head: #1e2c40;
    --app-field: #111a27;
    --app-border: #26344a;
    --app-border-strong: #384b64;
    --app-text: #e4ebf5;
    --app-text-2: #c8d3e3;
    --app-muted: #94a4ba;
    --app-subtle: #6f8098;
    --app-primary: #7fb0f5;
    --app-primary-600: #a4c8fa;
    --app-primary-50: rgba(127, 176, 245, .14);
    --app-primary-ring: rgba(127, 176, 245, .3);
    --app-value: #9cc3f8;
    --app-hover: #1c2a3d;
    --app-shadow: none;
    --app-shadow-lg: 0 14px 36px rgba(0, 0, 0, .5);
    --app-danger: #f58079;
    --nav-bg: linear-gradient(180deg, #101d30, #14253c);

    --t-indigo-bg: rgba(127, 176, 245, .15); --t-indigo-fg: #a9cbfa;
    --t-blue-bg: rgba(96, 165, 250, .14);    --t-blue-fg: #a9cbfb;
    --t-amber-bg: rgba(245, 180, 40, .14);   --t-amber-fg: #f0cb7c;
    --t-green-bg: rgba(52, 199, 120, .14);   --t-green-fg: #8fdcb2;
    --t-gray-bg: rgba(148, 163, 184, .14);   --t-gray-fg: #c3cad6;
    --t-teal-bg: rgba(45, 212, 191, .14);    --t-teal-fg: #8ddfd2;
    --t-rose-bg: rgba(244, 90, 80, .16);     --t-rose-fg: #f8aaa4;
    --t-purple-bg: rgba(167, 139, 250, .15); --t-purple-fg: #cdb9f7;

    --bs-primary: var(--app-primary);
    --bs-primary-rgb: 127, 176, 245;
    --bs-link-color: var(--app-value);
    --bs-link-color-rgb: 156, 195, 248;
    --bs-link-hover-color: var(--app-primary-600);
    --bs-link-hover-color-rgb: 164, 200, 250;
    --bs-body-color: var(--app-text);
    --bs-body-bg: var(--app-bg);
    --bs-border-color: var(--app-border);
    --bs-secondary-color: var(--app-muted);
    --bs-font-sans-serif: var(--font-sans);
}

/* ---------- Base & readable type ---------- */
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
html[data-text="lg"] { font-size: 16.5px; }
html[data-text="xl"] { font-size: 18px; }

body {
    background: var(--app-bg); color: var(--app-text); font-family: var(--font-sans); font-weight: 400;
    line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
    -webkit-tap-highlight-color: transparent; overflow-wrap: break-word;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.005em; color: var(--app-text); }
a { text-decoration: none; }
.text-muted { color: var(--app-muted) !important; }
.text-body { color: var(--app-text) !important; }
.small, small { font-size: .875rem; }
.min-w-0 { min-width: 0; }
::selection { background: var(--app-primary-ring); }
:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* Keep emphasis gentle everywhere, including older pages */
strong, b { font-weight: 600; }
.fw-bold { font-weight: 600 !important; }
.fw-semibold { font-weight: 500 !important; }
.text-primary { color: var(--app-primary) !important; }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--app-radius-sm); font-weight: 500; padding: .5rem .95rem; }
.btn-sm { padding: .32rem .7rem; font-size: .875rem; border-radius: 7px; }
.btn-lg { padding: .72rem 1.2rem; border-radius: 10px; }
.btn-primary {
    --bs-btn-color: #fff; --bs-btn-bg: #1d4f91; --bs-btn-border-color: #1d4f91;
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #173f78; --bs-btn-hover-border-color: #173f78;
    --bs-btn-active-color: #fff; --bs-btn-active-bg: #12335f; --bs-btn-active-border-color: #12335f;
    --bs-btn-disabled-bg: #1d4f91; --bs-btn-disabled-border-color: #1d4f91;
}
.btn-outline-primary {
    --bs-btn-color: var(--app-primary); --bs-btn-border-color: var(--app-border-strong);
    --bs-btn-hover-bg: var(--app-primary-50); --bs-btn-hover-color: var(--app-primary); --bs-btn-hover-border-color: var(--app-primary);
    --bs-btn-active-bg: var(--app-primary-50); --bs-btn-active-color: var(--app-primary); --bs-btn-active-border-color: var(--app-primary);
}
.btn-light {
    --bs-btn-color: var(--app-text-2); --bs-btn-bg: var(--app-surface); --bs-btn-border-color: var(--app-border-strong);
    --bs-btn-hover-color: var(--app-text); --bs-btn-hover-bg: var(--app-hover); --bs-btn-hover-border-color: var(--app-border-strong);
    --bs-btn-active-color: var(--app-text); --bs-btn-active-bg: var(--app-hover); --bs-btn-active-border-color: var(--app-border-strong);
}
.btn-link { font-weight: 500; }
.btn-icon { width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 1.1rem; flex-shrink: 0; }
.btn-soft-success { background: var(--t-green-bg); color: var(--t-green-fg); border: 1px solid transparent; }
.btn-soft-success:hover, .btn-soft-success:focus-visible { background: var(--c-green); color: #fff; }
.btn-soft-primary { background: var(--app-primary-50); color: var(--app-primary); border: 1px solid transparent; }
.btn-soft-primary:hover { background: #1d4f91; color: #fff; }
.btn-wa { background: var(--t-green-bg); color: var(--t-green-fg); border: 1px solid transparent; }
.btn-wa:hover { background: #25d366; color: #fff; }

/* Quiet icon button (call, WhatsApp, reschedule) */
.btn-ghost {
    width: 36px; height: 36px; border-radius: 9px; border: 0; background: transparent; color: var(--app-muted);
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; flex-shrink: 0; padding: 0;
}
.btn-ghost:hover { background: var(--app-hover); color: var(--app-text); }
.witem:hover .btn-ghost:hover { background: var(--app-surface); }
.btn-ghost.wa:hover { background: var(--t-green-bg) !important; color: var(--t-green-fg); }
/* The one main action of a row (Done, Paid, Renew…) */
.btn-act {
    --bs-btn-color: var(--app-text-2); --bs-btn-bg: var(--app-surface); --bs-btn-border-color: var(--app-border-strong);
    --bs-btn-hover-color: var(--t-green-fg); --bs-btn-hover-bg: var(--t-green-bg); --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--t-green-fg); --bs-btn-active-bg: var(--t-green-bg); --bs-btn-active-border-color: transparent;
    white-space: nowrap; min-width: 5.5rem;
}
.btn-act.primary { --bs-btn-hover-color: var(--app-primary); --bs-btn-hover-bg: var(--app-primary-50); --bs-btn-active-color: var(--app-primary); --bs-btn-active-bg: var(--app-primary-50); }

/* ---------- Forms ---------- */
.form-control, .form-select {
    border-radius: var(--app-radius-sm); border-color: var(--app-border-strong); padding: .58rem .85rem; font-size: 1rem;
    background-color: var(--app-field); color: var(--app-text); min-height: 2.7rem;
}
.form-control::placeholder { color: var(--app-subtle); opacity: 1; }
.form-control:focus, .form-select:focus { border-color: var(--app-primary); box-shadow: 0 0 0 .2rem var(--app-primary-ring); background-color: var(--app-field); color: var(--app-text); }
textarea.form-control { min-height: 5rem; }
.form-label { font-weight: 500; font-size: .9rem; margin-bottom: .35rem; color: var(--app-text-2); }
.form-text { font-size: .84rem; color: var(--app-muted); }
.form-check-input { width: 1.15em; height: 1.15em; border-color: var(--app-border-strong); }
.form-check-input:checked { background-color: #1d4f91; border-color: #1d4f91; }
.input-group-text { background: var(--app-surface-2); border-color: var(--app-border-strong); color: var(--app-muted); border-radius: var(--app-radius-sm); }
.field-validation-error, .text-danger { font-size: .86rem; }
.text-danger { color: var(--app-danger) !important; }
.input-validation-error { border-color: var(--c-red) !important; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.validation-summary-valid { display: none; }
.alert { border-radius: var(--app-radius); border-width: 1px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
    width: var(--nav-w); flex-shrink: 0; background: var(--app-surface); color: var(--app-text);
    border-right: 1px solid var(--app-border); display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: 1045; padding: 1rem .75rem;
    transition: width .18s ease;
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--app-text); font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; padding: .2rem .5rem 1rem; white-space: nowrap; }
.brand:hover { color: var(--app-text); }
.brand-logo {
    width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    background: #ffffff; color: #fff; font-size: 1.05rem;
}
.side-nav { flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; margin: 0 -.25rem; padding: 0 .25rem; }
.nav-label { font-size: .78rem; color: var(--app-subtle); font-weight: 500; padding: 1.1rem .75rem .35rem; white-space: nowrap; }
.nav-link-item {
    display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem; border-radius: 9px; position: relative;
    color: var(--app-text-2); font-weight: 400; font-size: .95rem; margin-bottom: 1px; transition: background .12s, color .12s; white-space: nowrap; min-height: 2.5rem;
}
.nav-link-item i { font-size: 1.1rem; width: 20px; text-align: center; color: var(--app-subtle); flex-shrink: 0; }
.nav-link-item:hover { background: var(--app-hover); color: var(--app-text); }
.nav-link-item.active { background: var(--app-primary-50); color: var(--app-primary); font-weight: 500; }
.nav-link-item.active i { color: var(--app-primary); }
.nav-link-item .nav-text { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-count {
    min-width: 22px; height: 20px; padding: 0 7px; border-radius: 99px; background: var(--t-gray-bg); color: var(--t-gray-fg);
    font-size: .74rem; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.nav-count.hot { background: var(--t-rose-bg); color: var(--t-rose-fg); }

.sidebar-foot { border-top: 1px solid var(--app-border); margin-top: .5rem; padding-top: .6rem; }
.sidebar-user { display: flex; align-items: center; gap: .65rem; padding: .45rem; }
.sidebar-user .name { font-weight: 500; font-size: .9rem; }
.sidebar-user .role { font-size: .8rem; color: var(--app-muted); }
.nav-collapse-btn { margin-left: auto; color: var(--app-subtle); border: 0; background: none; width: 32px; height: 32px; border-radius: 8px; }
.nav-collapse-btn:hover { background: var(--app-hover); color: var(--app-text); }

@media (min-width: 992px) {
    html[data-nav="mini"] .sidebar { width: var(--nav-w-mini); }
    html[data-nav="mini"] .nav-text, html[data-nav="mini"] .nav-label, html[data-nav="mini"] .brand-name,
    html[data-nav="mini"] .sidebar-user .min-w-0, html[data-nav="mini"] .sidebar-user .avatar { display: none; }
    html[data-nav="mini"] .nav-link-item { justify-content: center; padding: .55rem; }
    html[data-nav="mini"] .nav-count { position: absolute; top: 1px; right: 3px; min-width: 17px; height: 17px; font-size: .66rem; padding: 0 5px; }
    html[data-nav="mini"] .brand { justify-content: center; padding-left: 0; padding-right: 0; }
    html[data-nav="mini"] .nav-collapse-btn { margin: 0 auto; }
    html[data-nav="mini"] .nav-collapse-btn i { transform: rotate(180deg); }
    html[data-nav="mini"] .side-nav { margin-top: .5rem; }
}

.avatar {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    background: var(--t-indigo-bg); color: var(--t-indigo-fg); font-weight: 500; font-size: .84rem; letter-spacing: .02em;
}
.avatar-xs { width: 24px; height: 24px; font-size: .64rem; }
.avatar-sm { width: 32px; height: 32px; font-size: .76rem; }
.avatar-lg { width: 60px; height: 60px; font-size: 1.3rem; }
.avatar-btn { width: auto; height: auto; border: 0; padding: 2px; border-radius: 50%; }
.avatar.a1 { background: var(--t-rose-bg); color: var(--t-rose-fg); }
.avatar.a2 { background: var(--t-amber-bg); color: var(--t-amber-fg); }
.avatar.a3 { background: var(--t-green-bg); color: var(--t-green-fg); }
.avatar.a4 { background: var(--t-blue-bg); color: var(--t-blue-fg); }
.avatar.a5 { background: var(--t-purple-bg); color: var(--t-purple-fg); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cur { font-size: .55em; font-weight: 500; color: var(--app-subtle); margin-right: .3em; letter-spacing: .03em; vertical-align: .3em; }
.topbar {
    position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: .75rem;
    background: color-mix(in srgb, var(--app-bg) 88%, transparent); backdrop-filter: saturate(1.3) blur(10px); -webkit-backdrop-filter: saturate(1.3) blur(10px);
    padding: .65rem 2rem; border-bottom: 1px solid var(--app-border);
    padding-top: calc(.65rem + var(--safe-t));
}
.topbar-title { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.topbar-search { position: relative; flex: 1; max-width: 480px; }
.topbar-search > i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--app-subtle); pointer-events: none; }
.topbar-search input {
    width: 100%; border: 1px solid var(--app-border); background: var(--app-surface); color: var(--app-text); border-radius: 10px;
    padding: .52rem 3rem .52rem 2.45rem; outline: none; font-size: .95rem; min-height: 2.5rem;
}
.topbar-search input::placeholder { color: var(--app-subtle); }
.topbar-search input:focus { border-color: var(--app-primary); box-shadow: 0 0 0 .2rem var(--app-primary-ring); }
.topbar-search kbd { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); background: var(--app-surface-2); color: var(--app-subtle); border: 1px solid var(--app-border); border-radius: 6px; font-size: .72rem; padding: .05rem .4rem; font-family: var(--font-sans); box-shadow: none; }
.search-results {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--app-surface); border: 1px solid var(--app-border);
    border-radius: 12px; box-shadow: var(--app-shadow-lg); max-height: min(70vh, 520px); overflow-y: auto; z-index: 1050; padding: .35rem;
}
.search-group { font-size: .78rem; font-weight: 500; color: var(--app-subtle); padding: .6rem .75rem .25rem; }
.search-item { display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem; border-radius: 8px; color: var(--app-text); }
.search-item:hover, .search-item.active { background: var(--app-hover); color: var(--app-text); }
.search-item .s-title { font-weight: 500; }
.search-item .s-sub { font-size: .84rem; color: var(--app-muted); }
.search-empty { padding: 1rem; text-align: center; color: var(--app-muted); font-size: .92rem; }

.content { padding: 1.75rem 2rem 2.5rem; max-width: 1440px; width: 100%; margin: 0 auto; flex: 1; }
.sidebar-backdrop { display: none; }
@media (max-width: 1399.98px) { .content { padding: 1.5rem 1.5rem 2rem; } .topbar { padding-left: 1.5rem; padding-right: 1.5rem; } }

/* ---------- Phone & tablet shell ---------- */
.bottom-nav { display: none; }
.mobile-only { display: none !important; }

@media (max-width: 991.98px) {
    .mobile-only { display: inline-flex !important; }
    .desktop-only { display: none !important; }
    .sidebar {
        position: fixed; left: 0; top: 0; transform: translateX(-105%); transition: transform .22s ease; width: min(86vw, 300px);
        padding-top: calc(1rem + var(--safe-t)); padding-bottom: calc(1rem + var(--safe-b)); padding-left: calc(.75rem + var(--safe-l));
    }
    .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0, 0, 0, .3); }
    .sidebar-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(15, 18, 30, .45); z-index: 1040; }
    .nav-collapse-btn { display: none; }
    .content { padding: 1rem; padding-bottom: calc(var(--bottom-h) + var(--safe-b) + 1.5rem); }
    .topbar { padding: .5rem .9rem; padding-top: calc(.5rem + var(--safe-t)); gap: .5rem; }
    .topbar-search { display: none; position: absolute; left: 0; right: 0; top: 100%; max-width: none; padding: .6rem .9rem; background: var(--app-bg); border-bottom: 1px solid var(--app-border); }
    .topbar-search > i { left: 1.75rem; }
    .topbar-search kbd { display: none; }
    .topbar-search .search-results { left: .9rem; right: .9rem; top: calc(100% - 2px); }
    body.search-open .topbar-search { display: block; }

    .bottom-nav {
        display: grid; grid-template-columns: repeat(5, 1fr); align-items: stretch; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
        background: color-mix(in srgb, var(--app-surface) 95%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
        border-top: 1px solid var(--app-border); padding: 0 calc(.25rem + var(--safe-r)) var(--safe-b) calc(.25rem + var(--safe-l));
        height: calc(var(--bottom-h) + var(--safe-b));
    }
    .bottom-nav a, .bottom-nav button {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--app-subtle);
        font-size: .7rem; font-weight: 500; background: none; border: 0; position: relative; padding: 0; min-width: 0;
    }
    .bottom-nav i { font-size: 1.3rem; line-height: 1.1; }
    .bottom-nav .active { color: var(--app-primary); }
    .bottom-nav .dot { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 17px; width: auto; height: 17px; padding: 0 5px; border-radius: 99px; background: var(--c-red); color: #fff; font-size: .64rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--app-surface); }
    .bottom-nav .fab {
        width: 48px; height: 48px; border-radius: 16px; margin: -10px auto 0; color: #fff; align-self: start;
        background: #1d4f91; box-shadow: 0 6px 16px rgba(29, 79, 145, .4);
    }
    .bottom-nav .fab i { font-size: 1.45rem; }
    .toast-container { top: calc(var(--safe-t) + 3.5rem) !important; left: 0; right: 0; padding: .5rem .75rem !important; }
    .app-toast { min-width: 0 !important; width: 100%; }
}
@media (max-width: 359.98px) {
    .content { padding-left: .7rem; padding-right: .7rem; }
    .topbar .brand-logo { display: none !important; }
    .sheet-grid { grid-template-columns: repeat(2, 1fr); }
    .bottom-nav a span, .bottom-nav button span { font-size: .64rem; }
}

/* Quick-add sheet (phone) */
.sheet { border-radius: 20px 20px 0 0; height: auto !important; max-height: 88vh; background: var(--app-surface); color: var(--app-text); padding-bottom: var(--safe-b); border: 0 !important; }
.sheet .offcanvas-header { padding-bottom: .25rem; }
.sheet .offcanvas-title { font-weight: 600 !important; font-size: 1.05rem; }
.sheet-grip { width: 40px; height: 4px; border-radius: 99px; background: var(--app-border-strong); margin: .6rem auto 0; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.sheet-tile { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: .9rem .4rem; border-radius: 14px; background: var(--app-surface-2); color: var(--app-text-2); font-weight: 500; font-size: .85rem; text-align: center; border: 1px solid var(--app-border); }
.sheet-tile:hover { color: var(--app-text); border-color: var(--app-primary); }
.sheet-tile .stat-icon { width: 42px; height: 42px; }

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 600; margin: 0; }
.page-header p { margin: .25rem 0 0; color: var(--app-muted); }
.breadcrumb-link { font-size: .9rem; color: var(--app-muted); display: inline-flex; align-items: center; gap: .3rem; margin-bottom: .5rem; }
.breadcrumb-link:hover { color: var(--app-primary); }
.greeting { font-size: 1.55rem; font-weight: 600; margin: 0; }
@media (max-width: 575.98px) {
    .page-header { align-items: stretch; flex-direction: column; gap: .75rem; margin-bottom: 1.1rem; }
    .page-header h1, .greeting { font-size: 1.3rem; }
    .page-header > .d-flex, .page-header > form, .page-header > .btn { width: 100%; }
    .page-header > .d-flex > .btn, .page-header > .d-flex > a { flex: 1; }
    .page-header > .d-flex > form { flex: 1 1 100%; }
    .page-header > .d-flex > .view-switch { flex: 0 0 auto; }
    .page-header .form-select { width: 100%; }
}

.view-switch { display: inline-flex; background: var(--app-surface-2); border: 1px solid var(--app-border); border-radius: 10px; padding: 3px; gap: 2px; }
.view-switch a, .view-switch button { padding: .34rem .8rem; border-radius: 7px; color: var(--app-muted); font-weight: 500; font-size: .9rem; display: inline-flex; align-items: center; gap: .4rem; border: 0; background: none; white-space: nowrap; }
.view-switch a:hover, .view-switch button:hover { color: var(--app-text); }
.view-switch .active { background: var(--app-surface); color: var(--app-text); box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }

/* ---------- Cards ---------- */
.card { --bs-card-bg: var(--app-surface); --bs-card-color: var(--app-text); border: 1px solid var(--app-border); border-radius: var(--app-radius); box-shadow: var(--app-shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--app-border); padding: .9rem 1.25rem; font-weight: 600; font-size: .98rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.card-header a.small, .card-header .small a, .card-header > a { font-weight: 400; font-size: .88rem; }
.card-header > span > .bi:first-child { color: var(--app-subtle) !important; }
.card-body { padding: 1.25rem; }
.card-title-sm { font-size: .95rem; font-weight: 600; margin: 0; }
.card-title { font-size: 1rem; font-weight: 600; margin: 0; display: inline-flex; align-items: center; gap: .55rem; }
.card-foot-link { display: block; text-align: center; padding: .7rem; font-size: .9rem; border-top: 1px solid var(--app-border); color: var(--app-muted); }
.card-foot-link:hover { background: var(--app-hover); color: var(--app-primary); }
.count-chip { background: var(--app-surface-2); border: 1px solid var(--app-border); color: var(--app-muted); font-size: .76rem; font-weight: 500; border-radius: 99px; min-width: 22px; height: 21px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; }
.count-chip.hot { background: var(--t-rose-bg); color: var(--t-rose-fg); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--g, var(--c-gray)); display: inline-block; flex-shrink: 0; }
@media (max-width: 575.98px) { .card-header { padding: .8rem 1rem; } .card-body { padding: 1rem; } }

.stat-card { padding: 1rem 1.15rem; display: flex; flex-direction: row; align-items: center; gap: .85rem; height: 100%; transition: background .12s, border-color .12s; color: inherit; }
a.stat-card:hover { background: var(--app-hover); color: inherit; border-color: var(--app-border-strong); }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.stat-icon.sm { width: 32px; height: 32px; font-size: .95rem; border-radius: 9px; }
.stat-value { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-card .fw-bold { font-weight: 600 !important; }
.stat-label { color: var(--app-muted); font-size: .86rem; }
.stat-delta { font-size: .76rem; font-weight: 500; border-radius: 99px; padding: .04rem .42rem; display: inline-flex; align-items: center; gap: .1rem; }
.stat-delta.up { background: var(--t-green-bg); color: var(--t-green-fg); }
.stat-delta.down { background: var(--t-rose-bg); color: var(--t-rose-fg); }
@media (max-width: 575.98px) {
    .stat-card { padding: .8rem .85rem; gap: .45rem; flex-direction: column; align-items: flex-start; }
    .stat-card > div { width: 100%; }
    .stat-card .stat-icon { width: 32px; height: 32px; font-size: .95rem; border-radius: 9px; }
    .stat-value { font-size: 1.12rem; overflow: hidden; text-overflow: ellipsis; }
    .stat-label { font-size: .84rem; }
}

.tone-indigo { background: var(--t-indigo-bg); color: var(--t-indigo-fg); }
.tone-blue { background: var(--t-blue-bg); color: var(--t-blue-fg); }
.tone-amber { background: var(--t-amber-bg); color: var(--t-amber-fg); }
.tone-green { background: var(--t-green-bg); color: var(--t-green-fg); }
.tone-gray { background: var(--t-gray-bg); color: var(--t-gray-fg); }
.tone-teal { background: var(--t-teal-bg); color: var(--t-teal-fg); }
.tone-rose { background: var(--t-rose-bg); color: var(--t-rose-fg); }
.tone-purple { background: var(--t-purple-bg); color: var(--t-purple-fg); }

/* Key / value list (e.g. "This month" on the home page) */
.kv { list-style: none; margin: 0; padding: 0; }
.kv li { border-bottom: 1px solid var(--app-border); }
.kv li:last-child { border-bottom: 0; }
.kv-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: .72rem 1.25rem; color: inherit; }
a.kv-row:hover { background: var(--app-hover); color: inherit; }
.kv .k { color: var(--app-muted); }
.kv .v { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; color: var(--app-text); }
.kv .v small { display: block; font-weight: 400; color: var(--app-subtle); font-size: .78rem; }
@media (max-width: 575.98px) { .kv-row { padding: .7rem 1rem; } }

/* ---------- Badges & status ---------- */
.badge-soft { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .55rem; border-radius: 6px; font-size: .78rem; font-weight: 500; white-space: nowrap; line-height: 1.35; }
.badge-blue { background: var(--t-blue-bg); color: var(--t-blue-fg); }
.badge-amber { background: var(--t-amber-bg); color: var(--t-amber-fg); }
.badge-green { background: var(--t-green-bg); color: var(--t-green-fg); }
.badge-gray { background: var(--t-gray-bg); color: var(--t-gray-fg); }
.badge-indigo { background: var(--t-indigo-bg); color: var(--t-indigo-fg); }
.badge-teal { background: var(--t-teal-bg); color: var(--t-teal-fg); }
.badge-rose { background: var(--t-rose-bg); color: var(--t-rose-fg); }
.badge-purple { background: var(--t-purple-bg); color: var(--t-purple-fg); }

/* Status: a small coloured dot plus plain text. Calm, but easy to scan. */
.pill { display: inline-flex; align-items: center; gap: .45rem; font-size: .86rem; font-weight: 400; color: var(--app-text-2); white-space: nowrap; line-height: 1.3; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--c-gray)); flex-shrink: 0; }
.pill-red { --dot: var(--c-red); color: var(--app-danger); }
.pill-green { --dot: var(--c-green); } .pill-blue { --dot: var(--c-blue); } .pill-indigo { --dot: var(--c-indigo); }
.pill-teal { --dot: var(--c-teal); } .pill-amber { --dot: var(--c-amber); } .pill-gray { --dot: var(--c-gray); } .pill-purple { --dot: var(--c-purple); }
.rating { display: inline-flex; align-items: center; gap: .25rem; font-size: .76rem; font-weight: 500; border-radius: 6px; padding: .08rem .42rem; vertical-align: .08em; }
.rating-Hot { background: var(--t-rose-bg); color: var(--t-rose-fg); }
.rating-Warm { background: var(--t-amber-bg); color: var(--t-amber-fg); }
.rating-Cold { background: var(--t-blue-bg); color: var(--t-blue-fg); }

/* ---------- Filter tabs ---------- */
.stage-tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.stage-tab {
    display: inline-flex; align-items: center; gap: .45rem; padding: .38rem .8rem; border-radius: 8px; background: transparent;
    border: 1px solid transparent; color: var(--app-muted); font-weight: 500; font-size: .9rem; white-space: nowrap; min-height: 2.3rem;
}
.stage-tab:hover { color: var(--app-text); background: var(--app-hover); }
.stage-tab.active { background: var(--app-surface); border-color: var(--app-border); color: var(--app-text); box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
.stage-tab i { color: var(--app-subtle); }
.stage-tab.active i { color: var(--app-primary); }
.stage-tab .count { color: var(--app-subtle); font-size: .8rem; font-weight: 400; }
.stage-tab.active .count { color: var(--app-muted); }
@media (max-width: 767.98px) {
    .stage-tabs { flex-wrap: nowrap; overflow-x: auto; margin-left: -1rem; margin-right: -1rem; padding: 2px 1rem 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .stage-tabs::-webkit-scrollbar { display: none; }
}

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; --bs-table-color: var(--app-text); --bs-table-border-color: var(--app-border); }
.table-app { margin: 0; }
.table-app > :not(caption) > * > * { padding: .78rem 1.1rem; border-bottom-color: var(--app-border); vertical-align: middle; }
.table-app thead th { font-size: .82rem; color: var(--app-muted); font-weight: 500; background: var(--app-surface-2); white-space: nowrap; text-transform: none; letter-spacing: 0; }
.table-app tbody tr { transition: background .1s; }
.table-app tbody tr[data-href] { cursor: pointer; }
.table-app tbody tr:hover > * { background: var(--app-hover); }
.table-app tbody tr:last-child td { border-bottom: 0; }
.table-app tfoot td { background: var(--app-surface-2); font-weight: 500; }
.cell-title { font-weight: 500; color: var(--app-text); }
a.cell-title:hover { color: var(--app-primary); }
.table-app .avatar + .cell-title { white-space: nowrap; }
.cell-sub { font-size: .85rem; color: var(--app-muted); }

.icon-link-btn { color: var(--app-subtle); padding: .4rem .5rem; border-radius: 8px; display: inline-flex; font-size: 1.02rem; }
.icon-link-btn:hover { background: var(--app-hover); color: var(--app-text); }
.icon-link-btn.wa:hover { background: var(--t-green-bg); color: var(--t-green-fg); }

/* Phone: every table row becomes a card. site.js copies the column titles into data-label. */
@media (max-width: 767.98px) {
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tfoot, .table-stack tr { display: block; width: 100%; }
    .table-stack tr { padding: .85rem 1rem; border-bottom: 1px solid var(--app-border); }
    .table-stack tbody:last-child tr:last-child, .table-stack tfoot tr:last-child { border-bottom: 0; }
    .table-stack tfoot tr { background: var(--app-surface-2); }
    .table-stack > * > tr > td {
        display: grid; grid-template-columns: minmax(6.2rem, 36%) 1fr; column-gap: .75rem; padding: .14rem 0; border: 0; text-align: left !important;
        background: none !important; white-space: normal !important;
    }
    .table-stack > * > tr > td::before { content: attr(data-label); color: var(--app-subtle); font-size: .84rem; grid-column: 1; grid-row: 1 / span 6; }
    .table-stack > * > tr > td > * { grid-column: 2; justify-self: start; max-width: 100%; }
    .table-stack > * > tr > td:first-child, .table-stack > * > tr > td[data-label=""] { display: block; }
    .table-stack > * > tr > td:first-child::before, .table-stack > * > tr > td[data-label=""]::before { display: none; }
    .table-stack > * > tr > td:first-child { padding-bottom: .35rem; }
    .table-stack > * > tr > td[data-label=""]:not(:first-child) { display: flex; flex-wrap: wrap; gap: .5rem; padding-top: .55rem; }
    .table-stack > * > tr > td[data-label=""] .btn { flex: 1; min-height: 2.5rem; }
    .table-stack > * > tr > td[data-label=""] .icon-link-btn { background: var(--app-surface-2); border: 1px solid var(--app-border); flex: 1; justify-content: center; padding: .5rem; }
    .table-stack td:empty { display: none !important; }
    .table-responsive:has(> .table-stack) { overflow: visible; }
}

/* ---------- Filters bar ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: .9rem 1.1rem; border-bottom: 1px solid var(--app-border); }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 170px; }
.filter-bar .search-input { flex: 1; min-width: 220px; }
@media (max-width: 575.98px) {
    .filter-bar { padding: .85rem 1rem; }
    .filter-bar .form-control, .filter-bar .search-input { width: 100%; min-width: 0; flex: 1 1 100%; }
    .filter-bar .form-select { width: auto; min-width: 0; flex: 1 1 40%; }
    .filter-bar .btn { flex: 1 1 auto; }
    .filter-bar .btn-link { flex: 0 0 auto; }
}

/* ---------- Client profile ---------- */
.profile-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.profile-head h1 { font-size: 1.4rem; font-weight: 600; margin: 0; }
.info-list { list-style: none; padding: 0; margin: 0; }
.info-list li { display: flex; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--app-border); }
.info-list li:last-child { border-bottom: 0; }
.info-list i { color: var(--app-subtle); font-size: 1rem; margin-top: .1rem; }
.info-list .label { font-size: .8rem; color: var(--app-subtle); }
.info-list .value { font-weight: 400; color: var(--app-text); word-break: break-word; }
.note-box { background: var(--t-amber-bg); color: var(--t-amber-fg); border-radius: 10px; padding: .8rem 1rem; white-space: pre-wrap; font-size: .92rem; }
.note-box.plain { white-space: normal; }
.note-box code { color: inherit; font-weight: 600; }
.action-row { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (max-width: 575.98px) {
    .action-row { display: grid; grid-template-columns: repeat(2, 1fr); width: 100%; }
    .action-row > * { width: 100%; }
    .action-row .btn { width: 100%; }
}

.nav-tabs-app { border-bottom: 1px solid var(--app-border); gap: .25rem; padding: 0 1rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.nav-tabs-app::-webkit-scrollbar { display: none; }
.nav-tabs-app .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--app-muted); font-weight: 500; padding: .85rem .75rem; border-radius: 0; white-space: nowrap; background: none; }
.nav-tabs-app .nav-link:hover { color: var(--app-text); }
.nav-tabs-app .nav-link.active { color: var(--app-text); border-bottom-color: var(--app-primary); background: none; }
.nav-tabs-app .badge-soft { font-weight: 400; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: .8rem; padding: .9rem 0; border-bottom: 1px solid var(--app-border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .meta { font-size: .84rem; color: var(--app-muted); }
.timeline .meta strong { font-weight: 500; }
.timeline .text { white-space: pre-wrap; margin-top: .15rem; }

.feed { list-style: none; margin: 0; padding: 0; position: relative; }
.feed::before { content: ""; position: absolute; left: 15px; top: 8px; bottom: 8px; width: 1px; background: var(--app-border); }
.feed li { display: flex; gap: .85rem; padding: .6rem 0; position: relative; }
.feed .stat-icon { position: relative; z-index: 1; box-shadow: 0 0 0 4px var(--app-surface); }
.feed .f-title { font-weight: 500; }
.feed .f-meta { font-size: .82rem; color: var(--app-subtle); }
.feed .f-text { white-space: pre-wrap; margin-top: .2rem; color: var(--app-text-2); }

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--app-muted); }
.empty-icon { width: 52px; height: 52px; margin: 0 auto .9rem; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; background: var(--app-surface-2); color: var(--app-subtle); border: 1px solid var(--app-border); }
.empty-state h2, .empty-state h3 { color: var(--app-text); font-weight: 500; }
.coming-soon { border: 1px dashed var(--app-border-strong); border-radius: 12px; padding: 1.5rem; text-align: center; color: var(--app-muted); background: var(--app-surface-2); }

/* ---------- Form layout ---------- */
.form-section { padding: 1.4rem 1.5rem; border-bottom: 1px solid var(--app-border); }
.form-section:last-of-type { border-bottom: 0; }
.form-section-title { font-weight: 600; margin-bottom: .15rem; display: flex; align-items: center; gap: .5rem; font-size: 1rem; }
.form-section-title i { color: var(--app-subtle); }
.form-section-hint { font-size: .88rem; color: var(--app-muted); margin-bottom: 1.1rem; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; padding: 1rem 1.5rem; background: var(--app-surface-2); border-top: 1px solid var(--app-border); border-radius: 0 0 var(--app-radius) var(--app-radius); }
@media (max-width: 575.98px) {
    .form-section { padding: 1.1rem 1rem; }
    .form-actions { position: sticky; bottom: calc(var(--bottom-h) + var(--safe-b)); z-index: 5; padding: .75rem 1rem; border-radius: 0; }
    .form-actions .btn { flex: 1; min-height: 2.8rem; }
}

.stage-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem; }
.stage-picker input { position: absolute; opacity: 0; pointer-events: none; }
.stage-picker label {
    border: 1px solid var(--app-border-strong); border-radius: 10px; padding: .62rem .85rem; cursor: pointer; display: flex; align-items: center; gap: .5rem;
    font-weight: 400; transition: all .15s; background: var(--app-field); min-height: 2.75rem; color: var(--app-text-2);
}
.stage-picker label i { color: var(--app-subtle); }
.stage-picker label:hover { border-color: var(--app-primary); }
.stage-picker input:checked + label { border-color: var(--app-primary); background: var(--app-primary-50); color: var(--app-primary); font-weight: 500; }
.stage-picker input:checked + label i { color: var(--app-primary); }
.stage-picker input:focus-visible + label { outline: 2px solid var(--app-primary); outline-offset: 2px; }

/* ---------- Product cards ---------- */
.product-card { height: 100%; display: flex; flex-direction: column; }
.product-card .price { font-size: 1.25rem; font-weight: 600; }
.product-card.inactive { opacity: .65; }

/* ---------- Toasts, modals, menus ---------- */
.app-toast { border: 0; border-radius: 12px; box-shadow: var(--app-shadow-lg); min-width: 300px; font-weight: 500; }
.toast-success { background: #ecf8f1; color: #1d5e3d; }
.toast-error { background: #fdefef; color: #8f2a30; }
[data-bs-theme="dark"] .toast-success { background: #16301f; color: #a9e7c4; }
[data-bs-theme="dark"] .toast-error { background: #3a171a; color: #ffc1c6; }
.app-toast i { font-size: 1.1rem; }
.modal-content { --bs-modal-bg: var(--app-surface); --bs-modal-color: var(--app-text); border: 0; border-radius: 16px; }
.modal-header .modal-title { font-weight: 600; font-size: 1.1rem; }
.modal-title .bi { color: var(--app-subtle) !important; }
.confirm-icon { width: 50px; height: 50px; border-radius: 50%; margin: 0 auto; display: flex; align-items: center; justify-content: center; background: var(--t-rose-bg); color: var(--t-rose-fg); font-size: 1.3rem; }
.dropdown-menu { --bs-dropdown-bg: var(--app-surface); --bs-dropdown-color: var(--app-text); --bs-dropdown-border-color: var(--app-border); --bs-dropdown-link-color: var(--app-text-2); --bs-dropdown-link-hover-bg: var(--app-hover); --bs-dropdown-link-hover-color: var(--app-text); --bs-dropdown-link-active-bg: var(--app-primary-50); --bs-dropdown-link-active-color: var(--app-primary); border-radius: 12px; padding: .35rem; box-shadow: var(--app-shadow-lg); font-size: .94rem; }
.dropdown-item { border-radius: 7px; padding: .5rem .75rem; font-weight: 400; }
.dropdown-item .bi { color: var(--app-subtle); }
.dropdown-header { color: var(--app-text); font-size: .94rem; font-weight: 500; }
@media (max-width: 575.98px) {
    .modal:not(#confirmModal) .modal-dialog { margin: 0; max-width: none; min-height: 100%; align-items: flex-end; }
    .modal:not(#confirmModal) .modal-content { border-radius: 20px 20px 0 0; padding-bottom: var(--safe-b); max-height: 92vh; overflow-y: auto; }
    .modal.fade:not(#confirmModal) .modal-dialog { transform: translateY(40px); }
    .modal.show:not(#confirmModal) .modal-dialog { transform: none; }
    .modal-footer .btn { flex: 1; min-height: 2.8rem; }
}

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--app-surface-2); border: 1px solid var(--app-border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; border-radius: 7px; padding: .38rem .5rem; font-weight: 500; font-size: .85rem; color: var(--app-muted); display: inline-flex; align-items: center; justify-content: center; gap: .3rem; white-space: nowrap; }
.seg button.active { background: var(--app-surface); color: var(--app-text); box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.settings-block { padding: .5rem .75rem .65rem; min-width: 260px; }
.settings-block .lbl { font-size: .8rem; font-weight: 500; color: var(--app-subtle); margin: .35rem 0 .3rem; }

/* ---------- Auth pages ---------- */
.auth-body { background: var(--app-bg); }
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; padding-top: calc(1.5rem + var(--safe-t)); }
.auth-brand { display: flex; align-items: center; gap: .6rem; font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; margin-bottom: 1.5rem; }
.auth-card { width: 100%; max-width: 410px; box-shadow: var(--app-shadow-lg); border: 0; }
.auth-card .card-body { padding: 2rem; }
.auth-card h1 { font-weight: 600 !important; }
@media (max-width: 575.98px) { .auth-card .card-body { padding: 1.4rem; } }

/* ---------- Bell ---------- */
.bell-count {
    position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px;
    background: var(--c-red); color: #fff; font-size: .64rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid var(--app-bg);
}
.bell-menu { width: 370px; max-width: calc(100vw - 1.5rem); border-radius: 14px; overflow: hidden; padding: 0; }
.bell-list { max-height: min(60vh, 420px); overflow-y: auto; }
.bell-item { display: flex; gap: .7rem; padding: .75rem 1rem; color: inherit; border-bottom: 1px solid var(--app-border); }
.bell-item:hover { background: var(--app-hover); color: inherit; }
.bell-item .fw-semibold { font-weight: 500 !important; }

/* ---------- Money ---------- */
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.text-overdue { color: var(--app-danger) !important; }
.kpi-sub { font-size: .82rem; color: var(--app-muted); }
.plan-preview { list-style: none; padding: 0; margin: 0; }
.plan-preview li { display: flex; justify-content: space-between; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--app-border); font-size: .94rem; }
.plan-preview li:last-child { border-bottom: 0; }
.plan-preview strong { font-weight: 500; }
.totals-box { background: var(--app-surface-2); border: 1px solid var(--app-border); border-radius: 10px; padding: 1rem 1.25rem; }
.totals-box .row-line { display: flex; justify-content: space-between; padding: .2rem 0; color: var(--app-text-2); }
.totals-box .grand { font-size: 1.15rem; font-weight: 600; border-top: 1px solid var(--app-border); margin-top: .4rem; padding-top: .5rem; color: var(--app-text); }
.line-table td { vertical-align: top; }
.line-table .form-control, .line-table .form-select { padding: .45rem .6rem; }
.bulk-bar { position: sticky; bottom: 1rem; z-index: 5; background: #1f2430; color: #fff; border-radius: 12px; padding: .7rem 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); margin-top: 1rem; }
.bulk-bar .form-control { min-width: 180px; }
@media (max-width: 991.98px) { .bulk-bar { bottom: calc(var(--bottom-h) + var(--safe-b) + .75rem); } }
@media (max-width: 767.98px) {
    .line-table thead { display: none; }
    .line-table, .line-table tbody, .line-table tr { display: block; width: 100%; }
    .line-table tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .5rem; padding: .85rem 0; border-bottom: 1px solid var(--app-border); }
    .line-table td { display: block; padding: 0 !important; border: 0 !important; width: auto !important; }
    .line-table td:first-child { grid-column: 1 / -1; }
    .line-table td:nth-last-child(2) { grid-column: 1 / 3; align-self: center; text-align: left !important; font-weight: 500; }
    .line-table td:last-child { text-align: right; }
    .line-table td:nth-child(2)::before, .line-table td:nth-child(3)::before, .line-table td:nth-child(4)::before { display: block; font-size: .8rem; color: var(--app-subtle); margin-bottom: .15rem; }
    .line-table td:nth-child(2)::before { content: "Qty"; }
    .line-table td:nth-child(3)::before { content: "Unit price"; }
    .line-table td:nth-child(4)::before { content: "Discount"; }
    .line-table td:nth-child(5)::before { content: "Line total  "; font-weight: 400; color: var(--app-subtle); white-space: pre; }
}

/* ---------- Charts ---------- */
.trend { display: flex; align-items: flex-end; gap: .75rem; height: 170px; padding-top: .5rem; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .4rem; height: 100%; min-width: 0; }
.trend-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; border-bottom: 1px solid var(--app-border); }
.trend-bar { width: 34%; max-width: 20px; border-radius: 4px 4px 0 0; min-height: 2px; transition: height .4s ease; }
.trend-bar.sales { background: #2a63b0; }
.trend-bar.paid { background: #2fa7ad; }
.trend-label { font-size: .8rem; color: var(--app-subtle); }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .35rem; vertical-align: .05em; }
.progress-thin { height: 6px; border-radius: 99px; background: var(--t-gray-bg); overflow: hidden; }
.progress-thin > span { display: block; height: 100%; border-radius: 99px; background: #2a63b0; }
.progress-thin.good > span { background: var(--c-green); }

.funnel { display: flex; flex-direction: column; gap: .75rem; }
.funnel-row { display: grid; grid-template-columns: 6.5rem 1fr 2.2rem; align-items: center; gap: .8rem; color: var(--app-text-2); }
.funnel-row:hover { color: var(--app-text); }
.funnel-row > span:first-child { white-space: nowrap; display: inline-flex; align-items: center; gap: .5rem; }
.funnel-bar { height: 8px; border-radius: 99px; background: var(--t-gray-bg); overflow: hidden; }
.funnel-bar > span { display: block; height: 100%; border-radius: 99px; background: var(--g, var(--c-indigo)); min-width: 4px; font-size: 0; }
.funnel-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--app-text); }

/* ---------- Calendar ---------- */
#calendar { --fc-border-color: var(--app-border); --fc-today-bg-color: var(--app-primary-50); --fc-button-bg-color: var(--app-surface); --fc-button-border-color: var(--app-border-strong); --fc-button-text-color: var(--app-text-2); --fc-button-hover-bg-color: var(--app-hover); --fc-button-hover-border-color: var(--app-border-strong); --fc-button-active-bg-color: #1d4f91; --fc-button-active-border-color: #1d4f91; --fc-page-bg-color: var(--app-surface); --fc-neutral-bg-color: var(--app-surface-2); --fc-list-event-hover-bg-color: var(--app-hover); }
#calendar .fc-button { border-radius: 8px; font-weight: 500; text-transform: capitalize; box-shadow: none !important; padding: .42rem .8rem; }
#calendar .fc-button-active { color: #fff; }
#calendar .fc-toolbar-title { font-size: 1.1rem; font-weight: 600; }
#calendar .fc-col-header-cell-cushion { font-weight: 500; color: var(--app-muted); }
#calendar .fc-event { border-radius: 6px; padding: 2px 4px; font-size: .82rem; cursor: pointer; }
#calendar a { color: inherit; }
@media (max-width: 767.98px) {
    #calendar .fc-toolbar { flex-wrap: wrap; gap: .5rem; }
    #calendar .fc-toolbar-title { font-size: 1rem; }
    #calendar .fc-list-event td { padding: .7rem .6rem; }
}

/* ---------- Print ---------- */
@media print {
    .sidebar, .topbar, .bottom-nav, .no-print, .toast-container, .breadcrumb-link, .offcanvas, .install-banner { display: none !important; }
    body, .content { background: #fff !important; padding: 0 !important; color: #000 !important; }
    .card { box-shadow: none !important; border-color: #ddd !important; }
    .print-only { display: block !important; }
}
.print-only { display: none; }

/* ---------- Lists ---------- */
.list-row { display: flex; flex-direction: row; align-items: center; gap: .8rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--app-border); color: inherit; }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: var(--app-hover); color: inherit; }
.list-row .fw-semibold { font-weight: 500 !important; }
.day-head { padding: .5rem 1.25rem; font-size: .84rem; font-weight: 500; color: var(--app-muted); background: var(--app-surface-2); border-bottom: 1px solid var(--app-border); }
.roadmap-item { display: flex; gap: .75rem; padding: .6rem 0; }
.roadmap-item .dot { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: .9rem; }
@media (max-width: 575.98px) { .list-row { padding: .75rem 1rem; } .day-head { padding: .5rem 1rem; } }

/* Activity row (meeting / visit / call) */
.act-row { display: grid; grid-template-columns: auto 5rem 1fr auto auto; align-items: center; gap: .9rem; padding: .78rem 1.25rem; border-bottom: 1px solid var(--app-border); }
.act-row:last-child { border-bottom: 0; }
.act-row:hover { background: var(--app-hover); }
.act-row .act-when { text-align: center; }
.act-row .act-when .fw-bold { font-weight: 500 !important; }
.act-row .act-main { min-width: 0; color: inherit; }
.act-row .act-actions { display: flex; gap: .4rem; }
@media (max-width: 767.98px) {
    .act-row { grid-template-columns: auto 1fr auto; padding: .85rem 1rem; row-gap: .6rem; }
    .act-row .act-when { grid-column: 3; grid-row: 1; text-align: right; }
    .act-row .act-main { grid-column: 2; grid-row: 1; }
    .act-row .act-badge { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
    .act-row .act-actions { grid-column: 1 / -1; }
    .act-row .act-actions .btn { flex: 1; min-height: 2.5rem; }
}

/* ==========================================================================
   My work: groups by time, one calm row per thing to do
   ========================================================================== */
.g-rose { --g: var(--c-red); } .g-green { --g: var(--c-green); } .g-blue { --g: var(--c-blue); } .g-indigo { --g: var(--c-indigo); }
.g-teal { --g: var(--c-teal); } .g-gray { --g: var(--c-gray); } .g-amber { --g: var(--c-amber); } .g-purple { --g: var(--c-purple); }

.wgroup { margin-bottom: 1.75rem; }
.wgroup-head { display: flex; align-items: center; gap: .55rem; padding: 0 .15rem .65rem; flex-wrap: wrap; }
.wgroup-toggle { border: 0; background: none; color: var(--app-subtle); width: 26px; height: 26px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; transition: transform .15s; flex-shrink: 0; margin-left: -.3rem; }
.wgroup-toggle:hover { background: var(--app-hover); color: var(--app-text); }
.wgroup.collapsed .wgroup-toggle { transform: rotate(-90deg); }
.wgroup-title { font-family: var(--font-display); font-size: 1.02rem; font-weight: 600; color: var(--app-text); margin: 0; cursor: pointer; display: inline-flex; align-items: center; gap: .55rem; }
.wgroup-title i { display: none; }
.wgroup-title::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--g); flex-shrink: 0; }
.wgroup.g-rose .wgroup-title { color: var(--app-danger); }
.wgroup-count { background: var(--app-surface); border: 1px solid var(--app-border); color: var(--app-muted); border-radius: 99px; min-width: 24px; height: 22px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 500; }
.wgroup-hint { color: var(--app-subtle); font-size: .86rem; }
.wgroup-sum { margin-left: auto; font-weight: 400; font-size: .88rem; color: var(--app-muted); }
.wgroup-body { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius); box-shadow: var(--app-shadow); overflow: hidden; }
.wgroup.collapsed .wgroup-body { display: none; }
.wgroup-empty { padding: 1.1rem 1.25rem; color: var(--app-muted); display: flex; align-items: center; gap: .6rem; }
.wgroup-empty i { color: var(--app-subtle); }

.witem { display: grid; grid-template-columns: auto minmax(0, 1fr) 8.5rem 8rem auto; align-items: center; gap: 1rem; padding: .8rem 1.1rem; border-bottom: 1px solid var(--app-border); }
.witem:last-child { border-bottom: 0; }
.witem:hover { background: var(--app-hover); }
.witem-main { min-width: 0; color: inherit; }
.witem-main:hover { color: inherit; }
.witem-main:hover .witem-title { color: var(--app-primary); }
.witem-title { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--app-text); }
.witem-title .fw-normal { color: var(--app-subtle) !important; }
.witem-sub { font-size: .85rem; color: var(--app-muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.witem-when { font-size: .88rem; color: var(--app-text-2); white-space: nowrap; }
.witem-when small { display: block; color: var(--app-subtle); font-size: .8rem; }
.witem-when.late, .witem-when.late small { color: var(--app-danger); }
.witem-amount { font-weight: 400; color: var(--app-text-2); }
.witem-actions { display: flex; gap: .2rem; justify-content: flex-end; align-items: center; flex-wrap: nowrap; }
.witem-actions .btn-act { margin-left: .35rem; }
.witem .stat-icon.sm { width: 32px; height: 32px; }

/* Rows re-flow by the width of their own box, so they read well in a narrow column too. */
.wgroup-body, .wlist { container-type: inline-size; }
@container (max-width: 900px) {
    .witem { grid-template-columns: auto minmax(0, 1fr) auto; row-gap: .4rem; }
    .witem-when { text-align: right; }
    .witem-status { grid-column: 2; justify-self: start; }
    .witem-actions { grid-column: 3; }
}
@container (max-width: 560px) {
    .witem { padding: .85rem .95rem; column-gap: .8rem; }
    .witem-status { grid-column: 2 / 4; grid-row: 2; }
    .witem-actions { grid-column: 2 / -1; grid-row: 3; justify-content: flex-start; }
    .witem-actions .btn-act { margin-left: auto; flex: 0 1 8rem; min-height: 2.4rem; }
    .witem-actions .btn-ghost { width: 40px; height: 40px; }
    .witem-title, .witem-sub { white-space: normal; }
}
@media (max-width: 767.98px) {
    .wgroup-sum { margin-left: 0; width: 100%; padding-left: 1.6rem; }
    .wgroup-hint { display: none; }
}

/* Summary strip: "what needs me now", in one quiet card */
.focus-strip {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--app-surface); border: 1px solid var(--app-border);
    border-radius: var(--app-radius); box-shadow: var(--app-shadow); overflow: hidden; margin-bottom: 1.75rem;
}
.focus-tile {
    display: flex; flex-direction: column; gap: .15rem; padding: 1rem 1.2rem 1.05rem; color: inherit; min-width: 0;
    box-shadow: -1px 0 0 var(--app-border), 0 -1px 0 var(--app-border); transition: background .12s;
}
a.focus-tile:hover { background: var(--app-hover); color: inherit; }
.focus-tile .ft-top { display: flex; align-items: center; gap: .5rem; color: var(--app-muted); font-size: .85rem; font-weight: 400; min-width: 0; }
.focus-tile .ft-top::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--g, var(--c-indigo)); flex-shrink: 0; }
.focus-tile .ft-top i { display: none; }
.focus-tile .ft-num { font-family: var(--font-display); font-size: 1.55rem; font-weight: 600; line-height: 1.25; color: var(--app-text); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: .25rem; }
.focus-tile .ft-sub { font-size: .8rem; color: var(--app-subtle); }
.focus-tile.calm .ft-top::before { background: var(--app-border-strong); }
.focus-tile.calm .ft-num { color: var(--app-subtle); }
.focus-tile.g-rose:not(.calm) .ft-num { color: var(--app-danger); }
.focus-tile.active { background: var(--app-primary-50); }
@media (max-width: 1199.98px) { .focus-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 575.98px) {
    .focus-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1.25rem; }
    .focus-tile { padding: .8rem .9rem .85rem; }
    .focus-tile .ft-num { font-size: 1.3rem; }
    .focus-tile .ft-top { font-size: .8rem; }
}

/* Week strip: the next 7 days at a glance */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; }
.week-day { border: 1px solid transparent; border-radius: 10px; padding: .5rem .4rem; text-align: center; color: inherit; min-width: 0; }
a.week-day:hover { background: var(--app-hover); color: inherit; }
.week-day .wd-name { font-size: .76rem; color: var(--app-subtle); }
.week-day .wd-num { font-family: var(--font-display); font-size: 1.1rem; font-weight: 500; color: var(--app-text); }
.week-day .wd-dots { display: flex; justify-content: center; gap: 3px; min-height: 18px; margin-top: .15rem; flex-wrap: wrap; }
.week-day .wd-chip { font-size: .68rem; border-radius: 5px; padding: 0 .28rem; line-height: 1.5; }
.week-day.today { background: var(--app-primary-50); }
.week-day.today .wd-name, .week-day.today .wd-num { color: var(--app-primary); }
.week-day.off .wd-num { color: var(--app-subtle); }
@media (max-width: 575.98px) { .week-strip { gap: .15rem; } .week-day { padding: .4rem .1rem; } .week-day .wd-name { font-size: .66rem; } .week-day .wd-chip i { display: none; } }

/* ==========================================================================
   Pipeline board (Kanban)
   ========================================================================== */
.board { display: flex; gap: 1rem; align-items: flex-start; overflow-x: auto; padding: 2px 2px 1rem; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.board-col { flex: 1 0 280px; max-width: 370px; background: var(--app-surface-2); border: 1px solid var(--app-border); border-radius: var(--app-radius); display: flex; flex-direction: column; max-height: calc(100dvh - 15rem); min-height: 12rem; scroll-snap-align: start; transition: box-shadow .12s, background .12s; }
.board-col.drop { background: var(--app-primary-50); box-shadow: 0 0 0 2px var(--app-primary); }
.board-head { padding: .8rem .95rem .3rem; display: flex; align-items: center; gap: .5rem; }
.board-head h2 { font-size: .96rem; font-weight: 600; margin: 0; color: var(--app-text); display: flex; align-items: center; gap: .5rem; }
.board-head h2 i { display: none; }
.board-head h2::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--g); }
.board-sum { padding: 0 .95rem .7rem; font-size: .84rem; color: var(--app-muted); border-bottom: 1px solid var(--app-border); }
.board-sum strong { color: var(--app-text-2); font-weight: 500; }
.board-cards { padding: .65rem; overflow-y: auto; display: flex; flex-direction: column; gap: .55rem; flex: 1; scrollbar-width: thin; }
.kcard { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 10px; padding: .75rem .8rem; cursor: grab; transition: box-shadow .12s, transform .12s, opacity .12s, border-color .12s; }
.kcard:hover { box-shadow: var(--app-shadow-lg); border-color: var(--app-border-strong); }
.kcard.dragging { opacity: .45; transform: rotate(1.5deg); }
.kcard-top { display: flex; align-items: flex-start; gap: .55rem; }
.kcard-name { font-weight: 500; color: var(--app-text); display: block; line-height: 1.35; }
a.kcard-name:hover { color: var(--app-primary); }
.kcard-co { font-size: .83rem; color: var(--app-muted); display: block; }
.kcard-meta { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .55rem; }
.kchip { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 400; border-radius: 6px; padding: .12rem .42rem; background: var(--t-gray-bg); color: var(--t-gray-fg); white-space: nowrap; }
.kchip.warn { background: var(--t-amber-bg); color: var(--t-amber-fg); }
.kchip.bad { background: var(--t-rose-bg); color: var(--t-rose-fg); }
.kchip.good { background: var(--t-green-bg); color: var(--t-green-fg); }
.kchip.info { background: var(--t-indigo-bg); color: var(--t-indigo-fg); }
.kcard-foot { display: flex; align-items: center; gap: .2rem; margin-top: .6rem; padding-top: .5rem; border-top: 1px solid var(--app-border); }
.kcard-foot .icon-link-btn { padding: .3rem .45rem; }
.kcard-move { margin-left: auto; }
.kcard-move .btn { font-size: .82rem; padding: .22rem .6rem; }
.board-empty { text-align: center; color: var(--app-subtle); font-size: .86rem; padding: 1.25rem .5rem; border: 1px dashed var(--app-border-strong); border-radius: 10px; }
.board-more { text-align: center; font-size: .86rem; padding: .25rem; }
@media (max-width: 767.98px) {
    .board { margin: 0 -1rem; padding: 2px 1rem 1rem; gap: .75rem; scroll-snap-type: x mandatory; }
    .board-col { flex: 0 0 86%; max-height: none; }
    .board-cards { overflow: visible; }
    .kcard { cursor: default; }
}

/* ---------- Install banner & phone page ---------- */
.install-banner { display: none; align-items: center; gap: .75rem; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius); padding: .75rem 1rem; margin-bottom: 1rem; }
.install-banner.show { display: flex; }
.qr-box { background: #fff; border-radius: 14px; padding: .75rem; display: inline-block; border: 1px solid var(--app-border); }
.qr-box img { display: block; width: 180px; height: 180px; image-rendering: pixelated; }
.url-box { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1rem; font-weight: 500; background: var(--app-surface-2); border: 1px solid var(--app-border); border-radius: 10px; padding: .55rem .85rem; overflow-wrap: anywhere; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; position: relative; padding: 0 0 .8rem 2.4rem; color: var(--app-text-2); }
.steps li strong { color: var(--app-text); font-weight: 500; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: .05rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--app-surface-2); border: 1px solid var(--app-border); color: var(--app-muted); font-weight: 500; display: flex; align-items: center; justify-content: center; font-size: .8rem; }
html[data-app="1"] .hide-in-app { display: none !important; }


/* ==========================================================================
   Navy theme refinements: richer colour and clearer hierarchy.
   Titles are navy and bold, values are blue and semi-bold, labels are grey.
   ========================================================================== */
strong, b, .fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }
h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: 0; }

/* Side menu: deep navy */
.sidebar { background: var(--nav-bg); border-right: 0; color: #fff; box-shadow: 2px 0 12px rgba(13, 40, 80, .18); }
.brand, .brand:hover { color: #fff; font-weight: 700; }
.brand-logo { background: #fff; color: #1d4f91; }
.nav-label { color: rgba(255, 255, 255, .55); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; }
.nav-link-item { color: rgba(255, 255, 255, .86); }
.nav-link-item i { color: rgba(255, 255, 255, .7); }
.nav-link-item:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.nav-link-item.active { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #6fb1ff; }
.nav-link-item.active i { color: #fff; }
.nav-count { background: rgba(255, 255, 255, .2); color: #fff; font-weight: 600; }
.nav-count.hot { background: #ffd9d5; color: #a3241e; }
.sidebar-foot { border-top-color: rgba(255, 255, 255, .16); }
.sidebar-user .name { color: #fff; font-weight: 600; }
.sidebar-user .role { color: rgba(255, 255, 255, .65); }
.sidebar .avatar { background: rgba(255, 255, 255, .18); color: #fff; }
.nav-collapse-btn { color: rgba(255, 255, 255, .7); }
.nav-collapse-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
/* The menu's scrollbar stays hidden until the pointer is over the menu */
.side-nav { scrollbar-width: thin; scrollbar-color: transparent transparent; transition: scrollbar-color .15s; }
.side-nav:hover, .side-nav:focus-within { scrollbar-color: rgba(255, 255, 255, .3) transparent; }

/* Top bar and page titles */
.topbar { background: var(--app-surface); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: 0 1px 3px rgba(16, 40, 80, .06); }
.topbar-search input { background: var(--app-surface-2); border-color: var(--app-border); }
.topbar .brand-logo { background: #1d4f91; color: #fff; }
.page-header h1, .greeting, .profile-head h1 { color: var(--app-primary); font-weight: 700; font-size: 1.5rem; }
.topbar-title { color: var(--app-primary); font-weight: 700; }

/* Buttons */
.btn { font-weight: 600; }
.btn-light { --bs-btn-color: var(--app-primary); --bs-btn-border-color: var(--app-border-strong); --bs-btn-hover-color: var(--app-primary); --bs-btn-hover-bg: var(--app-primary-50); --bs-btn-hover-border-color: var(--app-primary); --bs-btn-active-color: var(--app-primary); --bs-btn-active-bg: var(--app-primary-50); }
.btn-act { --bs-btn-color: var(--app-primary); --bs-btn-border-color: var(--app-border-strong); }
.btn-ghost { color: var(--app-value); }
.btn-ghost:hover { background: var(--app-primary-50) !important; color: var(--app-primary); }
.btn-ghost.wa { color: #1d7a3e; }

/* Cards */
.card { border-radius: 10px; }
.card-header { font-weight: 700; color: var(--app-primary); }
.card-title { font-weight: 700; color: var(--app-primary); font-size: 1.05rem; }
.card-title.text-overdue { color: var(--app-danger) !important; }
.card-header > span > .bi:first-child { color: var(--app-value) !important; }

/* Values are blue and semi-bold, like a label / value sheet */
.cell-title, .witem-title, .kcard-name, .search-item .s-title, .feed .f-title { font-weight: 600; color: var(--app-value); }
.witem-title .fw-normal, .witem-amount { color: var(--app-muted) !important; font-weight: 400 !important; }
.info-list .value, .kv .v { font-weight: 600; color: var(--app-value); }
.kv .v small.up { color: var(--t-green-fg); }
.kv .v small.down { color: var(--t-rose-fg); }
.info-list .label, .kv .k { color: var(--app-muted); }
.stat-value { font-weight: 700; color: var(--app-text); }
.form-label { font-weight: 600; color: var(--app-text-2); }

/* Status badges: tinted, readable */
.pill { padding: .16rem .62rem; border-radius: 99px; font-size: .8rem; font-weight: 600; background: var(--t-gray-bg); color: var(--t-gray-fg); }
.pill::before { display: none; }
.pill-red { background: var(--t-rose-bg); color: var(--t-rose-fg); }
.pill-green { background: var(--t-green-bg); color: var(--t-green-fg); }
.pill-blue { background: var(--t-blue-bg); color: var(--t-blue-fg); }
.pill-indigo { background: var(--t-indigo-bg); color: var(--t-indigo-fg); }
.pill-teal { background: var(--t-teal-bg); color: var(--t-teal-fg); }
.pill-amber { background: var(--t-amber-bg); color: var(--t-amber-fg); }
.pill-purple { background: var(--t-purple-bg); color: var(--t-purple-fg); }
.badge-soft { font-weight: 600; border-radius: 99px; padding: .16rem .6rem; }

/* Tables */
.table-app thead th { background: var(--app-head); color: var(--app-text-2); font-weight: 600; font-size: .86rem; }
.day-head { background: var(--app-head); color: var(--app-text-2); font-weight: 600; }

/* Underlined tabs (filters, home, client profile) */
.tabs-line, .stage-tabs { display: flex; flex-wrap: nowrap; gap: 0; border-bottom: 1px solid var(--app-border); margin-bottom: 1.25rem; overflow-x: auto; scrollbar-width: none; }
.tabs-line::-webkit-scrollbar, .stage-tabs::-webkit-scrollbar { display: none; }
.tabs-line .nav-link, .stage-tab {
    border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; box-shadow: none !important; margin-bottom: -1px;
    padding: .65rem 1rem; color: #4d6a96; font-weight: 600; font-size: .95rem; white-space: nowrap; display: inline-flex; align-items: center; gap: .45rem; min-height: 0;
}
[data-bs-theme="dark"] .tabs-line .nav-link, [data-bs-theme="dark"] .stage-tab { color: var(--app-muted); }
.tabs-line .nav-link:hover, .stage-tab:hover { color: var(--app-primary); background: none; }
.tabs-line .nav-link.active, .stage-tab.active { color: var(--app-primary); border-bottom-color: var(--app-primary); background: none; }
.stage-tab i { color: inherit; opacity: .8; }
.tabs-line .count, .stage-tab .count { background: var(--t-gray-bg); color: var(--t-gray-fg); border-radius: 99px; font-size: .74rem; font-weight: 700; padding: .02rem .5rem; }
.tabs-line .active .count, .stage-tab.active .count { background: var(--app-primary); color: #fff; }
[data-bs-theme="dark"] .tabs-line .active .count, [data-bs-theme="dark"] .stage-tab.active .count { color: #0f1723; }
.tabs-line .count.hot { background: var(--t-rose-bg); color: var(--t-rose-fg); }
.nav-tabs-app .nav-link { font-weight: 600; color: #4d6a96; border-bottom-width: 3px; }
.nav-tabs-app .nav-link.active { color: var(--app-primary); }
@media (max-width: 767.98px) { .stage-tabs, .tabs-line { margin-left: -1rem; margin-right: -1rem; padding: 0 .5rem; } }

/* Time-range buttons: Today | 3 days | Week | Month */
.presets { display: inline-flex; background: var(--app-surface); border: 1px solid var(--app-border-strong); border-radius: 8px; overflow: hidden; flex-shrink: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.presets::-webkit-scrollbar { display: none; }
.presets a, .presets button { border: 0; border-right: 1px solid var(--app-border); background: none; padding: .5rem .9rem; color: var(--app-text-2); font-weight: 600; font-size: .9rem; white-space: nowrap; display: inline-flex; align-items: center; gap: .4rem; }
.presets a:last-child, .presets button:last-child { border-right: 0; }
.presets a:hover { background: var(--app-primary-50); color: var(--app-primary); }
.presets .active { background: var(--app-primary); color: #fff !important; }
[data-bs-theme="dark"] .presets .active { color: #0f1723 !important; }
.presets .count { font-size: .74rem; font-weight: 700; background: var(--t-gray-bg); color: var(--t-gray-fg); border-radius: 99px; padding: 0 .45rem; }
.presets .active .count { background: rgba(255, 255, 255, .25); color: inherit; }
.presets .alert-range:not(.active) { color: var(--app-danger); }
.presets .alert-range:not(.active) .count { background: var(--t-rose-bg); color: var(--t-rose-fg); }

.filter-panel { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 10px; box-shadow: var(--app-shadow); padding: .75rem .9rem; margin-bottom: 1.5rem; }
.filter-fields { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-left: auto; }
.filter-fields .form-select { width: auto; min-width: 11rem; }
.search-field { position: relative; }
.search-field > i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--app-subtle); pointer-events: none; }
.search-field .form-control { padding-left: 2.3rem; min-width: 13rem; }
.filter-bar .presets { margin-right: .25rem; }
@media (max-width: 767.98px) {
    .filter-panel { padding: .7rem; }
    .filter-panel .presets, .filter-bar .presets { width: 100%; }
    .filter-fields { margin-left: 0; width: 100%; }
    .filter-fields .form-select { flex: 1 1 45%; min-width: 0; }
    .search-field { flex: 1 1 100%; margin-left: 0 !important; }
    .search-field .form-control { min-width: 0; width: 100%; }
}

/* Summary strip: a coloured edge per number */
.focus-tile { border-left: 4px solid var(--g, var(--app-border-strong)); box-shadow: 0 -1px 0 var(--app-border); padding-left: 1rem; }
.focus-tile .ft-top { font-weight: 600; color: var(--app-text-2); }
.focus-tile .ft-top::before { display: none; }
.focus-tile .ft-num { font-weight: 700; }
.focus-tile.calm { border-left-color: var(--app-border-strong); }
.focus-tile .ft-sub { color: var(--app-muted); }

/* Group headings */
.wgroup-title { font-weight: 700; color: var(--app-primary); }
.wgroup.g-rose .wgroup-title { color: var(--app-danger); }
.wgroup-count { background: var(--app-primary); border-color: transparent; color: #fff; font-weight: 700; }
[data-bs-theme="dark"] .wgroup-count { color: #0f1723; }
.wgroup.g-rose .wgroup-count { background: var(--c-red); color: #fff; }
.wgroup-hint { color: var(--app-muted); }
.wgroup-sum { color: var(--app-text-2); font-weight: 600; }
.count-chip { font-weight: 700; }
.board-head h2 { font-weight: 700; color: var(--app-primary); }
.week-day .wd-num { font-weight: 700; }
.week-day .wd-name { color: var(--app-muted); font-weight: 600; }
.trend-bar.sales, .legend-dot.sales { background: #2a63b0; }
.trend-bar.paid, .legend-dot.paid { background: #2fa7ad; }

/* Phone bottom bar */
.bottom-nav a, .bottom-nav button { color: var(--app-muted); font-weight: 600; }

/* ==========================================================================
   Forms: numbered sections with the explanation on the left, fields on the right
   ========================================================================== */
.form-card { max-width: 1020px; container-type: inline-size; }
form { counter-reset: form-step; }
.form-section-title { color: var(--app-primary); font-weight: 700; font-size: 1.02rem; gap: .6rem; }
.form-section-title i { display: none; }
.form-section-title::before {
    counter-increment: form-step; content: counter(form-step); width: 1.65rem; height: 1.65rem; border-radius: 50%; flex-shrink: 0;
    background: var(--app-primary); color: #fff; font-size: .82rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
[data-bs-theme="dark"] .form-section-title::before { color: #0f1723; }
.form-section-hint { color: var(--app-muted); }
.form-control, .form-select { border-radius: 7px; }
.form-control:hover, .form-select:hover { border-color: var(--app-value); }
.form-actions { position: sticky; bottom: 0; z-index: 5; background: var(--app-surface-2); }
.stage-picker label { border-radius: 8px; font-weight: 600; color: var(--app-text-2); }
.stage-picker label i { color: var(--app-value); }
.stage-picker input:checked + label { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }
.stage-picker input:checked + label i { color: #fff; }
[data-bs-theme="dark"] .stage-picker input:checked + label, [data-bs-theme="dark"] .stage-picker input:checked + label i { color: #0f1723; }
.text-danger:not(.field-validation-error):not(.dropdown-item) { font-weight: 700; }

@container (min-width: 800px) {
    .form-section { position: relative; padding: 1.6rem 1.75rem 1.6rem 17.5rem; min-height: 9.5rem; }
    .form-section-title { position: absolute; left: 1.75rem; top: 1.6rem; width: 14rem; margin: 0; }
    .form-section-hint { position: absolute; left: 1.75rem; top: 3.9rem; width: 13.5rem; margin: 0; font-size: .86rem; }
    .form-section > .form-label:first-of-type { margin-top: 0; }
}

/* Quick picks under a date field */
.quick-picks { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.quick-picks button { border: 1px solid var(--app-border-strong); background: var(--app-surface); color: var(--app-value); border-radius: 99px; padding: .16rem .7rem; font-size: .82rem; font-weight: 600; }
.quick-picks button:hover { background: var(--app-primary-50); border-color: var(--app-primary); }
.quick-picks button.active { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }
[data-bs-theme="dark"] .quick-picks button.active { color: #0f1723; }

/* Pop-ups: a tinted title band */
.modal-header { background: var(--app-head); border-radius: 16px 16px 0 0; padding: 1rem 1.25rem !important; border-bottom: 1px solid var(--app-border) !important; }
.modal-header .modal-title { color: var(--app-primary); font-weight: 700; }
.modal-title .bi { color: var(--app-value) !important; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: .9rem 1.25rem 1.1rem; }
@media (max-width: 575.98px) { .modal:not(#confirmModal) .modal-header { border-radius: 20px 20px 0 0; } }

/* Sign-in */
.auth-body { background: linear-gradient(160deg, #173f78 0%, #1f56a0 55%, #2a63b0 100%); }
.auth-brand { color: #fff; font-weight: 700; }
.auth-card h1 { color: var(--app-primary); font-weight: 700 !important; }
.auth-wrap > p { color: rgba(255, 255, 255, .8) !important; }


/* ---------- Menu sections that fold ---------- */
.nav-group .nav-label {
    display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: 0; text-align: left; cursor: pointer;
    border-radius: 6px; margin-top: .35rem;
}
.nav-group .nav-label:hover { color: #fff; }
.nav-group .nav-label i { font-size: .7rem; opacity: 0; transition: transform .15s, opacity .15s; }
.side-nav:hover .nav-group .nav-label i, .nav-group.folded .nav-label i { opacity: .8; }
.nav-group.folded .nav-label i { transform: rotate(-90deg); }
.nav-group.folded .nav-group-items { display: none; }

/* Icons-only menu shows every item, without section headings */
@media (min-width: 992px) {
    html[data-nav="mini"] .nav-group .nav-label { display: none; }
    html[data-nav="mini"] .nav-group.folded .nav-group-items { display: block; }
    html[data-nav="mini"] .nav-group + .nav-group, html[data-nav="mini"] .side-nav > a + .nav-group { border-top: 1px solid rgba(255, 255, 255, .12); margin-top: .4rem; padding-top: .4rem; }
}
.topbar [data-nav-collapse] { margin-right: .25rem; }

/* New sale on a phone: label the product picker */
@media (max-width: 767.98px) {
    .line-table td:first-child::before { content: "Product"; display: block; font-size: .8rem; color: var(--app-subtle); margin-bottom: .15rem; }
}


/* ==========================================================================
   Pipeline: journey strip and self-explaining columns
   ========================================================================== */
.journey { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-bottom: 1.25rem; }
.journey-step {
    position: relative; display: flex; gap: .8rem; align-items: flex-start; padding: 1rem 1.6rem 1rem 1.25rem; color: inherit;
    background: var(--app-surface); border: 1px solid var(--app-border); border-top: 4px solid var(--g); box-shadow: var(--app-shadow);
}
.journey-step:first-child { border-radius: 10px 0 0 10px; }
.journey-step:last-child { border-radius: 0 10px 10px 0; }
.journey-step + .journey-step { border-left: 0; }
.journey-step:not(:last-child)::after {
    content: "\F285"; font-family: "bootstrap-icons"; position: absolute; right: -14px; top: 50%; transform: translateY(-50%); z-index: 2;
    width: 28px; height: 28px; border-radius: 50%; background: var(--app-surface); border: 1px solid var(--app-border); color: var(--app-muted);
    display: flex; align-items: center; justify-content: center; font-size: .8rem;
}
a.journey-step:hover { background: var(--app-hover); color: inherit; }
.journey-num { width: 2rem; height: 2rem; border-radius: 50%; background: var(--g); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.journey-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.journey-name { font-weight: 700; font-size: 1.05rem; color: var(--app-primary); display: flex; align-items: center; gap: .5rem; }
.journey-count { background: var(--t-gray-bg); color: var(--t-gray-fg); border-radius: 99px; font-size: .78rem; padding: 0 .55rem; font-weight: 700; }
.journey-help { color: var(--app-muted); font-size: .86rem; line-height: 1.4; }
.journey-value { color: var(--app-value); font-weight: 600; font-size: .9rem; margin-top: .15rem; }
@media (max-width: 767.98px) {
    /* Phone: one compact row of stage tabs that jump to each column */
    .journey { gap: .4rem; margin-bottom: 1rem; }
    .journey-step, .journey-step:first-child, .journey-step:last-child { border-radius: 10px; border-left: 1px solid var(--app-border); padding: .55rem .4rem; flex-direction: column; align-items: center; gap: .3rem; text-align: center; }
    .journey-step:not(:last-child)::after { display: none; }
    .journey-num { width: 1.5rem; height: 1.5rem; font-size: .8rem; }
    .journey-name { font-size: .85rem; flex-direction: column; gap: .15rem; }
    .journey-help, .journey-value { display: none; }
    .board-col { scroll-margin-left: 1rem; }
}
.board-col { border-top: 4px solid var(--g); background: var(--app-surface-2); }
.board-head { align-items: flex-start; padding: .85rem .95rem .35rem; }
.board-head h2 { font-size: 1rem; gap: .5rem; }
.board-head h2::before { display: none; }
.board-help { font-size: .8rem; color: var(--app-muted); line-height: 1.35; margin-top: .2rem; }
.board-sum { padding: .1rem .95rem .7rem; }
.board-sum strong { color: var(--app-value); font-weight: 700; }

.kcard { padding: .85rem .9rem .6rem; border-left: 3px solid var(--g, var(--app-border)); }
.kcard-name { font-size: 1rem; }
.kcard-next { display: flex; flex-direction: column; gap: .3rem; margin-top: .6rem; }
.kcard-line { display: flex; align-items: center; gap: .45rem; font-size: .84rem; color: var(--app-text-2); }
.kcard-line i { color: var(--app-subtle); width: 1rem; text-align: center; }
.kcard-line.bad, .kcard-line.bad i { color: var(--app-danger); }
.kcard-line.warn { color: var(--t-amber-fg); font-weight: 600; }
.kcard-line.warn i { color: var(--t-amber-fg); }
a.kcard-line.warn:hover { text-decoration: underline; }
.kcard-line.good, .kcard-line.good i { color: var(--t-green-fg); }
.kcard-foot { margin-top: .65rem; padding-top: .45rem; gap: .1rem; }
.kcard-move { margin-left: auto; display: flex; align-items: center; gap: .15rem; }
.kcard-move .btn-act { min-width: 0; padding: .25rem .65rem; font-size: .82rem; }

/* ---------- Reseller tree (Team page) ---------- */
.tree-cell { display: flex; align-items: center; gap: .55rem; padding-left: calc(var(--depth, 0) * 1.75rem); min-width: 0; }
.tree-branch { color: var(--app-muted); margin-right: -.2rem; line-height: 1; }

/* ---------- Logo (Settings → Logo) ---------- */
.brand-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-logo.has-img { padding: 4px; background: #fff; }
.brand-logo-wide { width: auto; height: 40px; padding: 5px 11px; background: #fff; }
.brand-logo-wide img { width: auto; }
.brand-logo-mark { display: none; }
.brand-name-after { font-size: 1.15rem; letter-spacing: .02em; }
@media (min-width: 992px) {
    html[data-nav="mini"] .brand-logo-wide { display: none; }
    html[data-nav="mini"] .brand-logo-mark { display: inline-flex; }
}
.topbar .brand-logo.has-img { background: #fff; box-shadow: inset 0 0 0 1px var(--app-border); }
.auth-brand .brand-logo { width: 44px; height: 44px; border-radius: 12px; }
.auth-brand .brand-logo-wide { width: auto; height: 60px; padding: 8px 16px; border-radius: 14px; }
.auth-brand .brand-logo-mark { display: none !important; }

.logo-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.logo-picker > input { position: absolute; opacity: 0; pointer-events: none; }
.logo-option { position: relative; display: flex; flex-direction: column; gap: .3rem; padding: 1rem; cursor: pointer; height: 100%; border: 2px solid var(--app-border); transition: border-color .12s, box-shadow .12s; }
.logo-option:hover { border-color: var(--app-primary); }
.logo-picker > input:checked + .logo-option { border-color: var(--app-primary); box-shadow: 0 0 0 3px var(--app-primary-50); }
.logo-picker > input:focus-visible + .logo-option { outline: 2px solid var(--app-primary); outline-offset: 2px; }
.logo-option-check { position: absolute; top: .6rem; right: .6rem; width: 24px; height: 24px; border-radius: 50%; display: none; align-items: center; justify-content: center; background: var(--app-primary); color: #fff; font-size: .9rem; }
.logo-picker > input:checked + .logo-option .logo-option-check { display: inline-flex; }
.logo-option-art { height: 96px; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--app-border); padding: .75rem; margin-bottom: .4rem; }
.logo-option-art img { max-height: 100%; max-width: 100%; }
.logo-option-icon { width: 54px; height: 54px; font-size: 1.6rem; background: #1d4f91 !important; color: #fff !important; border-radius: 14px; }
.logo-option-name { font-weight: 600; }
.logo-option-menu { margin-top: .5rem; display: flex; flex-direction: column; gap: .3rem; }
.logo-option-menu .brand { background: var(--nav-bg); border-radius: 10px; padding: .55rem .7rem; font-size: .95rem; pointer-events: none; }
