:root {
    --bg: #f2efe8;
    --paper: #fbf9f3;
    --ink: #1f2a2c;
    --muted: #61706d;
    --line: #d7d0c2;
    --sidebar: #18312e;
    --sidebar-ink: #e7e0d0;
    --accent: #b66b2f;
    --success: #3d6f5a;
    --shadow: 0 14px 40px rgba(24, 49, 46, 0.08);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at top right, rgba(182, 107, 47, 0.14), transparent 30%),
        linear-gradient(180deg, #f5f1e8 0%, #ede7d9 100%);
    color: var(--ink);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

code {
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.92rem;
}

h1,
h2,
h3 {
    font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
    margin: 0;
}

p {
    margin: 0;
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 35%),
        var(--sidebar);
    color: var(--sidebar-ink);
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.sidebar-brand {
    display: grid;
    gap: 8px;
}

.brand-link {
    font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-size: 2rem;
    letter-spacing: 0.02em;
}

.brand-tag {
    color: rgba(231, 224, 208, 0.8);
    line-height: 1.5;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.nav-link {
    padding: 12px 14px;
    border-radius: 12px;
    color: rgba(231, 224, 208, 0.88);
}

.nav-link:hover,
.nav-link.is-active {
    background: rgba(251, 249, 243, 0.12);
    color: #fffaf0;
}

.sidebar-note {
    margin-top: auto;
    padding: 16px;
    border-radius: 14px;
    background: rgba(251, 249, 243, 0.08);
    color: rgba(231, 224, 208, 0.82);
    line-height: 1.55;
}

.content {
    padding: 40px;
    display: grid;
    gap: 24px;
}

.page-header {
    display: grid;
    gap: 6px;
}

.page-header h1 {
    font-size: clamp(2.4rem, 4vw, 3.4rem);
}

.card-page-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 22px;
    align-items: flex-end;
    padding: 14px 18px;
    border: 1px solid rgba(215, 208, 194, 0.92);
    border-radius: 18px;
    background: rgba(245, 241, 232, 0.94);
    box-shadow: 0 16px 34px rgba(24, 49, 46, 0.1);
    backdrop-filter: blur(12px);
}

.card-page-header-title {
    display: grid;
    align-content: center;
    min-width: 0;
    flex: 0 1 auto;
}

.card-page-header-title h1 {
    font-size: clamp(2rem, 3.4vw, 3.35rem);
    line-height: 1.02;
}

.card-header-stat {
    display: grid;
    gap: 8px;
    align-content: center;
    min-width: 0;
    padding-left: 14px;
    border-left: 1px solid rgba(215, 208, 194, 0.9);
}

.card-header-value {
    font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-size: clamp(1.25rem, 2.1vw, 1.95rem);
    line-height: 1.08;
}

.card-header-price {
    padding-left: 18px;
}

.eyebrow,
.kicker {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.76rem;
    color: var(--accent);
    font-weight: 700;
}

.panel {
    background: rgba(251, 249, 243, 0.92);
    border: 1px solid rgba(215, 208, 194, 0.7);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.hero {
    display: grid;
    gap: 24px;
}

.hero h2 {
    font-size: clamp(1.7rem, 2.4vw, 2.5rem);
    margin-top: 6px;
}

.lede {
    color: var(--muted);
    line-height: 1.65;
    max-width: 70ch;
}

.route-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.route-card {
    display: grid;
    gap: 8px;
    padding: 18px;
    border-radius: 16px;
    background: linear-gradient(160deg, rgba(24, 49, 46, 0.96), rgba(46, 82, 75, 0.96));
    color: #f7f1e5;
}

.route-card span {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.74rem;
    color: rgba(247, 241, 229, 0.72);
}

.route-card strong {
    line-height: 1.45;
    font-weight: 600;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.stat-grid.compact {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stat-card {
    background: var(--paper);
    border: 1px solid rgba(215, 208, 194, 0.7);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.stat-label {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-value {
    font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-size: 2rem;
    margin-top: 10px;
}

.stat-note {
    color: var(--muted);
    margin-top: 8px;
    line-height: 1.45;
}

.two-column {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 20px;
}

.section-heading {
    display: grid;
    gap: 6px;
    margin-bottom: 18px;
}

.section-heading p {
    color: var(--muted);
    line-height: 1.55;
}

.search-panel {
    display: grid;
    gap: 16px;
}

.search-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-form input {
    flex: 1 1 260px;
    min-width: 220px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 1rem;
    background: #fffdf7;
}

.search-form button {
    border: none;
    border-radius: 12px;
    padding: 14px 18px;
    background: var(--accent);
    color: #fff8f0;
    font-weight: 700;
    cursor: pointer;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    border-top: 1px solid rgba(215, 208, 194, 0.8);
    text-align: left;
    vertical-align: top;
}

.data-table thead th {
    border-top: none;
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.data-table tbody tr:hover {
    background: rgba(182, 107, 47, 0.05);
}

.compact-table th,
.compact-table td {
    padding: 10px 8px;
}

.muted {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.4;
}

.coverage-list {
    display: grid;
    gap: 16px;
}

.coverage-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px 64px;
    gap: 12px;
    align-items: center;
}

.coverage-meta {
    display: grid;
    gap: 2px;
}

.coverage-meta span,
.coverage-share {
    color: var(--muted);
}

.coverage-bar {
    height: 12px;
    border-radius: 999px;
    background: rgba(24, 49, 46, 0.08);
    overflow: hidden;
}

.coverage-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--success), #5b9580);
}

.detail-hero {
    display: grid;
    gap: 14px;
}

.identity-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.identity-grid .label {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 6px;
}

.ce-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px 18px;
}

.card-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: start;
}

.card-details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
}

.ce-detail-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 24px;
    align-items: start;
}

