/* ===================================================================
   Lead Accounting+ Portal — design system v2
   Light + dark themes, app shell (sidebar + top bar), command palette,
   table power tools, charts, toasts, modals. Every class from v1 is
   still supported so existing views keep working.
   =================================================================== */

:root {
    --bg: #f4f5fb;
    --bg-2: #eceef7;
    --surface: #ffffff;
    --surface-2: #f8f9fd;
    --surface-3: #f1f3f9;
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --muted-2: #94a3b8;
    --line: #e6e8f0;
    --line-2: #d9dce8;
    --brand: #4f46e5;
    --brand-2: #7c3aed;
    --brand-3: #db2777;
    --brand-soft: #eef0ff;
    --brand-ink: #3730a3;
    --ok: #059669;
    --ok-soft: #ecfdf5;
    --ok-line: #a7f3d0;
    --warn: #d97706;
    --warn-soft: #fffbeb;
    --warn-line: #fde68a;
    --bad: #dc2626;
    --bad-soft: #fef2f2;
    --bad-line: #fecaca;
    --info: #0284c7;
    --info-soft: #f0f9ff;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 20px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px -12px rgba(15, 23, 42, .12);
    --shadow-lg: 0 4px 12px rgba(15, 23, 42, .06), 0 24px 48px -16px rgba(79, 70, 229, .18);
    --shadow-pop: 0 10px 40px -10px rgba(15, 23, 42, .35);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Plus Jakarta Sans', var(--font);
    --font-mono: ui-monospace, 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
    --side-w: 256px;
    --side-w-mini: 74px;
    --top-h: 62px;
    --side-bg: linear-gradient(180deg, #0d1326, #131a33);
    --side-ink: #94a3b8;
    --side-ink-hi: #e2e8f0;
    --chart-grid: rgba(15, 23, 42, .07);
    --scroll-thumb: #cbd5e1;
    --focus: rgba(79, 70, 229, .16);
    color-scheme: light;
}

html[data-theme="dark"] {
    --bg: #0b0f1a;
    --bg-2: #0f1424;
    --surface: #121829;
    --surface-2: #171e33;
    --surface-3: #1d2540;
    --ink: #e6e9f2;
    --ink-2: #c7cdd9;
    --muted: #8b95a9;
    --muted-2: #6b7688;
    --line: #232b41;
    --line-2: #2c3550;
    --brand: #6d64ff;
    --brand-2: #9b6bff;
    --brand-3: #f05aa1;
    --brand-soft: #1e2145;
    --brand-ink: #c3c0ff;
    --ok: #34d399;
    --ok-soft: #0e2a22;
    --ok-line: #1c5a45;
    --warn: #fbbf24;
    --warn-soft: #2d2410;
    --warn-line: #6b5314;
    --bad: #f87171;
    --bad-soft: #2f1616;
    --bad-line: #6e2424;
    --info: #38bdf8;
    --info-soft: #0f2536;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, .35), 0 24px 48px -16px rgba(109, 100, 255, .25);
    --shadow-pop: 0 10px 40px -10px rgba(0, 0, 0, .7);
    --side-bg: linear-gradient(180deg, #0a0e1c, #0e1326);
    --chart-grid: rgba(255, 255, 255, .07);
    --scroll-thumb: #334155;
    --focus: rgba(109, 100, 255, .28);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14.5px;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    transition: background .25s, color .25s;
}
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.02em; margin: 0 0 .5em; color: var(--ink); }
a { color: var(--brand); text-decoration: none; }
a:hover { opacity: .9; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.mt1 { margin-top: 12px; } .mb1 { margin-bottom: 12px; }
.mt2 { margin-top: 20px; } .mb2 { margin-bottom: 20px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }
.text-ok { color: var(--ok); } .text-bad { color: var(--bad); } .text-warn { color: var(--warn); } .text-brand { color: var(--brand); }
::selection { background: var(--brand); color: #fff; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* icons (inline SVG sprite) */
.ico { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -3px; }
.ico-sm { width: 15px; height: 15px; }
.ico-lg { width: 22px; height: 22px; }

/* ---------- animated background orbs (auth + public) ---------- */
.bg-orbs { position: fixed; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; }
.bg-orbs i {
    position: absolute; border-radius: 50%; filter: blur(70px); opacity: .35;
    animation: drift 22s ease-in-out infinite alternate;
}
.bg-orbs i:nth-child(1) { width: 420px; height: 420px; background: #c7d2fe; top: -120px; left: -80px; }
.bg-orbs i:nth-child(2) { width: 360px; height: 360px; background: #e9d5ff; bottom: -100px; right: -60px; animation-delay: -7s; }
.bg-orbs i:nth-child(3) { width: 260px; height: 260px; background: #bae6fd; top: 40%; left: 55%; animation-delay: -14s; }
html[data-theme="dark"] .bg-orbs i { opacity: .22; }
html[data-theme="dark"] .bg-orbs i:nth-child(1) { background: #4338ca; }
html[data-theme="dark"] .bg-orbs i:nth-child(2) { background: #7e22ce; }
html[data-theme="dark"] .bg-orbs i:nth-child(3) { background: #0369a1; }
@keyframes drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(60px, -40px) scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* ---------- reveal animation ---------- */
.reveal, .card, .stat, .table-card, .plan-card, .chart-card {
    animation: fadeUp .45s cubic-bezier(.2, .7, .3, 1) both;
}
.stats > *:nth-child(2), .grid-2 > *:nth-child(2), .grid-3 > *:nth-child(2) { animation-delay: .05s; }
.stats > *:nth-child(3), .grid-3 > *:nth-child(3) { animation-delay: .1s; }
.stats > *:nth-child(4) { animation-delay: .15s; }
.stats > *:nth-child(5) { animation-delay: .2s; }
.stats > *:nth-child(6) { animation-delay: .25s; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: -400px 0; } to { background-position: 400px 0; } }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 18px; color: var(--ink); font-weight: 600; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand img.logo-full { width: auto; height: 36px; border-radius: 0; }
.sidebar .brand img.logo-full { height: 30px; }
.brand b { background: linear-gradient(90deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-dark { color: #e2e8f0; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
    font: 600 13.5px var(--font); cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s, border-color .2s, color .2s;
    white-space: nowrap; line-height: 1.25; text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn-primary {
    color: #fff; background: linear-gradient(120deg, var(--brand), var(--brand-2));
    box-shadow: 0 8px 20px -8px rgba(79, 70, 229, .5);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -8px rgba(79, 70, 229, .55); opacity: 1; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted-2); opacity: 1; }
.btn-soft { background: var(--brand-soft); color: var(--brand-ink); }
.btn-soft:hover { filter: brightness(.97); opacity: 1; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { filter: brightness(.95); opacity: 1; }
.btn-danger-soft { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { filter: brightness(.95); opacity: 1; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 36px; height: 36px; border-radius: 10px; }
.btn-icon.btn-sm { width: 30px; height: 30px; padding: 5px; }
.btn[disabled] { opacity: .6; cursor: wait; }
.btn .ico { width: 16px; height: 16px; }
.btn-group { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; }
.btn-group .btn { border-radius: 0; border: 0; border-right: 1px solid var(--line-2); background: var(--surface); color: var(--muted); }
.btn-group .btn:last-child { border-right: 0; }
.btn-group .btn.on, .btn-group .btn:hover { background: var(--brand-soft); color: var(--brand-ink); }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 6px; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field.req label::after { content: " *"; color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
input[type=date], input[type=tel], input[type=url], select, textarea {
    width: 100%; padding: 10px 13px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
    background: var(--surface); font: 500 14px var(--font); color: var(--ink); outline: none;
    transition: border-color .15s, box-shadow .15s, background .2s;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, select:focus, textarea:focus {
    border-color: var(--brand); box-shadow: 0 0 0 4px var(--focus);
}
input[disabled], select[disabled], textarea[disabled] { background: var(--surface-3); color: var(--muted); }
select { appearance: none; -webkit-appearance: none; padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center; }
textarea { min-height: 90px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .form-grid, .form-grid-3 { grid-template-columns: 1fr; } }
.input-icon { position: relative; }
.input-icon .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 36px; }
.input-eye { position: relative; }
.input-eye input { padding-right: 42px; }
.input-eye button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.input-eye button:hover { color: var(--ink); background: var(--surface-3); }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select { width: auto; min-width: 140px; padding: 8px 11px; font-size: 13.5px; }
.filter-bar select { padding-right: 30px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; cursor: pointer; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }

/* switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { width: 40px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .2s; flex-shrink: 0; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + i { background: linear-gradient(120deg, var(--brand), var(--brand-2)); }
.switch input:checked + i::after { transform: translateX(18px); }

/* password strength meter */
.pw-meter { height: 5px; border-radius: 3px; background: var(--surface-3); margin-top: 8px; overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--bad); transition: width .3s, background .3s; }
.pw-meter[data-level="2"] i { width: 50%; background: var(--warn); }
.pw-meter[data-level="3"] i { width: 75%; background: #84cc16; }
.pw-meter[data-level="4"] i { width: 100%; background: var(--ok); }
.pw-meter[data-level="1"] i { width: 25%; }

/* OTP boxes */
.otp-row { display: flex; gap: 10px; justify-content: center; margin: 18px 0; }
.otp-row input {
    width: 48px; height: 56px; text-align: center; font-size: 22px; font-weight: 700;
    border-radius: 12px; padding: 0;
}

/* ---------- flash / toasts ---------- */
.flash {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 500;
    animation: fadeUp .35s both;
}
.flash-ok { background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok-line); }
.flash-err { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad-line); }
.flash-x { background: none; border: 0; font-size: 18px; cursor: pointer; color: inherit; opacity: .6; }
.flash-x:hover { opacity: 1; }
.toasts { position: fixed; top: 16px; right: 16px; z-index: 900; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
    display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
    background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop);
    animation: popIn .25s both; font-size: 13.5px; font-weight: 500; position: relative; overflow: hidden;
}
.toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); }
.toast.ok::before { background: var(--ok); }
.toast.err::before { background: var(--bad); }
.toast.warn::before { background: var(--warn); }
.toast .ico { margin-top: 1px; }
.toast.ok .ico { color: var(--ok); } .toast.err .ico { color: var(--bad); } .toast.warn .ico { color: var(--warn); }
.toast .flash-x { margin-left: auto; font-size: 16px; line-height: 1; }
.toast.leaving { opacity: 0; transform: translateX(20px); transition: all .3s; }

/* ---------- badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 1.4; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--surface-3); color: var(--muted); }
.badge .ico { width: 12px; height: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted-2); }
.dot-ok { background: var(--ok); } .dot-bad { background: var(--bad); } .dot-warn { background: var(--warn); } .dot-brand { background: var(--brand); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--line-2); cursor: pointer; transition: all .15s; text-decoration: none; }
.chip:hover { border-color: var(--muted-2); color: var(--ink); opacity: 1; }
.chip.on { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.chip .count { background: var(--surface-3); color: var(--muted); padding: 0 6px; border-radius: 999px; font-size: 11px; }
.chip.on .count { background: rgba(255,255,255,.5); }
html[data-theme="dark"] .chip.on .count { background: rgba(0,0,0,.25); }

/* health score pill */
.health { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px; padding: 3px 9px 3px 6px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.health i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.health-good { background: var(--ok-soft); color: var(--ok); }
.health-fair { background: var(--warn-soft); color: var(--warn); }
.health-poor { background: var(--bad-soft); color: var(--bad); }
.health-dead { background: var(--surface-3); color: var(--muted); }

/* ---------- cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 22px;
}
.card + .card { margin-top: 20px; }
.card h3 { font-size: 15.5px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.card-head h3 { margin: 0; }
.card-head .sub { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.card-soft { background: var(--surface-2); box-shadow: none; }
.card-accent { border-top: 3px solid var(--brand); }
.card-glass { background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(14px); }
.card.compact { padding: 16px 18px; }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 13.5px; }
.callout .ico { color: var(--brand); margin-top: 1px; }
.callout-warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.callout-warn .ico { color: var(--warn); }
.callout-bad { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.callout-bad .ico { color: var(--bad); }
.callout-ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.callout-ok .ico { color: var(--ok); }
.callout b { display: block; margin-bottom: 2px; }
.callout p { margin: 0; opacity: .85; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px 18px; position: relative; overflow: hidden;
    transition: transform .2s, box-shadow .2s; display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat::after {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
}
.stat small { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; gap: 6px; }
.stat b { display: block; font-size: 26px; font-family: var(--font-display); margin-top: 2px; line-height: 1.15; letter-spacing: -.02em; word-break: break-word; }
.stat .badge { align-self: flex-start; margin-top: 4px; }
.stat .stat-ico { position: absolute; right: 14px; top: 16px; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.stat .stat-ico .ico { width: 18px; height: 18px; }
.stat.stat-warn::after { background: linear-gradient(90deg, #f59e0b, #f97316); }
.stat.stat-warn .stat-ico { background: var(--warn-soft); color: var(--warn); }
.stat.stat-ok::after { background: linear-gradient(90deg, #10b981, #059669); }
.stat.stat-ok .stat-ico { background: var(--ok-soft); color: var(--ok); }
.stat.stat-bad::after { background: linear-gradient(90deg, #ef4444, #dc2626); }
.stat.stat-bad .stat-ico { background: var(--bad-soft); color: var(--bad); }
.stat.stat-info::after { background: linear-gradient(90deg, #0ea5e9, #0284c7); }
.stat.stat-info .stat-ico { background: var(--info-soft); color: var(--info); }
.stat .trend { font-size: 12px; font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }
.trend-up { color: var(--ok); } .trend-down { color: var(--bad); } .trend-flat { color: var(--muted); }
.stat a.stat-link { position: absolute; inset: 0; }
.stat .spark { position: absolute; right: 0; bottom: 0; width: 45%; height: 46px; opacity: .55; pointer-events: none; }
.stat-inline { display: flex; gap: 22px; flex-wrap: wrap; }
.stat-inline > div small { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat-inline > div b { font-size: 18px; font-family: var(--font-display); }

/* progress */
.prog-track { height: 10px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.prog-track > div, .prog-track > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .6s cubic-bezier(.2,.7,.3,1); }
.prog-ok > div { background: linear-gradient(90deg, #10b981, #059669); }
.prog-warn > div { background: linear-gradient(90deg, #f59e0b, #f97316); }
.prog-bad > div { background: linear-gradient(90deg, #ef4444, #dc2626); }
.ring { --p: 0; --c: var(--brand); width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; position: relative;
    background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0); }
.ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--surface); }
.ring b { position: relative; font-family: var(--font-display); font-size: 18px; }
.ring small { position: relative; display: block; font-size: 10px; color: var(--muted); text-align: center; }

/* ---------- tables ---------- */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-card .card-head { padding: 16px 18px 0; }
.table-card + .table-card, .card + .table-card, .table-card + .card { margin-top: 20px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
    text-align: left; padding: 11px 14px; color: var(--muted); font-size: 11.5px;
    text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line);
    background: var(--surface-2); white-space: nowrap; font-weight: 600; position: sticky; top: 0; z-index: 2;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--ink); }
table.data th.sortable::after { content: "↕"; opacity: .35; margin-left: 5px; font-size: 10px; }
table.data th.sort-asc::after { content: "↑"; opacity: 1; color: var(--brand); }
table.data th.sort-desc::after { content: "↓"; opacity: 1; color: var(--brand); }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .15s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr.selected { background: var(--brand-soft); }
table.data td .btn { vertical-align: middle; }
.table-empty { padding: 40px; text-align: center; color: var(--muted); }
.table-empty .ico { width: 34px; height: 34px; color: var(--muted-2); display: block; margin: 0 auto 10px; }
table.data.compact { font-size: 12.5px; }
table.data.compact th { padding: 8px 10px; font-size: 10.5px; }
table.data.compact td { padding: 7px 10px; }
table.data.compact .badge { font-size: 11px; padding: 2px 8px; }
.table-card.dense table.data td { padding: 6px 12px; font-size: 12.5px; }
.table-card.dense table.data th { padding: 8px 12px; }
.cell-main { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; max-width: 240px; white-space: nowrap; }
.cell-sub { display: block; color: var(--muted); font-size: 11.5px; margin-top: 1px; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-check { width: 34px; padding-right: 0 !important; }
.row-check input { width: 15px; height: 15px; accent-color: var(--brand); margin: 0; display: block; }
.table-tools { display: flex; gap: 8px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--surface); }
.table-tools .input-icon { flex: 1; min-width: 180px; max-width: 320px; }
.table-tools .input-icon input { padding: 7px 10px 7px 32px; font-size: 13px; }
.table-tools .count { color: var(--muted); font-size: 12.5px; margin-left: auto; }
.table-tools .tool { background: transparent; border: 1px solid var(--line-2); color: var(--muted); border-radius: 8px; padding: 6px 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font: 600 12px var(--font); }
.table-tools .tool:hover, .table-tools .tool.on { color: var(--brand-ink); background: var(--brand-soft); border-color: transparent; }
.bulk-bar { display: none; gap: 10px; align-items: center; padding: 10px 16px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--line); }
.bulk-bar.on { display: flex; }
.bulk-bar .btn { margin-left: auto; }
.cust-bulk { border-radius: 10px; margin: 10px 0 8px; border: 1px solid var(--line); flex-wrap: wrap; }
.cust-bulk .btn { margin-left: 0; }
.cust-bulk .btn:first-of-type { margin-left: auto; }
tr.filtered-out { display: none; }
.trow-link { cursor: pointer; }

/* mini bar inside cells */
.bar-cell { display: flex; align-items: center; gap: 8px; }
.bar-cell .prog-track { flex: 1; height: 7px; min-width: 60px; }
.bar-cell span { font-size: 12px; color: var(--muted); min-width: 36px; text-align: right; }

/* ---------- pagination ---------- */
.pager { display: flex; gap: 8px; padding: 12px 16px; justify-content: flex-end; align-items: center; border-top: 1px solid var(--line); }
.pager .muted { margin-right: auto; font-size: 12.5px; }

/* ---------- tabs (in-page) ---------- */
.tabbar { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabbar a, .tabbar button { padding: 10px 14px; font: 600 13.5px var(--font); color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tabbar a.on, .tabbar button.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabbar a:hover, .tabbar button:hover { color: var(--ink); opacity: 1; }
.tabbar .count { background: var(--surface-3); color: var(--muted); font-size: 11px; padding: 1px 7px; border-radius: 999px; margin-left: 5px; }
.tab-pane { display: none; }
.tab-pane.on { display: block; animation: fadeIn .25s; }

/* ---------- dropdown / menus ---------- */
.menu { position: relative; }
.menu-pop {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; background: var(--surface); border: 1px solid var(--line);
    border-radius: 14px; box-shadow: var(--shadow-pop); padding: 6px; z-index: 80; display: none; animation: popIn .18s both;
}
.menu.open .menu-pop { display: block; }
.menu-pop a, .menu-pop button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 11px; border-radius: 9px; color: var(--ink); font: 500 13.5px var(--font); background: none; border: 0; cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); opacity: 1; }
.menu-pop .sep { height: 1px; background: var(--line); margin: 5px 0; }
.menu-pop .head { padding: 8px 11px 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.menu-pop .danger { color: var(--bad); }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(2, 6, 23, .55); backdrop-filter: blur(4px); z-index: 500; display: none; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .2s; }
.modal-bg.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-pop); width: 100%; max-width: 480px; padding: 24px; animation: popIn .22s both; max-height: 90vh; overflow: auto; }
.modal h3 { font-size: 17px; margin-bottom: 8px; }
.modal p { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal.wide { max-width: 760px; }

/* drawer (side panel) */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-pop); z-index: 510; transform: translateX(100%); transition: transform .28s cubic-bezier(.2,.7,.3,1); display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 16px; }
.drawer-body { padding: 20px; overflow: auto; flex: 1; }

/* ---------- command palette ---------- */
.palette-bg { position: fixed; inset: 0; background: rgba(2, 6, 23, .5); backdrop-filter: blur(4px); z-index: 600; display: none; padding: 10vh 16px 16px; justify-content: center; align-items: flex-start; }
.palette-bg.open { display: flex; animation: fadeIn .15s; }
.palette { width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-pop); overflow: hidden; animation: popIn .2s both; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.palette-input .ico { color: var(--muted); }
.palette-input input { border: 0; background: transparent; font: 500 16px var(--font); flex: 1; padding: 4px 0; box-shadow: none !important; color: var(--ink); }
.palette-input kbd { font: 600 11px var(--font-mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 6px; background: var(--surface-2); }
.palette-list { max-height: 420px; overflow: auto; padding: 8px; }
.palette-list .group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 12px 4px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--ink); text-decoration: none; }
.palette-item .ico { color: var(--muted); }
.palette-item .pi-ico { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; flex-shrink: 0; }
.palette-item b { display: block; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item small { color: var(--muted); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .pi-main { min-width: 0; flex: 1; }
.palette-item.active, .palette-item:hover { background: var(--brand-soft); opacity: 1; }
.palette-item.active .pi-ico { background: var(--surface); }
.palette-item .badge { margin-left: auto; }
.palette-foot { display: flex; gap: 14px; padding: 8px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.palette-foot kbd { font: 600 10.5px var(--font-mono); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; background: var(--surface-2); margin-right: 3px; }
.palette-empty { padding: 30px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- tooltip ---------- */
[data-tip] { position: relative; }
[data-tip]::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(4px); background: #0f172a; color: #fff; font: 500 12px var(--font); padding: 6px 9px; border-radius: 7px; white-space: nowrap; opacity: 0; pointer-events: none; transition: all .15s; z-index: 90; }
[data-tip]:hover::after { opacity: 1; transform: translateX(-50%); }
[data-tip-right]::after { left: auto; right: 0; transform: translateX(0); }

/* ---------- skeleton ---------- */
.skel { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 800px 100%; animation: shimmer 1.4s infinite linear; border-radius: 8px; height: 14px; }

/* ---------- charts ---------- */
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; min-width: 0; }
.chart-card h3 { font-size: 15px; margin-bottom: 4px; }
.chart-card .sub { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }
.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 320px; }
.chart-box.short { height: 170px; }
.chart-box canvas { max-width: 100%; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 20px; }
.chart-grid .span2 { grid-column: span 2; }
@media (max-width: 760px) { .chart-grid .span2 { grid-column: span 1; } }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: -1px; }

/* ---------- timeline / activity ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .t-ico { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-3); color: var(--muted); display: grid; place-items: center; flex-shrink: 0; }
.timeline .t-ico.ok { background: var(--ok-soft); color: var(--ok); }
.timeline .t-ico.warn { background: var(--warn-soft); color: var(--warn); }
.timeline .t-ico.bad { background: var(--bad-soft); color: var(--bad); }
.timeline .t-ico.brand { background: var(--brand-soft); color: var(--brand); }
.timeline .t-main { flex: 1; min-width: 0; }
.timeline .t-main b { font-weight: 600; }
.timeline .t-main small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.timeline time { color: var(--muted-2); font-size: 11.5px; white-space: nowrap; }

/* ===================================================================
   PUBLIC (landing / pricing) LAYOUT — unchanged look
   =================================================================== */
.public-body { min-height: 100vh; display: flex; flex-direction: column; }
.topnav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px clamp(20px, 6vw, 72px);
}
.topnav nav { display: flex; align-items: center; gap: 22px; }
.topnav nav > a { font-weight: 600; color: var(--ink); font-size: 14px; }
.public-main { flex: 1; padding: 0 clamp(20px, 6vw, 72px) 60px; }
.footer {
    display: flex; justify-content: space-between; padding: 22px clamp(20px, 6vw, 72px);
    border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; background: var(--surface);
}
.hero { text-align: center; padding: clamp(48px, 9vh, 110px) 0 30px; max-width: 860px; margin: 0 auto; }
.hero .eyebrow {
    display: inline-block; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
    background: var(--brand-soft); color: var(--brand); margin-bottom: 20px;
}
.hero h1 { font-size: clamp(34px, 5.5vw, 58px); line-height: 1.08; margin-bottom: 18px; }
.hero h1 span {
    background: linear-gradient(90deg, var(--brand), var(--brand-2), #db2777);
    background-size: 200%; -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: hue 8s linear infinite alternate;
}
@keyframes hue { to { background-position: 100%; } }
.hero p { font-size: 17px; color: var(--muted); max-width: 620px; margin: 0 auto 30px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-cta .btn { padding: 13px 26px; font-size: 15px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin: 56px auto; max-width: 1050px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature .ico { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font-size: 20px; margin-bottom: 14px; }
.feature h3 { font-size: 15px; margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: 13.5px; margin: 0; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; max-width: 1050px; margin: 20px auto 40px; }
.plan-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px; box-shadow: var(--shadow); position: relative; transition: transform .2s, box-shadow .2s; }
.plan-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.plan-card.popular { border: 2px solid var(--brand); }
.plan-card .pop-tag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; font-size: 11px; font-weight: 700; padding: 4px 14px; border-radius: 999px; letter-spacing: .04em; }
.plan-card h3 { font-size: 17px; }
.plan-price { font-family: var(--font-display); font-size: 34px; font-weight: 800; margin: 8px 0 2px; }
.plan-price small { font-size: 13px; color: var(--muted); font-weight: 500; }
.plan-card ul { list-style: none; padding: 0; margin: 18px 0 22px; }
.plan-card li { padding: 7px 0; font-size: 14px; color: var(--ink-2); }
.plan-card li::before { content: "✓"; color: var(--ok); font-weight: 700; margin-right: 9px; }

/* ===================================================================
   AUTH LAYOUT — split screen with brand panel
   =================================================================== */
.auth-body { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-side {
    position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
    padding: 44px 52px; color: #fff;
    background: radial-gradient(1200px 600px at -10% -10%, #6d64ff 0%, transparent 55%),
                radial-gradient(900px 500px at 110% 110%, #9b6bff 0%, transparent 50%),
                linear-gradient(160deg, #0d1326 0%, #1a1f4a 60%, #0d1326 100%);
}
.auth-side::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.12) 1px, transparent 1px); background-size: 26px 26px; opacity: .35; mask-image: linear-gradient(180deg, rgba(0,0,0,.8), transparent 80%); }
.auth-side > * { position: relative; }
.auth-side .brand { color: #fff; }
.auth-side h2 { font-size: clamp(26px, 3vw, 38px); line-height: 1.12; margin: 0 0 14px; color: #fff; max-width: 520px; }
.auth-side p { color: rgba(255,255,255,.72); max-width: 480px; font-size: 15px; line-height: 1.6; margin: 0; }
.auth-points { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 12px; align-items: center; color: rgba(255,255,255,.88); font-size: 14px; }
.auth-points li i { width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,.12); display: grid; place-items: center; flex-shrink: 0; }
.auth-points .ico { width: 16px; height: 16px; }
.auth-quote { border-left: 2px solid rgba(255,255,255,.35); padding-left: 14px; color: rgba(255,255,255,.8); font-size: 13.5px; }
.auth-foot { display: flex; justify-content: space-between; align-items: center; color: rgba(255,255,255,.55); font-size: 12.5px; flex-wrap: wrap; gap: 8px; }
.auth-foot a { color: rgba(255,255,255,.8); }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 24px; position: relative; }
.auth-wrap { width: 100%; max-width: 440px; }
.auth-brand { justify-content: center; width: 100%; margin-bottom: 22px; display: none; }
.auth-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 32px;
}
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.auth-links { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--muted); }
.auth-links a { font-weight: 600; }
.auth-top { position: absolute; top: 18px; right: 20px; display: flex; gap: 8px; }
.auth-bottom { margin-top: 18px; text-align: center; color: var(--muted-2); font-size: 12px; }
@media (max-width: 980px) {
    .auth-body { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .auth-brand { display: inline-flex; }
    .auth-main { min-height: 100vh; }
}

/* login tabs */
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-3); padding: 4px; border-radius: 12px; margin-bottom: 22px; }
.tabs button {
    border: 0; background: transparent; padding: 9px; border-radius: 9px; font: 600 13.5px var(--font);
    color: var(--muted); cursor: pointer; transition: all .2s; display: inline-flex; gap: 8px; align-items: center; justify-content: center;
}
.tabs button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* processing spinner */
.spinner {
    width: 52px; height: 52px; margin: 10px auto 22px; border-radius: 50%;
    border: 4px solid var(--brand-soft); border-top-color: var(--brand);
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-note { text-align: center; color: var(--muted); min-height: 22px; transition: opacity .3s; }
.proc-steps { list-style: none; padding: 0; margin: 20px auto; max-width: 340px; text-align: left; display: grid; gap: 8px; }
.proc-steps li { display: flex; gap: 10px; align-items: center; font-size: 13.5px; color: var(--muted); }
.proc-steps li i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; font-size: 11px; flex-shrink: 0; }
.proc-steps li.on { color: var(--ink); font-weight: 600; }
.proc-steps li.on i { border-color: var(--brand); color: var(--brand); }
.proc-steps li.done { color: var(--ink-2); }
.proc-steps li.done i { background: var(--ok); border-color: var(--ok); color: #fff; }

/* ===================================================================
   APP (portal) LAYOUT — sidebar + top bar
   =================================================================== */
.app-body { display: flex; min-height: 100vh; background: var(--bg); }
.sidebar {
    width: var(--side-w); flex-shrink: 0; display: flex; flex-direction: column;
    background: var(--side-bg);
    padding: 18px 12px 14px; position: sticky; top: 0; height: 100vh; transition: width .22s cubic-bezier(.2,.7,.3,1);
    z-index: 50;
}
.sidebar .brand { margin: 4px 10px 22px; height: 32px; overflow: hidden; }
.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; overflow-x: hidden; padding-right: 2px; }
.side-nav .side-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #5b6784; font-weight: 700; padding: 14px 14px 6px; white-space: nowrap; }
.side-nav a {
    display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
    color: var(--side-ink); font-weight: 500; font-size: 13.5px; transition: all .18s; white-space: nowrap; position: relative;
}
.side-nav a .ico { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.side-nav a i { font-style: normal; width: 20px; text-align: center; opacity: .9; flex-shrink: 0; }
.side-nav a .lbl { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.side-nav a .pill { margin-left: auto; background: rgba(255,255,255,.1); color: #cbd5e1; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.side-nav a .pill.hot { background: var(--bad); color: #fff; }
.side-nav a:hover { color: var(--side-ink-hi); background: rgba(255, 255, 255, .06); opacity: 1; }
.side-nav a.active {
    color: #fff; background: linear-gradient(90deg, rgba(79, 70, 229, .9), rgba(124, 58, 237, .75));
    box-shadow: 0 8px 18px -8px rgba(79, 70, 229, .6);
}
.side-user {
    display: flex; align-items: center; gap: 10px; padding: 12px 6px 2px;
    border-top: 1px solid rgba(255, 255, 255, .08); margin-top: 12px; white-space: nowrap;
}
.avatar {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
    background: linear-gradient(120deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 700; font-size: 14px;
}
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.side-user-info { flex: 1; min-width: 0; }
.side-user-info b { display: block; color: #e2e8f0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-info small { color: #64748b; font-size: 11.5px; }
.side-logout { color: #94a3b8; display: grid; place-items: center; padding: 6px; border-radius: 8px; }
.side-logout:hover { color: #f87171; background: rgba(255,255,255,.06); opacity: 1; }
.side-collapse { background: none; border: 0; color: #64748b; cursor: pointer; display: none; margin: 8px auto 0; padding: 6px; border-radius: 8px; }
.side-collapse:hover { color: #e2e8f0; background: rgba(255,255,255,.06); }

/* collapsed (mini) sidebar on desktop */
html[data-side="mini"] .sidebar { width: var(--side-w-mini); padding-left: 10px; padding-right: 10px; }
html[data-side="mini"] .sidebar .brand { justify-content: center; margin-left: 0; margin-right: 0; }
html[data-side="mini"] .sidebar .brand img.logo-full { display: none !important; }
html[data-side="mini"] .sidebar .brand span { display: inline !important; font-size: 15px; }
html[data-side="mini"] .sidebar .brand span:not(.mini-mark) { display: none !important; }
html[data-side="mini"] .sidebar .brand .mini-mark { display: grid !important; }
html[data-side="mini"] .side-nav a { justify-content: center; padding: 10px 0; }
html[data-side="mini"] .side-nav a .lbl, html[data-side="mini"] .side-nav a .pill, html[data-side="mini"] .side-sec { display: none; }
html[data-side="mini"] .side-nav a[data-tip]::after { left: calc(100% + 10px); bottom: auto; top: 50%; transform: translateY(-50%) translateX(-4px); }
html[data-side="mini"] .side-nav a[data-tip]:hover::after { transform: translateY(-50%); }
html[data-side="mini"] .side-user-info, html[data-side="mini"] .side-logout { display: none; }
html[data-side="mini"] .side-user { justify-content: center; padding-left: 0; padding-right: 0; }
.mini-mark { display: none; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(120deg, var(--brand), var(--brand-2)); color: #fff; place-items: center; font: 800 15px var(--font-display); }

.app-shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 clamp(14px, 2.5vw, 28px);
    background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 40;
    border-bottom: 1px solid var(--line);
}
.topbar .crumbs { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); min-width: 0; }
.topbar .crumbs b { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .crumbs .sep { color: var(--muted-2); }
.topbar .spacer { flex: 1; }
.top-search {
    display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 11px; padding: 7px 12px;
    color: var(--muted); font-size: 13.5px; cursor: pointer; width: clamp(180px, 22vw, 320px); transition: all .15s;
}
.top-search:hover { border-color: var(--muted-2); color: var(--ink); }
.top-search kbd { margin-left: auto; font: 600 11px var(--font-mono); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 6px; background: var(--surface-2); color: var(--muted); }
.top-btn { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; position: relative; transition: all .15s; }
.top-btn:hover { color: var(--ink); border-color: var(--muted-2); opacity: 1; }
.top-btn .n { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; display: none; place-items: center; border: 2px solid var(--bg); }
.top-btn .n.on { display: grid; }
.top-btn .ico-sun { display: none; }
html[data-theme="dark"] .top-btn .ico-sun { display: block; }
html[data-theme="dark"] .top-btn .ico-moon { display: none; }
.notif-pop { width: min(380px, calc(100vw - 32px)); padding: 0; }
.notif-pop .nh { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.notif-pop .nl { max-height: 380px; overflow: auto; }
.notif-pop a.ni { display: flex; gap: 10px; padding: 11px 14px; border-radius: 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.notif-pop a.ni:last-child { border-bottom: 0; }
.notif-pop .ni .dot { margin-top: 6px; flex-shrink: 0; }
.notif-pop .ni b { display: block; font-size: 13.5px; font-weight: 600; }
.notif-pop .ni small { color: var(--muted); font-size: 12px; }
.notif-pop .nempty { padding: 28px; text-align: center; color: var(--muted); font-size: 13.5px; }

.app-main { flex: 1; padding: 24px clamp(14px, 2.5vw, 28px) 40px; max-width: 1280px; min-width: 0; width: 100%; margin: 0 auto; }
.app-main.wide { max-width: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 23px; margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; max-width: 760px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.side-toggle { display: none; }
.side-scrim { display: none; }
@media (max-width: 900px) {
    .side-toggle { display: grid; }
    .sidebar { position: fixed; z-index: 70; transform: translateX(-100%); transition: transform .25s; width: var(--side-w) !important; padding: 18px 12px 14px !important; }
    html[data-side="mini"] .side-nav a { justify-content: flex-start; padding: 9px 12px; }
    html[data-side="mini"] .side-nav a .lbl, html[data-side="mini"] .side-nav a .pill, html[data-side="mini"] .side-sec { display: initial; }
    html[data-side="mini"] .side-user-info, html[data-side="mini"] .side-logout { display: initial; }
    html[data-side="mini"] .sidebar .brand img.logo-full { display: inline !important; }
    html[data-side="mini"] .sidebar .brand .mini-mark { display: none !important; }
    .sidebar.open { transform: none; }
    .side-scrim.on { display: block; position: fixed; inset: 0; background: rgba(2,6,23,.5); z-index: 60; }
    .top-search { width: 40px; padding: 7px; justify-content: center; }
    .top-search span, .top-search kbd { display: none; }
    .topbar .crumbs { display: none; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stat b { font-size: 22px; }
}
@media (max-width: 520px) {
    .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .app-main { padding: 16px 12px 40px; }
    .page-head h1 { font-size: 20px; }
}

/* key/value grid (detail pages) */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kv div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; min-width: 0; }
.kv small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; margin-bottom: 4px; }
.kv b { font-size: 14px; word-break: break-word; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kv .copy { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 5px; display: inline-grid; place-items: center; }
.kv .copy:hover { color: var(--brand); background: var(--brand-soft); }
.copy-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 5px; display: inline-grid; place-items: center; vertical-align: middle; }
.copy-btn:hover { color: var(--brand); background: var(--brand-soft); }

/* secret reveal */
.secret { cursor: pointer; user-select: none; }
.secret[data-hidden="1"] b { filter: blur(5px); }
.secret::after { content: "click to reveal"; display: block; font-size: 10.5px; color: var(--brand); margin-top: 3px; }
.secret[data-hidden="0"]::after { content: "click to hide"; }

/* plan chooser (upgrade page) */
.choose-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.choose-plan {
    border: 2px solid var(--line); border-radius: 14px; padding: 18px; cursor: pointer;
    background: var(--surface); transition: all .18s; position: relative;
}
.choose-plan:hover { border-color: var(--brand-2); }
.choose-plan.selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 10px 24px -12px rgba(79, 70, 229, .4); }
.choose-plan.selected::after { content: "✓"; position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.choose-plan h4 { margin: 0 0 4px; font-size: 15px; }
.choose-plan .p { font-family: var(--font-display); font-weight: 800; font-size: 22px; }
.choose-plan .p small { font-size: 12px; color: var(--muted); font-weight: 500; }
.choose-plan .inc { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.choose-plan input { position: absolute; opacity: 0; }
.choose-plan .tag { position: absolute; top: -10px; left: 14px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; font-size: 10.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.choose-plan ul { list-style: none; padding: 0; margin: 10px 0 0; font-size: 12.5px; color: var(--ink-2); }
.choose-plan li::before { content: "✓ "; color: var(--ok); font-weight: 700; }

.billing-toggle { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 4px; gap: 4px; margin-bottom: 18px; }
.billing-toggle label { padding: 7px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .18s; }
.billing-toggle input { display: none; }
.billing-toggle label.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* pay summary */
.pay-summary { max-width: 520px; margin: 0 auto; }
.pay-lines { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 18px 0; }
.pay-lines div { display: flex; justify-content: space-between; padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.pay-lines div:last-child { border: 0; }
.pay-lines .total { background: var(--brand-soft); font-weight: 700; font-size: 16px; }
.pay-lines .credit { color: var(--ok); }
.quote-live { position: sticky; top: calc(var(--top-h) + 16px); }

/* steps (wizards) */
.steps { display: flex; gap: 8px; margin-bottom: 22px; }
.steps span { flex: 1; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 8px; border-radius: 8px; background: var(--surface-3); }
.steps span.on { background: var(--brand-soft); color: var(--brand-ink); }
.steps span.done { background: var(--ok-soft); color: var(--ok); }

/* nudge (alerts) */
.nudge {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: var(--bad-soft); border: 1px solid var(--bad-line); border-radius: var(--radius);
    padding: 14px 18px; margin-bottom: 20px; animation: fadeUp .4s both;
}
.nudge b { color: var(--bad); font-size: 14.5px; }
.nudge p { margin: 2px 0 0; color: var(--bad); opacity: .85; font-size: 13px; }
.nudge > div { flex: 1; min-width: 220px; }
.nudge.warn { background: var(--warn-soft); border-color: var(--warn-line); }
.nudge.warn b, .nudge.warn p { color: var(--warn); }
.nudge.warn .nudge-dot { background: var(--warn); box-shadow: 0 0 0 0 rgba(217,119,6,.5); }
.nudge.info { background: var(--info-soft); border-color: transparent; }
.nudge.info b, .nudge.info p { color: var(--info); }
.nudge.info .nudge-dot { background: var(--info); animation: none; }
.nudge-dot {
    width: 12px; height: 12px; border-radius: 50%; background: var(--bad); flex-shrink: 0;
    box-shadow: 0 0 0 0 rgba(220, 38, 38, .5); animation: pulse 1.6s infinite;
}
.dot-red {
    width: 8px; height: 8px; border-radius: 50%; background: #f87171; margin-left: auto;
    box-shadow: 0 0 0 0 rgba(248, 113, 113, .6); animation: pulse 1.6s infinite;
}
@keyframes pulse {
    70% { box-shadow: 0 0 0 7px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* danger zone */
.danger-zone { border-color: var(--bad-line); }
.danger-zone h3 { color: var(--bad); }

/* misc */
.divider { height: 1px; background: var(--line); margin: 20px 0; }
.inline-form { display: inline; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; align-items: start; }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-2-1, .grid-1-2 { grid-template-columns: minmax(0, 1fr); } }
kbd.key { font: 600 11px var(--font-mono); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: 2px 6px; background: var(--surface-2); color: var(--muted); }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.empty .ico { width: 36px; height: 36px; color: var(--muted-2); margin-bottom: 10px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list span { background: var(--surface-3); color: var(--ink-2); font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 7px; }
.avatar-row { display: flex; align-items: center; gap: 10px; }
.avatar-row .avatar { width: 30px; height: 30px; font-size: 12.5px; }
.avatar-blue { background: linear-gradient(120deg, #0ea5e9, #2563eb); }
.avatar-green { background: linear-gradient(120deg, #34d399, #059669); }
.avatar-orange { background: linear-gradient(120deg, #fbbf24, #f97316); }
.avatar-pink { background: linear-gradient(120deg, #f472b6, #db2777); }
.expiry-pill { font-variant-numeric: tabular-nums; }

/* cost / azure report specifics */
.cost-delta { font-weight: 700; font-size: 12px; }
.cost-delta.up { color: var(--bad); } .cost-delta.down { color: var(--ok); }
.tree-row td:first-child { padding-left: 30px; color: var(--muted); }
.group-row td { background: var(--surface-2); font-weight: 700; cursor: pointer; }
.group-row td .caret { display: inline-block; transition: transform .2s; margin-right: 6px; color: var(--muted); }
.group-row.open td .caret { transform: rotate(90deg); }
.group-row + .tree-row { display: none; }
.pl-good { color: var(--ok); font-weight: 700; } .pl-bad { color: var(--bad); font-weight: 700; } .pl-none { color: var(--muted); }
.perm-box { background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 12px; padding: 14px 16px; font-size: 13px; }
.perm-box code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-3); padding: 2px 6px; border-radius: 5px; display: inline-block; margin: 2px 0; }
.perm-box pre { background: var(--surface-3); padding: 10px 12px; border-radius: 8px; overflow: auto; font-size: 12px; margin: 8px 0 0; font-family: var(--font-mono); white-space: pre-wrap; }

/* print (receipts) */
@media print {
    .sidebar, .topbar, .page-actions, .toasts, .side-toggle, .no-print { display: none !important; }
    .app-main { padding: 0; max-width: none; }
    body { background: #fff; }
    .card, .table-card { box-shadow: none; }
}

/* theme-specific assets */
.only-dark { display: none !important; }
html[data-theme="dark"] .only-dark { display: inline !important; }
html[data-theme="dark"] .only-light { display: none !important; }

/* fixed-column chart grids */
.chart-grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.chart-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .chart-grid.g4, .chart-grid.g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .chart-grid.g4, .chart-grid.g3 { grid-template-columns: 1fr; } .chart-grid .span2 { grid-column: span 1; } }

/* =====================================================================
   Business OS (CRM, delivery, support, HR)
   ===================================================================== */
.dl { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 0; font-size: 13.5px; }
.dl > span { color: var(--muted); padding: 7px 0; border-bottom: 1px dashed var(--line); }
.dl > b { font-weight: 600; padding: 7px 0; border-bottom: 1px dashed var(--line); word-break: break-word; min-height: 1.2em; }
.dl > span:nth-last-child(2), .dl > b:last-child { border-bottom: 0; }

.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; min-height: 60vh; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.kcol-head { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; position: sticky; top: 0; }
.kcol-head b { font-size: 13px; display: flex; align-items: center; gap: 7px; }
.kcol-head small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.kcol-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; min-height: 80px; transition: background .15s; }
.kcol-body.drop { background: var(--brand-soft); }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 10px 11px; cursor: grab; box-shadow: 0 1px 2px rgba(15,23,42,.04); transition: transform .12s, box-shadow .12s; display: block; color: inherit; }
.kcard:hover { box-shadow: var(--shadow); transform: translateY(-1px); opacity: 1; }
.kcard.dragging { opacity: .45; }
.kcard .t { font-weight: 650; font-size: 13.5px; line-height: 1.3; }
.kcard .s { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kcard .f { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 6px; font-size: 12px; }
.kcard .v { font-weight: 700; }
.kcard.stale { border-left: 3px solid var(--warn, #f59e0b); }
.kcard.late { border-left: 3px solid var(--bad, #ef4444); }

.stage-track { display: flex; gap: 4px; margin: 4px 0 18px; overflow-x: auto; }
.stage-track form { flex: 1; min-width: 96px; }
.stage-track button { width: 100%; border: 0; background: var(--surface-3); color: var(--muted); font: 600 12px var(--font); padding: 9px 8px; cursor: pointer; clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%, 9px 50%); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-track form:first-child button { clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%); border-radius: 8px 0 0 8px; }
.stage-track button.done { background: var(--brand-soft); color: var(--brand); }
.stage-track button.cur { background: var(--brand); color: #fff; }
.stage-track button:disabled { cursor: default; }
.stage-track button:not(:disabled):hover { filter: brightness(.96); }

.checklist .ci { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.checklist .ci:last-child { border-bottom: 0; }
.checklist .ci label { font-size: 13.5px; }
.checklist .ci input[type=text], .checklist .ci input[type=number], .checklist .ci input[type=date], .checklist .ci select { margin-top: 5px; }
.checklist .ci .req { color: var(--bad, #ef4444); }
.checklist .ci .by { color: var(--muted); font-size: 11.5px; }

.task-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row .ticon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.task-row.overdue .ticon { background: rgba(239,68,68,.12); color: #ef4444; }
.task-row.done { opacity: .6; }
.task-row .tt { font-weight: 600; font-size: 13.5px; }
.task-row .ts { color: var(--muted); font-size: 12px; }

.quote-lines input { min-width: 0; }
.quote-lines td { vertical-align: top; }
.q-paper { background: #fff; color: #0f172a; max-width: 880px; margin: 0 auto; padding: 36px 40px; border-radius: 14px; box-shadow: var(--shadow); font-size: 13.5px; }
.q-paper table { width: 100%; border-collapse: collapse; }
.q-paper th, .q-paper td { padding: 8px 10px; border-bottom: 1px solid #e6e8f0; text-align: left; }
.q-paper th { background: #f4f5fb; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #475569; }
.q-paper .num { text-align: right; }
@media print { .no-print { display: none !important; } .q-paper { box-shadow: none; padding: 0; } body { background: #fff !important; } }
.hero-greet { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.hero-greet h1 { margin: 0; font-size: 26px; }
.qa { display: flex; gap: 8px; flex-wrap: wrap; }
.task-row > div:last-child { position: relative; }
.menu-inline > summary { list-style: none; } .menu-inline > summary::-webkit-details-marker { display: none; }
.prog-track > span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .6s cubic-bezier(.2,.7,.3,1); }
.prog-track > span.prog-ok { background: linear-gradient(90deg, #10b981, #059669); }
.prog-track > span.prog-warn { background: linear-gradient(90deg, #f59e0b, #f97316); }
.prog-track > span.prog-bad { background: linear-gradient(90deg, #ef4444, #dc2626); }

/* ---------- Gamification: leaderboard, levels, badges, tiers ---------- */
.lb-hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 900px) { .lb-hero { grid-template-columns: 1fr; } }
.lb-me { display: flex; align-items: center; gap: 18px; padding: 18px 20px; border-radius: 18px; color: #fff; background: linear-gradient(120deg, var(--brand), var(--brand-2) 60%, var(--brand-3)); box-shadow: var(--shadow-pop); position: relative; overflow: hidden; }
.lb-me::after { content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.12); }
.lb-me .muted, .lb-me .small { color: rgba(255,255,255,.8); }
.lb-me b { color: #fff; }
.ring { --p: 0; width: 72px; height: 72px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255,255,255,.25) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: rgba(15,23,42,.35); backdrop-filter: blur(2px); }
.ring span { position: relative; font-weight: 800; font-size: 24px; color: #fff; }
.ring.lg { width: 92px; height: 92px; } .ring.lg span { font-size: 30px; }
.lb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lb-me .chip { background: rgba(255,255,255,.16); border-color: transparent; color: #fff; cursor: default; }
.chip-fire { background: linear-gradient(120deg, #f97316, #ef4444) !important; color: #fff !important; border-color: transparent !important; }
.chip.sm { padding: 2px 8px; font-size: 11.5px; }
.lb-spot { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.lb-spot > div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.lb-spot small { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.lb-spot b { font-size: 17px; }
.lb-badge-row { display: flex; gap: 6px; margin-top: 4px; }
.podium { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; align-items: end; margin: 6px 0 16px; }
.podium-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 10px 0; border-radius: 16px 16px 0 0; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; text-decoration: none; color: var(--ink); transition: transform .18s; }
.podium-slot:hover { transform: translateY(-3px); }
.podium-slot.empty { border: 0; background: transparent; }
.podium-slot .avatar { width: 54px; height: 54px; font-size: 20px; }
.podium-slot.p1 .avatar { width: 68px; height: 68px; font-size: 24px; background: linear-gradient(120deg, #f59e0b, #ef4444); box-shadow: 0 0 0 4px rgba(245,158,11,.25); }
.podium-slot.p2 .avatar { background: linear-gradient(120deg, #94a3b8, #64748b); } .podium-slot.p3 .avatar { background: linear-gradient(120deg, #d97706, #92400e); }
.podium-pts { font-weight: 800; font-size: 18px; } .podium-pts small { color: var(--muted); font-weight: 500; }
.podium-base { width: 100%; text-align: center; padding: 8px; margin-top: 6px; font-size: 20px; border-radius: 10px 10px 0 0; background: var(--surface-3); }
.p1 .podium-base { padding: 18px; background: linear-gradient(180deg, #fde68a, #fbbf24); } .p2 .podium-base { padding: 12px; } .p3 .podium-base { padding: 8px; }
.rank { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-weight: 700; font-size: 13px; background: var(--surface-3); color: var(--muted); }
.rank.r1 { background: linear-gradient(120deg, #fde68a, #f59e0b); color: #7c2d12; } .rank.r2 { background: linear-gradient(120deg, #e2e8f0, #94a3b8); color: #1e293b; } .rank.r3 { background: linear-gradient(120deg, #fdba74, #b45309); color: #fff; }
.lvl { display: inline-block; padding: 2px 7px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: 11.5px; }
tr.row-me td { background: var(--brand-soft) !important; }
.area-bars { display: flex; gap: 3px; height: 10px; align-items: stretch; min-width: 120px; }
.area-bars .ab { --w: 0%; width: var(--w); min-width: 6px; border-radius: 3px; opacity: .9; }
.ab-sales { background: #4f46e5; } .ab-delivery { background: #0ea5e9; } .ab-support { background: #10b981; } .ab-work { background: #f59e0b; } .ab-hr { background: #ec4899; } .ab-learning { background: #8b5cf6; } .ab-team { background: #ef4444; } .ab-partner { background: #64748b; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.badge-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; font-weight: 600; text-align: center; transition: transform .15s; }
.badge-tile:hover { transform: translateY(-2px); }
.badge-tile .ico { width: 26px; height: 26px; padding: 8px; box-sizing: content-box; border-radius: 50%; color: #fff; }
.badge-tile.tier-bronze .ico { background: linear-gradient(120deg, #d97706, #92400e); } .badge-tile.tier-silver .ico { background: linear-gradient(120deg, #94a3b8, #475569); } .badge-tile.tier-gold .ico { background: linear-gradient(120deg, #fbbf24, #d97706); }
.badge-tile.locked { opacity: .45; filter: grayscale(1); } .badge-tile.locked:hover { opacity: .7; }
.badge-tile.sm { padding: 4px; border: 0; background: transparent; } .badge-tile.sm .ico { width: 16px; height: 16px; padding: 6px; }
.progress-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.progress-row:last-child { border-bottom: 0; } .progress-row .bar { grid-column: 1 / -1; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .6s ease; }
.lb-me .bar { background: rgba(255,255,255,.25); } .lb-me .bar i { background: #fff; }
.kudos-wall { display: flex; flex-direction: column; gap: 8px; }
.kudo { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; }
.kudo .ico { color: #ef4444; flex: 0 0 auto; margin-top: 2px; }
.level-track { display: flex; flex-wrap: wrap; gap: 6px; }
.level-track span { padding: 4px 10px; border-radius: 999px; font-size: 12px; background: var(--surface-3); color: var(--muted); }
.level-track span.done { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.tier { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; }
.tier-platinum { background: linear-gradient(120deg, #6366f1, #0ea5e9); } .tier-gold { background: linear-gradient(120deg, #f59e0b, #d97706); } .tier-silver { background: linear-gradient(120deg, #94a3b8, #64748b); } .tier-bronze { background: linear-gradient(120deg, #b45309, #78350f); }
.tier-badge { width: 84px; height: 84px; border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #fff; font-weight: 800; font-size: 12px; flex: 0 0 auto; box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.tier-badge .ico { width: 30px; height: 30px; }
.stat.tier-stat small { color: inherit; opacity: .85; } .stat.tier-stat { color: #fff; } .stat.tier-stat b { color: #fff; } .stat.tier-stat .muted { color: rgba(255,255,255,.8); }
.score-bar { display: flex; height: 10px; border-radius: 4px; overflow: hidden; background: var(--surface-3); min-width: 140px; }
.score-bar i { display: block; height: 100%; }
.legend .lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin: 0 4px 0 10px; vertical-align: -1px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; } .modal-head h3 { margin: 0; }
.tips p { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; } .tips .ico { color: var(--brand); flex: 0 0 auto; margin-top: 2px; }
.kudos-quick button { opacity: .35; } tr:hover .kudos-quick button { opacity: 1; }

/* points toasts + celebration */
.pts-toast { position: fixed; right: 18px; bottom: 18px; z-index: 900; display: flex; flex-direction: column; gap: 8px; }
.pts-toast .pt { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: var(--shadow-pop); animation: ptIn .35s cubic-bezier(.2,.9,.3,1.3) both; font-size: 13.5px; max-width: 320px; }
.pts-toast .pt b { font-size: 16px; color: #a7f3d0; white-space: nowrap; }
.pts-toast .pt.badge-pt { background: linear-gradient(120deg, #f59e0b, #ef4444); } .pts-toast .pt.badge-pt b { color: #fff; }
.pts-toast .pt .ico { flex: 0 0 auto; }
@keyframes ptIn { from { transform: translateY(20px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 899; }
.game-strip { display: grid; grid-template-columns: 1.3fr repeat(3, 1fr) 1.6fr; gap: 10px; margin: 0 0 14px; }
@media (max-width: 1100px) { .game-strip { grid-template-columns: 1fr 1fr; } } @media (max-width: 640px) { .game-strip { grid-template-columns: 1fr; } }
.gs-level { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; color: #fff; text-decoration: none; background: linear-gradient(120deg, var(--brand), var(--brand-2)); box-shadow: var(--shadow-pop); }
.gs-level .ring { width: 52px; height: 52px; } .gs-level .ring span { font-size: 18px; } .gs-level b { display: block; font-size: 15px; } .gs-level .small { color: rgba(255,255,255,.8); }
.gs-item { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: transform .15s, box-shadow .15s; }
a.gs-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.gs-item small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.gs-item b { font-size: 18px; display: flex; align-items: center; gap: 6px; } .gs-item b span { font-size: 12px; color: var(--muted); font-weight: 500; }
.gs-item .small { color: var(--muted); } .gs-item .bar { margin: 4px 0 2px; }
.gs-ways .chips { margin-top: 4px; } .gs-ways .chip { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.tier-strip { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: 18px; color: #fff; text-decoration: none; margin-bottom: 14px; box-shadow: var(--shadow-pop); }
.tier-strip .tier-badge { width: 60px; height: 60px; border-radius: 16px; background: rgba(255,255,255,.18); box-shadow: none; } .tier-strip .tier-badge .ico { width: 24px; height: 24px; }
.tier-strip b { display: block; font-size: 16px; color: #fff; } .tier-strip .small { color: rgba(255,255,255,.85); } .tier-strip .bar { background: rgba(255,255,255,.25); margin-top: 6px; max-width: 420px; } .tier-strip .bar i { background: #fff; }
.pulse-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; } @media (max-width: 800px) { .pulse-row { grid-template-columns: 1fr; } }
.pulse-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: transform .15s, box-shadow .15s; }
.pulse-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.pulse-card > small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: 11px; }
.pulse-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; } .pulse-line .rank { width: 24px; height: 24px; font-size: 11.5px; }
.grow { flex: 1; }

/* ---------- UX polish ---------- */
.kmeta { display: flex; align-items: center; gap: 6px; }
.avatar.xs { width: 22px; height: 22px; font-size: 10px; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; background: var(--surface-3); color: var(--muted); }
.pill-saas { background: #e0f2fe; color: #075985; } .pill-lifetime { background: #ede9fe; color: #5b21b6; } .pill-rfid { background: #fef3c7; color: #92400e; } .pill-custom { background: #fce7f3; color: #9d174d; }
[data-theme="dark"] .pill-saas { background: #0c4a6e; color: #bae6fd; } [data-theme="dark"] .pill-lifetime { background: #4c1d95; color: #ddd6fe; } [data-theme="dark"] .pill-rfid { background: #78350f; color: #fde68a; } [data-theme="dark"] .pill-custom { background: #831843; color: #fbcfe8; }
.table-empty { padding: 44px 20px; }
.table-empty::before { content: ""; display: block; width: 84px; height: 64px; margin: 0 auto 10px; opacity: .55; background: no-repeat center / contain url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 84 64' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='10' y='14' width='64' height='42' rx='8' fill='%23eef0ff' stroke='%23a5b4fc'/><path d='M10 30h18l5 7h18l5-7h18' stroke='%23a5b4fc'/><path d='M30 8l3-4M54 8l-3-4M42 6V2' stroke='%23c7d2fe'/></svg>"); }
.table-empty b { color: var(--ink-2); }
.app-main > * { animation: pageIn .28s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.stat { transition: transform .15s, box-shadow .15s; } .stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
table.data tbody tr[data-href] { transition: background .12s; }
.btn-primary:active { transform: translateY(0) scale(.98); }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 4px var(--brand-soft) !important; }
/* sticky save bar for long forms */
.save-bar { position: sticky; bottom: 12px; z-index: 40; display: none; align-items: center; gap: 12px; margin-top: 14px; padding: 10px 14px 10px 16px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: var(--shadow-pop); animation: ptIn .3s both; }
.save-bar.on { display: flex; }
.save-bar .sb-text { flex: 1; font-size: 13.5px; } .save-bar .sb-text b { color: #fde68a; }
.save-bar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.3); }
.save-bar .prog { width: 120px; height: 6px; border-radius: 999px; background: rgba(255,255,255,.2); overflow: hidden; } .save-bar .prog i { display: block; height: 100%; background: #a7f3d0; transition: width .3s; }
/* ---------- partner programme ---------- */
.choice-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice-card { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px 12px 38px; border: 1.5px solid var(--line-2); border-radius: 12px; cursor: pointer; position: relative; font-weight: 400 !important; transition: border-color .15s, background .15s; }
.choice-card input { position: absolute; left: 12px; top: 14px; }
.choice-card b { font-size: 14px; color: var(--ink); } .choice-card span { font-size: 12px; color: var(--muted); }
.choice-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.plan-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: transform .15s, box-shadow .15s; position: relative; }
.plan-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.plan-card.inactive { opacity: .55; }
.plan-card h3 { margin: 0; font-size: 16px; } .plan-card .terms { font-size: 12.5px; color: var(--ink-2); margin: 0; padding-left: 16px; } .plan-card .terms li { margin: 2px 0; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.method-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.m-flat { background: #e0f2fe; color: #075985; } .m-slab { background: #ede9fe; color: #5b21b6; } .m-fixed { background: #fef3c7; color: #92400e; }
.slab-viz { display: flex; align-items: flex-end; gap: 4px; height: 70px; margin: 6px 0; }
.slab-viz div { flex: 1; background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-radius: 6px 6px 0 0; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: flex-start; justify-content: center; padding-top: 4px; min-height: 18px; }
.slab-rows .slab-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 6px; }
.agreement-paper { max-width: 820px; margin: 0 auto; background: #fff; color: #0f172a; border-radius: 14px; padding: 36px 40px; box-shadow: 0 10px 40px rgba(15,23,42,.08); line-height: 1.6; font-size: 14.5px; }
.agreement-paper h4 { margin: 18px 0 4px; font-size: 14.5px; }
.onb-progress { display: flex; align-items: center; gap: 12px; }
.onb-progress .bar { flex: 1; }
.next-step { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: 16px; background: linear-gradient(120deg, var(--brand-soft), transparent); border: 1px solid var(--line); margin-bottom: 14px; }
.next-step .ns-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: #fff; flex: 0 0 auto; }
.next-step b { display: block; font-size: 15px; }
.tl-item { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; } .tl-item:last-child { border-bottom: 0; }
.field label.choice-card { display: flex; margin-bottom: 0; }
.choice-card b, .choice-card span { display: block; }
/* task rows: done form opens inline under the row (no floating popup behind other cards) */
.task-row .tmain { min-width: 0; }
.task-row .tmain .tt, .task-row .toutcome { overflow-wrap: anywhere; }
.task-row .tclient { display: inline-block; font-size: 11.5px; font-weight: 700; color: var(--brand); text-transform: none; margin-bottom: 1px; }
.task-row .tdone { display: none; grid-column: 1 / -1; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.task-row.closing .tdone { display: grid; gap: 8px; }
.task-row .tdone textarea { width: 100%; }
.tx-table tr.tx-superseded td { opacity: .45; text-decoration: line-through; }
.tx-table tfoot th { border-top: 2px solid var(--line-2); }
.tx-edit { display: inline-block; } .tx-edit > summary { list-style: none; display: inline-flex; } .tx-edit > summary::-webkit-details-marker { display: none; }
.tx-edit[open] { display: block; }
.tx-edit-form { margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); min-width: 520px; white-space: normal; }

/* Sync from LEAD */
.sync-hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.sync-hero small { letter-spacing: .06em; font-size: 11px; }
.sync-hero #syncState b { font-size: 1.05rem; }
.sync-hero .spinner { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }

/* hints under form fields wrap (cell-sub is nowrap for table cells) */
.field .cell-sub { white-space: normal; overflow-wrap: anywhere; }

/* referral link box */
.ref-link { display: flex; gap: 8px; }
.ref-link input { flex: 1; min-width: 0; }

/* reschedule a task inline */
.task-row .tresched { display: none; grid-column: 1 / -1; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.task-row.resched .tresched { display: grid; gap: 8px; }
.task-day { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 12px 0 4px; }
.task-day:first-child { margin-top: 0; }
.task-day.bad { color: var(--bad); } .task-day.now { color: var(--brand); } .task-day.muted { opacity: .7; }
.deal-chatter .timeline { max-height: 560px; overflow-y: auto; }

/* deal page — form sheet on the left, chatter on the right */
.deal-odoo { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1000px) { .deal-odoo { grid-template-columns: minmax(0, 1fr); } }
.deal-sheet { padding-top: 22px; }
.deal-title { font-size: 30px; line-height: 1.15; margin: 0 0 16px; letter-spacing: -.01em; }
.deal-rev { display: flex; gap: 36px; flex-wrap: wrap; margin-bottom: 18px; }
.deal-rev small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.deal-rev b { font-size: 22px; }
.deal-rev .muted.small { display: block; margin-top: 2px; }
.deal-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 28px; margin-bottom: 18px; }
@media (max-width: 640px) { .deal-fields { grid-template-columns: minmax(0, 1fr); } }
.deal-sheet .tabbar { margin-top: 4px; }
.chatter { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; }
.chatter-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chatter-btns .btn-ghost.on { background: var(--brand-soft, var(--surface-2)); color: var(--brand); }
.ch-pane { margin-bottom: 10px; }
.ch-pane .card.compose { box-shadow: none; border: 1px solid var(--line); margin: 0; }
.ch-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 600; margin: 16px 0 10px; }
.ch-sep::before, .ch-sep::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.ch-msg { display: flex; gap: 10px; margin-bottom: 14px; }
.ch-msg .avatar.sm { flex: none; width: 30px; height: 30px; font-size: 11px; }
.ch-msg .ch-text { font-size: 14px; white-space: pre-wrap; line-height: 1.5; }
.ch-msg.stage .ch-text, .ch-msg.task .ch-text { color: var(--muted); font-size: 13px; }
.src-table input[type=text] { padding: 6px 10px; font-size: 14px; }
.src-table td { vertical-align: middle; }

/* ---------- Website chat inbox ---------- */
.wc { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 16px; align-items: start; }
.wc > .card { margin: 0; }
.wc-side { padding: 12px; position: sticky; top: 76px; max-height: calc(100vh - 100px); display: flex; flex-direction: column; }
.wc-views { margin-bottom: 10px; flex-wrap: wrap; }
.wc-views .chip b { font-weight: 700; margin-left: 2px; }
.wc-list { overflow-y: auto; margin: 0 -6px; }
.wc-item { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: var(--radius-sm); color: inherit; text-decoration: none; border: 1px solid transparent; }
.wc-item:hover { background: var(--surface-2); }
.wc-item.on { background: var(--brand-soft); border-color: var(--line); }
.wc-item .avatar { position: relative; flex: none; }
.wc-item .wc-it { min-width: 0; }
.wc-item .wc-it b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-item .cell-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.wc-item.unread .cell-sub { color: var(--ink); font-weight: 600; }
.wc-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.wc-pill { background: var(--bad); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.wc-on, .wc-dot.on { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); border: 2px solid var(--surface); }
.wc-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted-2); vertical-align: middle; }
.wc-dot.on { position: static; border: 0; box-shadow: 0 0 0 3px var(--ok-soft); }
.wc-main { padding: 0; display: flex; flex-direction: column; min-height: calc(100vh - 230px); }
.wc-main > #wcChat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.wc-main > #wcChat[hidden] { display: none; }
.wc-empty { margin: auto; text-align: center; padding: 60px 20px; color: var(--muted); }
.wc-head { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wc-name { margin: 0 0 2px; font-size: 20px; }
.wc-links { margin-top: 6px; }
.wc-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.wc-msgs { flex: 1; overflow-y: auto; padding: 18px; max-height: calc(100vh - 380px); min-height: 280px; background: var(--surface-2); }
.wc-msg { display: flex; flex-direction: column; max-width: 74%; margin-bottom: 12px; }
.wc-msg.us { margin-left: auto; align-items: flex-end; }
.wc-bub { padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; background: var(--surface); border: 1px solid var(--line); }
.wc-msg.them .wc-bub { border-bottom-left-radius: 4px; }
.wc-msg.us .wc-bub { background: var(--brand); color: #fff; border-color: var(--brand); border-bottom-right-radius: 4px; }
.wc-msg.us .wc-bub a { color: #fff; text-decoration: underline; }
.wc-msg.bot .wc-bub { background: var(--info-soft); color: var(--ink); border-color: var(--line); }
.wc-msg.bot .wc-bub a { color: var(--info); }
.wc-by { margin-top: 3px; font-size: 11.5px; }
.wc-sys { text-align: center; margin: 10px 0 14px; }
.wc-sys span { font-size: 12px; color: var(--muted); background: var(--surface-3); padding: 3px 10px; border-radius: 999px; }
.wc-typing { padding: 4px 18px; }
.wc-compose { display: flex; gap: 10px; align-items: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); }
.wc-compose textarea { flex: 1; resize: vertical; min-height: 44px; }
.wc-quick { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 18px 14px; }
.wc-quick button { font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.wc-quick button:hover { border-color: var(--brand); color: var(--brand); }
@media (max-width: 900px) {
    .wc { grid-template-columns: 1fr; }
    .wc-side { position: static; max-height: 320px; }
    .wc-msg { max-width: 90%; }
    .wc-msgs { max-height: 60vh; }
}

/* ---------- Sales → implementation hand-off (trial setup / install before closing) ---------- */
.impl-card { border-left: 4px solid #0d9488; }
.impl-card .card-head h3 { margin: 0; }
.impl-card .dl { margin-top: 6px; }
.impl-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.impl-done { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); display: grid; gap: 6px; }
.impl-done textarea { width: 100%; }
.impl-done .btn { justify-self: start; }
details.impl-send > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
details.impl-send > summary::-webkit-details-marker { display: none; }
details.impl-send > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.impl-send[open] > summary::before { transform: rotate(90deg); }
details.impl-send > form { margin-top: 12px; }
.stage-track button.handoff { border-style: dashed; }
.stage-track button.handoff.cur { background: #0d9488; border-color: #0d9488; color: #fff; }
