/* ── Table wrap ── */
.table-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

/* ── Shared table base ── */
#results-table,
#browser-table,
#favorites-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

#results-table th,
#browser-table th,
#favorites-table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 1;
}

#results-table td,
#browser-table td,
#favorites-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#results-table tbody tr:nth-child(even):not(.row-done) td,
#browser-table  tbody tr:nth-child(even):not(.row-done) td,
#favorites-table tbody tr:nth-child(even):not(.row-done) td { background: var(--bg3); }

#results-table tbody tr:hover td,
#browser-table  tbody tr:hover td,
#favorites-table tbody tr:hover td { background: var(--bg4); }

#results-table tbody tr:last-child td,
#browser-table  tbody tr:last-child td,
#favorites-table tbody tr:last-child td { border-bottom: none; }

/* ── Completed row gold tint ── */
#results-table tbody tr.row-done td,
#browser-table  tbody tr.row-done td,
#favorites-table tbody tr.row-done td { background: var(--gold-bg); }

#results-table tbody tr.row-done:hover td,
#browser-table  tbody tr.row-done:hover td,
#favorites-table tbody tr.row-done:hover td { background: rgba(180,140,40,0.20); }

#results-table tbody tr.row-done:nth-child(even) td,
#browser-table  tbody tr.row-done:nth-child(even) td,
#favorites-table tbody tr.row-done:nth-child(even) td { background: rgba(240,220,100,0.18); }

#browser-table tbody tr.row-done td { opacity: 0.55; }
#browser-table tbody tr.row-done:hover td { opacity: 0.8; }

/* ── Column widths ── */
.col-pct     { width: 70px; }
.col-prog    { width: 160px; }
.col-name    { width: auto; }
.col-reward  { width: 240px; }
.col-actions { width: 100px; }

td.col-pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

td.col-prog    { color: var(--muted); font-variant-numeric: tabular-nums; }
td.col-reward  { color: var(--muted); font-size: 13px; }

td.col-actions {
  white-space: nowrap;
  text-align: right;
  padding-right: 8px;
  overflow: visible;
}

/* ── Percent classes ── */
.pct-high { color: var(--green); }
.pct-med  { color: var(--yellow); }
.pct-low  { color: var(--text); }
.pct-done { color: var(--green); font-size: 12px; }
.pct-na   { color: var(--muted); }

/* ── Reward icons ── */
.ap-icon      { width: 20px; height: 20px; vertical-align: -5px; margin-right: 2px; }
.mastery-icon { width: 24px; height: 24px; vertical-align: -5px; margin-right: 2px; }
.reward-icon  { width: 18px; height: 18px; vertical-align: -4px; margin-right: 2px; }

.item-reward-icon {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: var(--bg3);
  object-fit: cover;
  vertical-align: -5px;
  margin-right: 2px;
}
[data-theme="light"] .item-reward-icon { border-color: rgba(0, 0, 0, 0.2); }
.col-reward .item-reward-label { display: none; }

/* ── Row name button ── */
.ach-row-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: color 0.1s;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.ach-row-btn:hover { color: var(--accent); }

/* ── Empty row ── */
.empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 4rem 0;
  border: none;
  background: transparent !important;
}

/* ── Progress bar ── */
.prog-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  font-size: 12px;
  min-height: 32px;
  justify-content: center;
}

.prog-bar-bg {
  width: 100%;
  height: 4px;
  background: var(--bg4);
  border-radius: 99px;
  overflow: hidden;
}

.prog-bar-bg.invisible {
  visibility: hidden;
}

.prog-bar-fill { height: 100%; border-radius: 99px; transition: width 0.3s ease; }

/* ── Hidden rows ── */
tr.row-hidden td { opacity: 0.35; }
tr.row-hidden:hover td { opacity: 0.65; }

/* ── Row action buttons ── */
.row-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.1s, background 0.1s;
  vertical-align: middle;
}

.row-action-btn:hover                { color: var(--text); background: var(--bg4); }
.row-action-btn.active.row-fav-btn   { color: var(--gold); }
.row-action-btn.active.row-fav-btn svg { fill: currentColor; }
.row-action-btn.active.row-hide-btn  { color: var(--red); }

/* ── Skeleton loading rows ── */
.skeleton-row td { border-bottom: 1px solid var(--border-soft); }

.skel {
  display: inline-block;
  height: 10px;
  border-radius: 4px;
  background: var(--bg4);
  animation: skel-pulse 1.4s ease-in-out infinite;
}

.skel-sm  { width: 36px; }
.skel-md  { width: 100px; }
.skel-lg  { width: 180px; }

@keyframes skel-pulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1;   }
}