:root{
  --bg:#f4f5f8;
  --bg-soft:#eef0f4;
  --surface:#ffffff;
  --surface-2:#fafafc;
  --text:#14151a;
  --muted:#767a85;
  --muted-2:#9a9da6;
  --line:#e7e8ee;
  --line-soft:#eef0f4;
  --accent:#4f46e5;
  --accent-2:#7c6ffc;
  --accent-ink:#ffffff;
  --tint:#eef0ff;
  --green:#1a9c6b;
  --green-tint:#e6f7ef;
  --red:#e5484d;
  --red-tint:#fdecec;
  --amber:#b8720a;
  --amber-tint:#fff3e0;
  --radius-sm:10px;
  --radius:18px;
  --radius-lg:26px;
  --shadow-xs:0 1px 2px rgba(20,21,26,.05);
  --shadow-sm:0 4px 16px rgba(20,21,26,.05);
  --shadow:0 12px 32px rgba(20,21,26,.07);
  --shadow-lg:0 30px 70px rgba(20,21,26,.16);
  --ease:cubic-bezier(.4,0,.2,1);
  --font:Inter,-apple-system,BlinkMacSystemFont,"SF Pro Display","SF Pro Text","Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}

*{box-sizing:border-box}

html{-webkit-text-size-adjust:100%}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--font);
  font-size:14px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

button,input,select,textarea{font:inherit;color:inherit}
button,a,select{-webkit-tap-highlight-color:transparent}
button,a{touch-action:manipulation}
button{cursor:pointer;border:0;background:none}
a{color:inherit;text-decoration:none}
h1,h2,h3,p{margin:0}
ul{margin:0;padding:0;list-style:none}

::selection{background:var(--accent);color:#fff}

button:focus-visible,a:focus-visible,select:focus-visible,input:focus-visible,textarea:focus-visible,[tabindex]:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:3px;
  border-radius:6px;
}

small{display:block;color:var(--muted);font-size:11px;line-height:1.6}

/* ---------- Sidebar ---------- */
.sidebar{
  width:260px;
  background:var(--surface);
  border-right:1px solid var(--line);
  position:fixed;
  inset:0 auto 0 0;
  display:flex;
  flex-direction:column;
  padding:26px 18px;
  z-index:30;
  overflow:auto;
}

.brand{
  display:flex;
  align-items:center;
  gap:11px;
  font-size:19px;
  font-weight:700;
  letter-spacing:-.02em;
  padding:2px 4px 0;
}

.brand-mark{
  background:linear-gradient(150deg,var(--accent),var(--accent-2));
  color:#fff;
  width:36px;
  height:36px;
  border-radius:11px;
  display:grid;
  place-items:center;
  font-size:18px;
  font-weight:700;
  letter-spacing:-1px;
  position:relative;
  box-shadow:0 8px 18px rgba(79,70,229,.28);
  flex-shrink:0;
}

.brand-mark span{
  font-size:10px;
  position:absolute;
  right:3px;
  bottom:3px;
}

.brand-dot{color:var(--accent)}

.workspace{
  display:flex;
  gap:11px;
  align-items:center;
  border:1px solid var(--line);
  background:var(--surface-2);
  padding:12px;
  border-radius:14px;
  margin:22px 0 20px;
  font-size:12px;
}

.workspace>span:last-child{margin-left:auto}

.avatar{
  background:var(--tint);
  color:var(--accent);
  width:32px;
  height:32px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
  font-size:11px;
  font-weight:700;
  border-radius:9px;
}

.nav-label,.eyebrow{
  color:var(--muted-2);
  font-size:10px;
  font-weight:700;
  letter-spacing:1.4px;
  text-transform:uppercase;
}

.nav-label{margin:4px 10px 10px}

.sidebar nav{display:flex;flex-direction:column;gap:3px}

.sidebar nav a{
  display:flex;
  align-items:center;
  gap:12px;
  padding:11px 12px;
  color:var(--muted);
  border-radius:11px;
  font-size:13px;
  font-weight:500;
  transition:background .15s var(--ease),color .15s var(--ease);
}

.sidebar nav a:hover{background:var(--bg-soft);color:var(--text)}

.sidebar nav a.active{
  color:var(--accent);
  background:var(--tint);
  font-weight:650;
}

