    /* =============================================================
       ALMANAC DESIGN SYSTEM — Patent Leaderboard
       Inspired by Sports-Reference.com. Cream paper, navy ink,
       burgundy accents. Every number is mono; every label is sans;
       every proper noun in a heading is serif.
       ============================================================= */

    :root {
      --bg:         #faf7ef;
      --surface:    #f4efde;
      --ink:        #1a1f3a;
      --ink-2:      #5a5f6e;
      --ink-3:      #8a8578;
      --rule:       #d8d1bf;
      --rule-2:     #ebe5d3;
      --accent:     #8b0000;
      --gold:       #b88a2e;
      --silver:     #888577;
      --bronze:     #9c6b3a;
      --font-serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
      --font-sans:  -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
      --font-mono:  'SF Mono', Menlo, Monaco, Consolas, 'Courier New', monospace;
    }

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

    body {
      font-family: var(--font-sans);
      background: var(--bg);
      color: var(--ink);
      font-size: 14px;
      line-height: 1.5;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    a { color: var(--accent); text-decoration: none; }
    a:hover { text-decoration: underline; }
    a:focus-visible,
    button:focus-visible,
    input:focus-visible,
    select:focus-visible,
    textarea:focus-visible,
    [tabindex]:focus-visible {
      outline: 3px solid var(--accent);
      outline-offset: 3px;
    }

    .skip-link {
      position: absolute;
      left: 16px;
      top: 8px;
      z-index: 1000;
      transform: translateY(-140%);
      background: var(--ink);
      color: white;
      padding: 8px 12px;
      border-radius: 4px;
      font-weight: 700;
    }
    .skip-link:focus,
    .skip-link:focus-visible {
      transform: translateY(0);
      text-decoration: none;
      color: white;
    }

    /* ── Masthead ─────────────────────────────────────────────────── */
    .masthead {
      background: var(--surface);
      border-bottom: 6px double var(--ink);
    }
    .mast-inner {
      max-width: 1100px;
      margin: 0 auto;
      padding: 10px 40px;
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 12px;
    }
    .wordmark {
      font-family: var(--font-serif);
      font-size: 26px;
      font-weight: 500;
      color: var(--ink);
      text-decoration: none;
      letter-spacing: -0.01em;
      flex-shrink: 0;
    }
    .wordmark:hover { text-decoration: none; color: var(--ink); }
    .mast-right {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 1px;
    }
    .mast-tagline {
      font-family: var(--font-sans);
      font-size: 11px;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.18em;
      color: var(--accent);
    }
    .mast-date {
      font-family: var(--font-mono);
      font-size: 11px;
      color: var(--ink-3);
      font-variant-numeric: tabular-nums;
    }

    /* ── Nav strip ────────────────────────────────────────────────── */
    .nav-strip {
      background: var(--bg);
      border-bottom: 1px solid var(--rule);
    }
    .nav-inner {
      max-width: 1100px;
      margin: 0 auto;
      padding: 0 40px;
      display: flex;
      align-items: stretch;
      justify-content: space-between;
    }
    nav { display: flex; }
    nav a {
      display: inline-block;
      padding: 9px 14px;
      font-size: 13px;
      font-weight: 500;
      color: var(--ink-2);
      text-decoration: none;
      border-bottom: 3px solid transparent;
      margin-bottom: -1px;
    }
    nav a:first-child { padding-left: 0; }
    nav a:hover { color: var(--ink); text-decoration: none; }
    nav a.active { color: var(--accent); border-bottom-color: var(--accent); }

    .year-selector {
      display: flex;
      align-items: center;
    }
    .sr-only {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }
    .year-selector select {
      font-family: var(--font-mono);
      font-size: 12px;
      font-variant-numeric: tabular-nums;
      color: var(--ink);
      background: var(--bg);
      border: none;
      border-left: 1px solid var(--rule);
      padding: 8px 24px 8px 10px;
      cursor: pointer;
      outline: none;
      appearance: none;
      -webkit-appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a8578'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 8px center;
      background-color: var(--bg);
    }
    .year-selector select:hover { background-color: var(--surface); }

    /* ── Breadcrumbs ──────────────────────────────────────────────── */
    .breadcrumbs {
      max-width: 1100px;
      margin: 0 auto;
      padding: 7px 40px;
      font-family: var(--font-mono);
      font-size: 11px;
      color: var(--ink-3);
      font-variant-numeric: tabular-nums;
      border-bottom: 1px solid var(--rule-2);
    }
    .breadcrumbs a { color: var(--ink-2); text-decoration: none; }
    .breadcrumbs a:hover { color: var(--accent); text-decoration: underline; }
    .breadcrumbs .sep { margin: 0 5px; color: var(--rule); }

    th.sortable {
      cursor: pointer;
      user-select: none;
      white-space: nowrap;
    }
    th.sortable:hover { color: var(--ink); }
    th.active-sort { color: var(--accent); }
    th.active-sort .sort-arrow { opacity: 1; }
    .sort-arrow {
      opacity: 0.35;
      font-size: 11px;
      margin-left: 3px;
    }

    /* ── Main content area ────────────────────────────────────────── */
    main {
      flex: 1;
      max-width: 1100px;
      margin: 0 auto;
      padding: 28px 40px;
      width: 100%;
    }

    /* ── Page head (replaces old dark .page-header) ───────────────── */
    .page-header {
      max-width: 1100px;
      margin: 0 auto;
      padding: 22px 40px 18px;
      border-bottom: 1px solid var(--rule-2);
    }
    .page-header-content { /* kept for compat — same as .page-header */ }
    .page-header-content--with-media {
      display: flex;
      align-items: flex-start;
      gap: 20px;
    }
    .page-header-copy {
      min-width: 0;
      flex: 1;
    }
    .page-header h1 {
      font-family: var(--font-serif);
      font-size: clamp(1.4rem, 4vw, 1.875rem);
      font-weight: 500;
      color: var(--ink);
      margin-bottom: 6px;
    }
    .page-header p {
      font-size: 14px;
      color: var(--ink-2);
    }
    .state-flag {
      width: 112px;
      height: 72px;
      object-fit: contain;
      border: 1px solid var(--rule);
      border-radius: 3px;
      background: white;
      flex-shrink: 0;
    }
    .state-flag-placeholder {
      width: 112px;
      height: 72px;
      border: 1px solid var(--rule);
      border-radius: 3px;
      background: var(--surface);
      color: var(--ink);
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: var(--font-mono);
      font-size: 1.1rem;
      flex-shrink: 0;
    }
    .kicker {
      font-family: var(--font-sans);
      font-size: 11px;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.18em;
      color: var(--accent);
      margin-bottom: 4px;
    }

    /* ── Year badge in headings ───────────────────────────────────── */
    .year-badge {
      font-family: var(--font-mono);
      font-variant-numeric: tabular-nums;
      font-size: 0.75em;
      color: var(--ink-3);
      font-weight: 400;
    }

    /* ── Profile header (inventor / company) ──────────────────────── */
    .profile-header {
      border-bottom: 1px solid var(--rule);
    }
    .profile-header-content {
      max-width: 1100px;
      margin: 0 auto;
      padding: 22px 40px;
      display: flex;
      align-items: flex-start;
      gap: 24px;
    }
    .profile-photo {
      width: 96px;
      height: 96px;
      border-radius: 3px;
      object-fit: cover;
      flex-shrink: 0;
      border: 1px solid var(--rule);
    }
    .avatar-placeholder {
      width: 96px;
      height: 96px;
      border-radius: 3px;
      background: var(--surface);
      border: 1px solid var(--rule);
      color: var(--ink-2);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 2rem;
      font-weight: 500;
      font-family: var(--font-serif);
      flex-shrink: 0;
    }
    .company-logo {
      width: 96px;
      height: 80px;
      border-radius: 3px;
      background: white;
      border: 1px solid var(--rule);
      object-fit: contain;
      padding: 10px;
      flex-shrink: 0;
    }
    .company-logo-placeholder {
      width: 96px;
      height: 80px;
      border-radius: 3px;
      background: var(--surface);
      border: 1px solid var(--rule);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.5rem;
      font-weight: 600;
      font-family: var(--font-serif);
      color: var(--ink);
      flex-shrink: 0;
    }
    .profile-details {
      flex: 1;
      min-width: 0;
    }
    .profile-details h1 {
      font-family: var(--font-serif);
      font-size: clamp(1.35rem, 3.8vw, 1.75rem);
      font-weight: 500;
      color: var(--ink);
      margin-bottom: 8px;
    }
    .profile-details h1 .h1-stat {
      font-size: clamp(1rem, 3vw, 1.125rem);
      font-weight: 400;
      color: var(--ink-2);
      white-space: nowrap;
    }

    /* ── Rank badges on profile pages ─────────────────────────────── */
    .rank-badges {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .rank-badge {
      display: flex;
      align-items: center;
      gap: 7px;
      font-size: 13px;
      color: var(--ink-2);
    }
    .rank-badge img {
      width: 18px;
      height: 18px;
      object-fit: contain;
      border: 1px solid var(--rule);
      border-radius: 2px;
    }
    .rank-badge .mini-icon {
      width: 18px;
      height: 18px;
      background: var(--surface);
      border: 1px solid var(--rule);
      border-radius: 2px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--ink);
      font-size: 9px;
      font-weight: 700;
      flex-shrink: 0;
    }
    .rank-badge strong {
      font-family: var(--font-mono);
      font-variant-numeric: tabular-nums;
      color: var(--ink);
      font-weight: 400;
    }
    .rank-badge a { color: var(--accent); }

    /* ── Top-percent badge ────────────────────────────────────────── */
    .top-percent-badge {
      display: inline-block;
      font-family: var(--font-mono);
      font-size: 10px;
      font-variant-numeric: tabular-nums;
      color: var(--accent);
      border: 1px solid var(--accent);
      padding: 0 4px;
      border-radius: 2px;
      margin-left: 4px;
      vertical-align: middle;
    }

    /* ── Stat block (big number on profile pages) ─────────────────── */
    .stat-block {
      text-align: center;
      flex-shrink: 0;
      padding-left: 16px;
      border-left: 1px solid var(--rule-2);
    }
    .stat-block .big-number {
      font-family: var(--font-mono);
      font-size: clamp(2.5rem, 8vw, 3.5rem);
      font-weight: 400;
      color: var(--ink);
      line-height: 1;
      font-variant-numeric: tabular-nums;
      display: block;
    }
    .stat-block .stat-label {
      font-size: 11px;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--ink-3);
      margin-top: 5px;
    }

    /* ── Stat strip (home + list pages) ──────────────────────────── */
    .stats-row {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      border-top: 1px solid var(--rule);
      border-bottom: 1px solid var(--rule);
      margin-bottom: 32px;
    }
    .stat-card {
      padding: 16px 20px;
      text-align: center;
      border-right: 1px solid var(--rule-2);
    }
    .stat-card:last-child { border-right: none; }
    .stat-card .number {
      font-family: var(--font-mono);
      font-size: clamp(1.4rem, 5vw, 1.8rem);
      font-variant-numeric: tabular-nums;
      color: var(--ink);
      display: block;
    }
    .stat-card .label {
      font-size: 11px;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--ink-3);
      margin-top: 3px;
    }

    /* ── Section title / section head ─────────────────────────────── */
    .section-title {
      font-family: var(--font-serif);
      font-size: 18px;
      font-weight: 500;
      color: var(--ink);
      border-bottom: 2px solid var(--rule);
      padding-bottom: 6px;
      margin-bottom: 12px;
      display: flex;
      align-items: baseline;
      justify-content: space-between;
    }
    .section-title .view-all {
      font-family: var(--font-sans);
      font-size: 12px;
      color: var(--accent);
      font-weight: 500;
    }
    .section-note {
      font-size: 11px;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--ink-3);
      margin-bottom: 10px;
    }

    /* ── Data tables ──────────────────────────────────────────────── */
    .data-table {
      width: 100%;
      margin-bottom: 20px;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }
    .data-table table {
      width: 100%;
      border-collapse: collapse;
      min-width: 400px;
    }
    .data-table thead {
      border-bottom: 1px solid var(--rule);
    }
    .data-table th {
      font-family: var(--font-sans);
      font-weight: 500;
      text-transform: uppercase;
      font-size: 11px;
      letter-spacing: 0.1em;
      color: var(--ink-2);
      padding: 8px 12px;
      text-align: left;
      background: var(--bg);
      white-space: nowrap;
    }
    .data-table th.numeric { text-align: right; }
    .data-table th.center  { text-align: center; }
    .data-table tbody tr   { border-bottom: 1px dotted var(--rule-2); }
    .data-table tbody tr:last-child { border-bottom: none; }
    .data-table tbody tr:hover { background: var(--surface); }
    /* Remove old rank-row color tinting */
    .data-table tr.rank-1,
    .data-table tr.rank-2,
    .data-table tr.rank-3 { background: none; }
    .data-table td {
      padding: 9px 12px;
      color: var(--ink);
      font-size: 14px;
    }
    .data-table td.numeric {
      text-align: right;
      font-family: var(--font-mono);
      font-size: 13px;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
      color: var(--ink-2);
    }
    .data-table td.date {
      text-align: right;
      font-family: var(--font-mono);
      font-size: 12px;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
      color: var(--ink-3);
    }
    .data-table td.center { text-align: center; }
    .data-table a { color: var(--accent); font-weight: 400; }
    .data-table a:hover { text-decoration: underline; }

    /* ── Rank medals ──────────────────────────────────────────────── */
    .rank-medal {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 22px;
      height: 22px;
      border-radius: 50%;
      font-family: var(--font-mono);
      font-size: 11px;
      font-weight: 500;
      color: var(--bg);
      font-variant-numeric: tabular-nums;
    }
    .medal-gold   { background: var(--gold); }
    .medal-silver { background: var(--silver); }
    .medal-bronze { background: var(--bronze); }
    .rank-plain {
      font-family: var(--font-mono);
      font-size: 12px;
      color: var(--ink-3);
      font-variant-numeric: tabular-nums;
    }

    /* ── Co-inventors ─────────────────────────────────────────────── */
    .co-inventors {
      font-size: 11px;
      max-width: 260px;
      line-height: 1.4;
      color: var(--ink-3);
    }
    .co-inventors a { color: var(--ink-2); font-weight: 400; }

    /* ── Hero search (home page) ──────────────────────────────────── */
    .hero-search {
      background: var(--surface);
      border-bottom: 1px solid var(--rule);
      padding: 36px 40px 32px;
      text-align: center;
    }
    .hero-search h1 {
      font-family: var(--font-serif);
      font-size: clamp(1.25rem, 4vw, 1.625rem);
      font-weight: 500;
      color: var(--ink);
      margin-bottom: 6px;
    }
    .hero-search p {
      font-size: 14px;
      color: var(--ink-2);
      margin-bottom: 22px;
    }
    .search-container { max-width: 600px; margin: 0 auto; }
    .search-box {
      display: flex;
      border: 1px solid var(--rule);
      overflow: hidden;
      background: white;
    }
    .search-box input {
      flex: 1;
      padding: 11px 15px;
      font-size: 14px;
      border: none;
      outline: none;
      background: transparent;
      color: var(--ink);
      font-family: var(--font-sans);
    }
    .search-box input::placeholder { color: var(--ink-3); }
    .search-box button {
      padding: 11px 22px;
      font-size: 13px;
      font-weight: 600;
      background: var(--accent);
      color: white;
      border: none;
      cursor: pointer;
      font-family: var(--font-sans);
      letter-spacing: 0.04em;
    }
    .search-box button:hover { background: #700000; }

    /* ── Browse links ─────────────────────────────────────────────── */
    .browse-section { margin-top: 28px; }
    .browse-section h3 {
      font-size: 11px;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.18em;
      color: var(--ink-3);
      margin-bottom: 10px;
    }
    .browse-links { display: flex; flex-wrap: wrap; gap: 7px; }
    .browse-link {
      display: inline-block;
      padding: 5px 13px;
      border: 1px solid var(--rule);
      color: var(--ink-2);
      text-decoration: none;
      font-size: 13px;
      background: var(--bg);
    }
    .browse-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
    /* Unify all browse-link variants to same almanac style */
    .browse-company, .browse-inventor, .browse-city, .browse-state { color: var(--ink-2); }

    /* ── Pagination ───────────────────────────────────────────────── */
    .pagination {
      display: flex;
      justify-content: center;
      gap: 3px;
      margin-top: 20px;
    }
    .pagination a, .pagination span {
      display: inline-block;
      padding: 5px 11px;
      border: 1px solid var(--rule);
      font-family: var(--font-mono);
      font-size: 12px;
      font-variant-numeric: tabular-nums;
      color: var(--ink-2);
      text-decoration: none;
    }
    .pagination a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
    .pagination .current {
      background: var(--ink);
      color: var(--bg);
      border-color: var(--ink);
    }

    /* ── Related pages module ─────────────────────────────────────── */
    .related-pages {
      border-top: 1px solid var(--rule);
      margin-top: 36px;
      padding-top: 18px;
      margin-bottom: 8px;
    }
    .related-pages-title {
      font-family: var(--font-serif);
      font-size: 16px;
      font-weight: 500;
      color: var(--ink);
      border-bottom: 2px solid var(--rule);
      padding-bottom: 5px;
      margin-bottom: 10px;
    }
    .related-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 0 24px;
    }
    .related-item {
      font-size: 13px;
      padding: 5px 0;
      border-bottom: 1px dotted var(--rule-2);
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      gap: 8px;
    }
    .related-item a { color: var(--accent); }
    .related-item .rel-count {
      font-family: var(--font-mono);
      font-size: 11px;
      color: var(--ink-3);
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }

    /* ── Partial year notice ──────────────────────────────────────── */
    .partial-year-notice {
      border-left: 3px solid var(--accent);
      background: var(--surface);
      padding: 8px 14px;
      margin-bottom: 16px;
      font-size: 13px;
      color: var(--ink-2);
    }

    /* ── Info/tip banners ─────────────────────────────────────────── */
    .info-banner {
      border-left: 3px solid var(--rule);
      background: var(--surface);
      padding: 8px 14px;
      margin-bottom: 20px;
      font-size: 13px;
      color: var(--ink-2);
    }

    /* ── Empty state ──────────────────────────────────────────────── */
    .empty-state {
      text-align: center;
      padding: 40px 20px;
      border: 1px solid var(--rule-2);
      color: var(--ink-3);
    }
    .empty-state p { margin-bottom: 12px; }
    .empty-state a {
      display: inline-block;
      padding: 8px 18px;
      border: 1px solid var(--accent);
      color: var(--accent);
      font-size: 13px;
      font-weight: 500;
    }
    .empty-state a:hover { background: var(--accent); color: white; text-decoration: none; }

    /* ── View all / text center ───────────────────────────────────── */
    .text-center { text-align: center; }
    .text-muted   { color: var(--ink-3); }
    .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
    .view-all-link {
      display: inline-block;
      margin-top: 10px;
      color: var(--accent);
      text-decoration: none;
      font-size: 13px;
      font-weight: 500;
    }
    .view-all-link:hover { text-decoration: underline; }
    .btn-primary {
      display: inline-block;
      padding: 10px 22px;
      background: var(--accent);
      color: white;
      border-radius: 4px;
      text-decoration: none;
      font-weight: 600;
      font-size: 14px;
    }
    .btn-primary:hover { background: var(--accent-dark, #6b0000); color: white; text-decoration: none; }

    /* ── Footer ───────────────────────────────────────────────────── */
    footer {
      border-top: 1px solid var(--rule);
      padding: 18px 40px;
      text-align: center;
      color: var(--ink-3);
      font-size: 12px;
      font-style: italic;
      margin-top: auto;
    }
    footer a { color: var(--ink-2); font-style: normal; }
    .footer-stamp {
      font-family: var(--font-mono);
      font-style: normal;
      font-size: 11px;
      font-variant-numeric: tabular-nums;
      color: var(--ink-3);
      margin-top: 4px;
      display: block;
    }

    /* ── Mobile ───────────────────────────────────────────────────── */
    @media (max-width: 640px) {
      .mast-inner  { padding: 10px 16px; flex-direction: column; gap: 4px; }
      .mast-right  { align-items: flex-start; flex-direction: row; gap: 12px; }
      .nav-inner   { padding: 0 8px; flex-wrap: wrap; }
      nav a        { padding: 8px 9px; font-size: 12px; }
      nav a:first-child { padding-left: 4px; }
      .year-selector select { font-size: 12px; padding: 8px 22px 8px 8px; }
      .breadcrumbs { padding: 6px 16px; }
      main         { padding: 18px 16px; }
      .page-header { padding: 16px 16px 12px; }
      .page-header-content--with-media { flex-direction: column; gap: 14px; }
      .page-header h1 { font-size: clamp(1.375rem, 7vw, 1.875rem); }
      .state-flag, .state-flag-placeholder { width: 96px; height: 62px; }
      .profile-header-content { padding: 16px; flex-direction: column; gap: 14px; }
      .profile-details h1 { font-size: clamp(1.25rem, 6vw, 1.75rem); }
      .stat-block  { border-left: none; border-top: 1px solid var(--rule-2); padding-left: 0; padding-top: 10px; }
      .stat-block .big-number { font-size: clamp(2.5rem, 11vw, 3.5rem); }
      .stats-row   { grid-template-columns: repeat(3, 1fr); }
      .stat-card   { padding: 10px 8px; }
      .stat-card .number { font-size: clamp(1.4rem, 7vw, 1.8rem); }
      .hero-search { padding: 24px 16px 20px; }
      .hero-search h1 { font-size: clamp(1.25rem, 6vw, 1.625rem); }
      .related-grid { grid-template-columns: 1fr 1fr; }
      footer { padding: 14px 16px; }
    }
    @media (max-width: 380px) {
      .stat-card .number { font-size: 1.2rem; }
      .related-grid { grid-template-columns: 1fr; }
    }
