  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #f0f2f5;
    color: #1a1a1a;
    padding: 0.5rem 0.84rem 0.08rem;
    min-height: 100vh;
  }

  header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.64rem;
    margin-bottom: 0.34rem;
  }
  h1     { font-size: 1.24rem; font-weight: 600; }
  .meta  { font-size: 0.73rem; color: #666; margin-top: 0.01rem; }
  .meta.is-stale { color: #9f3a00; font-weight: 600; }
  .site-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
    padding: 0.16rem;
    border: 1px solid #d8dde3;
    border-radius: 8px;
    background: rgba(255,255,255,0.86);
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
  }
  .site-nav a {
    display: inline-grid;
    place-items: center;
    width: 1.72rem;
    height: 1.72rem;
    border-radius: 6px;
    color: #3f4b59;
    text-decoration: none;
    font-size: 1rem;
    line-height: 1;
  }
  .site-nav a:hover { background: #eef2f5; }
  .site-nav a.active {
    background: #457b9d;
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
  }

  .filter {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    column-gap: 0.8rem;
    row-gap: 0.46rem;
    margin-bottom: 0.52rem;
    background: #fff;
    border-radius: 8px;
    padding: 0.38rem 0.7rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    font-size: 0.84rem;
  }
  .filter label { color: #555; }
  .time-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.42rem;
  }
  .range-buttons {
    display: inline-flex;
    gap: 0.32rem;
    align-items: center;
    margin-left: 1.05rem;
  }
  .control-spacer {
    width: 0.7rem;
    height: 1.4rem;
    border-left: 1px solid #dde2e7;
    margin-left: 0.12rem;
  }
  .date-field {
    position: relative;
    display: inline-flex;
    align-items: center;
  }
  .date-display {
    width: 8.1rem;
    border: 1px solid #d0d0d0;
    border-radius: 5px;
    padding: 0.24rem 2.35rem 0.24rem 0.45rem;
    font-size: 0.84rem;
    font-family: inherit;
  }
  .date-display:focus {
    outline: 2px solid #457b9d;
    border-color: transparent;
  }
  .picker-btn {
    position: absolute;
    right: 0.18rem;
    top: 50%;
    transform: translateY(-50%);
    min-width: 1.9rem;
    padding: 0.14rem 0.32rem;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background: #f5f5f5;
    font-size: 0.72rem;
    cursor: pointer;
  }
  .picker-btn:hover { background: #e8e8e8; }
  .native-date-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
  }
  .nav-btn {
    min-width: 2.05rem;
    padding: 0.24rem 0.52rem;
    border: 1px solid #d0d0d0;
    border-radius: 5px;
    background: #f5f5f5;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
  }
  .nav-btn:hover:not(:disabled) { background: #e8e8e8; }
  .nav-btn:disabled {
    opacity: 0.45;
    cursor: default;
  }
  .stats-toggle {
    margin-left: auto;
    padding-left: 1rem;
  }
  .axis-toggle {
    margin-left: 1.8rem;
    margin-right: 1.2rem;
  }
  .filter-actions {
    display: flex;
    column-gap: 0.92rem;
    align-items: center;
  }
  .toggle-option {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #555;
    font-size: 0.78rem;
    white-space: nowrap;
  }
  .toggle-option input {
    accent-color: #457b9d;
    cursor: pointer;
  }
  .radio-group {
    display: inline-flex;
    gap: 0.18rem;
    align-items: center;
    padding: 0.08rem 0.46rem;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: rgba(255,255,255,0.6);
  }
  .data-toggles-start {
    margin-left: 2.3rem;
  }
  .radio-group .toggle-option {
    padding: 0.06rem 0.2rem;
    border-radius: 4px;
  }
  .filter button {
    padding: 0.24rem 0.66rem;
    border: 1px solid #d0d0d0;
    border-radius: 5px;
    background: #f5f5f5;
    font-size: 0.81rem;
    cursor: pointer;
  }
  .filter button:hover { background: #e8e8e8; }

  .stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.46rem;
    margin-bottom: 0.58rem;
  }
  .stat-card {
    min-width: 0;
    padding: 0.54rem 0.66rem;
    border: 1px solid #e6e8eb;
    border-radius: 9px;
    background: linear-gradient(180deg, #fbfcfd, #f6f7f9);
  }
  .stat-label {
    display: block;
    margin-bottom: 0.22rem;
    color: #666;
    font-size: 0.69rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
  .stat-value {
    display: block;
    font-size: 0.98rem;
    font-weight: 700;
    color: #20242a;
    line-height: 1.15;
  }
  .stat-note {
    display: block;
    margin-top: 0.18rem;
    color: #667085;
    font-size: 0.72rem;
    line-height: 1.25;
  }
  .stat-note-grid {
    display: inline-grid;
    grid-template-columns: max-content max-content max-content;
    column-gap: 0.42rem;
    row-gap: 0.06rem;
    align-items: baseline;
    margin-top: 0.04rem;
  }
  .stat-note-grid-value {
    color: #536174;
    font-variant-numeric: tabular-nums;
  }

  @media (max-width: 1180px) {
    .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  }
  @media (max-width: 880px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
  @media (max-width: 680px) {
    header { align-items: center; }
    .stats-grid { grid-template-columns: 1fr; }
  }

  .card {
    background: #fff;
    border-radius: 10px;
    padding: 0.74rem 0.9rem 0.7rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
  }
  .card h2 { font-size: 0.9rem; font-weight: 600; color: #444; margin-bottom: 0.44rem; }

  #error,
  #loading,
  #empty {
    display: none;
    border-radius: 8px;
    padding: 0.78rem;
    margin-bottom: 1rem;
  }
  #error {
    background: #fff3f3;
    border: 1px solid #f5c0c0;
    color: #c00;
  }
  #loading {
    background: #eef6fb;
    border: 1px solid #b8d7e8;
    color: #2f5f78;
  }
  #empty {
    background: #fff9e9;
    border: 1px solid #f0d58a;
    color: #7a5800;
  }
