/* Page transition overlay */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.page-transition.fade-out {
    opacity: 1;
    pointer-events: all;
}

.page-transition.fade-in {
    opacity: 1;
    animation: fadeIn 0.2s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 1; }
    to { opacity: 0; }
}

:root {
    /* Layout dimensions */
    --header-height: 52px;
    /* Row chart / filter column: 133px × 1.2 × 1.2 */
    --filter-col-width: calc(133px * 1.44);
    --results-header-height: auto;

    /* Spacing */
    --gap-sm: 3px;
    --gap-md: 16px;
    --gap-lg: 24px;

    /* Colors - Blue theme */
    --primary-blue: #1a365d;
    --accent-blue: #0066cc;
    --light-bg: #f7fafc;
    --results-bg: #edf2f7;
    --border-color: #cbd5e0;
    --text-dark: #1a202c;
    --text-muted: #718096;
}

html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100%;
    background-color: #fff;
}

body {
    font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 500;
}

a,
a:visited,
a:hover,
a:focus,
a:active {
    text-decoration: none;
}

/* ========================================
   APP CONTAINER - Full viewport
   ======================================== */

#app-container {
    display: grid;
    grid-template-rows: var(--header-height) 1fr;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
}

/* ========================================
   HEADER
   ======================================== */

#app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px var(--gap-lg);
    border-bottom: 1.5px solid var(--primary-blue);
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
}

.header-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    align-self: flex-start;
    padding-top: 4px;
}

#updated-date {
    font-size: 11px;
    font-style: italic;
    color: var(--text-muted);
}

.header-dropdown {
    position: relative;
}

.header-dropdown-trigger {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-blue);
    letter-spacing: 0.2px;
    cursor: default;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
}

.header-dropdown-trigger::after {
    content: '\25BE';
    font-size: 12px;
}

.header-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    z-index: 1000;
    padding: 6px 0;
}

.header-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 0;
    right: 0;
    height: 6px;
}

.header-dropdown:hover .header-dropdown-menu,
.header-dropdown:focus-within .header-dropdown-menu {
    display: block;
}

/* Make the trigger focusable for touch (tap to open) */
.header-dropdown-trigger {
    outline: none;
}

.header-dropdown-menu a {
    display: block;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.header-dropdown-menu a:hover {
    background-color: rgba(26, 54, 93, 0.06);
    color: var(--accent-blue);
}

.header-dropdown-menu a.active {
    color: var(--primary-blue);
    font-weight: 700;
}

#title h1 {
    font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 30px;
    font-weight: 800;
    margin: 0;
    line-height: 1;
    color: #000;
    letter-spacing: -0.5px;
}

#title {
    display: flex;
    align-items: center;
    gap: 20px;
}

.title-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 20px;
    border-left: 1.5px solid var(--primary-blue);
    align-self: center;
    height: 26px;
    margin-top: 6px;
}

#nav-links a {
    color: var(--text-muted);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: color 0.2s ease;
    padding: 4px 10px;
    border-radius: 4px;
}

#nav-links a:hover {
    color: var(--accent-blue);
    background-color: rgba(26, 54, 93, 0.05);
}

#nav-links a.active {
    color: var(--primary-blue);
    font-weight: 700;
    pointer-events: none;
    cursor: default;
}

#nav-links a.active:hover {
    color: var(--primary-blue);
    background-color: transparent;
}

/* ========================================
   MAIN CONTENT - Filter Zone + Results Zone
   ======================================== */

#main-content {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr;
    column-gap: var(--gap-lg);
    row-gap: 2px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: var(--gap-sm);
    box-sizing: border-box;
    background-color: #fff;
}

.preserved-hidden {
    display: none !important;
}


/* Full-width time chart spanning both columns */
#time-chart-row {
    grid-column: 1 / -1;
    grid-row: 1;
    border-bottom: 1px solid var(--border-color);
    min-width: 0;
    overflow-x: hidden;
}

#chart-grant-date {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* Givebacks page: copy above forgiven-amount bar chart */
.givebacks-time-chart-head {
    padding: 8px 2px 4px;
    margin-left: 10px;
    min-width: 0;
}

.givebacks-time-chart-lede {
    margin: 0;
    font-size: 13px;
    line-height: 1.35;
    font-weight: 500;
    color: var(--text-dark);
}

.givebacks-lede-head {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-dark);
}

.givebacks-time-chart-source {
    font-size: 11px;
    font-weight: 400;
    white-space: nowrap;
}

.givebacks-time-chart-source a {
    color: var(--accent-blue);
    font-weight: 500;
    text-decoration: none;
}

.givebacks-time-chart-source a:hover {
    text-decoration: underline;
}

/* ========================================
   FILTER ZONE (Left side - 2 columns)
   ======================================== */

