/* ════════════════════════════════════════════════════════════════════════
   Comp — views.css · new chrome + Sets / Collections / Markets / Settings
   Inherits all tokens from styles.css (works across all 3 directions).
   ════════════════════════════════════════════════════════════════════════ */

/* ── utilities ── */
.hide-sm, .hide-md { }
.btn-sm { padding: 10px 16px; font-size: 13px; border-radius: 11px; }
.danger:hover { color: var(--neg); border-color: var(--neg); }

/* ── tweakable button shape + spacing scale (driven by Tweaks panel) ── */
.btn-primary, .btn-ghost, .btn-sm { border-radius: var(--btn-radius, 14px); }
.dashboard { gap: calc(16px * var(--sp, 1)); }
.grid2 { gap: calc(16px * var(--sp, 1)); }
.tiles, .inv-summary { gap: calc(14px * var(--sp, 1)); }
.setgrid { gap: calc(14px * var(--sp, 1)); }
.ladder__grid { gap: calc(12px * var(--sp, 1)); }
.section-intro { margin-bottom: calc(20px * var(--sp, 1)); }

/* ── Tweaks panel ── */
.tweaks {
  position: fixed; right: 18px; bottom: 18px; z-index: 600; width: 320px; max-width: calc(100vw - 24px);
  max-height: min(82vh, 720px); display: none; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.tweaks.open { display: flex; animation: pop .2s cubic-bezier(.3,1.2,.5,1); }
.tweaks__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 15px 16px; border-bottom: 1px solid var(--hairline); background: var(--surface-2); user-select: none; }
.tweaks__title { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.tweaks__sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.tweaks__x { width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); cursor: pointer; font-size: 13px; }
.tweaks__x:hover { color: var(--ink); }
.tweaks__body { padding: 14px 16px 16px; overflow-y: auto; }
.tw-sec { margin-bottom: 15px; }
.tw-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; }
.tw-hint { font-weight: 500; color: var(--muted); font-size: 11px; }
.tw-val { font-family: var(--font-mono); font-weight: 700; color: var(--accent-2); margin-left: auto; }
.tw-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tw-chip { font-family: var(--font-ui); font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 7px 11px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: .14s; }
.tw-chip:hover { color: var(--ink); border-color: var(--accent-line); }
.tw-chip.is-active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }
.tw-chip__sw { width: 11px; height: 11px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(128,128,128,.3); }
.tw-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.tw-sw { width: 30px; height: 30px; border-radius: 9px; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); transition: transform .12s; }
.tw-sw:hover { transform: scale(1.08); }
.tw-sw.is-active { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent-line); }
.tw-range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: var(--raise); outline: none; }
.tw-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); cursor: pointer; box-shadow: 0 2px 6px -1px rgba(0,0,0,.5); }
.tw-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); cursor: pointer; }
.tw-reset { width: 100%; margin-top: 4px; font-family: var(--font-ui); font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; cursor: pointer; transition: .14s; }
.tw-reset:hover { color: var(--ink); border-color: var(--accent-line); }
@media (max-width: 520px) { .tweaks { right: 12px; left: 12px; bottom: 12px; width: auto; } }

/* ── last sale / sale-type tags (shared across every tab) ── */
.saletag { font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .02em; padding: 1px 6px; border-radius: 5px; white-space: nowrap; }
.saletag--auc { color: var(--accent-2); background: var(--accent-soft); }
.saletag--bin { color: var(--pos); background: var(--pos-soft); }
.saletag--bo  { color: var(--gold); background: var(--gold-soft); }
.ls-seller { color: var(--ink-2); font-weight: 600; }
.ls-date { color: var(--muted); }
.ls-dot { opacity: .4; margin: 0 6px; }
.ls-none { color: var(--faint); }

