/* Unagi dashboard. Same language as the website: copper-sulphate blue on white, navy ink, hairlines, mono labels, big quiet numbers.
 * Layout: a left rail that answers "where am I and where can I go", and a page that opens with what it is for. */

:root {
  --paper: #ffffff;
  --bg: #f7f9fd;
  --ink: #06143a;
  --blue: #1a5fd0;
  --blue-deep: #0b2f86;
  --tint: #eef4ff;
  --text: var(--ink);
  --muted: rgba(6, 20, 58, .62);
  --faint: rgba(6, 20, 58, .42);
  --hair: rgba(6, 20, 58, .12);
  --hair-strong: rgba(6, 20, 58, .22);
  --good: #146c43; --good-soft: #e1f3e9;
  --warn: #a15c07; --warn-soft: #fdf0d8;
  --bad: #c2271b; --bad-soft: #fde8e6;
  --accent: var(--blue); --accent-deep: var(--blue-deep); --accent-soft: var(--tint);
  --high: var(--bad); --high-soft: var(--bad-soft); --medium: var(--warn); --medium-soft: var(--warn-soft);
  --surface: var(--paper); --surface-2: #f1f5fc; --border: var(--hair);
  --display: "Helvetica Neue", "Inter", "Segoe UI", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --side: 248px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--display); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-weight: 800; letter-spacing: -.045em; line-height: 1.02; font-size: clamp(1.9rem, 3.4vw, 2.9rem); }
h2 { font-weight: 800; letter-spacing: -.03em; line-height: 1.15; font-size: 1.2rem; }
h3 { font-weight: 700; letter-spacing: -.015em; font-size: 1rem; }
p { margin-bottom: .8em; } p:last-child { margin-bottom: 0; }
a { color: var(--blue); text-underline-offset: 3px; }
code, pre { font-family: var(--mono); font-size: .86em; }
code { background: var(--tint); color: var(--blue-deep); padding: 1px 6px; }
::selection { background: var(--blue); color: #fff; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.boot, .muted { color: var(--muted); } .small { font-size: .85rem; }
.eyebrow { font: 500 10.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); display: block; }
.ico { flex: none; }
.spacer { flex: 1; }

/* ---------------------------------------------------------------- the frame */
#app { min-height: 100vh; }
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; align-self: start; height: 100vh; display: flex; flex-direction: column; background: var(--paper); border-right: 1px solid var(--hair); padding: 18px 14px 14px; overflow-y: auto; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.3rem; letter-spacing: -.04em; color: var(--ink); text-decoration: none; padding: 2px 8px 14px; }
.brand svg { width: 26px; height: 26px; color: var(--blue); }

.siteswitch { position: relative; margin: 0 0 16px; }
.siteswitch summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--hair-strong); background: var(--paper); }
.siteswitch summary::-webkit-details-marker { display: none; }
.siteswitch .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; } .siteswitch .dot.off { background: var(--warn); }
.siteswitch b { display: block; font-size: .92rem; line-height: 1.2; } .siteswitch small { color: var(--muted); font-size: .76rem; }
.siteswitch .caret { margin-left: auto; color: var(--faint); }
.siteswitch .menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--paper); border: 1px solid var(--hair-strong); box-shadow: 0 14px 40px rgba(6, 20, 58, .16); z-index: 30; max-height: 60vh; overflow: auto; }
.siteswitch .menu a { display: block; padding: 9px 12px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--hair); }
.siteswitch .menu a:hover { background: var(--tint); } .siteswitch .menu small { display: block; color: var(--muted); }

.nav { display: grid; gap: 2px; }
.nav-group { margin: 16px 0 4px; padding: 0 10px; }
.nav a, .side-foot a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; text-decoration: none; color: var(--ink); font-weight: 600; border-left: 3px solid transparent; position: relative; background: none; border-top: 0; border-right: 0; border-bottom: 0; font: inherit; cursor: pointer; text-align: left; width: 100%; }
.nav a { font-weight: 600; } .side-foot button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 11px; padding: 9px 10px; font-weight: 600; cursor: pointer; width: 100%; color: var(--ink); border-left: 3px solid transparent; }
.nav a .ico, .side-foot .ico { color: var(--faint); }
.nav a:hover, .side-foot a:hover, .side-foot button:hover { background: var(--surface-2); }
.nav a.on, .side-foot a.on { background: var(--tint); color: var(--blue); border-left-color: var(--blue); } .nav a.on .ico, .side-foot a.on .ico { color: var(--blue); }
.badge { margin-left: auto; min-width: 20px; padding: 1px 7px; text-align: center; font: 700 11px/18px var(--mono); border-radius: 999px; background: var(--blue); color: #fff; }
.badge.urgent { background: var(--bad); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--hair); display: grid; gap: 2px; }
.side-foot .who { padding: 8px 10px; font-size: .8rem; color: var(--muted); word-break: break-all; }

