:root {
  --bg: #f3f4f6;
  --bg-top: #f8fafc;
  --bg-soft: #e5e7eb;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --card-subtle: #f8fafc;
  --text: #111827;
  --text-dim: #4b5563;
  --accent: #0284c7;
  --accent-2: #0369a1;
  --border: #d1d5db;
  --border-soft: #e5e7eb;
  --control-bg: #f9fafb;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --radius: 16px;
  --shadow: 0 10px 28px rgba(17, 24, 39, 0.08);
}

body.dark-theme {
  --bg: #0b1220;
  --bg-top: #111827;
  --bg-soft: #1f2937;
  --surface: #111827;
  --surface-2: #1f2937;
  --card-subtle: #0f172a;
  --text: #e5e7eb;
  --text-dim: #9ca3af;
  --accent: #38bdf8;
  --accent-2: #7dd3fc;
  --border: #374151;
  --border-soft: #334155;
  --control-bg: #0f172a;
  --danger: #f87171;
  --ok: #4ade80;
  --warn: #fbbf24;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
}

.bg-pattern {
  display: none;
}

.launch-screen {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.8rem 1rem 2.6rem;
  animation: reveal 450ms ease;
}

.hero {
  padding: 2.2rem 1rem 1.4rem;
  max-width: 1180px;
  margin: 0 auto;
  animation: reveal 450ms ease;
}

.team-grid {
  margin-top: 1.2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.7rem;
}

.team-tile {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.75rem 0.45rem;
  min-height: 120px;
  display: grid;
  place-items: center;
  gap: 0.28rem;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.team-tile img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.team-tile .team-code {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.08em;
}

.team-tile .team-name {
  font-size: 0.66rem;
  text-align: center;
  color: var(--text-dim);
  line-height: 1.25;
}

.team-tile.logo-missing {
  background: var(--surface-2);
}

.team-tile.logo-missing span {
  color: var(--text);
  letter-spacing: 0.06em;
}

.team-tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(2, 132, 199, 0.14);
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

.hero-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.hero-team-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: inherit;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1.05;
  margin-top: 0.45rem;
}

h2 {
  font-size: 1.55rem;
}

h3 {
  font-size: 1.25rem;
}

.hero-copy {
  margin: 0.85rem 0 1rem;
  max-width: 69ch;
  color: var(--text-dim);
  font-size: 0.98rem;
  line-height: 1.45;
}

.hero-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.chip {
  font-size: 0.78rem;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--control-bg);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
}

.chip-accent {
  color: var(--text);
  border-color: rgba(2, 132, 199, 0.45);
  background: rgba(2, 132, 199, 0.08);
}

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1rem 2.2rem;
  display: grid;
  gap: 1rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  animation: reveal 400ms ease;
}

.launch-ranking {
  margin-top: 1rem;
}

.launch-ranking table {
  min-width: 980px;
}

.launch-cap-note {
  margin: 0.35rem 0 0.7rem;
  color: var(--text-dim);
  font-size: 0.86rem;
}

.launch-team-cell {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.launch-rank-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.controls {
  display: grid;
  gap: 0.95rem;
}

.summary-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.7rem;
}

.summary-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.offseason-view {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  display: grid;
  gap: 0.9rem;
}

.offseason-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1rem 2rem;
  display: grid;
  gap: 0.9rem;
}

.offseason-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
}

