/* =============================================
   Sleeper Dashboard - Custom Styles
   ============================================= */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-hover: #30363d;
  --border-color: #30363d;
  --border-muted: #21262d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent-green: #238636;
  --accent-green-hover: #2ea043;
  --accent-blue: #1f6feb;
  --accent-red: #da3633;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);

  --pos-qb: #ef4444;
  --pos-rb: #22c55e;
  --pos-wr: #3b82f6;
  --pos-te: #f97316;
  --pos-k:  #a78bfa;
  --pos-default: #8b949e;
}

* { box-sizing: border-box; }

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  font-size: 14px;
  margin: 0;
  min-height: 100vh;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Navbar ---- */
.navbar {
  background-color: var(--bg-secondary) !important;
  border-bottom: 1px solid var(--border-color);
  padding: 0.6rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary) !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-brand .brand-icon {
  font-size: 1.3rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: default;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-hover);
}

.btn-refresh {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s;
}

.btn-refresh:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.btn-refresh.spinning .refresh-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---- Tabs ---- */
.main-tabs {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  display: flex;
  gap: 0;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
  border-bottom-color: var(--text-muted);
}

.tab-btn.active {
  color: var(--text-primary);
  border-bottom-color: #f97316;
}

/* ---- Main Content ---- */
.main-content {
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ---- Section Cards ---- */
.card-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.panel-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---- Rankings Toolbar ---- */
.rankings-toolbar {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--bg-tertiary);
}

.pos-filter-group {
  display: flex;
  gap: 0.25rem;
}

.pos-filter-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 5px;
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.03em;
}

.pos-filter-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.pos-filter-btn.active {
  color: #fff;
}

.pos-filter-btn[data-pos="ALL"].active { background: var(--bg-hover); border-color: var(--text-secondary); color: var(--text-primary); }
.pos-filter-btn[data-pos="QB"].active  { background: var(--pos-qb); border-color: var(--pos-qb); }
.pos-filter-btn[data-pos="RB"].active  { background: var(--pos-rb); border-color: var(--pos-rb); }
.pos-filter-btn[data-pos="WR"].active  { background: var(--pos-wr); border-color: var(--pos-wr); }
.pos-filter-btn[data-pos="TE"].active  { background: var(--pos-te); border-color: var(--pos-te); }
.pos-filter-btn[data-pos="K"].active   { background: var(--pos-k);  border-color: var(--pos-k); }

.search-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--text-primary);
  padding: 0.3rem 0.75rem 0.3rem 2rem;
  font-size: 0.85rem;
  width: 200px;
  outline: none;
  transition: border-color 0.15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%238b949e' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.099zm-5.44 1.298a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.5rem center;
}

.search-box:focus {
  border-color: var(--accent-blue);
}

.search-box::placeholder {
  color: var(--text-muted);
}

.rankings-info {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.unsaved-badge {
  background: #7c2d12;
  color: #fb923c;
  border: 1px solid #ea580c;
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  display: none;
}

.unsaved-badge.visible { display: inline-block; }

/* ---- Mode toggle (Dynasty / Best Ball) ---- */
.mode-toggle {
  display: flex;
  align-items: center;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  padding: 3px;
  gap: 2px;
}

.mode-btn {
  background: transparent;
  border: none;
  border-radius: 5px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.25rem 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.mode-btn:hover:not(.active) {
  color: var(--text-secondary);
}

.mode-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}

.btn-save {
  background: var(--accent-green);
  border: 1px solid var(--accent-green);
  color: #fff;
  border-radius: 5px;
  padding: 0.3rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-save:hover {
  background: var(--accent-green-hover);
  border-color: var(--accent-green-hover);
}

.btn-save:disabled {
  background: var(--bg-hover);
  border-color: var(--border-color);
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn-export {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 5px;
  padding: 0.3rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-export:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* ---- Player List ---- */
.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1.25rem;
  border-bottom: 1px solid var(--border-muted);
  transition: background 0.1s;
  user-select: none;
}

.player-row:last-child { border-bottom: none; }

.player-row:hover {
  background: var(--bg-tertiary);
}

.player-row.just-moved {
  animation: rowFlash 0.35s ease;
}

@keyframes rowFlash {
  0%   { background: rgba(35, 134, 54, 0.25); }
  100% { background: transparent; }
}

.player-row.hidden-row {
  display: none;
}

/* ── ROOKIES SECTION ── */
#rookie-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0 0 0.75rem 0;
  overflow: hidden;
  background: var(--bg-primary);
}
#rookie-section.joined-below {
  border-radius: 8px 8px 0 0;
  border-bottom: none;
  margin-bottom: 0;
}
#rookie-section .fa-section-header {
  background: rgba(251, 191, 36, 0.07);
}
.rookie-section-title {
  color: #f5a623;
}
.rookie-count-badge {
  background: rgba(251, 191, 36, 0.18);
  color: #f5a623;
}
#rookie-list {
  max-height: 320px;
  overflow-y: auto;
}

