/* The usage site (usage/): the analytics site's tokens (src/css/site.css), light only like the site.
   Chart series are the site's three, the first stepped lighter so the set passes the chart colour checks
   (lightness band, chroma, colour-blind separation on adjacent stack segments; dataviz validate_palette.js). */
@font-face { font-family: "Cabinet Grotesk"; src: url("assets/cabinet-grotesk-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Cabinet Grotesk"; src: url("assets/cabinet-grotesk-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  --brand: #005A38;
  --brand-hover: #004617;
  --brand-tint: rgba(0, 90, 56, 0.07);
  --brand-tint-strong: rgba(0, 90, 56, 0.13);
  --text: #18251D;
  --muted: #5B6560;
  --canvas: #F7F6F0;
  --surface: #FFFFFF;
  --hover: #F3F4F2;
  --border: #DFE5DC;
  --border-strong: #C6CCC5;
  --focus-ring: rgba(0, 90, 56, 0.16);
  --gold-bg: #FBF6DF; --gold-text: #675C00;
  --red-bg: #FBEFEC; --red-text: #8C3B2E;
  --blue-bg: #EAF1FC; --blue-text: #245BB8;
  --orange-bg: #FBEFE2; --orange-text: #96511A;
  --green-bg: #E8F3EC; --green-text: #1F6B44;
  --violet-bg: #F1EDF8; --violet-text: #5B3F8F;
  --series-chat: #1A8A5A;
  --series-built: #2F6FD6;
  --series-opened: #B5651D;
  --series-views: #3F5A4C;
  --grid: #E9ECE7;
  --shadow-card: 0 2px 4px rgb(18 43 28 / 2%), 0 8px 24px rgb(18 43 28 / 3%);
  --shadow-float: 0 4px 8px rgb(18 43 28 / 6%), 0 16px 40px rgb(18 43 28 / 12%);
  --font: Roboto, Arial, sans-serif;
  --display: "Cabinet Grotesk", Roboto, Arial, sans-serif;
  --r-control: 4px;
  --r-card: 6px;
  --r-pill: 999px;
  --gutter: 32px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--text); font: 14px/1.5 var(--font); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---- header ---- */
.top { background: var(--surface); border-bottom: 1px solid var(--border); }
.top__inner, .wrap { max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter); }
.top__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); min-width: 0; }
.brand__logo { display: block; width: 104px; height: auto; }
.brand__divider { width: 1px; height: 28px; background: var(--border-strong); }
.brand__product { font: 700 17px/1.2 var(--display); letter-spacing: 0.01em; white-space: nowrap; }
.top__who { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the Usage / Business rules switch: tabs that sit on the header's bottom line */
.switch { display: flex; align-self: stretch; gap: 4px; margin: 0 auto 0 16px; }
.switch__link { display: flex; align-items: center; padding: 0 12px; border-top: 2px solid transparent; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); font-weight: 500; text-decoration: none; white-space: nowrap; }
.switch__link:hover { color: var(--text); background: var(--hover); }
.switch__link[aria-current="page"] { color: var(--brand); border-bottom-color: var(--brand); }
.switch__link:focus-visible { outline-offset: -2px; }

/* ---- the gate: signing in, sign-in button, refused, failed ---- */
.gate { max-width: 460px; margin: 12vh auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-card); padding: 32px; text-align: center; }
.gate h1 { font: 700 24px/1.25 var(--display); margin: 0 0 8px; }
.gate p { margin: 0 0 20px; color: var(--muted); }
.gate p:last-child { margin-bottom: 0; }
.spinner { width: 28px; height: 28px; margin: 0 auto 16px; border-radius: 50%; border: 3px solid var(--brand-tint-strong); border-top-color: var(--brand); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ---- buttons, segmented controls, inputs ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: var(--r-control); border: 1px solid var(--brand); background: var(--brand); color: #fff; font-weight: 500; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn--quiet { background: var(--surface); color: var(--brand); border-color: var(--border-strong); }
.btn--quiet:hover { background: var(--hover); border-color: var(--border-strong); }
.btn--small { height: 32px; padding: 0 12px; font-size: 13px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font-size: 13px; }

.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r-control); background: var(--surface); overflow: hidden; max-width: 100%; }
.segmented button { border: 0; background: none; padding: 0 14px; height: 36px; cursor: pointer; white-space: nowrap; color: var(--muted); font-weight: 500; }
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button:hover { background: var(--hover); color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--brand); color: #fff; }

.input, .select { height: 36px; border: 1px solid var(--border-strong); border-radius: var(--r-control); background: var(--surface); padding: 0 10px; min-width: 0; }
.input:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus-ring); }

