/* ============================================================
   Skin.TF V2 — UI layer.
   Builds on the existing design tokens in style.css (same --bg,
   --panel, --accent, etc.) so everything re-themes automatically in
   light AND dark mode. Scoped to .v2-* + small, purposeful nav/mobile
   improvements. No heavy animation.
   ============================================================ */

:root {
  --v2-gap: 1rem;
  --v2-radius: 12px;
  --v2-shadow: 0 8px 24px rgba(0,0,0,.18);
}

/* ---------- layout ---------- */
.v2-wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.v2-narrow { max-width: 760px; }
.v2-head { margin-bottom: 1.25rem; }
.v2-head h1 { margin: 0 0 .25rem; font-family: 'Barlow Condensed', system-ui, sans-serif; letter-spacing: .5px; }
.v2-back { display: inline-block; margin-bottom: .75rem; color: var(--text-dim); text-decoration: none; font-size: .9rem; }
.v2-back:hover { color: var(--accent); }
.v2-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--v2-gap); }
.v2-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--v2-gap); }
@media (max-width: 820px) { .v2-grid-2, .v2-grid-3 { grid-template-columns: 1fr; } }

/* ---------- cards ---------- */
.v2-card {
  background: linear-gradient(180deg, var(--panel), var(--panel-end));
  border: 1px solid var(--line); border-radius: var(--v2-radius);
  padding: 1.1rem 1.2rem; margin-bottom: var(--v2-gap); box-shadow: var(--v2-shadow);
}
.v2-card h2 { margin: 0 0 .75rem; font-size: 1.1rem; color: var(--text-bright); }
.v2-tile { text-decoration: none; color: inherit; transition: border-color .15s ease, transform .15s ease; display: block; }
.v2-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.v2-tile-icon { font-size: 1.8rem; margin-bottom: .4rem; }

/* ---------- forms ---------- */
.v2-form label { display: block; margin-bottom: .7rem; font-size: .85rem; color: var(--text-dim); }
.v2-form input[type=text], .v2-form input[type=number], .v2-form select, .v2-form textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .55rem .65rem;
  background: var(--bg-2); color: var(--text-bright); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); font-family: inherit; font-size: .95rem;
}
.v2-form textarea { resize: vertical; }
.v2-form input:focus, .v2-form select:focus, .v2-form textarea:focus { outline: none; border-color: var(--accent); }
.v2-form-inline { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.v2-form-inline label { margin-bottom: 0; }
.v2-form-inline input, .v2-form-inline select { width: auto; min-width: 130px; }
.v2-form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem 1rem; }
@media (max-width: 820px) { .v2-form-grid { grid-template-columns: 1fr 1fr; } }
.v2-check { display: inline-flex !important; align-items: center; gap: .4rem; }
.v2-check input { width: auto !important; margin: 0; }
.v2-btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------- tables ---------- */
.v2-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.v2-table th, .v2-table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.v2-table th { color: var(--text-dim); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.v2-table tbody tr:hover { background: var(--bg-2); }
.v2-row-off { opacity: .5; }
.v2-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }

/* ---------- badges / statuses ---------- */
.v2-badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 600;
  background: var(--bg-2); color: var(--text-dim); border: 1px solid var(--line-2); white-space: nowrap; }
.v2-good, .v2-status-accepted, .v2-status-resolved { color: var(--good); border-color: var(--good); }
.v2-bad, .v2-status-failed, .v2-status-cancelled, .v2-status-expired { color: var(--bad); border-color: var(--bad); }
.v2-status-open, .v2-status-waiting_staff { color: var(--accent-2); border-color: var(--accent); }
.v2-status-offer_sent, .v2-status-processing, .v2-status-queued, .v2-status-waiting_user { color: var(--pending); border-color: var(--pending); }
.v2-prio-urgent { color: #fff; background: var(--bad); border-color: var(--bad); }
.v2-prio-high { color: var(--bad); border-color: var(--bad); }
.v2-prio-low { opacity: .7; }

/* ---------- dots ---------- */
.v2-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .4rem; background: var(--text-dim); }
.v2-dot.on { background: var(--good); box-shadow: 0 0 6px var(--good); }
.v2-dot.off { background: var(--bad); }

/* ---------- stats ---------- */
.v2-stat-row { display: flex; flex-wrap: wrap; gap: var(--v2-gap); margin-bottom: var(--v2-gap); }
.v2-stat { flex: 1; min-width: 130px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--v2-radius); padding: 1rem; text-align: center; }
.v2-stat-n { display: block; font-size: 1.8rem; font-weight: 700; color: var(--text-bright); font-family: 'Barlow Condensed', sans-serif; }
.v2-stat-l { font-size: .8rem; color: var(--text-dim); }

