/* ---------------------------------------------------------------------------
   Data Insights — demo stylesheet.
   Tokens below were measured from a live installation (getComputedStyle +
   screenshot colour census), so they are values to preserve, not to taste.
   --------------------------------------------------------------------------- */
:root {
  --font: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif;

  --nav-h: 53px;
  --sidebar-w: 200px;
  --sidebar-w-collapsed: 80px;
  --item-h: 60px;
  --tabbar-h: 46px;

  --bg: #f7f7f7;
  --surface: #fff;
  --filterbar: #ecece8;
  --text: #333;
  --text-strong: #263238;
  --text-muted: #879399;
  --line: #e0e0e0;

  --accent: #fa5d42;          /* active nav item, tab ink bar, pagination */
  --sidebar-bg: #001529;
  --sidebar-text: rgba(255, 255, 255, 0.65);

  /* categorical series palette, sampled from rendered charts */
  --c1: #ffbe0b;  --c2: #fa5d42;  --c3: #98db39;  --c4: #efff42;
  --c5: #ff006e;  --c6: #c11cad;  --c7: #3a86ff;  --c8: #5f5ff6;
  --c9: #fd2b3b;  --c10: #007a87; --c11: #fd8a09; --c12: #243f74;
  --c13: #e04355; --c14: #3b0a45;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

/* ------------------------------------------------------------------ top bar */
.navbar {
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 15px; color: #1b1b1b; }
.brand svg { display: block; }
.navbar nav { display: flex; gap: 26px; }
.navbar nav a { color: #323232; text-decoration: none; font-size: 14px; }
.navbar nav a:hover { color: var(--accent); }
.navbar .spacer { flex: 1; }
.navbar .right { display: flex; align-items: center; gap: 20px; color: #323232; }
.caret { font-size: 9px; opacity: 0.6; margin-left: 3px; }

/* ------------------------------------------------------------ dashboard head */
.dash-head {
  background: var(--surface);
  padding: 20px 24px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.dash-title { font-size: 28px; font-weight: 200; color: var(--text-strong); margin: 0; letter-spacing: 0.2px; }
.pill {
  background: #f4f4f4; border: 1px solid #e6e6e6; border-radius: 12px;
  padding: 3px 11px; font-size: 12px; color: #5a6368;
}
.dash-head .spacer { flex: 1; }
.icon-btn {
  background: none; border: 0; cursor: pointer; color: #6a7378;
  padding: 4px; border-radius: 4px; line-height: 1;
}
.icon-btn:hover { background: #f2f2f2; color: var(--text); }

/* ---------------------------------------------------------------- app layout */
.app { display: flex; align-items: flex-start; min-height: calc(100vh - var(--nav-h)); }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  align-self: stretch;
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  display: flex;
  flex-direction: column;
  transition: width 0.18s ease, flex-basis 0.18s ease;
  overflow: hidden;
}
.app.collapsed .sidebar { width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed); }
.sidebar .menu { flex: 1; overflow-y: auto; overflow-x: hidden; }
.sidebar .menu::-webkit-scrollbar { width: 6px; }
.sidebar .menu::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 3px; }

.mi {
  height: var(--item-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 18px;
  color: var(--sidebar-text);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  font-size: 14px;
}
.mi:hover { color: #fff; }
.mi .mi-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* chevron points down when collapsed, up when the section is open */
.mi .chev { transition: transform 0.18s ease; opacity: 0.7; flex: 0 0 auto; transform: rotate(180deg); font-size: 12px; }
.mi.open .chev { transform: rotate(0deg); }
.mi.open { color: #fff; }
.app.collapsed .mi .mi-label, .app.collapsed .mi .chev { display: none; }
.app.collapsed .mi { justify-content: center; padding: 0; }

.mi-sub {
  height: var(--item-h);
  display: flex;
  align-items: center;
  padding: 0 16px 0 48px;
  color: var(--sidebar-text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}
.mi-sub:hover { color: #fff; }
.mi-sub.active { background: var(--accent); color: #fff; }
.app.collapsed .submenu { display: none; }

.submenu { overflow: hidden; }
.sidebar-trigger {
  height: 48px;
  flex: 0 0 48px;
  background: #002140;
  color: rgba(255, 255, 255, 0.75);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 0;
}
.sidebar-trigger:hover { color: #fff; }

/* ---------------------------------------------------------------- main column */
.main { flex: 1; min-width: 0; background: var(--surface); }

/* filter bands sit edge-to-edge in a warm grey, as in the real dashboard */
.filter-band {
  background: var(--filterbar);
  padding: 16px 18px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}
.filter-band + .filter-band { padding-top: 12px; }

.fb { min-width: 345px; max-width: 420px; }
.fb-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.fb-title { font-size: 16px; font-weight: 700; color: var(--text); }

.badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: #b8b8b8; color: #fff; border-radius: 11px;
  padding: 2px 7px; font-size: 11px; line-height: 1.4;
}
.badge.on { background: #4a4a4a; }
.kebab { color: #8a8a8a; cursor: pointer; letter-spacing: 1px; line-height: 1; padding: 0 2px; }
.kebab:hover { color: var(--text); }

/* select control -------------------------------------------------------- */
.select { position: relative; }
.select-input {
  background: #fff; border: 1px solid #d9d9d9; border-radius: 3px;
  min-height: 36px; padding: 4px 26px 4px 10px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  cursor: pointer; font-size: 14px;
}
.select-input:hover { border-color: #b3b3b3; }
.select.open .select-input { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(250, 93, 66, 0.12); }
.select-ph { color: #aaa; }
.select-arrow { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: #b3b3b3; font-size: 10px; pointer-events: none; }
.chip {
  background: #f0f0f0; border: 1px solid #e0e0e0; border-radius: 2px;
  padding: 1px 5px; font-size: 12px; display: inline-flex; align-items: center; gap: 5px;
}
.chip .x { cursor: pointer; color: #999; font-size: 13px; line-height: 1; }
.chip .x:hover { color: var(--accent); }

.select-menu {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 3px);
  background: #fff; border: 1px solid #e0e0e0; border-radius: 3px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.13);
  max-height: 260px; overflow-y: auto;
}
.select-opt { padding: 8px 11px; cursor: pointer; font-size: 14px; }
.select-opt:hover { background: #fff4f1; }
.select-opt.sel { background: #fdece8; font-weight: 600; }
.select-empty { padding: 10px 11px; color: #999; }

.timerange {
  display: inline-block; background: #f0f0ec; border: 1px solid #dedeD8;
  border-radius: 3px; padding: 6px 13px; font-size: 14px; color: var(--text); cursor: pointer;
}
.timerange:hover { border-color: #b3b3b3; }

/* "Configure Time Range" popover ---------------------------------------- */
.trange { position: relative; display: inline-block; }
.trange-pop {
  display: none;
  position: absolute; z-index: 80; left: 0; top: calc(100% + 6px);
  min-width: 270px;
  background: #fff; border: 1px solid #e0e0e0; border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
}
.trange.open .trange-pop { display: block; }
.trange.open .timerange { border-color: var(--accent); }
.trange-hd {
  font-size: 17px; font-weight: 400; color: var(--text-strong);
  padding: 14px 16px 10px;
  border-bottom: 1px solid #f0f0f0;
}
.trange-list { padding: 8px 4px; }
.trange-opt {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 16px; cursor: pointer; font-size: 15px; color: var(--text);
}
.trange-opt:hover { background: #fdf3f0; }
.trange-opt .radio {
  width: 17px; height: 17px; flex: 0 0 auto;
  border: 1.5px solid #d0d0d0; border-radius: 50%;
  display: inline-block; position: relative; background: #fff;
}
.trange-opt .radio.on { border-color: var(--accent); }
.trange-opt .radio.on::after {
  content: ''; position: absolute; inset: 3px;
  border-radius: 50%; background: var(--accent);
}
.trange-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 12px; border-top: 1px solid #f0f0f0;
}
.trange-foot button {
  border-radius: 3px; padding: 6px 14px; font-size: 12px; font-weight: 600;
  letter-spacing: 0.3px; cursor: pointer;
}
.btn-ghost { background: #fff; border: 1px solid #d9d9d9; color: #555; }
.btn-ghost:hover { border-color: #b3b3b3; }
.btn-primary { background: var(--accent); border: 1px solid var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }

/* ------------------------------------------------------------------- content */
.page { padding: 0 0 60px; }
.section-header {
  font-size: 28px; font-weight: 200; color: var(--text-strong);
  margin: 26px 0 6px; padding: 0 18px;
}
.divider { height: 1px; background: var(--line); margin: 22px 18px 0; }

/* documentation blocks the dashboard embeds as markdown */
.md { padding: 18px 18px 4px; max-width: 1000px; color: #444; line-height: 1.55; }
.md h2, .md h3 { font-weight: 200; color: var(--text-strong); margin: 4px 0 8px; }
.md h3 { font-size: 28px; }
.md h2 { font-size: 32px; }
.md h4 { font-size: 16px; font-weight: 600; margin: 10px 0 4px; }
.md p { margin: 4px 0; }
.md ul { margin: 8px 0 4px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md details { margin-top: 6px; }
.md summary { cursor: pointer; color: var(--accent); outline: none; }
.md summary::after { content: ' expand'; color: var(--accent); }

.row { display: flex; gap: 0; align-items: stretch; padding: 0 4px; }
.row > * { min-width: 0; }
.col { display: flex; flex-direction: column; min-width: 0; }

/* tabs ------------------------------------------------------------------ */
.tabs { margin-top: 8px; }
.tabbar {
  height: var(--tabbar-h);
  display: flex; align-items: stretch; gap: 22px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: thin;
}
.tab {
  display: flex; align-items: center;
  background: none; border: 0; cursor: pointer;
  font-size: 14px; color: rgba(0, 0, 0, 0.85);
  padding: 12px 4px; white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--accent); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* chart card ------------------------------------------------------------ */
.chart {
  flex: 1 1 0;
  padding: 16px 14px 10px;
  display: flex; flex-direction: column;
  min-width: 0;
}
.chart-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.chart-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  flex: 1; line-height: 1.32;
}
.chart-body { flex: 1; min-height: 0; position: relative; }

/* big numbers ---------------------------------------------------------- */
.bignum { font-weight: 400; color: #333; line-height: 1; letter-spacing: -1px; white-space: nowrap; }
.bignum-sub { color: var(--text-muted); font-size: 14px; margin-top: 10px; }
.bignum-cmp { color: #6f7a80; font-size: 14px; margin-top: 8px; }
.nodata { color: var(--text-muted); text-align: center; padding: 28px 8px; }
.nodata b { color: #5a6368; }
.stale { color: #c99a00; font-size: 12px; }
.bignum.stale-val { color: #b3b3b3; }

/* svg chart basics ----------------------------------------------------- */
.viz { width: 100%; display: block; overflow: visible; }
.viz text { font-family: var(--font); fill: #666; font-size: 11px; }
.viz .axis line, .viz .axis path { stroke: #ccc; }
.viz .gridline { stroke: #eee; }
.viz .val-label { fill: #666; font-size: 11px; text-anchor: middle; }
.viz .axis-title { fill: #888; font-size: 11px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; justify-content: flex-end; padding: 2px 6px 8px; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #555; }
.legend .dot { width: 9px; height: 9px; border-radius: 50%; }

/* hover tooltip --------------------------------------------------------- */
.viz-tip {
  position: fixed;
  display: none;
  z-index: 200;
  pointer-events: none;
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 3px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.17);
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text);
  max-width: 340px;
}
.viz-tip .hd {
  font-weight: 700;
  padding-bottom: 5px;
  margin-bottom: 5px;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}
.viz-tip .tr { display: flex; align-items: center; gap: 7px; padding: 2px 0; }
.viz-tip .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.viz-tip .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #555; }
.viz-tip .vl { font-weight: 700; white-space: nowrap; }

/* marks respond to the pointer; everything else stays transparent to it */
.viz [data-tip-series] { cursor: crosshair; }
.viz [data-tip-series]:hover { fill-opacity: 1; }

/* table ---------------------------------------------------------------- */
.tbl-controls {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 4px 0 10px; font-size: 14px; color: #555;
}
.tbl-controls .grow { flex: 1; }
.tbl-controls select, .tbl-controls input {
  font-family: inherit; font-size: 13px; padding: 4px 6px;
  border: 1px solid #d9d9d9; border-radius: 3px; background: #fff; color: var(--text);
}
.tbl-controls input { min-width: 150px; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 400; color: #555;
  border-bottom: 1px solid #d9d9d9; padding: 7px 8px;
  cursor: pointer;
  /* some real metric labels are very long (weighted_average_time_to_action_ms);
     wrapping the header keeps the value column from being pushed out of view */
  white-space: normal; word-break: break-word; min-width: 64px;
}
table.tbl th .sort { color: #bbb; margin-left: 5px; font-size: 10px; }
table.tbl th.num, table.tbl td.num { text-align: right; }
table.tbl td { padding: 7px 8px; border-bottom: 1px solid #f0f0f0; color: #333; white-space: nowrap; }
table.tbl tr:nth-child(even) td { background: #fafafa; }
table.tbl td.na { color: #b3b3b3; }
td.bar-cell { position: relative; }
td.bar-cell .cell-bar { position: absolute; right: 0; top: 0; bottom: 0; background: #d4d4d4; opacity: 0.55; }
td.bar-cell .cell-val { position: relative; }
.pager { display: flex; gap: 4px; justify-content: flex-end; margin-top: 10px; }
.pager button {
  min-width: 26px; height: 26px; border: 1px solid #e6e6e6; background: #fff;
  color: var(--accent); border-radius: 3px; cursor: pointer; font-size: 12px;
}
.pager button.cur { color: #555; border-color: #d9d9d9; }
.pager button:disabled { color: #ccc; cursor: default; }
.pager .gap { align-self: center; color: #999; padding: 0 2px; }

/* word cloud ----------------------------------------------------------- */
.cloud { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; justify-content: center; padding: 14px 8px; }
.cloud span { line-height: 1.05; font-weight: 600; }

/* gauge ---------------------------------------------------------------- */
.gauge-wrap { display: flex; justify-content: center; }

/* footer note ---------------------------------------------------------- */
.demo-note {
  position: fixed; right: 14px; bottom: 12px; z-index: 70;
  background: rgba(0, 21, 41, 0.9); color: #fff;
  font-size: 11px; padding: 7px 11px; border-radius: 4px;
  max-width: 330px; line-height: 1.45;
}
.demo-note b { color: var(--c1); }
.demo-note .close { float: right; margin-left: 10px; cursor: pointer; opacity: 0.7; }
.demo-note .close:hover { opacity: 1; }

@media (max-width: 900px) {
  .row { flex-wrap: wrap; }
  .chart { flex-basis: 100%; }
}