.offseason-header-main {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.offseason-team-logo {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  object-fit: contain;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
}

.offseason-kpis {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.offseason-timeline {
  padding-top: 0.8rem;
}

.timeline-track {
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.timeline-node {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 0.55rem 0.6rem;
  background: var(--surface-2);
}

.timeline-node span {
  display: block;
  font-size: 0.74rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.timeline-node small {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.9rem;
  color: var(--text);
}

.timeline-node.active {
  border-color: rgba(2, 132, 199, 0.55);
  background: rgba(2, 132, 199, 0.12);
}

.timeline-node.completed {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.12);
}

.phase-action-panel {
  margin-bottom: 0.9rem;
}

.offseason-sheet-grid {
  display: grid;
  gap: 1rem;
}

.sheet-panel {
  padding: 0.85rem;
}

.market-controls {
  margin-top: 0.55rem;
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.market-controls input,
.market-controls select {
  width: 100%;
  margin-top: 0.2rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 0.5rem 0.6rem;
  font-family: inherit;
}

.sheet-table-wrap {
  margin-top: 0.65rem;
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
}

.draft-board-wrap {
  max-height: 72vh;
}

.draft-log-wrap {
  max-height: 52vh;
}

.draft-source-note {
  margin: 0.45rem 0 0;
  color: var(--text-dim);
  font-size: 0.76rem;
}

.draft-needs-note {
  margin: 0.2rem 0 0.55rem;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.sheet-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: var(--surface);
}

.sheet-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

.sheet-table tbody tr:hover {
  background: rgba(2, 132, 199, 0.08);
}

.sheet-table .roster-player-cell img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.draft-spotlight {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 0.7rem;
  align-items: center;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 0.7rem;
  background: var(--surface-2);
}

.draft-feed-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.draft-feed-card {
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  border-radius: 11px;
  padding: 0.5rem;
}

.draft-feed-card p {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.draft-feed-card-current {
  border-color: rgba(2, 132, 199, 0.45);
  background: rgba(2, 132, 199, 0.1);
}

.draft-spotlight img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.draft-spotlight-team {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-dim);
}

.draft-spotlight-player {
  margin: 0.12rem 0;
  font-size: 1rem;
  font-weight: 700;
}

.draft-spotlight-meta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.team-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.team-chip img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

body.draft-phase-theme {
  --bg-top: #1f2937;
  --bg: #111827;
  --surface: #0f172a;
  --surface-2: #1e293b;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --border: #334155;
  --border-soft: #334155;
  --accent: #f59e0b;
  --accent-2: #fbbf24;
}

.savings-cell {
  min-width: 120px;
}

.savings-cell strong {
  display: block;
  font-size: 0.78rem;
}

.savings-track {
  margin-top: 0.22rem;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.28);
  overflow: hidden;
}

.savings-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.savings-positive strong {
  color: var(--ok);
}

.savings-positive .savings-track span {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.savings-negative strong {
  color: var(--danger);
}

.savings-negative .savings-track span {
  background: linear-gradient(90deg, #f87171, #dc2626);
}

.action-cell {
  display: flex;
  gap: 0.4rem;
}

.action-cell .btn {
  min-width: 108px;
  justify-content: center;
}

.impact-kpi {
  margin: 0.2rem 0 0.35rem;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  padding: 0.55rem 0.65rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.impact-kpi span {
  color: var(--text-dim);
  font-size: 0.75rem;
}

.impact-kpi strong {
  font-size: 1rem;
}

.impact-positive {
  background: rgba(34, 197, 94, 0.1);
}

.impact-positive strong {
  color: var(--ok);
}

.impact-negative {
  background: rgba(239, 68, 68, 0.12);
}

.impact-negative strong {
  color: var(--danger);
}

.cap-error-card {
  border-color: rgba(220, 38, 38, 0.28);
}

.cap-error-card h2 {
  color: #b91c1c;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 40;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  width: min(680px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.modal-body {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.35rem;
}

.modal-body p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.86rem;
}

.modal-actions {
  margin-top: 0.8rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.modal-input-grid {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.modal-input-grid label {
  font-size: 0.78rem;
}

.modal-input-grid input {
  margin-top: 0.25rem;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 0.5rem 0.6rem;
  font-family: inherit;
}

.summary-meta {
  margin: 0.35rem 0 0;
  color: var(--text-dim);
  font-size: 0.86rem;
}

.top-paid-wrap {
  margin-top: 1rem;
}

.summary-lists {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.compact-list li {
  margin-bottom: 0.35rem;
  color: var(--text-dim);
  font-size: 0.84rem;
}

.summary-entry {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.summary-entry img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-soft);
}

.control-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

label {
  display: grid;
  gap: 0.44rem;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.82rem;
}

select,
button {
  font-family: inherit;
}

select {
  appearance: none;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 0.64rem 0.72rem;
  font-size: 0.93rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.62rem;
}

.btn {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 0.62rem 0.92rem;
  font-weight: 700;
  font-size: 0.86rem;
  background: var(--control-bg);
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-primary {
  background: linear-gradient(160deg, #0ea5e9, #0284c7);
  border-color: transparent;
  color: #fff;
}

.btn-success {
  background: linear-gradient(160deg, #22c55e, #16a34a);
  border-color: transparent;
  color: #fff;
}

.btn-danger {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.32);
}

.btn-cut-action {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.46);
  color: #b91c1c;
  box-shadow: 0 1px 0 rgba(220, 38, 38, 0.15) inset;
}

.btn-restructure-action {
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.46);
  color: #0369a1;
  box-shadow: 0 1px 0 rgba(2, 132, 199, 0.14) inset;
}

.btn-cut-action:hover {
  background: rgba(220, 38, 38, 0.14);
  border-color: rgba(220, 38, 38, 0.62);
}

.btn-restructure-action:hover {
  background: rgba(2, 132, 199, 0.14);
  border-color: rgba(2, 132, 199, 0.62);
}

.kpi-grid {
  margin-top: 0.72rem;
  display: grid;
  gap: 0.72rem;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.team-focus-banner {
  margin-top: 0.72rem;
  border-radius: 14px;
  border: 1px solid rgba(73, 214, 255, 0.36);
  background: linear-gradient(160deg, rgba(73, 214, 255, 0.14), rgba(255, 145, 77, 0.08));
  padding: 0.7rem 0.8rem;
}

.team-focus-banner strong {
  display: block;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
}

.team-focus-banner small {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-dim);
}

.kpi-card {
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  padding: 0.72rem;
}

.kpi-card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kpi-card strong {
  margin-top: 0.28rem;
  display: block;
  font-size: 1.02rem;
}

.roster-wrap {
  margin-top: 1rem;
}

.roster-wrap .table-wrap {
  margin-top: 0.55rem;
  max-height: 420px;
  overflow: auto;
}


.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 660px;
}

th,
td {
  text-align: left;
  padding: 0.64rem 0.4rem;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.86rem;
}

tbody tr.row-selected {
  background: rgba(2, 132, 199, 0.1);
}

th {
  color: var(--accent-2);
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.sort-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  padding: 0;
}

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

.status-ok {
  color: var(--ok);
}

.status-warning {
  color: var(--warn);
}

.status-over {
  color: var(--danger);
}

.value-positive {
  color: var(--ok);
}

.value-negative {
  color: var(--danger);
}

.list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: grid;
  gap: 0.52rem;
}

.list li {
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  padding: 0.64rem 0.7rem;
  font-size: 0.84rem;
}

.list small {
  display: block;
  color: var(--text-dim);
  margin-top: 0.18rem;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 0.58rem;
}

.player-row img {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: contain;
  background: var(--bg-soft);
  image-rendering: -webkit-optimize-contrast;
}

.full-roster-title {
  margin-top: 0.9rem;
}

.full-roster {
  margin-top: 0.75rem;
}

.full-roster-table-wrap {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  overflow: auto;
  background: var(--card-subtle);
  max-height: 520px;
}

.full-roster-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.full-roster-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.full-roster-table tbody tr:hover {
  background: rgba(2, 132, 199, 0.08);
}

.roster-player-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.roster-player-cell img {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: contain;
  background: var(--bg-soft);
  image-rendering: -webkit-optimize-contrast;
}

.roster-card {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--card-subtle);
  padding: 0.62rem;
}

.roster-card p {
  margin: 0.28rem 0 0;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.roster-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.roster-head img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg-soft);
}

.top-controls {
  position: fixed;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 20;
  display: flex;
  gap: 0.45rem;
}

.theme-toggle {
  position: static;
}

.footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1rem 1.8rem;
  color: var(--text-dim);
  font-size: 0.78rem;
}

@media (max-width: 760px) {
  .hero {
    padding-top: 1.45rem;
  }

  .offseason-header {
    flex-direction: column;
    align-items: stretch;
  }

  .draft-feed-grid {
    grid-template-columns: 1fr;
  }

}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
