:root {
  --brand: #f58220;
  --brand-dark: #d96f18;
  --blue: #2171ec;
  --ink: #202632;
  --text: #475467;
  --muted: #667085;
  --line: #e6eaf0;
  --surface: #ffffff;
  --canvas: #f5f7fa;
  --soft-orange: #fff6ed;
  --soft-blue: #eff6ff;
  --shadow: 0 1px 2px rgb(16 24 40 / 4%), 0 8px 24px rgb(16 24 40 / 5%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

a {
  color: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: 256px;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.brand-block {
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--line);
}

.brand-block img {
  display: block;
  width: 132px;
  height: 60px;
  object-fit: contain;
  object-position: left center;
}

.brand-block p {
  margin: 6px 0 0;
  color: #98a2b3;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.sidebar nav {
  display: grid;
  gap: 5px;
  padding: 20px 16px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 9px;
  color: #475467;
  font-size: 14px;
  font-weight: 620;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--brand-dark);
  background: var(--soft-orange);
}

.nav-icon {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1;
}

.sidebar-note {
  display: flex;
  gap: 10px;
  margin: auto 16px 14px;
  padding: 13px;
  border: 1px solid #fedfbe;
  border-radius: 10px;
  background: #fffbf6;
}

.sidebar-note strong,
.sidebar-note span {
  display: block;
}

.sidebar-note strong {
  font-size: 12px;
}

.sidebar-note div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.status-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 999px;
  background: #12b76a;
  box-shadow: 0 0 0 3px #d1fadf;
}

.logout-form {
  padding: 0 16px 20px;
}

.logout-button {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 13px;
  font-weight: 620;
}

.logout-button:hover {
  border-color: #d0d5dd;
  color: var(--ink);
}

.main-shell {
  width: calc(100% - 256px);
  max-width: 1640px;
  margin-left: 256px;
  padding: 40px 44px 80px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 28px;
}

.eyebrow,
.section-kicker,
.rule-group {
  margin: 0 0 7px;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 43px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.header-copy {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

.freshness-badge {
  flex: 0 0 auto;
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid #fedfbe;
  border-radius: 999px;
  background: var(--soft-orange);
  color: #a74b09;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.filter-card,
.metric-card,
.chart-card,
.table-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.filter-card {
  margin-bottom: 20px;
  padding: 22px;
}

.filter-card-heading,
.card-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.export-link {
  padding: 8px 11px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.export-link:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.filters {
  display: grid;
  grid-template-columns: minmax(270px, 1.45fr) minmax(260px, 1.25fr) minmax(145px, 0.7fr) minmax(145px, 0.7fr) auto;
  gap: 12px;
  align-items: start;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > span,
.login-form label > span {
  color: #475467;
  font-size: 12px;
  font-weight: 700;
  line-height: 14px;
}

.field select,
.field input,
.login-form input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  outline: 0;
  background: white;
  color: var(--ink);
  font-size: 14px;
}

.field select:focus,
.field input:focus,
.login-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgb(245 130 32 / 13%);
}

.hostname-field {
  min-width: 0;
}

.hostname-picker {
  position: relative;
}

.hostname-trigger {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  outline: 0;
  background: white;
  color: var(--ink);
  font-size: 14px;
  text-align: left;
}

.hostname-trigger:hover,
.hostname-trigger[aria-expanded="true"] {
  border-color: var(--brand);
}

.hostname-trigger:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgb(245 130 32 / 13%);
}

#hostnameTriggerText {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hostname-chevron {
  flex: 0 0 auto;
  color: #667085;
  font-size: 16px;
  line-height: 1;
}

.hostname-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 7px);
  left: 0;
  width: min(430px, calc(100vw - 42px));
  overflow: hidden;
  border: 1px solid #d0d5dd;
  border-radius: 11px;
  background: white;
  box-shadow: 0 18px 45px rgb(16 24 40 / 16%);
}

.hostname-search-wrap {
  padding: 12px 12px 8px;
}

.hostname-search-wrap input {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 13px;
}

.hostname-panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px 9px;
  border-bottom: 1px solid #eef1f5;
}

.hostname-panel-toolbar button {
  padding: 5px 8px;
  border: 1px solid #e4e7ec;
  border-radius: 7px;
  background: #f9fafb;
  color: #475467;
  font-size: 11px;
  font-weight: 750;
}

.hostname-panel-toolbar button.active,
.hostname-panel-toolbar button:hover {
  border-color: #fedfbe;
  background: var(--soft-orange);
  color: var(--brand-dark);
}

#hostnameResultCount,
.hostname-panel-footer > span,
.hostname-help {
  color: #667085;
  font-size: 11px;
}

