/* Happen Bank Contact Center demo — shared styles for every dashboard.
   Tokens follow the wiki's Dashboard Style Guide. Change a color here and it changes everywhere. */

:root {
  --page: #F7F1ED;
  --surface: #FFFFFF;
  --surface-warm: #FFFDFB;
  --text-primary: #232222;
  --text-secondary: #333333;
  --text-muted: #636363;
  --border: rgba(35, 34, 34, 0.12);
  --grid: rgba(35, 34, 34, 0.08);
  --brand-blue: #2626FF;
  --brand-blue-hover: #1E1FCA;
  --brand-blue-active: #171897;
  --brand-purple: #AD11E3;
  --series-email: #6A6AFF;
  --gradient: linear-gradient(90deg, #2626FF 21%, #AD11E3 48%, #FD4621 67%, #FD8224 84%);
  /* status: wash = backgrounds and bands only; ink = text, icons, marks */
  --good-wash: #03B87B;  --good-ink: #00704A;
  --watch-wash: #F2A900; --watch-ink: #7A5200;
  --off-wash: #FD4621;   --off-ink: #B8260B;
  --wash-op: 0.12;
  --control: #8A8580;  /* control borders: 3:1 on cards and page */
  --on-ink: #FFFFFF;   /* icon color on a filled ink shape */
  --event: #636363;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.05);
  --font: 'Rethink Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --sel-op: .2;
    --page: #141313; --surface: #1E1D1D; --surface-warm: #2A2828;
    --text-primary: #F7F1ED; --text-secondary: #D6D0CC; --text-muted: #9E9A97;
    --border: rgba(247, 241, 237, 0.12); --grid: rgba(247, 241, 237, 0.08);
    --brand-blue: #8080FF; --brand-blue-hover: #9999FF; --brand-blue-active: #B3B3FF;
    --brand-purple: #C95BF0; --series-email: #A3A3FF;
    --good-wash: #2FD39A; --good-ink: #2FD39A;
    --watch-wash: #F2B92E; --watch-ink: #F2B92E;
    --off-wash: #FF6E4F; --off-ink: #FF6E4F;
    --wash-op: 0.12; --control: #7E7B78; --on-ink: #141313; --event: #9E9A97;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] { --sel-op: .2;
  --page: #141313; --surface: #1E1D1D; --surface-warm: #2A2828;
  --text-primary: #F7F1ED; --text-secondary: #D6D0CC; --text-muted: #9E9A97;
  --border: rgba(247, 241, 237, 0.12); --grid: rgba(247, 241, 237, 0.08);
  --brand-blue: #8080FF; --brand-blue-hover: #9999FF; --brand-blue-active: #B3B3FF;
  --brand-purple: #C95BF0; --series-email: #A3A3FF;
  --good-wash: #2FD39A; --good-ink: #2FD39A;
  --watch-wash: #F2B92E; --watch-ink: #F2B92E;
  --off-wash: #FF6E4F; --off-ink: #FF6E4F;
  --wash-op: 0.12; --control: #7E7B78; --on-ink: #141313; --event: #9E9A97;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 120px; }   /* keep focused items clear of the sticky bar */
.skip { position: absolute; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; background: var(--surface); border: 2px solid var(--brand-blue); border-radius: 8px; font-weight: 600; }
.skip:focus { top: 8px; }
main:focus { outline: none; }
body {
  margin: 0; background: var(--page); color: var(--text-secondary);
  font-family: var(--font); font-size: 15px; line-height: 1.5;
  font-variant-ligatures: none;   /* the font turns "(1)" into a circled digit */
}
a { color: var(--brand-blue); }
a:hover { color: var(--brand-blue-hover); }
:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 2px; border-radius: 4px; }
/* Chart marks keep focus after a click redraws the chart; only keyboard focus gets an outline, so a mouse click leaves no box behind */
svg :focus:not(:focus-visible) { outline: none; }
/* Picked date (a day or month clicked on a chart): a box around its column, and a blue chip in the sticky bar with a line saying where × goes back to */
.selbox { fill: none; stroke: var(--text-primary); stroke-width: 2; pointer-events: none; }
.filter-bar .chip.pick { border: 2px solid var(--brand-blue); border-radius: 999px; color: var(--brand-blue-hover); background: color-mix(in srgb, var(--brand-blue) 12%, var(--surface)); font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; min-height: 40px; cursor: pointer; }
.filter-bar .chip.pick:hover { background: color-mix(in srgb, var(--brand-blue) 20%, var(--surface)); }
.filter-bar .pickhint { font-size: 13px; color: var(--text-secondary); }
@media (max-width: 767px) { .filter-bar .chip.pick { order: 5; flex: 1 1 100%; min-height: 44px; } .filter-bar .pickhint { order: 6; flex: 1 1 100%; font-size: 12px; margin-top: -4px; } }
h1, h2, h3 { color: var(--text-primary); line-height: 1.2; margin: 0; }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--text-muted); }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button { font: inherit; color: inherit; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; gap: 24px; min-height: 60px; }
.wordmark { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text-primary); white-space: nowrap; }
.wordmark b { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; }
.demo-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--brand-blue); color: var(--brand-blue); }
.site-nav { display: flex; gap: 4px; flex: 1; }
.site-nav details { position: relative; }
.site-nav summary {
  list-style: none; cursor: pointer; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 14px;
  color: var(--text-secondary); min-height: 44px; display: flex; align-items: center; gap: 4px;
}
.site-nav summary::-webkit-details-marker { display: none; }
.site-nav summary::after { content: "▾"; font-size: 11px; color: var(--text-muted); }
.site-nav summary:hover { background: var(--surface-warm); }
.site-nav summary.current { color: var(--brand-blue); box-shadow: inset 0 -2px 0 var(--brand-blue); border-radius: 8px 8px 0 0; }
.site-nav .menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 260px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.site-nav .menu a, .site-nav .menu span {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 6px;
  text-decoration: none; color: var(--text-secondary); font-size: 14px; min-height: 44px;
}
.site-nav .menu a:hover { background: var(--surface-warm); color: var(--text-primary); }
.site-nav .menu a[aria-current="page"] { color: var(--brand-blue); font-weight: 600; }
.site-nav .menu span { color: var(--text-muted); }
.site-nav .menu span small { font-size: 11px; border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; }
.header-tools { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.fresh-badge {
  display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary);
  text-decoration: none; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); white-space: nowrap;
}
.fresh-badge:hover { color: var(--text-primary); border-color: var(--text-muted); }
.icon-btn {
  min-width: 44px; min-height: 44px; border: 1px solid var(--control); background: var(--surface); border-radius: 8px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-secondary);
}
.icon-btn:hover { border-color: var(--text-muted); color: var(--text-primary); }
.menu-btn { display: none; }

