
  @import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600&family=DM+Sans:wght@300;400;500&display=swap');

  :root {
    --green: #111111;
    --green-mid: #1a1a1a;
    --green-light: #c9a84c;
    --green-pale: #f5f0e8;
    --felt: #0a0a0a;
    --gold: #c9a84c;
    --gold-light: #e8c96a;
    --gold-pale: #faf5e4;
    --ivory: #f9f6f0;
    --text: #1a1a1a;
    --text-mid: #4a4a4a;
    --text-muted: #888;
    --border: #d8d2c4;
    --border-light: #ebe7de;
    --chip-red: #c0392b;
    --chip-blue: #2563a0;
    --chip-black: #1a1a1a;
    --chip-green: #1d7a3d;
    --chip-white: #f0ede6;
    --chip-yellow: #d4a017;
    --chip-purple: #6b3fa0;
    --chip-orange: #d4641a;
    --chip-pink: #c0567a;
    --chip-grey: #6b7280;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }

  body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background: var(--ivory);
    color: var(--text);
    min-height: 100vh;
  }

  /* ---- HEADER ---- */
  header {
    background: var(--felt);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid var(--gold);
  }

  .header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 64px;
  }

  .logo {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.02em;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .logo-chip {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gold);
    border: 3px solid var(--gold-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--felt);
    font-weight: 700;
    flex-shrink: 0;
  }

  .header-nav {
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
  }

  .nav-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
  }

  .nav-btn.active {
    background: var(--gold);
    color: var(--felt);
  }

  .nav-btn:not(.active) {
    background: transparent;
    color: rgba(255,255,255,0.6);
  }

  .nav-btn:not(.active):hover {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.9);
  }

  /* ---- STATS BAR ---- */
  .stats-bar {
    background: var(--green);
    padding: 10px 0;
    border-bottom: 1px solid var(--green-mid);
  }

  .stats-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    gap: 2.5rem;
    align-items: center;
  }

  .stat-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .stat-label {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.45);
  }

  .stat-val {
    font-size: 16px;
    font-weight: 500;
    color: var(--gold-light);
  }

  .stat-divider {
    width: 1px;
    height: 28px;
    background: rgba(255,255,255,0.15);
  }

  /* ---- MAIN LAYOUT ---- */
  .page { display: none; }
  .page.active { display: block; }

  .layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    align-items: start;
  }

  /* ---- SIDEBAR / FILTERS ---- */
  .sidebar {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    position: sticky;
    top: 84px;
  }

  .sidebar-header {
    background: var(--green);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .sidebar-header h3 {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.7);
  }

  .clear-filters {
    font-size: 11px;
    color: var(--gold-light);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 2px 6px;
    border-radius: 4px;
  }

  .clear-filters:hover { background: rgba(255,255,255,0.1); }

  .filter-section {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
  }

  .filter-section:last-child { border-bottom: none; }

  .filter-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
  }

  .filter-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--ivory);
    outline: none;
    transition: border-color 0.15s;
  }

  .filter-input:focus { border-color: var(--green-light); }

  .filter-select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--ivory);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
  }

  .filter-select:focus { border-color: var(--green-light); outline: none; }

  .status-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }

  .status-pill {
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    background: white;
    color: var(--text-mid);
    font-family: inherit;
  }

  .status-pill.active-all { background: var(--green); color: white; border-color: var(--green); }
  .status-pill.active-in_collection { background: #1d6a3d; color: white; border-color: #1d6a3d; }
  .status-pill.active-for_sale { background: #c9a84c; color: #1a1a1a; border-color: #c9a84c; }
  .status-pill.active-for_trade { background: #2563a0; color: white; border-color: #2563a0; }
  .status-pill.active-sold { background: #888; color: white; border-color: #888; }
  .status-pill:not([class*="active"]):hover { background: var(--ivory); }

  .range-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  /* ---- MAIN CONTENT ---- */
  .main-content {}

  .toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
  }

  .result-count {
    font-size: 13px;
    color: var(--text-muted);
    margin-right: auto;
  }

  .sort-select {
    padding: 7px 30px 7px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: white;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
  }

  .view-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: white;
  }

  .view-btn {
    padding: 7px 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
    transition: all 0.15s;
    line-height: 1;
  }

  .view-btn.active {
    background: var(--green);
    color: white;
  }

  .add-btn {
    padding: 7px 14px;
    background: var(--gold);
    color: var(--felt);
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
  }

  .add-btn:hover { background: var(--gold-light); }

  /* ---- GRID VIEW ---- */
  .chips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
  }

  .chip-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  }

  .chip-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    border-color: var(--green-light);
  }

  .chip-img-area {
    aspect-ratio: 4/3;
    background: var(--green-pale);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .chip-img-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .chip-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }

  .chip-placeholder-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 4px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--border);
  }

  .chip-placeholder-text {
    font-size: 11px;
    color: var(--text-muted);
  }

  .chip-status-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .badge-in_collection { background: rgba(29,106,61,0.85); color: white; }
  .badge-for_sale { background: rgba(201,168,76,0.9); color: #1a1a1a; }
  .badge-for_trade { background: rgba(37,99,160,0.85); color: white; }
  .badge-sold { background: rgba(100,100,100,0.75); color: white; }

  .chip-count-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    background: rgba(15,35,24,0.8);
    color: rgba(255,255,255,0.9);
  }

  .chip-card-body {
    padding: 12px;
  }

  .chip-casino {
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .chip-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
  }

  .chip-tag {
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
  }

  .tag-denom { background: var(--gold-pale); color: #7a5a1a; }
  .tag-count { background: #e8f0e4; color: #2a5a3a; }
  .tag-cat { background: #f0f0f0; color: #555; }

  .chip-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
  }

  .chip-price {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-mid);
  }

  .chip-asking {
    font-size: 14px;
    font-weight: 600;
    color: var(--gold);
  }

  .chip-pcf-link {
    font-size: 11px;
    color: var(--green-light);
    text-decoration: none;
  }

  .chip-pcf-link:hover { text-decoration: underline; }

  /* ---- LIST VIEW ---- */
  .chips-list {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
  }

  .list-header {
    display: grid;
    grid-template-columns: 60px 1fr 80px 80px 60px 90px 80px 100px;
    gap: 0;
    padding: 10px 16px;
    background: var(--green);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.55);
  }

  .list-row {
    display: grid;
    grid-template-columns: 60px 1fr 80px 80px 60px 90px 80px 100px;
    gap: 0;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    align-items: center;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 13px;
  }

  .list-row:last-child { border-bottom: none; }
  .list-row:hover { background: var(--ivory); }

  .list-casino { font-weight: 500; color: var(--text); }
  .list-denom { color: var(--text-mid); }
  .list-count { color: var(--text-mid); }
  .list-paid { color: var(--text-muted); font-size: 12px; }
  .list-ppc { color: var(--text-mid); }
  .list-pcf { color: var(--green-light); font-size: 11px; }

  /* ---- CHIP DETAIL MODAL ---- */
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
  }

  .modal-overlay.open { display: flex; }

  .modal {
    background: white;
    border-radius: 14px;
    max-width: 860px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    display: grid;
    grid-template-columns: 340px 1fr;
  }

  .modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.15s;
  }

  .modal-close:hover { background: var(--ivory); color: var(--text); }

  .modal-photos {
    background: var(--green-pale);
    border-radius: 14px 0 0 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .modal-main-photo {
    flex: 1;
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
  }

  .modal-main-photo img {
    max-width: 100%;
    max-height: 260px;
    object-fit: contain;
    border-radius: 8px;
  }

  .modal-no-photo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
  }

  .modal-no-photo-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
  }

  .modal-photo-thumbs {
    display: flex;
    gap: 6px;
    padding: 12px;
    overflow-x: auto;
    background: rgba(0,0,0,0.05);
    min-height: 64px;
    align-items: center;
  }

  .photo-thumb {
    width: 52px;
    height: 52px;
    border-radius: 6px;
    object-fit: cover;
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s;
  }

  .photo-thumb.active { border-color: var(--gold); }

  .add-photo-btn {
    width: 52px;
    height: 52px;
    border-radius: 6px;
    border: 2px dashed var(--border);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all 0.15s;
  }

  .add-photo-btn:hover { border-color: var(--green-light); color: var(--green-light); }

  .modal-info {
    padding: 1.5rem;
    overflow-y: auto;
  }

  .modal-casino-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 4px;
  }

  .modal-cat {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
  }

  .modal-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
  }

  .modal-tag {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
  }

  .modal-tag.denom { background: var(--gold-pale); color: #7a5a1a; }
  .modal-tag.count { background: var(--green-pale); color: #1a1a1a; }
  .modal-tag.status-in_collection { background: #e8f5ee; color: #1d6a3d; }
  .modal-tag.status-for_sale { background: var(--gold-pale); color: #7a5a1a; }
  .modal-tag.status-for_trade { background: #e8f0fa; color: #1a4a80; }
  .modal-tag.status-sold { background: #f0f0f0; color: #666; }

  .modal-section {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
  }

  .modal-section:last-child { border-bottom: none; margin-bottom: 0; }

  .modal-section-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
  }

  .modal-field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .modal-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .modal-field-key {
    font-size: 11px;
    color: var(--text-muted);
  }

  .modal-field-val {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
  }

  .modal-link {
    font-size: 12px;
    color: var(--green-light);
    text-decoration: none;
    word-break: break-all;
    display: block;
  }

  .modal-link:hover { text-decoration: underline; }

  .modal-notes-text {
    font-size: 13px;
    color: var(--text-mid);
    line-height: 1.5;
  }

  .modal-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
  }

  .action-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    color: var(--text-mid);
    transition: all 0.15s;
    text-align: center;
    min-width: 80px;
  }

  .action-btn:hover { background: var(--ivory); border-color: var(--green-light); color: var(--green); }
  .action-btn.primary { background: var(--gold); color: var(--felt); border-color: var(--gold); }
  .action-btn.primary:hover { background: var(--gold-light); }
  .action-btn.danger { color: #c0392b; }
  .action-btn.danger:hover { border-color: #c0392b; background: #fff5f5; }

  /* ---- STATUS EDIT INLINE ---- */
  .status-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }

  .status-opt {
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    background: white;
    transition: all 0.15s;
  }

  .status-opt:hover { border-color: var(--green-light); }
  .status-opt.sel-in_collection { background: #1d6a3d; color: white; border-color: #1d6a3d; }
  .status-opt.sel-for_sale { background: var(--gold); color: var(--felt); border-color: var(--gold); }
  .status-opt.sel-for_trade { background: #2563a0; color: white; border-color: #2563a0; }
  .status-opt.sel-sold { background: #888; color: white; border-color: #888; }

  /* ---- ADD/EDIT FORM MODAL ---- */
  .form-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 300;
    align-items: center;
    justify-content: center;
    padding: 1rem;
  }

  .form-modal.open { display: flex; }

  .form-box {
    background: white;
    border-radius: 14px;
    max-width: 620px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
  }

  .form-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--green);
  }

  .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
  }

  .form-full { grid-column: 1 / -1; }

  .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .form-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--ivory);
    outline: none;
    transition: border-color 0.15s;
  }

  .form-group input:focus,
  .form-group select:focus,
  .form-group textarea:focus { border-color: var(--green-light); }

  .form-group textarea { resize: vertical; min-height: 80px; }

  .form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
  }

  .btn-cancel {
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: white;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-mid);
  }

  .btn-save {
    padding: 8px 24px;
    border: none;
    border-radius: 7px;
    background: var(--gold);
    color: var(--felt);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
  }

  .btn-save:hover { background: var(--gold-light); }

  /* ---- SHOP PAGE ---- */
  .shop-hero {
    background: var(--felt);
    padding: 3rem 2rem;
    text-align: center;
    border-bottom: 2px solid var(--gold);
  }

  .shop-hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    color: var(--gold);
    margin-bottom: 8px;
  }

  .shop-hero p {
    font-size: 14px;
    color: rgba(255,255,255,0.55);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.6;
  }

  .shop-filter-bar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 14px 2rem;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    max-width: 100%;
  }

  .shop-grid-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
  }

  .shop-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
  }

  .shop-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    border-color: var(--gold);
  }

  .shop-img {
    aspect-ratio: 1;
    background: var(--green-pale);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
  }

  .shop-img img { width: 100%; height: 100%; object-fit: cover; }

  .shop-for-sale-ribbon {
    position: absolute;
    top: 12px;
    left: -6px;
    background: var(--gold);
    color: var(--felt);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 12px 4px 10px;
    border-radius: 0 4px 4px 0;
  }

  .shop-for-trade-ribbon {
    position: absolute;
    top: 12px;
    left: -6px;
    background: #2563a0;
    color: white;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 12px 4px 10px;
    border-radius: 0 4px 4px 0;
  }

  .shop-card-body {
    padding: 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .shop-casino {
    font-family: 'Playfair Display', serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.3;
  }

  .shop-details {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    flex: 1;
  }

  .shop-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
  }

  .shop-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--gold);
  }

  .shop-count { font-size: 12px; color: var(--text-muted); }

  .shop-enquire-btn {
    padding: 6px 14px;
    background: var(--green);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
  }

  .shop-enquire-btn:hover { background: var(--green-light); }

  .empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
  }

  .empty-state h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: var(--text-mid);
    margin-bottom: 8px;
  }

  /* ---- WANT LIST ---- */
  .want-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
  }

  .want-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
  }

  .want-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--green);
  }

  .want-list-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1.5rem;
  }

  .want-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .want-item-casino {
    font-weight: 500;
    font-size: 14px;
    flex: 1;
  }

  .want-item-details {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 80px;
  }

  .want-item-priority {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
  }

  .priority-high { background: #ffeaea; color: #c0392b; }
  .priority-med { background: var(--gold-pale); color: #7a5a1a; }
  .priority-low { background: var(--green-pale); color: #1a1a1a; }

  .want-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s;
  }

  .want-remove:hover { background: #fff5f5; color: #c0392b; }

  .add-want-form {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
  }

  .add-want-form h3 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
  }

  .want-form-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 8px;
    align-items: end;
  }

  .want-form-row input,
  .want-form-row select {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
  }

  .want-form-row button {
    padding: 8px 16px;
    background: var(--gold);
    color: var(--felt);
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
  }

  /* ---- PAGINATION ---- */
  .pagination {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
  }

  .page-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-mid);
    transition: all 0.15s;
    min-width: 36px;
    text-align: center;
  }

  .page-btn.active { background: var(--green); color: white; border-color: var(--green); }
  .page-btn:hover:not(.active) { background: var(--ivory); }
  .page-btn:disabled { opacity: 0.4; cursor: default; }

  /* ---- HIDDEN FILE INPUT ---- */
  #file-input { display: none; }


  .cg-result {
    display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px;
    background: var(--ivory); border: 1px solid var(--border); border-radius: 7px;
    margin-bottom: 6px; cursor: pointer; transition: border-color 0.15s;
  }
  .cg-result:hover { border-color: var(--green-light); }
  .cg-result-img { width: 44px; height: 44px; border-radius: 4px; object-fit: contain; flex-shrink: 0; background: white; }
  .cg-result-info { flex: 1; min-width: 0; }
  .cg-result-name { font-size: 13px; font-weight: 500; color: var(--text); }
  .cg-result-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
  .cg-result-use { font-size: 11px; color: var(--green-light); font-weight: 500; flex-shrink: 0; }
  .cg-searching { font-size: 12px; color: var(--text-muted); font-style: italic; padding: 4px 0; }

  .photo-upload-area {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--ivory);
  }

  .photo-upload-area:hover { border-color: var(--green-light); background: var(--green-pale); }

  /* ---- TOAST ---- */
  .toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--green);
    color: white;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    border-left: 3px solid var(--gold);
  }

  .toast.show { transform: translateY(0); opacity: 1; }



  /* ---- HOLDINGS VIEW ---- */
  .holdings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
  }

  .holding-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.15s, border-color 0.15s;
  }

  .holding-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.07); }

  .holding-header {
    padding: 12px 14px 10px;
    cursor: pointer;
    user-select: none;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    align-items: start;
  }

  .holding-header:hover { background: var(--ivory); }

  .holding-casino {
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
  }

  .holding-denom {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
  }

  .holding-total {
    text-align: right;
    grid-row: 1 / 3;
    grid-column: 2;
  }

  .holding-count {
    font-size: 22px;
    font-weight: 600;
    color: var(--green);
    line-height: 1;
  }

  .holding-count-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .holding-pills {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    padding: 0 14px 10px;
  }

  .holding-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-top: 1px solid var(--border-light);
    background: var(--ivory);
  }

  .holding-cost {
    font-size: 11px;
    color: var(--text-muted);
  }

  .holding-expand-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: var(--green-light);
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    padding: 0;
    transition: color 0.15s;
  }

  .holding-expand-btn:hover { color: var(--green); }

  .holding-arrow {
    font-size: 9px;
    transition: transform 0.2s;
    display: inline-block;
  }

  .holding-arrow.open { transform: rotate(180deg); }

  /* Transactions drawer */
  .holding-txns {
    display: none;
    border-top: 1px solid var(--border-light);
  }

  .holding-txns.open { display: block; }

  .txn-row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 0 8px;
    align-items: center;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-light);
    font-size: 12px;
    transition: background 0.1s;
  }

  .txn-row:last-child { border-bottom: none; }
  .txn-row:hover { background: var(--ivory); }

  .txn-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--green-pale);
    color: var(--green);
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .txn-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
  }

  .txn-main {
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .txn-sub {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .txn-links {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
  }

  .txn-link {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.15s;
    flex-shrink: 0;
  }

  .txn-link:hover { border-color: var(--green-light); color: var(--green); background: var(--green-pale); }
  .txn-link.pcf { color: var(--green-light); }
  .txn-link.cg { color: var(--gold); }
  .txn-link.open-chip { color: var(--text-mid); }


  /* ---- SCAN MODAL ---- */
  .scan-modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    z-index: 400; align-items: center; justify-content: center; padding: 1rem;
  }
  .scan-modal-overlay.open { display: flex; }
  .scan-modal {
    background: white; border-radius: 14px; max-width: 680px; width: 100%;
    max-height: 92vh; overflow-y: auto; position: relative; padding: 2rem;
  }
  .scan-title {
    font-family: 'Playfair Display', serif; font-size: 1.3rem; color: var(--green);
    margin-bottom: 1.25rem;
  }
  .scan-drop-zone {
    border: 2px dashed var(--border); border-radius: 10px; padding: 2.5rem 1.5rem;
    text-align: center; cursor: pointer; transition: all 0.2s; background: var(--ivory);
    position: relative;
  }
  .scan-drop-zone:hover, .scan-drop-zone.drag-over {
    border-color: var(--green-light); background: var(--green-pale);
  }
  .scan-drop-zone input[type=file] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
  }
  .scan-drop-icon { font-size: 36px; margin-bottom: 8px; }
  .scan-drop-text { font-size: 14px; color: var(--text-mid); }
  .scan-drop-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

  .scan-preview {
    display: none; margin-top: 1.25rem; gap: 1.25rem;
    grid-template-columns: 200px 1fr;
  }
  .scan-preview.visible { display: grid; }
  .scan-preview-img {
    width: 200px; height: 200px; border-radius: 10px; object-fit: contain;
    background: var(--green-pale); border: 1px solid var(--border);
  }
  .scan-results { display: flex; flex-direction: column; gap: 10px; }

  .scan-status {
    font-size: 13px; color: var(--text-muted); font-style: italic;
    padding: 8px 0; display: flex; align-items: center; gap: 8px;
  }
  .scan-spinner {
    width: 14px; height: 14px; border: 2px solid var(--border);
    border-top-color: var(--green); border-radius: 50%;
    animation: spin 0.8s linear infinite; flex-shrink: 0;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  .scan-field-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  }
  .scan-field { display: flex; flex-direction: column; gap: 3px; }
  .scan-field label {
    font-size: 10px; font-weight: 500; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--text-muted);
  }
  .scan-field input, .scan-field select {
    padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; font-family: inherit; outline: none; background: white;
    transition: border-color 0.15s;
  }
  .scan-field input:focus, .scan-field select:focus { border-color: var(--green-light); }
  .scan-field-full { grid-column: 1 / -1; }

  .color-swatch {
    width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border);
    display: inline-block; vertical-align: middle; margin-right: 6px; flex-shrink: 0;
  }
  .color-match-row {
    display: flex; align-items: center; gap: 6px; padding: 6px 10px;
    background: var(--ivory); border-radius: 6px; border: 1px solid var(--border-light);
    font-size: 12px;
  }
  .color-match-name { font-weight: 500; color: var(--text); }
  .color-match-hex { color: var(--text-muted); font-family: monospace; font-size: 11px; }
  .color-match-dist { margin-left: auto; color: var(--text-muted); font-size: 11px; }

  .scan-actions {
    display: flex; gap: 8px; margin-top: 1.25rem;
    padding-top: 1rem; border-top: 1px solid var(--border-light);
  }

  /* ---- SETS PAGE ---- */
  .sets-layout { max-width: 1200px; margin: 0 auto; padding: 1.5rem 2rem; }

  .sets-toolbar {
    display: flex; align-items: center; gap: 10px; margin-bottom: 1.25rem; flex-wrap: wrap;
  }

  .sets-toolbar h2 {
    font-family: 'Playfair Display', serif; font-size: 1.3rem; color: var(--green); margin-right: auto;
  }

  .set-type-tabs { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; background: white; }

  .set-tab {
    padding: 7px 16px; border: none; background: transparent; cursor: pointer;
    font-size: 13px; font-weight: 500; font-family: inherit; color: var(--text-muted);
    transition: all 0.15s; border-right: 1px solid var(--border);
  }
  .set-tab:last-child { border-right: none; }
  .set-tab.active { background: var(--green); color: white; }
  .set-tab:not(.active):hover { background: var(--ivory); }

  .sets-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.25rem;
  }

  .set-card {
    background: white; border: 1px solid var(--border); border-radius: 12px;
    overflow: hidden; transition: all 0.2s; cursor: pointer;
  }
  .set-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.08); border-color: var(--gold); transform: translateY(-1px); }

  .set-card-header {
    padding: 0;
    position: relative;
    background: var(--green-pale);
    min-height: 160px;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
  }

  .set-card-header img { width: 100%; height: 160px; object-fit: cover; }

  .set-type-ribbon {
    position: absolute; top: 10px; left: -4px;
    padding: 3px 10px 3px 8px; border-radius: 0 4px 4px 0;
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  }
  .ribbon-playable { background: var(--green); color: white; }
  .ribbon-mixed { background: var(--gold); color: var(--felt); }

  .set-status-badge {
    position: absolute; top: 10px; right: 10px;
    padding: 3px 8px; border-radius: 12px; font-size: 10px; font-weight: 500;
  }

  .set-chip-strip {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.45));
    padding: 20px 12px 8px;
    display: flex; gap: 4px; flex-wrap: wrap;
  }

  .set-denom-pill {
    padding: 2px 7px; border-radius: 10px; font-size: 10px; font-weight: 600;
    background: rgba(255,255,255,0.9); color: var(--text);
  }

  .set-placeholder-icon {
    font-size: 48px; color: var(--border); display: flex; flex-direction: column;
    align-items: center; gap: 6px;
  }

  .set-card-body { padding: 14px 16px; }

  .set-name {
    font-family: 'Playfair Display', serif; font-size: 1rem; font-weight: 600;
    color: var(--text); margin-bottom: 4px; line-height: 1.3;
  }

  .set-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; }

  .set-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 10px; border-top: 1px solid var(--border-light);
  }

  .set-price { font-size: 15px; font-weight: 600; color: var(--gold); }
  .set-chip-count { font-size: 12px; color: var(--text-muted); }

  /* Set detail modal */
  .set-modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    z-index: 200; align-items: center; justify-content: center; padding: 1rem;
  }
  .set-modal-overlay.open { display: flex; }

  .set-modal {
    background: white; border-radius: 14px; max-width: 900px; width: 100%;
    max-height: 92vh; overflow-y: auto; position: relative;
  }

  .set-modal-top {
    display: grid; grid-template-columns: 380px 1fr;
  }

  .set-modal-photos {
    background: var(--green-pale); border-radius: 14px 0 0 0; overflow: hidden;
    display: flex; flex-direction: column; min-height: 280px;
  }

  .set-modal-main-img {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 1.5rem; min-height: 220px; position: relative;
  }
  .set-modal-main-img img { max-width: 100%; max-height: 240px; object-fit: contain; border-radius: 8px; }

  .set-modal-thumbs {
    display: flex; gap: 6px; padding: 10px; background: rgba(0,0,0,0.05);
    overflow-x: auto; min-height: 58px; align-items: center;
  }

  .set-modal-info { padding: 1.5rem; }

  .set-modal-title {
    font-family: 'Playfair Display', serif; font-size: 1.35rem; font-weight: 600;
    color: var(--text); margin-bottom: 4px;
  }

  .set-modal-chips-section {
    border-top: 1px solid var(--border-light); padding: 1.25rem 1.5rem;
  }

  .set-chips-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-top: 10px;
  }

  .set-chip-row {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    background: var(--ivory); border-radius: 7px; border: 1px solid var(--border-light);
    cursor: pointer; transition: border-color 0.15s;
  }
  .set-chip-row:hover { border-color: var(--green-light); }

  .set-chip-thumb {
    width: 36px; height: 36px; border-radius: 50%; background: var(--green-pale);
    overflow: hidden; flex-shrink: 0; display: flex; align-items: center;
    justify-content: center; font-size: 14px; color: var(--border);
  }
  .set-chip-thumb img { width: 100%; height: 100%; object-fit: cover; }

  .set-chip-info { flex: 1; min-width: 0; }
  .set-chip-casino { font-size: 12px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .set-chip-denom { font-size: 11px; color: var(--text-muted); }

  .remove-chip-from-set {
    background: none; border: none; cursor: pointer; color: var(--text-muted);
    font-size: 14px; padding: 2px 4px; border-radius: 3px; opacity: 0.5; transition: all 0.15s;
  }
  .remove-chip-from-set:hover { opacity: 1; color: #c0392b; }

  /* Add-chip-to-set picker */
  .chip-picker-search {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; font-family: inherit; outline: none; margin-bottom: 8px;
  }
  .chip-picker-list {
    max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px;
    background: white;
  }
  .chip-picker-item {
    padding: 8px 12px; cursor: pointer; font-size: 13px; display: flex;
    align-items: center; gap: 8px; border-bottom: 1px solid var(--border-light);
    transition: background 0.1s;
  }
  .chip-picker-item:last-child { border-bottom: none; }
  .chip-picker-item:hover { background: var(--green-pale); }
  .chip-picker-item.already-in { opacity: 0.4; cursor: default; }

  /* Set form modal */
  .set-form-modal {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    z-index: 300; align-items: center; justify-content: center; padding: 1rem;
  }
  .set-form-modal.open { display: flex; }

  .set-form-box {
    background: white; border-radius: 14px; max-width: 560px; width: 100%;
    max-height: 90vh; overflow-y: auto; padding: 2rem; position: relative;
  }

  /* Inventory grouping toggle */
  .group-toggle-bar {
    display: flex; align-items: center; gap: 8px; margin-bottom: 1rem;
    padding: 10px 14px; background: var(--gold-pale); border-radius: 8px;
    border: 1px solid #e8d8a0;
  }
  .group-toggle-bar label { font-size: 13px; font-weight: 500; color: #7a5a1a; cursor: pointer; }

  .casino-group-header {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    background: var(--green); color: white; border-radius: 8px; cursor: pointer;
    margin-bottom: 6px; margin-top: 8px; user-select: none;
  }
  .casino-group-header:first-child { margin-top: 0; }
  .casino-group-name { font-family: 'Playfair Display', serif; font-size: 14px; font-weight: 600; flex: 1; }
  .casino-group-meta { font-size: 12px; color: rgba(255,255,255,0.6); }
  .casino-group-arrow { font-size: 12px; color: rgba(255,255,255,0.7); transition: transform 0.2s; }
  .casino-group-arrow.open { transform: rotate(180deg); }
  .casino-group-chips { display: none; margin-bottom: 8px; }
  .casino-group-chips.open { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; padding: 0 4px; }

  @media (max-width: 700px) {
    .set-modal-top { grid-template-columns: 1fr; }
    .set-modal-photos { border-radius: 14px 14px 0 0; }
    .sets-grid { grid-template-columns: 1fr; }
  }

  /* Responsive */
  @media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .modal { grid-template-columns: 1fr; }
    .modal-photos { border-radius: 14px 14px 0 0; }
    .list-header, .list-row { grid-template-columns: 1fr 60px 60px 80px; }
    .list-header span:nth-child(n+5), .list-row span:nth-child(n+5) { display: none; }
  }


/* ============================================================
   MOBILE FIXES - appended
   ============================================================ */

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

* { box-sizing: border-box; }

@media (max-width: 768px) {
  .logo-text { display: none !important; }

  /* Holdings: single column */
  .holdings-grid {
    grid-template-columns: 1fr !important;
  }

  /* Toolbar: wrap, compact buttons */
  .toolbar {
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 8px;
  }
  .result-count { order: -1; width: 100%; font-size: 12px; }
  .sort-select { flex: 1; min-width: 0; font-size: 12px; max-width: 160px; }
  .btn-label { display: none; }
  #scan-btn, #add-btn { padding: 7px 10px; font-size: 15px; }

  /* Layout */
  .layout {
    grid-template-columns: 1fr !important;
    padding: 0.75rem !important;
    gap: 0.75rem !important;
  }

  .sidebar { position: static !important; width: 100% !important; }

  /* Stats */
  .stats-inner {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    padding: 8px 0.75rem !important;
    gap: 1rem !important;
    -webkit-overflow-scrolling: touch;
  }
  .stat-divider { display: none !important; }
  .stat-item { flex-shrink: 0; }
  .stat-val { font-size: 14px; }
  .stat-label { font-size: 9px; }

  /* Chips grid */
  .chips-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
  }

  /* Modals slide up from bottom */
  .modal-overlay,
  .form-modal,
  .scan-modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .modal,
  .form-box,
  .scan-modal {
    border-radius: 14px 14px 0 0 !important;
    max-height: 90vh !important;
    overflow-y: auto;
  }
  .modal { grid-template-columns: 1fr !important; }
  .modal-photos { border-radius: 14px 14px 0 0 !important; min-height: 200px; }
  .form-grid { grid-template-columns: 1fr !important; }
  .form-full { grid-column: 1 !important; }

  /* Sets */
  .sets-grid { grid-template-columns: 1fr !important; }
  .sets-layout { padding: 0.75rem !important; }
  .sets-toolbar { flex-wrap: wrap; gap: 8px; }

  /* Want list */
  .want-page { padding: 0.75rem !important; }
  .want-form-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 6px;
  }
  .want-form-row button { grid-column: 1 / -1; }

  /* Marketplace */
  .mp-filter-bar {
    padding: 10px 0.75rem !important;
    gap: 6px !important;
  }
  .mp-grid-container { padding: 0.75rem !important; }
}

