/* ShopperScope: the merchant's interface. The look is the approved demo (docs/ui_demo): a dark menu, a light
   ground, white cards; people are orange, AI agents blue, unsure visits hatched grey. */
:root {
  --ink: #131C26; --ink2: #3F4B59; --ink3: #5A6675; --ground: #EEF1F4; --card: #FFFFFF; --menu: #111A24; --line: #D5DBE2; --line2: #EDF0F3;
  --people: #EB6834; --agents: #2A78D6; --agents-on-dark: #5B9BEA;
  --hatch: repeating-linear-gradient(135deg, #AEB7C1 0 3px, #D5DBE1 3px 6px);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.45; }
button { font: inherit; cursor: pointer; color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--agents); outline-offset: 2px; }
a { color: #174A8C; } a:hover { color: #0E3566; }
.loading { padding: 40px; color: var(--ink3); }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.num { font-variant-numeric: tabular-nums; }

.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.menu { flex: 1 0 216px; background: var(--menu); padding: 22px 14px; display: flex; flex-direction: column; gap: 26px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: #fff; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.tabs { display: flex; flex-direction: column; gap: 4px; }
.tabs button { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border: 0; border-radius: 8px; text-align: left; font-size: 14.5px;
  background: transparent; color: #C3CCD6; font-weight: 400; }
.tabs button:hover { background: #1A2633; }
.tabs button.on { background: #22303F; color: #fff; font-weight: 500; }
.legend { margin-top: auto; padding: 0 8px; display: flex; flex-direction: column; gap: 6px; color: #9CA8B6; font-size: 12.5px; }
.legend div, .chart-legend span { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 2px; flex: 0 0 10px; }
.dot.people { background: var(--people); } .dot.agents { background: var(--agents); } .menu .dot.agents { background: var(--agents-on-dark); }
.dot.unsure { background: var(--hatch); } .menu .dot.unsure { background: repeating-linear-gradient(135deg, #7E8A98 0 2px, #4A5665 2px 4px); }
.signout { background: transparent; border: 0; color: #9CA8B6; font-size: 12.5px; text-align: left; padding: 0 8px; }
.signout:hover { color: #fff; }

.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.sitebar { background: var(--card); padding: 12px 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; border-bottom: 1px solid #DFE4EA; }
.label { font-size: 12.5px; color: var(--ink3); font-weight: 500; }
.sites { display: flex; flex-wrap: wrap; gap: 6px; }
.sites button { min-height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid #C5CED8; background: #fff; color: var(--ink); font-size: 13.5px; font-weight: 500; }
.sites button.on { border-color: var(--menu); background: var(--menu); color: #fff; }
.domain { font-size: 12.5px; color: var(--ink3); }
.pill { margin-left: auto; font-size: 12.5px; font-weight: 500; padding: 5px 10px; border-radius: 999px; }
.content { padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.015em; }
.question { margin: 4px 0 0; font-size: 14.5px; color: var(--ink3); }
.subs { display: flex; flex-wrap: wrap; gap: 4px 22px; border-bottom: 1px solid var(--line); }
.subs button { min-height: 40px; padding: 0 2px; background: transparent; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14.5px; color: var(--ink3); font-weight: 400; }
.subs button.on { border-bottom-color: var(--ink); color: var(--ink); font-weight: 500; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.bar .group { display: flex; align-items: center; gap: 8px; }
.seg { display: flex; }
.seg button { min-height: 34px; padding: 0 13px; border: 1px solid #C5CED8; margin-left: -1px; background: #fff; color: var(--ink); font-size: 13.5px; font-weight: 500; }
.seg button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; } .seg button:last-child { border-radius: 0 8px 8px 0; }
.seg button.on { background: var(--menu); border-color: var(--menu); color: #fff; position: relative; z-index: 1; }
.dates { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink3); }
.dates input { font: inherit; font-size: 13px; min-height: 34px; padding: 0 8px; border: 1px solid #C5CED8; border-radius: 8px; color: var(--ink); background: #fff; }
.dates button { min-height: 34px; padding: 0 12px; border: 1px solid #C5CED8; border-radius: 8px; background: #fff; font-size: 13.5px; font-weight: 500; }
.filterline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--ink2); }
.filterline button { border: 1px solid #C5CED8; background: #fff; border-radius: 999px; padding: 3px 10px; font-size: 12.5px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 16px; }
.tile { background: var(--card); border-radius: 10px; padding: 18px 20px; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.tile .name { font-size: 13.5px; color: var(--ink3); font-weight: 500; }
.tile .value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile .foot { font-size: 13px; color: var(--ink2); }
.tile .delta { font-size: 12.5px; color: var(--ink3); font-variant-numeric: tabular-nums; min-height: 18px; }
.bar3 { display: flex; gap: 2px; height: 8px; margin: 2px 0; }
.bar3 > div, .split > div { border-radius: 2px; min-width: 0; }
.bar3 .p, .split .p { background: var(--people); } .bar3 .a, .split .a { background: var(--agents); } .bar3 .u { background: var(--hatch); }

.blocks { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.block { min-width: 0; background: var(--card); border-radius: 10px; padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 12px; }
.block h2 { margin: 0; font-size: 16px; font-weight: 600; }
.block .sub { margin: 3px 0 0; font-size: 13px; color: var(--ink3); max-width: 92ch; }
.block .foot { margin: 0; font-size: 12.5px; color: var(--ink3); max-width: 96ch; text-wrap: pretty; }
.empty { font-size: 14px; color: var(--ink3); padding: 10px 0 6px; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--ink2); }
.plot { position: relative; height: 176px; padding-left: 48px; display: flex; align-items: flex-end; gap: 3px; }
.tick { position: absolute; left: 0; right: 0; border-top: 1px solid #E4E8ED; }
.tick span { position: absolute; left: 0; top: -9px; font-size: 12px; color: var(--ink3); background: #fff; padding-right: 6px; font-variant-numeric: tabular-nums; }
.col { position: relative; flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.col .stack { width: 100%; max-width: 24px; display: flex; flex-direction: column; gap: 2px; border-radius: 4px 4px 0 0; overflow: hidden; }
.col .stack .p { background: var(--people); } .col .stack .a { background: var(--agents); } .col .stack .u { background: var(--hatch); }
.col:hover .stack { filter: brightness(0.92); }
.xlabels { padding-left: 48px; display: flex; gap: 3px; }
.xlabels div { flex: 1 1 0; min-width: 0; display: flex; justify-content: center; font-size: 12px; color: var(--ink3); white-space: nowrap; font-variant-numeric: tabular-nums; }

.scroll { overflow-x: auto; }
.thead, .trow { display: grid; }
.thead { border-bottom: 1px solid var(--line); }
.thead div { padding: 8px 12px 8px 0; font-size: 12.5px; font-weight: 500; color: var(--ink3); }
.trow { border-bottom: 1px solid var(--line2); }
.trow.open { cursor: pointer; } .trow.open:hover { background: #F7F9FB; }
.cell { padding: 10px 12px 10px 0; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.cell:last-child, .thead div:last-child { padding-right: 0; }
.cell.right { align-items: flex-end; text-align: right; }
.cell .t { font-size: 14px; font-variant-numeric: tabular-nums; text-wrap: pretty; } .cell .t.b { font-weight: 500; }
.cell .s { font-size: 12.5px; color: var(--ink3); text-wrap: pretty; }
.split { display: flex; gap: 2px; height: 8px; width: 100%; }
.pair { display: flex; flex-direction: column; gap: 3px; width: 100%; }
.pair div { height: 6px; border-radius: 0 3px 3px 0; min-width: 1px; } .pair .p { background: var(--people); } .pair .a { background: var(--agents); }
.tag { font-size: 12.5px; font-weight: 500; padding: 3px 9px; border-radius: 999px; white-space: nowrap; align-self: flex-start; }
.cell.right .tag { align-self: flex-end; }
.tone-people { background: #FCE9DF; color: #8A3A12; } .tone-agents { background: #E1ECFA; color: #174A8C; } .tone-unsure { background: #E9EDF1; color: #3F4B59; }
.tone-warn { background: #FFF1CF; color: #6B4A00; } .tone-good { background: #DFF3E7; color: #14603A; }

.funnel { display: flex; flex-direction: column; gap: 14px; }
.fstep { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.fstep .name { flex: 0 0 230px; font-size: 14px; font-weight: 500; }
.fstep .bars { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fstep .line { display: flex; align-items: center; gap: 10px; }
.fstep .track { flex: 1 1 0; min-width: 0; }
.fstep .fill { height: 12px; border-radius: 0 4px 4px 0; min-width: 2px; } .fstep .fill.p { background: var(--people); } .fstep .fill.a { background: var(--agents); }
.fstep .words { flex: 0 0 170px; font-size: 13px; color: var(--ink2); font-variant-numeric: tabular-nums; }

.note { display: flex; flex-direction: column; gap: 12px; padding: 6px 0 4px; max-width: 86ch; }
.note p { margin: 0; font-size: 14.5px; text-wrap: pretty; }
.note ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.note li { display: flex; gap: 10px; align-items: baseline; font-size: 14px; color: var(--ink2); text-wrap: pretty; }
.note li::before { content: ""; flex: 0 0 6px; height: 6px; border-radius: 3px; background: var(--ink3); transform: translateY(-2px); }

.visits { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.vlist { flex: 1 1 400px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.vrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-height: 52px; padding: 8px 12px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.vrow:hover { background: #F5F7F9; } .vrow.on { background: #EAF1FB; }
.vrow .when { flex: 0 0 96px; font-size: 12.5px; color: var(--ink2); }
.vrow .what { flex: 1 1 180px; min-width: 0; font-size: 13.5px; }
.vrow .where { flex: 0 0 auto; font-size: 12.5px; color: var(--ink3); }
.panel { flex: 1 1 380px; min-width: 0; background: #F5F7F9; border-radius: 10px; padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 12px; }
.panel .head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.panel .head .tag { font-size: 13px; padding: 4px 11px; align-self: center; }
.panel .sure { font-size: 13px; color: var(--ink2); }
.panel h3 { margin: 0 0 6px; font-size: 12.5px; font-weight: 500; color: var(--ink3); }
.panel .reason, .panel .find { font-size: 13.5px; text-wrap: pretty; margin-bottom: 4px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 10px 16px; }
.facts div { display: flex; flex-direction: column; gap: 1px; min-width: 0; } .facts .k { font-size: 12.5px; color: var(--ink3); } .facts .v { font-size: 13.5px; }
.step { display: flex; gap: 12px; align-items: baseline; margin-bottom: 6px; }
.step .time { flex: 0 0 38px; font-size: 12.5px; color: var(--ink3); } .step .kind { flex: 0 0 108px; font-size: 13px; font-weight: 500; }
.step .text { flex: 1 1 0; min-width: 0; font-size: 13.5px; text-wrap: pretty; }

.signin { max-width: 380px; margin: 14vh auto; background: var(--card); border-radius: 10px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.signin h1 { font-size: 20px; } .signin p { margin: 0; color: var(--ink3); }
.signin input { font: inherit; min-height: 40px; padding: 0 12px; border: 1px solid #C5CED8; border-radius: 8px; }
.signin button { min-height: 40px; border: 0; border-radius: 8px; background: var(--menu); color: #fff; font-weight: 500; }
.signin .wrong { color: #A1260D; font-size: 13px; min-height: 18px; }
.welcome { background: var(--card); border-radius: 10px; padding: 24px; max-width: 820px; display: flex; flex-direction: column; gap: 12px; }
.welcome pre { margin: 0; background: #F5F7F9; border-radius: 8px; padding: 12px 14px; overflow-x: auto; font-size: 12.5px; }

.promos { display: flex; flex-wrap: wrap; gap: 8px; }
.promo { display: inline-flex; border: 1px solid #C5CED8; border-radius: 8px; overflow: hidden; background: #fff; }
.promo.on { border-color: var(--menu); box-shadow: inset 0 0 0 1px var(--menu); }
.promo button { border: 0; background: transparent; padding: 7px 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; font-size: 13.5px; }
.promo button span { font-size: 12.5px; color: var(--ink3); }
.promo .remove { border-left: 1px solid #DFE4EA; justify-content: center; font-size: 16px; color: var(--ink3); padding: 0 10px; }
.promo .remove:hover { color: #A1260D; }
.newpromo summary { cursor: pointer; font-size: 13.5px; font-weight: 500; color: #174A8C; }
.newpromo form { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px 16px; max-width: 900px; }
.newpromo label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink3); font-weight: 500; }
.newpromo input:not([type=checkbox]) { font: inherit; font-size: 14px; min-height: 36px; padding: 0 10px; border: 1px solid #C5CED8; border-radius: 8px; color: var(--ink); }
.newpromo .wide { grid-column: 1 / -1; }
.newpromo fieldset { border: 1px solid #DFE4EA; border-radius: 8px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; }
.newpromo legend { font-size: 12.5px; color: var(--ink3); font-weight: 500; padding: 0 4px; }
.newpromo .check { flex-direction: row; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink); font-weight: 400; }
.newpromo button[type=submit], .gobutton { min-height: 36px; padding: 0 14px; border: 0; border-radius: 8px; background: var(--menu); color: #fff; font-weight: 500; font-size: 13.5px; }
.newpromo .wrong { margin-left: 12px; color: #A1260D; font-size: 13px; }
