:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface2: #f5f6f8;
    --border: #e4e4e4;
    --white: #ffffff;
    --yes: #4CAF50;
    --yes-dim: rgba(76,175,80,0.15);
    --no: #f44336;
    --no-dim: rgba(244,67,54,0.15);
    --absent: #FF9800;
    --absent-dim: rgba(255,152,0,0.15);
    --na: #80888E;
    --na-dim: rgba(128,136,142,0.12);
    --orange: #F7971F;
    --orange-hover: #FF6B00;
    --blue: #253F91;
    --text: #1a1a1a;
    --text-dim: #1a1a1a;
    --text-dimmer: #1a1a1a;
    --border-hover: #444444;
    --tier-b: #A2D06B;
    --tier-d: #C62828;
    --tier-a-badge: #4CAF50;
    --tier-b-badge: #A8B400;
  }

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

  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Roboto', sans-serif;
    min-height: 100vh;
    padding: 0;
  }

  /* HEADER */
  .header {
    background: var(--blue);
    border-bottom: 4px solid var(--orange);
    padding: 40px 48px 32px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 24px;
  }

  .header-left h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(36px, 5vw, 64px);
    letter-spacing: 2px;
    line-height: 1;
    color: var(--white);
  }

  .header-left h1 span {
    color: var(--orange);
  }

  .header-left p {
    margin-top: 10px;
    color: var(--white);
    font-size: 14px;
    font-weight: 300;
    max-width: 480px;
    line-height: 1.6;
  }

  .header-right {
    display: flex;
    align-items: flex-start;
    flex-shrink: 0;
  }

  .header-right img {
    height: calc(clamp(36px, 5vw, 64px) * 4 / 3);
    width: auto;
  }

  .legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-family: 'Roboto Mono', monospace;
    color: var(--white);
  }

  .legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
  }

  /* FILTERS */
  .filters {
    padding: 20px 48px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    border-bottom: 1px solid var(--border);
  }

  /* MAIN GRID */
  .main {
    padding: 32px 48px 0;
  }

  .stats-section {
    background: var(--surface2);
    padding: 32px 48px;
    margin: 0 -0px;
  }

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

  .stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    transition: border-color 0.2s, transform 0.2s;
  }

  .stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
  }

  .stat-card .stat-number {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 48px;
    line-height: 1;
    letter-spacing: 1px;
  }

  .stat-card.active {
    outline: 2px solid var(--orange);
  }
  .stat-card .stat-label {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
    font-family: 'Roboto Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  /* COUNCILLOR CARDS */
  .grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
  }

  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
  }

  .card-header {
    padding: 16px 20px 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
  }

  .card-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    letter-spacing: 1px;
    line-height: 1;
  }

  .card-ward {
    font-size: 11px;
    font-family: 'Roboto Mono', monospace;
    color: var(--text-dimmer);
    margin-top: 3px;
    text-transform: uppercase;
  }


  .card-ward-link {
    color: inherit;
    text-decoration: none;
  }
  .card-ward-link:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
  }

  .support-badge {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    letter-spacing: 1px;
    line-height: 1;
    text-align: right;
  }

  .support-label {
    font-size: 10px;
    font-family: 'Roboto Mono', monospace;
    color: var(--text-dimmer);
    text-transform: uppercase;
    text-align: right;
    margin-top: 2px;
  }

  /* Support bar */
  .support-bar-wrap {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
  }

  .support-bar {
    height: 6px;
    background: var(--surface2);
    border-radius: 3px;
    overflow: hidden;
    display: flex;
    gap: 2px;
  }

  .bar-yes { background: var(--yes); border-radius: 3px 0 0 3px; transition: width 0.4s ease; }
  .bar-no { background: var(--no); transition: width 0.4s ease; }
  .bar-absent { background: var(--absent); transition: width 0.4s ease; }
  .bar-na { background: var(--na); border-radius: 0 3px 3px 0; transition: width 0.4s ease; }

  .bar-counts {
    display: flex;
    gap: 12px;
    margin-top: 8px;
  }

  .bar-count {
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .bar-count .dot {
    width: 7px;
    height: 7px;
    border-radius: 1px;
  }

  /* VOTES TABLE */
  .votes-section {
    padding: 0 20px 2px;
  }

  .votes-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    cursor: pointer;
    font-size: 11px;
    font-family: 'Roboto Mono', monospace;
    color: var(--text-dimmer);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    user-select: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: color 0.15s;
  }

  .votes-toggle:hover { color: var(--text-dim); }

  .toggle-arrow {
    transition: transform 0.2s;
    font-size: 10px;
  }

  .votes-toggle.open .toggle-arrow { transform: rotate(90deg); }

  .votes-list {
    display: none;
    flex-direction: column;
    gap: 2px;
  }

  .votes-list.open { display: flex; }

  .vote-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    border-radius: 4px;
    gap: 8px;
  }

  .vote-row:hover { background: var(--surface2); }

  .vote-name {
    font-size: 13px;
    font-family: 'Roboto', sans-serif;
    color: var(--text);
    flex: 1;
    line-height: 1.4;
  }

  .vote-chip {
    font-family: 'Roboto Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 3px;
    flex-shrink: 0;
    letter-spacing: 0.5px;
  }

  .chip-yes { background: var(--yes-dim); color: var(--yes); }
  .chip-no { background: var(--no-dim); color: var(--no); }
  .chip-absent { background: var(--absent-dim); color: var(--absent); }
  .chip-na { background: var(--na-dim); color: var(--na); }

  /* Grade stripe on left — colours match TIERS in JS */
  .card.grade-a { border-left: 12px solid var(--yes); }
  .card.grade-b { border-left: 12px solid var(--tier-b); }
  .card.grade-c { border-left: 12px solid var(--orange); }
  .card.grade-d { border-left: 12px solid var(--tier-d); }
  .card.grade-f { border-left: 12px solid var(--tier-d); }
  .card.grade-na { border-left: 12px solid var(--na); }

  .hidden { display: none !important; }

  @media (max-width: 600px) {
    .header {
      padding: 24px 20px 20px;
      gap: 16px;
      position: relative;
    }
    .header-right {
      position: absolute;
      top: 24px;
      right: 20px;
    }
    .header-right img {
      height: 32px;
    }
    .header-left {
      padding-right: 64px;
    }
    .filters, .main { padding-left: 16px; padding-right: 16px; }
    .main { padding-top: 20px; }
    .stats-section { padding: 20px 16px; }
    .stats-bar { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px 16px; }
    .stat-card .stat-number { font-size: 36px; }
    .grid { grid-template-columns: 1fr; }
    .card-header { padding: 12px 16px 10px; }
    .support-bar-wrap { padding: 10px 16px; }
    .votes-section { padding: 0 16px 2px; }
  }
