  body { font-family: system-ui, sans-serif; margin: 0; padding: 64px 16px 16px; background: var(--bg); color: var(--text); }
  a { color: var(--gold-bright); }
  h1 { font-size: 1.4rem; margin: 0 0 12px; }
  .card-box { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 16px; }
  .stats { display: flex; gap: 24px; flex-wrap: wrap; }
  .stat { font-size: 1.1rem; }
  .stat b { display: block; font-size: 1.4rem; }
  table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
  th, td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
  img.thumb { height: 64px; border-radius: 4px; }
  .foil { color: var(--gold-bright); font-weight: 600; }
  .normal { color: var(--text-dim); }
  .unmatched { color: var(--text-faint); font-style: italic; }
  input[type=file], input[type=number], input[type=text], input[type=email], input[type=password] { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 6px; }
  button, .btn { background: var(--gold); color: var(--on-gold); border: none; border-radius: 4px; padding: 8px 14px; cursor: pointer; font-size: 0.95rem; text-decoration: none; display: inline-block; font-weight: 600; }
  button.secondary, .btn.secondary { background: var(--surface-raised); color: var(--text); border: 1px solid var(--border); font-weight: normal; }
  form { margin: 0; }
  .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
  textarea { width: 100%; min-height: 200px; background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); border-radius: 4px; font-family: monospace; }
  .msg { background: var(--success-bg); border: 1px solid var(--success-border); padding: 8px 12px; border-radius: 4px; margin-bottom: 12px; }
  .review-banner { background: var(--warn-bg); border: 1px solid var(--warn-border); padding: 10px 12px; border-radius: 4px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
  .review-card { display: flex; gap: 12px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 6px; padding: 10px; margin-bottom: 10px; align-items: center; }
  .review-card img.thumb { height: 100px; }
  .review-card .fields { flex: 1; }
  .review-card label { margin-right: 14px; }
  .discard-row { color: var(--danger); }
  .binder-grid { display: grid; gap: 8px; }
  .slot {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    aspect-ratio: 5/7; border-radius: 6px; text-decoration: none; padding: 6px; text-align: center;
  }
  .slot.filled { background: var(--surface-alt); border: 1px solid var(--border); }
  .slot.filled img.thumb { height: auto; width: 100%; border-radius: 4px; margin-bottom: 4px; }
  .slot.empty { background: var(--surface-alt); border: 1px dashed var(--border-soft); color: var(--text-faint); }
  .slot-label { font-size: 0.68rem; color: var(--text-dim); line-height: 1.2; }
  .slot-empty-label { font-size: 0.75rem; line-height: 1.4; }
  .trend-row { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; }
  .trend-row .up, td.up, td .up { color: var(--success); }
  .trend-row .down, td.down, td .down { color: var(--danger); }
  .trend-row .flat { color: var(--text-dim); }
  .sparkline { flex-shrink: 0; color: var(--text-dim); }
  .sparkline.up { color: var(--success); }
  .sparkline.down { color: var(--danger); }
  .edit-col { display: none; }
  table.show-edit .edit-col { display: table-cell; }
  .qty-edit { display: flex; gap: 4px; align-items: center; }
  .qty-edit input { width: 3.5em; padding: 4px; }
  .qty-edit button { padding: 4px 9px; }
  .slot-wrap { position: relative; }
  .slot-wrap .qty-edit {
    position: absolute; top: 3px; right: 3px; z-index: 10;
    background: rgba(28,20,16,0.88); border-radius: 4px; padding: 2px; gap: 2px;
  }
  .slot-wrap .qty-edit input { width: 2.4em; padding: 2px; font-size: 0.75rem; }
  .slot-wrap .qty-edit button { padding: 2px 6px; font-size: 0.75rem; }

  .topbar {
    position: fixed; top: 0; left: 0; right: 0; height: 48px; box-sizing: border-box;
    display: flex; align-items: center; gap: 10px; padding: 0 8px 0 4px;
    background: var(--surface); border-bottom: 1px solid var(--border); z-index: 300;
  }
  .menu-btn {
    background: none; border: none; color: var(--text); font-size: 1.5rem; line-height: 1;
    cursor: pointer; padding: 6px 10px; border-radius: 4px;
  }
  .menu-btn:hover { background: var(--surface-raised); }
  .topbar-brand { color: var(--gold-bright); font-weight: 700; text-decoration: none; font-size: 1.05rem; }
  .currency-form { margin-left: auto; }
  .currency-form select {
    background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); border-radius: 4px;
    padding: 5px 6px; font-size: 0.85rem;
  }
  .topbar-icon-btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%; color: var(--text); margin-left: 10px; flex-shrink: 0;
  }
  .topbar-icon-btn:hover { background: var(--surface-raised); }
  .topbar-icon-btn svg { width: 19px; height: 19px; }
  .topbar-badge {
    position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; padding: 0 3px;
    border-radius: 8px; background: var(--danger); color: #fff; font-size: 0.65rem; font-weight: 700;
    line-height: 1; display: flex; align-items: center; justify-content: center; border: 2px solid var(--surface);
  }
  .side-menu {
    position: fixed; top: 0; left: 0; bottom: 0; width: 230px; box-sizing: border-box;
    background: var(--surface); border-right: 1px solid var(--border); z-index: 400;
    transform: translateX(-100%); transition: transform 0.2s ease;
    display: flex; flex-direction: column; padding-top: 48px; overflow-y: auto;
  }
  .side-menu.open { transform: translateX(0); }
  .side-menu a { color: var(--text); text-decoration: none; padding: 13px 18px; border-bottom: 1px solid var(--border-soft); }
  .side-menu a:hover, .side-menu a:active { background: var(--surface-raised); }
  .side-menu-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 350; display: none;
  }
  .side-menu-overlay.open { display: block; }

  #imgHoverPreview {
    position: fixed; display: none; z-index: 1000; pointer-events: none;
    border: 2px solid var(--gold); border-radius: 8px; background: var(--surface);
    box-shadow: 0 8px 30px rgba(0,0,0,0.6); padding: 4px;
  }
  #imgHoverPreview img { display: block; max-width: 320px; max-height: 440px; border-radius: 4px; }

  .chat-thread { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; padding: 4px; margin-bottom: 12px; }
  .chat-row { display: flex; }
  .chat-row.me { justify-content: flex-end; }
  .chat-row.them { justify-content: flex-start; }
  .chat-bubble { max-width: 75%; padding: 8px 12px; border-radius: 14px; font-size: 0.92rem; line-height: 1.4; }
  .chat-bubble.me { background: var(--gold); color: var(--on-gold); border-bottom-right-radius: 4px; }
  .chat-bubble.them { background: var(--surface-alt); color: var(--text); border-bottom-left-radius: 4px; }
  .chat-time { font-size: 0.68rem; opacity: 0.7; display: block; margin-top: 3px; }
  .chat-compose { display: flex; gap: 8px; align-items: flex-end; }
  .chat-compose textarea { flex: 1; min-height: 40px; max-height: 120px; resize: none; }
  .chat-compose button { flex: none; }

  /* Slide-in chat panel -- "Message seller" from Browse Market/deck-buy
     opens this instead of navigating away, so Back still lands on the
     listing you were looking at, not the messages inbox. Right-side
     mirror of the existing .side-menu (left) slide/overlay mechanics. */
  .chat-panel {
    position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 92vw; box-sizing: border-box;
    background: var(--surface); border-left: 1px solid var(--border); z-index: 450;
    transform: translateX(100%); transition: transform 0.2s ease;
    display: flex; flex-direction: column; padding: 58px 14px 14px;
  }
  .chat-panel.open { transform: translateX(0); }
  .chat-panel-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 440; display: none; }
  .chat-panel-overlay.open { display: block; }
  .chat-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
  .chat-panel-close { background: none; border: none; color: var(--text); font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 2px 8px; }
  .chat-panel-close:hover { background: var(--surface-raised); border-radius: 4px; }
  .chat-panel .chat-thread { flex: 1; max-height: none; }
  .chat-panel-loading { color: var(--text-dim); padding: 8px 0; }
  /* Same fragment renders both the panel and the standalone /messages/<handle>
     page (see _chat_panel_fragment_html) -- the close button only makes
     sense in the panel context. */
  .chat-standalone .chat-panel-close { display: none; }

  /* Marketplace browse -- layout patterns (pill search bar, chip filters,
     card grid) modeled after g2g.com's storefront, kept on this app's
     own dark Clow Card palette rather than copying their colors too. */
  .market-search-row { display: flex; gap: 10px; margin-bottom: 14px; }
  .market-search-input {
    flex: 1; border-radius: 24px; padding: 12px 20px; font-size: 1rem;
    background: var(--surface-alt); border: 1px solid var(--border); color: var(--text);
  }
  .market-search-row button { border-radius: 24px; padding: 0 26px; }
  .market-filter-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
  .market-filter-chips .chip {
    background: var(--surface-alt); border: 1px solid var(--border); border-radius: 20px;
    padding: 6px 14px; font-size: 0.85rem; display: flex; align-items: center; gap: 6px;
  }
  .market-filter-chips .chip input, .market-filter-chips .chip select {
    background: transparent; border: none; color: var(--text); font-size: 0.85rem; padding: 0; width: 4.5em;
  }
  .market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
  .market-card {
    background: var(--surface-alt); border: 1px solid var(--border); border-radius: 12px;
    padding: 12px; display: flex; flex-direction: column; gap: 6px;
  }
  .market-card img.thumb { width: 100%; height: auto; border-radius: 8px; }
  .market-card-name { font-weight: 600; font-size: 0.9rem; line-height: 1.3; }
  .market-card-price { font-size: 1.1rem; font-weight: 700; color: var(--gold-bright); }
  .market-card-seller { font-size: 0.78rem; color: var(--text-dim); text-decoration: none; }
  .market-card-seller:hover { text-decoration: underline; }
  .market-card .btn { border-radius: 20px; text-align: center; font-size: 0.8rem; padding: 8px 10px; margin-top: auto; }
