/* DigiMonk CRM — design system. Brand: Charcoal #333333 · Red #EC1A3C · Deep red #CE002C · Light gray #E6E6E6 · White. Font: Poppins. */

:root {
  --red: #EC1A3C; --deep: #CE002C; --grad: linear-gradient(135deg, #EC1A3C 0%, #CE002C 100%);
  --red-tint: #FDE8EC; --ink: #333333; --ink-2: #5c5c5c; --muted: #8a8a8a; --line: #E6E6E6; --line-2: #EFEFEF;
  --bg: #F7F7F7; --surface: #FFFFFF; --surface-2: #FAFAFA; --hover: #F4F4F4;
  --ok: #1E9E5A; --ok-tint: #E5F6EC; --warn: #B7791F; --warn-tint: #FDF3E1;
  --radius: 12px; --radius-sm: 8px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04); --shadow-lg: 0 18px 50px rgba(0,0,0,.16);
  --side: 248px; --top: 64px;
  --font: 'Poppins', Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #F2F2F2; --ink-2: #CFCFCF; --muted: #9A9A9A; --line: #2F2F2F; --line-2: #262626;
  --bg: #141414; --surface: #1C1C1C; --surface-2: #202020; --hover: #262626; --red-tint: #3A1219;
  --ok-tint: #12301F; --warn-tint: #33280F; --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 18px 50px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
:lang(ta) { font-family: 'Noto Sans Tamil', var(--font); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
input, select, textarea { font: inherit; color: var(--ink); }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 24px; } h3 { font-size: 15px; font-weight: 600; } h4 { font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
code, kbd { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--hover); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; } .red { color: var(--red); } .nowrap { white-space: nowrap; }
.pos { color: var(--ok); } .neg { color: var(--red); } .late { color: var(--red); font-weight: 600; }
.ic { width: 18px; height: 18px; flex: none; }
.link { color: var(--red); font-weight: 500; } .link:hover { color: var(--deep); text-decoration: underline; }
.pad { padding: 16px 18px; margin: 0; } .pad-x { padding: 0 18px; }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--red); color: #fff; }

