:root {
      --bg: #0f172a;
      --bg-alt: #020617;
      --card: #0b1120;
      --accent: #38bdf8;
      --accent-soft: rgba(56, 189, 248, 0.15);
      --text: #e5e7eb;
      --muted: #9ca3af;
      --border: #1f2937;
    }
    * {
      box-sizing: border-box;
    }
	
	a:visited {
    color: coral;
}

a {
  position: relative;
  color: antiquewhite;
  text-decoration: none;
  font-size: larger;
  transition:
    color 0.25s ease,
    text-shadow 0.25s ease;
}

a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.9),
    transparent
  );
  opacity: 0;
  transform: scaleX(0.6);
  transition:
    opacity 0.2s ease,
    transform 0.4s ease;
}

a:hover {
  color: #ffffff;
  text-shadow:
    0 0 6px rgba(255,255,255,0.6),
    0 0 14px rgba(0,180,255,0.6);
}

a:hover::after {
  opacity: 1;
  transform: scaleX(1);
}
	
    body {
      margin: 0;
      padding: 0;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      background: radial-gradient(circle at top, #1e293b 0, #020617 55%);
      color: var(--text);
    }
    .page {
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }
    header {
      padding: 24px 32px 8px;
      border-bottom: 1px solid rgba(148, 163, 184, 0.15);
      background: linear-gradient(to right, rgba(15,23,42,0.95), rgba(15,23,42,0.9));
      backdrop-filter: blur(16px);
      position: sticky;
      top: 0;
      z-index: 10;
    }
    .title-row {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      gap: 12px;
    }
    .title-row h1 {
      margin: 0;
      font-size: 24px;
      letter-spacing: 0.03em;
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      border-radius: 999px;
      padding: 4px 10px;
      font-size: 11px;
      background: rgba(15, 118, 110, 0.15);
      color: #a5f3fc;
      border: 1px solid rgba(34, 211, 238, 0.35);
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }
    .pill-dot {
      width: 7px;
      height: 7px;
      border-radius: 999px;
      background: #22c55e;
      box-shadow: 0 0 0 4px rgba(34,197,94,0.25);
    }
    .subtitle {
      margin-top: 6px;
      font-size: 13px;
      color: var(--muted);
      max-width: 720px;
    }
    .toolbar {
      margin-top: 16px;
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      font-size: 12px;
    }
    .toolbar select,
    .toolbar button {
      border-radius: 999px;
      border: 1px solid rgba(148, 163, 184, 0.35);
      background: rgba(15, 23, 42, 0.9);
      color: #e2e8f0;
      padding: 6px 12px;
      font-size: 12px;
      font-weight: 600;
      letter-spacing: 0.02em;
      outline: none;
      transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, color 0.2s ease;
    }
    .toolbar select {
      color: #e2e8f0;
      background-color: rgba(15, 23, 42, 0.95);
    }
    .toolbar select#periodSelect {
      border-color: rgba(125, 211, 252, 0.45);
      background-color: rgba(30, 41, 59, 0.95);
      box-shadow: 0 0 8px rgba(56, 189, 248, 0.2);
    }
    .toolbar select#periodSelect:hover,
    .toolbar select#periodSelect:focus-visible {
      border-color: rgba(125, 211, 252, 0.75);
      box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
    }
    .toolbar select option {
      background: #0f172a;
      color: #e2e8f0;
      transition: background-color 0.2s ease, color 0.2s ease;
    }
    .toolbar select option:checked,
    .toolbar select option:active,
    .toolbar select option:hover {
      background: #1e293b;
      color: #7dd3fc;
    }
    .toolbar select:hover,
    .toolbar button:hover,
    .toolbar select:focus-visible,
    .toolbar button:focus-visible {
      border-color: rgba(56, 189, 248, 0.65);
      background: linear-gradient(135deg, rgba(30, 64, 175, 0.35), rgba(15, 23, 42, 0.92));
      box-shadow: 0 0 10px rgba(56, 189, 248, 0.25), 0 0 18px rgba(15, 118, 110, 0.18);
      transform: translateY(-1px);
    }
    .toolbar select:focus-visible,
    .toolbar button:focus-visible {
      outline: 2px solid rgba(56, 189, 248, 0.55);
      outline-offset: 2px;
    }
    .toolbar button.primary {
      border-color: rgba(56, 189, 248, 0.7);
      background: radial-gradient(circle at top, rgba(56,189,248,0.3), rgba(15,23,42,0.95));
      box-shadow: 0 0 24px rgba(56, 189, 248, 0.3);
      display: none;
    }
    .toolbar .heatmap {
      border-color: rgba(34, 211, 238, 0.6);
      background: linear-gradient(135deg, rgba(15, 118, 110, 0.25), rgba(15, 23, 42, 0.92));
      cursor: pointer;
    }
    .toolbar .heatmap:hover,
    .toolbar .heatmap:focus-visible {
      border-color: rgba(34, 211, 238, 0.9);
      background: linear-gradient(135deg, rgba(45, 212, 191, 0.35), rgba(15, 23, 42, 0.92));
      box-shadow: 0 0 12px rgba(34, 211, 238, 0.35), 0 0 20px rgba(56, 189, 248, 0.2);
      transform: translateY(-1px);
    }
    main {
      flex: 1;
      padding: 20px 32px 32px;
    }
    .grid {
      display: grid;
      grid-template-columns: repeat(12, minmax(0, 1fr));
      gap: 18px;
    }
    .kpi-row {
      grid-column: span 12;
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 14px;
      margin-bottom: 8px;
    }
    .kpi-card {
      background: radial-gradient(circle at top left, rgba(56,189,248,0.15), var(--card));
      border-radius: 16px;
      border: 1px solid rgba(148,163,184,0.28);
      padding: 14px 16px;
      position: relative;
      overflow: hidden;
    }
    .kpi-label {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--muted);
      margin-bottom: 4px;
    }
    .kpi-value-row {
      display: flex;
      align-items: baseline;
      gap: 8px;
    }
    .kpi-value {
      font-size: 22px;
      font-weight: 600;
    }
    .kpi-trend {
      font-size: 11px;
    }
    .kpi-trend.up {
      color: #4ade80;
    }
    .kpi-trend.down {
      color: #f97373;
    }
    .kpi-caption {
      margin-top: 6px;
      font-size: 11px;
      color: var(--muted);
    }
    .card {
      background: radial-gradient(circle at top left, rgba(56,189,248,0.08), var(--card));
      border-radius: 18px;
      border: 1px solid rgba(148, 163, 184, 0.22);
      padding: 14px 16px 12px;
      box-shadow: 0 12px 35px rgba(15, 23, 42, 0.9);
    }
    .card h2 {
      margin: 0 0 2px;
      font-size: 14px;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .card h2 span.badge {
      font-size: 10px;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      padding: 2px 7px;
      border-radius: 999px;
      border: 1px solid rgba(148, 163, 184, 0.4);
      color: var(--muted);
    }
    .card-subtitle {
      font-size: 11px;
      color: var(--muted);
      margin-bottom: 10px;
    }
    .card--half {
      grid-column: span 6;
    }
    .card--balanced {
      padding: 16px 18px 14px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .card--balanced h2 {
      font-size: 15px;
      margin: 0;
      color: var(--text);
    }
    .card--balanced .badge {
      margin-left: 6px;
    }
    .card--balanced .card-subtitle {
      font-size: 12px;
      margin: 0;
      color: var(--muted);
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .card--balanced .card-subtitle__text {
      line-height: 1.5;
    }
    .card--balanced .chart-toggle {
      margin-bottom: 0;
      align-items: center;
    }
    .card--balanced .card-subtitle--with-toggle {
      align-items: center;
      min-height: 48px;
    }
    .chart-toggle--placeholder {
      width: 168px;
      visibility: hidden;
      pointer-events: none;
    }
    .card--balanced .chart-toggle__btn {
      padding: 6px 12px;
      font-size: 12px;
      color: var(--text);
    }
    .card--balanced .chart-wrapper--tall {
      height: 340px;
      margin-top: 4px;
      width: 100%;
    }
    .card--balanced .legend-inline {
      align-items: center;
      gap: 12px;
      font-size: 12px;
      color: var(--muted);
    }
    .legend-label {
      font-size: 12px;
      color: var(--muted);
      line-height: 1.2;
    }
    .card--balanced .hint-row {
      margin-top: 8px;
      align-items: center;
    }
    .card--balanced .hint-pill {
      font-size: 11px;
    }
    .chart-wrapper {
      position: relative;
      width: 100%;
      height: 260px;
    }
    .chart-wrapper.small {
      height: 210px;
    }
    .chart-wrapper canvas {
      display: block;
      max-width: 100%;
      max-height: 100%;
    }
    .card-subtitle--with-toggle {
      display: flex;
      align-items: flex-start;
      justify-content: flex-end;
      gap: 12px;
      flex-wrap: wrap;
    }
    .card-subtitle__text {
      flex: 1 1 auto;
    }
    .site-events__text {
      flex: 1 1 70%;
      min-width: 260px;
    }
    .chart-toggle {
      display: flex;
      gap: 0.5rem;
      margin-bottom: 0.5rem;
    }
    .chart-toggle__btn {
      padding: 4px 10px;
      border-radius: 999px;
      border: 1px solid rgba(148, 163, 184, 0.7);
      background: transparent;
      color: #e5e7eb;
      font-size: 12px;
      cursor: pointer;
    }
    .chart-toggle__btn--active {
      background: rgba(56, 189, 248, 0.18);
      border-color: rgba(56, 189, 248, 1);
    }
    .filter-chips {
		display: flex !important;
		flex-direction: row;
		flex-wrap: wrap !important;
		gap: 8px !important;
		align-items: flex-end !important;
		
	}
    .card-subtitle--with-toggle .filter-chips {
      <!-- margin-left: auto; -->
      justify-content: center;
    }
    .filter-chip {
      padding: 6px 10px;
      border-radius: 999px;
      border: 1px solid rgba(148, 163, 184, 0.6);
      background: rgba(15, 23, 42, 0.9);
      color: #e5e7eb;
      font-size: 11px;
      cursor: pointer;
      transition: all 0.18s ease;
    }
    .filter-chip:hover {
      border-color: rgba(56, 189, 248, 0.75);
      box-shadow: 0 10px 24px rgba(56, 189, 248, 0.1);
    }
    .filter-chip.filter-chip--active {
      background: rgba(56, 189, 248, 0.2);
      border-color: rgba(56, 189, 248, 1);
      box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.18), 0 14px 38px rgba(56, 189, 248, 0.12);
    }
    @keyframes siteEventsRowGlow {
      0% {
        box-shadow: 0 0 0 rgba(56, 189, 248, 0);
        background: rgba(56, 189, 248, 0.04);
      }
      50% {
        box-shadow: 0 0 10px rgba(56, 189, 248, 0.18), inset 0 0 0 1px rgba(56, 189, 248, 0.22);
        background: rgba(56, 189, 248, 0.1);
      }
      100% {
        box-shadow: 0 0 4px rgba(56, 189, 248, 0.08), inset 0 0 0 1px rgba(56, 189, 248, 0.12);
        background: rgba(56, 189, 248, 0.06);
      }
    }
    #siteEventsButtons .filter-dropdown__item {
      transition: background 0.2s ease, box-shadow 0.25s ease;
      border-radius: 10px;
    }
    #siteEventsButtons .filter-dropdown__item:hover {
      background: rgba(56, 189, 248, 0.08);
      box-shadow: 0 0 10px rgba(56, 189, 248, 0.16), inset 0 0 0 1px rgba(56, 189, 248, 0.18);
      animation: siteEventsRowGlow 1.4s ease-in-out 2;
    }
    #siteEventsButtons .filter-dropdown__item:hover .filter-dropdown__count {
      color: #7dd3fc;
      text-shadow: 0 0 10px rgba(56, 189, 248, 0.45);
    }
    #siteEventsButtons {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      justify-content: flex-end;
      align-items: flex-start;
      flex: 0 0 auto;
      min-width: 220px;
      margin-left: auto;
    }
    #siteEventsEventButtons {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      justify-content: flex-start;
      align-items: flex-start;
      flex: 1 1 auto;
      min-width: 200px;
    }
    .chart-wrapper--total {
      height: 360px;
    }
    .chart-wrapper--tall {
      height: 325px;
    }
    .hint-row {
      margin-top: 8px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 11px;
      color: var(--muted);
      gap: 8px;
    }
    .hint-pill {
      padding: 3px 8px;
      border-radius: 999px;
      border: 1px dashed rgba(148, 163, 184, 0.5);
    }
    .legend-inline {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
      font-size: 11px;
    }
    .legend-dot {
      width: 8px;
      height: 8px;
      border-radius: 999px;
      background: var(--accent);
    }
    .legend-dot.alt {
      background: #f97373;
    }
    .legend-dot.warn {
      background: #38bdf8;
    }
    .legend-dot.danger {
      background: #f97373;
    }
    footer {
      padding: 14px 32px 20px;
      font-size: 11px;
      color: var(--muted);
      border-top: 1px solid rgba(30, 64, 175, 0.55);
      background: linear-gradient(to right, #020617, #020617 40%, #0b1120);
    }
    @media (max-width: 1100px) {
      main { padding: 18px 18px 24px; }
      header { padding: 18px 18px 10px; }
      .kpi-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .chart-wrapper { height: 220px; }
    }
    @media (max-width: 720px) {
      .grid {
        display: flex;
        flex-direction: column;
      }
      .kpi-row {
        grid-template-columns: 1fr;
      }
      .chart-wrapper { height: 200px; }
    }
