:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --win: #138a4b;
  --loss: #bd2f2f;
  --tie: #8a6a10;
  --pending: #5f6470;
  --shadow: 0 12px 30px rgba(18, 32, 48, 0.08);
  --sidebar-width: 260px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 440px) 1fr;
}

.login-panel {
  background: var(--panel);
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow);
}

.login-visual {
  background:
    linear-gradient(rgba(10, 17, 28, 0.1), rgba(10, 17, 28, 0.36)),
    url("https://images.unsplash.com/photo-1508344928928-7165b67de128?auto=format&fit=crop&w=1800&q=80")
      center / cover;
  min-height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  font-weight: 800;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.login-panel h1 {
  font-size: 32px;
  line-height: 1.05;
  margin-bottom: 12px;
}

.login-panel p {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 28px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

label {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 9px 11px;
  background: white;
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 3px solid rgba(15, 118, 110, 0.16);
  border-color: var(--accent);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.icon-btn,
.menu-btn {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-btn {
  width: 100%;
  background: var(--accent);
  color: white;
}

.secondary-btn {
  background: #e7f2f1;
  color: #075e56;
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
}

.hint {
  margin-top: 18px;
  padding: 12px;
  border-radius: 8px;
  background: #f0f5f5;
  color: #315450;
  font-size: 13px;
}

.error {
  color: var(--loss);
  min-height: 20px;
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.app-shell.sidebar-closed {
  grid-template-columns: 0 1fr;
}

.sidebar {
  background: #101820;
  color: white;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--sidebar-width);
  overflow: hidden;
  transition: transform 180ms ease, width 180ms ease, padding 180ms ease;
  z-index: 30;
}

.sidebar-closed .sidebar {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  transform: translateX(-100%);
}

.scrim {
  display: none;
}

.sidebar .brand {
  margin: 0;
  justify-content: space-between;
  min-width: 212px;
}

.brand-copy {
  min-width: 0;
  flex: 1;
}

.sidebar .eyebrow,
.sidebar small {
  color: #a9b6c6;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  text-align: left;
  padding: 12px;
  border-radius: 8px;
  background: transparent;
  color: #c8d2df;
  font-weight: 800;
}

.nav button.active {
  background: #243442;
  color: white;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  padding: 0;
  background: #22313e;
  color: white;
  font-size: 22px;
}

.menu-btn {
  display: grid;
  place-items: center;
  width: 42px;
  padding: 0;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  flex: 0 0 auto;
}

.main {
  padding: 28px;
  display: grid;
  gap: 22px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.title-block h1 {
  font-size: 28px;
  margin-bottom: 6px;
}

.title-block p {
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel-pad {
  padding: 18px;
}

.filter-heading {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.filter-reset {
  order: -1;
  flex: 0 0 auto;
}

.filter-heading h2 {
  font-size: 18px;
  margin-bottom: 4px;
}

.filter-heading p {
  color: var(--muted);
  line-height: 1.45;
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
}

.explain-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.explain-strip > div {
  background: #edf7f6;
  border: 1px solid #cce6e3;
  border-radius: 8px;
  padding: 14px;
  color: #244845;
  line-height: 1.45;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
}

.kpi {
  padding: 16px;
  border-left: 4px solid var(--accent);
}

.kpi.win {
  border-left-color: var(--win);
}

.kpi.tie {
  border-left-color: #d49b14;
}

.kpi.loss {
  border-left-color: var(--loss);
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  min-width: 0;
}

.grid-2 > * {
  min-width: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h2 {
  font-size: 18px;
}

.panel-header span {
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.legend span {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-win {
  background: var(--win);
}

.legend-tie {
  background: #d49b14;
}

.legend-loss {
  background: var(--loss);
}

.chart {
  width: 100%;
  height: 300px;
  display: block;
}

.table-wrap {
  overflow: auto;
  max-height: 540px;
  max-width: 100%;
}

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

.records-table {
  min-width: 720px;
  table-layout: fixed;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  white-space: nowrap;
}

.records-table th,
.records-table td {
  white-space: normal;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9fafb;
  color: #475467;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-weight: 800;
  font-size: 12px;
}

.badge.Ganado {
  color: var(--win);
  background: #e8f7ee;
}

.badge.Perdido {
  color: var(--loss);
  background: #fdeeee;
}

.badge.Empate {
  color: var(--tie);
  background: #fff5d7;
}

.badge.Pendiente {
  color: var(--pending);
  background: #edf0f5;
}

.location-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 7px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.location-badge.away {
  color: #0b5c7a;
  background: #e4f4fb;
}

.location-badge.home {
  color: #6f3f00;
  background: #fff0d9;
}

.score-line {
  display: grid;
  gap: 3px;
  color: #344054;
  line-height: 1.25;
}

.score-line span:first-child {
  font-weight: 800;
  color: var(--ink);
}

.score-line strong {
  color: var(--accent);
  font-size: 12px;
}

.records-list {
  display: grid;
  gap: 0;
}

.records-head,
.record-row {
  display: grid;
  grid-template-columns: 120px minmax(220px, 1fr) minmax(260px, 1fr);
  gap: 12px;
  align-items: center;
}

.records-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9fafb;
  border-bottom: 1px solid var(--line);
  color: #475467;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  text-transform: uppercase;
}

.record-row {
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.record-date {
  display: grid;
  gap: 8px;
}

.matchup {
  display: grid;
  gap: 6px;
}

.matchup > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.muted-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.record-pitcher {
  font-weight: 700;
  color: #344054;
}

.record-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: center;
}

.record-summary .score-line {
  grid-column: 1 / -1;
}

.team-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.team-logo,
.team-logo-fallback {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}

.team-logo {
  object-fit: contain;
}

.team-logo-fallback {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8edf3;
  color: #344054;
  font-size: 10px;
  font-weight: 900;
}

.records-table th:nth-child(1),
.records-table td:nth-child(1) {
  width: 92px;
}

.records-table th:nth-child(2),
.records-table td:nth-child(2) {
  width: 118px;
}

.records-table th:nth-child(5),
.records-table td:nth-child(5) {
  width: 130px;
}

.records-table th:nth-child(6),
.records-table td:nth-child(6) {
  width: 160px;
}

.records-table th:nth-child(7),
.records-table td:nth-child(7) {
  width: 92px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.compact-panel {
  box-shadow: none;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.inline-form .field {
  margin-bottom: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chips span {
  border-radius: 999px;
  background: #edf0f5;
  color: #344054;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.quality-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  line-height: 1.45;
  padding-left: 18px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1060px) {
  .app-shell,
  .app-shell.sidebar-closed,
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    transform: translateX(-100%);
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
    width: var(--sidebar-width);
    padding: 24px;
  }

  .sidebar-open .scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 32, 0.48);
    z-index: 20;
  }

  .filters,
  .kpis,
  .grid-2,
  .form-grid,
  .explain-strip,
  .inline-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .main,
  .login-panel,
  .sidebar {
    padding: 18px;
  }

  .filters,
  .kpis,
  .grid-2,
  .form-grid,
  .explain-strip,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
  }

  .topbar .secondary-btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .title-block h1 {
    font-size: 23px;
  }

  table {
    min-width: 760px;
  }

  .records-table {
    min-width: 680px;
  }

  .records-head {
    display: none;
  }

  .record-row {
    grid-template-columns: 1fr;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 10px;
  }

  .records-list {
    gap: 10px;
  }
}