@media (max-width: 480px) {
  .chips-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 768px) {
  .sidebar-filters-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-mid);
    margin-bottom: 6px;
    user-select: none;
  }
  .sidebar-filters-toggle:hover { background: var(--ivory); }
  .sidebar-filters-toggle-arrow { font-size: 10px; color: var(--text-muted); transition: transform 0.2s; }
  .sidebar-filters-toggle-arrow.open { transform: rotate(180deg); }

  .sidebar-collapsible { display: none; }
  .sidebar-collapsible.open { display: block; }

  /* Search always visible — move it outside collapse */
  .sidebar-search-always { display: block; }
}

@media (min-width: 769px) {
  .sidebar-filters-toggle { display: none; }
  .sidebar-collapsible { display: block !important; }
  .sidebar-search-always { display: none; }
}

/* ── MARKETPLACE MODALS ──────────────────────────────────────── */
.listing-modal-overlay,
.offer-modal-overlay,
.publish-modal-overlay,
.profile-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.listing-modal-overlay.open,
.offer-modal-overlay.open,
.publish-modal-overlay.open,
.profile-modal-overlay.open {
  display: flex;
}

#listing-modal-content {
  background: white;
  border-radius: 14px;
  max-width: 860px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
}

#offer-modal-content,
#publish-modal-content,
#profile-modal-content {
  background: white;
  border-radius: 14px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

/* ── MARKETPLACE PAGE ────────────────────────────────────────── */
.mp-loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-style: italic;
}

.mp-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.mp-empty h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--text-mid);
  margin-bottom: 8px;
}

.mp-filter-bar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 12px 2rem;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.mp-grid-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
}

.publish-btn {
  padding: 5px 12px;
  background: var(--gold);
  color: var(--felt);
  border: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}

.publish-btn:hover { background: var(--gold-light); }

.profile-btn {
  padding: 5px 10px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,0.6);
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}

.profile-btn:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

@media (max-width: 768px) {
  #listing-modal-content {
    border-radius: 14px 14px 0 0;
    max-height: 92vh;
  }
  #offer-modal-content,
  #publish-modal-content,
  #profile-modal-content {
    border-radius: 14px 14px 0 0;
  }
  .listing-modal-overlay,
  .offer-modal-overlay,
  .publish-modal-overlay,
  .profile-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
}