.ce-detail-left {
    display: grid;
    gap: 20px;
}

.ce-name-block {
    display: grid;
    gap: 8px;
}

.ce-name {
    font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-size: clamp(2rem, 3.2vw, 3rem);
    line-height: 1.05;
}

.ce-detail-item {
    display: grid;
    gap: 6px;
    align-content: start;
    padding: 16px 18px;
    border-radius: 16px;
    background: var(--paper);
    border: 1px solid rgba(215, 208, 194, 0.7);
    box-shadow: var(--shadow);
}

.ce-detail-value {
    font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-size: 1.55rem;
    line-height: 1.2;
}

.ce-detail-code {
    font-size: 0.9rem;
    word-break: break-word;
}

.ce-detail-note {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

.ce-card-art-shell {
    display: grid;
    gap: 10px;
    justify-items: start;
}

.card-image-panel .ce-card-art-shell {
    justify-items: center;
}

.card-image-panel {
    display: grid;
    align-content: start;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.ce-card-art-frame,
.ce-card-art-placeholder {
    width: 100%;
    max-width: 280px;
    border-radius: 18px;
    overflow: hidden;
    border: none;
    background: transparent;
    box-shadow: 0 20px 34px rgba(24, 49, 46, 0.18);
}

.ce-card-art {
    display: block;
    width: 100%;
    height: auto;
}

.ce-card-art-placeholder {
    min-height: 390px;
    padding: 18px;
    align-content: start;
}

.price-controls-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 18px;
}

.price-control-field {
    display: grid;
    gap: 8px;
}

.price-control-field select,
.price-control-field input {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.96rem;
    background: #fffdf7;
}

.price-controls-submit {
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    background: var(--accent);
    color: #fff8f0;
    font-weight: 700;
    cursor: pointer;
}

.printing-price-controls {
    grid-template-columns: minmax(0, 320px) auto;
}

.price-summary-grid .stat-value {
    font-size: 1.5rem;
    line-height: 1.15;
}

.mix-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.mix-list {
    display: grid;
    gap: 16px;
}

.mix-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px 64px;
    gap: 12px;
    align-items: center;
}

.mix-meta {
    display: grid;
    gap: 2px;
}

.mix-label {
    font-weight: 700;
}

.mix-count,
.mix-share {
    color: var(--muted);
    font-size: 0.92rem;
}

.mix-bar {
    height: 12px;
    border-radius: 999px;
    background: rgba(24, 49, 46, 0.08);
    overflow: hidden;
}

.mix-bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(182, 107, 47, 0.92), rgba(61, 111, 90, 0.82));
}