.disclaimer { background: var(--surface-warm); border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); }
.disclaimer .wrap { padding-top: 8px; padding-bottom: 8px; }
.disclaimer b { color: var(--text-primary); }
.gradient-strip { height: 3px; background: var(--gradient); }

/* ---------- Filter bar ---------- */
.filter-bar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.filter-bar .wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.filter { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.filter select {
  font: inherit; font-size: 14px; color: var(--text-primary); background: var(--surface); min-height: 40px;
  border: 1px solid var(--control); border-radius: 8px; padding: 6px 30px 6px 10px; cursor: pointer;
}
.filter-bar .spacer { flex: 1; }
.link-btn {
  background: none; border: 0; color: var(--brand-blue); cursor: pointer; font-size: 14px; padding: 8px 6px;
  min-height: 40px; border-radius: 6px;
}
.link-btn:hover { color: var(--brand-blue-hover); text-decoration: underline; }
.btn {
  font-size: 14px; font-weight: 600; min-height: 40px; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--control); background: var(--surface); color: var(--text-primary);
}
.btn:hover { border-color: var(--text-muted); }

/* ---------- Status ---------- */
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 2px 8px 2px 6px; border-radius: 999px; white-space: nowrap; }
.status::before { font-size: 11px; line-height: 1; }
.status.good { color: var(--good-ink); background: color-mix(in srgb, var(--good-wash) calc(var(--wash-op) * 100%), transparent); }
.status.good::before { content: "✓"; }
.status.watch { color: var(--watch-ink); background: color-mix(in srgb, var(--watch-wash) calc(var(--wash-op) * 140%), transparent); }
.status.watch::before { content: "!"; font-weight: 800; }
.status.off { color: var(--off-ink); background: color-mix(in srgb, var(--off-wash) calc(var(--wash-op) * 100%), transparent); }
.status.off::before { content: "✕"; }
.status.none { color: var(--text-muted); background: var(--surface-warm); }
.status.none::before { content: "–"; }
.chg { font-size: 13px; font-weight: 600; white-space: nowrap; }
.chg.better { color: var(--good-ink); }
.chg.worse { color: var(--off-ink); }
.chg.flat, .chg.neutral { color: var(--text-muted); }
.chg .res, .chg .amt { display: block; }
.chg .res { font-weight: 700; }
.chg .amt { text-wrap: balance; font-weight: 400; font-size: 12px; color: var(--text-muted); }
.tile .chg.flat, .tile .chg.neutral { font-weight: 400; font-size: 12px; }
.tile .chg { display: block; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); white-space: normal; }

