/* Claro — customer-success workspace. Light theme, cool near-white surfaces. */

:root {
  --ink: #0F172A;
  --ink-2: #334155;
  --ink-3: #64748B;
  --line: #E2E8F0;
  --line-2: #EEF2F7;
  --surface: #F8FAFC;
  --card: #FFFFFF;
  --card-2: #F1F5F9;

  --azure: #0B72E7;
  --azure-ink: #0A5BB8;
  --azure-wash: #E7F0FD;
  --teal: #0E9E8E;
  --teal-wash: #DDF3F0;
  --amber: #D97706;
  --amber-wash: #FBEEDA;
  --rose: #DC2626;
  --rose-wash: #FBE4E4;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --radius-sm: 9px;

  --sans: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --display: "Darker Grotesque", var(--sans);
  --mono: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--surface);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2.5px solid var(--azure); outline-offset: 2px; border-radius: 4px; }

.mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--azure), var(--teal));
  display: grid; place-items: center;
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.brand-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 27px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.brand-sub {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 2px;
}

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 10px 8px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 500;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--card-2); color: var(--ink); }
.nav a.active { background: var(--azure-wash); color: var(--azure-ink); font-weight: 600; }
.nav a svg { width: 18px; height: 18px; flex: none; }

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid var(--line-2);
  padding-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--teal-wash); color: var(--teal);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  flex: none;
}
.sidebar-foot .who { font-size: 13px; font-weight: 600; line-height: 1.2; }
.sidebar-foot .role { font-size: 11.5px; color: var(--ink-3); }