.set-highlight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.set-highlight-link {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.set-highlight-link:hover {
    color: var(--accent);
}

.card-price-history-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.chart-axis-captions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.detail-list {
    display: grid;
    gap: 12px;
}

.detail-list div {
    display: grid;
    gap: 4px;
}

.detail-list dt {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.detail-list dd {
    margin: 0;
}

.plain-list {
    display: grid;
    gap: 10px;
    padding-left: 20px;
    margin: 0;
    line-height: 1.55;
}

.empty-state {
    color: var(--muted);
    line-height: 1.6;
}

.pager {
    margin-top: 18px;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.pager-link {
    padding: 10px 14px;
    border: 1px solid rgba(215, 208, 194, 0.9);
    border-radius: 12px;
    background: #fffdf7;
}

.pager-link.is-disabled {
    color: var(--muted);
    background: rgba(215, 208, 194, 0.2);
}

.pager-status {
    color: var(--muted);
    font-size: 0.95rem;
}

.price-chart-shell {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.price-chart-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.85rem;
}

.price-chart {
    width: 100%;
    height: auto;
    padding: 8px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(24, 49, 46, 0.04), rgba(24, 49, 46, 0.01));
    border: 1px solid rgba(215, 208, 194, 0.9);
}

.axis-line {
    stroke: rgba(97, 112, 109, 0.6);
    stroke-width: 1.2;
}

.axis-line-muted {
    stroke: rgba(97, 112, 109, 0.35);
}

.axis-grid-line {
    stroke: rgba(97, 112, 109, 0.18);
    stroke-width: 1;
}

.axis-grid-line-vertical {
    stroke-dasharray: 4 5;
}

.axis-tick-label {
    fill: rgba(97, 112, 109, 0.96);
    font-size: 12px;
}

.price-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.card-floor-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.card-floor-point {
    fill: #fff7ef;
    stroke: #4f6f86;
    stroke-width: 2;
    opacity: 0.95;
}

.price-point {
    fill: #fff7ef;
    stroke: #4f6f86;
    stroke-width: 2;
    opacity: 0.95;
}

.light-market-line {
    fill: none;
    stroke: #2e6676;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.light-point {
    fill: #f7fcfd;
    stroke: #2e6676;
    stroke-width: 1.8;
    opacity: 0.96;
}

.light-volume-bar {
    fill: rgba(61, 111, 90, 0.22);
}

.set-volume-bar {
    fill: rgba(61, 111, 90, 0.34);
}

.sales-volume-bar {
    fill: rgba(61, 111, 90, 0.26);
}

.sales-whisker {
    stroke: rgba(53, 86, 122, 0.42);
    stroke-width: 1.2;
}

.sales-range-box {
    fill: rgba(87, 132, 179, 0.18);
    stroke: rgba(53, 86, 122, 0.58);
    stroke-width: 1.2;
}

.sales-median-line {
    stroke: rgba(29, 54, 83, 0.88);
    stroke-width: 1.8;
}

.sales-average-line {
    stroke: rgba(29, 54, 83, 0.88);
    stroke-width: 1.6;
    stroke-dasharray: 4 2;
}

.chart-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 18px;
    padding: 0;
    margin: 4px 0 0;
    list-style: none;
}

.chart-legend li {
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--ink);
    line-height: 1.45;
}

.legend-swatch {
    width: 24px;
    min-width: 24px;
    height: 10px;
    border-radius: 999px;
}

.legend-swatch.price-line {
    background: var(--accent);
}

.legend-swatch.price-point-swatch {
    background: linear-gradient(90deg, #fff7ef 0%, #fff7ef 45%, #4f6f86 45%, #4f6f86 100%);
    border: 1px solid rgba(79, 111, 134, 0.7);
}

.legend-swatch.card-floor-line {
    background: var(--accent);
}

.legend-swatch.card-floor-point-swatch {
    background: linear-gradient(90deg, #fff7ef 0%, #fff7ef 45%, #4f6f86 45%, #4f6f86 100%);
    border: 1px solid rgba(79, 111, 134, 0.7);
}

.legend-swatch.sales-volume-swatch {
    background: rgba(61, 111, 90, 0.3);
}

.legend-swatch.light-market-line-swatch {
    background: #2e6676;
}

.legend-swatch.light-volume-swatch {
    background: rgba(61, 111, 90, 0.3);
}

.legend-swatch.sales-range-swatch {
    background: rgba(87, 132, 179, 0.18);
    border: 1px solid rgba(53, 86, 122, 0.58);
}

.legend-swatch.sales-median-swatch {
    position: relative;
    background: rgba(54, 86, 122, 0.14);
}

.legend-swatch.sales-median-swatch::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 3px;
    border-top: 2px solid rgba(29, 54, 83, 0.88);
}

.legend-swatch.sales-median-swatch::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 7px;
    border-top: 2px dashed rgba(29, 54, 83, 0.88);
}

