:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #7d8590;
  --accent: #58a6ff;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --over-bg: rgba(248, 81, 73, 0.07);
  --under-bg: rgba(63, 185, 80, 0.07);
  --over-border: rgba(248, 81, 73, 0.3);
  --under-border: rgba(63, 185, 80, 0.3);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* ─── HEADER ────────────────────────────────────────────────────────────────── */

.header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
  white-space: nowrap;
}

.header-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.steam-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  width: 240px;
  outline: none;
  transition: border-color 0.15s;
}
.steam-input:focus { border-color: var(--accent); }
.steam-input::placeholder { color: var(--text-muted); }
.steam-input.input-error {
  border-color: var(--red);
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.login-btn {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.login-btn:hover { opacity: 0.85; }

.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-steam-icon {
  font-size: 18px;
  color: var(--accent);
}

.user-steam-id {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-family: 'Courier New', monospace;
  letter-spacing: 0.5px;
}

.logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.logout-btn:hover { border-color: var(--red); color: var(--red); }

.header-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.next-update {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.next-update-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.next-update-timer {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── NAV TABS ──────────────────────────────────────────────────────────────── */

.main-nav {
  display: flex;
  gap: 0;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}

.main-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -1px;
  letter-spacing: 0.2px;
}
.main-tab:hover { color: var(--text); }
.main-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ─── STATS BAR ─────────────────────────────────────────────────────────────── */

.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px 24px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0;
}

/* First stat card (Total Market Cap / Portfolio Value) gets accent top border */
.stats-bar .stat-card:first-child {
  border-top: 2px solid var(--accent);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-value--small {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

/* MCap changes in stat card */
.mcap-changes {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.mcap-change-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.mcap-change-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}

.chg-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
  font-weight: 600;
}

.chg-up   { color: var(--green); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chg-down { color: var(--red);   font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chg-zero { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chg-none { color: var(--text-muted); font-size: 12px; }

/* ─── TABLE CONTAINER ───────────────────────────────────────────────────────── */

.table-container {
  padding: 0 24px 40px;
}

.table-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.search-input {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  width: 220px;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

.filter-btns { display: flex; gap: 6px; }

.filter-btn {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}
.filter-btn:hover { color: var(--text); border-color: var(--text-muted); }
.filter-btn.active { background: var(--bg3); color: var(--text); border-color: var(--accent); }
.filter-btn--over.active { border-color: var(--red); color: var(--red); background: rgba(248,81,73,0.08); }
.filter-btn--under.active { border-color: var(--green); color: var(--green); background: rgba(63,185,80,0.08); }

/* ─── TABLE ─────────────────────────────────────────────────────────────────── */

.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.items-table thead {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

.items-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  user-select: none;
}

.items-table th.sortable { cursor: pointer; }
.items-table th.sortable:hover { color: var(--text); }
.items-table th.active-sort { color: var(--accent); }

.items-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.items-table tbody tr {
  background: var(--bg);
  cursor: pointer;
  transition: background 0.12s ease;
}
.items-table tbody tr:hover { background: var(--bg3); }
.items-table tbody tr:hover td { border-bottom-color: var(--border); }
.items-table tbody tr:last-child td { border-bottom: none; }

.items-table tbody tr.row-overpriced {
  background: var(--over-bg);
}
.items-table tbody tr.row-overpriced td:first-child {
  box-shadow: inset 3px 0 0 var(--red);
}
.items-table tbody tr.row-undervalued {
  background: var(--under-bg);
}
.items-table tbody tr.row-undervalued td:first-child {
  box-shadow: inset 3px 0 0 var(--green);
}

/* ─── COLUMN WIDTHS ─────────────────────────────────────────────────────────── */

.col-rank   { width: 36px; text-align: center; }
.col-img    { width: 48px; padding-left: 12px !important; padding-right: 6px !important; }
.col-name   { width: 26%; min-width: 160px; }
.col-price  { width: 120px; white-space: nowrap; }
.col-supply { width: 80px; }
.col-cap    { width: 120px; white-space: nowrap; }
.col-changes{ width: 144px; padding-left: 4px !important; padding-right: 4px !important; }
.col-chart  { width: 100px; }
.col-qty    { width: 54px; }
.col-pct    { width: 100px; }

/* ─── TABLE CELL CONTENT ────────────────────────────────────────────────────── */

.rank {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.item-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 4px;
  background: var(--bg3);
  display: block;
}

.items-table td:nth-child(2) {
  overflow: hidden;
  vertical-align: middle;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.item-img-placeholder {
  width: 36px;
  height: 36px;
  background: var(--bg3);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 16px;
}

.item-name {
  font-weight: 500;
  font-size: 13px;
  line-height: 1.3;
}

.item-name-line {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
}

.item-name-line > span:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}

.item-name-line .badge,
.item-name-line .timeleft-inline {
  flex-shrink: 0;
}

.item-price {
  font-weight: 600;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.item-supply {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.item-cap {
  font-weight: 600;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ─── BADGES ────────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: middle;
}

.badge-overpriced {
  background: rgba(248, 81, 73, 0.15);
  color: var(--red);
  border: 1px solid rgba(248, 81, 73, 0.35);
}

.badge-undervalued {
  background: rgba(63, 185, 80, 0.15);
  color: var(--green);
  border: 1px solid rgba(63, 185, 80, 0.35);
}

.badge-normal { display: none; }

/* ─── TIMELEFT BADGE ────────────────────────────────────────────────────────── */

.timeleft-inline { display: inline-flex; align-items: center; }

.timeleft-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: rgba(210, 153, 34, 0.15);
  color: #e3a219;
  border: 1px solid rgba(210, 153, 34, 0.35);
  white-space: nowrap;
  line-height: 1.5;
  vertical-align: middle;
}

.timeleft-expired {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  color: var(--text-muted);
}

/* ─── ORIGINAL PRICE ────────────────────────────────────────────────────────── */

.orig-price {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  font-family: 'Courier New', monospace;
}

/* ─── CHANGES COLUMN ────────────────────────────────────────────────────────── */

.changes-header {
  display: flex;
  gap: 0;
  width: 100%;
}

.changes-header span {
  flex: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.item-changes { }

.mobile-24h { display: none; }

.changes-grid {
  display: flex;
  gap: 0;
}

.changes-grid > div {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ─── LOADING ROW ────────────────────────────────────────────────────────────── */

.loading-row td {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ─── MODAL ─────────────────────────────────────────────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.modal-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--bg3);
  flex-shrink: 0;
}

.modal-title-block { flex: 1; min-width: 0; }
.modal-title-block h2 { font-size: 18px; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-meta { font-size: 12px; color: var(--text-muted); }

.modal-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--bg3); color: var(--text); }

.modal-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.tab-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.modal-chart-container {
  background: var(--bg);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  height: 220px;
}
.modal-chart-container canvas { max-height: 188px; }

.modal-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 480px) {
  .modal-stats { grid-template-columns: repeat(4, 1fr); }
}

.modal-stat {
  background: var(--bg3);
  border-radius: 6px;
  padding: 10px 14px;
}
.modal-stat-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.4px; }
.modal-stat-value { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ─── SCROLLBAR ─────────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── PORTFOLIO CHART ───────────────────────────────────────────────────────── */

/* ─── PORTFOLIO GUEST STATE ─────────────────────────────────────────────────── */

#portfolioGuest {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 80px 24px;
}

.portfolio-guest-msg {
  text-align: center;
  max-width: 360px;
}

.portfolio-guest-icon {
  font-size: 48px;
  color: var(--accent);
  margin-bottom: 16px;
  opacity: 0.6;
}

.portfolio-guest-msg h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.portfolio-guest-msg p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ─── PORTFOLIO CHART ───────────────────────────────────────────────────────── */

.portfolio-chart-container {
  margin: 0 24px 16px;
  padding: 14px 20px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.portfolio-chart-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.portfolio-chart-tabs {
  display: flex;
  gap: 4px;
}

.portfolio-chart-tab {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
}
.portfolio-chart-tab:hover { color: var(--text); }
.portfolio-chart-tab.active { background: var(--bg3); color: var(--accent); border-color: var(--accent); }

.portfolio-chart-canvas-wrap {
  height: 180px;
}

/* ─── PORTFOLIO SECTION ─────────────────────────────────────────────────────── */

.refresh-btn {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.refresh-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.refresh-btn:disabled { opacity: 0.5; cursor: default; }

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

.item-qty {
  font-weight: 600;
  color: var(--accent);
  font-family: 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
}

.item-pct {
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ─── MOBILE ────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {

  /* Header */
  .header {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    height: auto;
    padding: 10px 16px;
    gap: 8px;
  }

  .header-left {
    grid-column: 1;
    grid-row: 1;
  }

  .header-right {
    grid-column: 2;
    grid-row: 1;
  }

  .header-center {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }

  .logo {
    font-size: 13px;
    letter-spacing: 0.5px;
  }

  .steam-input {
    width: 100%;
    min-width: 0;
    flex: 1;
  }

  .login-area {
    width: 100%;
  }

  .user-area {
    width: 100%;
    flex-wrap: wrap;
  }

  .next-update-label { font-size: 9px; }
  .next-update-timer { font-size: 13px; }

  /* Nav */
  .main-nav {
    padding: 0 16px;
  }

  .main-tab {
    padding: 9px 14px;
    font-size: 13px;
  }

  /* Stats bar */
  .stats-bar {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px 16px;
  }

  .stat-card {
    padding: 12px 14px;
  }

  .stat-value {
    font-size: 18px;
  }

  .stat-value--small {
    font-size: 13px;
  }

  .mcap-changes {
    gap: 8px;
    margin-top: 8px;
  }

  /* Table container */
  .table-container {
    padding: 0 16px 32px;
  }

  .table-controls {
    gap: 8px;
  }

  .search-input {
    width: 100%;
  }

  .filter-btns {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .filter-btn {
    padding: 7px 8px;
    text-align: center;
    font-size: 11px;
  }

  /* Table */
  .items-table th,
  .items-table td {
    padding: 8px 10px;
  }

  .col-rank { width: 28px; }
  .col-img  { width: 40px; padding-left: 10px !important; padding-right: 4px !important; }
  .col-name { min-width: 140px; }
  .col-price { width: 85px; }
  .col-supply { width: 70px; }
  .col-cap { width: 90px; }
  .col-changes { width: 130px; }

  .item-img,
  .item-img-placeholder {
    width: 30px;
    height: 30px;
  }

  .item-img-placeholder { font-size: 14px; }

  .stat-value { font-size: 16px; }

  /* Portfolio chart */
  .portfolio-chart-container {
    margin: 0 16px 12px;
    padding: 12px 14px 14px;
  }

  .portfolio-chart-canvas-wrap {
    height: 150px;
  }

  /* Modal */
  .modal {
    padding: 16px;
    max-height: 95vh;
  }

  .modal-title-block h2 {
    font-size: 15px;
  }
}

/* Sticky first 3 columns on mobile horizontal scroll:
   col-rank (36px) + col-img (40px) + col-name = sticky block = 76px offset for name */
@media (max-width: 768px) {
  .items-table th.col-rank,
  .items-table td.rank {
    position: sticky;
    left: 0;
    z-index: 3;
  }

  .items-table th.col-img,
  .items-table td:nth-child(2) {
    position: sticky;
    left: 28px;
    z-index: 3;
  }

  .items-table th.col-name,
  .items-table td.item-name {
    position: sticky;
    left: 68px;
    z-index: 3;
  }

  /* thead sticky cells background */
  .items-table thead th.col-rank,
  .items-table thead th.col-img,
  .items-table thead th.col-name {
    background: var(--bg2);
  }

  /* tbody default */
  .items-table tbody td.rank,
  .items-table tbody td:nth-child(2),
  .items-table tbody td.item-name {
    background: var(--bg);
  }

  /* Row colour variants */
  .items-table tbody tr.row-overpriced td.rank,
  .items-table tbody tr.row-overpriced td:nth-child(2),
  .items-table tbody tr.row-overpriced td.item-name {
    background: #160f0f;
  }
  .items-table tbody tr.row-undervalued td.rank,
  .items-table tbody tr.row-undervalued td:nth-child(2),
  .items-table tbody tr.row-undervalued td.item-name {
    background: #0e1610;
  }

  /* hover state */
  .items-table tbody tr:hover td.rank,
  .items-table tbody tr:hover td:nth-child(2),
  .items-table tbody tr:hover td.item-name {
    background: var(--bg2);
  }

  /* Fade shadow on right edge to hint scrollability */
  .table-wrapper {
    background: var(--bg);
  }
}

@media (max-width: 480px) {
  .stats-bar { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stats-bar .stat-card:first-child { grid-column: 1 / -1; }
  .stat-value { font-size: 20px; }
  .steam-input { width: 180px; font-size: 12px; }

  /* Hide columns */
  #itemsTable .col-supply, #itemsTable td:nth-child(5),
  #itemsTable .col-changes, #itemsTable td:nth-child(7) { display: none; }
  #portfolioTable .col-qty, #portfolioTable td:nth-child(5),
  #portfolioTable .col-pct, #portfolioTable td:nth-child(7) { display: none; }

  /* Badges */
  .item-name-line { flex-wrap: nowrap; }
  .item-name .badge, .item-name-line .badge { display: none; }

  /* Table layout — fixed so name column fills remaining space */
  .table-container { padding: 0 8px 24px; }
  .items-table th, .items-table td { padding: 7px 5px; }
  .items-table { table-layout: fixed; width: 100%; min-width: 0; }

  /* Column widths: rank(28) | img(30) | name(auto) | price(80) | mcap(75) */
  .col-rank  { width: 28px; }
  .col-img   { width: 30px; padding-left: 3px !important; padding-right: 3px !important; }
  /* col-name has no width — fills all remaining space */
  .col-price { width: 80px; }
  .col-cap   { width: 75px; }

  /* Image */
  .item-img, .item-img-placeholder { width: 24px; height: 24px; }

  /* Price wraps — orig-price shows on new lines */
  .item-price { white-space: normal; }
  .orig-price { font-size: 10px; line-height: 1.3; }

  /* Name td: just clip overflow, nothing else */
  td.item-name { overflow: hidden; }

  /* Truncate only the TEXT span inside the name cell */
  .item-name > span:first-child,
  .item-name-line span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
  }

  /* 24h change under name — mobile only */
  .mobile-24h { display: block; font-size: 11px; margin-top: 2px; }

  /* Remove sticky */
  .items-table th.col-rank, .items-table td.rank,
  .items-table th.col-img,  .items-table td:nth-child(2),
  .items-table th.col-name, .items-table td.item-name { position: static; }
}
