/* ===== WarriorCRM — dark premium command center (light mode supported) ===== */
:root{
  --bg:#0b0f1a; --surface:#121826; --surface2:#172033; --card:#121826;
  --text:#e8edf6; --muted:#8a94a7; --border:#1e2636; --border2:#283248;
  --primary:#e0453a;          /* warrior red */
  --gold:#d4af37; --blue:#3b82f6; --teal:#2e9bdb;
  --green:#22c55e; --amber:#f59e0b; --red:#ef4444; --purple:#a78bfa; --wa:#25d366;
  --green-bg:rgba(34,197,94,.16);--amber-bg:rgba(245,158,11,.16);--red-bg:rgba(239,68,68,.16);
  --blue-bg:rgba(59,130,246,.16);--gray-bg:rgba(138,148,167,.16);
  --shadow:0 1px 2px rgba(0,0,0,.4),0 2px 8px rgba(0,0,0,.25);
  --grad:linear-gradient(135deg,var(--primary),#7a1f1a);
  --gold-grad:linear-gradient(135deg,var(--gold),#a8842a);
}
[data-theme="light"]{
  --bg:#eef1f7; --surface:#ffffff; --surface2:#f4f6fb; --card:#ffffff;
  --text:#10182a; --muted:#64748b; --border:#e4e8f0; --border2:#d8dee9;
  --shadow:0 1px 2px rgba(16,24,40,.06),0 1px 3px rgba(16,24,40,.06);
  --green-bg:#dcfce7;--amber-bg:#fef3c7;--red-bg:#fee2e2;--blue-bg:#dbeafe;--gray-bg:#eef1f6;
}
*{box-sizing:border-box;margin:0;padding:0}
body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;background:var(--bg);color:var(--text);font-size:14px;-webkit-font-smoothing:antialiased}
.hidden{display:none!important}.muted{color:var(--muted)}
#app{display:flex;min-height:100vh}
@keyframes fadeUp{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
#content>*{animation:fadeUp .25s ease both}

/* sidebar */
#sidebar{width:240px;background:var(--surface);border-right:1px solid var(--border);display:flex;flex-direction:column;position:fixed;inset:0 auto 0 0;overflow-y:auto;z-index:40}
.brand{display:flex;gap:11px;align-items:center;padding:16px;border-bottom:1px solid var(--border);cursor:pointer}
.brand-logo{font-size:24px;width:40px;height:40px;display:flex;align-items:center;justify-content:center;background:var(--grad);border-radius:11px;box-shadow:0 4px 14px rgba(224,69,58,.4)}
.brand-name{font-weight:800;font-size:16px;color:var(--text);letter-spacing:.2px}
.brand-name b{color:var(--gold)}
.brand-sub{font-size:10px;color:var(--muted);letter-spacing:.03em}
#nav{flex:1;padding:6px 8px}
.nav-group{padding:14px 10px 5px;font-size:9.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);font-weight:800;opacity:.75}
.nav-item{display:flex;align-items:center;gap:11px;padding:8px 10px;border-radius:9px;cursor:pointer;color:var(--muted);font-size:13.5px;margin-bottom:1px;position:relative}
.nav-item:hover{background:var(--surface2);color:var(--text)}
.nav-item.active{background:linear-gradient(90deg,rgba(224,69,58,.18),transparent);color:var(--text);font-weight:700}
.nav-item.active::before{content:"";position:absolute;left:0;top:6px;bottom:6px;width:3px;border-radius:3px;background:var(--primary)}
.nav-item .ico{width:18px;text-align:center;font-size:14px}
.nav-item .nl{flex:1}
.nav-item .count{background:var(--surface2);color:var(--muted);border-radius:9px;padding:0 7px;font-size:11px;font-weight:700}
.nav-item.active .count{background:rgba(224,69,58,.25);color:#ffd9d4}
.sidebar-foot{padding:12px 16px;font-size:10.5px;color:var(--muted);border-top:1px solid var(--border)}
.sidebar-foot b{color:var(--gold)}

/* main + topbar */
#main{flex:1;margin-left:240px;display:flex;flex-direction:column;min-width:0}
#topbar{display:flex;align-items:center;gap:12px;background:var(--surface);padding:11px 20px;border-bottom:1px solid var(--border);position:sticky;top:0;z-index:30}
#hamburger{display:none;background:none;border:none;font-size:22px;cursor:pointer;color:var(--text)}
.crumb{font-size:16px;font-weight:700;color:var(--text);white-space:nowrap}
.crumb-link{color:var(--teal);cursor:pointer}.crumb-link:hover{text-decoration:underline}
.crumb-sep{color:var(--muted);margin:0 2px}
.gsearch{position:relative;margin-left:auto;width:min(320px,34vw)}
.gs-ico{position:absolute;left:11px;top:50%;transform:translateY(-50%);font-size:13px;opacity:.6}
#globalSearch{width:100%;padding:9px 12px 9px 32px;border:1px solid var(--border2);border-radius:9px;font-size:13px;background:var(--bg);color:var(--text)}
#globalSearch:focus{outline:none;border-color:var(--primary)}
.search-results{position:absolute;top:44px;left:0;right:0;background:var(--surface);border:1px solid var(--border2);border-radius:10px;box-shadow:var(--shadow);max-height:60vh;overflow-y:auto;z-index:60;padding:6px}
.sr-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:8px;cursor:pointer}
.sr-item:hover{background:var(--surface2)}
.sr-empty{padding:14px;color:var(--muted);font-size:13px;text-align:center}
.roleSel{background:var(--bg);color:var(--text);border:1px solid var(--border2);border-radius:9px;padding:8px 9px;font-size:12.5px;font-weight:600;cursor:pointer}
.iconbtn{background:var(--bg);border:1px solid var(--border2);color:var(--text);border-radius:9px;width:38px;height:36px;cursor:pointer;font-size:15px}
.iconbtn:hover{border-color:var(--primary)}

/* buttons */
.btn{border:none;border-radius:9px;padding:8px 13px;font-size:13px;font-weight:600;cursor:pointer;display:inline-flex;align-items:center;gap:6px;text-decoration:none}
.btn-primary{background:var(--grad);color:#fff;box-shadow:0 3px 12px rgba(224,69,58,.35)}
.btn-primary:hover{filter:brightness(1.06)}
.btn-light{background:var(--surface2);color:var(--text);border:1px solid var(--border2)}
.btn-light:hover{border-color:var(--muted)}
.btn-danger{background:var(--red-bg);color:var(--red)}
.btn-success{background:var(--green-bg);color:var(--green)}
.btn-gold{background:var(--gold-grad);color:#1a1206;font-weight:700}
.btn-wa{background:var(--wa);color:#04250f;font-weight:700}
.btn-sm{padding:5px 10px;font-size:12px}
.ic-btn{background:none;border:none;cursor:pointer;font-size:14px;padding:4px 6px;border-radius:6px;opacity:.7;color:var(--text)}
.ic-btn:hover{opacity:1;background:var(--surface2)}
.menu-wrap{position:relative}
.menu{position:absolute;right:0;top:44px;background:var(--surface);border:1px solid var(--border2);border-radius:10px;box-shadow:var(--shadow);min-width:200px;z-index:55;padding:6px}
.menu button{display:flex;gap:8px;align-items:center;width:100%;text-align:left;padding:9px 12px;background:none;border:none;cursor:pointer;font-size:13px;color:var(--text);border-radius:7px}
.menu button:hover{background:var(--surface2)}.menu button.danger{color:var(--red)}

#content{padding:20px;max-width:1340px;width:100%}

/* avatars */
.ava{display:inline-flex;align-items:center;justify-content:center;border-radius:50%;color:#fff;font-weight:700;flex:none}
.ava.xs{width:26px;height:26px;font-size:10px}.ava.sm{width:30px;height:30px;font-size:11px}.ava.lg{width:54px;height:54px;font-size:18px}

/* tiles */
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(168px,1fr));gap:13px;margin-bottom:18px}
.tile{background:var(--card);border:1px solid var(--border);border-radius:13px;padding:14px 15px;box-shadow:var(--shadow);position:relative;overflow:hidden}
.tile::after{content:"";position:absolute;right:-20px;top:-20px;width:70px;height:70px;border-radius:50%;background:radial-gradient(circle,rgba(212,175,55,.10),transparent 70%)}
.tile-top{display:flex;align-items:center;gap:8px;margin-bottom:9px}
.tile-ico{width:30px;height:30px;border-radius:9px;display:flex;align-items:center;justify-content:center;font-size:15px}
.tile-label{font-size:11px;color:var(--muted);font-weight:600}
.tile-val{font-size:25px;font-weight:800;color:var(--text)}

/* cards */
.card{background:var(--card);border:1px solid var(--border);border-radius:13px;padding:16px;box-shadow:var(--shadow);margin-bottom:16px}
.card-h{font-size:13px;font-weight:700;color:var(--text);margin-bottom:12px;display:flex;align-items:center;gap:8px}
.card-sub{background:var(--surface2);color:var(--muted);border-radius:9px;padding:1px 8px;font-size:11px;font-weight:700}
.card-h .spacer{margin-left:auto}
.cards-3{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}
.cards-2{display:grid;grid-template-columns:1fr 1fr;gap:16px}

.donut-wrap{display:flex;gap:14px;align-items:center}
.legend{flex:1;font-size:12px}
.legend-row{display:flex;align-items:center;gap:7px;padding:3px 0}
.legend-row .dot{width:9px;height:9px;border-radius:2px}
.legend-v{margin-left:auto;font-weight:700;color:var(--text)}

.funnel{display:flex;flex-direction:column;gap:6px}
.funnel-row{display:flex;align-items:center;gap:8px;font-size:12px}
.funnel-row .fl{width:120px;color:var(--muted);flex:none}
.funnel-bar{height:20px;border-radius:5px;color:#fff;display:flex;align-items:center;justify-content:flex-end;padding:0 7px;font-size:11px;font-weight:700;min-width:20px}

.mini-list{list-style:none}
.mini-list li{display:flex;align-items:center;gap:10px;padding:8px 4px;border-bottom:1px solid var(--border);font-size:13px;cursor:pointer;border-radius:6px}
.mini-list li:last-child{border-bottom:none}.mini-list li:hover{background:var(--surface2)}
.ml-name{flex:1;display:flex;flex-direction:column;line-height:1.25;min-width:0}
.ml-name small{color:var(--muted);font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mini-empty{color:var(--muted);font-size:13px;padding:10px 4px}

/* activity feed */
.feed{list-style:none}
.feed li{display:flex;gap:10px;padding:8px 2px;border-bottom:1px solid var(--border);font-size:12.5px}
.feed li:last-child{border-bottom:none}
.feed .fdot{width:8px;height:8px;border-radius:50%;margin-top:5px;flex:none}
.feed .ftime{color:var(--muted);font-size:11px}

.target-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:10px}
.target-row label{font-size:12px;color:var(--muted)}
.target-row input{padding:8px 10px;border:1px solid var(--border2);border-radius:8px;background:var(--bg);color:var(--text);width:160px}
.target-txt{font-size:13px;color:var(--text)}
.progress{height:9px;background:var(--surface2);border-radius:6px;overflow:hidden}
.progress>div{height:100%;background:linear-gradient(90deg,var(--gold),var(--primary))}

/* toolbar + table */
.toolbar{display:flex;gap:10px;align-items:center;margin-bottom:14px;flex-wrap:wrap}
.search{flex:1;min-width:170px;padding:9px 12px;border:1px solid var(--border2);border-radius:9px;font-size:13px;background:var(--surface);color:var(--text)}
.tb-right{display:flex;gap:8px;margin-left:auto}
.chips{display:flex;gap:6px;flex-wrap:wrap}
.chip{padding:5px 12px;border-radius:20px;border:1px solid var(--border2);background:var(--surface);cursor:pointer;font-size:12px;color:var(--muted)}
.chip.active{background:var(--grad);color:#fff;border-color:transparent}
.bulkbar{display:flex;align-items:center;gap:10px;background:rgba(224,69,58,.12);border:1px solid rgba(224,69,58,.3);border-radius:9px;padding:8px 12px;margin-bottom:12px;font-size:13px;font-weight:600;color:var(--text)}
.table-wrap{background:var(--card);border:1px solid var(--border);border-radius:13px;overflow:auto;box-shadow:var(--shadow)}
table{width:100%;border-collapse:collapse;font-size:13px}
th{background:var(--surface2);text-align:left;padding:10px 12px;font-size:10.5px;text-transform:uppercase;letter-spacing:.03em;color:var(--muted);font-weight:700;white-space:nowrap;border-bottom:1px solid var(--border)}
th.sortable{cursor:pointer;user-select:none}th.sortable:hover{color:var(--text)}
th.chk,td.chk{width:34px;text-align:center}
th.ava-h,td.ava-cell{width:38px}
td{padding:9px 12px;border-bottom:1px solid var(--border);white-space:nowrap;color:var(--text)}
tr:last-child td{border-bottom:none}
tr.row:hover{background:var(--surface2);cursor:pointer}
.rowact{text-align:right;white-space:nowrap}
.list-foot{margin-top:10px;color:var(--muted);font-size:12px}
.empty-state{text-align:center;padding:46px 20px;color:var(--muted)}
.empty-state .big{font-size:42px;margin-bottom:8px}
input,select,textarea{color:var(--text)}

/* pills */
.pill{display:inline-block;padding:3px 9px;border-radius:14px;font-size:11px;font-weight:700;white-space:nowrap}
.pill-green{background:var(--green-bg);color:var(--green)}
.pill-amber{background:var(--amber-bg);color:var(--amber)}
.pill-red{background:var(--red-bg);color:var(--red)}
.pill-gray{background:var(--gray-bg);color:var(--muted)}
.pill-blue{background:var(--blue-bg);color:var(--blue)}

/* kanban */
.kanban{display:flex;gap:14px;overflow-x:auto;padding-bottom:10px}
.kcol{background:var(--surface);border:1px solid var(--border);border-radius:12px;min-width:236px;width:236px;flex:none;display:flex;flex-direction:column}
.kcol-h{display:flex;justify-content:space-between;align-items:center;padding:11px 13px;font-size:12px;font-weight:700;color:var(--text)}
.kcol-n{background:var(--surface2);border-radius:9px;padding:0 7px;font-size:11px;color:var(--muted)}
.kcol-body{padding:0 9px 12px;display:flex;flex-direction:column;gap:8px;min-height:60px}
.kcol-body.drop{background:rgba(59,130,246,.12);border-radius:8px;outline:2px dashed var(--blue)}
.kc{background:var(--card);border:1px solid var(--border2);border-radius:9px;padding:10px;display:flex;gap:9px;align-items:flex-start;cursor:grab;box-shadow:var(--shadow)}
.kc.dragging{opacity:.4}
.kc-t{font-size:13px;font-weight:600;color:var(--text)}
.kc-s{font-size:11.5px;color:var(--muted);margin-top:2px}
.kempty{color:var(--muted);font-size:12px;text-align:center;padding:8px;opacity:.5}

/* detail */
.detail-head{display:flex;align-items:center;gap:16px}
.dh-info{flex:1;min-width:0}
.dh-name{font-size:20px;font-weight:800;color:var(--text)}
.dh-id{font-size:12px;color:var(--muted);font-weight:600;font-family:ui-monospace,monospace}
.dh-badges{margin-top:6px;display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.hb{font-weight:800;color:var(--green)}
.dh-acts{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.detail-grid{display:grid;grid-template-columns:1.7fr 1fr;gap:16px}
.fields{display:grid;grid-template-columns:1fr 1fr;gap:2px 18px}
.frow{display:flex;justify-content:space-between;gap:12px;padding:7px 0;border-bottom:1px solid var(--border);font-size:13px}
.frow .fk{color:var(--muted)}
.frow .fv{font-weight:600;text-align:right;word-break:break-word}
.radar-wrap{display:flex;align-items:center;justify-content:center;gap:6px}
.radar-avg{font-size:11px;color:var(--muted);text-align:center}
.radar-avg b{font-size:20px;color:var(--text)}
.log-btns{display:flex;gap:6px;margin-bottom:8px;flex-wrap:wrap}
#noteBox{width:100%;min-height:54px;border:1px solid var(--border2);border-radius:8px;padding:8px;font-size:13px;font-family:inherit;resize:vertical;margin-bottom:8px;background:var(--bg);color:var(--text)}
.timeline{display:flex;flex-direction:column;gap:2px}
.tl-item{display:flex;gap:10px;padding:7px 0;border-bottom:1px solid var(--border)}
.tl-item:last-child{border-bottom:none}
.tl-dot{width:9px;height:9px;border-radius:50%;margin-top:5px;flex:none}
.tl-txt{font-size:13px}.tl-time{font-size:11px;color:var(--muted);margin-top:1px}

/* channels */
.ch-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:14px}
.ch-card{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:14px;box-shadow:var(--shadow)}
.ch-top{display:flex;align-items:center;gap:9px;margin-bottom:11px}
.ch-ico{font-size:20px}.ch-name{font-weight:700;color:var(--text);font-size:13.5px;flex:1}
.ch-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;text-align:center;margin-bottom:11px}
.ch-stats div{background:var(--surface2);border-radius:8px;padding:7px 2px}
.ch-stats b{display:block;font-size:16px;color:var(--text)}
.ch-stats span{font-size:9px;color:var(--muted);text-transform:uppercase}
.ch-card .btn{width:100%;justify-content:center}

/* AI assistant */
.ai-badge{display:inline-block;background:var(--gold-grad);color:#1a1206;font-size:10px;font-weight:800;padding:2px 9px;border-radius:20px;letter-spacing:.04em}
.ai-block{border-left:3px solid var(--gold);padding:10px 14px;background:var(--surface2);border-radius:0 10px 10px 0;margin-bottom:10px}
.ai-block .lbl{font-size:11px;color:var(--gold);font-weight:700;text-transform:uppercase;letter-spacing:.04em;margin-bottom:4px}
.ai-block .txt{font-size:13.5px;line-height:1.55}

/* scoring */
.factor{display:flex;align-items:center;gap:12px;margin-bottom:14px}
.factor .fname{width:160px;font-weight:600;font-size:13px}
.factor .fweight{width:48px;color:var(--muted);font-size:12px}
.factor input[type=range]{flex:1;accent-color:var(--primary)}
.factor .fval{width:26px;text-align:center;font-weight:700;color:var(--gold)}
.score-result{text-align:center;margin-top:10px;padding-top:12px;border-top:1px solid var(--border)}
.score-band{font-size:17px;font-weight:700;margin-top:2px}
.tip{background:var(--blue-bg);color:var(--blue);padding:11px 15px;border-radius:10px;font-size:13px;margin-bottom:16px;border:1px solid rgba(59,130,246,.25)}

/* templates */
.tmpl-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:14px}
.tmpl textarea{width:100%;min-height:120px;border:1px solid var(--border2);border-radius:8px;padding:9px;font-size:12.5px;font-family:inherit;resize:vertical;line-height:1.5;background:var(--bg);color:var(--text)}
.tmpl-foot{display:flex;gap:8px;margin-top:9px;align-items:center}
.tmpl .ph{width:108px;padding:7px 9px;border:1px solid var(--border2);border-radius:7px;font-size:12px;background:var(--bg);color:var(--text)}
.total-row{background:var(--surface2);font-weight:800;color:var(--text)}
.total-row td{border-top:2px solid var(--border2)}

/* settings */
.set-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.set-grid .field{display:flex;flex-direction:column;gap:5px}
.set-grid label{font-size:12px;color:var(--muted);font-weight:600}
.set-grid input,.set-grid select{padding:9px 11px;border:1px solid var(--border2);border-radius:8px;background:var(--bg);color:var(--text);font-size:13px}
.role-card{display:flex;gap:10px;align-items:flex-start;padding:10px;border:1px solid var(--border);border-radius:10px;margin-bottom:8px}
.role-card .rico{font-size:18px}

/* modal */
#overlay{position:fixed;inset:0;background:rgba(3,6,14,.6);z-index:60}
.modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:var(--surface);border:1px solid var(--border2);border-radius:14px;width:min(740px,94vw);max-height:90vh;overflow-y:auto;z-index:70;box-shadow:0 24px 60px rgba(0,0,0,.6)}
.modal-head{display:flex;justify-content:space-between;align-items:center;padding:16px 20px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--surface);border-radius:14px 14px 0 0}
.modal-head h2{font-size:16px;color:var(--text)}
.modal-close{background:none;border:none;font-size:21px;cursor:pointer;color:var(--muted)}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:13px;padding:20px}
.field{display:flex;flex-direction:column;gap:5px}.field.full{grid-column:1/-1}
.field label{font-size:12px;font-weight:600;color:var(--muted)}
.field input,.field select,.field textarea{padding:9px 11px;border:1px solid var(--border2);border-radius:8px;font-size:13px;font-family:inherit;background:var(--bg);color:var(--text)}
.field input:focus,.field select:focus,.field textarea:focus{outline:none;border-color:var(--primary)}
.field textarea{resize:vertical;min-height:60px}
.field .computed{padding:9px 11px;background:var(--surface2);border-radius:8px;font-size:13px;color:var(--gold);font-weight:700}
.modal-foot{display:flex;justify-content:space-between;gap:10px;padding:15px 20px;border-top:1px solid var(--border);position:sticky;bottom:0;background:var(--surface)}
.mf-r{display:flex;gap:10px}

/* toast */
#toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:var(--surface2);border:1px solid var(--border2);color:var(--text);padding:11px 20px;border-radius:24px;font-size:13px;z-index:90;box-shadow:var(--shadow);opacity:0;transition:opacity .2s,transform .2s;pointer-events:none}
#toast.show{opacity:1;transform:translateX(-50%) translateY(-4px)}

@media(max-width:980px){.cards-3{grid-template-columns:1fr}.cards-2{grid-template-columns:1fr}.detail-grid{grid-template-columns:1fr}.set-grid{grid-template-columns:1fr}}
@media(max-width:860px){
  #sidebar{transform:translateX(-100%);transition:transform .25s;z-index:80}
  #app.sidebar-open #sidebar{transform:translateX(0)}
  #main{margin-left:0}#hamburger{display:block}
  .gsearch{width:auto;flex:1}.crumb{display:none}
  .form-grid{grid-template-columns:1fr}.fields{grid-template-columns:1fr}
  .roleSel{display:none}
}
