:root {
    --ec-black: #0A0A0C;
    --ec-charcoal: #353839;
    --ec-gold: #D4AF37;
    --ec-warm-gold: #C9914B;
    --ec-cream: #F6F3EA;
    --ec-card: #FFFFFF;
    --ec-muted: #6B7280;
    --ec-border: #E2DED2;
    --ec-danger: #B42318;
    --ec-success: #147A3D;
    --ec-blue: #174EA6;
    --ec-shadow: 0 10px 30px rgba(10, 10, 12, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    background: var(--ec-cream);
    color: var(--ec-black);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.45;
    margin: 0;
    max-width: none;
}

h1,
h2,
h3 {
    color: var(--ec-black);
    letter-spacing: 0;
}

h1 {
    font-family: Orbitron, "Arial Black", Impact, system-ui, sans-serif;
    font-size: clamp(26px, 3.4vw, 38px);
    margin: 0 0 6px;
    text-transform: uppercase;
}

h2 {
    font-size: 18px;
    margin: 0 0 8px;
}

h3 {
    font-size: 15px;
    margin: 14px 0 6px;
}

a {
    color: #7A5A0A;
}

.top-nav {
    align-items: center;
    background: var(--ec-black);
    border-bottom: 3px solid var(--ec-gold);
    box-shadow: var(--ec-shadow);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin: 0 0 20px;
    padding: 12px 24px;
}

.brand-title {
    color: var(--ec-gold);
    font-family: Orbitron, "Arial Black", Impact, system-ui, sans-serif;
    font-size: 18px;
    font-weight: 900;
    margin-right: auto;
    text-transform: uppercase;
}

.app-mode-badge {
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.04em;
    padding: 4px 8px;
    text-transform: uppercase;
}

.app-mode-development {
    background: #FFF3CD;
    color: #7A4D00;
}

.app-mode-production {
    color: #B9E8C9;
}

.top-nav a,
.top-nav-logout button {
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: #F8F1D1;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 7px 9px;
    text-decoration: none;
}

.top-nav a:hover,
.top-nav-logout button:hover {
    background: rgba(212, 175, 55, 0.16);
    color: #FFFFFF;
}

.top-nav-menu {
    position: relative;
}

.top-nav-menu summary {
    background: transparent;
    border-radius: 999px;
    color: #F8F1D1;
    cursor: pointer;
    font-weight: 700;
    list-style: none;
    padding: 7px 9px;
}

.top-nav-menu summary::-webkit-details-marker {
    display: none;
}

.top-nav-menu summary::after {
    content: " ▾";
}

.top-nav-menu summary:hover {
    background: rgba(212, 175, 55, 0.16);
    color: #FFFFFF;
}

.top-nav-menu-options {
    background: var(--ec-black);
    border: 1px solid rgba(212, 175, 55, 0.55);
    border-radius: 8px;
    box-shadow: var(--ec-shadow);
    display: grid;
    gap: 2px;
    grid-template-columns: 1fr;
    left: 0;
    min-width: 150px;
    padding: 5px;
    position: absolute;
    top: calc(100% + 6px);
    z-index: 10;
}

.top-nav-menu-options a {
    border-radius: 6px;
    color: #F8F1D1;
    display: block;
    text-align: left;
    white-space: nowrap;
}

.top-nav-menu-options a:hover {
    color: #FFFFFF;
}

.payload-preview {
    background: #111827;
    border-radius: 8px;
    color: #f8fafc;
    max-height: 520px;
    overflow: auto;
    padding: 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

.top-nav-logout {
    margin: 0;
}

.page-shell {
    margin: 24px auto;
    max-width: 1240px;
    padding: 0 28px 30px;
}

body > h1,
body > p,
body > .workflow-grid,
body > .layout,
body > .details,
body > .box,
body > .warning,
body > table,
body > form,
body > .oauth-badge {
    margin-left: auto;
    margin-right: auto;
    max-width: 1240px;
    width: calc(100% - 64px);
}

.card,
.step-card,
.details,
.box,
.panel {
    background: var(--ec-card);
    border: 1px solid var(--ec-border);
    border-radius: 10px;
    box-shadow: var(--ec-shadow);
}

.workflow-grid {
    display: grid;
    gap: 16px;
}

.step-card {
    padding: 14px;
}

.step-number,
.slot-number {
    color: #8A6A12;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.image-card {
    background: #FFFFFF;
    border: 1px solid var(--ec-border);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(10, 10, 12, 0.06);
}

.image-card.required {
    border-color: var(--ec-gold);
}

.preview-frame {
    background: #FBFAF6;
    border-color: #D7CDAE;
    border-radius: 8px;
}

.actions {
    gap: 8px;
}

.card,
.details,
.box,
.panel {
    padding: 14px;
}

.muted,
.help-text {
    color: var(--ec-muted);
    font-size: 13px;
}

.button-link,
button,
input[type="submit"] {
    background: var(--ec-gold);
    border: 1px solid #B99722;
    border-radius: 8px;
    color: var(--ec-black);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    font-weight: 800;
    line-height: 1.15;
    padding: 8px 12px;
    text-decoration: none;
}

.button-link:hover,
button:hover,
input[type="submit"]:hover {
    background: #E2C45A;
}

button:disabled,
input[type="submit"]:disabled,
.button-link[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.55;
}

.button-small,
.actions button,
.batch-bar button,
td button {
    min-height: 30px;
    padding: 6px 9px;
}

.button-secondary {
    background: var(--ec-charcoal);
    border-color: var(--ec-charcoal);
    color: #FFFFFF;
}

.button-danger,
button.danger {
    background: var(--ec-danger);
    border-color: #8E1B12;
    color: #FFFFFF;
}

.page-heading-row,
.card-title-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
}

.summary-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    margin: 16px 0;
}