#filter-zone {
    display: grid;
    /* Names column: +10% then +20% vs base 208px → 208 × 1.1 × 1.2 */
    grid-template-columns: var(--filter-col-width) calc(208px * 1.32);
    grid-template-rows: 1fr;
    gap: var(--gap-sm);
    padding: var(--gap-sm);
    grid-column: 1;
    grid-row: 2;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
    background-color: #fff;
}

#main-content.givebacks-table-mode #filter-zone {
    grid-template-columns: var(--filter-col-width);
}

#main-content.givebacks-table-mode #names-list-col,
#main-content.givebacks-table-mode #chart-remedyType-wrap {
    display: none;
}

/* Reoffenders: single-column layout — results zone spans full width */
#main-content.reoffenders-mode {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
}

#main-content.reoffenders-mode #results-zone {
    grid-column: 1;
    grid-row: 2;
}

#reoffenders-table-panel {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 10px 12px;
    background-color: var(--results-bg);
}

.reoffenders-table-scroll {
    height: 100%;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
}

.reoffenders-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 13px;
}

/* ========================================
   PARDON DETAIL PANEL
   ======================================== */

#pardon-detail {
    flex: 1;
    overflow-y: auto;
    padding: var(--gap-md) var(--gap-lg);
    background-color: var(--results-bg);
}

#givebacks-table-panel {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 10px 12px;
    background-color: var(--results-bg);
}

.givebacks-table-scroll {
    height: 100%;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
}

.givebacks-table {
    --gb-header-row-height: 56px;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 11px;
}

.givebacks-table thead th {
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    color: #2a3240;
    background: #f5f6f4;
    border-bottom: 1px solid var(--border-color);
    padding: 10px 12px;
    vertical-align: top;
    position: sticky;
    top: 0;
    z-index: 4;
}

.givebacks-table .gb-columns-row th {
    top: 0;
    z-index: 4;
}

.givebacks-table .col-subhead {
    display: inline-block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.25;
}

.givebacks-table .gb-totals-row th {
    top: var(--gb-header-row-height);
    z-index: 3;
    background: #eef1f4;
    font-size: 13px;
    font-weight: 700;
    vertical-align: middle;
    padding-top: 7px;
    padding-bottom: 7px;
}

#gb-total-pardonee {
    font-size: 13px;
}

#gb-total-victim,
#gb-total-gov {
    font-size: 12px;
    line-height: 1.05;
    text-align: right;
}

.givebacks-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 12px;
    vertical-align: top;
}

.gb-name {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.15;
    color: #202733;
    margin-bottom: 2px;
}

.gb-pardon-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: #aab4c4;
    text-underline-offset: 2px;
}

.gb-pardon-link:hover {
    color: #1a5fa8;
    text-decoration-color: #1a5fa8;
}

.gb-meta {
    font-size: 7px;
    color: #465265;
    margin-bottom: 6px;
}

.gb-amount {
    font-size: 11px;
    line-height: 1;
    font-weight: 700;
    color: #ad3e4f;
    margin-bottom: 3px;
}

.gb-subtext {
    font-size: 9px;
    color: #3f4b5d;
}

.gb-none {
    font-size: 12px;
    line-height: 1;
    font-style: italic;
    color: #555f6e;
}

.gb-doc-placeholder {
    font-size: 12px;
    line-height: 1.25;
    color: #274f78;
    text-decoration: underline;
    margin-bottom: 6px;
}

.gb-doc-district {
    font-size: 9px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #3f4b5d;
    margin-bottom: 6px;
}

.gb-doc-placeholder:last-child {
    margin-bottom: 0;
}

.givebacks-table-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
}

.gb-col-offense {
    font-size: 12px;
    color: #3f4b5d;
}

.givebacks-table .gb-columns-row th:nth-child(3),
.givebacks-table .gb-columns-row th:nth-child(4),
.givebacks-table .gb-totals-row th:nth-child(3),
.givebacks-table .gb-totals-row th:nth-child(4) {
    text-align: right;
}

.gb-col-victim,
.gb-col-gov {
    text-align: right;
}

.gb-col-victim .gb-subtext,
.gb-col-gov .gb-subtext,
.gb-col-victim .gb-none,
.gb-col-gov .gb-none {
    text-align: right;
}

.detail-name-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 6px;
}

.detail-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
    flex: 1;
    min-width: 0;
}

.detail-district {
    flex-shrink: 0;
    max-width: 42%;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    color: var(--text-muted);
    text-align: right;
}