.spotlight__last { margin-top: 12px; font-size: 13px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.spotlight__last b { font-family: var(--font-mono); color: var(--ink); font-weight: 700; }

.setcard__last { display: flex; align-items: center; gap: 6px; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--hairline); font-size: 11px; color: var(--muted); }
.setcard__last .ls-seller { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.setcard__lastp { font-family: var(--font-mono); font-weight: 700; color: var(--ink-2); }

.coll-last { white-space: nowrap; }
.coll-last__p { font-family: var(--font-mono); font-weight: 700; font-size: 13px; margin-right: 6px; }
.coll-last__s { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }

/* ── theme direction menu ── */
.theme-wrap { position: relative; }
.theme-toggle__caret { width: 12px; height: 12px; color: var(--muted); margin-left: -2px; }
.thmenu {
  position: absolute; top: calc(100% + 8px); right: 0; width: 244px; z-index: 200;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 7px; display: none;
}
.thmenu.open { display: block; animation: pop .18s cubic-bezier(.3,1.2,.5,1); }
.thmenu__title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 7px 9px 4px; }
.thmenu__item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 9px; border: none; background: none; border-radius: calc(var(--r) - 4px); cursor: pointer; text-align: left; transition: background .14s; }
.thmenu__item:hover { background: var(--surface-2); }
.thmenu__item.is-active { background: var(--accent-soft); }
.thmenu__sw { width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(128,128,128,.3); }
.thmenu__txt { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.thmenu__txt b { font-family: var(--font-ui); font-weight: 700; font-size: 14px; color: var(--ink); }
.thmenu__txt small { font-size: 11px; color: var(--muted); }
.thmenu__check { color: var(--accent-2); font-weight: 800; }

/* ── inputs / selects shared by views ── */
.sel, .inp {
  -webkit-appearance: none; appearance: none;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink);
  border-radius: 11px; padding: 11px 13px; font-family: inherit; font-size: 14px; font-weight: 600;
  transition: border-color .15s, box-shadow .15s;
}
.sel { padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2376767f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.sel--lg { min-width: 220px; font-size: 15px; }
.inp::placeholder { color: var(--faint); font-weight: 500; }
.sel:focus, .inp:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }

/* ── refine / filter bar (Search) ── */
.refinebar { padding: 12px 14px; margin-top: 6px; }
.refine { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.refine__search { position: relative; flex: 1 1 220px; display: flex; align-items: center; }
.refine__search svg { position: absolute; left: 13px; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.refine__search input { width: 100%; -webkit-appearance: none; appearance: none; background: var(--surface-2); border: 1px solid var(--border); color: var(--ink); border-radius: 11px; padding: 11px 13px 11px 38px; font-size: 14px; font-family: inherit; }
.refine__search input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.refine .inp { flex: 0 1 160px; }

/* ── Browse Sets ── */
.setbar { display: flex; gap: 10px; align-items: center; padding: 12px 14px; margin-top: 4px; flex-wrap: wrap; }
.setbar .search__field { flex: 1 1 320px; }
.set-meta { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 22px 2px 4px; }
.set-meta h2 { font-size: 24px; font-weight: 700; }
.set-meta__sub { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 4px; }
.set-meta__sub b { color: var(--ink-2); font-weight: 700; }
.set-toolbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin: 12px 0; flex-wrap: wrap; }

.setgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.setcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; }
.setcard:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: var(--shadow); }
.setcard__art { position: relative; aspect-ratio: 3/4; background: var(--raise); overflow: hidden; }
.setcard__art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.setcard__ph { width: 100%; height: 100%; background: linear-gradient(150deg, var(--raise), var(--surface-2)); }
.setcard__badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 5px; }
.setcard__add { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 9px; border: none; background: rgba(8,11,18,.74); backdrop-filter: blur(6px); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center; opacity: 0; transition: .15s; }
.setcard:hover .setcard__add { opacity: 1; }
.setcard__add:hover { background: var(--accent); color: #0b0f1c; }
.setcard__add.is-added { background: var(--pos); color: #06281b; opacity: 1; }
.setcard__body { padding: 11px 12px 13px; }
.setcard__num { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--muted); }
.setcard__name { font-size: 14px; font-weight: 600; margin: 2px 0 9px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.setcard__prices { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.setcard__raw { font-family: var(--font-mono); font-weight: 700; font-size: 17px; }
.setcard__raw .dash { color: var(--faint); }
.setcard__psa { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); text-align: right; }

/* ── Collections bar ── */
.collbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; flex-wrap: wrap; }
.collbar__left, .collbar__right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.icon-btn { width: 40px; height: 40px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2); cursor: pointer; display: grid; place-items: center; font-size: 15px; transition: .15s; }
.icon-btn:hover { color: var(--ink); border-color: var(--accent-line); }
.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.icon-mini { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); cursor: pointer; transition: .14s; font-size: 12px; }
.icon-mini:hover { color: var(--ink); border-color: var(--accent-line); }
.icon-mini--del:hover { color: var(--neg); border-color: var(--neg); }
.inv-row__note { font-size: 11px; color: var(--ink-2); font-style: italic; margin-top: 3px; opacity: .8; }
.inv-thumb--sm { width: 30px; height: 42px; }

