/* =====================================================================
   Fast2SMS CRM — design system
   Red/white, minimal, generous whitespace. Matches the sample screenshots.
   ===================================================================== */
:root{
  --red:#E0242A; --red-dark:#C01D22; --red-050:#FEECEC; --red-100:#FBD5D6;
  --ink:#111827; --ink-2:#374151; --muted:#6B7280; --muted-2:#9CA3AF;
  --line:#E9EAEC; --line-2:#EEF0F2;
  --bg:#F7F7F8; --card:#FFFFFF; --sidebar:#FFFFFF;
  --green:#10B981; --green-050:#ECFDF5;
  --amber:#F59E0B; --amber-050:#FEF6E7;
  --blue:#2563EB; --indigo:#6366F1;
  --radius:14px; --radius-sm:10px;
  --shadow:0 1px 2px rgba(16,24,40,.04),0 1px 3px rgba(16,24,40,.06);
  --shadow-lg:0 8px 24px rgba(16,24,40,.10);
  --sidebar-w:248px; --topbar-h:76px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Inter,Helvetica,Arial,sans-serif;
  background:var(--bg); color:var(--ink); font-size:14.5px; line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
a{color:inherit;text-decoration:none}
button{font-family:inherit}
h1,h2,h3,h4{margin:0;font-weight:700}
.muted{color:var(--muted)}
.small{font-size:12.5px}
.tiny{font-size:11.5px}

/* ---------- App shell ---------- */
.app{display:flex;min-height:100vh}
.sidebar{
  width:var(--sidebar-w);flex:0 0 var(--sidebar-w);background:var(--sidebar);
  border-right:1px solid var(--line);display:flex;flex-direction:column;
  position:sticky;top:0;height:100vh;
}
.sidebar .brand{display:flex;align-items:center;gap:10px;padding:22px 22px 18px}
.sidebar .brand .logo{width:34px;height:34px;border-radius:9px;background:var(--red);
  display:flex;align-items:center;justify-content:center;color:#fff;font-weight:800;font-size:15px}
.sidebar .brand b{font-weight:800;font-size:16px}
.sidebar .brand b span{color:var(--red)}
.nav{padding:6px 12px;display:flex;flex-direction:column;gap:2px;flex:1;overflow:auto}
.nav a{
  display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:10px;
  color:var(--ink-2);font-weight:500;position:relative;
}
.nav a svg{width:19px;height:19px;stroke:var(--muted);flex:0 0 19px}
.nav a:hover{background:#F4F4F5}
.nav a.active{background:var(--red-050);color:var(--red);font-weight:700}
.nav a.active svg{stroke:var(--red)}
.nav a.active::before{content:"";position:absolute;left:-12px;top:8px;bottom:8px;width:3px;
  background:var(--red);border-radius:0 3px 3px 0}
.sidebar .foot{padding:16px 22px;color:var(--muted-2);font-size:12px;border-top:1px solid var(--line-2)}

.main{flex:1;min-width:0;display:flex;flex-direction:column}
.topbar{
  height:var(--topbar-h);display:flex;align-items:center;gap:16px;
  padding:0 30px;background:var(--bg);position:sticky;top:0;z-index:20;
}
.topbar h1{font-size:22px}
.topbar .search{margin-left:auto;position:relative}
.topbar .search input{
  width:340px;max-width:38vw;border:1px solid var(--line);background:#fff;border-radius:11px;
  padding:10px 14px 10px 38px;font-size:14px;color:var(--ink);box-shadow:var(--shadow)}
.topbar .search svg{position:absolute;left:12px;top:50%;transform:translateY(-50%);
  width:16px;height:16px;stroke:var(--muted-2)}
.icon-btn{width:42px;height:42px;border-radius:11px;border:1px solid var(--line);background:#fff;
  display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:var(--shadow)}
.icon-btn svg{width:18px;height:18px;stroke:var(--muted)}
.avatar{width:40px;height:40px;border-radius:50%;background:var(--red);color:#fff;font-weight:700;
  display:flex;align-items:center;justify-content:center;font-size:13px;flex:0 0 40px}
.avatar.sm{width:30px;height:30px;font-size:11px;flex-basis:30px}
.avatar.lg{width:64px;height:64px;font-size:20px;flex-basis:64px;border-radius:16px}
.content{padding:8px 30px 60px;flex:1}

/* ---------- Buttons ---------- */
.btn{display:inline-flex;align-items:center;gap:8px;padding:10px 16px;border-radius:11px;
  border:1px solid var(--line);background:#fff;color:var(--ink);font-weight:600;font-size:14px;
  cursor:pointer;box-shadow:var(--shadow);transition:.12s}
.btn:hover{background:#FafafA}
.btn svg{width:16px;height:16px;stroke:currentColor}
.btn-primary{background:var(--red);border-color:var(--red);color:#fff}
.btn-primary:hover{background:var(--red-dark)}
.btn-danger{color:var(--red);border-color:var(--line)}
.btn-danger:hover{background:var(--red-050)}
.btn-sm{padding:7px 12px;font-size:13px;border-radius:9px}
.btn-ghost{border-color:transparent;box-shadow:none;background:transparent}
.btn-ghost:hover{background:#F1F1F2}

/* ---------- Cards ---------- */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  box-shadow:var(--shadow)}
.card-pad{padding:22px 24px}
.grid{display:grid;gap:18px}
.grid-4{grid-template-columns:repeat(4,1fr)}
.grid-2{grid-template-columns:2fr 1fr}
@media(max-width:1100px){.grid-4{grid-template-columns:repeat(2,1fr)}.grid-2{grid-template-columns:1fr}}

/* KPI card */
.kpi{padding:20px 22px}
.kpi .top{display:flex;justify-content:space-between;align-items:flex-start}
.kpi .label{color:var(--muted);font-weight:600;font-size:13.5px}
.kpi .ico{width:34px;height:34px;border-radius:9px;background:var(--red-050);
  display:flex;align-items:center;justify-content:center}
.kpi .ico svg{width:17px;height:17px;stroke:var(--red)}
.kpi .num{font-size:32px;font-weight:800;margin:12px 0 2px;letter-spacing:-.02em}
.kpi .sub{color:var(--muted);font-size:13px}

/* ---------- Section header ---------- */
.section-head{display:flex;align-items:center;gap:12px;margin-bottom:16px}
.section-head h2{font-size:18px}
.section-head .spacer{flex:1}

/* ---------- Chips / pills ---------- */
.chip{display:inline-flex;align-items:center;gap:6px;padding:4px 11px;border-radius:999px;
  font-size:12.5px;font-weight:600;background:#F1F2F4;color:var(--ink-2)}
.chip .dot{width:7px;height:7px;border-radius:50%;background:var(--muted-2)}
.tag{display:inline-flex;align-items:center;padding:3px 10px;border-radius:999px;font-size:12px;font-weight:600}
.stage-pill{display:inline-flex;align-items:center;gap:7px;padding:4px 12px;border-radius:999px;
  font-size:13px;font-weight:600}

/* ---------- Toolbar (filters row) ---------- */
.toolbar{display:flex;align-items:center;gap:10px;margin-bottom:16px;flex-wrap:wrap}
.toolbar .spacer{flex:1}
.filter-chip{display:inline-flex;align-items:center;gap:7px;padding:9px 14px;border-radius:10px;
  border:1px solid var(--line);background:#fff;font-weight:600;font-size:13.5px;box-shadow:var(--shadow);cursor:pointer}
.filter-chip svg{width:15px;height:15px;stroke:var(--muted)}
.op-hint{color:var(--muted-2);font-size:12.5px}

/* ---------- Tables ---------- */
.table-card{background:#fff;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow)}
table.data{width:100%;border-collapse:collapse}
table.data th{font-size:11.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);
  text-align:left;padding:14px 18px;font-weight:700;border-bottom:1px solid var(--line)}
table.data td{padding:15px 18px;border-bottom:1px solid var(--line-2);vertical-align:middle}
table.data tr:last-child td{border-bottom:none}
table.data tr:hover td{background:#FCFCFD}
.row-name{font-weight:700;color:var(--ink)}
.mini-icons{display:inline-flex;gap:6px;margin-left:8px}
.mini-icons a{width:26px;height:26px;border-radius:7px;border:1px solid var(--line);
  display:inline-flex;align-items:center;justify-content:center;background:#fff}
.mini-icons a svg{width:14px;height:14px;stroke:var(--muted)}
.mini-icons a:hover{background:var(--red-050);border-color:var(--red-100)}
.mini-icons a:hover svg{stroke:var(--red)}

/* ---------- Detail (2-column single page) ---------- */
.detail{display:grid;grid-template-columns:360px 1fr;gap:22px;align-items:start}
@media(max-width:1000px){.detail{grid-template-columns:1fr}}
.profile-card{padding:24px}
.profile-card .head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:18px}
.profile-card h2{font-size:22px;margin-top:14px}
.profile-card .chips{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0 18px}
.field{padding:12px 0;border-bottom:1px solid var(--line-2)}
.field:last-child{border-bottom:none}
.field .k{color:var(--muted);font-weight:600;font-size:12.5px;display:flex;align-items:center;gap:7px;margin-bottom:4px}
.field .k svg{width:15px;height:15px;stroke:var(--muted-2)}
.field .v{color:var(--ink);font-weight:500}
.meta-foot{color:var(--muted);font-size:12.5px;margin-top:16px;line-height:1.7}

.tabs{display:flex;gap:26px;border-bottom:1px solid var(--line);margin-bottom:22px;overflow-x:auto}
.tabs a{padding:12px 2px;color:var(--muted);font-weight:600;white-space:nowrap;border-bottom:2px solid transparent;margin-bottom:-1px}
.tabs a.active{color:var(--red);border-bottom-color:var(--red)}
.tabs a:hover{color:var(--ink)}

/* linked deal row */
.deal-row{display:flex;align-items:center;gap:14px;padding:16px 18px;border:1px solid var(--line);
  border-radius:12px;margin-bottom:10px;background:#fff}
.deal-row:hover{box-shadow:var(--shadow)}
.deal-row .t{font-weight:700}
.deal-row .p{color:var(--muted);font-size:12.5px}
.deal-row .spacer{flex:1}
.deal-row .amt{font-weight:800}

/* ---------- Notes (WhatsApp style) ---------- */
.note-item{display:flex;gap:12px;padding:14px 0;border-bottom:1px solid var(--line-2)}
.note-item .body{flex:1}
.note-item .who{font-weight:700;font-size:13.5px}
.note-item .when{color:var(--muted-2);font-size:12px}
.note-item .text{margin:4px 0 0;white-space:pre-wrap}
.note-item .acts{display:flex;gap:10px;margin-top:6px}
.note-item .acts button{background:none;border:none;color:var(--muted);font-size:12px;cursor:pointer;padding:0}
.note-item .acts button:hover{color:var(--red)}
.pinned{background:var(--amber-050);border-radius:10px;padding:12px;border-bottom:none}
.note-compose{display:flex;gap:10px;margin-top:8px}
.note-compose textarea{flex:1;border:1px solid var(--line);border-radius:12px;padding:12px 14px;
  font-family:inherit;font-size:14px;resize:vertical;min-height:46px}

/* ---------- Kanban ---------- */
.kanban{display:flex;gap:16px;overflow-x:auto;padding-bottom:20px}
.kcol{flex:0 0 288px;width:288px}
.kcol .khead{display:flex;align-items:center;gap:8px;margin-bottom:12px;padding:0 4px}
.kcol .khead .cnt{margin-left:auto;color:var(--muted);font-weight:700;font-size:13px}
.kcard{background:#fff;border:1px solid var(--line);border-radius:12px;padding:15px 16px;margin-bottom:10px;
  box-shadow:var(--shadow);cursor:grab}
.kcard:hover{box-shadow:var(--shadow-lg)}
.kcard.dragging{opacity:.5}
.kcard .t{font-weight:700;margin-bottom:8px}
.kcard .r{display:flex;justify-content:space-between;align-items:center}
.kcard .amt{font-weight:800}
.kcard .prob{color:var(--muted);font-size:12.5px}
.kcol.drop{background:var(--red-050);border-radius:12px}

/* ---------- Progress bars ---------- */
.bars{display:flex;flex-direction:column;gap:14px}
.bar-row{display:flex;align-items:center;gap:14px}
.bar-row .lbl{width:130px;flex:0 0 130px}
.bar-track{flex:1;height:20px;background:#EDEEF0;border-radius:7px;overflow:hidden}
.bar-fill{height:100%;background:linear-gradient(90deg,#E0242A,#C01D22);border-radius:7px}
.bar-row .val{width:34px;text-align:right;font-weight:800}
.progress{height:9px;background:#EDEEF0;border-radius:6px;overflow:hidden}
.progress > i{display:block;height:100%;background:var(--red);border-radius:6px}

/* ---------- Schedule / activity list ---------- */
.list-item{display:flex;align-items:center;gap:12px;padding:14px 0;border-bottom:1px solid var(--line-2)}
.list-item:last-child{border-bottom:none}
.list-item .ico{width:36px;height:36px;border-radius:9px;background:var(--red-050);
  display:flex;align-items:center;justify-content:center;flex:0 0 36px}
.list-item .ico svg{width:17px;height:17px;stroke:var(--red)}
.list-item .when{margin-left:auto;color:var(--muted);font-size:13px;white-space:nowrap}
.list-item .t{font-weight:600}

/* checkbox tasks */
.task-line{display:flex;align-items:center;gap:12px;padding:12px 2px;border-bottom:1px solid var(--line-2)}
.task-line:last-child{border-bottom:none}
.task-check{width:20px;height:20px;border:2px solid var(--muted-2);border-radius:6px;cursor:pointer;
  display:inline-flex;align-items:center;justify-content:center;flex:0 0 20px;background:#fff}
.task-check.done{background:var(--red);border-color:var(--red)}
.task-check svg{width:12px;height:12px;stroke:#fff;stroke-width:3}
.task-line.done .t{color:var(--muted-2);text-decoration:line-through}
.group-title{font-weight:800;margin:22px 0 6px;font-size:15px}
.group-title.overdue{color:var(--red)}

/* ---------- Forms ---------- */
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px 20px}
.form-grid .full{grid-column:1 / -1}
@media(max-width:700px){.form-grid{grid-template-columns:1fr}}
label.fld{display:block}
label.fld > span{display:block;font-weight:600;font-size:13px;color:var(--ink-2);margin-bottom:6px}
.input,select,textarea.input{
  width:100%;border:1px solid var(--line);border-radius:10px;padding:11px 13px;font-size:14px;
  font-family:inherit;background:#fff;color:var(--ink)}
.input:focus,select:focus,textarea:focus{outline:none;border-color:var(--red);box-shadow:0 0 0 3px var(--red-050)}
.req-star{color:var(--red)}
.form-err{color:var(--red);font-size:12.5px;margin-top:5px}
.help{color:var(--muted);font-size:12.5px}

/* ---------- Flash ---------- */
.flash{padding:13px 18px;border-radius:12px;margin-bottom:18px;font-weight:600;display:flex;gap:10px;align-items:center}
.flash.success{background:var(--green-050);color:#065F46;border:1px solid #A7F3D0}
.flash.error{background:var(--red-050);color:#991B1B;border:1px solid var(--red-100)}
.banner-info{background:var(--red-050);border:1px solid var(--red-100);border-radius:12px;padding:14px 18px;
  color:var(--ink-2);margin-bottom:18px;display:flex;gap:10px;align-items:center}
.banner-info svg{width:18px;height:18px;stroke:var(--red);flex:0 0 18px}

/* ---------- Auth ---------- */
.auth-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;background:var(--bg);padding:20px}
.auth-card{width:100%;max-width:420px;background:#fff;border:1px solid var(--line);border-radius:20px;
  padding:38px 34px;box-shadow:var(--shadow-lg)}
.auth-card .brand{display:flex;align-items:center;gap:11px;margin-bottom:26px}
.auth-card .brand .logo{width:40px;height:40px;border-radius:11px;background:var(--red);color:#fff;
  display:flex;align-items:center;justify-content:center;font-weight:800}
.auth-card h1{font-size:22px;margin-bottom:4px}
.auth-card .sub{color:var(--muted);margin-bottom:24px}
.auth-card label.fld{margin-bottom:16px}
.auth-card .btn-primary{width:100%;justify-content:center;padding:12px}

/* utility */
.flex{display:flex}.items-center{align-items:center}.gap-8{gap:8px}.gap-12{gap:12px}
.mt-8{margin-top:8px}.mt-16{margin-top:16px}.mt-24{margin-top:24px}.mb-0{margin-bottom:0}
.right{margin-left:auto}.nowrap{white-space:nowrap}.hidden{display:none}
.empty{text-align:center;color:var(--muted);padding:48px 20px}
.empty svg{width:40px;height:40px;stroke:var(--muted-2);margin-bottom:10px}
.divider{height:1px;background:var(--line-2);margin:18px 0}
.dropdown{position:relative}
.dropdown-menu{position:absolute;right:0;top:calc(100% + 6px);background:#fff;border:1px solid var(--line);
  border-radius:12px;box-shadow:var(--shadow-lg);min-width:180px;padding:6px;z-index:40;display:none}
.dropdown.open .dropdown-menu{display:block}
.dropdown-menu button,.dropdown-menu a{display:block;width:100%;text-align:left;padding:9px 12px;border-radius:8px;
  background:none;border:none;font-size:13.5px;cursor:pointer;color:var(--ink)}
.dropdown-menu button:hover,.dropdown-menu a:hover{background:#F4F4F5}

/* =====================================================================
   v1.1 — interactivity & polish
   ===================================================================== */
/* Page entrance */
.content{animation:fadeUp .28s ease both}
@keyframes fadeUp{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}

/* Hide the ugly scrollbar under the detail tabs */
.tabs{scrollbar-width:none;-ms-overflow-style:none}
.tabs::-webkit-scrollbar{display:none}
.tabs a{transition:color .15s,border-color .15s}

/* Cards & rows lift on hover */
.card{transition:box-shadow .18s ease,transform .18s ease}
a.card:hover{transform:translateY(-2px);box-shadow:var(--shadow-lg)}
.deal-row{transition:box-shadow .15s ease,transform .15s ease}
.deal-row:hover{transform:translateY(-1px)}
.kcard{transition:box-shadow .15s ease,transform .15s ease}
.kcard:hover{transform:translateY(-2px)}
.kpi{transition:box-shadow .18s ease,transform .18s ease}
.kpi:hover{transform:translateY(-2px);box-shadow:var(--shadow-lg)}

/* Buttons feel clickable */
.btn{transition:background .12s,transform .1s,box-shadow .12s}
.btn:active{transform:scale(.97)}
.icon-btn{transition:background .12s,transform .1s}
.icon-btn:hover{background:#F7F7F8}

/* Sidebar nav */
.nav a{transition:background .13s,color .13s}

/* Table rows */
table.data tr{transition:background .12s}
table.data tr[onclick]:hover td{background:#FBF7F7}

/* Tasks tick animation */
.task-check{transition:background .15s,border-color .15s,transform .12s}
.task-check:active{transform:scale(.85)}
.task-line{transition:opacity .25s}
.task-line.done{opacity:.62}

/* Bar chart grows in */
.bar-fill{animation:growBar .6s ease both}
@keyframes growBar{from{width:0}}

/* Toast notifications (flash messages float in top-right and auto-dismiss) */
.toast-wrap{position:fixed;top:20px;right:20px;z-index:300;display:flex;flex-direction:column;gap:10px}
.toast{min-width:260px;max-width:380px;padding:14px 18px;border-radius:12px;font-weight:600;font-size:14px;
  display:flex;gap:10px;align-items:center;background:#fff;border:1px solid var(--line);
  box-shadow:var(--shadow-lg);animation:toastIn .28s cubic-bezier(.21,1.02,.73,1) both}
.toast.success{border-left:4px solid var(--green)}
.toast.error{border-left:4px solid var(--red)}
.toast.hide{animation:toastOut .3s ease both}
@keyframes toastIn{from{opacity:0;transform:translateX(24px)}to{opacity:1;transform:none}}
@keyframes toastOut{to{opacity:0;transform:translateX(24px)}}

/* Selects look interactive */
select.input{cursor:pointer}
.stage-pill,.tag,.chip{transition:transform .12s}
.tag:hover{transform:scale(1.05)}

/* Kanban drop target pulse */
.kcol.drop .kbody{outline:2px dashed var(--red-100);outline-offset:4px;border-radius:12px}

/* ---------- Live search dropdown (topbar) & contact picker ---------- */
.search-menu,.picker-menu{
  position:absolute;top:calc(100% + 8px);left:0;right:0;background:#fff;
  border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow-lg);
  z-index:120;display:none;overflow:hidden;max-height:420px;overflow-y:auto;
  animation:fadeUp .18s ease both}
.search-menu.open,.picker-menu.open{display:block}
.search-menu .grp-label{font-size:11px;text-transform:uppercase;letter-spacing:.06em;
  color:var(--muted-2);font-weight:700;padding:10px 16px 4px}
.search-menu a,.picker-menu a{display:flex;flex-direction:column;gap:2px;padding:10px 16px;
  border-bottom:1px solid var(--line-2);transition:background .1s}
.search-menu a:last-child,.picker-menu a:last-child{border-bottom:none}
.search-menu a:hover,.picker-menu a:hover{background:var(--red-050)}
.picker{position:relative}
.picker-empty{padding:14px 16px;color:var(--muted);font-size:13.5px}
.picker-menu .create-row{color:var(--red);font-weight:700;background:#FFFBFB}
.picker-menu .create-row:hover{background:var(--red-050)}

/* ---------- Kanban v2 (Bigin-style board) ---------- */
.kanban{align-items:flex-start;gap:14px;padding-bottom:24px}
.kcol{flex:0 0 300px;width:300px;background:#F1F1F4;border-radius:16px;padding:10px;
  display:flex;flex-direction:column;max-height:calc(100vh - 230px)}
.khead2{background:#fff;border-radius:12px;padding:11px 14px;margin-bottom:10px;box-shadow:var(--shadow)}
.khead2 .kname{font-weight:800;font-size:14.5px}
.khead2 .kmeta{color:var(--muted);font-size:12.5px;margin-top:2px}
.kbody{flex:1;min-height:150px;overflow-y:auto;display:flex;flex-direction:column;gap:10px;
  padding:2px;border-radius:12px;scrollbar-width:thin}
.kbody::-webkit-scrollbar{width:6px}
.kbody::-webkit-scrollbar-thumb{background:#D8D8DC;border-radius:3px}
.kcard{margin-bottom:0;user-select:none}
.kcard .kwho{color:var(--muted);font-size:12.5px;margin:-4px 0 8px}
.kempty{border:2px dashed #DDDDE2;border-radius:12px;color:var(--muted-2);font-size:13px;
  display:flex;align-items:center;justify-content:center;min-height:110px}
.kadd{display:flex;align-items:center;justify-content:center;gap:6px;color:var(--muted);
  font-size:13px;font-weight:600;padding:9px;border-radius:10px;margin-top:8px;transition:all .12s}
.kadd:hover{background:#fff;color:var(--red)}
.kcol.drop{background:var(--red-050)}
.kcol.drop .kbody{outline:2px dashed var(--red-100);outline-offset:2px}
.kcard.dragging{opacity:.45;transform:rotate(2deg)}