.detail-date {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.detail-top {
    position: relative;
    margin-bottom: 14px;
}

.detail-section {
    margin-bottom: 10px;
}

.detail-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.detail-value {
    font-size: 14px;
    color: var(--text-dark);
    line-height: 1.5;
}

.detail-empty {
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
}

/* Left column: presidency, clemency, then occupation / relationship / topic; one scrollbar for the whole stack */
#filter-col-left {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
    overflow-x: hidden;
    overflow-y: auto;
    min-width: 0;
    min-height: 0;
    align-self: stretch;
    /* Reserve scrollbar width so row charts stay full width; enables overflow when content is taller than grid area */
    scrollbar-gutter: stable;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

/* Row charts default .chart-scroll to flex+inner scroll; here the column scrolls instead */
#filter-col-left .chart-scroll {
    flex: 0 0 auto;
    overflow: visible;
    min-height: 0;
}

/* Filter columns */
.filter-column {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: visible;
}

/* District fills the remaining left-column height and scrolls internally */
#filter-col-district {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#filter-col-district > div {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Chart containers */
#chart-president_term,
#chart-clemency_type {
    display: flex;
    flex-direction: column;
    overflow: visible;
}

#chart-district-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ========================================
   NAMES LIST COLUMN
   ======================================== */

#names-list-col {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
    /* No top padding so "Pardons" lines up with presidency chart title (filter zone already padded). */
    padding: 0 var(--gap-sm) var(--gap-sm);
    box-sizing: border-box;
}

#names-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.names-list-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1px;
    padding: 6px 7px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #dbe3ec;
    margin-bottom: 6px;
    background-color: rgba(255, 255, 255, 0.75);
    box-sizing: border-box;
    max-width: 100%;
}

.names-list-item:hover {
    background-color: rgba(26, 54, 93, 0.06);
}

.names-list-item.selected {
    background-color: rgba(26, 54, 93, 0.12);
}

.nli-footer {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    margin-top: -4px;
}

.nli-meta {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.nli-footer-clemency {
    flex-shrink: 0;
}

.nli-clemency {
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.nli-clemency--pardon {
    color: #6282a8;
}

.nli-clemency--commutation {
    color: #8f77b0;
}

.nli-clemency--other {
    color: var(--text-muted);
    font-weight: 500;
}

.nli-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.nli-amount {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35em 0.5em;
    margin-top: 2px;
    line-height: 1.2;
}

.nli-amount-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-blue);
}

.nli-amount-remedy {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Givebacks: remedy pills — tints of shared.js remedyBarFill (stack + row chart) */
.remedy-type-pill {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
    line-height: 1.2;
}

.remedy-type-pill--compact {
    font-size: 10px;
    padding: 2px 7px;
    font-weight: 600;
}

.remedy-type-pill--fine {
    background-color: #fef9c3;
    color: #a16207;
}

.remedy-type-pill--restitution {
    background-color: #d1fae5;
    color: #047857;
}

.remedy-type-pill--forfeiture {
    background-color: #f3e8ff;
    color: #7e22ce;
}

.remedy-type-pill--other {
    background-color: #f1f5f9;
    color: #475569;
}

.detail-remedy-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.detail-giveback-amt {
    font-weight: 600;
}

.nli-offense {
    font-size: 12px;
    font-weight: 400;
    color: #2f3744;
    line-height: 1.22;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.chart-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 10px;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


.chart-title-count {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    min-width: 30px;
    text-align: right;
}

.chart-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Search inputs in filter columns */
.chart-search-container {
    position: relative;
    margin-bottom: var(--gap-sm);
    flex-shrink: 0;
}

#names-search-container {
    margin-top: 4px;
}

.chart-search {
    width: 100%;
    padding: 6px 28px 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
}

.chart-search:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.chart-search::placeholder {
    color: var(--text-muted);
}

.chart-search-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
    pointer-events: none;
}

.chart-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
    display: none;
}

.chart-search-clear:hover {
    color: var(--text-dark);
}

.chart-search:not(:placeholder-shown) ~ .chart-search-icon,
.chart-search-container.has-selection .chart-search-icon {
    display: none;
}

.chart-search:not(:placeholder-shown) ~ .chart-search-clear,
.chart-search-container.has-selection .chart-search-clear {
    display: block;
}

.chart-search.has-selection {
    border: 2px solid var(--primary-blue);
    background-color: #fff;
}

.chart-search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.chart-search-item {
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}

.chart-search-item:last-child {
    border-bottom: none;
}

.chart-search-item:hover,
.chart-search-item.selected {
    background-color: rgba(43, 108, 176, 0.1);
}

.chart-search-item .item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 10px;
}

.chart-search-item .item-count {
    color: var(--text-muted);
    font-size: 12px;
    flex-shrink: 0;
}

/* ========================================
   RESULTS ZONE (Right side)
   ======================================== */

#results-zone {
    display: flex;
    flex-direction: column;
    grid-column: 2;
    grid-row: 2;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background-color: var(--results-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

#results-header {
    padding: var(--gap-sm) var(--gap-lg);
    background-color: var(--results-bg);
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    flex-shrink: 0;
}

#results-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--gap-md);
}

.results-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.results-header-source {
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
}