.main { min-width: 0; display: flex; flex-direction: column; }
.trial { background: var(--blue); color: #fff; font: 12px/1 var(--mono); letter-spacing: .04em; text-align: center; padding: 9px 16px; }
.trial.expired { background: var(--bad); }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 12px clamp(18px, 3vw, 40px); background: rgba(247, 249, 253, .88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--hair); }
.menu-btn { display: none; background: none; border: 1px solid var(--hair-strong); padding: 7px; cursor: pointer; color: var(--ink); }
.crumbs { font-size: .88rem; color: var(--muted); display: flex; gap: 8px; align-items: center; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs b { color: var(--ink); }
.find { position: relative; display: flex; align-items: center; }
.find .ico { position: absolute; left: 10px; color: var(--faint); pointer-events: none; }
.find input { padding: 8px 12px 8px 34px; width: clamp(150px, 20vw, 260px); }
.pill-select { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--muted); }
.pill-select select { padding: 7px 10px; font-weight: 600; color: var(--ink); }
.live-pill { display: inline-flex; align-items: center; gap: 7px; font: 600 12px/1 var(--mono); padding: 8px 12px; border: 1px solid var(--hair-strong); color: var(--ink); text-decoration: none; background: var(--paper); white-space: nowrap; }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); animation: pulse 1.6s ease-in-out infinite; } .live-pill.quiet i { background: var(--faint); animation: none; }

.page { width: 100%; max-width: 1240px; padding: clamp(22px, 3vw, 40px) clamp(18px, 3vw, 40px) 80px; animation: rise .35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .page { animation: none; } .badge.urgent, .live-pill i, .livedot { animation: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: clamp(20px, 3vw, 32px); }
.page-head .eyebrow { margin-bottom: 10px; color: var(--blue); }
.page-head .lede { margin-top: 12px; max-width: 62ch; color: var(--muted); font-size: 1.04rem; line-height: 1.5; }
.page-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.section { margin-top: clamp(24px, 3vw, 36px); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head p { color: var(--muted); font-size: .92rem; margin: 0; }

/* ---------------------------------------------------------------- building blocks */
.card { background: var(--paper); border: 1px solid var(--hair); padding: clamp(16px, 2vw, 24px); margin-bottom: 16px; min-width: 0; }
.card > h2:first-child, .card > h3:first-child { margin-bottom: 10px; }
.card.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(138px, 1fr)); }
.kpi { background: var(--paper); border: 1px solid var(--hair); padding: 14px 16px; }
.kpi .label { font: 500 10.5px/1 var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.kpi .value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.045em; margin-top: 8px; line-height: 1; color: var(--ink); }