/* ---------- tabs ---------- */
.v2-tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: var(--v2-gap); border-bottom: 1px solid var(--line); }
.v2-tabs a { padding: .5rem .9rem; text-decoration: none; color: var(--text-dim); border-bottom: 2px solid transparent; text-transform: capitalize; }
.v2-tabs a.active { color: var(--accent-2); border-bottom-color: var(--accent); }

/* ---------- ticket thread ---------- */
.v2-ticket-list { list-style: none; padding: 0; margin: 0; }
.v2-ticket-list li a { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .6rem .2rem; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.v2-ticket-list li a:hover { color: var(--text-bright); }
.v2-ticket-subj { font-weight: 600; flex: 1; }
.v2-ticket-meta { color: var(--text-dim); font-size: .8rem; }
.v2-thread { display: flex; flex-direction: column; gap: .7rem; margin: 1rem 0; }
.v2-msg { padding: .7rem .9rem; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); max-width: 85%; }
.v2-msg-user { align-self: flex-end; background: var(--bg-2); }
.v2-msg-staff { align-self: flex-start; border-color: var(--accent); }
.v2-msg-internal { border-style: dashed; border-color: var(--pending); background: transparent; }
.v2-msg-who { font-size: .72rem; color: var(--text-dim); margin-bottom: .25rem; text-transform: uppercase; letter-spacing: .04em; }
.v2-msg-body { white-space: pre-wrap; color: var(--text-bright); }
.v2-msg-time { font-size: .7rem; color: var(--text-dim); margin-top: .3rem; }
.v2-reply { margin-top: 1rem; }
.v2-controls { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }

/* ---------- preview ---------- */
.v2-preview { margin-top: .8rem; }
.v2-preview-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 1rem; }
@media (max-width: 820px) { .v2-preview-grid { grid-template-columns: 1fr; } }
.v2-preview-h { font-size: .75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.v2-preview-ok { color: var(--good); margin-top: .3rem; }
.v2-preview-bad { color: var(--bad); margin-top: .3rem; }
.v2-preview pre { background: var(--bg-2); padding: .6rem; border-radius: 8px; overflow: auto; max-height: 200px; }

/* ---------- alerts / empty ---------- */
.v2-alert { padding: .7rem 1rem; border-radius: 8px; margin-bottom: var(--v2-gap); border: 1px solid var(--line-2); }
.v2-alert-bad { color: var(--bad); border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.v2-empty { text-align: center; padding: 2.5rem 1rem; }
.v2-empty-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.v2-empty-sm { padding: 1rem 0; }
.v2-contact-row { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: 1rem; }
.v2-guide ol { margin: .5rem 0 0; padding-left: 1.2rem; }
.v2-guide li { margin-bottom: .35rem; }
.v2-queue-list { margin: 0; padding-left: 1.2rem; }

/* ---------- skeleton loaders (reusable, S2) ---------- */
.v2-skeleton { background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 37%, var(--panel) 63%);
  background-size: 400% 100%; animation: v2-shimmer 1.4s ease infinite; border-radius: 8px; }
.v2-skeleton.line { height: .8rem; margin: .4rem 0; }
.v2-skeleton.tile { height: 120px; }
@keyframes v2-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .v2-skeleton { animation: none; } }

/* ---------- toast ---------- */
#v2-toasts { position: fixed; bottom: 1rem; right: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 9999; }
.v2-toast { background: var(--panel); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); color: var(--text-bright);
  padding: .6rem .9rem; border-radius: 8px; box-shadow: var(--v2-shadow); max-width: 320px; font-size: .9rem; }
.v2-toast.bad { border-left-color: var(--bad); }
.v2-toast.good { border-left-color: var(--good); }

/* ---------- header: mobile menu + steam-items pill (S2/S7) ---------- */
.nav-toggle { display: none; background: none; border: 1px solid var(--line-2); color: var(--text);
  border-radius: var(--radius-sm); padding: .35rem .5rem; cursor: pointer; }
.nav-toggle svg { display: block; width: 22px; height: 22px; }
.nav-link-steam { display: inline-flex; align-items: center; gap: .3rem; }
.nav-link-steam svg { width: 15px; height: 15px; }

@media (max-width: 880px) {
  .nav-toggle { display: inline-block; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--panel); border-bottom: 1px solid var(--line); padding: .4rem 0;
    max-height: 0; overflow: hidden; transition: max-height .2s ease; gap: 0;
  }
  .nav-links.open { max-height: 80vh; overflow: auto; }
  .nav-links a { padding: .7rem 1.1rem; border-bottom: 1px solid var(--line); }
  .nav-inner { position: relative; flex-wrap: wrap; }
}

