@font-face{font-family:"Manrope";src:url("/assets/fonts/manrope-latin.woff2") format("woff2");font-weight:100 900;font-display:swap;}

/* Churn Risk Explainer — customer-health RISK CONSOLE. Light, data-forward, decisive. */
:root {
  --page: #f4f5f7;
  --card: #ffffff;
  --panel: #fbfcfd;
  --primary: #334155;      /* slate-blue */
  --primary-deep: #1e293b;
  --ink: #1e293b;
  --ink-soft: #475569;
  --muted: #94a3b8;
  --border: #e5e8ec;
  --border-strong: #d4dae1;

  /* risk scale — red -> amber -> green */
  --crit: #e11d48;         /* risk red */
  --high: #f43f5e;
  --warn: #f59e0b;         /* amber */
  --good: #16a34a;         /* safe green */
  --gridline: #e5e8ec;

  /* level tokens consumed by .acct/.lvl/.fill (${lvl}) */
  --low: #16a34a;    --low-bg: #ecfdf3;    --low-ink: #15803d;
  --medium: #f59e0b; --medium-bg: #fffbeb; --medium-ink: #b45309;
  --high-c: #fb7185; --high-bg: #fff1f2;   --high-ink: #be123c;
  --critical: #e11d48; --critical-bg: #fef2f2; --critical-ink: #be123c;

  --radius: 14px;
  --radius-sm: 10px;
  --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --shadow-sm: 0 1px 2px rgba(30,41,59,.05), 0 1px 3px rgba(30,41,59,.04);
  --shadow: 0 1px 2px rgba(30,41,59,.04), 0 10px 28px -12px rgba(30,41,59,.18);
  --shadow-lg: 0 24px 60px -24px rgba(30,41,59,.30);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
}

/* ---- product sub-header (sits below the injected navy nav) ---- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -.015em; color: var(--primary-deep); font-size: 15px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 15px;
  background: linear-gradient(150deg, var(--primary), var(--primary-deep));
  box-shadow: inset 0 0 0 3px rgba(225,29,72,.9), var(--shadow-sm);
}
.brand .sub { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.topbar .spacer { flex: 1; }
.topbar .badge {
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
  border: 1px solid var(--border); background: var(--panel);
  padding: 5px 12px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 7px;
}
.topbar .badge .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--good);
  box-shadow: 0 0 0 3px rgba(22,163,74,.16);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* ---- layout ---- */
.wrap { max-width: 1060px; margin: 0 auto; padding: 34px 26px 80px; }

.hero { margin-bottom: 24px; }
.hero h1 {
  margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.03em; color: var(--primary-deep);
}
.hero p { margin: 10px 0 0; color: var(--ink-soft); font-size: 15.5px; max-width: 720px; }

/* ---- cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.input-card { position: relative; }
.input-card::before {
  content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px;
  border-radius: 3px; background: linear-gradient(180deg, var(--crit), var(--warn) 55%, var(--good));
}

.notes-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 8px; gap: 12px; }
.notes-head label { font-size: 13px; font-weight: 700; color: var(--primary-deep); }
.link-btn { background: none; border: none; color: var(--primary); font-size: 13px; font-weight: 700; cursor: pointer; padding: 0; }
.link-btn:hover { color: var(--crit); text-decoration: underline; }

textarea {
  width: 100%; font-family: var(--mono); font-size: 12.5px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; outline: none; min-height: 210px; resize: vertical; line-height: 1.65;
  transition: border-color .15s, box-shadow .15s;
}
textarea::placeholder { color: var(--muted); }
textarea:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(51,65,85,.12); }

.actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 14.5px; font-weight: 700; color: #fff; cursor: pointer;
  background: linear-gradient(150deg, var(--primary), var(--primary-deep));
  border: none; border-radius: var(--radius-sm); padding: 12px 22px;
  box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .15s, filter .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); filter: brightness(1.06); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .65; cursor: default; transform: none; filter: none; }
.btn.ghost {
  background: #fff; color: var(--primary-deep);
  border: 1px solid var(--border-strong); box-shadow: none;
}
.btn.ghost:hover { background: var(--panel); border-color: var(--primary); filter: none; }
.btn.small { font-size: 12.5px; padding: 8px 14px; border-radius: 8px; }
.hint { font-size: 12.5px; color: var(--muted); }
.hint em { color: var(--ink-soft); font-style: normal; font-weight: 700; }

/* ---- error banner ---- */
.banner.error {
  display: flex; align-items: center; gap: 10px; margin-top: 16px;
  background: var(--critical-bg); border: 1px solid #fecdd3; color: var(--critical-ink);
  border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13.5px; font-weight: 600;
}
.banner.error .i {
  flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--crit); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}