.summary-card {
    background: #fff;
    border: 1px solid var(--ec-border);
    border-radius: 10px;
    padding: 14px;
}

.summary-card span,
.summary-card strong { display: block; }
.summary-card strong { font-size: 21px; margin-top: 4px; }
.collection-toolbar, .inline-form, .actions { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; }
.collection-toolbar { justify-content: space-between; margin: 14px 0; }
.collection-toolbar form { margin: 0; }
.inline-form input[type="text"], .inline-form input:not([type]) { min-width: min(360px, 70vw); }
.collection-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); }
.collection-card { background: #fff; border: 1px solid var(--ec-border); border-radius: 12px; box-shadow: var(--ec-shadow); overflow: hidden; }
.collection-thumbnails { background: #f4f1e8; display: grid; gap: 8px; grid-template-columns: 1fr 1fr; padding: 10px; text-decoration: none; }
.collection-thumbnails span { align-items: center; display: flex; flex-direction: column; gap: 4px; justify-content: center; min-width: 0; }
.collection-thumbnails img { background: #fff; border-radius: 6px; display: block; height: 120px; object-fit: contain; width: 100%; }
.collection-thumbnails small { color: var(--ec-muted); font-weight: 800; }
.missing-thumbnail { background: #ebe7dc; border: 1px dashed #aaa18c; border-radius: 6px; height: 120px; }
.collection-card-body { padding: 14px; }
.collection-card-body h2 { margin: 0; }
.money-grid { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); margin: 12px 0; }
.money-grid span, .money-grid strong { display: block; }
.collection-summary-grid { grid-template-columns: repeat(5, minmax(140px, 1fr)); }
.summary-attention { border-color: #D48B21; background: #FFF8E8; }
.collection-controls { display: grid; gap: 16px; margin: 14px 0; }
.collection-filter-form {
    align-items: end;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(210px, 1.5fr) repeat(3, minmax(150px, 1fr)) auto auto;
}
.collection-filter-form label { display: grid; gap: 5px; margin: 0; }
.collection-filter-form input,
.collection-filter-form select { margin: 0; min-width: 0; width: 100%; }
.collection-filter-actions { display: flex; gap: 7px; }
.collection-control-row { align-items: center; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
.collection-control-row form { margin: 0; }
.rate-input { align-items: center; display: flex; gap: 5px; white-space: nowrap; }
.rate-input input { margin: 0; width: 86px; }
.collection-view-switcher { align-items: center; display: flex; flex-wrap: wrap; gap: 5px; }
.collection-view-switcher > span { color: var(--ec-muted); font-size: 12px; font-weight: 800; margin-right: 3px; text-transform: uppercase; }
.collection-view-switcher a {
    border: 1px solid var(--ec-border);
    border-radius: 7px;
    color: var(--ec-charcoal);
    font-size: 13px;
    font-weight: 800;
    padding: 7px 9px;
    text-decoration: none;
}
.collection-view-switcher a.active { background: var(--ec-charcoal); border-color: var(--ec-charcoal); color: #FFFFFF; }
.collection-owner { color: var(--ec-muted); font-size: 13px; margin: 7px 0; }
.owner-needed { color: #9A4D00; font-weight: 900; }
.owner-warning { border-color: #D48B21; }
.collection-card-actions form { margin: 0; }
.collection-view-compact { gap: 10px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.collection-view-compact .collection-card { border-radius: 9px; }
.collection-view-compact .collection-thumbnails { gap: 5px; padding: 6px; }
.collection-view-compact .collection-thumbnails img,
.collection-view-compact .missing-thumbnail { height: 78px; }
.collection-view-compact .collection-card-body { padding: 8px; }
.collection-view-compact .collection-card-body h2 { font-size: 14px; line-height: 1.2; }
.collection-view-compact .badge { font-size: 9px; padding: 3px 5px; }
.collection-view-compact .card-title-row { align-items: start; gap: 5px; }
.collection-view-compact .collection-card-identity,
.collection-view-compact .collection-owner,
.collection-view-compact .grading-cost { font-size: 11px; line-height: 1.25; margin: 5px 0; }
.collection-view-compact .money-grid { gap: 4px; margin: 7px 0; }
.collection-view-compact .money-grid span { font-size: 9px; overflow-wrap: anywhere; }
.collection-view-compact .money-grid strong { font-size: 11px; margin-top: 2px; }
.collection-view-compact .compact-warning { font-size: 10px; line-height: 1.25; margin: 6px 0; padding: 6px; }
.collection-view-compact .collection-card-actions { display: grid; grid-template-columns: 1fr; gap: 5px; }
.collection-view-compact .collection-card-actions > *,
.collection-view-compact .collection-card-actions button { font-size: 10px; min-height: 28px; padding: 5px 6px; width: 100%; }
.collection-text-list { box-sizing: border-box; max-width: 100%; min-width: 0; overflow: hidden; padding: 0; width: 100%; }
.collection-text-list .table-scroll {
    border-bottom: 1px solid var(--ec-border);
    max-width: 100%;
    overflow-x: auto !important;
    overscroll-behavior-x: contain;
    padding-bottom: 8px;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}
.collection-text-list table {
    display: table !important;
    font-size: 12px;
    margin: 0;
    max-width: 100% !important;
    min-width: 1120px;
    overflow: hidden !important;
    table-layout: fixed;
    width: 100% !important;
}
.collection-text-table .collection-text-col-player { width: 15%; }
.collection-text-table .collection-text-col-card { width: 19%; }
.collection-text-table .collection-text-col-owner { width: 8%; }
.collection-text-table .collection-text-col-cost { width: 8%; }
.collection-text-table .collection-text-col-market { width: 9%; }
.collection-text-table .collection-text-col-price { width: 8%; }
.collection-text-table .collection-text-col-roi { width: 5%; }
.collection-text-table .collection-text-col-status { width: 8%; }
.collection-text-table .collection-text-col-actions { width: 20%; }
.collection-text-list th,
.collection-text-list td { line-height: 1.15; min-width: 0; overflow: hidden; padding: 5px 6px; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }
.collection-text-list th { padding: 6px; white-space: nowrap; }
.collection-text-table th:nth-child(7),
.collection-text-table td:nth-child(7) { padding-left: 3px; padding-right: 3px; }
.collection-text-table th:nth-child(8),
.collection-text-table td:nth-child(8) { padding-left: 3px; padding-right: 3px; }
.collection-text-table td:nth-child(8) .badge { font-size: 8px; max-width: 100%; overflow: hidden; padding-left: 4px; padding-right: 4px; text-overflow: ellipsis; }
.collection-text-table th:nth-child(9),
.collection-text-table td:nth-child(9) { overflow: visible; }
.collection-text-list .badge { font-size: 9px; padding: 2px 5px; }
.collection-text-list tbody tr:nth-child(even) { background: #FBFAF6; }
.text-list-player-cell { overflow: visible !important; position: relative; }
.text-list-player-details { max-width: 100%; position: relative; }
.text-list-player-details summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: 2px;
    list-style: none;
    max-width: 100%;
}
.text-list-player-details summary::-webkit-details-marker { display: none; }
.text-list-player-details summary strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.text-list-player-details summary span { color: var(--ec-gold-dark); flex: 0 0 auto; font-weight: 900; }
.text-list-player-full {
    background: var(--ec-charcoal);
    border-radius: 6px;
    box-shadow: var(--ec-shadow);
    color: #FFFFFF;
    left: 4px;
    max-width: min(320px, 80vw);
    padding: 7px 9px;
    position: absolute;
    top: calc(100% + 4px);
    white-space: normal;
    z-index: 20;
}
.text-list-card-cell { overflow: hidden; text-overflow: ellipsis; }
.listing-blockers { color: #7A4F01; display: block; margin-top: 5px; max-width: 240px; }
.collection-text-list .text-list-actions {
    align-items: center !important;
    display: grid !important;
    gap: 0;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
}
.collection-text-list .text-list-action-cell { min-width: 190px; }
.collection-text-list .text-list-actions > a,
.collection-text-list .text-list-actions > form { min-width: 0; width: 100% !important; }
.collection-text-list .text-list-actions form { margin: 0; }
.collection-text-list .text-list-actions .button-link,
.collection-text-list .text-list-actions button {
    display: inline-flex !important;
    font-size: 10px;
    justify-content: center;
    min-height: 26px !important;
    min-width: 0;
    opacity: 1 !important;
    overflow: visible;
    padding: 4px 10px;
    text-overflow: clip;
    visibility: visible !important;
    white-space: nowrap;
    width: 100% !important;
}
.badge-success { background: #e6f4ea; color: var(--ec-success); }
.narrow-page { max-width: 850px; }
.stacked-form { display: grid; gap: 16px; }
.stacked-form label, .form-grid label { display: grid; font-weight: 700; gap: 5px; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.photo-upload-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.upload-box { background: #fbfaf6; border: 1px dashed #9b9278; border-radius: 9px; display: grid; font-weight: 800; gap: 8px; padding: 14px; }
.upload-box.required { border: 2px solid var(--ec-gold); }
.upload-preview { background: #FFFFFF; border-radius: 7px; height: 170px; object-fit: contain; width: 100%; }
.import-preview { align-items: center; display: flex; gap: 18px; margin: 16px 0; }
.import-preview img { max-height: 220px; max-width: 180px; object-fit: contain; }
.collection-detail-layout { display: grid; gap: 18px; grid-template-columns: minmax(260px, 0.75fr) minmax(0, 1.6fr); }
.collection-detail-layout > * { min-width: 0; }
.collection-detail-page { max-width: 1280px; }
.collection-detail-page .summary-grid { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
.collection-detail-page .card,
.collection-detail-page .summary-card { overflow-wrap: anywhere; }
.collection-detail-page form,
.collection-detail-page .table-scroll,
.collection-intake-page form { min-width: 0; max-width: 100%; }
.collection-detail-actions > * { min-width: 0; }
.collection-images { align-content: start; display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.collection-images > img, .collection-images figure img { border-radius: 8px; width: 100%; }
.collection-images figure { margin: 0; }
.replacement-current-images { margin-top: 12px; }
.replacement-current-images figcaption { color: #5d6670; font-size: 13px; margin-top: 4px; }
.table-scroll { overflow-x: auto; }
.table-scroll th { text-align: left; }

.green-summary {
    background: #E6F4EA;
    border-color: #78B789;
}

.buy-toolbar { margin: 14px 0; }
.search-card-panel { margin: 14px 0; }
.search-card-form {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 3fr) minmax(190px, 1fr) auto;
}
.search-card-form label { margin: 0; }
.search-card-form button { white-space: nowrap; }
.search-card-summary { grid-template-columns: repeat(5, minmax(140px, 1fr)); }
.search-card-results table { min-width: 1120px; }
.search-card-results td { vertical-align: middle; }
.search-card-result-controls { align-items: end; display: flex; justify-content: flex-end; margin: 12px 0; }
.search-card-result-controls label { display: grid; font-weight: 700; gap: 5px; min-width: 220px; }
.search-card-result-image {
    border-radius: 6px;
    height: 88px;
    object-fit: contain;
    width: 68px;
}
.search-card-result-title { min-width: 290px; }
.search-card-actions {
    align-items: stretch;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 125px;
}
.search-card-actions form { margin: 0; }
.search-card-actions button,
.search-card-actions .button-link { box-sizing: border-box; text-align: center; width: 100%; }
.lot-pricing-page { max-width: 1480px; }
.lot-upload-layout { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lot-pricing-options { align-items: center; grid-template-columns: minmax(220px, 0.6fr) minmax(300px, 1.4fr); }
.lot-result-heading { align-items: start; display: flex; gap: 20px; justify-content: space-between; }
.lot-source-image-wrap { align-items: end; display: grid; gap: 7px; justify-items: end; }
.lot-image-open { font-size: 12px; min-height: 34px; padding: 6px 10px; }
.lot-source-image { border: 1px solid var(--ec-border); max-height: 260px; max-width: min(420px, 42vw); object-fit: contain; }
.lot-image-dialog { background: var(--ec-card); border: 0; max-height: 100vh; max-width: 100vw; padding: 18px; width: min(1400px, 96vw); }
.lot-image-dialog::backdrop { background: rgba(0, 0, 0, 0.82); }
.lot-image-dialog img { display: block; margin: 12px auto 0; max-height: calc(100vh - 95px); max-width: 100%; object-fit: contain; }
.lot-image-close { min-height: 36px; padding: 6px 12px; }
.lot-summary-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.lot-profit-grid { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.lot-pricing-results table { font-size: 12px; min-width: 0; table-layout: fixed; width: 100%; }
.lot-pricing-results th,
.lot-pricing-results td { line-height: 1.25; padding: 6px 5px; vertical-align: top; }
.lot-pricing-results th:first-child,
.lot-pricing-results td:first-child { text-align: center; width: 4%; }
.lot-pricing-results th:nth-child(2),
.lot-pricing-results td:nth-child(2) { width: 24%; }
.lot-pricing-results th:nth-child(n+3),
.lot-pricing-results td:nth-child(n+3) { text-align: center; width: 10.28%; }
.lot-card-title { min-width: 0; overflow-wrap: anywhere; }
.lot-card-identity { align-items: flex-start; display: flex; gap: 7px; }
.lot-card-details { flex: 1 1 auto; min-width: 0; }
.lot-card-crop-button { background: transparent; border: 0; cursor: zoom-in; flex: 0 0 auto; min-height: 0; padding: 0; }
.lot-card-crop { background: #fff; border: 1px solid var(--ec-border); flex: 0 0 auto; height: 92px; object-fit: contain; width: 66px; }
.lot-card-crop-button:hover .lot-card-crop { border-color: var(--ec-gold); }
.lot-card-details > strong { display: block; font-size: 12px; line-height: 1.25; }
.lot-card-meta { color: var(--ec-muted); font-size: 10px; margin-top: 3px; }
.lot-card-reprice { margin-top: 5px; }
.lot-card-reprice summary { color: #7A5A0A; font-size: 11px; font-weight: 800; }
.lot-card-reprice-form { display: grid; gap: 5px; margin-top: 5px; }
.lot-card-reprice-form label { display: grid; font-size: 10px; font-weight: 700; gap: 2px; }
.lot-card-reprice-form input { font-size: 12px; min-height: 32px; padding: 4px 6px; }
.lot-card-reprice-form button { font-size: 11px; min-height: 32px; padding: 4px 8px; width: fit-content; }
.lot-card-manual-price { margin-top: 5px; }
.lot-card-manual-price summary { color: #7A5A0A; font-size: 11px; font-weight: 800; }
.lot-card-manual-price-form { align-items: end; display: grid; gap: 5px; grid-template-columns: repeat(3, minmax(64px, 1fr)); margin-top: 5px; }
.lot-card-manual-price-form label { display: grid; font-size: 10px; font-weight: 700; gap: 2px; }
.lot-card-manual-price-form input { font-size: 12px; min-height: 32px; min-width: 0; padding: 4px 6px; width: 100%; }
.lot-card-manual-price-form button { font-size: 11px; grid-column: 1 / -1; min-height: 32px; padding: 4px 8px; width: fit-content; }
.lot-manual-price-note { font-size: 10px; margin: 5px 0 0; }
.lot-listings-dropdown { margin-top: 5px; position: relative; }
.lot-listings-dropdown summary { color: #7A5A0A; font-size: 11px; font-weight: 800; }
.lot-listings-dropdown-content { border-left: 2px solid var(--ec-gold); display: grid; gap: 5px; margin-top: 5px; max-height: 300px; overflow-y: auto; padding-left: 6px; }
.lot-pricing-listing { display: grid; gap: 1px; text-align: left; }
.lot-pricing-listing a,
.lot-pricing-listing > span:not(.lot-price-kind) { font-size: 10px; line-height: 1.2; }
.lot-pricing-listing strong { font-size: 10px; }
.lot-price-kind { color: var(--ec-charcoal); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.lot-listings-empty { font-size: 10px; margin: 5px 0 0; }
.lot-grade-listings { text-align: center; }
.lot-grade-listings summary { color: var(--ec-charcoal); cursor: pointer; font-weight: 800; }
.lot-grade-listings .lot-listings-dropdown-content { min-width: 190px; text-align: left; }
.warning-text { color: var(--ec-danger); font-size: 12px; }
.buy-rules { margin: 14px 0; }
.buy-rules summary { font-size: 15px; }
.selected-player-search { margin: 14px 0 18px; }
.selected-player-search .page-heading-row {
    align-items: start;
    gap: 18px;
}
.selected-player-search form {
    display: grid;
    gap: 12px;
    width: 100%;
}
.selected-player-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    max-height: 320px;
    overflow: auto;
    padding-right: 4px;
}
.selected-player-option {
    align-items: start;
    background: #FBFAF6;
    border: 1px solid var(--ec-border);
    border-radius: 8px;
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 9px;
}
.selected-player-option input {
    flex: 0 0 auto;
    margin-top: 3px;
    width: auto;
}
.selected-player-option small {
    color: var(--ec-muted);
    display: block;
    font-size: 12px;
    margin-top: 2px;
}
.buy-filter-form,
.add-player-form {
    align-items: end;
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
}
.buy-filter-form label,
.add-player-form label { margin: 0; }
.buy-filter-form .checkbox-label {
    align-items: center;
    display: flex;
    gap: 7px;
    min-height: 36px;
}
.checkbox-label input { flex: 0 0 auto; width: auto; }
.buy-opportunity-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
}
.buy-opportunity-card {
    background: #FFFFFF;
    border: 1px solid var(--ec-border);
    border-radius: 12px;
    box-shadow: var(--ec-shadow);
    overflow: hidden;
}
.buy-opportunity-card.green-deal {
    border: 3px solid var(--ec-success);
    box-shadow: 0 8px 24px rgba(28, 110, 59, 0.18);
}
.buy-image-wrap {
    align-items: center;
    background: #F4F1E8;
    display: flex;
    height: 230px;
    justify-content: center;
    position: relative;
}
.buy-image-wrap img {
    height: 100%;
    object-fit: contain;
    width: 100%;
}
.deal-percent {
    background: var(--ec-charcoal);
    border-radius: 999px;
    bottom: 10px;
    color: #FFFFFF;
    font-weight: 900;
    padding: 7px 11px;
    position: absolute;
    right: 10px;
}
.green-deal .deal-percent { background: var(--ec-success); }
.buy-card-body { padding: 14px; }
.buy-card-body h2 { margin: 10px 0 4px; }
.buy-listing-title { min-height: 42px; }
.buy-money-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 12px 0;
}
.buy-money-grid span {
    background: #FBFAF6;
    border-radius: 7px;
    color: var(--ec-muted);
    font-size: 12px;
    padding: 8px;
}
.buy-money-grid strong {
    color: var(--ec-black);
    display: block;
    font-size: 18px;
    margin-top: 3px;
}
.empty-buy-state { grid-column: 1 / -1; }
.player-chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.player-chip-list form { margin: 0; }

@media (max-width: 1100px) {
    .collection-filter-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .collection-view-compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .collection-summary-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

@media (max-width: 900px) {
    .collection-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .collection-view-compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .collection-filter-form { grid-template-columns: 1fr; }
    .collection-filter-actions > * { flex: 1; }
    .collection-control-row { align-items: stretch; display: grid; }
    .collection-view-switcher { justify-content: center; }
    .collection-view-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .collection-text-list { padding: 0; }
    .collection-detail-layout { grid-template-columns: 1fr; }
    .collection-images { grid-template-columns: 1fr 1fr; }
    .collection-detail-page .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .collection-detail-actions { align-items: stretch !important; display: grid !important; grid-template-columns: 1fr; }
    .collection-detail-actions > *,
    .collection-detail-actions button,
    .collection-detail-actions .button-link { width: 100%; }
    .money-grid { grid-template-columns: 1fr; }
    .import-preview { align-items: flex-start; flex-direction: column; }
    .import-preview img { max-width: 100%; }
    .buy-opportunity-grid { grid-template-columns: 1fr; }
    .search-card-form { grid-template-columns: 1fr; }
    .search-card-summary { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
    .lot-upload-layout,
    .lot-pricing-options,
    .lot-profit-grid { grid-template-columns: 1fr; }
    .lot-result-heading { display: grid; grid-template-columns: 1fr; }
    .lot-source-image-wrap { justify-items: stretch; }
    .lot-source-image { max-width: 100%; width: 100%; }
    .buy-filter-form,
    .add-player-form { grid-template-columns: 1fr; }
    .selected-player-search .page-heading-row { display: block; }
    .selected-player-grid { grid-template-columns: 1fr; max-height: 420px; }
}

@media (max-width: 480px) {
    .collection-view-compact { grid-template-columns: 1fr; }
    .collection-detail-page .summary-grid,
    .collection-images,
    .photo-upload-grid { grid-template-columns: 1fr; }
    .collection-detail-page .card,
    .collection-detail-page .summary-card { padding: 12px; }
}

.badge {
    border-radius: 999px;
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    padding: 5px 9px;
}

.badge-review {
    background: #FFF3CD;
    color: #7A4F01;
}

.badge-pricing-review {
    background: #FDECEC;
    color: #B3261E;
}

.pricing-review-row {
    background: #FFF7F7;
}

.pricing-review-warning {
    background: #FDECEC;
    border: 1px solid #E7A09A;
    border-radius: 8px;
    color: #8F1D17;
    padding: 10px;
}

.badge-ready {
    background: #FFF7D6;
    color: #705000;
}

.badge-live,
.badge-success {
    background: #E6F4EA;
    color: var(--ec-success);
}

.badge-ended {
    background: #ECEFF1;
    color: var(--ec-charcoal);
}

.marketplace-status-grid {
    display: grid;
    gap: 9px;
}

.marketplace-status-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.marketplace-status-inline {
    color: var(--ec-muted);
    font-size: 12px;
    margin-top: 5px;
}

.ready,
.status-ready {
    background: #FFF7D6;
    color: #705000;
}

.blocked,
.status-needs-review {
    background: #FFF3CD;
    color: #7A4F01;
}

.status-listed,
.published-row .status-badge {
    background: #E6F4EA;
    color: var(--ec-success);
}

.status-ended {
    background: #ECEFF1;
    color: var(--ec-charcoal);
}

.warning,
.oauth-not_ready,
.oauth-unknown {
    background: #FFF3CD;
    border: 1px solid #FFE08A;
    border-radius: 8px;
    color: #7A4F01;
    padding: 10px;
}

.oauth-ready {
    background: #E6F4EA;
    border: 1px solid #B7DFC2;
    border-radius: 8px;
    color: var(--ec-success);
    padding: 10px;
}

label {
    color: #282A2B;
    display: block;
    font-size: 13px;
    font-weight: 800;
    margin-top: 10px;
}

input,
select,
textarea {
    background: #FFFFFF;
    border: 1px solid #CCC6B8;
    border-radius: 8px;
    color: var(--ec-black);
    font: inherit;
    padding: 8px 10px;
    width: 100%;
}

textarea {
    min-height: 150px;
    resize: vertical;
}

table {
    background: var(--ec-card);
    border-collapse: separate;
    border-radius: 10px;
    border-spacing: 0;
    box-shadow: var(--ec-shadow);
    overflow: hidden;
    width: 100%;
}

th {
    background: var(--ec-black);
    color: #F8F1D1;
    font-size: 12px;
    letter-spacing: 0;
    text-transform: uppercase;
}

th,
td {
    border-bottom: 1px solid var(--ec-border);
    padding: 9px 10px;
    text-align: left;
    vertical-align: top;
}

tr:last-child td {
    border-bottom: 0;
}

img {
    border-radius: 8px;
}

details > summary {
    cursor: pointer;
    font-weight: 800;
}

.actions {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.actions form,
.batch-bar form {
    margin: 0;
}

.compact-meta {
    color: var(--ec-muted);
    font-size: 12px;
    line-height: 1.35;
}

.section-gap {
    margin-top: 14px;
}

.pricing-heading,
.saved-comp-row {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.pricing-heading form,
.saved-comp-row form {
    flex: 0 0 auto;
    margin: 0;
}

.pricing-recommendations {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 14px 0;
}

.price-choice {
    align-items: center;
    background: #FBFAF6;
    border: 1px solid var(--ec-border);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    text-align: center;
}

.price-choice strong {
    font-size: 24px;
}

.recommended-choice {
    border: 2px solid var(--ec-gold);
}

.pricing-summary {
    background: #FBFAF6;
    border-radius: 8px;
    padding: 10px;
}

.saved-comp-row {
    border-top: 1px solid var(--ec-border);
    padding: 8px 0;
}

.short-textarea {
    min-height: 80px;
}

.table-scroll {
    max-width: 100%;
    overflow-x: auto;
}

@media (max-width: 760px) {
    html,
    body {
        max-width: 100% !important;
        overflow-x: auto;
        width: 100% !important;
    }

    body {
        margin: 0 !important;
        padding: 0 12px 28px !important;
        touch-action: pan-x pan-y;
    }

    .page-shell {
        margin: 0;
        padding: 0 0 28px;
    }

    .collection-detail-page,
    .collection-intake-page {
        padding-left: 12px;
        padding-right: 12px;
    }

    .collection-detail-page .page-heading-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .collection-detail-page .page-heading-row .badge {
        align-self: flex-start;
    }

    .top-nav {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 6px !important;
        margin: 0 -12px 20px !important;
        padding: max(12px, env(safe-area-inset-top)) 12px 12px !important;
        width: auto !important;
    }

    .brand-title {
        grid-column: 1 / -1;
        margin: 0 0 4px !important;
        text-align: center;
    }

    .top-nav a,
    .top-nav-menu,
    .top-nav-menu summary,
    .top-nav-logout,
    .top-nav-logout button {
        min-height: 44px;
        width: 100%;
    }

    .top-nav a,
    .top-nav-menu summary,
    .top-nav-logout button {
        align-items: center;
        border: 1px solid rgba(212, 175, 55, 0.3);
        border-radius: 8px;
        display: flex;
        justify-content: center;
        padding: 9px 6px !important;
        text-align: center;
    }

    .top-nav-menu summary {
        display: flex;
        justify-content: center;
    }

    .top-nav-menu-options {
        left: 0;
        position: static;
        width: 100%;
    }

    .top-nav-menu-options a {
        display: flex;
        justify-content: center;
        text-align: center;
    }

    body > h1,
    body > p,
    body > .workflow-grid,
    body > .layout,
    body > .details,
    body > .box,
    body > .warning,
    body > table,
    body > form,
    body > .oauth-badge {
        margin-left: 0 !important;
        margin-right: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    h1 {
        font-size: 25px;
        overflow-wrap: anywhere;
    }

    .image-grid,
    .form-grid,
    .layout,
    .grid,
    .compact-grid,
    .dashboard-grid,
    .stats-grid,
    .two-column {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .pricing-recommendations {
        grid-template-columns: minmax(0, 1fr);
    }

    .pricing-heading,
    .saved-comp-row {
        align-items: stretch;
        flex-direction: column;
    }

    .pricing-heading form,
    .pricing-heading button,
    .saved-comp-row form,
    .saved-comp-row button {
        width: 100%;
    }

    input,
    select,
    textarea {
        font-size: 16px !important;
        max-width: 100% !important;
    }

    input[type="file"] {
        background: #FFFFFF;
        min-height: 48px;
        padding: 10px !important;
    }

    input[type="checkbox"],
    input[type="radio"] {
        min-height: auto;
        width: auto;
    }

    button,
    input[type="submit"],
    .button-link {
        min-height: 44px;
    }

    .actions,
    .batch-bar,
    .queue-actions {
        align-items: stretch !important;
        flex-direction: column !important;
    }

    .actions > form,
    .actions > a,
    .batch-bar > form,
    .queue-actions > form {
        width: 100%;
    }

    .actions button,
    .actions input[type="submit"],
    .actions .button-link,
    .batch-bar button,
    .queue-actions button {
        width: 100%;
    }

    table {
        display: block;
        max-width: none !important;
        min-width: max-content !important;
        overflow-x: auto !important;
        overflow-y: visible;
        overscroll-behavior-x: contain;
        scrollbar-color: #9b9278 #f4f1e8;
        scrollbar-width: thin;
        touch-action: pan-x pan-y;
        -webkit-overflow-scrolling: touch;
        width: max-content !important;
    }

    /* A table wrapper is the preferred independent touch-scroll surface. If
       an older page has an unwrapped table, the page itself remains pannable
       instead of clipping the table off-screen. */
    .table-scroll,
    table {
        scrollbar-gutter: stable;
    }

    .table-scroll {
        max-width: 100% !important;
        min-width: 0;
        overflow-x: auto !important;
        overflow-y: visible;
        overscroll-behavior-x: contain;
        scrollbar-color: #9b9278 #f4f1e8;
        scrollbar-width: thin;
        touch-action: pan-x pan-y;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    .table-scroll > table {
        display: table !important;
        max-width: none !important;
        min-width: max-content !important;
        overflow: visible !important;
        touch-action: pan-x pan-y;
        width: max-content !important;
    }

    th,
    td {
        min-width: 105px;
        white-space: normal;
        overflow-wrap: anywhere;
    }

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

    .table-scroll th:first-child,
    .table-scroll td:first-child {
        position: sticky;
        left: 0;
        z-index: 1;
    }

    .table-scroll th:first-child {
        background: var(--ec-black);
    }

    .table-scroll td:first-child {
        background: var(--ec-card);
    }

    .table-scroll tbody tr:nth-child(even) td:first-child {
        background: #FBFAF6;
    }

    pre,
    code {
        max-width: 100%;
        overflow-x: auto;
        white-space: pre-wrap;
        word-break: break-word;
    }

    img {
        height: auto;
        max-width: 100%;
    }

    .page-shell,
    .ready-page,
    main,
    section,
    .card,
    .box,
    .details,
    .panel,
    .layout,
    .page-heading-row,
    .collection-controls,
    .collection-grid,
    .collection-card,
    .editor-column,
    .image-column {
        min-width: 0;
        max-width: 100%;
    }

    .page-heading-row > *,
    .collection-control-row > *,
    .actions > *,
    .quick-actions > *,
    .sticky-action-bar > * {
        min-width: 0;
        max-width: 100%;
    }

    .page-heading-row a,
    .card-title-row a,
    td a,
    .muted,
    .warning,
    .success,
    .oauth-badge,
    .details,
    .box,
    .panel {
        overflow-wrap: anywhere;
    }

    button,
    input[type="submit"],
    .button-link {
        max-width: 100%;
        white-space: normal;
    }

    .preview-frame {
        max-height: none !important;
    }
}