.nav-icon{
  width:26px;
  height:26px;
  border-radius:8px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:14px;
  color:var(--muted-2);
  background:transparent;
  flex-shrink:0;
  transition:background .15s var(--ease),color .15s var(--ease);
}

.sidebar nav a:hover .nav-icon{background:var(--surface);color:var(--text)}
.sidebar nav a.active .nav-icon{background:var(--accent);color:#fff}

.sidebar-bottom{margin-top:auto;padding-top:22px}

.help-card{
  background:linear-gradient(160deg,var(--surface-2),var(--bg-soft));
  border:1px solid var(--line-soft);
  border-radius:16px;
  padding:16px;
}

.help-card strong{display:block;font-size:13px;line-height:1.5;margin:8px 0;letter-spacing:-.01em}
.help-card p{font-size:11px;line-height:1.7;color:var(--muted)}

.switch-design{
  display:inline-flex;
  align-items:center;
  gap:5px;
  font-size:11px;
  font-weight:600;
  margin:14px 2px 0;
  color:var(--accent);
}

.profile{
  display:flex;
  gap:10px;
  align-items:center;
  padding-top:16px;
  margin-top:16px;
  border-top:1px solid var(--line);
  font-size:12px;
}

.profile strong{font-weight:650}

/* ---------- Shell / topbar ---------- */
.shell{margin-left:260px}

.topbar{
  height:72px;
  padding:0 36px;
  border-bottom:1px solid var(--line);
  display:flex;
  justify-content:space-between;
  align-items:center;
  background:rgba(255,255,255,.86);
  backdrop-filter:saturate(180%) blur(14px);
  position:sticky;
  top:0;
  z-index:15;
}

.breadcrumb{font-size:12.5px;color:var(--muted)}
.breadcrumb span{margin:0 10px;color:var(--muted-2)}
.breadcrumb b{font-weight:650;color:var(--text)}

.top-actions{display:flex;gap:18px;align-items:center}

.demo-label{
  font-size:10.5px;
  font-weight:600;
  color:var(--muted);
  border:1px solid var(--line);
  background:var(--surface-2);
  padding:7px 12px;
  border-radius:999px;
}

.icon-button{
  background:var(--surface-2);
  color:var(--text);
  font-size:17px;
  position:relative;
  width:38px;
  height:38px;
  border-radius:11px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  transition:background .15s var(--ease);
}

.icon-button:hover{background:var(--bg-soft)}

.icon-button i{
  position:absolute;
  right:8px;
  top:8px;
  width:6px;
  height:6px;
  background:var(--red);
  border-radius:50%;
  box-shadow:0 0 0 2px var(--surface);
}

/* ---------- Main / headings ---------- */
main{max-width:1480px;margin:auto;padding:34px 36px 24px}

.page-heading{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  margin-bottom:26px;
}

h1{font-size:31px;letter-spacing:-.03em;font-weight:680;margin:8px 0}
h2{font-size:16px;font-weight:650;letter-spacing:-.01em}
h3{font-size:14px;font-weight:650}
.page-heading p{color:var(--muted);font-size:13px;line-height:1.55}

.primary{
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  color:#fff;
  border-radius:999px;
  padding:12px 19px;
  font-size:12px;
  font-weight:650;
  box-shadow:0 10px 22px rgba(79,70,229,.26);
  transition:transform .15s var(--ease),box-shadow .15s var(--ease),filter .15s var(--ease);
  white-space:nowrap;
}

.primary:hover{transform:translateY(-1px);box-shadow:0 14px 26px rgba(79,70,229,.32)}
.primary:active{transform:translateY(0)}

.secondary{
  padding:11px 16px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface);
  color:var(--text);
  font-size:11.5px;
  font-weight:600;
  transition:background .15s var(--ease),border-color .15s var(--ease);
}

.secondary:hover{background:var(--bg-soft);border-color:var(--muted-2)}

.filters{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:24px;
  gap:15px;
  flex-wrap:wrap;
}

.filter-group{display:flex;gap:10px;flex-wrap:wrap}

.filter-group label{
  font-size:11px;
  font-weight:600;
  color:var(--muted);
  display:flex;
  align-items:center;
  gap:8px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:999px;
  padding:9px 14px;
}

select{border:0;background:transparent;color:var(--text);font-size:12px;font-weight:500;padding:0 8px 0 0;max-width:100%}