/* ---- spinner ---- */
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- results (toggle via .show) ---- */
#results { display: none; margin-top: 26px; }
#results.show { display: block; animation: rise .45s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* portfolio summary */
.portfolio {
  background: linear-gradient(180deg, #fff, var(--panel));
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 20px;
}
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px 18px; position: relative; overflow: hidden;
}
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--good); }
.stat:first-child::after { background: var(--crit); }
.stat:nth-child(2)::after { background: var(--warn); }
.s-val { font-size: 30px; font-weight: 800; letter-spacing: -.03em; color: var(--primary-deep); line-height: 1.05; }
.s-val.risk { color: var(--crit); }
.s-lab { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 6px; }
.headline {
  margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--border-strong);
  font-size: 15px; color: var(--ink-soft); line-height: 1.6; font-weight: 500;
}
.sample-tag {
  display: inline-block; margin-left: 6px; vertical-align: middle;
  font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--primary); background: #eef2f6; border: 1px solid var(--border-strong);
  padding: 2px 8px; border-radius: 999px;
}

/* ---- account rows ---- */
.acct {
  background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--medium);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 20px 22px; margin-bottom: 14px; transition: box-shadow .18s, transform .12s;
}
.acct:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.acct.low { border-left-color: var(--low); }
.acct.medium { border-left-color: var(--medium); }
.acct.high { border-left-color: var(--high-c); }
.acct.critical { border-left-color: var(--critical); }

.acct-head { display: flex; align-items: center; gap: 12px; }
.acct-head .name { font-size: 17px; font-weight: 800; letter-spacing: -.02em; color: var(--primary-deep); }
.acct-head .arr {
  font-size: 12px; font-weight: 700; color: var(--ink-soft);
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px;
}
.acct-head .spacer { flex: 1; }

/* risk-level chip */
.lvl {
  font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  padding: 4px 11px; border-radius: 999px; white-space: nowrap;
}
.lvl.low { color: var(--low-ink); background: var(--low-bg); border: 1px solid #bbf7d0; }
.lvl.medium { color: var(--medium-ink); background: var(--medium-bg); border: 1px solid #fde68a; }
.lvl.high { color: var(--high-ink); background: var(--high-bg); border: 1px solid #fecdd3; }
.lvl.critical { color: #fff; background: var(--critical); border: 1px solid var(--critical); }

/* meter + score */
.meter { display: flex; align-items: center; gap: 14px; margin: 16px 0 14px; }
.track { flex: 1; height: 9px; border-radius: 999px; background: #eef1f4; overflow: hidden; border: 1px solid var(--border); }
.fill { height: 100%; border-radius: 999px; transition: width .6s cubic-bezier(.2,.7,.2,1); }
.fill.low { background: linear-gradient(90deg, #22c55e, var(--good)); }
.fill.medium { background: linear-gradient(90deg, #fbbf24, var(--warn)); }
.fill.high { background: linear-gradient(90deg, #fb7185, var(--high)); }
.fill.critical { background: linear-gradient(90deg, #f43f5e, var(--crit)); }
.score { font-size: 22px; font-weight: 800; color: var(--primary-deep); letter-spacing: -.02em; min-width: 66px; text-align: right; }
.score small { font-size: 12px; font-weight: 600; color: var(--muted); }

.summary { font-size: 14.5px; color: var(--ink-soft); line-height: 1.6; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 16px 0 4px; }
.mini-h {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin-bottom: 8px;
}
ul.clean { list-style: none; margin: 0; padding: 0; }
ul.clean li {
  position: relative; padding-left: 20px; margin-bottom: 7px; font-size: 13.5px; color: var(--ink-soft); line-height: 1.5;
}
ul.clean li::before {
  content: ""; position: absolute; left: 4px; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--warn);
}
ul.clean.pos li::before { background: var(--good); }

.play {
  margin-top: 16px; padding: 13px 16px; border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #f8fafc, #eef2f6); border: 1px solid var(--border);
  font-size: 14px; color: var(--ink); line-height: 1.55;
}
.play b { color: var(--primary-deep); font-weight: 800; }

/* save-email drafts panel */
.save { margin-top: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); overflow: hidden; }
.save summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  padding: 12px 16px; font-size: 13.5px; font-weight: 700; color: var(--primary-deep);
}
.save summary::-webkit-details-marker { display: none; }
.save summary .spacer { flex: 1; }
.save summary .chev { transition: transform .2s; color: var(--muted); font-size: 18px; font-weight: 700; }
.save[open] summary { border-bottom: 1px solid var(--border); }
.save[open] summary .chev { transform: rotate(90deg); color: var(--primary); }
.save .body { padding: 16px; background: #fff; }
.save .subj { font-size: 13.5px; color: var(--ink); margin-bottom: 12px; }
.save .subj span { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .05em; margin-right: 6px; }
.save .mail {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65; color: var(--ink-soft);
  white-space: pre-wrap; background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px; border-left: 3px solid var(--primary);
}
.copy-mail { margin-top: 2px; }

/* usage footer line */
.usage { margin-top: 8px; font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.foot-note { margin-top: 34px; font-size: 12px; color: var(--muted); line-height: 1.6; text-align: center; }

@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; gap: 14px; }
  .hero h1 { font-size: 25px; }
  .wrap { padding: 24px 18px 60px; }
}