.hostname-help {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hostname-options {
  max-height: 310px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 5px 0;
}

.hostname-option-group + .hostname-option-group {
  border-top: 1px solid #f0f2f5;
}

.hostname-group-label {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: 8px 12px 5px;
  background: rgb(255 255 255 / 96%);
  color: #98a2b3;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hostname-option {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  color: #344054;
  cursor: pointer;
  font-size: 12px;
}

.hostname-option:hover {
  background: #f9fafb;
}

.hostname-option input {
  width: 15px;
  min-height: auto;
  height: 15px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  accent-color: var(--brand);
}

.hostname-option-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-badge {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 2px 5px;
  border-radius: 999px;
  background: var(--soft-orange);
  color: var(--brand-dark);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hostname-empty {
  margin: 0;
  padding: 22px 14px;
  color: #667085;
  font-size: 12px;
  text-align: center;
}

.hostname-panel-footer {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid #eef1f5;
  background: #fcfcfd;
}

.hostname-panel-footer > span {
  min-width: 0;
}

.hostname-panel-footer > div {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.hostname-cancel,
.hostname-apply {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 750;
}

.hostname-cancel {
  border: 1px solid #d0d5dd;
  background: white;
  color: #475467;
}

.hostname-apply {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: white;
}

.hostname-apply:disabled {
  border-color: #e4e7ec;
  background: #e4e7ec;
  color: #98a2b3;
  cursor: not-allowed;
}

.apply-button,
.login-form button {
  min-height: 42px;
  padding: 9px 19px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-size: 13px;
  font-weight: 750;
  box-shadow: 0 1px 2px rgb(16 24 40 / 8%);
}

.filters > .apply-button {
  align-self: start;
  margin-top: 20px;
}

.apply-button:hover,
.login-form button:hover {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
}

.quick-ranges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.quick-ranges button {
  padding: 6px 9px;
  border: 1px solid #e4e7ec;
  border-radius: 7px;
  background: #f9fafb;
  color: #667085;
  font-size: 11px;
  font-weight: 700;
}

.quick-ranges button:hover {
  border-color: #fedfbe;
  background: var(--soft-orange);
  color: var(--brand-dark);
}

.filter-description {
  margin: 13px 0 0;
  padding-top: 13px;
  border-top: 1px solid #f0f2f5;
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}

.loading-state,
.error-banner {
  margin: 20px 0;
  padding: 16px 18px;
  border-radius: 10px;
  font-size: 13px;
}

.loading-state {
  border: 1px solid #dbeafe;
  background: var(--soft-blue);
  color: #175cd3;
}

.error-banner {
  border: 1px solid #fecdca;
  background: #fef3f2;
  color: #b42318;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card {
  min-height: 152px;
  padding: 19px;
}

.metric-card.accent-card {
  border-top: 3px solid var(--brand);
  padding-top: 17px;
}

.metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.metric-mark {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.metric-mark.blue {
  background: var(--blue);
}

.metric-mark.orange {
  background: var(--brand);
}

.metric-card > strong {
  display: block;
  margin-top: 16px;
  font-size: clamp(27px, 3vw, 36px);
  line-height: 1;
  letter-spacing: -0.035em;
}

.metric-card > p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.chart-card,
.table-card {
  padding: 22px;
}

.chart-card {
  margin-bottom: 20px;
}

.card-heading {
  margin-bottom: 18px;
}

.card-heading.compact {
  margin-bottom: 12px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 11px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend b {
  font-weight: 650;
}

.legend-line {
  width: 18px;
  height: 3px;
  border-radius: 999px;
}

.legend-line.blue {
  background: var(--blue);
}

.legend-line.orange {
  background: var(--brand);
}

.chart-wrap {
  min-height: 320px;
  overflow: hidden;
}

.chart-wrap.short {
  min-height: 230px;
}

.chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.grid-line {
  stroke: #eaecf0;
  stroke-width: 1;
}

.axis-label {
  fill: #98a2b3;
  font-size: 11px;
}

.x-label {
  text-anchor: middle;
}

.y-label {
  text-anchor: end;
}

.series-line {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.raw-line {
  stroke: var(--blue);
  stroke-width: 2.2;
}

.selected-line {
  stroke: var(--brand);
  stroke-width: 2.4;
}

.selected-area,
.share-area {
  fill: rgb(245 130 32 / 9%);
}

.share-area {
  fill: rgb(245 130 32 / 13%);
}

.raw-point {
  fill: var(--blue);
  stroke: white;
  stroke-width: 2;
}

.selected-point {
  fill: var(--brand);
  stroke: white;
  stroke-width: 2;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(350px, 0.8fr);
  gap: 20px;
}

.two-column .chart-card {
  min-width: 0;
}

.component-bars {
  display: grid;
  gap: 11px;
  max-height: 280px;
  overflow: auto;
  padding-right: 3px;
}

.component-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  color: var(--text);
  font-size: 11px;
}

.component-heading strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.component-track {
  display: block;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  background: #f0f2f5;
}

.component-track::-webkit-progress-bar {
  border-radius: inherit;
  background: #f0f2f5;
}

.component-track::-webkit-progress-value {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f58220, #ffad66);
}

.component-track::-moz-progress-bar {
  border-radius: inherit;
  background: linear-gradient(90deg, #f58220, #ffad66);
}

.mini-note {
  margin: 13px 0 0;
  color: #98a2b3;
  font-size: 10px;
  line-height: 1.45;
}

.table-card {
  margin-bottom: 58px;
}

.range-label {
  color: var(--muted);
  font-size: 11px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

thead {
  background: #f9fafb;
}

th,
td {
  padding: 11px 14px;
  border-bottom: 1px solid #eef1f4;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

th:first-child,
td:first-child {
  text-align: left;
}

thead th {
  color: #667085;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tbody th {
  color: #344054;
  font-weight: 650;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fffcf9;
}

.definitions-section {
  scroll-margin-top: 30px;
  margin-top: 26px;
}

.section-heading {
  display: block;
  margin-bottom: 20px;
}

.section-heading > p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.rule-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
}

.rule-card.selected {
  border-color: #f7b982;
  box-shadow: inset 3px 0 0 var(--brand);
}

.rule-card > p:not(.rule-group) {
  min-height: 52px;
  margin: 8px 0 13px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.48;
}

.rule-definition {
  padding: 10px;
  border-radius: 7px;
  background: #f8fafc;
  color: #475467;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  line-height: 1.55;
}

[hidden] {
  display: none !important;
}

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgb(245 130 32 / 12%), transparent 30%),
    radial-gradient(circle at 85% 75%, rgb(33 113 236 / 11%), transparent 32%),
    #f7f8fb;
}

.login-shell {
  width: min(100%, 430px);
}

.login-panel {
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 18px 50px rgb(16 24 40 / 10%);
}

.login-panel > img {
  display: block;
  width: 146px;
  height: 66px;
  object-fit: contain;
  object-position: left center;
}

.login-product {
  margin: 5px 0 30px;
  color: #98a2b3;
  font-size: 12px;
  font-weight: 700;
}

.login-panel h1 {
  font-size: 29px;
}

.login-panel h1 + p {
  margin: 9px 0 22px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 15px;
}

.login-form label {
  display: grid;
  gap: 6px;
}

.login-form button {
  margin-top: 3px;
}

.login-error {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid #fecdca;
  border-radius: 8px;
  background: #fef3f2;
  color: #b42318;
  font-size: 12px;
}

.login-footnote {
  margin: 15px 0 0;
  color: #98a2b3;
  font-size: 11px;
  text-align: center;
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-column {
    grid-template-columns: 1fr;
  }

  .rule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: 1fr 1fr 0.7fr 0.7fr;
  }

  .apply-button {
    grid-column: 1 / -1;
    margin-top: 0;
  }
}

@media (max-width: 820px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
  }

  .brand-block img {
    width: 104px;
    height: 48px;
  }

  .brand-block p {
    margin: 0;
  }

  .sidebar nav {
    display: flex;
    overflow-x: auto;
    padding: 8px 14px 12px;
  }

  .nav-link {
    flex: 0 0 auto;
    padding: 8px 10px;
  }

  .sidebar-note,
  .logout-form {
    display: none;
  }

  .main-shell {
    width: 100%;
    margin-left: 0;
    padding: 28px 20px 60px;
  }

  .page-header {
    display: block;
  }

  .freshness-badge {
    display: inline-block;
    margin-top: 16px;
    white-space: normal;
  }

  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .filter-field,
  .hostname-field {
    grid-column: 1 / -1;
  }

  .rule-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .main-shell {
    padding-inline: 14px;
  }

  .filter-card,
  .chart-card,
  .table-card {
    padding: 17px;
  }

  .filter-card-heading,
  .card-heading {
    display: block;
  }

  .export-link {
    display: inline-block;
    margin-top: 12px;
  }

  .filters,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .filter-field,
  .hostname-field,
  .apply-button {
    grid-column: auto;
  }

  .hostname-panel {
    width: 100%;
  }

  .hostname-panel-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-card {
    min-height: 132px;
  }

  .legend {
    margin-top: 12px;
  }

  .chart-wrap {
    min-height: 220px;
    overflow-x: auto;
  }

  .chart {
    min-width: 620px;
  }

  .login-panel {
    padding: 28px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}

/* Date-range users and views, alongside the existing session cards. */
.export-actions { display:flex; gap:16px; flex-wrap:wrap; }
.chart-metric-label { display:flex; align-items:center; gap:8px; margin-top:12px; color:#667085; font-size:12px; }
.chart-metric-label select { padding:7px 10px; border:1px solid #d0d5dd; border-radius:6px; background:#fff; max-width:100%; }
.table-note { padding:0 24px; }
#usersNotice { margin: -4px 0 22px; }