/* ---------------- buttons ---------------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: 13.5px; border: 1px solid transparent; transition: transform .12s, background .15s, box-shadow .15s, border-color .15s; white-space: nowrap; position: relative; }
.btn:active { transform: scale(.97); }
.btn .ic { width: 16px; height: 16px; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(236,26,60,.28); }
.btn.primary:hover { box-shadow: 0 6px 20px rgba(236,26,60,.4); }
.btn.ghost { background: var(--surface); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink-2); background: var(--hover); }
.btn.danger { background: var(--surface); color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.wa { background: #1E9E5A; color: #fff; } .btn.wa:hover { background: #17824a; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; justify-content: center; padding: 12px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn.loading { color: transparent !important; } .btn.loading::after { content: ''; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border: 2px solid #fff; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.ghost.loading::after { border-color: var(--ink); border-right-color: transparent; }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; color: var(--ink-2); transition: background .15s, color .15s; position: relative; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.sm { width: 30px; height: 30px; } .icon-btn.sm .ic { width: 15px; height: 15px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- login ---------------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.login-art { background: #1d1d1d; color: #fff; position: relative; overflow: hidden; display: flex; align-items: center; padding: 56px; }
.login-art::before { content: ''; position: absolute; width: 620px; height: 620px; right: -220px; top: -180px; border-radius: 50%; background: radial-gradient(circle, rgba(236,26,60,.55), transparent 65%); filter: blur(10px); animation: float 9s ease-in-out infinite alternate; }
.login-art::after { content: ''; position: absolute; width: 420px; height: 420px; left: -160px; bottom: -160px; border-radius: 50%; background: radial-gradient(circle, rgba(206,0,44,.45), transparent 65%); animation: float 11s ease-in-out infinite alternate-reverse; }
@keyframes float { to { transform: translate(-40px, 50px) scale(1.08); } }
.login-copy { position: relative; z-index: 1; max-width: 480px; }
.login-copy h1 { font-size: clamp(34px, 4vw, 52px); line-height: 1.08; margin: 10px 0 18px; }
.login-copy h1 span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-copy p { color: #cfcfcf; font-size: 15px; }
.login-copy ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.login-copy li { display: flex; align-items: center; gap: 12px; color: #eee; }
.login-copy li .ic { color: var(--red); background: rgba(255,255,255,.07); padding: 7px; width: 34px; height: 34px; border-radius: 9px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 600; color: var(--red); margin: 0; }
.eyebrow.light { color: #ff8da0; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(24px, 6vw, 88px); position: relative; }
.login-logo { position: absolute; top: 22px; right: 26px; } .login-logo img { height: 46px; display: block; }
.login-form { width: 100%; max-width: 380px; margin: 0 auto; display: grid; gap: 14px; }
.login-form h2 { font-size: 28px; } .login-form > p.muted { margin: -10px 0 6px; }
.login-err { background: var(--red-tint); color: var(--deep); padding: 10px 12px; border-radius: 9px; margin: 0; font-weight: 500; }
.pw { position: relative; } .pw .icon-btn { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); }
.shake { animation: shake .4s; } @keyframes shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-4px); } }
:root[data-theme="dark"] .login-logo, :root[data-theme="dark"] .top-logo { background: #fff; border-radius: 10px; padding: 5px 9px; }

/* ---------------- shell ---------------- */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 40; transition: transform .25s; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; height: var(--top); border-bottom: 1px solid var(--line); }
.side-brand b { display: block; font-size: 15px; } .side-brand small { color: var(--muted); font-size: 11px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 17px; box-shadow: 0 4px 12px rgba(236,26,60,.35); }
.side-close { display: none; margin-left: auto; }
.side nav { flex: 1; overflow-y: auto; padding: 10px 12px 20px; }
.nav-sec p { margin: 16px 10px 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; }
.nav-sec a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--ink-2); font-weight: 500; transition: background .15s, color .15s; position: relative; }
.nav-sec a:hover { background: var(--hover); color: var(--ink); }
.nav-sec a.on { background: var(--red-tint); color: var(--red); font-weight: 600; }
.nav-sec a.on::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--red); }
.badge { margin-left: auto; background: var(--red); color: #fff; font-style: normal; font-size: 11px; font-weight: 600; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; }
.side-foot { border-top: 1px solid var(--line); padding: 10px; }
.me-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; text-align: left; }
.me-btn:hover { background: var(--hover); } .me-btn div { flex: 1; min-width: 0; } .me-btn b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .me-btn small { color: var(--muted); text-transform: capitalize; }
.main { margin-left: var(--side); min-height: 100vh; }
.top { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 14px; padding: 0 22px; background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px); border-bottom: 1px solid var(--line); }
.top h2 { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.menu-btn { display: none; }
.search-trigger { flex: 1; max-width: 440px; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--muted); transition: border-color .15s; margin-left: auto; }
.search-trigger:hover { border-color: var(--ink-2); } .search-trigger span { flex: 1; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.top-logo { height: 40px; width: auto; display: block; margin-left: 8px; }
.notif .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; background: var(--red); border-radius: 50%; border: 2px solid var(--surface); }
.quick-new, .notif { position: relative; }
.menu { position: absolute; z-index: 60; top: calc(100% + 8px); right: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; animation: pop .16s ease-out; }
.menu > button, .menu > a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; text-align: left; font-weight: 500; }
.menu > button:hover, .menu > a:hover { background: var(--hover); }
.me-menu { position: fixed; top: auto; right: auto; }
.menu-head { padding: 8px 10px; font-weight: 600; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.notif-menu { width: 340px; max-height: 420px; overflow: auto; }
.notif-menu a { align-items: flex-start !important; } .notif-menu b { font-weight: 500; display: block; font-size: 13px; } .notif-menu small { color: var(--muted); }
.notif-menu .n-overdue .ic, .notif-menu .n-invoice .ic { color: var(--red); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.scrim { display: none; }
#view { outline: none; }
#view.enter .page { animation: enter .28s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- page layout ---------------- */
.page { padding: 24px clamp(14px, 2.4vw, 32px) 60px; max-width: 1480px; margin: 0 auto; }
.page.wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.count { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--hover); padding: 2px 9px; border-radius: 20px; vertical-align: middle; margin-left: 4px; }
.count:empty { display: none; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; margin-bottom: 12px; } .back:hover { color: var(--red); }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g-2 { grid-template-columns: 1fr 1fr; } .g-3 { grid-template-columns: repeat(3, 1fr); } .g-2-1 { grid-template-columns: 2fr 1fr; } .g-detail { grid-template-columns: 1.35fr 1fr; align-items: start; }
.col { display: grid; gap: 16px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card.flush { overflow: hidden; }
.card > .chart, .card > svg { padding: 0 14px 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px 10px; }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.grid > .card, .col > .card { margin: 0; }
section.card + section.card { margin-top: 16px; } .grid section.card + section.card, .col section.card + section.card { margin-top: 0; }

/* hero */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.hero h1 { font-size: 28px; margin: 4px 0 2px; } .hero p { margin: 0; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 16px; }
.kpis.k4 { grid-template-columns: repeat(4, 1fr); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; transition: transform .18s, box-shadow .18s, border-color .18s; position: relative; overflow: hidden; }
a.kpi:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0,0,0,.08); border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.kpi-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi-top .ic { color: var(--red); width: 17px; height: 17px; }
.kpi-val { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi.accent { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 10px 28px rgba(236,26,60,.3); }
.kpi.accent .kpi-top, .kpi.accent .kpi-top .ic, .kpi.accent .sub { color: rgba(255,255,255,.85); }
.kpi.accent .delta { background: rgba(255,255,255,.2); color: #fff; }
.kpi-foot { font-size: 12px; min-height: 20px; }
.delta { display: inline-block; font-weight: 600; font-size: 11.5px; padding: 1px 7px; border-radius: 20px; }
.delta.up { color: var(--ok); background: var(--ok-tint); } .delta.down { color: var(--red); background: var(--red-tint); }
.sub { color: var(--muted); }

/* charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10.5px; font-family: var(--font); }
.chart .draw { stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: draw 1.3s ease-out forwards; }
.chart .draw[stroke-dasharray="5 5"] { stroke-dasharray: 5 5; stroke-dashoffset: 0; animation: none; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart .dot { opacity: 0; transition: opacity .2s; } .chart:hover .dot { opacity: 1; }
.chart.bars { height: 130px; } .chart.bars rect { transform-origin: bottom; transform-box: fill-box; animation: grow .6s ease-out backwards; }
.chart.bars rect:hover { fill: var(--deep); }
@keyframes grow { from { transform: scaleY(0); } }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i, .legend-list i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.donut-row { display: flex; align-items: center; gap: 18px; padding: 4px 18px 18px; flex-wrap: wrap; }
.donut-wrap { position: relative; display: grid; place-items: center; }
.donut { transform: rotate(-90deg); } .donut circle { transition: stroke-width .2s; } .donut circle:hover { stroke-width: 6.5; }
.donut-center { position: absolute; text-align: center; line-height: 1.1; } .donut-center b { display: block; font-size: 20px; } .donut-center small { color: var(--muted); }
.legend-list { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 150px; display: grid; gap: 7px; font-size: 13px; }
.legend-list li { display: flex; align-items: center; } .legend-list b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* funnel */
.funnel { padding: 0 18px 16px; display: grid; gap: 9px; }
.funnel-row { display: grid; grid-template-columns: 100px 1fr 34px 62px; align-items: center; gap: 10px; font-size: 13px; border-radius: 8px; }
a.funnel-row:hover b { color: var(--red); }
.fbar { height: 10px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.fbar i { display: block; height: 100%; border-radius: 6px; background: var(--ink); animation: widen .8s ease-out; }
@keyframes widen { from { width: 0 !important; } }
.funnel-row b { text-align: right; } .funnel-row small { color: var(--muted); text-align: right; }
.funnel.big .funnel-row { grid-template-columns: 110px 1fr 40px 44px; }
.st-new i, i.st-new { background: #9A9A9A; } i.st-contacted { background: #6b6b6b; } i.st-qualified { background: #333333; } i.st-proposal { background: #F07A8D; } i.st-negotiation { background: #EC1A3C; } i.st-won { background: #CE002C; } i.st-lost { background: #C4C4C4; }
:root[data-theme="dark"] i.st-qualified { background: #ddd; } :root[data-theme="dark"] i.st-contacted { background: #aaa; }

/* lists */
.mini-list { list-style: none; margin: 0; padding: 0 10px 12px; }
.mini-list a { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: 10px; transition: background .15s; }
.mini-list a:hover { background: var(--hover); } .mini-list div { flex: 1; min-width: 0; } .mini-list b, .mini-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .mini-list small { color: var(--muted); }
.feed { list-style: none; margin: 0; padding: 0 18px 14px; display: grid; gap: 12px; max-height: 420px; overflow: auto; }
.feed li { display: flex; gap: 11px; font-size: 13px; } .feed p { margin: 2px 0 0; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; } .feed small { color: var(--muted); font-size: 11.5px; }
.feed-ic, .task-ic, .tl-ic { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--hover); color: var(--ink-2); }
.feed-ic .ic, .task-ic .ic, .tl-ic .ic { width: 15px; height: 15px; }
.t-whatsapp .feed-ic, .task-ic.t-whatsapp, .t-whatsapp > .tl-ic { background: #E5F6EC; color: #1E9E5A; }
.t-call .feed-ic, .task-ic.t-call, .t-call > .tl-ic, .t-stage .feed-ic, .t-stage > .tl-ic, .t-web .feed-ic, .t-web > .tl-ic, .task-ic.t-followup { background: var(--red-tint); color: var(--red); }
.t-payment .feed-ic, .t-payment > .tl-ic { background: var(--ok-tint); color: var(--ok); }
:root[data-theme="dark"] .t-whatsapp .feed-ic, :root[data-theme="dark"] .task-ic.t-whatsapp, :root[data-theme="dark"] .t-whatsapp > .tl-ic { background: #12301F; }
.leaders { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; padding: 0 18px 16px; }
.leader { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; } .leader div { flex: 1; } .leader b, .leader small { display: block; } .leader small { color: var(--muted); } .rank { font-size: 18px; width: 24px; text-align: center; }

/* avatars, pills, score */
.avatar { --h: 0; width: 32px; height: 32px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; color: #fff; background: linear-gradient(135deg, hsl(var(--h) 0% 30%), hsl(var(--h) 0% 18%)); }
.avatar:nth-child(odd) { background: var(--grad); }
.avatar.xs { width: 24px; height: 24px; font-size: 10px; } .avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.who { display: inline-flex; align-items: center; gap: 7px; }
.pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: var(--hover); color: var(--ink-2); white-space: nowrap; border: 1px solid transparent; }
.p-new, .p-draft, .p-planning, .p-enquiry, .p-planned, .p-open, .p-low { background: var(--hover); color: var(--ink-2); }
.p-contacted, .p-sent, .p-in-progress, .p-upcoming, .p-medium, .p-warm, .p-onboarding, .p-sales, .p-staff { background: var(--surface); border-color: var(--line); color: var(--ink); }
.p-qualified, .p-review, .p-manager, .p-enrolled { background: var(--ink); color: var(--surface); }
.p-proposal, .p-partially-paid, .p-high, .p-live { background: var(--red-tint); color: var(--deep); }
.p-negotiation, .p-urgent, .p-hot, .p-admin, .p-overdue { background: var(--red); color: #fff; }
.p-won, .p-paid, .p-completed, .p-accepted, .p-active, .p-done { background: var(--ok-tint); color: var(--ok); }
.p-lost, .p-cancelled, .p-rejected, .p-churned, .p-dropped, .p-refunded, .p-ended, .p-cold, .p-paused, .p-on-hold, .p-archived { background: var(--line-2); color: var(--muted); text-decoration: none; }
.score { position: relative; width: 34px; height: 34px; display: inline-grid; place-items: center; flex: none; }
.score svg { position: absolute; inset: 0; transform: rotate(-90deg); } .score circle { fill: none; stroke: var(--line); stroke-width: 3.2; } .score circle + circle { stroke: var(--muted); stroke-linecap: round; transition: stroke-dasharray .8s; }
.score.hi circle + circle { stroke: var(--red); } .score.mid circle + circle { stroke: var(--ink); }
.score b { font-size: 11px; font-weight: 700; }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 6px; background: var(--hover); color: var(--ink-2); margin-top: 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 6px; background: var(--line-2); border-radius: 4px; overflow: hidden; width: 90px; display: inline-block; vertical-align: middle; margin-right: 6px; } .bar i { display: block; height: 100%; background: var(--grad); }

/* toolbar + table */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); flex: 1; min-width: 220px; max-width: 360px; color: var(--muted); }
.search:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(236,26,60,.12); }
.search input { border: 0; outline: 0; background: none; flex: 1; height: 100%; min-width: 0; }
.chip-select { height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 0 30px 0 12px; font-size: 13px; font-weight: 500; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.chip-select:hover { border-color: var(--ink-2); }
.seg { display: inline-flex; background: var(--hover); border-radius: 10px; padding: 3px; gap: 2px; border: 1px solid var(--line); flex-wrap: wrap; }
.seg a, .seg button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; font-weight: 500; font-size: 13px; color: var(--muted); }
.seg .on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; } .seg .ic { width: 15px; height: 15px; }
.bulk { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--ink); color: var(--surface); border-radius: 12px; margin-bottom: 12px; flex-wrap: wrap; animation: pop .2s; }
.bulk span { font-weight: 600; margin-right: auto; }
.bulk select { height: 32px; border-radius: 8px; border: 0; padding: 0 8px; font-size: 13px; background: var(--surface); color: var(--ink); }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.tbl th[data-sort] { cursor: pointer; user-select: none; } .tbl th[data-sort]:hover { color: var(--ink); }
.tbl th.sorted { color: var(--red); } .tbl th.sorted.asc::after { content: ' ↑'; } .tbl th.sorted.desc::after { content: ' ↓'; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl tbody tr { cursor: pointer; transition: background .12s; } .tbl tbody tr:hover { background: var(--hover); } .tbl tbody tr.sel { background: var(--red-tint); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tfoot td { border-top: 2px solid var(--line); background: var(--surface-2); }
.tbl .r { text-align: right; } .tbl .cb { width: 40px; padding-right: 0; } .tbl .cb input { width: 16px; height: 16px; accent-color: var(--red); cursor: pointer; }
.tbl .primary-cell b { font-weight: 600; }
.tbl.mini td, .tbl.mini th { padding: 9px 18px; } .tbl.mini th { position: static; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; color: var(--muted); }

/* skeleton & empty */
.skel-wrap { display: grid; gap: 10px; padding: 16px; } .skel { height: 18px; border-radius: 8px; background: linear-gradient(90deg, var(--line-2) 25%, var(--hover) 50%, var(--line-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; } .skel:nth-child(3n) { width: 70%; } .skel:nth-child(4n) { width: 85%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 42px 20px; } .empty h4 { font-size: 16px; margin: 12px 0 4px; } .empty p { color: var(--muted); margin: 0 0 16px; }
.empty-art { width: 64px; height: 64px; margin: 0 auto; border-radius: 20px; background: var(--red-tint); color: var(--red); display: grid; place-items: center; } .empty-art .ic { width: 28px; height: 28px; }
.boot-err { min-height: 100vh; display: grid; place-items: center; }

/* forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .span2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); } .field label i { color: var(--red); font-style: normal; }
.field input:not([type=checkbox]):not([type=radio]):not([type=range]), .field select, .field textarea, .row-inline input, .login-form input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); transition: border-color .15s, box-shadow .15s; font-size: 14px; }
.field input:focus, .field select:focus, .field textarea:focus, .login-form input:focus { outline: 0; border-color: var(--red); box-shadow: 0 0 0 3px rgba(236,26,60,.13); }
.field input[readonly], .field input:disabled, .field select:disabled { background: var(--hover); color: var(--muted); }
.field textarea { resize: vertical; min-height: 70px; }
.field.err input, .field.err select, .field.err textarea { border-color: var(--red); } .ferr { color: var(--red); font-size: 12px; font-weight: 500; }
.prefix { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); overflow: hidden; } .prefix span { padding: 0 0 0 12px; color: var(--muted); } .prefix input { border: 0 !important; box-shadow: none !important; }
.prefix:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(236,26,60,.13); }
.range { display: flex; gap: 10px; align-items: center; } .range input { flex: 1; accent-color: var(--red); } .range b { width: 42px; text-align: right; }
.switch { position: relative; width: 44px; height: 24px; display: inline-block; } .switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 20px; transition: .2s; cursor: pointer; } .switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--red); } .switch input:checked + span::before { transform: translateX(20px); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }
.row-inline { display: flex; gap: 8px; }
.fk { position: relative; } .fk-list { display: none; position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 240px; overflow: auto; padding: 4px; }
.fk-list.open { display: block; } .fk-list button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 7px; } .fk-list button:hover { background: var(--hover); } .fk-list small { display: block; color: var(--muted); font-size: 11.5px; } .fk-empty { padding: 10px; color: var(--muted); }
.items { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.items-head, .item-row { display: grid; grid-template-columns: 1fr 70px 110px 100px 34px; gap: 8px; align-items: center; padding: 6px 10px; }
.items-head { background: var(--surface-2); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.item-row { border-top: 1px solid var(--line-2); } .item-row input { padding: 8px 9px !important; } .i-amt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
.items-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; } .items-total { font-size: 13px; color: var(--ink-2); }
.drop { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 30px; border: 2px dashed var(--line); border-radius: 12px; cursor: pointer; color: var(--muted); margin: 10px 0; transition: .15s; } .drop:hover, .drop.over { border-color: var(--red); color: var(--red); background: var(--red-tint); } .drop .ic { width: 28px; height: 28px; }
.map-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; align-items: center; margin-bottom: 14px; } .map-grid select { padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.pre { white-space: pre-wrap; font-size: 12px; max-height: 300px; overflow: auto; }
.toggle-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 0 10px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; } .toggle-chip input { accent-color: var(--red); }

/* modal & drawer */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(20,20,20,.42); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .2s; }
.overlay.in { opacity: 1; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateY(14px) scale(.98); transition: transform .22s; }
.modal.wide { max-width: 860px; }
.overlay.in .modal { transform: none; }
.overlay.is-drawer { place-items: stretch end; padding: 0; }
.drawer { background: var(--surface); width: min(620px, 100vw); height: 100vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateX(40px); transition: transform .25s cubic-bezier(.2,.8,.2,1); }
.drawer.wide { width: min(860px, 100vw); }
.overlay.in .drawer { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); } .modal-head h3 { font-size: 17px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer .form-actions { position: sticky; bottom: -20px; background: var(--surface); padding: 14px 0 4px; margin-bottom: -4px; border-top: 1px solid var(--line); }
.confirm-text { font-size: 15px; margin: 0 0 18px; }

/* toasts */
#toasts { position: fixed; z-index: 200; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--surface); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; gap: 14px; align-items: center; font-weight: 500; opacity: 0; transform: translateY(12px); transition: .25s; max-width: 92vw; }
.toast.in { opacity: 1; transform: none; } .toast.error { background: var(--red); color: #fff; }
.toast-act { color: #ff8da0; font-weight: 700; } .toast.error .toast-act { color: #fff; text-decoration: underline; }

/* record */
.record-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px; flex-wrap: wrap; margin-bottom: 14px; }
.rh-main { display: flex; gap: 16px; align-items: center; min-width: 0; } .rh-main h1 { font-size: 22px; } .rh-main p { margin: 2px 0 8px; }
.rh-ic { width: 56px; height: 56px; border-radius: 16px; background: var(--red-tint); color: var(--red); display: grid; place-items: center; } .rh-ic .ic { width: 26px; height: 26px; }
.rh-actions { display: flex; gap: 8px; flex-wrap: wrap; } .pills { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.path { display: flex; margin-bottom: 14px; overflow-x: auto; border-radius: 12px; }
.path-step { flex: 1; min-width: 104px; padding: 11px 14px 11px 24px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 12.5px; color: var(--muted); clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); margin-right: -6px; transition: .15s; white-space: nowrap; }
.path-step:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: 12px 0 0 12px; padding-left: 16px; }
.path-step:hover { color: var(--ink); background: var(--hover); }
.path-step.done { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.path-step.cur { background: var(--grad); color: #fff; border-color: transparent; }
.path-step.cur.st-lost { background: var(--muted); }
.quick { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; margin-bottom: 14px; flex-wrap: wrap; }
.quick > span { display: flex; align-items: center; gap: 8px; } .quick .ic { color: var(--red); }
.quick-btns { display: flex; gap: 6px; flex-wrap: wrap; } .quick-btns button { padding: 6px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; font-weight: 500; display: inline-flex; gap: 5px; align-items: center; } .quick-btns button:hover { border-color: var(--red); color: var(--red); } .quick-btns .ic { width: 14px; height: 14px; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 20px; padding: 0 18px 14px; }
.kv { padding: 9px 0; border-bottom: 1px solid var(--line-2); min-width: 0; } .kv > span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; margin-bottom: 2px; } .kv > div { overflow: hidden; text-overflow: ellipsis; }
.notes { padding: 0 18px 16px; } .notes p { margin: 0; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 12px; }
.composer { margin: 0 18px 14px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(236,26,60,.1); }
.comp-types { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line-2); overflow-x: auto; }
.comp-types input { display: none; } .comp-types span { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 7px; font-size: 12.5px; font-weight: 500; color: var(--muted); cursor: pointer; } .comp-types .ic { width: 14px; height: 14px; }
.comp-types input:checked + span { background: var(--red-tint); color: var(--red); }
.composer textarea { width: 100%; border: 0; outline: 0; padding: 12px; resize: vertical; background: transparent; min-height: 64px; }
.comp-foot { display: flex; justify-content: flex-end; padding: 0 8px 8px; }
.timeline { list-style: none; margin: 0; padding: 0 18px 18px; position: relative; max-height: 640px; overflow: auto; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; position: relative; } .timeline li:not(:last-child)::after { content: ''; position: absolute; left: 14.5px; top: 44px; bottom: -6px; width: 1px; background: var(--line); }
.timeline p { margin: 3px 0 2px; font-size: 13.5px; } .timeline small { color: var(--muted); font-size: 11.5px; }
.me { display: flex; gap: 14px; align-items: center; padding: 0 18px 16px; } .me p { margin: 2px 0 0; }
.shortcuts { padding-left: 18px; color: var(--ink-2); line-height: 2; }

/* kanban */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; min-height: 60vh; scroll-snap-type: x proximity; }
.col-k { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; max-height: calc(100vh - 210px); transition: border-color .15s, background .15s; scroll-snap-align: start; }
.col-k.over { border-color: var(--red); background: var(--red-tint); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); } .col-head small { margin-left: auto; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.col-head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.st-contacted .dot { background: #6b6b6b; } .st-qualified .dot { background: var(--ink); } .st-proposal .dot { background: #F07A8D; } .st-negotiation .dot { background: var(--red); } .st-won .dot { background: var(--ok); } .st-lost .dot { background: #C4C4C4; }
.col-body { padding: 10px; display: grid; gap: 9px; overflow-y: auto; min-height: 80px; }
.col-empty { border: 2px dashed var(--line); border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); font-size: 12.5px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: grab; transition: transform .15s, box-shadow .15s, border-color .15s; position: relative; animation: pop .2s; }
.kcard:hover { box-shadow: 0 8px 22px rgba(0,0,0,.09); transform: translateY(-2px); border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.kcard.dragging { opacity: .45; transform: rotate(2deg); cursor: grabbing; }
.kcard.hot { border-left: 3px solid var(--red); }
.kc-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; } .kc-top b { font-size: 13.5px; line-height: 1.3; }
.kc-top .score { width: 30px; height: 30px; } .kc-top .score b { font-size: 10px; }
.kcard > small { display: block; margin-top: -4px; }
.kc-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; } .kc-foot .num { margin-right: auto; font-size: 13px; }
.due { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 12px; white-space: nowrap; } .due .ic { width: 13px; height: 13px; } .due.late { color: var(--red); font-weight: 600; }
.kc-quick { display: none; gap: 4px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line-2); align-items: center; }
.kcard:hover .kc-quick, .kcard:focus-within .kc-quick { display: flex; }
.kc-quick a { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; color: var(--ink-2); } .kc-quick a:hover { background: var(--red-tint); color: var(--red); } .kc-quick .ic { width: 15px; height: 15px; }
.kc-quick select { margin-left: auto; font-size: 12px; border: 1px solid var(--line); border-radius: 7px; padding: 3px 6px; background: var(--surface); }

/* tasks */
.tasks { list-style: none; margin: 0; padding: 6px 10px 10px; }
.task { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 10px; cursor: pointer; transition: background .12s, opacity .3s; }
.task:hover { background: var(--hover); }
.tick { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; transition: .15s; }
.tick .ic { width: 14px; height: 14px; } .tick:hover { border-color: var(--red); color: var(--red); }
.task.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; animation: popin .3s; } .task.done .task-main b { text-decoration: line-through; color: var(--muted); }
@keyframes popin { 50% { transform: scale(1.25); } }
.task-main { flex: 1; min-width: 0; } .task-main b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .task-main small { color: var(--muted); display: flex; gap: 4px; align-items: center; flex-wrap: wrap; } .task-main small a { color: var(--red); }
.tasks.compact .task-ic { display: none; } .tasks.compact { padding-top: 0; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab { padding: 8px 14px; border-radius: 10px; font-weight: 600; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; border: 1px solid transparent; }
.tab span { background: var(--hover); color: var(--ink-2); padding: 0 8px; border-radius: 20px; font-size: 12px; }
.tab:hover { color: var(--ink); } .tab.on { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow); }
.tab.alert span { background: var(--red); color: #fff; }
.quick-add { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; margin-bottom: 14px; } .quick-add > .ic { color: var(--red); } .quick-add input { flex: 1; border: 0; outline: 0; background: none; font-size: 14px; padding: 6px 0; min-width: 0; }

/* code blocks */
.code { position: relative; margin: 12px 18px 18px; } .code pre { margin: 0; background: #1d1d1d; color: #f3f3f3; padding: 14px; border-radius: 10px; font-size: 12px; line-height: 1.6; overflow: auto; max-height: 300px; }
.code .btn { position: absolute; top: 8px; right: 8px; }

/* palette */
.palette-ov { place-items: start center; padding-top: 12vh; }
.palette { width: min(640px, 100%); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .18s; border: 1px solid var(--line); }
.palette label { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette input { flex: 1; border: 0; outline: 0; background: none; font-size: 16px; }
.pal-list { max-height: 380px; overflow: auto; padding: 6px; }
.pal-list button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 9px; text-align: left; }
.pal-list button span { flex: 1; min-width: 0; } .pal-list small { display: block; color: var(--muted); font-size: 12px; }
.pal-list button.on { background: var(--red-tint); } .pal-list button.on .ic { color: var(--red); }
.pal-list em { font-style: normal; font-size: 11px; color: var(--muted); border: 1px solid var(--line); padding: 1px 7px; border-radius: 6px; }
.pal-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* document (invoice / proposal) */
.doc { background: #fff; color: #333; font-size: 13px; padding: 36px 40px; max-width: 820px; margin: 0 auto; }
.doc.preview { padding: 26px; border-radius: 12px; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--red); padding-bottom: 18px; margin-bottom: 20px; }
.doc-head h2 { font-size: 24px; letter-spacing: .06em; } .doc-head p { margin: 4px 0 0; color: #5c5c5c; } .doc-logo { height: 52px; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr auto; gap: 20px; margin-bottom: 22px; } .doc-parties small, .doc-notes small, .doc-dates small { display: block; font-size: 10.5px; letter-spacing: .12em; color: #8a8a8a; font-weight: 600; } .doc-parties b { font-size: 14px; } .doc-parties p { margin: 4px 0 0; color: #5c5c5c; } .doc-dates p { margin: 0 0 8px; text-align: right; }
.doc-items { width: 100%; border-collapse: collapse; } .doc-items th { background: #333; color: #fff; padding: 9px 10px; text-align: left; font-size: 11.5px; letter-spacing: .05em; } .doc-items td { padding: 10px; border-bottom: 1px solid #E6E6E6; } .doc-items tbody tr:nth-child(even) td { background: #F7F7F7; } .doc-items .r { text-align: right; }
.doc-totals { margin: 14px 0 20px auto; width: 300px; } .doc-totals p { display: flex; justify-content: space-between; margin: 0; padding: 6px 10px; } .doc-totals .grand { border-top: 2px solid #333; font-size: 15px; } .doc-totals .grand b { color: #EC1A3C; }
.doc-notes { margin-bottom: 14px; } .doc-notes p { margin: 4px 0 0; color: #5c5c5c; }
.doc-foot { border-top: 1px solid #E6E6E6; padding-top: 14px; margin-top: 24px; font-size: 12px; color: #5c5c5c; } .doc-foot p { margin: 0 0 4px; }
.doc-preview { padding: 0; overflow: hidden; } .doc-preview .doc { box-shadow: none; }
.print-body { background: #fff; margin: 0; } .print-body .doc { padding: 24px 32px; }
@media print { .print-body .doc { padding: 0; } @page { size: A4; margin: 14mm; } }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; }

/* ---------------- responsive ---------------- */
@media (max-width: 1320px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) {
  .g-3 { grid-template-columns: 1fr 1fr; } .g-2-1, .g-detail { grid-template-columns: 1fr; }
  .search-trigger kbd, .search-trigger span { display: none; } .search-trigger { flex: 0; margin-left: auto; padding: 9px; border: 0; background: none; }
}
@media (max-width: 900px) {
  .side { transform: translateX(-100%); box-shadow: var(--shadow-lg); } .side-close { display: grid; }
  body.side-open .side { transform: none; } body.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .main { margin-left: 0; } .menu-btn { display: grid; }
  .login { grid-template-columns: 1fr; } .login-art { display: none; } .login-panel { min-height: 100vh; padding-top: 90px; }
  .g-2 { grid-template-columns: 1fr; } .kpis.k4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .top { padding: 0 10px; gap: 6px; } .top h2 { font-size: 15px; max-width: 120px; } .top-logo { height: 30px; margin-left: 4px; }
  .hide-sm { display: none; }
  .page { padding: 16px 16px 80px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; } .kpi { padding: 12px; } .kpi-val { font-size: 21px; }
  .g-3 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 22px; }
  .form-grid, .kv-grid, .map-grid { grid-template-columns: 1fr; }
  .search { max-width: none; min-width: 100%; }
  .chip-select { flex: 1; min-width: 46%; }
  .items-head { display: none; } .item-row { grid-template-columns: 1fr 1fr 34px; } .item-row .i-desc { grid-column: 1 / -1; } .item-row .i-amt { display: none; }
  .doc { padding: 18px; } .doc-parties { grid-template-columns: 1fr; } .doc-dates p { text-align: left; } .doc-totals { width: 100%; }
  .board { grid-auto-columns: 84vw; }
  .record-head { padding: 16px; } .rh-main .avatar.lg, .rh-ic { width: 44px; height: 44px; }
  .funnel-row { grid-template-columns: 84px 1fr 28px 50px; }
  .notif-menu { position: fixed; left: 10px; right: 10px; top: 60px; width: auto; }
  .tbl td, .tbl th { padding: 10px; }
  .modal-body { padding: 16px; }
  .login-logo img { height: 36px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ===================== AI assistant (Claude) ===================== */
.ai-card { border-top: 3px solid var(--red); }
.ai-card .card-head h3 { display: flex; align-items: center; gap: 8px; }
.ai-card .card-head h3 .ic { color: var(--red); }
.ai-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ai-body { padding: 4px 18px 18px; }
.ai-body p { margin: 0 0 8px; }
.ai-body ul { margin: 4px 0 10px; padding-left: 20px; } .ai-body li { margin: 3px 0; }
.ai-body h4 { margin: 10px 0 6px; font-size: 14px; }
.ai-summary { font-size: 14.5px; color: var(--ink); }
.ai-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 12px 0; }
.ai-facts > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.ai-facts small, .ai-next small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.intent-hot { color: var(--red); } .intent-warm { color: var(--warn); } .intent-cold { color: var(--muted); }
.ai-next { display: flex; gap: 10px; align-items: flex-start; background: var(--red-tint); border-radius: var(--radius-sm); padding: 12px 14px; margin: 6px 0 12px; }
.ai-next .ic { color: var(--red); flex: none; margin-top: 2px; } .ai-next p { margin: 2px 0 0; font-weight: 500; }
.ai-body details { margin: 6px 0; } .ai-body summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.ai-draft { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; margin: 10px 0; }
.ai-draft-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.ai-draft-head b { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.ai-draft-head span { display: flex; gap: 6px; }
.ai-draft textarea, .ai-draft input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: var(--surface); resize: vertical; font-size: 13.5px; }
.ai-draft input { margin-bottom: 6px; font-weight: 600; }
.ai-apply { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.btn.xs { padding: 4px 10px; font-size: 12px; min-height: 0; gap: 4px; }
.btn.xs .ic { width: 14px; height: 14px; }
.err-text { color: var(--red); font-weight: 500; }
.pill.p-green { background: var(--ok-tint); color: var(--ok); } .pill.p-gray { background: var(--hover); color: var(--muted); }
.ai-thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 8px 0; }
.ai-dots { display: inline-flex; gap: 4px; } .ai-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: aiDot 1.2s infinite ease-in-out; }
.ai-dots i:nth-child(2) { animation-delay: .15s; } .ai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes aiDot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
.ai-brief { margin-bottom: 18px; }
.ai-chat { display: flex; flex-direction: column; min-height: 60vh; }
.ai-log { flex: 1; padding: 18px; overflow-y: auto; max-height: 65vh; display: flex; flex-direction: column; gap: 12px; }
.ai-examples { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-examples .chip { cursor: pointer; border: 1px solid var(--line); background: var(--surface-2); border-radius: 20px; padding: 7px 14px; font-size: 13px; text-align: left; color: var(--ink); }
.ai-examples .chip:hover { border-color: var(--red); color: var(--red); }
.ai-msg { display: flex; } .ai-msg.user { justify-content: flex-end; }
.ai-bubble { max-width: min(760px, 92%); border-radius: 14px; padding: 10px 14px; }
.ai-msg.user .ai-bubble { background: var(--grad); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.assistant .ai-bubble { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.ai-bubble p { margin: 0 0 6px; } .ai-bubble p:last-child { margin: 0; } .ai-bubble ul { margin: 4px 0; padding-left: 20px; }
.ai-input { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.ai-input textarea { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; resize: none; background: var(--surface); }
@media (max-width: 640px) { .ai-input { flex-direction: column; align-items: stretch; } .ai-facts { grid-template-columns: 1fr 1fr; } }

/* ---------- Meta lead ads card ---------- */
.meta-card { margin-bottom: 16px; }
.meta-steps { margin: 0 0 8px; padding-left: 34px; line-height: 1.7; }
.meta-steps code, .meta-hook code { font-size: 12px; }
.meta-hook { margin-bottom: 6px; }
.meta-hook .kv input { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.meta-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 10px 0; }
.meta-facts > div { background: var(--surface-2, #F7F7F7); border-radius: 10px; padding: 10px 12px; }
.meta-facts span { display: block; font-size: 11.5px; } .meta-facts b { font-size: 14px; }
.meta-card .form-actions { flex-wrap: wrap; gap: 8px; }
.meta-card details { margin: 8px 0; } .meta-card summary { cursor: pointer; }
.meta-card .pill { margin: 0 4px 4px 0; }

.meta-pages { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin: 4px 0 10px; }
.meta-pages b { width: 100%; }

/* ---------- notifications ---------- */
.nudge { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 14px; border-left: 4px solid var(--red); }
.nudge > svg { flex: none; color: var(--red); width: 22px; height: 22px; }
.nudge > div { flex: 1; min-width: 0; } .nudge p { margin: 2px 0 0; }
.notif-card .pad-x { padding-bottom: 6px; }
.notif-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-2, #F0F0F0); cursor: default; }
.notif-row > div { min-width: 0; } .notif-row p { margin: 2px 0 0; }
.notif-row select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font: inherit; }
.notif-row .switch, .notif-row .btn, .notif-row select { flex: none; }
.notif-card .hint { background: var(--red-tint, #FDE8EC); border-radius: 10px; padding: 10px 12px; margin: 8px 0; display: flex; gap: 8px; align-items: flex-start; }
#ntest p { margin: 4px 0; }
@media (max-width: 560px) { .notif-row { flex-wrap: wrap; } .nudge { flex-wrap: wrap; } }
.notif-row input[type=email] { flex: 0 1 260px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font: inherit; }

.side nav a.nav-unit { padding-left: 30px; font-size: 13px; }

/* =====================================================================
   Mobile-first polish (v1.5): app-like phone experience
   ===================================================================== */
.tabbar, .f-toggle, .m-actions { display: none; }
.btn.wa { background: #25D366; color: #fff; border-color: #25D366; }
.f-count { font-style: normal; background: var(--red); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; margin-left: 2px; }

@media (max-width: 900px) {
  /* bottom tab bar, like a native app */
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 32;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px; min-height: 48px; justify-content: center;
    color: var(--muted); font-size: 11px; font-weight: 500; background: none; border: 0; border-radius: 10px; -webkit-tap-highlight-color: transparent; }
  .tabbar .ic { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--red); } .tabbar a.on .ic { stroke-width: 2.2; }
  .tabbar .badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10px; font-style: normal; display: grid; place-items: center; }
  .page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  #toasts { bottom: calc(78px + env(safe-area-inset-bottom)) !important; }
  .me-menu { bottom: calc(70px + env(safe-area-inset-bottom)) !important; left: auto !important; right: 10px; }
  .top { padding-top: env(safe-area-inset-top); height: calc(var(--top) + env(safe-area-inset-top)); }
}

@media (max-width: 640px) {
  /* top bar: room for the page title */
  .top { gap: 2px; } .top h2 { flex: 1; max-width: none; font-size: 16px; }
  [data-themebtn] { display: none; }
  .top .icon-btn, .search-trigger { width: 40px; height: 40px; }

  /* no iOS zoom when tapping a field; comfy touch targets */
  input, select, textarea, .field input, .field select, .field textarea, .row-inline input { font-size: 16px !important; }
  .btn { min-height: 42px; } .btn.sm { min-height: 36px; }
  .icon-btn { min-width: 40px; min-height: 40px; }

  /* page head + toolbar */
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .page-head .actions [data-new] { flex: 1 1 100%; order: -1; justify-content: center; }
  .toolbar .search { flex: 1; min-width: 0; }
  .f-toggle { display: inline-flex; }
  .toolbar .chip-select, .toolbar [data-clear] { display: none; }
  .toolbar.f-open .chip-select { display: block; flex: 1 1 46%; min-width: 46%; }
  .toolbar.f-open [data-clear]:not([hidden]) { display: inline-flex; }

  /* tables become tappable cards */
  .card.flush:has(.tbl) { background: none; border: 0; box-shadow: none; }
  .table-wrap { overflow: visible; }
  .tbl, .tbl tbody { display: block; }
  .tbl thead, .tbl tfoot { display: none; }
  .tbl tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 14px 14px 14px 44px; margin-bottom: 10px; position: relative;
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.04)); }
  .tbl tr.sel { border-color: var(--red); }
  .tbl td { display: block; padding: 0 !important; border: 0 !important; min-width: 0; text-align: left !important; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
  .tbl td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); margin-bottom: 1px; }
  .tbl td.is-empty, .tbl td.cb + td.is-empty { display: none; }
  .tbl td.cb { position: absolute; left: 14px; top: 16px; }
  .tbl td.primary-cell { grid-column: 1 / -1; font-size: 16px; } .tbl td.primary-cell::before { display: none; }
  .tbl td.nowrap { white-space: normal; }
  .tbl td.m-actions { display: flex; gap: 8px; grid-column: 1 / -1; margin-top: 6px; }
  .tbl td.m-actions .btn { flex: 1; justify-content: center; min-height: 40px; }
  .pager { justify-content: space-between; }
  .bulk { position: sticky; top: calc(var(--top) + 6px); z-index: 5; }

  /* record page */
  .record-head .rh-actions, .rh-actions { flex-wrap: wrap; }
  .kv:has(> div > span.muted:only-child) { display: none; }
  .kv-grid { grid-template-columns: 1fr 1fr !important; column-gap: 14px; }
  .kv-grid .kv:has(textarea), .kv-grid .kv.wide { grid-column: 1 / -1; }
  .stepper, .stages { overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .quick { flex-direction: column; align-items: stretch; } .quick-btns { display: flex; flex-wrap: wrap; gap: 6px; } .quick-btns button { flex: 1 1 40%; min-height: 38px; }

  /* modals become full-height sheets */
  .overlay { align-items: flex-end; padding: 0; }
  .modal { max-width: none; width: 100%; max-height: calc(100dvh - 24px); border-radius: 18px 18px 0 0; }
  .modal .modal-foot, .modal .form-actions { position: sticky; bottom: 0; background: var(--surface); padding-bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 2; }
  .modal-foot .btn { flex: 1; justify-content: center; }

  /* boards and wide content scroll sideways with snapping */
  .board { scroll-snap-type: x mandatory; } .board > * { scroll-snap-align: start; }
  .card-head { flex-wrap: wrap; gap: 6px; }
  .ai-card .card-head { align-items: flex-start; }
  pre, .code pre { white-space: pre-wrap; word-break: break-word; }
}
@media (max-width: 340px) {
  .kpis { grid-template-columns: 1fr 1fr; } .kpi-val { font-size: 18px; }
  .tbl tr { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 640px) {
  /* bigger thumb area for "Mark done" without changing the look */
  .tick { position: relative; width: 28px; height: 28px; }
  .tick::after { content: ''; position: absolute; inset: -10px; }
  #pre { display: flex; flex-wrap: wrap; gap: 6px; background: none; padding: 0; }
  #pre button { min-height: 38px; flex: 1 1 30%; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
  #pre button.on { background: var(--red); color: #fff; border-color: var(--red); }
}
@media (max-width: 640px) {
  /* forms inside cards (Settings, Meta, alerts) get breathing room */
  .card > form.form-grid, .card > .form-grid { padding: 4px 14px 14px; }
  .card > form.form-grid .form-actions, .card .pad-x .form-actions { justify-content: stretch; }
  .card .form-actions .btn { flex: 1 1 100%; justify-content: center; }
  .meta-card .form-actions { flex-direction: column; } .meta-card .form-actions .btn { width: 100%; }
  .meta-pages b { font-size: 13px; }
  .meta-facts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .hero { flex-direction: column; align-items: stretch; gap: 14px; }
  .hero-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); grid-auto-rows: 44px; align-items: stretch; gap: 8px; height: auto; }
  .hero-actions .btn { height: 44px; min-height: 0; }
  .hero-actions .btn { justify-content: center; padding-left: 8px; padding-right: 8px; }
  .rh-actions { display: flex !important; flex-wrap: nowrap; gap: 6px; width: 100%; }
  .rh-actions > * { flex: 0 0 44px; height: 44px; min-width: 0; padding-left: 6px; padding-right: 6px; justify-content: center; }
  .rh-actions > [data-convert] { flex: 1 1 auto; }
  .rh-actions [data-convert] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rh-actions .btn, .rh-actions .icon-btn { justify-content: center; }
}

/* ---------- lead origin + folders ---------- */
.folders { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 4px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.folders:empty { display: none; }
.folder { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.folder .ic { width: 15px; height: 15px; } .folder b { font-weight: 600; color: var(--muted); }
.folder.on { background: var(--red); border-color: var(--red); color: #fff; } .folder.on b { color: #fff; }
.origin { display: inline-block; font-weight: 600; color: var(--ink); background: var(--red-tint, #FDE8EC); border-radius: 6px; padding: 2px 8px; font-size: 12.5px; }
.folder-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.folder-tag .ic { width: 13px; height: 13px; }
.came-from { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--red-tint, #FDE8EC); }
.came-from > .ic { color: var(--red); flex: none; margin-top: 2px; }
.came-from small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.came-from b { display: block; font-size: 15px; } .came-from .folder-tag { margin-top: 4px; }
@media (max-width: 640px) {
  .tbl td[data-label="Came from"] { grid-column: 1 / -1; } .tbl td[data-label="Came from"]::before { display: none; }
  .tbl td[data-label="Came from"] .origin { font-size: 13.5px; padding: 5px 10px; display: block; }
  .tbl td[data-label="Folder"]::before { display: none; }
}

.record-head .came-from { flex-basis: 100%; }
@media (max-width: 640px) { .tbl .origin { white-space: normal; overflow-wrap: anywhere; } }

/* ---------- WhatsApp templates ---------- */
.img-field { display: grid; gap: 8px; } .img-field img { max-width: 220px; max-height: 260px; border-radius: 10px; border: 1px solid var(--line); object-fit: cover; }
.img-field.busy { opacity: .5; pointer-events: none; } .img-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.wa-send .wa-tpls { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin: 6px 0 12px; }
.wa-tpl { flex: none; width: 150px; display: grid; gap: 6px; text-align: left; padding: 8px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; font: inherit; }
.wa-tpl img, .wa-noimg { width: 100%; height: 90px; object-fit: cover; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; color: #25D366; }
.wa-tpl b { font-size: 13px; display: block; line-height: 1.3; } .wa-tpl small { color: var(--muted); font-size: 11.5px; }
.wa-tpl.on { border-color: #25D366; box-shadow: 0 0 0 3px rgba(37,211,102,.15); }
.wa-send textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font: inherit; line-height: 1.5; }
.wa-poster { display: grid; gap: 6px; margin-top: 10px; } .wa-poster img { max-width: 180px; border-radius: 10px; border: 1px solid var(--line); }
.wa-actions .btn.wa { min-width: 180px; justify-content: center; }
@media (max-width: 640px) { .wa-actions { flex-direction: column; } .wa-actions .btn { width: 100%; } .wa-tpl { width: 130px; } }
@media (max-width: 640px) { .wa-poster img { max-width: 120px; } .wa-send textarea { min-height: 150px; } }

/* ---------- live new-lead pop-up ---------- */
#leadPops { position: fixed; z-index: 250; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(420px, calc(100vw - 20px)); display: grid; gap: 8px; pointer-events: none; }
.lead-pop { pointer-events: auto; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--red); border-radius: 16px; padding: 12px 12px 10px; box-shadow: 0 18px 50px rgba(0,0,0,.22);
  transform: translateY(-130%) scale(.96); opacity: 0; transition: transform .38s cubic-bezier(.2,1.2,.3,1), opacity .25s; }
.lead-pop.in { transform: none; opacity: 1; }
.lead-pop.meta { border-left-color: #1877F2; }
.lp-top { display: flex; gap: 10px; align-items: flex-start; }
.lp-bell { width: 38px; height: 38px; border-radius: 12px; background: var(--red); color: #fff; display: grid; place-items: center; flex: none; animation: ring 1s ease 2; }
.lead-pop.meta .lp-bell { background: #1877F2; }
.lp-bell .ic { width: 20px; height: 20px; }
.lp-txt { flex: 1; min-width: 0; } .lp-txt small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--red); }
.lead-pop.meta .lp-txt small { color: #1877F2; }
.lp-txt b { display: block; font-size: 16px; } .lp-txt span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-x { background: none; border: 0; color: var(--muted); padding: 4px; cursor: pointer; }
.lp-btns { display: flex; gap: 6px; margin-top: 10px; } .lp-btns .btn { flex: 1; justify-content: center; }
@keyframes ring { 0%,100% { transform: rotate(0); } 15% { transform: rotate(18deg); } 30% { transform: rotate(-16deg); } 45% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 75% { transform: rotate(4deg); } }

/* ---------- pull to refresh ---------- */
.ptr { position: fixed; z-index: 60; top: calc(var(--top) + 6px + env(safe-area-inset-top)); left: 50%; width: 38px; height: 38px; border-radius: 50%; background: var(--surface); box-shadow: 0 4px 16px rgba(0,0,0,.18); display: grid; place-items: center; color: var(--muted); opacity: 0; }
.ptr.ready { color: var(--red); } .ptr.spin .ic { animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- swipe hints on lead cards ---------- */
@media (max-width: 640px) {
  .tbl tr { touch-action: pan-y; transition: box-shadow .2s; }
  .tbl tr.sw-call { box-shadow: -6px 0 0 #2E7D32 inset, 0 6px 18px rgba(46,125,50,.18); }
  .tbl tr.sw-wa { box-shadow: 6px 0 0 #25D366 inset, 0 6px 18px rgba(37,211,102,.2); }
  .btn:active, .tabbar a:active, .folder:active { transform: scale(.97); }
}