.results-header-source a {
    color: var(--accent-blue);
    font-weight: 500;
    text-decoration: none;
}

.results-header-source a:hover {
    text-decoration: underline;
}

#menu-info {
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
    white-space: nowrap;
}

#menu-info .record-count {
    font-size: 12px;
    font-weight: 400;
    color: #0a0a0a;
}

#menu-info .record-filters {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-muted);
}

#filters {
    max-height: 120px;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

#filters:empty,
#filters.no-filters {
    max-height: 0;
    margin: 0;
    padding: 0;
}

#chart-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--gap-sm) var(--gap-lg);
    background-color: var(--results-bg);
}

/* ========================================
   STORY CARDS
   ======================================== */

.detail-stories {
    margin-top: 14px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.detail-column-background .detail-stories {
    padding-left: 0;
    padding-right: 0;
}

.story-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eef0f3;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
    border-radius: 4px;
    padding-left: 4px;
    padding-right: 4px;
}

.story-card:hover {
    background-color: rgba(26, 54, 93, 0.05);
}

.story-card:last-child {
    border-bottom: none;
}

.story-thumb {
    width: 32px;
    height: 32px;
    border-radius: 3px;
    flex-shrink: 0;
    margin-top: 2px;
    object-fit: contain;
}

.story-thumb--article {
    width: 80px;
    height: 60px;
    border-radius: 4px;
    object-fit: cover;
    margin-top: 0;
}

.story-info {
    flex: 1;
    min-width: 0;
}

.story-publisher {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.story-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-blue);
    line-height: 1.35;
    margin-bottom: 2px;
}

.story-author {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 1px;
}

.story-date {
    font-size: 10px;
    color: var(--text-muted);
}

/* ========================================
   DC.JS CHART OVERRIDES
   ======================================== */

#chart-president_term,
#chart-clemency_type,
#chart-district-wrap {
    font-weight: 500;
    font-size: 13px;
}

/* ========================================
   MOBILE LAYOUT (≤768px)
   - Unlocks scrolling
   - Collapses to single column
   - Hides dc.js charts (unusable on touch)
   - Keeps name search + results fully functional
   ======================================== */

@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        overflow-y: auto;
        height: auto;
    }

    #app-container {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 100dvh;
        width: 100%;
        overflow: visible;
    }

    /* ---- Header ---- */
    #app-header {
        padding: 6px 14px;
        flex-wrap: wrap;
        gap: 4px;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    #title h1 {
        font-size: 22px;
    }

    #title {
        gap: 10px;
    }

    #nav-links {
        padding-left: 10px;
        margin-top: 3px;
        height: auto;
    }

    #updated-date {
        display: none;
    }

    .header-side {
        padding-top: 2px;
        gap: 0;
        margin-left: auto;
    }

    /* ---- Main content: single-column stack ---- */
    #main-content {
        display: flex;
        flex-direction: column;
        height: auto;
        overflow: visible;
        padding: 8px;
        gap: 8px;
    }

    /* Hide time chart (dc.js SVG — too wide for touch) */
    #time-chart-row {
        display: none;
    }

    /* Filter zone: single column, natural height */
    #filter-zone {
        display: flex;
        flex-direction: column;
        height: auto;
        overflow: visible;
        padding: 0;
        gap: 0;
        width: 100%;
        box-sizing: border-box;
    }

    /* Hide all dc.js row charts */
    #filter-col-left {
        display: none;
    }

    /* Names list: full width, capped height with its own scroll */
    #names-list-col {
        width: 100%;
        height: auto;
        max-height: 45vh;
        min-height: 160px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        padding: 0;
        box-sizing: border-box;
    }

    #names-list {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Givebacks: hide names list col (uses .preserved-hidden already, just ensure it stays hidden) */
    #main-content.givebacks-table-mode #filter-zone {
        display: flex;
    }

    /* Results zone: full width, natural height */
    #results-zone {
        width: 100%;
        height: auto;
        min-height: 50vh;
        overflow: visible;
        border-radius: 8px;
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
    }

    #pardon-detail {
        height: auto;
        overflow-y: visible;
        padding: 12px 14px;
    }

    /* Givebacks table panel */
    #givebacks-table-panel {
        height: auto;
        min-height: 50vh;
        overflow: visible;
        padding: 8px;
    }

    .givebacks-table-scroll {
        height: auto;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Detail split: already collapses to 1 col at 1100px; ensure it applies here too */
    .detail-content-split {
        grid-template-columns: minmax(0, 1fr);
    }

    .detail-column + .detail-column {
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    /* Reoffenders table panel */
    #reoffenders-table-panel {
        height: auto;
        min-height: 0;
        overflow: visible;
        padding: 8px;
    }

    .reoffenders-table-scroll {
        height: auto;
        overflow-x: visible;
        overflow-y: visible;
    }
}