/* ---------- Info popover ---------- */
.info-btn {
  border: 0; background: none; padding: 0; width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  color: var(--text-muted); font-size: 14px; display: inline-flex; align-items: center; justify-content: center; flex: none;
  position: relative;
}
.info-btn::after { content: ""; position: absolute; inset: -10px; }
.info-btn:hover { color: var(--brand-blue); }
.popover {
  position: absolute; z-index: 50; width: min(340px, calc(100vw - 32px)); padding: 14px 16px; font-size: 13px;
  background: var(--surface); color: var(--text-secondary); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.popover h4 { margin: 0 0 6px; font-size: 14px; color: var(--text-primary); }
.popover dl { margin: 8px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; }
.popover dt { color: var(--text-muted); }
.popover dd { margin: 0; }
.popover a { display: inline-block; margin-top: 10px; }

/* ---------- Tooltip ---------- */
.tooltip {
  position: fixed; z-index: 60; padding: 8px 10px; font-size: 12.5px; line-height: 1.45;
  background: var(--surface); color: var(--text-secondary); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.16); max-width: 280px;
}
.tooltip b { color: var(--text-primary); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 48px; font-size: 13px; color: var(--text-muted); }
.site-footer .wrap { padding-top: 20px; padding-bottom: 32px; display: grid; gap: 6px; }

/* ---------- Narrower screens: the nav collapses into a menu button ---------- */
@media (max-width: 1279px) { .fresh-badge span.long { display: none; } }
@media (max-width: 1099px) {
  .site-header .wrap { flex-wrap: wrap; gap: 8px 12px; padding-top: 8px; padding-bottom: 8px; }
  .menu-btn { display: inline-flex; order: 2; }
  .header-tools { order: 1; margin-left: auto; }
  .site-nav { display: none; order: 3; flex-basis: 100%; flex-direction: column; }
  .site-nav.open { display: flex; }
  .site-nav .menu { position: static; box-shadow: none; border: 0; padding: 0 0 0 12px; }
}
/* ---------- Phone ---------- */
@media (max-width: 767px) {
  .wrap { padding: 0 16px; }
  h1 { font-size: 24px; }
  .wordmark b { font-size: 15px; }
  .fresh-badge { font-size: 12px; padding: 6px 8px; }
  .site-header .wrap { min-height: 0; }
}
@media (max-width: 479px) {
  .menu-btn { order: 1; margin-left: auto; }
  .header-tools { order: 2; flex-basis: 100%; justify-content: space-between; margin-left: 0; }
  .site-nav { order: 3; }
}
/* Phone filter bar: one compact row of controls, labels kept for screen readers */
@media (max-width: 767px) {
  .filter-bar .wrap { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .filter .flabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .filter { flex: 1 1 140px; }
  .filter select { width: 100%; }
  .filter-bar .spacer { display: none; }
  .filter-bar .btn, .filter-bar .link-btn, .filter-bar select { min-height: 44px; }
}

/* Key to numbered event markers on charts; a line legend with a single entry is left out */
.evkey { margin: 8px 0 0; font-size: 12.5px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.evkey b { font-weight: 600; } .evkey i { font-style: normal; font-weight: 700; color: var(--text-secondary); }

/* Says when a trend's scale doesn't start at zero, with the button that switches */
.axnote { margin: 10px 0 0; padding: 4px 10px; font-size: 13px; color: var(--text-secondary); border-left: 3px solid var(--text-muted); display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.axnote[hidden] { display: none; } .axnote .link-btn { padding: 4px 0; white-space: nowrap; font-size: 13px; }
@media (max-width: 767px) { .axnote .link-btn { min-height: 44px; } }

/* Sort by lists above tables */
.sortby { max-width: 100%; } .sortby span { white-space: nowrap; } .sortby select { min-width: 0; max-width: 100%; }
@media (max-width: 767px) { .tools .sortby { flex: 1 1 100%; } .sortby select { flex: 1; min-height: 44px; } }
