:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --ink: #0b2545;
    --muted: #5b6b7f;
    --border: #e3eaf4;
    --accent: #2f5fbf;
    --accent-2: #e7f0ff;
    --shadow: 0 18px 40px rgba(15, 34, 63, 0.08);
    --sidebar-width: 280px;
}

body {
    font-family: "Source Sans 3", "Segoe UI", sans-serif;
    line-height: 1.5;
    background: var(--bg);
    color: var(--ink);
    padding-bottom: 0;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 16px 12px;
    background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow);
    z-index: 12;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sidebar-brand {
    display: flex;
    justify-content: center;
}

.app-content {
    flex: 1 1 auto;
    min-width: 0;
}

.app-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.app-header-inner {
    width: min(100%, 1900px);
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.app-header-title {
    font-family: "Source Serif 4", "Times New Roman", serif !important;
    font-weight: 700;
    font-size: clamp(1.7rem, 2.4vw, 2.5rem);
    line-height: 1.1;
    margin: 0;
    flex: 1 1 auto;
    text-align: center;
}

.app-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
    flex: 0 0 auto;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-footer {
    margin-top: auto;
}

.sidebar-footer-text {
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.35;
}

.sidebar-audio-btn {
    width: 100%;
}

.report-shell {
    width: min(100%, 1900px);
    margin: 0 auto;
}

h1 {
    font-family: "Source Serif 4", "Times New Roman", serif;
    margin-bottom: 8px;
}

.meta {
    color: var(--muted);
}

.page-header {
    background: linear-gradient(135deg, #ffffff 0%, #eef4ff 100%);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100%;
}

.page-header-inner {
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
}

.page-header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
}

.brand-title {
    font-family: "Source Serif 4", "Times New Roman", serif;
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--ink);
}

.brand-subtitle {
    color: var(--muted);
    font-size: 0.9rem;
}

.brand-banner-link {
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    text-decoration: none;
    width: fit-content;
    max-width: 100%;
}

.brand-banner {
    display: block;
    height: 200px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

@media (max-width: 520px) {
    .brand-banner {
        height: 160px;
        max-width: 360px;
    }
}

.nav-items {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.nav-link-item {
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05rem;
    padding: 6px 2px;
    border-bottom: 2px solid transparent;
}

.nav-link-item:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.app-sidebar .nav-link-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border-bottom: 0;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(227, 234, 244, 0.9);
}

.app-sidebar .nav-link-item:hover {
    background: var(--accent-2);
    border-color: #c9d7f3;
}

.app-sidebar .nav-link-item.is-active {
    background: var(--accent-2);
    border-color: #c9d7f3;
    color: var(--accent);
}

.app-sidebar .nav-link-item i {
    font-size: 1.1rem;
}

.header-meta {
    text-align: right;
    word-break: break-word;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.header-action {
    margin: 0;
    align-self: flex-end;
}

.filters {
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.table-shell {
    width: 100%;
    margin: 0 auto;
    padding-bottom: 70px;
}

.report-hero {
    margin: 12px 0 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.report-hero summary {
    list-style: none;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 700;
    background: #f7faff;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.report-hero summary::-webkit-details-marker {
    display: none;
}

.report-hero summary::after {
    content: "";
    position: absolute;
    right: 16px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
    transform: translateY(-50%) rotate(45deg);
}

.report-hero[open] summary::after {
    transform: translateY(-50%) rotate(-135deg);
}

.report-hero-body {
    padding: 12px;
    display: flex;
    justify-content: center;
}

.report-hero img {
    max-width: 70%;
    height: auto;
    display: block;
}

.filters-bar {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.filters-item {
    min-width: 160px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: flex-end;
}

.filters-item.inline-field {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: unset;
    flex-wrap: nowrap;
}

.filters-item .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
}

.filters-item.inline-field .form-label {
    margin: 0;
    white-space: nowrap;
}

.filters-item.inline-field .form-control {
    border-radius: 999px;
    height: 32px;
    padding-left: 12px;
    padding-right: 12px;
}

.filters-actions {
    justify-content: center;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #f7faff;
    color: var(--ink);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    height: 32px;
}

.filter-clear-btn {
    width: 96px;
    padding-left: 0;
    padding-right: 0;
    text-align: center;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination-ellipsis {
    color: var(--muted);
    padding: 0 4px;
}

.table-footer {
    margin-top: 0;
    padding: 10px 12px 12px;
    background: #f7faff;
    border-top: 1px solid var(--border);
    border-radius: 0 0 12px 12px;
    box-shadow: none;
}

@media (max-width: 900px) {
    .app-shell {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
        flex: 0 0 auto;
        height: auto;
        position: sticky;
        top: 0;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-footer {
        margin-top: 0;
        display: flex;
        gap: 10px;
        align-items: center;
        justify-content: space-between;
    }
}

.filter-pill::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #b8c7e6;
}

#filter-competitive:checked + .filter-pill {
    background: var(--accent-2);
    border-color: #c9d7f3;
    color: var(--accent);
}

#filter-competitive:checked + .filter-pill::before {
    background: var(--accent);
}

.filters-dropdown summary {
    cursor: pointer;
    font-weight: 600;
}

.filters-dropdown {
    position: relative;
    min-width: 140px;
}

.filters-details summary {
    list-style: none;
    position: relative;
    padding: 6px 28px 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #f7faff;
    color: var(--ink);
    font-weight: 600;
}

.filters-details summary::-webkit-details-marker {
    display: none;
}

.filters-details summary::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
    transform: translateY(-50%) rotate(45deg);
}

.filters-details[open] summary::after {
    transform: translateY(-50%) rotate(-135deg);
}

.filters-details[open] summary {
    color: var(--ink);
    background: var(--accent-2);
    border-color: #c9d7f3;
}

.filters-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    padding: 10px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    width: max-content;
    max-width: 420px;
    display: grid;
    gap: 6px;
    z-index: 5;
}

#results-table {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

#results-table thead th {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.92rem;
    color: var(--ink);
    font-weight: 700;
}

th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.index-col {
    cursor: default;
}

.sort-indicator {
    margin-left: 6px;
    color: var(--muted);
    font-size: 0.9em;
    display: inline-block;
    vertical-align: middle;
}

.nowrap {
    white-space: nowrap;
}

.empty {
    padding: 12px;
    background: #fff8dc;
    border: 1px solid #e0d8a8;
}

.table-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-scroll {
    overflow-x: hidden;
    padding: 12px;
}

#results-table thead th {
    background: linear-gradient(180deg, #f6f9ff 0%, #e9f0ff 100%);
    color: var(--ink);
    border-color: #c9d7f3;
    z-index: 2;
}

#results-table tbody td {
    border-color: var(--border);
    font-size: 0.98rem;
    text-align: center;
}

#results-table thead th {
    text-align: center;
}

#results-table tbody tr:nth-child(even) {
    background: #f8fbff;
}

#results-table tbody tr.row-highlight td {
    background-color: var(--row-highlight, transparent);
}