.legend-note,
.chart-note {
    color: var(--muted);
}

.chart-note {
    margin-top: 4px;
    line-height: 1.55;
}

.history-disclosure {
    margin-top: 18px;
    border-top: 1px solid rgba(215, 208, 194, 0.9);
    padding-top: 18px;
}

.history-disclosure summary {
    cursor: pointer;
    font-weight: 700;
    list-style: none;
}

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

.history-disclosure[open] summary {
    margin-bottom: 16px;
}

.table-sort-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.table-sort-link {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(215, 208, 194, 0.9);
    background: #fffdf7;
    font-size: 0.92rem;
}

.table-sort-link.is-active {
    background: rgba(24, 49, 46, 0.08);
    border-color: rgba(24, 49, 46, 0.2);
}

.associated-printings-table td:nth-child(4),
.associated-printings-table th:nth-child(4) {
    text-align: right;
}

.card-floor-contributors {
    margin-top: 20px;
}

.market-hero {
    display: grid;
    gap: 18px;
}

.market-hero-copy {
    display: grid;
    gap: 10px;
}

.tab-strip {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.tab-strip.compact {
    margin-bottom: 0;
}

.tab-link {
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(215, 208, 194, 0.9);
    background: #fffdf7;
    font-size: 0.92rem;
}

.tab-link.is-active {
    background: rgba(24, 49, 46, 0.08);
    border-color: rgba(24, 49, 46, 0.2);
    font-weight: 700;
}

.market-filter-groups {
    display: grid;
    gap: 14px;
    margin: 18px 0 14px;
}

.filter-chip-group {
    display: grid;
    gap: 8px;
}

.filter-chip-label {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.table-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    margin: 18px 0 10px;
}

.market-movers-header-row {
    align-items: center;
    margin-top: 0;
}

.numeric-cell {
    text-align: right;
    white-space: nowrap;
}

.mover-positive {
    color: #1d6c47;
    font-weight: 700;
}

.mover-negative {
    color: #9f4127;
    font-weight: 700;
}

.movers-table td,
.movers-table th {
    white-space: nowrap;
}

.movers-table td:nth-child(2),
.movers-table td:nth-child(3),
.movers-table td:nth-child(4),
.movers-table td:nth-child(5),
.movers-table th:nth-child(2),
.movers-table th:nth-child(3),
.movers-table th:nth-child(4),
.movers-table th:nth-child(5) {
    white-space: normal;
}

.sortable-table-link {
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sortable-table-link.is-active {
    color: var(--ink);
    font-weight: 700;
}

.sort-indicator {
    color: var(--muted);
    font-size: 0.76rem;
    letter-spacing: 0.02em;
}

.pager-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 980px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        gap: 18px;
    }

    .content {
        padding: 24px;
    }

    .two-column {
        grid-template-columns: 1fr;
    }

    .mix-grid {
        grid-template-columns: 1fr;
    }

    .coverage-row {
        grid-template-columns: 1fr;
    }

    .card-page-header {
        position: sticky;
        align-items: flex-start;
    }

    .card-header-stat {
        padding-left: 0;
        padding-top: 10px;
        border-left: none;
        border-top: 1px solid rgba(215, 208, 194, 0.9);
    }

    .card-top-grid {
        grid-template-columns: 1fr;
    }

    .card-image-panel {
        order: -1;
        justify-items: center;
    }

    .card-details-grid {
        grid-template-columns: 1fr;
    }

    .price-controls-form {
        grid-template-columns: 1fr;
    }

    .printing-price-controls {
        grid-template-columns: 1fr;
    }

    .card-price-history-grid {
        grid-template-columns: 1fr;
    }

    .ce-detail-hero {
        grid-template-columns: 1fr;
    }
}