.source-indicator{font-size:11px;color:var(--muted);display:flex;align-items:center;gap:7px}
.source-indicator i{width:6px;height:6px;border-radius:50%;background:var(--green)}

.page-context-note{
  padding:13px 16px;
  margin-bottom:16px;
  border:1px solid var(--line);
  border-radius:14px;
  color:var(--muted);
  background:var(--surface-2);
  font-size:11.5px;
  line-height:1.6;
}

/* ---------- Content rhythm ---------- */
#content{display:block}
#content>*+*{margin-top:22px}

/* ---------- Summary banner (hero) ---------- */
.summary-banner{
  display:flex;
  align-items:flex-start;
  gap:20px;
  border:0;
  background:
    radial-gradient(130% 160% at 12% 15%,rgba(124,111,252,.38),transparent 55%),
    linear-gradient(150deg,#17181f 0%,#0a0a10 100%);
  padding:26px 30px;
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow-lg);
  position:relative;
  overflow:hidden;
}

.summary-symbol{
  display:grid;
  place-items:center;
  width:50px;
  height:50px;
  border-radius:15px;
  background:rgba(255,255,255,.12);
  color:#fff;
  font-size:21px;
  flex-shrink:0;
  backdrop-filter:blur(6px);
}

.summary-banner>div{position:relative;z-index:1;min-width:0}

.summary-banner h3{color:#fff;font-size:19px;font-weight:650;letter-spacing:-.02em;line-height:1.3}
.summary-banner p{font-size:12px;color:rgba(255,255,255,.66);margin-top:8px;line-height:1.65}

.summary-banner .badge{margin-left:auto;flex-shrink:0;align-self:flex-start;position:relative;z-index:1}
.summary-banner .badge{background:rgba(255,255,255,.14);color:#fff}
.summary-banner .badge.warn{background:rgba(255,178,120,.18);color:#ffcda3}
.summary-banner .badge.bad{background:rgba(255,120,110,.2);color:#ffb2ac}

.text-button{
  background:transparent;
  color:var(--accent);
  font-size:11.5px;
  font-weight:650;
  padding:8px 0;
  transition:opacity .15s var(--ease);
}

.text-button:hover{opacity:.72;text-decoration:underline;text-underline-offset:3px}
.summary-banner .text-button{margin-left:auto;white-space:nowrap}

/* ---------- KPI cards ---------- */
.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:16px}

.card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:22px;
  box-shadow:var(--shadow-sm);
  min-width:0;
  transition:box-shadow .18s var(--ease),transform .18s var(--ease);
}

.kpis>.card:hover{box-shadow:var(--shadow);transform:translateY(-2px)}

.kpi-top{display:flex;justify-content:space-between;align-items:center;color:var(--muted);font-size:11.5px;font-weight:600}

.kpi-top span{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:24px;
  height:24px;
  border-radius:8px;
  background:var(--bg-soft);
  color:var(--muted);
  font-size:12px;
  flex-shrink:0;
}

.metric{
  font-size:clamp(26px,2.3vw,34px);
  font-weight:680;
  letter-spacing:-.03em;
  margin:16px 0 10px;
  font-variant-numeric:tabular-nums;
}

.metric small{display:inline;font-size:14px;font-weight:400;letter-spacing:0;color:var(--muted)}

.badge{
  display:inline-block;
  border-radius:999px;
  padding:5px 10px;
  font-size:10.5px;
  font-weight:650;
  color:var(--green);
  background:var(--green-tint);
}

.badge.warn{color:var(--amber);background:var(--amber-tint)}
.badge.bad{color:var(--red);background:var(--red-tint)}

.kpi-foot{font-size:10.5px;color:var(--muted);display:flex;gap:8px;align-items:center;flex-wrap:wrap}

/* ---------- Grid layouts ---------- */
.grid-main{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(300px,1fr);gap:20px}

.card-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:22px}
.card-heading p{font-size:11.5px;color:var(--muted);margin-top:6px;line-height:1.55}

.legend{display:flex;gap:16px;color:var(--muted);font-size:10.5px;margin-bottom:18px}
.legend span:before{content:"";display:inline-block;width:7px;height:7px;background:var(--accent);border-radius:50%;margin-right:6px}
.legend span:last-child:before{background:var(--muted-2)}

.chart-wrap{position:relative;background:var(--surface-2);border-radius:14px;padding:12px}
.chart{width:100%;height:auto;display:block;max-height:230px}
.chart text{font-size:10px;fill:var(--muted);font-family:var(--font)}
.chart .gridline{stroke:var(--line);stroke-dasharray:3 5}
.chart .actual{stroke:var(--accent);stroke-width:3;fill:none}
.chart .target{stroke:var(--muted-2);stroke-width:2;fill:none;stroke-dasharray:5 5}
.chart .fill{fill:var(--tint)}

.chart-note{display:flex;justify-content:space-between;border-top:1px solid var(--line);padding-top:16px;margin-top:14px;gap:12px}
.chart-note strong{font-size:14px;display:block;margin-top:5px}

.priority{display:flex;gap:12px;padding:16px 0;border-top:1px solid var(--line);align-items:flex-start}
.priority:first-of-type{border:0;padding-top:2px}
.priority-dot{margin-top:6px;width:7px;height:7px;border-radius:50%;background:var(--red);flex-shrink:0}
.priority-dot.amber{background:var(--amber)}
.priority-dot.green{background:var(--green)}
.priority p{font-size:11.5px;color:var(--muted);line-height:1.65;margin-top:6px}
.priority h3{font-size:12.5px}
.priority .text-button{font-size:10.5px}

.section-title{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}

.funnel{display:grid;grid-template-columns:repeat(5,1fr);gap:12px}
.funnel-step{background:var(--surface-2);border-radius:14px;padding:16px}
.funnel-step strong{font-size:23px;display:block;margin:10px 0;letter-spacing:-.02em}
.funnel-step p{font-size:10.5px;color:var(--muted)}
.bar-track{height:5px;background:var(--bg-soft);border-radius:5px;overflow:hidden;margin:14px 0}
.bar-track span{display:block;height:100%;background:linear-gradient(90deg,var(--accent),var(--accent-2));border-radius:5px}
.funnel-step small{font-size:10px}

/* ---------- Tables ---------- */
.table-scroll{overflow:auto;border-radius:14px}
table{width:100%;border-collapse:collapse;text-align:left;white-space:nowrap}
th{font-size:10.5px;font-weight:650;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);padding:13px 14px;border-bottom:1px solid var(--line);background:var(--surface-2)}
td{padding:15px 14px;border-bottom:1px solid var(--line-soft);font-size:12.5px}
td strong{font-weight:650}
tbody tr{transition:background .12s var(--ease)}
tbody tr:hover{background:var(--surface-2)}
tr:last-child td{border:0}