/* ---------- Main / topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.86);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.05;
}
.topbar .page-kicker {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--azure);
  margin-bottom: 1px;
}
.topbar .spacer { flex: 1; }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 14px; min-width: 210px;
  box-shadow: var(--shadow-sm);
}
.search svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.search input {
  border: 0; background: transparent; font-family: inherit; font-size: 14px;
  color: var(--ink); width: 100%;
}
.search input:focus { outline: none; }

.pill-btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--ink-2); border-radius: 999px; padding: 8px 15px;
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-sm);
}
.pill-btn svg { width: 15px; height: 15px; }
.pill-btn:hover { border-color: var(--azure); color: var(--azure-ink); }

.content { padding: 26px 30px 56px; }

/* ---------- Cards & layout ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }

.card-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.card-head h2, .card-head h3 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
}
.card-head h2 { font-size: 23px; }
.card-head h3 { font-size: 20px; }
.card-head .spacer { flex: 1; }
.section-note { color: var(--ink-3); font-size: 13px; }

.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 18px; }

/* ---------- KPI tiles ---------- */
.kpi { padding: 18px 20px; }
.kpi .kpi-top { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.kpi .kpi-icon {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none;
}
.kpi .kpi-icon svg { width: 17px; height: 17px; }
.kpi .kpi-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-3);
}
.kpi .kpi-value {
  font-family: var(--display); font-weight: 800; font-size: 38px;
  line-height: 1; letter-spacing: -0.02em;
}
.kpi .kpi-value small { font-size: 21px; font-weight: 700; color: var(--ink-3); }
.kpi .kpi-delta { font-size: 12.5px; margin-top: 7px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.kpi .kpi-delta svg { width: 13px; height: 13px; }
.up { color: var(--teal); }
.down { color: var(--rose); }
.flat { color: var(--ink-3); }

.ic-azure { background: var(--azure-wash); color: var(--azure); }
.ic-teal { background: var(--teal-wash); color: var(--teal); }
.ic-amber { background: var(--amber-wash); color: var(--amber); }
.ic-rose { background: var(--rose-wash); color: var(--rose); }

/* ---------- Health pills & bands ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.03em; padding: 3px 9px; border-radius: 999px;
  white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.pill-thriving { background: var(--teal-wash); color: #0B7A6D; }
.pill-thriving .dot { background: var(--teal); }
.pill-steady { background: var(--azure-wash); color: var(--azure-ink); }
.pill-steady .dot { background: var(--azure); }
.pill-watch { background: var(--amber-wash); color: #A45806; }
.pill-watch .dot { background: var(--amber); }
.pill-atRisk { background: var(--rose-wash); color: #B01B1B; }
.pill-atRisk .dot { background: var(--rose); }

.tag {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.05em;
  padding: 2px 8px; border-radius: 6px; background: var(--card-2); color: var(--ink-2);
}

/* ---------- Distribution (signature) ---------- */
.dist { display: flex; flex-direction: column; gap: 14px; }
.dist-row { display: grid; grid-template-columns: 96px 1fr 40px; align-items: center; gap: 12px; }
.dist-row .dist-name { font-size: 13.5px; font-weight: 600; }
.dist-track { height: 26px; background: var(--card-2); border-radius: 7px; overflow: hidden; }
.dist-fill { height: 100%; border-radius: 7px; transition: width .5s ease; }
.fill-thriving { background: linear-gradient(90deg, var(--teal), #23B7A5); }
.fill-steady { background: linear-gradient(90deg, var(--azure), #3B8EF0); }
.fill-watch { background: linear-gradient(90deg, var(--amber), #E8940F); }
.fill-atRisk { background: linear-gradient(90deg, var(--rose), #E44848); }
.dist-count { font-family: var(--display); font-weight: 800; font-size: 22px; text-align: right; }

/* Health gauge (donut via conic-gradient) */
.gauge-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.gauge {
  --pct: 66;
  width: 128px; height: 128px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--teal) 0 calc(var(--pct) * 1%), var(--card-2) 0);
  display: grid; place-items: center; position: relative;
}
.gauge::after {
  content: ""; position: absolute; inset: 15px; border-radius: 50%; background: var(--card);
}
.gauge .gauge-inner { position: relative; text-align: center; z-index: 1; }
.gauge .gauge-num { font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1; }
.gauge .gauge-cap { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.legend { display: flex; flex-direction: column; gap: 9px; font-size: 13px; }
.legend .li { display: flex; align-items: center; gap: 9px; }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend b { font-family: var(--display); font-size: 16px; font-weight: 800; margin-left: auto; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-family: var(--mono); font-size: 10px; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 500;
  padding: 0 14px 11px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--surface); }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.selected { background: var(--azure-wash); }
table.data .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.data .company { font-weight: 600; }
.th-sort { cursor: pointer; user-select: none; }
.th-sort:hover { color: var(--azure); }

.score-cell { display: inline-flex; align-items: center; gap: 8px; }
.score-bar { width: 46px; height: 6px; border-radius: 4px; background: var(--card-2); overflow: hidden; }
.score-bar i { display: block; height: 100%; border-radius: 4px; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  border-radius: 999px; padding: 6px 13px; font-size: 12.5px; font-weight: 600;
}
.chip:hover { border-color: var(--azure); }
.chip.on { background: var(--azure); border-color: var(--azure); color: #fff; }
select.select {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 7px 13px; font-family: inherit; font-size: 13px; font-weight: 500;
}

/* ---------- Detail panel ---------- */
.panel-empty {
  display: grid; place-items: center; text-align: center; color: var(--ink-3);
  padding: 40px 20px; gap: 10px; min-height: 260px;
}
.panel-empty svg { width: 34px; height: 34px; color: var(--line); }
.panel-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.panel-head .p-name { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1.05; letter-spacing: -0.01em; }
.panel-head .p-meta { font-size: 12.5px; color: var(--ink-3); font-family: var(--mono); letter-spacing: 0.03em; }
.panel-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.panel-stat { background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 13px; }
.panel-stat .ps-label { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.panel-stat .ps-val { font-family: var(--display); font-weight: 800; font-size: 21px; line-height: 1.1; margin-top: 2px; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .tl-dot { position: absolute; left: 0; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--card); }
.timeline .tl-date { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em; color: var(--ink-3); }
.timeline .tl-note { font-size: 13.5px; margin-top: 1px; }
.dot-qbr { background: var(--azure); }
.dot-expansion { background: var(--teal); }
.dot-support { background: var(--amber); }
.dot-risk { background: var(--rose); }

.chips-inline { display: flex; flex-wrap: wrap; gap: 7px; }
.risk-line { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--ink-2); padding: 5px 0; }
.risk-line svg { width: 15px; height: 15px; color: var(--rose); flex: none; margin-top: 2px; }
.win-line svg { color: var(--teal); }

/* ---------- Risk board ---------- */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.board-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.board-col-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.board-col-head .cnt { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.board-col-head .bar { width: 4px; height: 18px; border-radius: 3px; }
.board-col-head h3 { font-family: var(--display); font-size: 18px; font-weight: 800; margin: 0; }
.board-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 11px;
  padding: 13px; margin-bottom: 11px; box-shadow: var(--shadow-sm);
}
.board-card:last-child { margin-bottom: 0; }
.board-card .bc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.board-card .bc-name { font-weight: 700; font-size: 14.5px; }
.board-card .bc-mrr { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.board-card .bc-reason { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 6px; padding: 2px 0; }
.board-card .bc-reason svg { width: 13px; height: 13px; color: var(--amber); flex: none; margin-top: 2px; }
.board-card .bc-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 11.5px; color: var(--ink-3); }

/* ---------- Charts (SVG/CSS) ---------- */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 168px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar-col .bar {
  width: 100%; max-width: 44px; border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--azure), #3B8EF0); transition: height .5s;
  position: relative;
}
.bar-col .bar.teal { background: linear-gradient(180deg, var(--teal), #23B7A5); }
.bar-col .bar-val { position: absolute; top: -20px; left: 0; right: 0; text-align: center; font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.bar-col .bar-lab { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; color: var(--ink-3); }

.spark { width: 100%; height: 64px; display: block; }
.trendline { width: 100%; height: 190px; display: block; }

.forecast { display: flex; flex-direction: column; gap: 14px; }
.forecast-row .f-top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.forecast-row .f-q { font-family: var(--display); font-weight: 800; font-size: 18px; }
.forecast-row .f-amt { margin-left: auto; font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.forecast-track { height: 30px; background: var(--card-2); border-radius: 8px; display: flex; overflow: hidden; }
.forecast-seg { height: 100%; display: grid; place-items: center; font-family: var(--mono); font-size: 10.5px; color: #fff; transition: width .5s; }
.seg-ontrack { background: var(--teal); }
.seg-nudge { background: var(--azure); }
.seg-risk { background: var(--amber); }

/* ---------- Gauges / meters small ---------- */
.meter { height: 8px; background: var(--card-2); border-radius: 5px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 5px; }

.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.stat-big { text-align: center; padding: 8px 0; }
.stat-big .sb-num { font-family: var(--display); font-weight: 800; font-size: 46px; line-height: 1; letter-spacing: -0.02em; }
.stat-big .sb-cap { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin-top: 4px; }

/* Activity feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--line-2); }
.feed li:last-child { border-bottom: 0; }
.feed .fi {
  width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center;
}
.feed .fi svg { width: 16px; height: 16px; }
.feed .fbody { min-width: 0; flex: 1; }
.feed .fmeta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.feed .facct { font-weight: 700; font-size: 14px; }
.feed .fdate { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); margin-left: auto; }
.feed .fnote { font-size: 13.5px; color: var(--ink-2); }
.feed .fcsm { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }

.empty-row td { text-align: center; color: var(--ink-3); padding: 26px; font-style: italic; }

/* ---------- Responsive ---------- */
.menu-btn { display: none; }

@media (max-width: 1080px) {
  .cols-4 { grid-template-columns: 1fr 1fr; }
  .cols-3 { grid-template-columns: 1fr 1fr; }
  .board { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 248px; z-index: 40;
    transform: translateX(-100%); transition: transform .22s ease; height: 100vh;
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .scrim {
    display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); z-index: 30;
  }
  .app.nav-open .scrim { display: block; }
  .menu-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); }
  .menu-btn svg { width: 18px; height: 18px; }
  .topbar h1 { font-size: 24px; }
  .search { min-width: 0; flex: 1; }
}

@media (max-width: 640px) {
  .cols-2, .cols-4, .cols-3, .span-2, .two-up, .panel-stats { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .content { padding: 20px 16px 44px; }
  .topbar { padding: 14px 16px; }
  .search { display: none; }
  .gauge-wrap { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