.btn { appearance: none; display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); padding: 9px 18px; border-radius: 999px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease); }
.btn:hover { background: var(--ink); color: #fff; transform: translateY(-1px); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; } .btn.primary:hover { background: var(--blue-deep); border-color: var(--blue-deep); }
.btn.small { padding: 5px 13px; font-size: .84rem; }
.btn.danger { color: var(--bad); border-color: var(--bad); } .btn.danger:hover { background: var(--bad); color: #fff; }
.btn[disabled] { opacity: .5; cursor: default; transform: none; }
.link { background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 3px; }

.chip { display: inline-block; padding: 3px 9px; border-radius: 999px; font: 600 10px/1.2 var(--mono); letter-spacing: .07em; text-transform: uppercase; border: 1px solid currentColor; color: var(--muted); margin-right: 6px; white-space: nowrap; }
.chip.good { color: var(--good); background: var(--good-soft); border-color: transparent; } .chip.warn, .chip.medium { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.chip.high, .chip.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; } .chip.info { color: var(--blue); background: var(--tint); border-color: transparent; }
button.chip { background: var(--paper); cursor: pointer; } button.chip:hover { background: var(--ink); color: #fff; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--hair); vertical-align: top; }
th { font: 500 10.5px/1.2 var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; transition: background .15s; } tr.clickable:hover td { background: var(--tint); }
tr[hidden] { display: none; }
.table-wrap { overflow-x: auto; }
.card .table-wrap { margin: 0 -6px; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=tel], input[type=url], select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--hair-strong); border-radius: 0; padding: 9px 11px; width: auto; max-width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26, 95, 208, .16); }
textarea { width: 100%; resize: vertical; }
input[type=color] { padding: 2px; height: 38px; width: 70px; }
label { display: grid; gap: 5px; font-weight: 600; font-size: .9rem; }
label small, .hint { color: var(--muted); font-weight: 400; font-size: .8rem; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; margin-bottom: 8px; cursor: pointer; }
label.check input { margin-top: .3em; width: 17px; height: 17px; accent-color: var(--blue); }
form.stack { display: grid; gap: 14px; max-width: 440px; }
.formgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin: 12px 0; }
.formgrid input:not([type=color]):not([type=checkbox]), .formgrid select { width: 100%; }
.error { color: var(--bad); background: var(--bad-soft); padding: 10px 14px; } .notice { background: var(--tint); padding: 10px 14px; border-left: 3px solid var(--blue); }
.toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
details { margin: 8px 0; } summary { cursor: pointer; font-weight: 600; }
.codebox { position: relative; background: var(--ink); color: #dbe8ff; padding: 14px 16px; overflow-x: auto; margin: 8px 0 12px; }
.codebox pre { margin: 0; white-space: pre-wrap; word-break: break-all; } .codebox .btn { position: absolute; top: 8px; right: 8px; background: var(--paper); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty-state { text-align: center; padding: clamp(28px, 5vw, 56px) 20px; border: 1px dashed var(--hair-strong); background: var(--paper); }
.empty-state h3 { font-size: 1.25rem; letter-spacing: -.03em; margin-bottom: 8px; } .empty-state p { color: var(--muted); max-width: 52ch; margin: 0 auto 16px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 99; }
.bars { display: grid; gap: 9px; } .bar-row { display: grid; grid-template-columns: minmax(80px, 150px) 1fr 54px; align-items: center; gap: 12px; font-size: .9rem; }
.bar-track { background: var(--surface-2); height: 18px; } .bar-fill { background: var(--blue); height: 100%; min-width: 2px; }
.meter { height: 8px; background: var(--surface-2); min-width: 120px; } .meter i { display: block; height: 100%; background: var(--good); transition: width .5s var(--ease); }

/* ---------------------------------------------------------------- home */
.verdict { font-size: clamp(1.35rem, 2.4vw, 2rem); font-weight: 700; letter-spacing: -.035em; line-height: 1.2; max-width: 30em; margin: 0 0 clamp(20px, 3vw, 30px); }
.verdict.down { border-left: 4px solid var(--bad); padding-left: 16px; } .verdict.up { border-left: 4px solid var(--good); padding-left: 16px; } .verdict.neutral { border-left: 4px solid var(--hair-strong); padding-left: 16px; }
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat { display: grid; gap: 4px; padding: 16px 18px 12px; background: var(--paper); border: 1px solid var(--hair); text-decoration: none; color: var(--ink); transition: border-color .2s, transform .2s var(--ease), box-shadow .2s; min-width: 0; }
.stat:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: 0 10px 28px rgba(6, 20, 58, .08); }
.stat-value { font-size: clamp(1.8rem, 2.6vw, 2.5rem); font-weight: 800; letter-spacing: -.05em; line-height: 1.05; }
.stat-delta { display: inline-flex; align-items: center; gap: 4px; font: 700 12px/1 var(--mono); }
.stat-delta small { font-weight: 400; color: var(--faint); margin-left: 3px; font-family: var(--display); }
.stat-delta.good { color: var(--good); } .stat-delta.bad { color: var(--bad); } .stat-delta.flat { color: var(--faint); }
.spark { color: var(--blue); margin-top: 6px; display: block; }
.home-cols { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1000px) { .home-cols { grid-template-columns: 1fr; } }

.actions { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.action-card { display: grid; grid-template-columns: auto 1fr auto; gap: 14px 18px; align-items: center; background: var(--paper); border: 1px solid var(--hair); border-left-width: 4px; padding: 16px 18px; }
.action-card.urgent { border-left-color: var(--bad); background: #fffafa; } .action-card.fix { border-left-color: var(--warn); } .action-card.opportunity { border-left-color: var(--blue); } .action-card.setup { border-left-color: var(--hair-strong); }
.action-kind { font: 700 10px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); align-self: start; padding-top: 4px; min-width: 70px; }
.action-card.urgent .action-kind { color: var(--bad); } .action-card.fix .action-kind { color: var(--warn); } .action-card.opportunity .action-kind { color: var(--blue); }
.action-body b { display: block; font-size: 1.02rem; letter-spacing: -.015em; line-height: 1.3; margin-bottom: 3px; } .action-body p { color: var(--muted); font-size: .9rem; margin: 0; }
@media (max-width: 700px) { .action-card { grid-template-columns: 1fr; } .action-kind { padding-top: 0; } }

.now { display: grid; gap: 0; }
.now a { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--hair); text-decoration: none; color: var(--ink); }
.now a:last-child { border-bottom: 0; } .now a:hover b { color: var(--blue); }
.now b { font-size: 1.7rem; letter-spacing: -.04em; font-weight: 800; } .now span { color: var(--muted); font-size: .9rem; } .now small { display: block; color: var(--faint); }

.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.funnel-row { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 5px; } .funnel-count { font-variant-numeric: tabular-nums; }
.funnel-track { height: 14px; background: var(--surface-2); } .funnel-fill { height: 100%; background: var(--blue); transition: width .6s var(--ease); }
.funnel-lost { display: block; margin-top: 4px; font-size: .8rem; color: var(--bad); }

.setup-card { border-color: var(--blue); background: linear-gradient(180deg, var(--tint), var(--paper) 140px); }
.setup-head { display: flex; justify-content: space-between; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.setup-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.setup-list li { display: grid; grid-template-columns: 26px 1fr auto; gap: 14px; align-items: center; padding: 12px 8px; border-top: 1px solid var(--hair); }
.setup-list li.next { background: var(--paper); box-shadow: inset 3px 0 0 var(--blue); }
.setup-list .tick { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--hair-strong); display: grid; place-items: center; color: #fff; }
.setup-list li.done .tick { background: var(--good); border-color: var(--good); } .setup-list li.done b { color: var(--muted); font-weight: 600; }
.setup-list p { margin: 2px 0 0; }

/* ---------------------------------------------------------------- insights */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters button { font: 600 12px/1 var(--mono); letter-spacing: .05em; text-transform: uppercase; border: 1px solid var(--hair-strong); background: var(--paper); padding: 9px 14px; cursor: pointer; color: var(--ink); }
.filters button.on { background: var(--ink); color: #fff; border-color: var(--ink); } .filters button:hover:not(.on) { background: var(--tint); }
.finding { border-left: 4px solid var(--hair-strong); } .finding.high { border-left-color: var(--bad); } .finding.medium { border-left-color: var(--warn); } .finding.info { border-left-color: var(--blue); }
.finding h3 { font-size: 1.15rem; letter-spacing: -.03em; line-height: 1.25; margin: 8px 0 6px; }
.finding ul { margin: .5em 0 .9em; padding-left: 1.1em; color: var(--muted); }
.action { background: var(--tint); border-left: 3px solid var(--blue); padding: 11px 14px; } .action b { color: var(--blue); }
.confidence { display: inline-flex; align-items: center; gap: 6px; font: 600 10px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.confidence i { display: inline-block; width: 28px; height: 5px; background: var(--hair); position: relative; } .confidence i::after { content: ""; position: absolute; inset: 0 auto 0 0; background: var(--blue); width: var(--c, 50%); }

/* ---------------------------------------------------------------- settings */
.settings { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings-nav { position: sticky; top: 78px; display: grid; gap: 2px; }
.settings-nav a { padding: 9px 12px; text-decoration: none; color: var(--ink); font-weight: 600; border-left: 3px solid transparent; }
.settings-nav a:hover { background: var(--surface-2); } .settings-nav a.on { background: var(--tint); color: var(--blue); border-left-color: var(--blue); }
@media (max-width: 900px) { .settings { grid-template-columns: 1fr; } .settings-nav { position: static; display: flex; overflow-x: auto; gap: 4px; } .settings-nav a { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; } .settings-nav a.on { border-bottom-color: var(--blue); } }
.savebar { position: sticky; bottom: 0; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border-top: 1px solid var(--hair-strong); padding: 12px 0; margin-top: 16px; display: flex; gap: 12px; align-items: center; z-index: 5; }
.fieldset-title { font: 500 10.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--blue); margin: 22px 0 6px; padding-top: 18px; border-top: 1px solid var(--hair); } .fieldset-title:first-child { border: 0; padding: 0; margin-top: 0; }
.steps { counter-reset: step; padding: 0; list-style: none; } .steps > li { counter-increment: step; position: relative; padding-left: 44px; margin-bottom: 24px; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 700; }

/* ---------------------------------------------------------------- the product map: one dot per visitor */
.k { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 4px 0 0; vertical-align: -1px; }

/* ---------------------------------------------------------------- conversations */
.chathead { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.chatmsgs { display: flex; flex-direction: column; gap: 8px; height: 50vh; overflow: auto; padding: 14px 0; }
.cm { max-width: 80%; padding: 9px 13px; background: var(--tint); white-space: pre-wrap; overflow-wrap: anywhere; }
.cm .cw { display: block; font: 600 10px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cm.visitor { align-self: flex-end; background: var(--blue); color: #fff; } .cm.visitor .cw { color: rgba(255, 255, 255, .75); }
.cm.agent { background: var(--good-soft); } .cm.sys { align-self: center; background: none; color: var(--muted); font-size: .82rem; text-align: center; }
.livedot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--good); margin-right: 8px; animation: pulse 1.6s ease-in-out infinite; }

/* ---------------------------------------------------------------- customers and charts */
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--tint); color: var(--blue); display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; letter-spacing: -.03em; flex: none; }
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
svg.chart { width: 100%; height: 140px; display: block; } svg.chart rect { fill: var(--blue); }
.timeline { list-style: none; padding: 0; margin: 0; max-height: 380px; overflow: auto; }
.toolbar input[type=search] { min-width: 240px; }

/* ---------------------------------------------------------------- sign in and plain pages */
.auth-box { max-width: 460px; margin: 9vh auto 0; padding: 0 18px; }
.auth-box h1 { margin-bottom: 10px; } .auth-box .card { padding: 30px; }
.plain { max-width: 1000px; margin: 0 auto; padding: 28px 20px 80px; }
.plain-top { display: flex; align-items: center; gap: 14px; padding: 14px clamp(18px, 3vw, 40px); border-bottom: 1px solid var(--hair); background: var(--paper); }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(86vw, 300px); transform: translateX(-102%); transition: transform .28s var(--ease); box-shadow: 0 0 60px rgba(6, 20, 58, .3); }
  .shell.open .side { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(6, 20, 58, .4); z-index: 15; }
  .menu-btn { display: inline-flex; }
  .find input { width: 140px; } .crumbs { display: none; }
}
@media (max-width: 640px) { .bar-row { grid-template-columns: 90px 1fr 44px; } .find { display: none; } .topbar { gap: 8px; } .pill-select span { display: none; } }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .stat { padding: 12px 12px 8px; } .stat-value { font-size: 1.6rem; } .stat-delta small { display: none; } .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ================================================================ round two: lists, canvases, console */
.crumbs a { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); text-decoration: none; } .crumbs a:hover b { text-decoration: underline; text-underline-offset: 3px; }
.page.wide { max-width: none; }
.narrow { max-width: 760px; }
.searchbox { position: relative; display: inline-flex; align-items: center; font-weight: 400 !important; }
.searchbox .ico { position: absolute; left: 10px; color: var(--faint); pointer-events: none; }
.searchbox input { padding: 8px 12px 8px 33px; min-width: min(300px, 100%); }
.toolbar { gap: 12px 16px; } .toolbar .spacer { flex: 1; }
.kpi-btn { text-align: left; font: inherit; cursor: pointer; } .kpi-btn:hover { border-color: var(--blue); background: var(--tint); }
.small-kpis { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-top: 12px; } .small-kpis .kpi { padding: 10px 12px; } .small-kpis .value { font-size: 1.35rem; margin-top: 6px; } .small-kpis small { font-size: .7rem; color: var(--muted); font-weight: 600; letter-spacing: 0; }

