/* ============ KATANA CRM — Design tokens ============ */
:root{
  --bg:#0b0b10; --bg-2:#0f0f15; --surface:#14141c; --surface-2:#1b1b25; --surface-3:#232330;
  --border:#262633; --border-2:#33334a;
  --text:#ececf3; --text-2:#b4b4c3; --muted:#7c7c90;
  --accent:#e5383b; --accent-2:#ff5a5f; --accent-soft:rgba(229,56,59,.14); --accent-ring:rgba(229,56,59,.38);
  --gold:#d4a72c; --gold-soft:rgba(212,167,44,.14);
  --green:#22c55e; --green-soft:rgba(34,197,94,.14);
  --blue:#3b82f6; --blue-soft:rgba(59,130,246,.14);
  --purple:#a855f7; --purple-soft:rgba(168,85,247,.14);
  --orange:#f97316; --orange-soft:rgba(249,115,22,.14);
  --yellow:#eab308; --yellow-soft:rgba(234,179,8,.14);
  --cyan:#06b6d4; --cyan-soft:rgba(6,182,212,.14);
  --red:#ef4444; --red-soft:rgba(239,68,68,.14);
  --shadow:0 1px 2px rgba(0,0,0,.35),0 8px 24px rgba(0,0,0,.25);
  --shadow-lg:0 24px 64px rgba(0,0,0,.55);
  --radius:14px; --radius-sm:10px; --radius-xs:7px;
  --sidebar:248px;
  --font:"Plus Jakarta Sans",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  color-scheme:dark;
}
:root[data-theme="light"]{
  --bg:#f4f4f7; --bg-2:#eeeef3; --surface:#ffffff; --surface-2:#f6f6f9; --surface-3:#ececf2;
  --border:#e4e4ec; --border-2:#d4d4e0;
  --text:#14141c; --text-2:#454556; --muted:#7a7a8c;
  --accent-soft:rgba(229,56,59,.1);
  --shadow:0 1px 2px rgba(20,20,40,.06),0 6px 20px rgba(20,20,40,.06);
  --shadow-lg:0 24px 64px rgba(20,20,40,.18);
  color-scheme:light;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{background:var(--bg);color:var(--text);font-family:var(--font);font-size:14px;line-height:1.45;-webkit-font-smoothing:antialiased}
button,input,select,textarea{font:inherit;color:inherit}
a{color:inherit}
.num{font-variant-numeric:tabular-nums}
::selection{background:var(--accent-ring)}
::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-thumb{background:var(--surface-3);border-radius:10px;border:2px solid var(--bg)}::-webkit-scrollbar-track{background:transparent}

/* ============ Icons ============ */
.ico{display:inline-flex;width:18px;height:18px;flex:none}
.ico svg{width:100%;height:100%;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}

/* ============ Layout ============ */
.app{display:flex;min-height:100vh}
.sidebar{width:var(--sidebar);flex:none;position:sticky;top:0;height:100vh;background:var(--bg-2);border-right:1px solid var(--border);display:flex;flex-direction:column;padding:18px 14px;z-index:40}
.brand{display:flex;align-items:center;gap:11px;padding:4px 8px 22px}
.brand-mark{width:36px;height:36px;border-radius:10px;background:linear-gradient(140deg,var(--accent-2),var(--accent) 55%,#8f1518);color:#fff;display:grid;place-items:center;box-shadow:0 6px 18px var(--accent-ring)}
.brand-mark svg{width:22px;height:22px}
.brand-text{display:flex;flex-direction:column;line-height:1.05}
.brand-text strong{font-weight:800;letter-spacing:.18em;font-size:15px}
.brand-text span{font-size:11px;color:var(--muted);letter-spacing:.32em;font-weight:600}
.nav{display:flex;flex-direction:column;gap:2px;flex:1;overflow:auto}
.nav-label{font-size:10.5px;text-transform:uppercase;letter-spacing:.12em;color:var(--muted);padding:14px 10px 6px;font-weight:700}
.nav-item{display:flex;align-items:center;gap:11px;padding:9px 10px;border-radius:9px;color:var(--text-2);text-decoration:none;font-weight:550;border:0;background:none;cursor:pointer;width:100%;text-align:left;transition:background .15s,color .15s;position:relative}
.nav-item:hover{background:var(--surface);color:var(--text)}
.nav-item.active{background:var(--accent-soft);color:var(--text)}
.nav-item.active::before{content:"";position:absolute;left:-14px;top:8px;bottom:8px;width:3px;border-radius:0 3px 3px 0;background:var(--accent)}
.nav-item.active .ico{color:var(--accent-2)}
.nav-badge{margin-left:auto;font-size:11px;font-weight:700;background:var(--accent);color:#fff;border-radius:20px;padding:1px 7px;min-width:20px;text-align:center}
.nav-badge.soft{background:var(--surface-3);color:var(--text-2)}
.sidebar-foot{border-top:1px solid var(--border);padding-top:10px;margin-top:10px}
.storage-note{font-size:11px;color:var(--muted);padding:6px 10px}
.main{flex:1;min-width:0;display:flex;flex-direction:column}
.topbar{position:sticky;top:0;z-index:30;display:flex;align-items:center;gap:16px;padding:14px 28px;background:color-mix(in srgb,var(--bg) 82%,transparent);backdrop-filter:blur(14px);border-bottom:1px solid var(--border)}
.top-title h1{font-size:19px;margin:0;font-weight:750;letter-spacing:-.01em}
.top-title p{margin:1px 0 0;color:var(--muted);font-size:12.5px}
.top-search{margin-left:auto;position:relative;display:flex;align-items:center;background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:0 10px;width:min(380px,36vw);transition:border-color .15s,box-shadow .15s}
.top-search:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.top-search .ico{color:var(--muted);width:16px;height:16px}
.top-search input{border:0;background:none;outline:0;padding:9px 8px;width:100%}
.search-pop{position:absolute;top:calc(100% + 6px);left:0;right:0;background:var(--surface);border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow-lg);max-height:360px;overflow:auto;display:none;padding:6px}
.search-pop.open{display:block}
.search-item{display:flex;align-items:center;gap:10px;padding:8px;border-radius:8px;cursor:pointer}
.search-item:hover,.search-item.hl{background:var(--surface-2)}
.view{padding:24px 28px 60px;max-width:1500px;width:100%;margin:0 auto;animation:fadeUp .28s ease}
@keyframes fadeUp{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.scrim{display:none}
.only-mobile{display:none}

/* ============ Primitives ============ */
.btn{display:inline-flex;align-items:center;gap:7px;padding:8px 14px;border-radius:9px;border:1px solid var(--border);background:var(--surface);color:var(--text);font-weight:600;cursor:pointer;white-space:nowrap;transition:background .15s,border-color .15s,transform .08s,box-shadow .15s;text-decoration:none;font-size:13.5px}
.btn:hover{background:var(--surface-2);border-color:var(--border-2)}
.btn:active{transform:translateY(1px)}
.btn .ico{width:16px;height:16px}
.btn-primary{background:var(--accent);border-color:var(--accent);color:#fff;box-shadow:0 4px 14px var(--accent-ring)}
.btn-primary:hover{background:var(--accent-2);border-color:var(--accent-2)}
.btn-ghost{background:transparent;border-color:transparent}
.btn-ghost:hover{background:var(--surface-2)}
.btn-danger{color:var(--red)}
.btn-danger:hover{background:var(--red-soft);border-color:var(--red)}
.btn-wa{background:#1fa855;border-color:#1fa855;color:#fff}
.btn-wa:hover{background:#25c062;border-color:#25c062}
.btn-sm{padding:5px 10px;font-size:12.5px;border-radius:8px}
.btn[disabled]{opacity:.45;pointer-events:none}
.icon-btn{display:inline-grid;place-items:center;width:34px;height:34px;border-radius:9px;border:1px solid transparent;background:none;color:var(--text-2);cursor:pointer;transition:background .15s,color .15s}
.icon-btn:hover{background:var(--surface-2);color:var(--text)}
.icon-btn.danger:hover{color:var(--red);background:var(--red-soft)}
.icon-btn .ico{width:17px;height:17px}
.icon-btn.only-mobile{display:none}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow)}
.card-h{display:flex;align-items:center;gap:10px;padding:16px 18px 6px}
.card-h h3{margin:0;font-size:14.5px;font-weight:700}
.card-h p{margin:0;color:var(--muted);font-size:12px}
.card-h .spacer{flex:1}
.card-b{padding:12px 18px 18px}
.muted{color:var(--muted)}
.chip{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:650;padding:3px 9px;border-radius:20px;background:var(--surface-3);color:var(--text-2);white-space:nowrap;line-height:1.35}
.chip .dot{width:7px;height:7px;border-radius:50%;background:currentColor}
.t-caliente{background:var(--red-soft);color:#ff6b6b}
.t-tibio{background:var(--yellow-soft);color:#f5c542}
.t-frio{background:var(--cyan-soft);color:#4fd1e8}
:root[data-theme="light"] .t-caliente{color:#c62828}:root[data-theme="light"] .t-tibio{color:#a16207}:root[data-theme="light"] .t-frio{color:#0e7490}
.grid{display:grid;gap:16px}
.row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.spacer{flex:1}
.section-title{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.1em;color:var(--muted);margin:26px 0 12px;display:flex;align-items:center;gap:10px}
.section-title::after{content:"";flex:1;height:1px;background:var(--border)}
.empty{padding:36px 16px;text-align:center;color:var(--muted)}
.empty .ico{width:34px;height:34px;color:var(--border-2);margin-bottom:8px}

/* Forms */
.field{display:flex;flex-direction:column;gap:6px;min-width:0}
.field label{font-size:12px;font-weight:650;color:var(--text-2)}
.field .hint{font-size:11.5px;color:var(--muted)}
.input,.select,.textarea{width:100%;background:var(--bg-2);border:1px solid var(--border);border-radius:9px;padding:9px 11px;outline:0;transition:border-color .15s,box-shadow .15s}
.input:focus,.select:focus,.textarea:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.select{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='%237c7c90' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;padding-right:30px}
.textarea{min-height:84px;resize:vertical}
.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.form-grid .full{grid-column:1/-1}
.seg{display:flex;gap:6px;flex-wrap:wrap}
.seg button{flex:1;min-width:88px;padding:8px 10px;border-radius:9px;border:1px solid var(--border);background:var(--bg-2);cursor:pointer;font-weight:600;transition:all .15s}
.seg button.on{border-color:var(--accent);background:var(--accent-soft)}
.toolbar{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-bottom:14px}
.toolbar .input,.toolbar .select{width:auto;min-width:150px;padding:8px 11px}
.toolbar .search-in{flex:1;min-width:220px;max-width:380px}
.filter-pills{display:flex;gap:4px;background:var(--surface);border:1px solid var(--border);padding:4px;border-radius:11px;flex-wrap:wrap}
.filter-pills button{border:0;background:none;padding:6px 12px;border-radius:8px;cursor:pointer;color:var(--text-2);font-weight:600;font-size:12.5px;transition:all .15s}
.filter-pills button:hover{color:var(--text)}
.filter-pills button.on{background:var(--surface-3);color:var(--text);box-shadow:var(--shadow)}

/* Combobox */
.combo{position:relative}
.combo-list{position:absolute;z-index:80;top:calc(100% + 4px);left:0;right:0;max-height:240px;overflow:auto;background:var(--surface);border:1px solid var(--border-2);border-radius:10px;box-shadow:var(--shadow-lg);padding:4px;display:none}
.combo.open .combo-list{display:block}
.combo-opt{display:flex;justify-content:space-between;gap:10px;padding:7px 9px;border-radius:7px;cursor:pointer}
.combo-opt:hover,.combo-opt.hl{background:var(--surface-2)}
.combo-opt span:last-child{color:var(--muted);font-variant-numeric:tabular-nums}

/* ============ KPI ============ */
.kpi-hero{grid-template-columns:repeat(4,minmax(0,1fr))}
.kpi{padding:18px 18px 16px;position:relative;overflow:hidden;transition:transform .2s,border-color .2s}
.kpi:hover{transform:translateY(-2px);border-color:var(--border-2)}
.kpi .k-label{display:flex;align-items:center;gap:8px;color:var(--text-2);font-size:12.5px;font-weight:600}
.kpi .k-ico{width:30px;height:30px;border-radius:9px;display:grid;place-items:center}
.kpi .k-ico .ico{width:16px;height:16px}
.kpi .k-val{font-size:28px;font-weight:800;letter-spacing:-.02em;margin-top:12px;font-variant-numeric:tabular-nums}
.kpi .k-sub{font-size:12px;color:var(--muted);margin-top:2px}
.kpi.accent{background:linear-gradient(150deg,color-mix(in srgb,var(--accent) 22%,var(--surface)) ,var(--surface) 70%);border-color:color-mix(in srgb,var(--accent) 35%,var(--border))}
.stat-strip{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px}
.stat{padding:13px 14px;border-radius:12px;background:var(--surface);border:1px solid var(--border);transition:border-color .2s,transform .2s;cursor:default}
.stat.link{cursor:pointer}
.stat:hover{border-color:var(--border-2);transform:translateY(-1px)}
.stat .s-l{font-size:12px;color:var(--muted);font-weight:600;display:flex;gap:6px;align-items:center}
.stat .s-v{font-size:21px;font-weight:780;margin-top:5px;font-variant-numeric:tabular-nums}
.stat .s-v small{font-size:12px;color:var(--muted);font-weight:600;margin-left:4px}
.pos{color:var(--green)}.neg{color:var(--red)}
.charts{grid-template-columns:repeat(12,minmax(0,1fr))}
.span-12{grid-column:span 12}.span-8{grid-column:span 8}.span-7{grid-column:span 7}.span-6{grid-column:span 6}.span-5{grid-column:span 5}.span-4{grid-column:span 4}
.chart-box{position:relative;height:260px}
.chart-box.sm{height:220px}
.funnel{display:flex;flex-direction:column;gap:8px;padding-top:4px}
.funnel-row{display:grid;grid-template-columns:120px 1fr 92px;align-items:center;gap:10px;font-size:12.5px}
.funnel-bar{height:26px;border-radius:7px;background:var(--surface-2);overflow:hidden}
.funnel-bar i{display:block;height:100%;border-radius:7px;transition:width .6s cubic-bezier(.2,.8,.2,1)}
.funnel-row b{font-variant-numeric:tabular-nums;text-align:right}
.bench{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px;font-size:11.5px;color:var(--muted)}
.bench span{display:inline-flex;align-items:center;gap:5px}
.bench i{width:8px;height:8px;border-radius:50%}

/* ============ Tables ============ */
.table-wrap{overflow:auto}
table.tbl{width:100%;border-collapse:separate;border-spacing:0}
.tbl th{position:sticky;top:0;background:var(--surface);text-align:left;font-size:11.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);font-weight:700;padding:11px 12px;border-bottom:1px solid var(--border);white-space:nowrap;z-index:1}
.tbl th.sortable{cursor:pointer;user-select:none}
.tbl th.sortable:hover{color:var(--text)}
.tbl td{padding:11px 12px;border-bottom:1px solid var(--border);vertical-align:middle}
.tbl tbody tr{transition:background .12s}
.tbl tbody tr:hover{background:var(--surface-2)}
.tbl tbody tr.click{cursor:pointer}
.tbl tr:last-child td{border-bottom:0}
.tbl .r{text-align:right}
.lead-cell{display:flex;align-items:center;gap:10px;min-width:200px}
.avatar{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;font-weight:750;font-size:12.5px;flex:none;color:#fff;letter-spacing:.02em}
.avatar.lg{width:64px;height:64px;border-radius:18px;font-size:22px}
.lead-name{font-weight:650;max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block}
.lead-sub{font-size:12px;color:var(--muted)}
.wa-link{display:inline-flex;align-items:center;gap:6px;color:#25c062;text-decoration:none;font-weight:600;white-space:nowrap}
.wa-link:hover{text-decoration:underline}
.wa-link .ico{width:15px;height:15px}
.date-pill{font-variant-numeric:tabular-nums;white-space:nowrap}
.date-pill.over{color:var(--red);font-weight:650}
.date-pill.today{color:var(--orange);font-weight:650}
.actions{display:flex;gap:2px;justify-content:flex-end}
.pager{display:flex;align-items:center;gap:8px;justify-content:space-between;padding:12px 16px;border-top:1px solid var(--border);color:var(--muted);font-size:12.5px}
.dup-banner{display:flex;align-items:center;gap:10px;padding:10px 14px;border-radius:11px;background:var(--orange-soft);border:1px solid color-mix(in srgb,var(--orange) 35%,transparent);margin-bottom:14px;font-size:13px}
.dup-banner .ico{color:var(--orange)}

/* ============ Lead detail ============ */
.back{display:inline-flex;align-items:center;gap:6px;color:var(--muted);text-decoration:none;font-weight:600;margin-bottom:14px;font-size:13px}
.back:hover{color:var(--text)}
.lead-hero{display:flex;gap:18px;align-items:center;padding:22px;flex-wrap:wrap}
.lead-hero h2{margin:0;font-size:22px;font-weight:780;letter-spacing:-.01em}
.lead-hero .meta{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px;align-items:center}
.lead-hero .hero-actions{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap}
.detail{grid-template-columns:minmax(0,360px) minmax(0,1fr);align-items:start;margin-top:16px}
.kv{display:grid;grid-template-columns:130px 1fr;gap:9px 12px;font-size:13.5px}
.kv dt{color:var(--muted)}
.kv dd{margin:0;font-weight:550;word-break:break-word}
.mini-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:16px}
.mini-stats div{background:var(--surface-2);border-radius:10px;padding:10px 12px}
.mini-stats span{display:block;font-size:11.5px;color:var(--muted)}
.mini-stats b{font-size:16px;font-variant-numeric:tabular-nums}
.timeline{position:relative;padding-left:26px}
.timeline::before{content:"";position:absolute;left:10px;top:6px;bottom:6px;width:2px;background:var(--border)}
.tl-item{position:relative;padding:0 0 18px;animation:fadeUp .25s ease}
.tl-dot{position:absolute;left:-26px;top:1px;width:22px;height:22px;border-radius:50%;display:grid;place-items:center;background:var(--surface-3);border:3px solid var(--surface)}
.tl-dot .ico{width:11px;height:11px}
.tl-head{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:13px}
.tl-head b{font-weight:700}
.tl-time{color:var(--muted);font-size:12px;margin-left:auto}
.tl-body{margin-top:6px;background:var(--surface-2);border-radius:10px;padding:10px 12px;font-size:13.5px;white-space:pre-wrap}
.tl-body .tl-row{display:flex;gap:6px;margin-top:4px;font-size:12.5px;color:var(--text-2)}
.tl-body .tl-row b{color:var(--muted);font-weight:600;min-width:86px}
.task{display:flex;align-items:flex-start;gap:10px;padding:9px 0;border-bottom:1px dashed var(--border)}
.task:last-child{border-bottom:0}
.task input{margin-top:3px;accent-color:var(--accent);width:16px;height:16px}
.task.done span{text-decoration:line-through;color:var(--muted)}
.note{background:var(--surface-2);border-radius:10px;padding:10px 12px;margin-bottom:8px;font-size:13.5px;white-space:pre-wrap;position:relative}
.note small{display:block;color:var(--muted);font-size:11.5px;margin-top:5px}
.tabs{display:flex;gap:2px;border-bottom:1px solid var(--border);padding:0 14px;overflow-x:auto}
.tabs button{border:0;background:none;padding:12px 12px;cursor:pointer;color:var(--muted);font-weight:650;border-bottom:2px solid transparent;margin-bottom:-1px;white-space:nowrap}
.tabs button.on{color:var(--text);border-color:var(--accent)}
.tabs button .count{font-size:11px;background:var(--surface-3);border-radius:10px;padding:1px 6px;margin-left:5px;color:var(--text-2)}

/* ============ Follow-ups ============ */
.fu-layout{grid-template-columns:minmax(0,1fr) minmax(0,420px);align-items:start}
.fu-tabs{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:10px;margin-bottom:16px}
.fu-tab{text-align:left;padding:12px 14px;border-radius:12px;background:var(--surface);border:1px solid var(--border);cursor:pointer;transition:all .15s;position:relative;overflow:hidden}
.fu-tab:hover{border-color:var(--border-2)}
.fu-tab.on{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.fu-tab .n{font-size:24px;font-weight:800;font-variant-numeric:tabular-nums}
.fu-tab .l{font-size:12px;color:var(--text-2);font-weight:600;display:flex;align-items:center;gap:6px}
.fu-tab .bar{position:absolute;left:0;top:0;bottom:0;width:3px}
.fu-item{display:flex;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid var(--border);transition:background .12s}
.fu-item:hover{background:var(--surface-2)}
.fu-item:last-child{border-bottom:0}
.fu-item .info{flex:1;min-width:0}
.fu-item .info .lead-name{cursor:pointer}
.fu-item .info .lead-name:hover{color:var(--accent-2)}
.badge-over{font-size:11.5px;font-weight:700;padding:2px 8px;border-radius:20px;white-space:nowrap}
.cal-head{display:flex;align-items:center;gap:8px;padding:14px 16px 8px}
.cal-head h3{margin:0;font-size:14.5px;flex:1;text-transform:capitalize}
.cal{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;padding:6px 14px 14px}
.cal .dow{font-size:11px;text-transform:uppercase;color:var(--muted);text-align:center;font-weight:700;padding:4px 0}
.cal .day{aspect-ratio:1/1;border-radius:9px;background:var(--surface-2);padding:5px;font-size:12px;cursor:pointer;display:flex;flex-direction:column;justify-content:space-between;border:1px solid transparent;transition:all .12s;min-height:38px}
.cal .day:hover{border-color:var(--border-2)}
.cal .day.out{opacity:.35}
.cal .day.today{border-color:var(--accent)}
.cal .day.sel{background:var(--accent-soft);border-color:var(--accent)}
.cal .day .dots{display:flex;gap:2px;flex-wrap:wrap}
.cal .day .dots i{width:6px;height:6px;border-radius:50%}
.cal .day .cnt{font-size:10.5px;font-weight:800;align-self:flex-end;background:var(--accent);color:#fff;border-radius:6px;padding:0 5px}
.cal .day.past .cnt{background:var(--red)}

/* ============ Pipeline ============ */
.board{display:flex;gap:14px;overflow-x:auto;padding-bottom:12px;align-items:flex-start;min-height:calc(100vh - 220px)}
.col{flex:0 0 278px;background:var(--bg-2);border:1px solid var(--border);border-radius:var(--radius);display:flex;flex-direction:column;max-height:calc(100vh - 200px)}
.col-h{padding:13px 14px 10px;border-bottom:1px solid var(--border)}
.col-h .t{display:flex;align-items:center;gap:8px;font-weight:700}
.col-h .t .n{margin-left:auto;font-size:12px;background:var(--surface-3);padding:1px 8px;border-radius:20px;color:var(--text-2)}
.col-h .sum{font-size:12px;color:var(--muted);margin-top:3px}
.col-h .stripe{height:3px;border-radius:3px;margin-bottom:10px}
.col-list{padding:10px;display:flex;flex-direction:column;gap:9px;overflow-y:auto;min-height:90px;flex:1}
.kcard{background:var(--surface);border:1px solid var(--border);border-radius:11px;padding:11px 12px;cursor:grab;transition:border-color .15s,box-shadow .15s,transform .15s;user-select:none}
.kcard:hover{border-color:var(--border-2);box-shadow:var(--shadow)}
.kcard:active{cursor:grabbing}
.kcard .kn{font-weight:650;font-size:13.5px;margin-bottom:7px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.kcard .kr{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:12px;color:var(--muted)}
.kcard .kf{display:flex;align-items:center;justify-content:space-between;margin-top:9px;font-size:12px}
.kcard .kf b{font-variant-numeric:tabular-nums}
.sortable-ghost{opacity:.35}
.sortable-chosen{box-shadow:0 0 0 2px var(--accent)!important}
.sortable-drag{transform:rotate(2deg)}

/* ============ Modals & toasts ============ */
.modal-root{position:fixed;inset:0;z-index:100;display:none}
.modal-root.open{display:block}
.modal-bg{position:absolute;inset:0;background:rgba(5,5,10,.62);backdrop-filter:blur(3px);animation:fade .2s ease}
@keyframes fade{from{opacity:0}}
.modal{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:min(680px,calc(100vw - 24px));max-height:calc(100vh - 40px);display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--border-2);border-radius:18px;box-shadow:var(--shadow-lg);animation:pop .22s cubic-bezier(.2,.8,.2,1)}
.modal.sm{width:min(440px,calc(100vw - 24px))}
@keyframes pop{from{opacity:0;transform:translate(-50%,-47%) scale(.98)}}
.modal-h{display:flex;align-items:center;gap:10px;padding:18px 20px;border-bottom:1px solid var(--border)}
.modal-h h3{margin:0;font-size:16.5px;font-weight:750;flex:1}
.modal-b{padding:20px;overflow:auto}
.modal-f{display:flex;gap:10px;justify-content:flex-end;padding:14px 20px;border-top:1px solid var(--border);flex-wrap:wrap}
.toasts{position:fixed;right:20px;bottom:20px;z-index:200;display:flex;flex-direction:column;gap:8px}
.toast{display:flex;align-items:center;gap:10px;background:var(--surface-3);border:1px solid var(--border-2);padding:11px 14px;border-radius:11px;box-shadow:var(--shadow-lg);animation:slideIn .25s ease;font-weight:550;max-width:360px}
.toast .ico{color:var(--green)}
.toast.err .ico{color:var(--red)}
@keyframes slideIn{from{opacity:0;transform:translateX(20px)}}
.warn-box{background:var(--orange-soft);border:1px solid color-mix(in srgb,var(--orange) 35%,transparent);border-radius:10px;padding:10px 12px;font-size:13px;margin-bottom:14px}
.warn-box ul{margin:6px 0 0;padding-left:18px}
.info-box{background:var(--blue-soft);border:1px solid color-mix(in srgb,var(--blue) 30%,transparent);border-radius:10px;padding:10px 12px;font-size:12.5px;color:var(--text-2)}
.drop{border:2px dashed var(--border-2);border-radius:14px;padding:28px;text-align:center;cursor:pointer;transition:all .15s}
.drop:hover,.drop.over{border-color:var(--accent);background:var(--accent-soft)}

/* ============ Responsive ============ */
@media (max-width:1180px){
  .kpi-hero{grid-template-columns:repeat(2,minmax(0,1fr))}
  .span-8,.span-7,.span-6,.span-5,.span-4{grid-column:span 12}
  .fu-layout,.detail{grid-template-columns:minmax(0,1fr)}
}
@media (max-width:900px){
  .sidebar{position:fixed;left:0;top:0;bottom:0;transform:translateX(-102%);transition:transform .25s cubic-bezier(.2,.8,.2,1);box-shadow:var(--shadow-lg)}
  .sidebar.open{transform:none}
  .scrim{display:block;position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:35;opacity:0;pointer-events:none;transition:opacity .2s}
  .scrim.open{opacity:1;pointer-events:auto}
  .only-mobile,.icon-btn.only-mobile{display:inline-grid}
  .topbar{padding:12px 16px;gap:10px;flex-wrap:wrap}
  .top-search{order:5;width:100%;margin-left:0}
  .top-title{flex:1}
  .view{padding:16px 16px 60px}
}
@media (max-width:640px){
  .hide-sm{display:none}
  .kpi-hero{grid-template-columns:1fr 1fr;gap:10px}
  .kpi{padding:14px}
  .kpi .k-val{font-size:22px}
  .stat-strip{grid-template-columns:1fr 1fr;gap:10px}
  .form-grid{grid-template-columns:1fr}
  .toolbar .input,.toolbar .select{flex:1 1 calc(50% - 5px);min-width:0}
  .toolbar > .btn{flex:1 1 0;justify-content:center}
  .toolbar > .spacer{display:none}
  .toolbar .search-in{max-width:none;min-width:100%}
  .lead-hero{padding:16px}
  .lead-hero .hero-actions{margin-left:0;width:100%}
  .kv{grid-template-columns:110px 1fr}
  .funnel-row{grid-template-columns:90px 1fr 70px}
  /* table → cards */
  .tbl.responsive thead{display:none}
  .tbl.responsive,.tbl.responsive tbody,.tbl.responsive tr,.tbl.responsive td{display:block;width:100%}
  .tbl.responsive tr{padding:12px 14px;border-bottom:1px solid var(--border)}
  .tbl.responsive td{border:0;padding:3px 0;display:flex;justify-content:space-between;gap:10px}
  .tbl.responsive td[data-l]::before{content:attr(data-l);color:var(--muted);font-size:12px}
  .tbl.responsive td.first{display:block}
  .tbl.responsive .actions{justify-content:flex-start;margin-top:4px}
  .modal{top:auto;bottom:0;transform:translateX(-50%);border-radius:18px 18px 0 0;max-height:92vh;width:100vw}
  @keyframes pop{from{opacity:0;transform:translate(-50%,30px)}}
  .toasts{left:12px;right:12px;bottom:12px}
  .cal .day{min-height:32px;padding:3px}
}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