.table-head{display:flex;align-items:center;gap:15px;justify-content:space-between;margin-bottom:18px;flex-wrap:wrap}

.search{
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface-2);
  color:var(--text);
  padding:10px 14px;
  font-size:11.5px;
  width:220px;
}

.stack{display:grid;gap:22px}

/* ---------- Module grid / board / flow ---------- */
.module-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}
.module-card{padding:22px}
.module-card .nav-icon{color:var(--accent);background:var(--tint);margin-bottom:18px;width:36px;height:36px;border-radius:11px;font-size:17px}
.module-card p{font-size:12px;color:var(--muted);line-height:1.7;margin:10px 0}
.module-card .text-button{margin-top:8px}

.board{display:grid;grid-template-columns:repeat(4,1fr);gap:15px}
.column{background:var(--surface-2);border-radius:16px;padding:14px;min-height:300px;border:1px solid var(--line-soft)}
.column>h3{font-size:12px;margin-bottom:16px;padding:2px 4px}
.deal{background:var(--surface);border:1px solid var(--line);padding:16px;border-radius:12px;margin-bottom:10px;cursor:grab;box-shadow:var(--shadow-xs)}
.deal strong{font-size:12px}
.deal p{font-size:11px;color:var(--muted);margin:8px 0}
.deal small{margin-top:10px}

.flow{display:flex;align-items:center;gap:18px;padding:22px 0;overflow:auto}
.flow-node{min-width:170px;padding:20px;border:1px solid var(--line);border-radius:14px;background:var(--surface)}
.flow-node.trigger{border-color:var(--accent);background:var(--tint)}
.flow-node small{margin:10px 0 0}
.flow-arrow{font-size:20px;color:var(--muted-2)}

.mini-list{display:grid;gap:15px;margin-top:18px}
.mini-list>div{padding-bottom:15px;border-bottom:1px solid var(--line)}
.mini-list>div:last-child{border:0;padding-bottom:0}
.mini-list strong{font-size:12px}
.mini-list p{font-size:11.5px;line-height:1.6;color:var(--muted);margin-top:6px}

