:root {
    --us-navy: #0a3161;
    --us-red: #b31942;
    --us-white: #fdfdfd;
    --us-blue-soft: #dce8f8;
    --ink: #112035;
    --muted: #42546e;
    --surface: #ffffff;
    --surface-alt: #f7f9fd;
    --line: #c7d4e8;
    --shadow: 0 14px 34px rgba(10, 49, 97, 0.14);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 20%, rgba(179, 25, 66, 0.08), transparent 35%),
        radial-gradient(circle at 90% 15%, rgba(10, 49, 97, 0.12), transparent 40%),
        repeating-linear-gradient(
            to bottom,
            #f8fbff 0px,
            #f8fbff 40px,
            #fef3f6 40px,
            #fef3f6 80px
        );
    min-height: 100vh;
    overflow-x: hidden;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -48px;
    background: var(--us-navy);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    z-index: 300;
    transition: top 120ms ease;
}

.skip-link:focus {
    top: 10px;
}

.hero-stripes {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -2;
    background:
        linear-gradient(130deg, rgba(10, 49, 97, 0.12) 0%, rgba(10, 49, 97, 0.02) 32%, transparent 34%),
        linear-gradient(90deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.6));
}

.bg-shape {
    position: fixed;
    pointer-events: none;
    z-index: -1;
    border-radius: 999px;
    filter: blur(12px);
}

.bg-shape-a {
    width: 360px;
    height: 360px;
    left: -120px;
    top: 80px;
    background: rgba(179, 25, 66, 0.16);
}

.bg-shape-b {
    width: 420px;
    height: 420px;
    right: -120px;
    bottom: 40px;
    background: rgba(10, 49, 97, 0.18);
}

.hero {
    padding: 54px 16px 30px;
    animation: fadeUp 500ms ease-out;
    border-bottom: 2px solid rgba(10, 49, 97, 0.12);
}

.profile-hero {
    background: linear-gradient(180deg, rgba(10, 49, 97, 0.18), rgba(179, 25, 66, 0.09));
}

.hero-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
}

.hero-emblem {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(10, 49, 97, 0.24);
    background: #fff;
}

.eyebrow {
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--us-red);
    font-size: 0.8rem;
    margin: 0 0 8px;
    font-weight: 800;
}

.hero h1 {
    margin: 0;
    font-size: clamp(1.95rem, 4vw, 3.1rem);
    line-height: 1.1;
    color: var(--us-navy);
}

.sub {
    margin: 14px auto 0;
    color: var(--muted);
    max-width: 780px;
    text-align: center;
}

.back-link {
    display: inline-block;
    margin-top: 6px;
    color: var(--us-navy);
    text-decoration: none;
    border: 1px solid var(--us-navy);
    padding: 7px 13px;
    border-radius: 999px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.8);
}

.container {
    width: min(1150px, 93vw);
    margin: 0 auto 68px;
}

.card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 255, 0.98));
    border: 1px solid var(--line);
    border-left: 5px solid var(--us-navy);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 22px;
}

.filters h2,
.analytics h2,
.card h2 {
    margin-top: 0;
    color: var(--us-navy);
}