/* ── FREE AGENTS SECTION ── */
#fa-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0 0 0.75rem 0;
  overflow: hidden;
  background: var(--bg-primary);
}
#fa-section.joined-above {
  border-radius: 0 0 8px 8px;
  border-top: none;
}

.fa-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.9rem;
  background: rgba(248, 81, 73, 0.07);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.fa-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-red);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.fa-count-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(248, 81, 73, 0.18);
  color: var(--accent-red);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.fa-section-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.fa-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 5px;
  padding: 0.18rem 0.6rem;
  font-size: 0.72rem;
  cursor: pointer;
  white-space: nowrap;
}
.fa-toggle-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }

.fa-list {
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow-y: auto;
}

.fa-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.9rem;
  border-bottom: 1px solid rgba(48, 54, 61, 0.5);
  font-size: 0.84rem;
  transition: background 0.15s;
}
.fa-row:last-child { border-bottom: none; }
.fa-row:hover { background: var(--bg-secondary); }

.fa-rank-num {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 2.2rem;
  text-align: right;
}

.fa-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.fa-name {
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fa-pos {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.fa-age {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 2.5rem;
}

.fa-last-team {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 2.5rem;
  flex-shrink: 0;
}

.fa-slot-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.fa-slot-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.fa-rank-input {
  width: 4rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 5px;
  padding: 0.25rem 0.4rem;
  font-size: 0.8rem;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}
.fa-rank-input:focus { border-color: var(--accent-blue); }
.fa-rank-input::-webkit-inner-spin-button,
.fa-rank-input::-webkit-outer-spin-button { opacity: 0.4; }

.fa-slot-btn {
  background: var(--accent-blue);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.fa-slot-btn:hover { opacity: 0.82; }
.fa-slot-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.fa-skip-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 5px;
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.fa-skip-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }

/* ── END FREE AGENTS SECTION ── */

.arrow-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.arrow-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.arrow-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.arrow-btn:disabled {
  opacity: 0.15;
  cursor: default;
}

.rank-num {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 600;
  min-width: 32px;
  text-align: right;
  flex-shrink: 0;
  cursor: default;
}
.rank-num:hover { color: var(--text-secondary); }

.rank-num.top-10 { color: var(--text-primary); font-weight: 700; }
.rank-num.top-25 { color: var(--text-secondary); }

.rank-edit-input {
  width: 3.2rem;
  background: var(--bg-hover);
  border: 1px solid #388bfd;
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  padding: 0.1rem 0.2rem;
  outline: none;
  -moz-appearance: textfield;
}
.rank-edit-input::-webkit-outer-spin-button,
.rank-edit-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.player-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
}

.player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.player-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pos-badge {
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 3px;
  padding: 0.12rem 0.4rem;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.pos-badge.QB { background: rgba(239,68,68,0.15); color: var(--pos-qb); border: 1px solid rgba(239,68,68,0.3); }
.pos-badge.RB { background: rgba(34,197,94,0.15); color: var(--pos-rb); border: 1px solid rgba(34,197,94,0.3); }
.pos-badge.WR { background: rgba(59,130,246,0.15); color: var(--pos-wr); border: 1px solid rgba(59,130,246,0.3); }
.pos-badge.TE { background: rgba(249,115,22,0.15); color: var(--pos-te); border: 1px solid rgba(249,115,22,0.3); }
.pos-badge.K  { background: rgba(167,139,250,0.15); color: var(--pos-k);  border: 1px solid rgba(167,139,250,0.3); }

.team-tag {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.player-meta {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 1rem;
}

/* Dot + label treated as one column, tight gap between them */
.player-status {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  width: 90px;
  min-width: 90px;
}

.player-age {
  font-size: 0.78rem;
  color: var(--text-muted);
  width: 54px;
  text-align: right;
  flex-shrink: 0;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.active     { background: #22c55e; }
.status-dot.injured    { background: #ef4444; }
.status-dot.ir         { background: #f97316; }
.status-dot.questionable { background: #fbbf24; }
.status-dot.pup        { background: #a78bfa; }
.status-dot.inactive   { background: var(--text-muted); }

.status-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ---- Loading / Empty States ---- */
.loading-state, .empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

.loading-state p, .empty-state p {
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
}

/* ---- Options Tab ---- */
.options-section {
  max-width: 500px;
}

.options-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus {
  border-color: var(--accent-blue);
}

.form-hint {
  font-size: 0.77rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.btn-primary {
  background: var(--accent-blue);
  border: 1px solid var(--accent-blue);
  color: #fff;
  border-radius: 6px;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary:hover {
  background: #388bfd;
  border-color: #388bfd;
}

/* ---- Toast Notifications ---- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideIn 0.2s ease;
  max-width: 320px;
}

.toast.success { border-color: var(--accent-green); }
.toast.error   { border-color: var(--accent-red); }
.toast.info    { border-color: var(--accent-blue); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

/* ---- Username Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  width: 380px;
  max-width: 90vw;
  box-shadow: var(--shadow-md);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.modal-logo {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 1rem;
}

.modal-error {
  color: #f87171;
  font-size: 0.82rem;
  margin-top: 0.5rem;
  display: none;
}

.modal-error.visible { display: block; }

/* ---- Last Saved ---- */
.last-saved-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---- Drag disabled notice ---- */
.drag-notice {
  background: rgba(31,111,235,0.08);
  border: 1px solid rgba(31,111,235,0.2);
  border-radius: 5px;
  padding: 0.4rem 0.75rem;
  font-size: 0.77rem;
  color: #79b8ff;
  display: none;
}

.drag-notice.visible { display: inline-block; }

/* ---- Count badge ---- */
.count-badge {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}


/* =============================================
   League Rosters Tab
   ============================================= */

.league-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.league-selector-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.league-selector {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 0.45rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
  min-width: 260px;
  max-width: 380px;
  transition: border-color 0.15s;
}

.league-selector:focus { border-color: var(--accent-blue); }

.league-load-status {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---- Overall layout ---- */
.league-layout {
  display: flex;
  gap: 1rem;
  height: calc(100vh - 185px);
  overflow: hidden;
}

.league-left-panel {
  width: 265px;
  min-width: 265px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0; /* lets the flex item shrink so overflow-y scrolling works */
}

.league-left-panel > .card-panel {
  flex-shrink: 0; /* don't compress cards — scroll instead */
}

.league-teams-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding-bottom: 1rem;
}

/* ---- Left panel table ---- */
.league-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.league-table thead tr {
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.league-table th {
  padding: 0.45rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.league-table td {
  padding: 0.38rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.league-table tr:last-child td { border-bottom: none; }
.league-table tbody tr:nth-child(odd) td  { background: var(--bg-secondary); }
.league-table tbody tr:nth-child(even) td { background: var(--bg-tertiary); }
.league-table tbody tr:hover td { background: rgba(255,255,255,0.06); }

.league-table tr.my-row td,
.league-table tr.my-row:hover td {
  background: #485160 !important;
  font-weight: 600;
  color: var(--text-primary);
}

.col-center { text-align: center !important; }

.score-pill {
  display: inline-block;
  background: var(--bg-hover);
  border-radius: 10px;
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 32px;
  text-align: center;
}

.score-pill.elite  { color: #22c55e; }
.score-pill.good   { color: #86efac; }
.score-pill.avg    { color: #fbbf24; }
.score-pill.below  { color: #f87171; }

/* =============================================
   WAIVER WIRE TAB
   ============================================= */

.waiver-layout {
  display: flex;
  gap: 1rem;
  height: calc(100vh - 185px);
  overflow: hidden;
  padding: 0 1rem 1rem;
}

.waiver-left-panel {
  width: 248px;
  min-width: 248px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow: hidden;
  min-height: 0;
}

/* Compact table styling scoped to the left panel */
.waiver-left-panel .card-panel {
  flex-shrink: 0;
}

.waiver-left-panel .panel-header {
  padding: 0.4rem 0.7rem;
}

.waiver-left-panel .panel-title {
  font-size: 0.75rem;
}

.waiver-left-panel .league-table {
  font-size: 0.68rem;
  table-layout: fixed;
  width: 100%;
}

/* Fixed column widths: player fills remaining space, POS/TEAM/count are fixed */
.waiver-left-panel .league-table th:nth-child(1),
.waiver-left-panel .league-table td:nth-child(1) { width: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.waiver-left-panel .league-table th:nth-child(2),
.waiver-left-panel .league-table td:nth-child(2) { width: 38px; text-align: center; }
.waiver-left-panel .league-table th:nth-child(3),
.waiver-left-panel .league-table td:nth-child(3) { width: 38px; text-align: center; }
.waiver-left-panel .league-table th:nth-child(4),
.waiver-left-panel .league-table td:nth-child(4) { width: 58px; text-align: center; white-space: nowrap; }

.waiver-left-panel .league-table th {
  padding: 0.22rem 0.4rem;
  font-size: 0.63rem;
}

.waiver-left-panel .league-table td {
  padding: 0.16rem 0.4rem;
  border-bottom: 1px solid var(--border-muted);
}


.waiver-left-panel .pos-badge {
  font-size: 0.6rem;
  padding: 0.08rem 0.22rem;
  display: inline-block;
}

/* Timeframe Buttons */
.tf-btn-group {
  display: flex;
  gap: 0.25rem;
  padding: 0.3rem 0 0;
  flex-shrink: 0;
}

.tf-btn {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.22rem 0;
  border-radius: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.tf-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.tf-btn.active {
  background: #d97706;
  border-color: #d97706;
  color: #fff;
}

/* Waiver Columns Scroll Area */
.waiver-columns-scroll {
  flex: 1;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 0;
  padding-bottom: 0.5rem;
}

.waiver-column {
  min-width: 230px;
  width: 230px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.waiver-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.55rem 0.75rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.waiver-col-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.waiver-season-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.waiver-col-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.waiver-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.6rem;
  border-bottom: 1px solid var(--border-muted);
  font-size: 0.78rem;
}

.waiver-row:last-child { border-bottom: none; }
.waiver-row:nth-child(odd)  { background: var(--bg-secondary); }
.waiver-row:nth-child(even) { background: var(--bg-tertiary); }
.waiver-row.trending-hot { background: #485160 !important; }

.waiver-rank {
  font-size: 0.7rem;
  color: var(--text-muted);
  width: 22px;
  text-align: right;
  flex-shrink: 0;
}

.waiver-rank.top-rank {
  color: var(--text-primary);
  font-weight: 700;
}

.waiver-name {
  flex: 1;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.75rem;
}

.waiver-team {
  font-size: 0.68rem;
  font-weight: 600;
  flex-shrink: 0;
}

.trend-icon {
  font-size: 0.75rem;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

/* ---- Team Columns ---- */
.team-column {
  min-width: 245px;
  width: 245px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.team-column.my-team {
  border-color: rgba(35, 134, 54, 0.55);
  box-shadow: 0 0 0 1px rgba(35, 134, 54, 0.15);
}

.team-col-header {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.team-col-header.mine {
  background: rgba(35, 134, 54, 0.12);
}

.team-col-name {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-col-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-hover);
}

/* ---- Roster rows ---- */
.roster-row {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem 0.45rem;
  border-bottom: 1px solid var(--border-muted);
  min-height: 26px;
}

.roster-row:hover { background: var(--bg-tertiary); }

.slot-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 38px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.roster-player-name {
  font-size: 0.72rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  letter-spacing: -0.01em;
}

.roster-player-name.empty {
  color: var(--text-muted);
  font-style: italic;
}

.roster-team-tag {
  font-size: 0.65rem;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 22px;
  text-align: right;
}

.roster-rank-num {
  font-size: 0.66rem;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 24px;
  text-align: right;
}

.roster-rank-num.top-rank { color: var(--text-secondary); font-weight: 700; }

.col-section-header {
  padding: 0.22rem 0.45rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

/* ---- Owned Elsewhere ---- */
.owned-elsewhere-wrap {
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.owned-elsewhere-header {
  padding: 0.3rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.owned-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem 0.45rem;
  border-bottom: 1px solid var(--border-muted);
}

.owned-row:hover { background: var(--bg-tertiary); }

.owned-row:last-child { border-bottom: none; }

.owned-player-name {
  font-size: 0.71rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.owned-team-tag {
  font-size: 0.64rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.owned-count-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #fbbf24;
  flex-shrink: 0;
  min-width: 24px;
  text-align: right;
}

/* ---- Draft Picks rows ---- */
.pick-row {
  justify-content: flex-start;
  gap: 0.35rem;
}

.pick-season {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  min-width: 30px;
}

.pick-round {
  font-size: 0.71rem;
  font-weight: 700;
  color: var(--text-primary);
  flex-shrink: 0;
  min-width: 26px;
}

.pick-own {
  font-size: 0.67rem;
  color: var(--accent-green-hover);
  font-weight: 600;
}

.pick-via {
  font-size: 0.67rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =============================================
   DYNASTY RANKINGS — RENOVATED LAYOUT
   ============================================= */

.rankings-layout {
  display: flex;
  gap: 1rem;
  height: calc(100vh - 140px);
  overflow: hidden;
}

.rankings-main {
  flex: 3;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rankings-main .player-list {
  flex: 1;
  overflow-y: auto;
}

/* ---- Team Filter Select ---- */
.team-filter-select {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--text-primary);
  padding: 0.3rem 0.6rem;
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
  min-width: 90px;
  max-width: 130px;
}

.team-filter-select:focus {
  border-color: var(--accent-blue);
}

/* ---- Sort Buttons ---- */
.sort-btn-group {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  overflow: hidden;
}

.sort-btn {
  background: var(--bg-secondary);
  border: none;
  color: var(--text-secondary);
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.sort-btn + .sort-btn {
  border-left: 1px solid var(--border-color);
}

.sort-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.sort-btn.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Cap player-info width in rankings so ownership columns sit in the middle, not pinned right */
.rankings-main .player-info {
  max-width: 400px;
}

/* ---- Rank change delta indicator ---- */
.rank-delta {
  width: 3rem;
  min-width: 3rem;
  font-size: 0.67rem;
  font-weight: 700;
  text-align: center;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.rank-delta.up   { color: #22c55e; }
.rank-delta.down { color: #ef4444; }

/* ---- % Owned columns (hidden in Best Ball mode) ---- */
.mode-bb .player-my-ownership,
.mode-bb .player-ownership { display: none; }

.player-my-ownership,
.player-ownership {
  font-size: 0.75rem;
  font-weight: 600;
  width: 44px;
  text-align: right;
  flex-shrink: 0;
}

.player-my-ownership {
  cursor: pointer;
  border-radius: 4px;
  padding: 0.1rem 0.2rem;
  transition: background 0.12s;
}
.player-my-ownership:hover {
  background: var(--bg-hover);
  text-decoration: underline;
  text-decoration-style: dotted;
}

/* Right (league-wide) column: always gray, no color coding */
.player-ownership {
  color: var(--text-muted) !important;
}

/* Bold the primary sort column when in ownership sort mode */
.player-list.sort-ownership .player-my-ownership {
  font-weight: 800;
  font-size: 0.78rem;
}

/* Hide arrow buttons when in ownership sort mode */
.player-list.sort-ownership .arrow-btns {
  visibility: hidden;
  pointer-events: none;
}

/* =============================================
   PLAYER H2H PANEL
   ============================================= */

.h2h-panel {
  flex: 1;
  min-width: 230px;
  max-width: 300px;
  align-self: flex-start;
}

.h2h-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}

.h2h-range {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.h2h-range-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--text-primary);
  padding: 0.28rem 0.45rem;
  font-size: 0.82rem;
  width: 60px;
  outline: none;
  transition: border-color 0.15s;
  text-align: center;
}

.h2h-range-input:focus {
  border-color: var(--accent-blue);
}

.h2h-range-sep {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.h2h-matchup {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.h2h-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 1.5rem 0;
}

.h2h-player-btn {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  color: var(--text-primary);
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.h2h-player-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.h2h-player-btn.higher {
  border-color: var(--border-color);
  opacity: 0.85;
}

.h2h-player-btn.lower {
  border-color: var(--border-color);
}

.h2h-rank {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
  flex-shrink: 0;
}

.h2h-name {
  font-size: 0.85rem;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.h2h-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.h2h-vs {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin: 0.1rem 0;
}

.h2h-skip-btn {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  padding: 0.35rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  margin-bottom: 0.6rem;
}

.h2h-skip-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.h2h-disclosure {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.5;
  min-height: 1.2em;
}


/* =============================================
   ACTIVITY TAB
   ============================================= */

/* Header bar */
.activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.activity-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#activity-export-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.activity-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

/* Filter bar */
.activity-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.75rem;
}

.activity-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--text-primary);
  font-size: 0.82rem;
  padding: 0.3rem 0.5rem;
  height: 30px;
  cursor: pointer;
}

.activity-select:focus {
  outline: none;
  border-color: var(--accent-blue);
}

/* Type toggle group */
.activity-type-group {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  overflow: hidden;
}

.activity-type-btn {
  background: var(--bg-tertiary);
  border: none;
  border-right: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0 0.6rem;
  height: 30px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.03em;
}

.activity-type-btn:last-child {
  border-right: none;
}

.activity-type-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.activity-type-btn.active {
  background: var(--accent-blue);
  color: #fff;
}

/* Search inputs */
.activity-search {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--text-primary);
  font-size: 0.82rem;
  padding: 0.3rem 0.6rem;
  height: 30px;
  width: 140px;
  transition: border-color 0.15s;
}

.activity-search::placeholder {
  color: var(--text-muted);
}

.activity-search:focus {
  outline: none;
  border-color: var(--accent-blue);
}

/* Date range */
.activity-date-range {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.activity-date-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--text-primary);
  font-size: 0.8rem;
  padding: 0.3rem 0.4rem;
  height: 30px;
  width: 130px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.activity-date-input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

/* Chromium date picker icon tint */
.activity-date-input::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

.activity-date-sep {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Clear button */
.activity-clear-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  padding: 0 0.65rem;
  height: 30px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.activity-clear-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* Summary line */
.activity-summary {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.activity-summary strong {
  color: var(--text-secondary);
}

/* Table wrapper */
.activity-table-wrap {
  overflow-x: auto;
}

/* Table */
.activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.activity-table thead tr {
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.activity-table th {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.55rem 0.85rem;
  text-align: left;
  white-space: nowrap;
}

.activity-table tbody tr { transition: background 0.1s; }

.activity-table tbody tr:nth-child(odd)  td { background: var(--bg-secondary); }
.activity-table tbody tr:nth-child(even) td { background: var(--bg-tertiary); }
.activity-table tbody tr:hover td { background: rgba(255,255,255,0.06); }

.activity-table td {
  padding: 0.55rem 0.85rem;
  vertical-align: middle;
  color: var(--text-primary);
}

/* Column widths */
.activity-col-time   { width: 110px; }
.activity-col-league { width: 160px; }
.activity-col-type   { width: 90px;  }
.activity-col-manager { width: 150px; vertical-align: top; }

.activity-mgr-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0;
}
.activity-mgr-row + .activity-mgr-row {
  border-top: 1px solid var(--border-color);
  margin-top: 0.2rem;
  padding-top: 0.35rem;
}
.activity-mgr-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}
.activity-mgr-avatar-placeholder {
  background: var(--bg-hover);
}
.activity-mgr-name {
  font-size: 0.8rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-col-players { min-width: 200px; vertical-align: top; }
.activity-col-share  { width: 54px; text-align: center; }

/* Time cell */
.activity-time-abs {
  display: block;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.activity-time-rel {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-top: 0.1rem;
}

/* Type badges */
.activity-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.activity-badge-add    { background: rgba(35, 134, 54, 0.25); color: #3fb950; }
.activity-badge-drop   { background: rgba(218, 54, 51, 0.2);  color: #f85149; }
.activity-badge-trade  { background: rgba(31, 111, 235, 0.2); color: #58a6ff; }
.activity-badge-waiver { background: rgba(249, 115, 22, 0.2); color: #fb923c; }

/* Player chips */
.activity-player {
  display: inline-block;
  font-size: 0.8rem;
  margin-right: 0.35rem;
  white-space: nowrap;
}

.activity-player-add  { color: #3fb950; }
.activity-player-drop { color: #f85149; }

/* Trade per-manager sub-rows — spacing mirrors .activity-mgr-row */
.activity-trade-side {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.35rem;
  padding: 0.15rem 0;
  line-height: 1.4;
  min-height: calc(22px + 0.3rem); /* matches avatar row height */
}

.activity-trade-side + .activity-trade-side {
  border-top: 1px solid var(--border-color);
  margin-top: 0.2rem;
  padding-top: 0.35rem;
}

.activity-trade-mgr {
  color: var(--text-muted);
  font-size: 0.72rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Draft pick chip — purple tint to distinguish from players */
.activity-pick {
  color: #a78bfa;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ── Share button in activity table ── */
.activity-share-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem 0.4rem;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.activity-share-btn:hover {
  color: #58a6ff;
  border-color: #58a6ff44;
  background: rgba(31,111,235,0.1);
}

/* ── Share modal overlay ── */
.share-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
}

.share-modal-box {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 1.25rem 1.5rem 1.5rem;
  width: 1040px;
  max-width: 97vw;
  position: relative;
}

.share-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  transition: color 0.15s;
}
.share-modal-close:hover { color: var(--text-primary); }

.share-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  padding-right: 1.5rem;
}

.share-modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.2rem;
}
.share-modal-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

/* Template picker */
.share-tpl-picker {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
.share-tpl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  background: #21262d;
  border: 1px solid #30363d;
  color: var(--text-secondary);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.share-tpl-btn:hover { background: #30363d; color: var(--text-primary); }
.share-tpl-btn.active {
  background: rgba(31,111,235,0.15);
  border-color: #388bfd66;
  color: #58a6ff;
}

/* Loading state */
.share-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  height: 200px;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.share-loading-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid #30363d;
  border-top-color: #58a6ff;
  border-radius: 50%;
  animation: share-spin 0.8s linear infinite;
}
@keyframes share-spin { to { transform: rotate(360deg); } }

.share-card-wrap {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #21262d;
  line-height: 0;
  position: relative;
}
.share-card-wrap canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

.share-modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn-share-copy,
.btn-share-download {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
}
.btn-share-copy {
  background: #1f6feb;
  border: 1px solid #388bfd44;
  color: #fff;
}
.btn-share-copy:hover { background: #388bfd; }

.btn-share-download {
  background: #21262d;
  border: 1px solid #30363d;
  color: var(--text-secondary);
}
.btn-share-download:hover { background: #30363d; }

/* =============================================
   Notes Button (player row)
   ============================================= */
.notes-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  margin-left: 0.25rem;
}

.notes-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

/* Accent color when the player already has notes */
.notes-btn.has-notes {
  color: #f59e0b;
  border-color: #f59e0b44;
}
.notes-btn.has-notes:hover {
  background: rgba(245,158,11,0.1);
  border-color: #f59e0b88;
}

/* =============================================
   Flag Buttons (Best Ball / Dynasty targets)
   ============================================= */
.flag-btn {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  gap: 1px;
  padding: 0;
}

.flag-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.flag-label {
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}

.flag-btn.flag-green { color: #22c55e; border-color: rgba(34,197,94,0.3); }
.flag-btn.flag-green:hover { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.6); }

.flag-btn.flag-yellow { color: #f59e0b; border-color: rgba(245,158,11,0.3); }
.flag-btn.flag-yellow:hover { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.6); }

.flag-btn.flag-red { color: #ef4444; border-color: rgba(239,68,68,0.3); }
.flag-btn.flag-red:hover { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.6); }

/* =============================================
   Notes Modal
   ============================================= */
.notes-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}

.notes-modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.notes-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s;
}
.notes-modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

/* Box is relative so the close button can be absolute */
.notes-modal-box { position: relative; }

.notes-modal-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--border-muted);
  flex-shrink: 0;
}

.notes-player-thumb {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.notes-modal-player-info { flex: 1; min-width: 0; }

.notes-modal-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notes-modal-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

/* Compose */
.notes-compose {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border-muted);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.notes-textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.55;
  padding: 0.6rem 0.75rem;
  resize: vertical;
  min-height: 70px;
  transition: border-color 0.15s;
}
.notes-textarea:focus {
  outline: none;
  border-color: #388bfd;
}
.notes-textarea::placeholder { color: var(--text-muted); }

.notes-save-btn {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent-green);
  border: 1px solid transparent;
  border-radius: 6px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: background 0.12s;
}
.notes-save-btn:hover { background: var(--accent-green-hover); }
.notes-save-btn:disabled { opacity: 0.5; cursor: default; }

/* Thread */
.notes-thread {
  overflow-y: auto;
  flex: 1;
  padding: 0.75rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.notes-thread-empty {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
  padding: 1rem 0;
}

.note-entry {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-muted);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
}

.note-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.note-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

.note-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.1rem 0.25rem;
  border-radius: 3px;
  display: flex;
  align-items: center;
  transition: color 0.12s, background 0.12s;
}
.note-delete-btn:hover { color: #f87171; background: rgba(248,113,113,0.1); }

.note-text {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.55;
  word-break: break-word;
}

/* =============================================
   Ownership Popup
   ============================================= */
.ownership-popup {
  position: fixed;
  z-index: 3000;
  width: 248px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  overflow: hidden;
  animation: popupFadeIn 0.12s ease;
}

@keyframes popupFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.own-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border-muted);
}

.own-popup-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.own-popup-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  flex-shrink: 0;
  margin-left: 0.5rem;
  transition: color 0.1s, background 0.1s;
}
.own-popup-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.own-popup-body {
  max-height: 340px;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.own-section { padding: 0 0 0.4rem; }
.own-section + .own-section { border-top: 1px solid var(--border-muted); padding-top: 0.4rem; }

.own-section-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.75rem 0.3rem;
}

.own-section-label.own-have    { color: #22c55e; }
.own-section-label.own-missing { color: var(--text-muted); }

.own-league-row {
  font-size: 0.8rem;
  padding: 0.22rem 0.75rem 0.22rem 1.5rem;
  line-height: 1.4;
}

.own-league-row.have    { color: var(--text-primary); }
.own-league-row.missing { color: var(--text-muted); }
.own-league-row.none    { color: var(--text-muted); font-style: italic; }