.timeline{display:grid;grid-template-columns:150px 1fr;gap:14px;margin:20px 0;align-items:center;font-size:12px}
.timeline-bar{height:30px;border-radius:8px;background:var(--tint);color:var(--accent);padding:8px 12px;font-size:10px;font-weight:650}

footer{display:flex;justify-content:space-between;font-size:10.5px;color:var(--muted);padding-top:28px;margin-top:14px;border-top:1px solid var(--line);gap:15px}

/* ---------- Dialogs / toast ---------- */
dialog{
  border:1px solid var(--line);
  background:var(--surface);
  color:var(--text);
  border-radius:24px;
  padding:30px;
  width:min(520px,90vw);
  box-shadow:var(--shadow-lg);
}

dialog::backdrop{background:rgba(15,16,22,.42);backdrop-filter:blur(6px)}
dialog h2{font-size:21px;margin:14px 0;letter-spacing:-.02em}
dialog p{color:var(--muted);line-height:1.75;font-size:12.5px;margin:10px 0}
.close{float:right}
.detail-label{display:block;font-size:11px;margin:20px 0 8px}

#toast{
  position:fixed;
  bottom:24px;
  left:50%;
  transform:translateX(-50%);
  background:var(--text);
  color:#fff;
  padding:13px 22px;
  border-radius:999px;
  z-index:50;
  display:none;
  font-size:12px;
  box-shadow:var(--shadow-lg);
}

.mobile-toggle{display:none}
.empty{padding:30px;text-align:center;color:var(--muted)}

/* ---------- Responsive ---------- */
@media(min-width:1500px){
  main{padding-top:40px}
  .metric{font-size:34px}
  .card{padding:26px}
}

@media(max-width:1150px){
  .sidebar{width:224px;padding:22px 14px}
  .shell{margin-left:224px}
  main{padding:26px 24px}
  .topbar{padding:0 24px}
  .kpis{gap:12px}
  .card{padding:19px}
  .metric{font-size:25px}
  .grid-main{grid-template-columns:1.4fr 1fr}
  .source-indicator{display:none}
  .board{grid-template-columns:repeat(2,1fr)}
}

@media(max-width:850px){
  .grid-main{grid-template-columns:1fr}
  .kpis{grid-template-columns:repeat(2,1fr)}
  .module-grid{grid-template-columns:repeat(2,1fr)}
  h1{font-size:26px}
  .summary-banner{flex-wrap:wrap}
  .summary-banner .badge{margin-left:0}
  .help-card{display:none}
}

@media(max-width:640px){
  .sidebar{transform:translateX(-100%);width:260px;transition:transform .22s var(--ease);box-shadow:none}
  .sidebar.open{transform:translateX(0);box-shadow:24px 0 60px rgba(15,16,22,.14)}
  .shell{margin:0;min-width:0}
  .mobile-toggle{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:10px;background:var(--surface-2);font-size:17px;color:var(--text)}
  .topbar{padding:0 16px;height:60px;gap:14px}
  .breadcrumb{margin-right:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .top-actions{gap:10px}
  .demo-label{display:none}
  main{padding:22px 16px;min-width:0}
  .page-heading{align-items:flex-start}
  .page-heading>div{min-width:0}
  .page-heading .primary{font-size:0;padding:10px;flex-shrink:0}
  .page-heading .primary:after{content:"↓";font-size:18px}
  h1{font-size:23px}
  .filters{align-items:flex-start}
  .filter-group{width:100%;flex-wrap:wrap;min-width:0}
  .filter-group label{flex:1;min-width:140px}
  .filter-group select{min-width:0}
  .summary-banner{padding:20px;gap:14px}
  .summary-banner>div{min-width:0}
  .metric{font-size:24px}
  .kpi-foot{flex-wrap:wrap;font-size:9px}
  .card{padding:17px}
  .kpis{gap:10px}
  .funnel{grid-template-columns:repeat(2,1fr);gap:12px}
  .module-grid,.board{grid-template-columns:1fr}
  .table-head{flex-wrap:wrap}
  .search{width:100%}
  footer{flex-direction:column}
  .chart-note{flex-wrap:wrap}
}

@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{transition-duration:.01ms!important;animation-duration:.01ms!important}
}