/* long lists that load as you scroll, with headings that sort */
.table-wrap.lazy { max-height: min(68vh, 720px); overflow: auto; border: 1px solid var(--hair); margin: 0 !important; }
.table-wrap.lazy thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; box-shadow: 0 1px 0 var(--hair-strong); }
.sorter { all: unset; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; font: inherit; font-weight: 700; color: inherit; white-space: nowrap; } .sorter:hover { color: var(--blue); } .sorter:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.sorter .arrow { font-size: .8em; color: var(--faint); } .sorter.on { color: var(--blue); } .sorter.on .arrow { color: var(--blue); }
th.num .sorter { flex-direction: row-reverse; }
.lazy-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; position: relative; } .lazy-foot i { position: absolute; left: 0; right: 0; bottom: 0; height: 1px; }
tr.clickable:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
td.empty, .plist-body .empty { text-align: center; color: var(--muted); padding: 28px 12px; }

/* products: a list you can search, and the picture for the one you pick */
.split { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); gap: 16px; align-items: start; } .split > * { min-width: 0; }
.plist { padding: 0; position: sticky; top: 74px; max-height: calc(100vh - 96px); display: flex; flex-direction: column; margin: 0; }
.plist-head { padding: 16px 16px 10px; display: grid; gap: 10px; border-bottom: 1px solid var(--hair); } .plist-head h2 { font-size: 1.05rem; } .plist-head p { margin: 0; }
.plist-head .searchbox input { min-width: 0; width: 100%; } .plist-head .searchbox { display: flex; }
.sortpick { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); } .sortpick select { flex: 1; min-width: 0; padding: 6px 8px; }
.plist-body { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; min-height: 120px; }
.pitem { display: grid; gap: 3px; padding: 10px 16px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--hair); border-left: 3px solid transparent; } .pitem:hover { background: var(--tint); } .pitem.on { background: var(--tint); border-left-color: var(--blue); }
.pname { font-weight: 700; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .pnums { font-size: .78rem; color: var(--muted); }
.minibar { display: flex; height: 4px; background: var(--surface-2); overflow: hidden; margin-top: 2px; } .minibar i { display: block; height: 100%; }
.pd-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.legend-toggle { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.lg { display: inline-flex; gap: 7px; align-items: center; font: 600 12px/1 var(--display); border: 1px solid var(--hair-strong); background: var(--paper); padding: 7px 10px; cursor: pointer; color: var(--ink); } .lg i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.lg:not(.on):not(.ringlabel) { opacity: .5; text-decoration: line-through; } .lg.ringlabel { cursor: default; border-style: dashed; } .lg i.ringed { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #06143a; width: 7px; height: 7px; margin: 0 2px; background: var(--blue); }
.canvas { position: relative; border: 1px solid var(--hair); background: radial-gradient(circle at 50% 50%, #fff 0, #f6f9ff 100%); height: clamp(380px, 62vh, 640px); overflow: hidden; }
.canvas svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; } .canvas svg.dragging { cursor: grabbing; } .canvas svg:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.zoomctl { position: absolute; right: 10px; top: 10px; display: flex; gap: 4px; z-index: 3; }
.zoomctl button { font: 700 14px/1 var(--display); min-width: 34px; height: 34px; padding: 0 10px; background: var(--paper); border: 1px solid var(--hair-strong); cursor: pointer; color: var(--ink); } .zoomctl button:hover { background: var(--tint); } .zoomctl button.primary { background: var(--ink); color: #fff; border-color: var(--ink); font-size: 12px; }
.canvas-hint { position: absolute; left: 12px; bottom: 8px; margin: 0; font: 500 11px var(--mono); color: var(--faint); pointer-events: none; background: rgba(255,255,255,.8); padding: 2px 6px; }
.dot { cursor: pointer; transition: opacity .15s, filter .15s; } .dot.faded { opacity: .08; pointer-events: none; } .dot.hot { stroke: var(--ink); stroke-width: 2.4; filter: drop-shadow(0 0 3px rgba(6,20,58,.5)); } .dot.picked { stroke: #c2271b; stroke-width: 3; }
.canvas.is-ball svg { cursor: pointer; }
.vpanel { border: 1px solid var(--hair); padding: 14px; background: var(--paper); display: flex; flex-direction: column; gap: 8px; overflow: auto; max-height: clamp(380px, 62vh, 640px); } .vpanel h4 { font: 500 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 0; }
.vcard { display: grid; gap: 4px; } .vname { font-size: 1.02rem; overflow-wrap: anywhere; } .vdot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; } .vdid { font-weight: 600; margin: 4px 0; }
.vcard dl, .cside dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0 0 10px; font-size: .86rem; } .vcard dt, .cside dt { color: var(--muted); } .vcard dd, .cside dd { margin: 0; overflow-wrap: anywhere; }
.vlist { margin-top: auto; border-top: 1px solid var(--hair); padding-top: 10px; } .vlist .searchbox { display: flex; } .vlist input { min-width: 0; width: 100%; padding: 6px 10px 6px 30px; }
#v-results { list-style: none; margin: 6px 0 0; padding: 0; } #v-results button { all: unset; cursor: pointer; display: flex; gap: 6px; align-items: center; padding: 5px 4px; font-size: .84rem; width: calc(100% - 8px); overflow-wrap: anywhere; } #v-results button:hover { background: var(--tint); }

/* site map */
.map-card { padding-bottom: 14px; } .map-canvas { height: clamp(420px, 66vh, 760px); background: #fff; }
.map-legend { display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin: 0 0 10px; } .map-legend span { display: inline-flex; gap: 6px; align-items: center; } .map-legend i { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.map-legend .pill-key { background: #a15c07; border-radius: 6px; width: 20px; height: 9px; } .map-legend .bar-key { height: 3px; width: 18px; background: var(--blue); }
.map-svg .node { cursor: pointer; } .map-svg .node:focus-visible rect:first-child, .map-svg .node.sel rect:first-child { stroke: var(--ink); stroke-width: 2.6; }

/* charts with both axes named */
.axchart { margin: 6px 0 0; position: relative; } .axchart svg { width: 100%; height: auto; display: block; max-height: 340px; }
.axchart .gl { stroke: var(--hair); stroke-width: 1; } .axchart .gl.base { stroke: var(--hair-strong); } .axchart .axt { font: 500 11px var(--mono); fill: var(--muted); } .axchart .axl { font: 600 11px var(--display); fill: var(--ink); }
.axchart .bar { fill: var(--blue); } .axchart .bar.on { fill: var(--blue-deep); } .axchart .prevline { stroke: var(--ink); stroke-opacity: .45; stroke-width: 1.6; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; } .axchart .hit { fill: transparent; }
.axtip { position: absolute; z-index: 3; background: var(--ink); color: #fff; padding: 8px 11px; font-size: .82rem; line-height: 1.4; pointer-events: none; min-width: 150px; } .axtip .muted { color: rgba(255,255,255,.7); }
.axchart figcaption { display: flex; gap: 14px; align-items: center; margin-top: 4px; } .axchart .key { display: inline-block; width: 18px; height: 10px; margin-right: 6px; vertical-align: middle; } .key.bar-key { background: var(--blue); } .key.prev-key { height: 0; border-top: 2px dashed rgba(6,20,58,.5); }
.chart-sum { margin: 4px 0 8px; }

/* insights */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--hair-strong); margin: 4px 0 16px; } .tabs button, .tabs a { all: unset; cursor: pointer; padding: 10px 16px; font-weight: 700; font-size: .92rem; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; } .tabs .on { color: var(--ink); border-bottom-color: var(--blue); } .tabs button:hover:not(.on), .tabs a:hover:not(.on) { color: var(--blue); } .tabs :focus-visible { outline: 2px solid var(--blue); }
.tabs .count { font: 700 11px var(--mono); background: var(--surface-2); padding: 2px 7px; border-radius: 999px; margin-left: 4px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hair); }
.still-note { display: flex; gap: 10px; align-items: flex-start; background: var(--bad-soft); color: var(--bad); padding: 10px 12px; margin: 0 0 12px; font-size: .9rem; } .still-note span { color: var(--ink); }
.card.handled { border-left: 4px solid var(--good); } .card.handled h3 { margin-top: 6px; }

/* conversations console */
.console { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr) 270px; height: calc(100vh - 170px); min-height: 480px; border: 1px solid var(--hair-strong); background: var(--paper); } .console > * { min-width: 0; min-height: 0; }
.clist { display: flex; flex-direction: column; border-right: 1px solid var(--hair); }
.clist-head { padding: 12px; display: grid; gap: 10px; border-bottom: 1px solid var(--hair); } .clist-head .searchbox input { width: 100%; min-width: 0; } .clist-head .searchbox { display: flex; } .clist-head .filters { margin: 0; gap: 6px; } .clist-head .filters button { padding: 6px 9px; font-size: 10.5px; }
.c-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .soundtoggle { margin-left: auto; font-size: .8rem; color: var(--muted); display: flex; gap: 5px; align-items: center; cursor: pointer; }
.livebadge { font: 700 10.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 5px 9px; background: var(--surface-2); color: var(--muted); } .livebadge[data-state=on] { background: var(--good-soft); color: var(--good); } .livebadge[data-state=on]::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 6px; animation: pulse 1.6s ease-in-out infinite; } .livebadge[data-state=off] { background: var(--bad-soft); color: var(--bad); }
.crows { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.crows .group { font: 600 10.5px var(--mono); letter-spacing: .09em; text-transform: uppercase; color: var(--faint); padding: 10px 14px 5px; background: var(--surface-2); position: sticky; top: 0; z-index: 1; } .crows .empty { padding: 28px 14px; color: var(--muted); text-align: center; }
.crow { display: grid; gap: 3px; padding: 11px 14px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--hair); border-left: 3px solid transparent; } .crow:hover { background: var(--tint); } .crow.on { background: var(--tint); border-left-color: var(--blue); }
.crow.m-waiting, .crow.m-asked { border-left-color: var(--bad); background: #fff8f7; } .crow.on.m-waiting, .crow.on.m-asked { background: var(--bad-soft); }
.crow-top { display: flex; justify-content: space-between; gap: 8px; } .crow-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .93rem; } .crow .when { font: 500 11px var(--mono); color: var(--faint); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); display: inline-block; }
.crow-text { font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .crow-text.typing { color: var(--blue); } .crow-text em { font-style: normal; font-weight: 700; }
.crow-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cthread { display: flex; flex-direction: column; min-width: 0; } .cthread .chathead { padding: 12px 16px; border-bottom: 1px solid var(--hair); align-items: center; flex-wrap: nowrap; } .cthread .chathead .back { display: none; }
.cthread .chatmsgs { flex: 1; height: auto; padding: 16px; min-height: 0; background: #fbfcff; }
.cm time { margin-left: 8px; font-weight: 500; opacity: .7; } .cm.assistant { background: var(--tint); } .cm.visitor.draft { background: transparent; color: var(--ink); border: 1.5px dashed var(--blue); opacity: .9; } .cm.visitor.draft .cw { color: var(--blue); }
.caret { display: inline-block; width: 2px; height: 1em; background: var(--blue); margin-left: 2px; vertical-align: text-bottom; animation: blink 1s steps(2) infinite; } @keyframes blink { 50% { opacity: 0; } }
.composer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--hair); background: var(--paper); align-items: flex-end; } .composer textarea { flex: 1; resize: none; font: inherit; padding: 9px 11px; border: 1px solid var(--hair-strong); } .composer.off textarea { background: var(--surface-2); }
.cside { padding: 16px; overflow: auto; border-left: 1px solid var(--hair); background: var(--paper); } .cside h4 { font: 500 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 0 0 10px; }
.c-empty { margin: auto; text-align: center; max-width: 380px; padding: 30px; color: var(--faint); } .c-empty h3 { color: var(--ink); margin: 10px 0 6px; } .pad { padding: 20px; }
@media (max-width: 1180px) { .console { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); } .cside { display: none; } }
@media (max-width: 800px) {
  .console { grid-template-columns: 1fr; height: calc(100vh - 150px); } .console.has-chat .clist { display: none; } .console:not(.has-chat) .cthread { display: none; } .cthread .chathead .back { display: inline-flex; transform: rotate(180deg); }
  .split { grid-template-columns: 1fr; } .plist { position: static; max-height: 360px; } .cloud-split { grid-template-columns: 1fr; } .vpanel { max-height: none; }
}

/* help */
.help { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; } .help-toc { position: sticky; top: 80px; display: grid; gap: 2px; } .help-toc a { padding: 8px 10px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem; border-left: 2px solid var(--hair); } .help-toc a:hover { color: var(--blue); border-left-color: var(--blue); } .help-toc .ext { margin-top: 10px; display: flex; gap: 8px; align-items: center; }
.help-dl { display: grid; grid-template-columns: 150px 1fr; gap: 12px 18px; margin: 0; } .help-dl dt { font-weight: 700; } .help-dl dd { margin: 0; color: var(--muted); } .help details { border-top: 1px solid var(--hair); padding: 10px 0; } .help summary { cursor: pointer; font-weight: 700; }
@media (max-width: 800px) { .help { grid-template-columns: 1fr; } .help-toc { position: static; grid-auto-flow: column; overflow-x: auto; } .help-dl { grid-template-columns: 1fr; gap: 2px; } .help-dl dd { margin-bottom: 10px; } }
/* the picture needs room: when its card is not wide, the visitor panel goes underneath instead of squeezing it */
.small-kpis { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
@container (max-width: 780px) {
  .vpanel { max-height: none; min-height: 150px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 220px); gap: 4px 18px; align-content: start; }
  .vpanel h4 { grid-column: 1 / -1; } .vpanel > p, .vpanel .vcard-slot { grid-column: 1; } .vpanel .vlist { grid-column: 2; grid-row: 2 / span 3; margin-top: 0; border-top: 0; padding-top: 0; }
}
.cloud-card { padding-bottom: 14px; container-type: inline-size; } .cloud-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.cloud-split { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 14px; align-items: stretch; } .cloud-split > * { min-width: 0; }
@container (max-width: 780px) { .cloud-split { grid-template-columns: 1fr; } }
