/* THE LEDGER — dark hardwood / leather-orange front-office theme */
:root {
  --wood-0: #0d0a07;   /* deepest hardwood */
  --wood-1: #14100b;   /* app bg */
  --wood-2: #1c1710;   /* panel */
  --wood-3: #241d14;   /* raised panel */
  --wood-4: #2f2619;   /* border / grain */
  --leather: #3a2c1c;
  --orange: #ee6730;   /* basketball / leather-orange accent */
  --orange-2: #f2864f;
  --amber: #d9a441;
  --ink: #f4ece0;      /* warm off-white */
  --ink-2: #c8b8a2;
  --muted: #9a866e;
  --line: #2c2317;
  --green: #57a06a;
  --red: #cf5b4e;
  --blue: #5b8fb0;
  --radius: 12px;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --head: 'Oswald', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;
  --shadow: 0 8px 28px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--body);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(238,103,48,.10), transparent 60%),
    repeating-linear-gradient(90deg, transparent 0 38px, rgba(255,255,255,.010) 38px 39px),
    var(--wood-1);
  min-height: 100vh;
}

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--wood-2), var(--wood-1));
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 44px; height: 44px; display: grid; place-items: center; font-size: 22px;
  border-radius: 10px; background: radial-gradient(circle at 35% 30%, var(--orange-2), var(--orange) 55%, #b8451c);
  box-shadow: inset 0 -6px 12px rgba(0,0,0,.35), 0 4px 10px rgba(238,103,48,.3);
}
.brand-text h1 {
  font-family: var(--head); font-weight: 700; letter-spacing: 3px;
  margin: 0; font-size: 22px; color: var(--ink);
}
.brand-text p { margin: 2px 0 0; font-size: 12px; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.pill {
  font-family: var(--mono); font-size: 12px; padding: 6px 11px; border-radius: 999px;
  background: var(--wood-3); border: 1px solid var(--wood-4); color: var(--amber);
}
.sync { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.sync.ok::before { content: '● '; color: var(--green); }
.sync.warn::before { content: '● '; color: var(--amber); }
.livepill { color: var(--green); font-family: var(--mono); font-size: 11px; margin-left: 8px; white-space: nowrap; letter-spacing: .3px; }
.livepill.warn { color: var(--amber); }

/* ---- tabs ---- */
.tabs {
  display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--line);
  background: var(--wood-1); position: sticky; top: 72px; z-index: 15; overflow-x: auto;
}
.tabs button {
  font-family: var(--head); font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase;
  font-size: 13px; color: var(--muted); background: none; border: none; cursor: pointer;
  padding: 15px 16px; border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabs button:hover { color: var(--ink-2); }
.tabs button.active { color: var(--orange-2); border-bottom-color: var(--orange); }

/* ---- layout ---- */
.view { padding: 22px; max-width: 1240px; margin: 0 auto; }
.loading { color: var(--muted); padding: 60px; text-align: center; font-family: var(--mono); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-family: var(--head); letter-spacing: 1.5px; text-transform: uppercase; font-size: 18px; margin: 0; }
.section-head .sub { color: var(--muted); font-size: 13px; }

/* ---- controls ---- */
select, input, button.btn {
  font-family: var(--body); font-size: 14px; color: var(--ink);
  background: var(--wood-3); border: 1px solid var(--wood-4); border-radius: 9px; padding: 9px 12px;
}
select:focus, input:focus { outline: 2px solid var(--orange); }
button.btn { cursor: pointer; font-weight: 600; }
button.btn.primary { background: linear-gradient(180deg, var(--orange-2), var(--orange)); color: #1a0e06; border: none; }
button.btn.primary:hover { filter: brightness(1.06); }
.chipbar { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-family: var(--mono); font-size: 12px; padding: 6px 10px; border-radius: 999px; cursor: pointer;
  background: var(--wood-2); border: 1px solid var(--wood-4); color: var(--ink-2);
}
.chip.active { background: var(--orange); color: #1a0e06; border-color: var(--orange); font-weight: 600; }

/* ---- cards / grid ---- */
.grid { display: grid; gap: 14px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.panel { background: linear-gradient(180deg, var(--wood-2), var(--wood-1)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* player row */
.player {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.player:last-child { border-bottom: none; }
.player .avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--wood-3); object-fit: cover; border: 1px solid var(--wood-4); }
.player .name { font-weight: 600; font-size: 15px; }
.player .meta { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.player .sal { font-family: var(--mono); font-weight: 600; text-align: right; }
.player .sal small { color: var(--muted); display: block; font-weight: 500; }
.pos-badge {
  display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 5px; background: var(--leather); color: var(--amber); margin-left: 6px;
}
.inj { color: var(--red); font-size: 11px; font-family: var(--mono); }

/* team card header */
.team-card .team-head {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line);
}
.team-card .team-logo { width: 40px; height: 40px; object-fit: contain; }
.team-card .team-name { font-family: var(--head); font-size: 16px; letter-spacing: .5px; }
.team-card .team-sub { font-size: 12px; color: var(--muted); font-family: var(--mono); }

/* ---- tables ---- */
table.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
table.ledger th {
  text-align: left; font-family: var(--head); font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  font-size: 12px; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--wood-4); position: sticky; top: 0;
  background: var(--wood-2); cursor: pointer;
}
table.ledger td { padding: 11px 14px; border-bottom: 1px solid var(--line); }
table.ledger tr:hover td { background: rgba(255,255,255,.02); }
table.ledger td.num, table.ledger th.num { text-align: right; font-family: var(--mono); }

/* cap bar / meter */
.capbar { position: relative; height: 12px; border-radius: 6px; background: var(--wood-3); overflow: hidden; }
.capbar > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; }
.band-under-cap { background: var(--green); }
.band-over-cap { background: var(--blue); }
.band-tax { background: var(--amber); }
.band-first-apron { background: var(--orange); }
.band-second-apron { background: var(--red); }
.tag {
  font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 600; white-space: nowrap;
}
.tag.band-under-cap { background: rgba(87,160,106,.18); color: var(--green); }
.tag.band-over-cap { background: rgba(91,143,176,.18); color: var(--blue); }
.tag.band-tax { background: rgba(217,164,65,.18); color: var(--amber); }
.tag.band-first-apron { background: rgba(238,103,48,.18); color: var(--orange-2); }
.tag.band-second-apron { background: rgba(207,91,78,.20); color: var(--red); }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--wood-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.tile .v { font-family: var(--mono); font-size: 24px; font-weight: 600; margin-top: 6px; color: var(--ink); }
.tile .v.orange { color: var(--orange-2); }

/* trade builder */
.trade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.trade-side .add-row { display: flex; gap: 8px; margin: 10px 14px; }
.trade-side .add-row select { flex: 1; }
.trade-verdict { margin-top: 16px; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--wood-4); background: var(--wood-2); }
.trade-verdict.legal { border-color: rgba(87,160,106,.5); }
.trade-verdict.illegal { border-color: rgba(207,91,78,.5); }
.verdict-line { font-family: var(--head); letter-spacing: 1px; text-transform: uppercase; font-size: 18px; }
.verdict-line.legal { color: var(--green); }
.verdict-line.illegal { color: var(--red); }
.sel-player { display: flex; justify-content: space-between; padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.sel-player button { background: none; border: none; color: var(--red); cursor: pointer; font-size: 15px; }

/* timeline */
.timeline .evt { display: grid; grid-template-columns: 96px 1fr; gap: 14px; padding: 14px; border-bottom: 1px solid var(--line); }
.timeline .evt .when { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.timeline .evt .what { font-size: 14px; }
.timeline .evt .src { font-size: 11px; color: var(--orange-2); font-family: var(--mono); margin-top: 4px; }
.kind-transaction .what::before { content: '🔁 '; }
.kind-news .what::before { content: '📰 '; }

/* typable team combo */
.team-combo { min-width: 210px; }
input[list] { background: var(--wood-3); border: 1px solid var(--wood-4); color: var(--ink); border-radius: 9px; padding: 9px 12px; font-size: 14px; font-family: var(--body); }

/* move-odds tags */
.tag.move-stay { background: rgba(87,160,106,.18); color: var(--green); }
.tag.move-high { background: rgba(238,103,48,.18); color: var(--orange-2); }
.tag.move-med { background: rgba(217,164,65,.18); color: var(--amber); }
.tag.move-low { background: rgba(154,134,110,.18); color: var(--muted); }

/* intel panel header */
.intel-h { font-family: var(--head); letter-spacing: 1px; text-transform: uppercase; font-size: 13px; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); }

/* inline contract edit */
.edit-sal { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0 2px; opacity: .5; }
.edit-sal:hover { color: var(--orange-2); opacity: 1; }

/* misc */
a { color: var(--orange-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.note { color: var(--muted); font-size: 12px; font-style: italic; margin: 4px 0 14px; }
.empty { color: var(--muted); padding: 40px; text-align: center; font-family: var(--mono); }
.foot { display: flex; justify-content: space-between; gap: 12px; padding: 16px 22px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@media (max-width: 720px) { .trade-grid { grid-template-columns: 1fr; } .tabs { top: 68px; } }