/* ── add/edit card modal form ── */
.form-field { margin-bottom: 13px; }
.form-field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; -webkit-appearance: none; appearance: none;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink);
  border-radius: 11px; padding: 11px 13px; font-family: inherit; font-size: 14px;
}
.form-field textarea { resize: vertical; line-height: 1.5; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ── Markets ── */
.index-hero { display: grid; grid-template-columns: 280px 1fr; gap: 8px; padding: 22px 24px; align-items: center; margin-bottom: 16px; }
.index-hero__left { display: flex; flex-direction: column; gap: 6px; }
.index-hero__valrow { display: flex; align-items: center; gap: 12px; }
.index-hero__val { font-family: var(--font-mono); font-weight: 700; font-size: 52px; line-height: 1; letter-spacing: -0.03em; }
.index-hero__sub { font-size: 12px; color: var(--muted); }
.index-hero__chart { min-width: 0; }
.index-hero__chart .chartbox { max-height: 200px; }

.movers { padding: 18px 20px; }
.movers__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.movers__head h2 { font-size: 17px; font-weight: 700; }
.mover__name { font-size: 14px; font-weight: 600; }
.inv-table tbody tr[data-q] { cursor: pointer; }

/* ── Settings ── */
.set-source { padding: 18px 22px; }
.settings-panel { margin-top: 16px; }
.set-source .panel-head { margin-bottom: 12px; }
.set-source .panel-head h2 { font-size: 17px; }
.panel-head--split { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.set-note { font-size: 13px; color: var(--muted); margin: 0; max-width: 70ch; line-height: 1.6; }
.modesw--lg { padding: 4px; }
.modesw--lg button { padding: 9px 18px; font-size: 13px; }
.modesw--lg button.is-active { background: var(--raise); color: var(--ink); border-radius: 999px; }

.src-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 6px 0 18px; }
.src-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 15px 16px; }
.src-card__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.src-card__name { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.src-card__desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-bottom: 10px; }
.src-card__env { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); background: var(--raise); border-radius: 7px; padding: 6px 9px; word-break: break-word; }
.src-pill { font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.src-pill--loading { color: var(--muted); background: var(--raise); }
.src-pill--on { color: var(--pos); background: var(--pos-soft); }
.src-pill--off { color: var(--neg); background: var(--neg-soft); }
.src-pill--demo { color: var(--gold); background: var(--gold-soft); }

.keys-help { border-top: 1px solid var(--hairline); padding-top: 16px; }
.keys-help h3 { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.keys-help p { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.codeblock { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; color: var(--ink-2); background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 14px 16px; overflow-x: auto; margin: 0 0 12px; white-space: pre; }

.dir-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 10px; }
.dir-card { display: flex; align-items: center; gap: 12px; padding: 13px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); cursor: pointer; text-align: left; transition: .15s; }
.dir-card:hover { border-color: var(--accent-line); }
.dir-card.is-active { border-color: var(--accent-line); background: var(--accent-soft); }
.dir-card__sw { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(128,128,128,.3); }
.dir-card__txt { display: flex; flex-direction: column; line-height: 1.3; }
.dir-card__txt b { font-family: var(--font-ui); font-weight: 700; font-size: 14px; color: var(--ink); }
.dir-card__txt small { font-size: 12px; color: var(--muted); }

.storage-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.storage-stat { font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); }

/* ── responsive ── */
@media (max-width: 1080px) {
  .hide-md { display: none !important; }
  .dashboard { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .index-hero { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .nav { display: none; }
  .hamburger { display: flex; }
}
@media (max-width: 720px) {
  .setgrid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .collbar { flex-direction: column; align-items: stretch; }
  .collbar__right { justify-content: space-between; }
  .index-hero__val { font-size: 40px; }
}