.analytics {
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.stat-card {
    border: 1px solid #bdd0ea;
    border-radius: 12px;
    padding: 14px;
    background:
        linear-gradient(180deg, rgba(10, 49, 97, 0.08), rgba(10, 49, 97, 0.01)),
        linear-gradient(90deg, #ffffff, #f3f7ff);
}

.stat-card p {
    margin: 0;
    color: #355072;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}

.stat-card h3 {
    margin: 10px 0 0;
    font-size: 1.85rem;
    line-height: 1;
    color: var(--us-red);
}

.insights-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.insight-card {
    border: 1px solid #cddbef;
    border-radius: 12px;
    padding: 14px;
    background: var(--surface);
}

.insight-ad-unit {
    margin-top: 14px;
    min-height: 220px;
    border: 1px dashed #c5d6ee;
    border-radius: 10px;
    padding: 8px;
    background: #f9fbff;
}

.insight-card h3 {
    margin-top: 0;
    color: var(--us-navy);
}

.mini-list {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 8px;
    color: #243d5a;
}

.country-snapshot {
    margin: 16px 0 8px;
    border: 1px solid #c8d8ef;
    border-radius: 12px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #f7fbff, #edf4ff);
}

.country-snapshot-title {
    margin: 0 0 6px;
    color: var(--us-navy);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
}

#countrySnapshotContent {
    margin: 0;
    color: #243d5a;
    font-size: 0.95rem;
    line-height: 1.4;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

label {
    display: grid;
    gap: 6px;
    font-size: 0.9rem;
}

label span {
    color: var(--muted);
    font-weight: 700;
}

input,
select {
    border: 1px solid #b7c9e6;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    background: #ffffff;
    color: var(--ink);
}

input:focus,
select:focus {
    outline: 2px solid rgba(10, 49, 97, 0.25);
    border-color: var(--us-navy);
}

.actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
}

.search-shortcut {
    margin: -2px 0 12px;
    color: var(--muted);
    font-size: 0.84rem;
}

kbd {
    font-family: inherit;
    font-weight: 700;
    border: 1px solid #b6c9e6;
    background: #f4f8ff;
    border-radius: 6px;
    padding: 1px 6px;
    color: var(--us-navy);
}

.active-filters {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid #b2c6e3;
    background: #edf3ff;
    color: #1c3f67;
    font-size: 0.78rem;
    font-weight: 700;
}

button {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    background: linear-gradient(180deg, #0d3f78, #0a3161);
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: transform 120ms ease, opacity 120ms ease;
}

button:hover {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.58;
    cursor: not-allowed;
    transform: none;
}

button.secondary {
    background: linear-gradient(180deg, #d44f71, #b31942);
    color: #fff;
}

button.ghost,
a.ghost {
    background: #ffffff;
    color: var(--us-navy);
    border: 1px solid #b7c9e6;
}

button.ghost:hover,
a.ghost:hover {
    background: #f3f8ff;
    color: var(--us-red);
}

.copy-status {
    min-height: 1.1rem;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 600;
}

.results-header {
    margin: 20px 4px 8px;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 600;
}

.results {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.company {
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 4px solid var(--us-red);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow);
    animation: fadeUp 400ms ease both;
}

.company:hover {
    transform: translateY(-2px);
    transition: transform 120ms ease;
}

.company h3 {
    margin: 0 0 8px;
    color: var(--us-navy);
}

.profile-link {
    display: inline-block;
    margin-top: 10px;
    text-decoration: none;
    font-weight: 800;
    color: var(--us-red);
}

.profile-layout {
    display: grid;
    gap: 14px;
}

.profile-head {
    display: flex;
    gap: 14px;
    align-items: center;
}

.profile-logo {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--us-red);
    background: #fff;
}

.company .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.tag {
    background: #ecf3ff;
    color: #153f70;
    border-radius: 999px;
    border: 1px solid #bfd0e8;
    padding: 3px 9px;
    font-size: 0.78rem;
    font-weight: 700;
}

.company p {
    margin: 5px 0;
    color: #2d486a;
    font-size: 0.92rem;
}

.company a {
    color: var(--us-red);
    text-decoration: none;
}

.pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    color: var(--us-navy);
    font-weight: 700;
}

.leaderboard-controls {
    margin-top: 16px;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
}

th,
td {
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid #dce6f5;
    font-size: 0.92rem;
}

th {
    color: #ffffff;
    background: linear-gradient(90deg, #0a3161, #174a84);
    position: sticky;
    top: 0;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 880px) {
    .hero-brand {
        flex-direction: column;
        text-align: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .insights-grid {
        grid-template-columns: 1fr;
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

    .results {
        grid-template-columns: 1fr;
    }

    .profile-head {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Site Navigation ─────────────────────────────────────── */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--us-navy);
    box-shadow: 0 2px 14px rgba(10, 49, 97, 0.4);
}

.nav-inner {
    width: min(1150px, 93vw);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 8px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.nav-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: #fff;
}

.nav-links {
    display: flex;
    gap: 4px;
    align-items: center;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 7px 14px;
    border-radius: 8px;
    transition: background 120ms ease, color 120ms ease;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.nav-links a.nav-cta {
    background: var(--us-red);
    color: #fff;
}

.nav-links a.nav-cta:hover {
    background: #d63a5a;
}

/* ── Site Footer ─────────────────────────────────────────── */
.site-footer {
    background: var(--us-navy);
    color: rgba(255, 255, 255, 0.85);
    margin-top: 48px;
    padding: 36px 16px 28px;
}

.footer-inner {
    width: min(1150px, 93vw);
    margin: 0 auto;
    text-align: center;
    display: grid;
    gap: 14px;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
}

.footer-tagline {
    margin: 0;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.02em;
}

.footer-divider {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--us-red), #174a84);
    margin: 0 auto;
    border: 0;
    border-radius: 999px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 22px;
    flex-wrap: wrap;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    font-size: 0.87rem;
    font-weight: 600;
    transition: color 120ms ease;
}

.footer-links a:hover {
    color: #fff;
}

.footer-copy {
    margin: 0;
    font-size: 0.77rem;
    color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 560px) {
    .nav-brand span { display: none; }
    .nav-links a { padding: 6px 9px; font-size: 0.82rem; }
}

/* ── AdSense Ad Units ──────────────────────────────────────── */
.ad-unit {
    width: 100%;
    overflow: hidden;
    text-align: center;
    margin: 20px 0;
    min-height: 90px;
    background: transparent;
}

.ad-unit ins {
    display: block;
}

.adsbygoogle-block {
    display: block;
}

.ad-unit-spaced {
    margin-top: 2rem;
}

.hero-compact {
    padding-bottom: 1.5rem;
}

.legal-title {
    color: var(--us-navy);
    font-size: 1.8rem;
    margin-bottom: 0.4rem;
}

.legal-updated {
    color: var(--muted);
    font-size: 0.9rem;
}
/* ── Link styles added by JS ─────────────────────────────── */
.mini-link {
    color: var(--us-navy);
    text-decoration: none;
    font-weight: 700;
    transition: color 120ms ease;
}

.mini-link:hover {
    color: var(--us-red);
    text-decoration: underline;
}

.card-title-link {
    color: var(--us-navy);
    text-decoration: none;
    font-weight: 800;
    transition: color 120ms ease;
}

.card-title-link:hover {
    color: var(--us-red);
}

/* ── Back to top button ──────────────────────────────────── */
.back-to-top {
    position: fixed;
    bottom: 28px;
    right: 24px;
    z-index: 200;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--us-red), #8f1230);
    color: #fff;
    font-size: 1.2rem;
    font-weight: 900;
    border: 0;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(179, 25, 66, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 220ms ease, transform 220ms ease;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.back-to-top:hover {
    background: linear-gradient(180deg, #d63a5a, var(--us-red));
    transform: translateY(-2px);
}

/* ── Skeleton loader ─────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, #e8eef8 25%, #d0daf0 50%, #e8eef8 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 8px;
    display: block;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 4px solid #c7d4e8;
    border-radius: 14px;
    padding: 16px;
    display: grid;
    gap: 10px;
}

.skeleton-card .sk-title  { height: 22px; width: 65%; }
.skeleton-card .sk-tag-row{ height: 18px; width: 85%; }
.skeleton-card .sk-line   { height: 14px; width: 90%; }
.skeleton-card .sk-line-s { height: 14px; width: 55%; }

/* ── Filter presets (localStorage) ──────────────────────── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
}

.section-header h2 {
    margin: 0 0 4px;
}

.section-header p {
    margin: 0;
}

.preset-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.preset-dropdown {
    position: relative;
}

.presets-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(10, 49, 97, 0.16);
    min-width: 200px;
    max-width: 280px;
    z-index: 100;
    margin-top: 4px;
    padding: 4px;
    max-height: 320px;
    overflow-y: auto;
}

.presets-menu.hidden {
    display: none;
}

.preset-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 120ms ease;
}

.preset-item:hover {
    background: var(--surface-alt);
}

.preset-item-name {
    flex: 1;
    font-size: 0.9rem;
    color: var(--ink);
    word-break: break-word;
    padding-right: 8px;
}

.preset-item-delete {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px 6px;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: color 120ms ease, background 120ms ease;
}

.preset-item-delete:hover {
    color: var(--us-red);
    background: rgba(179, 25, 66, 0.08);
}

.presets-empty {
    padding: 12px;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}