/* ---- site trust banners (S4) ---- */
.v2-sitebanner { padding: .6rem 1rem; text-align: center; font-size: .92rem; border-bottom: 1px solid var(--line);
  background: var(--panel-2); color: var(--text-bright); }
.v2-sitebanner a { color: var(--accent-2); text-decoration: none; font-weight: 600; }
.v2-sitebanner-success { background: color-mix(in srgb, var(--good) 14%, var(--panel-2)); border-bottom-color: var(--good); }
.v2-sitebanner-warning { background: color-mix(in srgb, var(--bad) 12%, var(--panel-2)); border-bottom-color: var(--bad); }

/* ---- Steam Items: two-inventory layout, cloned from the TF2 trade page (S14) ---- */
.si-page { max-width: 1180px; margin: 0 auto; }
.si-head { margin-bottom: .6rem; }
.si-head h1 { margin: 0 0 .2rem; }
.si-cats { margin-bottom: .7rem; }
/* two equal inventories: your items | bot items */
.columns.cols-steam { grid-template-columns: 1fr 1fr; align-items: stretch; }
.cols-steam .col { min-height: 360px; }
.cols-steam .grid { max-height: calc(100vh - 320px); }
/* selected tile highlight (matches trade-page accent) */
.item.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.item.sel:hover { border-color: var(--accent); }
/* "load more" pseudo-tile */
.item.si-more { background: var(--bg-2); color: var(--accent-2); font-size: 1.6rem; font-weight: 700; }
.item.si-more .price { color: var(--accent-2); }
/* non-marketable corner marker */
.item .count.nm { background: var(--scrim-strong); color: var(--bad); font-size: .6rem; }
/* empty / loading / error states inside a grid */
.grid-empty { grid-column: 1 / -1; padding: 2rem .8rem; text-align: center; color: var(--text-dim); font-size: .9rem; }
.grid-empty.err { color: var(--bad); }
.grid-empty a { color: var(--accent-2); }

/* sticky bottom action bar (replaces the trade page's middle offer column) */
.si-actionbar {
  position: sticky; bottom: 0; z-index: 10; margin-top: .8rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem;
  padding: .7rem 1rem; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 -6px 18px rgba(0,0,0,.28);
}
.si-bar-summ { flex: 1 1 240px; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; font-family: 'Barlow Condensed', sans-serif; letter-spacing: .02em; }
.si-bar-sell { color: var(--good); font-weight: 600; }
.si-bar-buy { color: var(--accent-2); font-weight: 600; }
.si-bar-sep { color: var(--text-dim); }
.si-bar-hint { color: var(--text-dim); font-size: .82rem; font-style: italic; }
.si-bar-act { display: flex; gap: .5rem; }
.si-bar-status { flex: 1 1 100%; font-size: .86rem; color: var(--text-dim); min-height: 1.1em; }
.si-bar-status a { color: var(--accent-2); }
.si-err { color: var(--bad); }
@media (max-width: 720px) {
  .columns.cols-steam { grid-template-columns: 1fr; }
  .cols-steam .grid { max-height: 52vh; }
}

/* ---- Steam Items / other-game claim list (row cards used by the shop game panel) ---- */
.v2-si-grid { display: grid; grid-template-columns: 1fr; gap: .6rem; }
.v2-si { display: flex; align-items: center; gap: .8rem; }
.v2-si > div { flex: 1; min-width: 0; }
@media (min-width: 640px) { .v2-si-grid { grid-template-columns: 1fr 1fr; } }

/* ---- Coin Shop: big game tiles (multi-game landing, S5/14) ---- */
.shop-games-bar { display: flex; flex-wrap: wrap; gap: .7rem; margin: .2rem 0 1rem; }
.shop-game-tile {
  flex: 0 0 auto; width: 150px;
  display: flex; flex-direction: column; align-items: stretch;
  padding: 0; overflow: hidden; cursor: pointer; font: inherit;
  background: var(--panel-2, var(--panel)); color: var(--text);
  border: 1px solid var(--line-2, var(--line)); border-radius: var(--radius);
  transition: transform .1s ease, border-color .12s ease, box-shadow .12s ease;
}
.shop-game-tile:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 6px 16px rgba(0,0,0,.4); }
.shop-game-tile.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.shop-game-art {
  display: flex; align-items: center; justify-content: center;
  width: 100%; aspect-ratio: 460 / 215; min-height: 70px;
  background: var(--bg-2); overflow: hidden;
}
.shop-game-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shop-game-emoji { font-size: 2.6rem; line-height: 1; }
.shop-game-name {
  padding: .5rem .4rem; text-align: center;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 600;
  letter-spacing: .02em; font-size: .95rem;
}
@media (max-width: 560px) {
  .shop-games-bar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: .3rem; }
  .shop-game-tile { width: 120px; }
}