/* ---- page head ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; padding: 32px 0 20px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.page-head h1 { margin: 0; font: 700 32px/1.15 var(--display); }
.lede { margin: 6px 0 0; color: var(--muted); max-width: 62ch; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; }
.status { margin: -8px 0 16px; color: var(--muted); font-size: 13px; min-height: 20px; }
.status button { margin-left: 6px; }

/* ---- stat tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-card); padding: 14px 16px; min-width: 0; }
.tile__label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.tile__dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.tile__value { display: block; margin-top: 4px; font: 700 30px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.tile__sub { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

/* ---- cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-card); padding: 20px; margin-bottom: 16px; min-width: 0; }
.card__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; }
.card__title { margin: 0; font: 700 19px/1.25 var(--display); }
.card__sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-2 > .card, .stack > .card { margin-bottom: 16px; }
.stack { min-width: 0; }
.empty { color: var(--muted); padding: 16px 0; margin: 0; }

/* ---- legend + charts ---- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; color: var(--text); font-size: 13px; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }
/* colours by role, as classes: the site's CSP allows no inline style attribute (staticwebapp.config.json) */
.c-chat { background: var(--series-chat); fill: var(--series-chat); }
.c-built { background: var(--series-built); fill: var(--series-built); }
.c-opened { background: var(--series-opened); fill: var(--series-opened); }
.c-views { background: var(--series-views); fill: var(--series-views); }
.speed { margin-top: 16px; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .day:focus { outline: none; }
.chart .day:focus .hit, .chart .day.is-hover .hit { fill: rgba(24, 37, 29, 0.05); }
.chart .peak { fill: var(--text); font-size: 11px; font-weight: 500; font-family: var(--font); }
.tip { position: fixed; z-index: 20; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-float); padding: 10px 12px; font-size: 13px; min-width: 160px; }
.tip__title { font-weight: 500; margin-bottom: 4px; }
.tip__row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip__row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.tip__row strong { font-weight: 500; font-variant-numeric: tabular-nums; }
.tip__total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }

/* ---- bar lists (page views by page, outcomes) ---- */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: 132px minmax(0, 1fr) 132px; align-items: center; gap: 12px; }
.bars__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars__track { display: block; height: 12px; border-radius: 0 4px 4px 0; background: var(--hover); overflow: hidden; }
.bars__fill { display: block; width: 0; height: 100%; border-radius: 0 4px 4px 0; background: var(--series-views); min-width: 2px; }
.bars__value { color: var(--muted); font-size: 13px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bars__value strong { color: var(--text); font-weight: 500; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
td.n, th.n { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tr.is-link { cursor: pointer; }
tr.is-link:hover td { background: var(--hover); }
.who { display: flex; flex-direction: column; min-width: 0; }
.who__name { font-weight: 500; }
.who__mail { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

/* ---- tags ---- */
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-pill); font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--hover); color: var(--muted); }
.tag--team { background: var(--brand-tint-strong); color: var(--brand); }
.tag--chat { background: var(--green-bg); color: var(--green-text); }
.tag--dashboard { background: var(--blue-bg); color: var(--blue-text); }
.tag--open { background: var(--orange-bg); color: var(--orange-text); }
.tag--rules { background: var(--violet-bg); color: var(--violet-text); }
.tag--refused { background: var(--gold-bg); color: var(--gold-text); }
.tag--error, .tag--capped { background: var(--red-bg); color: var(--red-text); }

/* ---- the question feed ---- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.filters .input { flex: 1 1 240px; }
.feed-count { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.feed { list-style: none; margin: 0; padding: 0; }
.q { display: grid; grid-template-columns: 172px minmax(0, 1fr); gap: 4px 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.q__tags { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.q__text { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.q__meta { grid-column: 2; margin: 0; color: var(--muted); font-size: 12px; }
.q__meta a { font-weight: 500; }
.q__meta button { font-size: 12px; }
.more { margin-top: 12px; }

/* ---- notes ---- */
.notes { color: var(--muted); font-size: 13px; padding: 4px 0 40px; max-width: 80ch; }
.notes p { margin: 0 0 6px; }

/* ---- narrower ---- */
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
/* the switch gets its own row under the logo: two equal tabs */
@media (max-width: 720px) {
  .top__inner { flex-wrap: wrap; gap: 0 16px; }
  .brand { min-height: 56px; }
  .switch { order: 3; flex: 0 0 calc(100% + 2 * var(--gutter)); margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); border-top: 1px solid var(--border); gap: 0; }
  .switch__link { flex: 1 1 0; justify-content: center; height: 44px; }
}
@media (max-width: 600px) {
  :root { --gutter: 16px; }
  .top__inner { min-height: 56px; }
  .brand__logo { width: 84px; }
  .brand__product { font-size: 15px; }
  .top__who { display: none; }
  .page-head { padding-top: 20px; }
  .page-head h1 { font-size: 26px; }
  .controls, .controls .segmented { width: 100%; }
  .controls .segmented button { flex: 1 1 0; padding: 0 6px; font-size: 13px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 12px; }
  .tile__value { font-size: 24px; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .table-wrap table { min-width: 460px; }
  #people .who__mail { display: none; }
  .bars li { grid-template-columns: 92px minmax(0, 1fr) 112px; gap: 8px; }
  .q { grid-template-columns: minmax(0, 1fr); }
  .q__meta { grid-column: 1; }
  .filters .select { flex: 1 1 140px; }
}
